Overview
The Avail Nexus SDK emits real-time events during operations, enabling you to build responsive UIs with progress tracking, status updates, and detailed step-by-step feedback.Event System
Events are emitted via theonEvent callback parameter available in most SDK methods:
Event Constants
The SDK provides event name constants to prevent typos:Core Events
STEPS_LIST
Emitted once at the start of an operation with all expected steps.STEP_COMPLETE
Emitted each time a step completes during bridge, transfer, or execute operations.SWAP_STEP_COMPLETE
Emitted each time a step completes during swap operations.Bridge Steps
Bridge operations emit the following step types:Step Types Reference
INTENT_ACCEPTED
INTENT_ACCEPTED
Intent created and accepted by solver.
INTENT_HASH_SIGNED
INTENT_HASH_SIGNED
User signed the intent hash with their wallet.
INTENT_SUBMITTED
INTENT_SUBMITTED
Intent submitted to the network with explorer URL.
INTENT_FULFILLED
INTENT_FULFILLED
Intent fulfilled by solver on destination chain.
ALLOWANCE_USER_APPROVAL
ALLOWANCE_USER_APPROVAL
Waiting for user to approve token allowance.
ALLOWANCE_APPROVAL_MINED
ALLOWANCE_APPROVAL_MINED
Allowance approval transaction confirmed on chain.
ALLOWANCE_ALL_DONE
ALLOWANCE_ALL_DONE
All required allowances approved.
INTENT_DEPOSIT
INTENT_DEPOSIT
Deposit initiated on a source chain.
INTENT_DEPOSITS_CONFIRMED
INTENT_DEPOSITS_CONFIRMED
All deposits confirmed on source chains.
INTENT_COLLECTION
INTENT_COLLECTION
Collecting funds from a source chain.
INTENT_COLLECTION_COMPLETE
INTENT_COLLECTION_COMPLETE
All funds collected from source chains.
APPROVAL
APPROVAL
Token approval for contract execution.
TRANSACTION_SENT
TRANSACTION_SENT
Execute transaction sent to network.
TRANSACTION_CONFIRMED
TRANSACTION_CONFIRMED
Execute transaction confirmed on chain.
Bridge Step TypeScript Type
Swap Steps
Swap operations emit the following step types:Swap Step Types Reference
SWAP_START
SWAP_START
Swap operation started.
DETERMINING_SWAP
DETERMINING_SWAP
Calculating optimal swap route.
CREATE_PERMIT_EOA_TO_EPHEMERAL
CREATE_PERMIT_EOA_TO_EPHEMERAL
Creating permit for ephemeral wallet.
CREATE_PERMIT_FOR_SOURCE_SWAP
CREATE_PERMIT_FOR_SOURCE_SWAP
Creating permit for source swap.
SOURCE_SWAP_BATCH_TX
SOURCE_SWAP_BATCH_TX
Executing source chain swaps in batch.
SOURCE_SWAP_HASH
SOURCE_SWAP_HASH
Source swap transaction hash received.
BRIDGE_DEPOSIT
BRIDGE_DEPOSIT
Bridge deposit for cross-chain swap.
RFF_ID
RFF_ID
Request for funds ID assigned.
DESTINATION_SWAP_BATCH_TX
DESTINATION_SWAP_BATCH_TX
Executing destination chain swaps.
DESTINATION_SWAP_HASH
DESTINATION_SWAP_HASH
Destination swap transaction hash received.
SWAP_COMPLETE
SWAP_COMPLETE
Swap completed successfully.
SWAP_SKIPPED
SWAP_SKIPPED
Swap skipped (sufficient balance exists).
Swap Step TypeScript Type
Building Progress UIs
Basic Progress Tracker
React Progress Component
Percentage Progress
Explorer Link Extraction
Event Handling Patterns
Switch Statement Pattern
Event Aggregation Pattern
Debugging with Events
Detailed Event Logger
Event History Tracking
Best Practices
Always Handle STEPS_LIST
Always Handle STEPS_LIST
Initialize your UI with the complete list of steps:
Use TypeIDs for Tracking
Use TypeIDs for Tracking
The
typeID field uniquely identifies each step:Extract Explorer URLs
Extract Explorer URLs
Show users transaction links when available:
Handle Both Bridge and Swap Events
Handle Both Bridge and Swap Events
Some operations emit both event types:
Next Steps
- Initialization - Set up the SDK
- Intents - Understand the intent-based architecture
- Hooks - Implement user approval workflows