Skip to main content
The deposit modal fires callbacks at each stage of the deposit lifecycle. Use these to update your UI, trigger backend processes, or log analytics.

Deposit lifecycle

  1. The modal initializes and fires onReady
  2. The user connects a wallet (or is connected via embedded wallet). The modal creates a smart account and fires onConnected with the EOA address and smartAccount address.
  3. The user selects a source chain, token, and amount, then confirms the deposit
  4. The modal submits the transaction on the source chain and fires onDepositSubmitted
  5. The bridge routes funds to the target chain. When waitForFinalTx is true (default), the modal waits for destination chain confirmation before firing onDepositComplete
If the bridge fails after submission, onDepositFailed fires instead of onDepositComplete.

Event callbacks

onReady

Fires when the modal is initialized and ready for interaction. No payload.
onReady={() => {
  console.log("Modal ready");
}}

onConnected

Fires when a smart account has been created for the deposit.
onConnected={(data) => {
  console.log("EOA:", data.address);
  console.log("Smart account:", data.smartAccount);
}}
FieldTypeDescription
addressAddressThe user’s EOA or owner address
smartAccountAddressThe smart account address that receives deposits

onDepositSubmitted

Fires when the user signs and submits the deposit transaction on the source chain.
onDepositSubmitted={(data) => {
  console.log("Submitted:", data.txHash, "on chain", data.sourceChain);
}}
FieldTypeDescription
txHashstringSource chain transaction hash
sourceChainnumber | "solana"Source chain ID
amountstringDeposit amount in the token’s smallest unit

onDepositComplete

Fires when tokens arrive on the target chain (or when the bridge is submitted, if waitForFinalTx is false).
onDepositComplete={(data) => {
  console.log("Completed:", data.destinationTxHash);
  console.log("Amount:", data.amount);
}}
FieldTypeDescription
txHashstringSource chain transaction hash
destinationTxHashstring | undefinedTarget chain transaction hash. Absent when waitForFinalTx is false.
amountstringAmount transferred
sourceChainnumber | "solana"Source chain ID
sourceTokenstringSource token address
targetChainnumberTarget chain ID
targetTokenstringTarget token address

onDepositFailed

Fires when the bridge fails after the deposit was submitted.
onDepositFailed={(data) => {
  console.log("Failed:", data.txHash, data.error);
}}
FieldTypeDescription
txHashstringSource chain transaction hash
errorstring | undefinedError message, if available

onError

Fires on errors at any stage — wallet connection, transaction signing, bridge setup, etc.
onError={(data) => {
  console.error(`[${data.code}] ${data.message}`);
}}
FieldTypeDescription
messagestringError description
codestring | undefinedError code, if available
For bridge-level error codes, see deposit processing error codes.

Error handling

Errors can occur at different stages:
StageCallbackTypical causes
Wallet connectiononErrorUser rejected connection, network error
Transaction signingonErrorUser rejected transaction, insufficient gas
After submissiononDepositFailedBridge failure, timeout, price deviation
Any stageonErrorUnexpected errors
onError fires for errors that prevent the deposit from being submitted. onDepositFailed fires for failures that happen after the source chain transaction is confirmed — at that point, the deposit service may retry automatically.

Analytics

The onEvent callback fires on granular user interactions for integration with your analytics pipeline.
onEvent={(event) => {
  analytics.track(event.type, event);
}}
Events include modal views (*_open) and CTA clicks (*_cta_click) at each step of the flow, with contextual properties like selected token, chain, and amount.