This function replaces the legacy
prepareWithdrawTxData() (also known as
prepareWithdrawTransactionData()) from SDK versions prior to 0.4.2. If you
are migrating, note that the new function uses amountOffer instead of
amount, and no longer accepts slippage or deadline parameters. See the
Changelog for full
migration details.Import
Usage
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
vaultName | string | Yes | Account name from AmplifyVault.name (e.g. from getVaultsByConfig()) |
wantAsset | Address | Yes | Token address you want to receive |
userAddress | Address | Yes | User’s wallet address |
chainId | number | Yes | Chain ID |
amountOffer | string | Yes | Account shares to withdraw (decimal string) |
Unlike the old Teller-based withdrawal, the WithdrawQueue does not require
slippage or deadline parameters. Orders are processed by the protocol at
the current exchange rate.Return Type
- Type Definition
- Example Response
Examples
- Viem
- Wagmi
Withdrawal Flow
Error Handling
| Error | Description | Resolution |
|---|---|---|
Vault not found | No account matches vaultName | Verify account name via getVaultsByConfig() |
Vault chain mismatch | Account not on requested chain | Verify chainId matches account deployment |
WithdrawQueue contract address not configured | Missing contract config | Check account exists for vaultName/chain |
BoringVault contract address not configured | Missing account config | Check account configuration |
Related
- getVaultsByConfig - Discover account names
- prepareWithdrawal - Unified withdrawal wrapper
- prepareWithdrawalAuthorization - Unified authorization flow
- prepareApproveWithdrawOrderTxData - Approve account shares
- Withdrawals Guide - Complete withdrawal integration guide
- Deposits - Deposit into accounts