Skip to main content
The unified deposit API simplifies deposits by automatically detecting the optimal authorization method. Use prepareDepositAuthorization() to determine the method, then prepareDeposit() to execute.

Import

prepareDepositAuthorization()

Determines the optimal authorization method for a deposit operation.

Function Signature

Parameters

Return Type (Discriminated Union)

Decision Logic

The function follows this priority order:
  1. Check forceMethod - If specified, use that method
  2. Check permit support - If token is in permit allowlist, return permit data
  3. Check existing allowance - If sufficient, return ALREADY_APPROVED
  4. Default to approval - Return approval transaction data

prepareDeposit()

Prepares transaction data for a deposit, automatically using the correct method based on provided parameters.

Function Signature

Parameters

Return Type


Complete Flow Example

Force Specific Method

Override automatic detection when needed:

Slippage Configuration

Error Handling