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

# logDeposit

Register a deposit that you executed yourself with the Zyfai backend.

[`depositFunds`](/docs/sdk/api/deposit-funds) already calls this after the ERC-20 transfer. If you **do not** use `depositFunds()`, you send the transfer from your frontend, Privy, Biconomy, or any custom wallet, you **must** call `logDeposit`. Otherwise the backend never sees the deposit: a reserved pool wallet is not handed over to the user, and yield / portfolio tracking does not start.

<Warning title="Required when you transfer yourself">
  Skip this only if you used [`depositFunds`](/docs/sdk/api/deposit-funds). That method logs the deposit internally. Any other transfer path must call `logDeposit` after the transaction confirms.
</Warning>

Typical cases:

* Sponsored / gasless transactions (Privy, Biconomy, etc.)
* Custom wallet or frontend transfer
* You need full control over how the transaction is sent

The token is automatically selected based on the chain if not provided.

## Signature

```typescript theme={null}
logDeposit(chainId: SupportedChainId, txHash: string, amount: string, tokenAddress?: string): Promise<LogDepositResponse>
```

## Parameters

| Parameter      | Type               | Required | Description                                                                    |
| -------------- | ------------------ | -------- | ------------------------------------------------------------------------------ |
| `chainId`      | `SupportedChainId` | ✅        | Chain ID where the deposit was made                                            |
| `txHash`       | `string`           | ✅        | Transaction hash of the deposit                                                |
| `amount`       | `string`           | ✅        | Amount in least decimal units (e.g., "100000000" for 100 USDC with 6 decimals) |
| `tokenAddress` | `string`           | ❌        | Token address (auto-selected based on chain if not provided)                   |

## Returns

Log deposit response with success status

## Return Type

```typescript theme={null}
interface LogDepositResponse {
  success: boolean;
  message: string;
}
```

## Example

```typescript theme={null}
// Execute deposit with Privy (sponsored transaction)
const txHash = await privyWallet.sendTransaction({
  to: safeAddress,
  data: transferData,
});

// Log the deposit to Zyfai backend
const result = await sdk.logDeposit(
  8453,           // chainId
  txHash,         // transaction hash from Privy
  "100000000"     // 100 USDC
);
console.log(result.success); // true
console.log(result.message); // "Deposit logged successfully"
```

## Example with custom token

```typescript theme={null}
// Log deposit with specific token address
const result = await sdk.logDeposit(
  8453,
  "0xTransactionHash...",
  "100000000",
  "0xCustomTokenAddress..." // Optional: override default token
);
```
