logDeposit
Use this method when you execute the deposit transaction yourself (e.g., with Privy, sponsored transactions, or any custom wallet implementation) and need to register the deposit with the Zyfai backend for fastest portfolio tracking.
This is useful for partners who:
- Use sponsored/gasless transactions (Privy, Biconomy, etc.)
- Have custom wallet implementations
- Need more control over transaction execution
The token is automatically selected based on the chain if not provided:
- Base (8453) and Arbitrum (42161): USDC
- Plasma (9745): USDT
Signature
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
interface LogDepositResponse {
success: boolean;
message: string;
}
Example
// 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
// Log deposit with specific token address
const result = await sdk.logDeposit(
8453,
"0xTransactionHash...",
"100000000",
"0xCustomTokenAddress..." // Optional: override default token
);