Skip to main content
This guide demonstrates complete withdrawal flows to redeem vault shares for underlying tokens.
Withdrawals follow a two-step process:
  1. Approve - Authorize the vault to spend your shares
  2. Withdraw - Redeem shares for the underlying token

Prerequisites

  • Node.js 22+
  • Amplify API key from Paxos Labs
  • SDK initialized with initAmplifySDK()
  • Vault shares to redeem

Installation

Complete Examples

useWithdraw Hook

Withdraw Component

What the Code Does

  1. Approves the vault - Authorizes the vault contract to spend your shares
  2. Prepares withdrawal - Builds transaction data with slippage protection
  3. Executes withdrawal - Redeems shares for underlying tokens
  4. Tracks status - Updates UI with current operation state

Customization

Slippage Tolerance

Slippage is specified in basis points (1 bp = 0.01%). Default is 75 (0.75%).

Partial Withdrawals

Specify the exact amount of vault shares to redeem:

Troubleshooting

prepareWithdrawTxData throws APIError when liquidity is unavailable or the vault is unsupported. Surface the endpoint and statusCode fields to help users understand failures.
For more details on the withdrawal API, see prepareWithdrawTxData.