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
ThevaultId 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 tobalanceand 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.
getUserCurrentBalance
Returns
Promise<UserCurrentBalance[]> — one entry per chain the vault is deployed on:
0n — this is not an error.
Result Shape
BothgetDepositTx and getWithdrawTx return Promise<PreparedTx[]>.
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 objectvaultId 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 extendGauntletSDKError, 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.