> ## Documentation Index
> Fetch the complete documentation index at: https://docs.unlink.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Deposit

> Move ERC-20 tokens from an EVM wallet into the unlink contract.

Deposit ERC-20 tokens into the unlink contract. The deposit goes into the account bound to your user client. See [Quickstart](/quickstart). Call `client.ensureRegistered()` once before depositing. A deposit's amount, token, and source wallet are public; see [How Unlink works](/how-unlink-works).

The recommended path is `depositWithApproval()`. It runs the Permit2 approval
when needed, waits for confirmation, and then runs the deposit in one call. It
requires an EVM provider. See [EVM provider setup](/quickstart#evm-provider).
Use `deposit()` directly only when the token is already approved or when you
want raw control over the approval flow.

```ts theme={null}
const tx = await client.depositWithApproval({
  token: "0xTokenAddress",
  amount: "1000000000000000000",
});

const confirmed = await tx.wait();
console.log(confirmed.confirmationStatus); // "confirmed" | "processed" | "failed"
```

## Parameters (`depositWithApproval`)

Required fields:

* `token`: ERC-20 token address.
* `amount`: amount in wei.

Optional fields:

* `deadline`: Permit2 deadline. Defaults to one hour from now.
* `nonce`: override Permit2 nonce. The SDK manages this by default.
* `evm`: override the EVM provider for this call.
* `waitForApproval`: override the approval-confirmation wait.

**Returns:** a `TransactionHandle`. See [Transaction status](/reading-data#transaction-status).

## 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:

```ts theme={null}
const approval = await client.ensureErc20Approval({
  token: "0xTokenAddress",
  amount: "1000000000000000000",
});

if (approval.status === "submitted") {
  // Wait for tx to be mined before depositing
  console.log("Approval tx:", approval.txHash);
}
// If approval.status === "already-approved", no transaction was needed

const tx = await client.deposit({
  token: "0xTokenAddress",
  amount: "1000000000000000000",
});

await tx.wait(); // resolves at user-facing confirmation by default
```

You can also inspect approval state or build the approval transaction manually:

```ts theme={null}
const state = await client.getApprovalState({ token, amount });
// state.isApproved: boolean

const approvalTx = await client.buildApprovalTx({ token, amount });
// approvalTx: { to: string; data: string; value?: bigint }
```

<Note>
  Approval methods require an EVM provider with `getErc20Allowance`.
  `ensureErc20Approval` and `depositWithApproval` also require
  `sendTransaction`. See [Quickstart](/quickstart#evm-provider) for a compact
  browser setup.
</Note>
