Skip to main content

Constructor

Discover Vaults

Transaction Functions

Import from @gauntlet-xyz/sdk/evm. These communicate on-chain via your RPC URLs. Require wallet in the client config — the SDK reads the account address from wallet.account.

getDepositTx

The vaultId string resolves to a VaultDeployment from the manifest. This is how the SDK knows which token to approve (supplyToken[0].address), which contract to call (vaultAddress or provisionerAddress), and whether the vault supports sync or async deposits.

getWithdrawTx

User Vault Balance

Balance lifecycle

An async deposit or withdrawal passes through a pending state while the vault solver queues and processes the operation:
  • pendingDeposit — funds are locked in the provisioner contract. They are not yet earning yield. Once the solver settles the request, they move to balance and begin earning.
  • pendingWithdraw — vault shares have been redeemed but the underlying assets have not yet been transferred. They are no longer earning yield. Once the solver settles the request, they arrive as ERC-20 tokens in the receiver wallet.
The solver typically processes requests within 2 hours; the maximum window is 12 hours. Funds are safe in both pending states — the delay is operational, not a risk. How an amount moves through the three states depends on whether the user chose sync or async:

getUserCurrentBalance

Returns Promise<UserCurrentBalance[]> — one entry per chain the vault is deployed on:
All numeric fields are always present. If the account has no position on a given chain, all three bigint fields are 0n — this is not an error.

Result Shape

Both getDepositTx and getWithdrawTx return Promise<PreparedTx[]>.
Steps must be executed in order. An approve step, when present, always comes first. Each step exposes two submission paths with different trade-offs:

Path 1 — step.payload + sendTransaction

Use for: backend scripts, embedded wallets (Privy, Dynamic), server-side signing, EVM pre-simulation (eth_call on the exact bytes to be broadcast). Attribution is pre-concatenated into payload.data — it cannot be lost regardless of wallet or provider.

Path 2 — step.tx + writeContract

Use for: browser wallets via wagmi (MetaMask, Coinbase Wallet, WalletConnect), or when you need wagmi simulation hooks. Pass step.tx.attribution as dataSuffix — wagmi appends it to the ABI-encoded calldata before sending. If dataSuffix is omitted or the EIP-1193 provider strips it, the transaction succeeds but volume is not attributed.

Attribution

How ERC-8021 builder codes work, why dataSuffix matters, and how to verify attribution is tracked.

Types

VaultInfo

VaultDeployment

The object vaultId resolves to. Carries all metadata the SDK needs to construct deposit and withdraw transactions — you never supply these directly.

TokenInfo

VaultFilter

AttributionMode

Errors

All errors extend GauntletSDKError, which extends Error.

Go Deeper

Examples

End-to-end code for deposits, withdrawals, and error handling.

API Reference

Use the raw API directly if you need more control than the SDK provides.