Overview
This example demonstrates how to use the Mirador SDK to track a complete blockchain transaction flow, from wallet connection through confirmation.Full Example
Node.js SDK Example
The Node.js SDK uses the same auto-flush pattern. Here’s the equivalent server-side implementation:Step-by-Step Breakdown
1. Initialize the Trace
2. Record Milestones
3. Add Transaction Hints
4. Handle Errors
Variations
Using sendTransaction
Let the trace handle tx hints and error capture automatically:
Using MiradorProvider
Wrap your wallet provider for zero-config transaction capture:Multi-Chain Swap
Using addTx with Transaction Objects
Safe Multisig Operation
Track Safe multisig message confirmations usingaddSafeMsgHint():
Staking Operation
Best Practices
Add context early
Add context early
Include identifying attributes (user, amounts, tokens) when creating the trace, not at the end.
Use descriptive event names
Use descriptive event names
swap_submitted is better than tx_sent. Future you will thank you.Include transaction details
Include transaction details
Add gas used, block numbers, and other on-chain data for debugging.
Always handle errors
Always handle errors
A trace without error handling is incomplete. Record failures with context.
Add transaction hints immediately
Add transaction hints immediately
Don’t wait for confirmation to add the hint - add it as soon as you have the hash.
Next Steps
API Reference
Complete API documentation
Traces
Learn about trace lifecycle and flushing