Constructor
Discover Vaults
Fee Wrapper Vaults (Partners)
Some partners integrate through a fee wrapper vault: an Aera vault that Gauntlet deploys exclusively for that partner, with the partner’s fee terms applied. Because a fee wrapper vault belongs to one partner, it is not included in the SDK’s bundled manifest.getVaults does not return it, and transaction functions throw VaultNotFoundError for its id.
To make your fee wrapper vault accessible through the SDK, register it with client.setManifest. setManifest replaces the whole manifest, so read the bundled one from client.manifest and append your vault to keep the standard vaults available:
setManifest once on each GauntletClient you construct, before the first call that references the vault.
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.
getAeraTokenModeSupport
Reads currently available token modes from the live Aera runtime. Use the result to decide which deposit and withdrawal actions to show.Promise<AeraTokenModeSupport>:
false while the V2 solving gate pauses the provisioner/token pair, and syncRedeem is also false unless the active fee calculator is V2. Read failures surface to the caller.
getSyncWithdrawQuote
Builds a block-consistent quote for an Aera V2 instant withdrawal without sending a transaction.
The returned
SyncWithdrawQuote includes estimated shares and tokensOut, executable maxUnitsIn/minTokensOut bounds, the effective rate, epoch capacity, optional unitsLockedUntil, and a block-stamped context. Capacity and lock fields are diagnostics; state can change after quoting, so the transaction may still revert on-chain.
getWithdrawTx
For a quoted sync withdrawal, pass the same sizing input. The builder reuses quote slippage when the transaction omits it:
entireAmount, it also rereads the wallet’s current share balance and rejects stale quote shares. A quote created for another account cannot be used by the configured wallet.
shares and entireAmount quotes with slippageBps: 10000 are rejected because they would produce minTokensOut: 0.
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.
On Aera vaults, both withdraw paths revert with
Aera__UnitsLocked while the user’s units are locked: a sync deposit locks all of the user’s vault units for 1 hour.
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.REST API Client — client.api
client.api is a typed client for every endpoint of the Gauntlet REST API. It is available on any configured GauntletClient (only apiKey is used — no RPC required), or standalone:
Timeseries and list methods accept
start / end (ISO 8601), granularity ('hour' | 'day' | 'week' | 'month'), limit, order, and an opaque next cursor from the previous response’s meta.next_cursor.
Failed requests throw GauntletApiError with .status, .path, and a machine-readable .code when the API provides one. An aggregate response can also succeed while single items fail; those failures arrive in the response’s meta.partial_errors as PartialResponseError entries (code, message, optional resource_id). The type is exported from the SDK.
Units and vault ids
The API emits amounts as human-unit decimal strings (e.g."1250.5") and identifies vaults by a CAIP-10-style id ("{chainId}:{address}", lowercase address) rather than the manifest vault id. The SDK ships exact converters for both — they throw instead of silently rounding:
Activity Flows
Raw activity rows are an immutable event log — an Aera async deposit, for example, is two rows (deposit_pending, then deposit or deposit_refunded) linked by request_hash. getActivityFlows fetches the log and stitches those lifecycles into one flow per user action, replacing client-side event-log scanning over RPC.
Returns
Promise<ActivityFlow[]>, newest first:
stitchActivityFlows(rows) is also exported if you fetch rows yourself.
waitForRequestSettlement
Polls the activity log until an Aera async request reaches a terminal state. Use after submitting arequestDeposit / requestRedeem transaction.
Position History
Replays a wallet’s complete activity for one vault into a chronological position timeline — running share balance, escrowed pending amounts, and cumulative net asset flows after every event. Complementsclient.api.positionTimeseries, which gives sampled value/PnL history.
Promise<PositionHistory>. A wallet that has never touched the vault gets an empty timeline, not an error.
buildPositionHistory(rows) is also exported.
Privy
@gauntlet-xyz/sdk/privy wires a Privy embedded or connected wallet into the SDK. Privy wallets are matched structurally ({ address, getEthereumProvider() }), so the SDK takes no @privy-io dependency.
To wrap only the wallet (and build the rest of the client yourself), use
walletClientFromPrivy(wallet, chain), which returns a viem WalletClient.
Types
SyncWithdrawQuote and SyncWithdrawQuoteBounds
SyncWithdrawQuote is a discriminated union. kind: 'redeem' carries the shares and minTokensOut required by on-chain redeem; kind: 'withdraw' carries the tokensOut and maxUnitsIn required by on-chain withdraw.
SyncWithdrawQuote is assignable to SyncWithdrawQuoteBounds, so the full quote can be passed directly to getWithdrawTx.
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.