Skip to content

feat: add vault transfer (deposit/withdraw) support#33

Merged
ifdario merged 1 commit intoinfinitefield:mainfrom
lihaostar:feat/vault-deposit-withdraw
Mar 9, 2026
Merged

feat: add vault transfer (deposit/withdraw) support#33
ifdario merged 1 commit intoinfinitefield:mainfrom
lihaostar:feat/vault-deposit-withdraw

Conversation

@lihaostar
Copy link

@lihaostar lihaostar commented Mar 8, 2026

Summary

  • Add VaultTransfer action struct with RMP+Agent signing support
  • Add HttpClient::vault_transfer() for depositing/withdrawing USDC from vaults
  • Add vault_transfer example for SDK usage
  • Add hypecli vault command with deposit and withdraw subcommands

The usd field is serialized as a plain integer in micro-USDC units (1 USD = 1,000,000), consistent with other RMP-signed actions like UpdateIsolatedMargin. The public API accepts Decimal in USDC and converts internally.

Usage

SDK

// Deposit 100 USDC into a vault
client.vault_transfer(&signer, vault_address, dec!(100), nonce, true).await?;

// Withdraw 50.5 USDC from a vault
client.vault_transfer(&signer, vault_address, dec!(50.5), nonce, false).await?;

Example

# Deposit 100 USDC
cargo run --example vault_transfer -- --vault 0x1234... --operation deposit --amount 100

# Withdraw 50 USDC
cargo run --example vault_transfer -- --vault 0x1234... --operation withdraw --amount 50

hypecli

# Deposit (private key)
hypecli vault deposit --private-key <KEY> --vault 0x1234... --amount 100

# Withdraw (private key)
hypecli vault withdraw --private-key <KEY> --vault 0x1234... --amount 50

# Deposit (keystore)
hypecli vault deposit --keystore <NAME> --vault 0x1234... --amount 100

# Withdraw (keystore)
hypecli vault withdraw --keystore <NAME> --vault 0x1234... --amount 50

@lihaostar lihaostar force-pushed the feat/vault-deposit-withdraw branch 2 times, most recently from ceab25b to aed731c Compare March 8, 2026 02:55
@lihaostar lihaostar changed the base branch from main to dev March 8, 2026 04:06
@lihaostar lihaostar changed the base branch from dev to main March 8, 2026 04:10
@lihaostar lihaostar marked this pull request as draft March 8, 2026 04:12
@lihaostar lihaostar force-pushed the feat/vault-deposit-withdraw branch from aed731c to 41e7052 Compare March 8, 2026 07:40
Replace confusing --deposit bool flag with explicit `vault deposit` and
`vault withdraw` subcommands, matching the pattern used by `order` and
`subscribe` commands.
@lihaostar lihaostar force-pushed the feat/vault-deposit-withdraw branch from 41e7052 to 8b97816 Compare March 8, 2026 07:41
@lihaostar lihaostar marked this pull request as ready for review March 8, 2026 07:44
@lihaostar
Copy link
Author

@ifdario could you please help review this PR? thanks.

@ifdario ifdario merged commit 7c7ca35 into infinitefield:main Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants