Skip to main content
Use Rust when your backend, keeper, or test harness needs direct account reads, transaction simulation, or Anchor instruction construction for Dynamic Vault.
vault-sdk/rust-client is a CLI-style helper, not a broad high-level SDK. It demonstrates PDA derivation, account reads, simulation, deposits, and withdrawals with anchor-client.

Install

For the current program source, depend on the mercurial-vault crate from the same workspace or pin the matching repository revision:
The local vault-sdk/rust-client depends on the vendored vault-sdk/programs/vault crate by path. The newer mercurial-vault/programs/vault source uses Anchor 0.31.1 and has a newer handler surface. Keep your crate, IDL, and deployed program target aligned.

Program ID

The public program ID is the same on mainnet and devnet.

PDA Derivation

For idle vaults, use the default pubkey as the base seed instead of VAULT_BASE_KEY.

Read Vault State

Calculate Unlocked Amount

The Rust client also demonstrates an instruction simulation path: simulate get_unlocked_amount, parse Anchor Program data: logs, and deserialize the TotalAmount event.

Deposit

The Rust client creates or reuses the user’s token and LP ATAs, then builds DepositWithdrawLiquidity.

Withdraw

Withdraw burns vault LP tokens. Pass the LP amount as unmint_amount.

Rust Client Commands

From vault-sdk/rust-client:
Common provider overrides:

Rust Or TypeScript