Skip to main content

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

Start with a descriptive name and include all relevant context upfront.

2. Record Milestones

Add events at significant points in the flow.

3. Add Transaction Hints

Link blockchain transactions to your trace for correlation.

4. Handle Errors

Always record failures with context for debugging.

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 using addSafeMsgHint():

Staking Operation

Best Practices

Include identifying attributes (user, amounts, tokens) when creating the trace, not at the end.
swap_submitted is better than tx_sent. Future you will thank you.
Add gas used, block numbers, and other on-chain data for debugging.
A trace without error handling is incomplete. Record failures with context.
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