Subscribe to typed lifecycle events from the Trustware SDK using the onEvent callback in your config.
The Trustware SDK emits typed events as users move through the deposit flow. You can subscribe to these events to track progress, update your own UI state, or send analytics without polling or manual state management.
token_page_loaded, token_page_error, balance_stream_chunk, and balance_stream_fallback are gated by the tokensPagination and balanceStreaming feature flags. tokensPagination is enabled by default, so set it to false in features to suppress its events. balanceStreaming is enabled by default from SDK 1.1.12 (off by default on 1.1.11 and earlier), but it permits streaming rather than forcing it: balance_stream_chunk fires only for scans that actually stream, so the widget’s balance fetches and Trustware.getBalancesByAddressStream emit chunks while a buffered Trustware.getBalancesByAddress call emits none. Set the flag to false to suppress both events and use the buffered request everywhere. swap_route_changed fires only when the widget runs in swap mode.
Pass an onEvent callback in your TrustwareConfigOptions. This works whether you are using TrustwareProvider or calling Trustware.init() directly in the headless core.
For the common case of reacting to a completed deposit, you can use onSuccess instead of filtering inside onEvent. It receives the Transaction object directly.
The following example shows how to use onEvent to display a success notification when a deposit completes, and log any errors to an external service.
onEvent: (event) => { switch (event.type) { case "transaction_success": showToast(`Deposit confirmed (tx: ${event.txHash})`); break; case "wallet_connected": analytics.track("wallet_connected", { address: event.address }); break; case "error": errorLogger.capture(event.error); break; }},
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Trustware","colors":{"primary":"#3B82F6","light":"#2563EB","dark":"#60A5FA"},"logo":{"light":"https://mintcdn.com/trustware/2MgKUWIkQdAtY__O/images/TW_Black_icon.png?fit=max\u0026auto=format\u0026n=2MgKUWIkQdAtY__O\u0026q=85\u0026s=4d16590f457272d26e07619b12eab2e9","dark":"https://mintcdn.com/trustware/2MgKUWIkQdAtY__O/images/TrustwareWhiteCastle.png?fit=max\u0026auto=format\u0026n=2MgKUWIkQdAtY__O\u0026q=85\u0026s=85017431ca4ea6a64e58241da56b73dc"},"favicon":"https://media.brand.dev/cf3363c7-1e63-4cf1-9488-e9e643ffb2bb.jpg","navbar":{"links":[{"icon":"npm","href":"https://www.npmjs.com/package/@trustware/sdk","label":"npm"}],"primary":{"type":"github","href":"https://github.com/trustware-io/trustware-sdk"}},"footer":{"socials":{"github":"https://github.com/orgs/trustware-io","x":"https://x.com/Trustware_io","website":"https://Trustware.io"}},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"trustware","hasAudioNarration":false,"actualSubdomain":"trustware","customDomains":["docs.trustware.io"],"gitSource":{"type":"github","owner":"trustware-io","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ad7c2bc77c5894178f37263","collectionId":"b73687f7-842b-435f-ae4c-6e0cb2326879","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ad7c2bc77c5894178f37263"},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6ad7c2bc77c5894178f37263","clientVersion":"0.0.3965","searchFilterCounts":[{"language":"default","tag":"Documentation","count":24},{"language":"default","tag":"API Reference","count":9},{"language":"default","tag":"Guides","count":9},{"language":"default","tag":"Endpoints","count":8},{"language":"default","tag":"Configuration","count":5},{"language":"default","tag":"Integration","count":4},{"language":"default","tag":"SDK Reference","count":2},{"language":"default","tag":"Events \u0026 Errors","count":2},{"language":"default","tag":"Get Started","count":2},{"language":"default","tag":"Getting Started","count":1}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[{"filePath":"custom.css","content":"[data-component-name=table-of-contents],[data-component-name=toc],aside[aria-label=\"On this page\"i],aside[aria-label=\"Table of contents\"i],nav[aria-label=\"On this page\"i],nav[aria-label=\"Table of contents\"i]{border-left:1px solid #e5e7eb;padding-left:1rem}@media (prefers-color-scheme:dark){[data-component-name=table-of-contents],[data-component-name=toc],aside[aria-label=\"On this page\"i],aside[aria-label=\"Table of contents\"i],nav[aria-label=\"On this page\"i],nav[aria-label=\"Table of contents\"i]{border-left-color:rgba(255,255,255,.12)}}"}],"page":{"pagePath":"events-errors/lifecycle-events","slug":"/events-errors/lifecycle-events","pageMetadata":{"title":"Trustware SDK lifecycle events reference","description":"Subscribe to typed lifecycle events from the Trustware SDK using the onEvent callback in your config.","href":"/events-errors/lifecycle-events"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Subscribe to typed lifecycle events from the Trustware SDK using the onEvent callback in your config.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,p:`p`,pre:`pre`,span:`span`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note,Table}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Table)_missingMdxReference(`Table`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`The Trustware SDK emits typed events as users move through the deposit flow. You can subscribe to these events to track progress, update your own UI state, or send analytics without polling or manual state management.`}),`\n`,_jsxs(Heading,{level:`2`,id:`the-trustwareevent-type`,children:[`The `,_jsx(_components.code,{children:`TrustwareEvent`}),` type`]}),`\n`,_jsxs(_components.p,{children:[`All events share a discriminated union type called `,_jsx(_components.code,{children:`TrustwareEvent`}),`. Each variant has a `,_jsx(_components.code,{children:`type`}),` string field you can use to narrow the event in a handler.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` type`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`TrustwareEvent`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@trustware/sdk\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`event-types`,children:`Event types`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`type`})}),_jsx(_components.th,{children:`When it fires`}),_jsx(_components.th,{children:`Additional fields`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`error`})}),_jsx(_components.td,{children:`Any SDK error (includes API key validation, tx failures, etc.)`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`error: TrustwareError`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`transaction_started`})}),_jsx(_components.td,{children:`Wallet opens with the transaction prompt`}),_jsx(_components.td,{children:`none`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`transaction_success`})}),_jsxs(_components.td,{children:[`Tx confirmed on-chain; carries `,_jsx(_components.code,{children:`txHash`}),` and optional `,_jsx(_components.code,{children:`Transaction`}),` record`]}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`txHash: string`}),`, `,_jsx(_components.code,{children:`transaction?: Transaction`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`wallet_connected`})}),_jsxs(_components.td,{children:[`Wallet attached; carries `,_jsx(_components.code,{children:`address`})]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`address: string`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`token_page_loaded`})}),_jsx(_components.td,{children:`Token list page fetched (with pagination metadata)`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`chainRef: string`}),`, `,_jsx(_components.code,{children:`count: number`}),`, `,_jsx(_components.code,{children:`hasNextPage: boolean`}),`, `,_jsx(_components.code,{children:`query?: string`}),`, `,_jsx(_components.code,{children:`cursor?: string`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`token_page_error`})}),_jsx(_components.td,{children:`Token list fetch failed`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`chainRef: string`}),`, `,_jsx(_components.code,{children:`message: string`}),`, `,_jsx(_components.code,{children:`query?: string`}),`, `,_jsx(_components.code,{children:`cursor?: string`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`balance_stream_chunk`})}),_jsx(_components.td,{children:`One chain’s balances arrived from the streamed address scan; fires once per chain`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`address: string`}),`, `,_jsx(_components.code,{children:`chunkSize: number`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`balance_stream_fallback`})}),_jsx(_components.td,{children:`The streamed scan was refused, aborted or failed, and the SDK re-ran it against the buffered endpoint`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`address: string`}),`, `,_jsx(_components.code,{children:`message: string`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`swap_route_changed`})}),_jsx(_components.td,{children:`Swap-mode route changed (different source or destination chain, token, or amount)`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`fromChain: string`}),`, `,_jsx(_components.code,{children:`fromToken: string`}),`, `,_jsx(_components.code,{children:`toChain: string`}),`, `,_jsx(_components.code,{children:`toToken: string`}),`, `,_jsx(_components.code,{children:`amount?: string`})]})]})]})]}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`token_page_loaded`}),`, `,_jsx(_components.code,{children:`token_page_error`}),`, `,_jsx(_components.code,{children:`balance_stream_chunk`}),`, and `,_jsx(_components.code,{children:`balance_stream_fallback`}),` are gated by the `,_jsx(_components.code,{children:`tokensPagination`}),` and `,_jsx(_components.code,{children:`balanceStreaming`}),` feature flags. `,_jsx(_components.code,{children:`tokensPagination`}),` is enabled by default, so set it to `,_jsx(_components.code,{children:`false`}),` in `,_jsx(_components.code,{children:`features`}),` to suppress its events. `,_jsx(_components.code,{children:`balanceStreaming`}),` is enabled by default from SDK 1.1.12 (off by default on 1.1.11 and earlier), but it permits streaming rather than forcing it: `,_jsx(_components.code,{children:`balance_stream_chunk`}),` fires only for scans that actually stream, so the widget’s balance fetches and `,_jsx(_components.code,{children:`Trustware.getBalancesByAddressStream`}),` emit chunks while a buffered `,_jsx(_components.code,{children:`Trustware.getBalancesByAddress`}),` call emits none. Set the flag to `,_jsx(_components.code,{children:`false`}),` to suppress both events and use the buffered request everywhere. `,_jsx(_components.code,{children:`swap_route_changed`}),` fires only when the widget runs in swap mode.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`how-to-subscribe`,children:`How to subscribe`}),`\n`,_jsxs(_components.p,{children:[`Pass an `,_jsx(_components.code,{children:`onEvent`}),` callback in your `,_jsx(_components.code,{children:`TrustwareConfigOptions`}),`. This works whether you are using `,_jsx(_components.code,{children:`TrustwareProvider`}),` or calling `,_jsx(_components.code,{children:`Trustware.init()`}),` directly in the headless core.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`14`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`TrustwareProvider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`type`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` TrustwareConfigOptions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@trustware/sdk\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` config`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` apiKey:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`NEXT_PUBLIC_TRUSTWARE_API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` routes:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toChain:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"8453\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toToken:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` onEvent`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"transaction_success\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"TX hash:\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`txHash`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`satisfies`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` TrustwareConfigOptions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`TypeScript narrows `,_jsx(_components.code,{children:`event`}),` to the correct shape inside each `,_jsx(_components.code,{children:`if`}),` branch, so accessing `,_jsx(_components.code,{children:`event.txHash`}),` is fully type-safe.`]}),`\n`,_jsxs(Heading,{level:`2`,id:`the-onsuccess-shortcut`,children:[`The `,_jsx(_components.code,{children:`onSuccess`}),` shortcut`]}),`\n`,_jsxs(_components.p,{children:[`For the common case of reacting to a completed deposit, you can use `,_jsx(_components.code,{children:`onSuccess`}),` instead of filtering inside `,_jsx(_components.code,{children:`onEvent`}),`. It receives the `,_jsx(_components.code,{children:`Transaction`}),` object directly.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` config`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` apiKey:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`NEXT_PUBLIC_TRUSTWARE_API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` routes:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toChain:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"8453\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toToken:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` onSuccess`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`transaction`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`transaction`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`satisfies`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` TrustwareConfigOptions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`onSuccess`}),` and `,_jsx(_components.code,{children:`onEvent`}),` are independent; you can use both at the same time.`]}),`\n`,_jsx(Heading,{level:`2`,id:`example-tracking-deposit-completion`,children:`Example: tracking deposit completion`}),`\n`,_jsxs(_components.p,{children:[`The following example shows how to use `,_jsx(_components.code,{children:`onEvent`}),` to display a success notification when a deposit completes, and log any errors to an external service.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`13`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`13`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#C8C8C8`},children:`onEvent`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` switch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`type`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` case`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"transaction_success\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` showToast`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`Deposit confirmed (tx: \"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`txHash`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\")`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` break`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` case`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"wallet_connected\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` analytics`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`track`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"wallet_connected\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`address:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`address`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` break`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` case`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` errorLogger`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`capture`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` break`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Trustware SDK lifecycle events reference","description":"Subscribe to typed lifecycle events from the Trustware SDK using the onEvent callback in your config.","href":"/events-errors/lifecycle-events"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"The TrustwareEvent type","slug":"the-trustwareevent-type","depth":2,"children":[{"title":"Event types","slug":"event-types","depth":3,"children":[]}]},{"title":"How to subscribe","slug":"how-to-subscribe","depth":2,"children":[]},{"title":"The onSuccess shortcut","slug":"the-onsuccess-shortcut","depth":2,"children":[]},{"title":"Example: tracking deposit completion","slug":"example-tracking-deposit-completion","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"trustware","siteName":"Trustware","title":"Trustware SDK lifecycle events reference - Trustware","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-26T16:13:27.896Z","originalFileLocation":"events-errors/lifecycle-events.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Subscribe to typed lifecycle events from the Trustware SDK using the onEvent callback in your config.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Trustware\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/jpeg\" sizes=\"180x180\" href=\"https://media.brand.dev/cf3363c7-1e63-4cf1-9488-e9e643ffb2bb.jpg\">\u003clink data-mint-head rel=\"icon\" type=\"image/jpeg\" sizes=\"32x32\" href=\"https://media.brand.dev/cf3363c7-1e63-4cf1-9488-e9e643ffb2bb.jpg\">\u003clink data-mint-head rel=\"icon\" type=\"image/jpeg\" sizes=\"16x16\" href=\"https://media.brand.dev/cf3363c7-1e63-4cf1-9488-e9e643ffb2bb.jpg\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/jpeg\" href=\"https://media.brand.dev/cf3363c7-1e63-4cf1-9488-e9e643ffb2bb.jpg\">\u003cmeta data-mint-head property=\"og:title\" content=\"Trustware SDK lifecycle events reference - Trustware\">\u003cmeta data-mint-head property=\"og:description\" content=\"Subscribe to typed lifecycle events from the Trustware SDK using the onEvent callback in your config.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Trustware\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.trustware.io/events-errors/lifecycle-events\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://trustware.mintlify.app/_mintlify/api/og/v2?division=Events+%26+Errors\u0026amp;title=Trustware+SDK+lifecycle+events+reference\u0026amp;description=Subscribe+to+typed+lifecycle+events+from+the+Trustware+SDK+using+the+onEvent+callback+in+your+config.\u0026amp;theme=dcdfbb00b6c2e23b972cf4e9\u0026amp;signature=cf337e944828b4db5cc195060803adfdc63c618b4d05fbe3fdf605c3dfa25a47\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Trustware SDK lifecycle events reference - Trustware\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Subscribe to typed lifecycle events from the Trustware SDK using the onEvent callback in your config.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://trustware.mintlify.app/_mintlify/api/og/v2?division=Events+%26+Errors\u0026amp;title=Trustware+SDK+lifecycle+events+reference\u0026amp;description=Subscribe+to+typed+lifecycle+events+from+the+Trustware+SDK+using+the+onEvent+callback+in+your+config.\u0026amp;theme=dcdfbb00b6c2e23b972cf4e9\u0026amp;signature=cf337e944828b4db5cc195060803adfdc63c618b4d05fbe3fdf605c3dfa25a47\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"https://mintlify.s3.us-west-1.amazonaws.com/trustware/_generated/favicon/browserconfig.xml?v=3\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Trustware\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#3B82F6\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.trustware.io/events-errors/lifecycle-events\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/events-errors/lifecycle-events.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.trustware.io/#organization\",\"name\":\"Trustware\",\"url\":\"https://docs.trustware.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/trustware/2MgKUWIkQdAtY__O/images/TW_Black_icon.png?fit=max\u0026auto=format\u0026n=2MgKUWIkQdAtY__O\u0026q=85\u0026s=4d16590f457272d26e07619b12eab2e9\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.trustware.io#website\",\"name\":\"Trustware\",\"url\":\"https://docs.trustware.io\",\"publisher\":{\"@id\":\"https://docs.trustware.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.trustware.io/events-errors/lifecycle-events#webpage\",\"url\":\"https://docs.trustware.io/events-errors/lifecycle-events\",\"name\":\"Trustware SDK lifecycle events reference\",\"description\":\"Subscribe to typed lifecycle events from the Trustware SDK using the onEvent callback in your config.\",\"dateModified\":\"2026-08-26T16:13:27.896Z\",\"isPartOf\":{\"@id\":\"https://docs.trustware.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.trustware.io/events-errors/lifecycle-events#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.trustware.io/events-errors/lifecycle-events#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Trustware\",\"item\":\"https://docs.trustware.io\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Trustware SDK lifecycle events reference\",\"item\":\"https://docs.trustware.io/events-errors/lifecycle-events\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.trustware.io/events-errors/lifecycle-events#article\",\"headline\":\"Trustware SDK lifecycle events reference\",\"name\":\"Trustware SDK lifecycle events reference\",\"description\":\"Subscribe to typed lifecycle events from the Trustware SDK using the onEvent callback in your config.\",\"url\":\"https://docs.trustware.io/events-errors/lifecycle-events\",\"mainEntityOfPage\":{\"@id\":\"https://docs.trustware.io/events-errors/lifecycle-events#webpage\"},\"dateModified\":\"2026-08-26T16:13:27.896Z\",\"publisher\":{\"@id\":\"https://docs.trustware.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.trustware.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Trustware\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Trustware","nav":{"global":null,"tabs":[{"tab":"Documentation","groups":[{"group":"Get Started","expanded":true,"pages":[{"title":"Introduction","sidebarTitle":"Introduction","href":"/introduction"},{"title":"Get started with the Trustware SDK","href":"/quickstart"}]},{"group":"Integration","pages":[{"title":"Drop-in widget with Trustware wallet detection","href":"/integration/drop-in-widget"},{"title":"Connect your existing wallet to Trustware","href":"/integration/host-wallet"},{"title":"Control the widget open state with a ref","href":"/integration/controlled-widget"},{"title":"Build custom deposit UI with the headless core","href":"/integration/headless-core"}]},{"group":"Configuration","pages":[{"title":"TrustwareConfigOptions configuration reference","href":"/configuration/overview"},{"title":"Route configuration: chains, tokens, and amounts","href":"/configuration/routes"},{"title":"Customize the Trustware widget appearance","href":"/configuration/theme"},{"title":"WalletConnect configuration for Trustware","href":"/configuration/walletconnect"},{"title":"Rate limiting and retry configuration","description":"How the Trustware SDK handles 429 responses: server-directed retry, the 10 second wait budget, RateLimitError, and callbacks for monitoring your key's rate limit.","href":"/configuration/retry"}]},{"group":"Events \u0026 Errors","pages":[{"title":"Trustware SDK lifecycle events reference","href":"/events-errors/lifecycle-events"},{"title":"Handle errors from the Trustware SDK","description":"Catch and respond to errors using the onError callback or try/catch. Use TrustwareErrorCode to identify error types and act on them precisely.","href":"/events-errors/error-handling"}]},{"group":"Guides","pages":[{"title":"Run the widget in swap mode","href":"/guides/swap-mode"},{"title":"Use Trustware with embedded wallets","href":"/guides/embedded-wallets"},{"title":"Withdraw from an embedded wallet","href":"/guides/embedded-wallet-withdrawals"},{"title":"Lock the deposit widget to a fixed amount","href":"/guides/fixed-amount"},{"title":"Set minimum and maximum deposit amounts","href":"/guides/amount-guardrails"},{"title":"Update the deposit destination at runtime","href":"/guides/runtime-destination"},{"title":"Deposit into vault destinations","href":"/guides/vault-destinations"},{"title":"Destination call options","href":"/guides/destination-call-options"},{"title":"Sponsor gas with Paymasters","href":"/guides/paymasters"}]},{"group":"SDK Reference","pages":[{"title":"TypeScript types exported from @trustware/sdk","href":"/api-reference/types"},{"title":"Supported chains and assets","sidebarTitle":"Supported chains and assets","href":"/supported-chains"}]}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/overview"}]}]},"title":"Trustware SDK lifecycle events reference - Trustware","buildId":"dpl_849ArpqvBiCczQiT1Y1stNGpbqHT","deploymentId":"dpl_849ArpqvBiCczQiT1Y1stNGpbqHT","dynamics":[],"chunks":[]}