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

# sendDeposit

> Deposit collateral the wallet already holds, or swap another token into it.

`sendDeposit` is the deposit to call.

It funds the user's Zyfai Safe with a collateral token, then registers that transfer. What happens before the transfer depends on the token the wallet spends:

* The wallet already holds that collateral on the deposit chain. `sendDeposit` transfers it. This is the same call as before: `sendDeposit(userAddress, chainId, amount, "USDC")`.
* The wallet holds a different token, or the same token on another chain. `sendDeposit` asks the execution API for a Relay quote, the wallet signs the steps, and Relay delivers the collateral to the Safe. Credit still requires that verified transfer.
* The wallet holds native ETH and the collateral is WETH on that same chain. The wallet wraps ETH to WETH, then transfers WETH. Relay does not do that pair.

`sendDeposit` confirms the collateral transfer and registers its lifecycle. It does not wait for allocation. Call [`waitForDepositPosition`](https://docs.zyf.ai/docs/sdk/api/wait-for-deposit-position) when the UI should wait until the deposit is in a position, skipped, or a cross-chain bridge execution is recorded.

On the first deposit, Zyfai assigns the user's EOA a pre-deployed Safe with a signed session key. No separate deploy or session-key API is needed.

`amount` is least units of the token being spent. Collateral symbols, chains, and minimums are on [Supported Assets](https://docs.zyf.ai/docs/sdk/supported-assets.md). `strategy` applies on the first deposit only.

## Signature

A collateral the wallet already holds:

```typescript theme={null}
sendDeposit(
  userAddress: string,
  chainId: SupportedChainId,
  amount: string,
  asset: string,
  strategy?: Strategy,
): Promise<DepositResponse>
```

Any other spend token:

```typescript theme={null}
sendDeposit({
  userAddress: string;
  chainId: SupportedChainId; // chain the collateral should arrive on
  asset: string;             // collateral that should land in the Safe
  amount: string;            // least units of the token being spent
  strategy?: Strategy;
  spendToken?: string;       // contract, collateral symbol, or "ETH"
  spendChainId?: number;     // defaults to chainId
  slippageBps?: number;      // swap only; default 200, max 500
}): Promise<DepositResponse>
```

Omit `spendToken` to spend `asset` on `chainId`. `slippageBps` applies only when the call swaps. A direct transfer or a same-chain ETH wrap ignores it. The value is stored on the funding order at quote time (default 200 basis points, maximum 500).

## Direct deposit

```typescript theme={null}
await sdk.connectAccount(walletProvider, 8453);

const sent = await sdk.sendDeposit(
  userAddress,
  8453,
  "100000000", // 100 USDC
  "USDC",
  "conservative", // first deposit only
);

const positioned = await sdk.waitForDepositPosition(sent.registration.id, 8453);
```

## Swap deposit

```typescript theme={null}
await sdk.connectAccount(walletProvider);

const sent = await sdk.sendDeposit({
  userAddress,
  chainId: 8453,
  asset: "USDC",
  amount: "25000000000000000000", // origin token least units
  spendToken: "0xOriginToken",
  spendChainId: 42161,
  slippageBps: 200,
});

await sdk.waitForDepositPosition(sent.registration.id, 8453);
```

`sent.route` is `"direct"`, `"swap"`, or `"wrap"`. A swap also returns `orderId`. `sent.txHash` is the collateral transfer into the Safe.

A refund or a failed fill throws and does not register a deposit. Funds return to the funding wallet when Relay refunds on the origin chain.

## Lifecycle states

| State | Meaning |
| - | - |
| `handover_pending` | Transfer is confirmed and registered; custody handover or balance credit is still running. |
| `credited` | Funds are credited on the Safe. |
| `position_pending` | Credited; rebalance into a position in progress. |
| `positioned` | Allocation finished for this lifecycle surface. |
| `recovered_to_eoa` | Terminal recovery: funds were returned to the EOA and were not credited. |

[`waitForDepositPosition`](https://docs.zyf.ai/docs/sdk/api/wait-for-deposit-position) keeps polling through credit until allocation finishes or is skipped. Use [`getDepositStatus`](https://docs.zyf.ai/docs/sdk/api/get-deposit-status) for a one-off refresh. Do not show a pending deposit as yield-bearing until it is `credited` and `balanceCredited` is `true`.

## When to use the other methods

[`sendDirectDeposit`](https://docs.zyf.ai/docs/sdk/api/send-direct-deposit) and [`sendSwapDeposit`](https://docs.zyf.ai/docs/sdk/api/send-swap-deposit) are the two steps inside `sendDeposit`. Call them when the integration already knows which path it wants.

For Privy, Biconomy, or another app-managed wallet that submits the collateral transfer itself, use the [external deposit building blocks](https://docs.zyf.ai/docs/sdk/api/external-deposit-building-blocks.md).

[`depositFunds`](https://docs.zyf.ai/docs/sdk/api/deposit-funds) remains for existing integrations. It wraps `sendDeposit` plus a short credit wait.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.