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.Documentation Index
Fetch the complete documentation index at: https://docs.trustware.io/llms.txt
Use this file to discover all available pages before exploring further.
The TrustwareEvent type
All events share a discriminated union type called TrustwareEvent. Each variant has a type string field you can use to narrow the event in a handler.
Event types
type | When it fires | Additional fields |
|---|---|---|
error | An SDK error occurs | error: TrustwareError |
transaction_started | A transaction is submitted to the wallet | — |
transaction_success | The transaction is confirmed | txHash: string, transaction?: Transaction |
wallet_connected | A wallet is connected | address: string |
token_page_loaded | A paginated token list loads successfully | chainRef: string, count: number, hasNextPage: boolean, query?: string, cursor?: string |
token_page_error | A paginated token list fails to load | chainRef: string, message: string, query?: string, cursor?: string |
balance_stream_chunk | A streaming balance response delivers a chunk | address: string, chunkSize: number |
balance_stream_fallback | The balance stream falls back to a non-streaming path | address: string, message: string |
token_page_loaded, token_page_error, balance_stream_chunk, and balance_stream_fallback are gated by the tokensPagination and balanceStreaming feature flags. Both are enabled by default — set either flag to false in features to suppress the corresponding events.How to subscribe
Pass anonEvent callback in your TrustwareConfigOptions. This works whether you are using TrustwareProvider or calling Trustware.init() directly in the headless core.
event to the correct shape inside each if branch, so accessing event.txHash is fully type-safe.
The onSuccess shortcut
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.
onSuccess and onEvent are independent — you can use both at the same time.
Example: tracking deposit completion
The following example shows how to useonEvent to display a success notification when a deposit completes, and log any errors to an external service.
