Skip to main content
This guide demonstrates complete deposit flows using the unified deposit API, which automatically detects the optimal authorization method (permit vs approval).
The unified deposit API handles three authorization paths automatically:
  • Permit - Gas-efficient off-chain signature (EIP-2612)
  • Approval - Standard ERC-20 approval transaction
  • Already Approved - Direct deposit when allowance exists

Prerequisites

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

Installation

Imports

Complete Examples

useDeposit Hook

Deposit Component

What the Code Does

  1. Checks authorization method - Determines if permit, approval, or already approved
  2. Handles permit flow - Signs typed data off-chain for gas-efficient authorization
  3. Handles approval flow - Sends approval transaction then deposit
  4. Handles pre-approved - Deposits directly if allowance exists
  5. Reports status - Updates UI with current operation status

Customization

Custom Slippage

Distributor Code

Force Approval Flow

Troubleshooting

For more details on the deposit API, see Deposit Workflow.