Import
Usage
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
settlementId | string | Yes | The settlement UUID. |
legIndex | number | Yes | The index of the leg to deposit (0-based). |
Return Type
| Property | Type | Description |
|---|---|---|
status | DepositStatus | Current step in the deposit flow. |
depositInfo | DepositInfo | null | Pre-encoded calldata and metadata (available after fetching). |
txHash | string | null | Transaction hash (available after deposit confirmation). |
error | string | null | Error message if any step failed. |
fetchInfo | function | Fetch deposit info without executing. Useful for preview. |
deposit | function | Execute the full deposit flow (fetch + approve + deposit). |
DepositStatus Values
| Status | Description |
|---|---|
"idle" | No deposit in progress. |
"fetching_info" | Fetching deposit calldata from the API. |
"checking_balance" | Checking token balance (Tier 3 only). |
"approving" | ERC-20 approval transaction in progress. |
"approval_confirmed" | Approval confirmed, proceeding to deposit. |
"depositing" | Deposit transaction in progress. |
"deposit_confirmed" | Deposit confirmed on-chain. |
"error" | A step failed. Check error for details. |
DepositInfo Object
| Field | Type | Description |
|---|---|---|
calldata | string | Encoded depositLeg() calldata. |
escrowAddress | string | Escrow contract address. |
chainId | number | Blockchain network. |
tokenAddress | string | ERC-20 token contract. |
depositAmount | string | Amount in smallest units. |
approvalCalldata | string | Encoded approve() calldata. |
approvalAmount | string | Amount to approve. |
How It Routes
The deposit hook routes based on what’s available:- Action delegates configured (Tier 2) - Calls
onDepositRequiredfrom the provider - Wagmi context detected (Tier 3) - Uses connected wallet directly
- Neither -
deposit()fetches info only; no on-chain execution
Fetch-Only Mode
UsefetchInfo to get the deposit calldata without executing. Useful for showing a preview or building custom deposit UI: