Skip to main content

Vault Operations

(assetId, amount, autoWait?) => Promise<TransactionResult>
Deposit tokens into vault. Use asset UUID from sdk.profile.getUserBalances().
(assetId, amount, autoWait?, source?) => Promise<WithdrawResult>
Withdraw tokens from vault. Use asset UUID from sdk.profile.getUserBalances(). source is "spot" or "margin"; see sdk.vault.withdraw.
(withdrawalIndex, autoWait?) => Promise<WithdrawResult>
Retry the on-chain submission of a withdrawal that never landed. It does not create a new withdrawal; see sdk.vault.retryWithdrawal.
(params?) => Promise<ListPendingWithdrawalsResponse>
List the caller’s withdrawals still awaiting on-chain confirmation, newest first, cursor-paginated with pageSize and pageToken. Wraps sdk.withdrawals.listPendingWithdrawals.

Token Approvals

(assetId, amount, autoWait?) => Promise<TransactionResult>
Approve vault to spend tokens. Use asset UUID from trading pairs.
(assetId) => Promise<bigint>
Check current token allowance by asset UUID
(assetId, amount) => Promise<boolean>
Check if approval is needed for an asset UUID

Validation Requirements

All vault operations include built-in validation to prevent common errors:
Required Parameters: Asset ID must be a non-empty string, and amount must be greater than 0.
Validation Checks: Example with error handling: