Skip to main content
Redeem shares in one transaction by pairing prepareWithdrawTxData with Privy’s wallet connection hooks. This pattern keeps signer UX inside Privy while letting the Amplify SDK handle calldata.

Overview

  • Fetch the target vault (for example with fetchVaults and React Query).
  • Prepare withdrawal calldata with slippage protection.
  • Submit the transaction via Privy’s sendTransaction.
  • Track optimistic state and surface any APIError details.

Prerequisites

  • React 18+
  • @privy-io/react-auth >= 3
  • @paxoslabs/amplify-sdk
  • Vault metadata available in your component (e.g., from fetchVaults)

Withdraw Hook

Component Usage

prepareWithdrawTxData throws APIError when the vault or asset is unsupported. Log the endpoint and statusCode to help users fall back to alternate flows.