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)
- Type Definition
- Permit Result
- Approval Result
- Already Approved Result
Decision Logic
The function follows this priority order:- Check
forceMethod- If specified, use that method - Check permit support - If token is in permit allowlist, return permit data
- Check existing allowance - If sufficient, return
ALREADY_APPROVED - 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
Related
- Deposits Guide - Complete integration examples
- DepositAuthMethod - Type definitions
- prepareDepositTxData - Lower-level deposit function