Skip to main content

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

ParameterTypeRequiredDescription
chainIdSupportedChainIdChain ID where the deposit was made
txHashstringTransaction hash of the deposit
amountstringAmount in least decimal units (e.g., "100000000" for 100 USDC with 6 decimals)
tokenAddressstringToken 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
);