Initialize
Embedded Wallet (Privy)
The SDK reads onlywallet.account.address — it never signs. Any viem-compatible wallet works, including embedded wallets from Privy, Dynamic, or similar providers.
For Privy, @gauntlet-xyz/sdk/privy sets up the whole client in one call:
Deposit
Withdraw
Check User Current Balance
getUserCurrentBalance returns a unified view of all three balance states for a vault position. Call it on load and after any deposit or withdrawal transaction to keep your UI in sync.
After an async deposit
When a user deposits withdepositMode: 'async', the amount appears in pendingDeposit while the vault solver queues it. During this time the funds are locked in the provisioner contract and are not yet earning yield. They move to balance once the solver settles the request — usually within 2 hours.
After an async withdrawal
When a user withdraws withdepositMode: 'async', the amount moves from balance to pendingWithdraw. During this time the vault shares have been redeemed and the assets are no longer earning yield, but they have not yet been transferred. Once the solver settles the request (usually within 2 hours), the assets become claimable as ERC-20 tokens in the receiver wallet.
Sync deposit and withdrawal
Sync transactions skip the queue. The balance moves immediately — nopendingDeposit or pendingWithdraw. Morpho withdrawals are sync. Aera mode support combines token settings with live runtime gates, so read it before presenting an instant action. When the V2 solving gate pauses a provisioner/token pair, both sync modes are unavailable. On Aera vaults, a sync deposit locks all of the depositor’s vault units for 1 hour; redeeming or transferring them during that window reverts with Aera__UnitsLocked.
Quote and submit an Aera instant withdrawal
Use the same sizing input for the quote and transaction. PassingsyncWithdrawQuote makes the transaction sync and pins the quoted on-chain bound. When transaction slippage is omitted, the builder uses the quote’s slippage; an explicitly supplied value must match.
wallet.account; an optional account must match it. The builder rereads the current share balance and rejects a stale full-position quote.
shares and entireAmount quotes with slippageBps: 10000 are rejected because they would produce minTokensOut: 0.
Read Live Vault Data
client.api exposes every REST API endpoint with generated types — live metrics, timeseries, positions, activity, TVL, and prices. No RPC needed; a data-only client is just new GauntletClient({ apiKey }).
"1250.5"). Convert to base units exactly with decimalToBigInt(value, token.decimals) — it throws instead of rounding.
Track Activity and Wait for Settlement
getActivityFlows turns the wallet’s raw activity log into one flow per user action, pairing async request/settle rows automatically:
Position History
Replay a wallet’s full event history for one vault into a chronological timeline — share balance, escrowed pending amounts, and net asset flows after every event:Wagmi / writeContract
When integrating with wagmi, usestep.tx fields with writeContractAsync. Pass step.tx.attribution as dataSuffix — wagmi appends it to the calldata before sending. Omitting dataSuffix silently drops attribution: the transaction succeeds but volume is not tracked.
Slippage
BothgetDepositTx and getWithdrawTx accept a slippageBps parameter (integer basis points, e.g. 50 = 0.5%). Defaults to 100 (1%).
Error Handling
UnsupportedFeatureError (runtime is not V2 sync capable), StalePriceError, InvalidSyncWithdrawBoundError, or InvalidWithdrawParamsError (sizing or quote context/account mismatch). Full-position flows use AccountRequiredError when the quote omits account, and AccountMismatchError when the account passed with getWithdrawTx({ entireAmount: true }) differs from the configured wallet.
Data-path calls throw GauntletApiError on failed requests:
Go Deeper
SDK Reference
Full constructor, methods, result shapes, and errors.
Deposit Your First Dollar
The full integration guide with confirmation and fallback guidance.