onLifecycle callback.
You switch on event.type to update your UI, trigger backend processes, or log
analytics. New event variants can be added without changing the prop surface.
Deposit lifecycle
- The modal initializes and fires
onReady - If the user funds from a wallet,
"connected"fires with the EOAaddressand thesmartAccountthe deposit lands on - The user selects a source chain, token, and amount, then confirms
- The modal submits the transaction on the source chain and emits
"submitted" - The bridge routes funds to the target chain. Once they arrive, the modal
emits
"complete"
"failed" is emitted instead of
"complete".
onLifecycle
onLifecycle receives a discriminated union — DepositLifecycleEvent on
<DepositModal>, WithdrawLifecycleEvent on <WithdrawModal>. The two are
similar but not identical; see withdraw events for the
differences.
Deposit events
amount is in the source token’s base units — divide by sourceDecimals to display
it. sourceDecimals is omitted when the token isn’t recognised, which happens for a
QR deposit of an unlisted token.
amountUsd is the USD value as entered in the modal. It is omitted for flows with no
amount input: QR transfer, fiat on-ramp, and exchange connect.
Withdraw events
WithdrawLifecycleEvent carries the same type values minus "balance-changed"
and "smart-account-changed". Its txHash is Hex, sourceChain is always a
number, sourceToken / targetToken are Address, and "submitted" adds an
accountAddress: Address field. "connected" means the deposit account for the
chosen target is registered and fundable, not that a wallet connected.
Claim events
ClaimLifecycleEvent is a separate union — lookup, refund_requested, complete,
failed. See claim modal.
onReady
Fires once when the modal is initialized and ready for interaction. No payload.onError
Fires on errors at any stage — wallet connection, transaction signing, bridge setup — that prevent the deposit from being submitted. Distinct from the"failed" lifecycle event, which covers failures after the source transaction
confirms.
Codes
Errors without a code carry only
message. For bridge-level codes, see deposit processing error codes.
Error handling
After the source chain transaction confirms, the deposit service may
retry automatically before the
"failed" event fires.
Analytics
TheonEvent callback fires on granular user interactions for your analytics
pipeline. Its payload type is DepositAnalyticsEvent, WithdrawAnalyticsEvent, or
ClaimAnalyticsEvent.
*_open) and CTA clicks (*_cta_click) at each
step of the flow, with contextual properties like selected token, chain, and
amount.