Overview
The MiradorProvider is an EIP-1193 compatible wrapper that automatically captures transaction data for Mirador traces. It interceptseth_sendTransaction and eth_sendRawTransaction calls, records tx hints and error data, and passes everything else through to the underlying provider.
This means you can drop it into any dApp and get transaction tracing without changing your existing transaction flow.
Quick Start
How It Works
- Your application sends a transaction through
MiradorProvider - The provider intercepts
eth_sendTransaction/eth_sendRawTransaction - It forwards the call to the underlying provider (e.g., MetaMask)
- On success: records the tx hash as a hint and adds a
tx:sentevent - On failure: captures the error message, code, and revert data as a
tx:errorevent - All other RPC methods (e.g.,
eth_call,eth_getBalance) pass through unchanged
Configuration
Auto-Create Traces Per Transaction
By default,MiradorProvider creates a new trace for each transaction:
traceOptions to configure the auto-created traces:
Bind to an Existing Trace
For multi-step flows where you want all transactions in a single trace:Using with Libraries
ethers.js
viem
Alternative: sendTransaction on Trace
If you don’t want a wrapper provider and prefer explicit control, use sendTransaction() directly on a trace. First set up the Web3Plugin, then call sendTransaction() on the trace:
Chain Detection
BothMiradorProvider and the Web3Plugin automatically detect the connected chain by calling eth_chainId on the underlying provider. The chain ID is mapped to a supported ChainName:
| Chain ID | Chain Name |
|---|---|
| 1 | ethereum |
| 137 | polygon |
| 42161 | arbitrum |
| 8453 | base |
| 10 | optimism |
| 56 | bsc |
chainIdToName() utility directly:
Error Capture
When a transaction fails (user rejection, insufficient funds, revert, etc.), the error is automatically captured:Next Steps
Transaction Hints
Learn about transaction correlation
Transaction Tracking Example
See a complete implementation
API Reference: Trace
Full method documentation
Types
EIP1193Provider, MiradorProviderOptions, etc.