Skip to main content
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 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. strategy applies on the first deposit only.

Signature

A collateral the wallet already holds:
Any other spend token:
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

Swap deposit

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

waitForDepositPosition keeps polling through credit until allocation finishes or is skipped. Use getDepositStatus 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 and sendSwapDeposit 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. depositFunds remains for existing integrations. It wraps sendDeposit plus a short credit wait.