Skip to main content

Initialize

Embedded Wallet (Privy)

The SDK reads only wallet.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:
For other embedded wallet providers, build the viem clients yourself:

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 with depositMode: '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 with depositMode: '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 — no pendingDeposit 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. Passing syncWithdrawQuote 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.
For a full-position instant exit, the quote requires the account whose shares it reads. The transaction always uses the configured 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 }).
User positions and PnL:
Amounts are human-unit decimal strings (e.g. "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:
After submitting an async deposit or withdrawal, block until the solver settles it:

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, use step.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

Both getDepositTx and getWithdrawTx accept a slippageBps parameter (integer basis points, e.g. 50 = 0.5%). Defaults to 100 (1%).

Error Handling

Aera instant quote and quote-bound transaction flows can also throw 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.