Deposit ERC-20 tokens into the unlink contract. The deposit goes into the account bound to yourDocumentation Index
Fetch the complete documentation index at: https://docs.unlink.xyz/llms.txt
Use this file to discover all available pages before exploring further.
unlink session (set via tenant.forUser({ account }), see Quickstart). Register the account once before depositing.
depositWithApproval() is the recommended path: it runs the Permit2 approval (when needed), waits for confirmation, and then runs the deposit in one call. Use deposit() directly only when the token is already approved or when you want raw control over the approval flow.
Parameters (depositWithApproval)
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | Yes | ERC-20 token address |
amount | string | Yes | Amount in wei |
deadline | number | No | Permit2 deadline (unix seconds). Defaults to 1 hour from now. |
nonce | string | No | Override Permit2 nonce (auto-managed by default) |
evm | EvmProvider | No | Override the EVM provider for this call |
waitForApproval | (txHash) => Promise<void> | No | Override the approval-confirmation wait (defaults to polling). |
{ txId: string; status: string }
Advanced: separate approval + deposit
If you’ve already arranged Permit2 approval out of band, or you want to integrate the approval into a custom receipt-polling pipeline, use the lower-level helpers:Approval methods require an EVM provider with
getErc20Allowance.
ensureErc20Approval and depositWithApproval also require
sendTransaction.