Skip to main content

Overview

The MiradorProvider is an EIP-1193 compatible wrapper that automatically captures transaction data for Mirador traces. It intercepts eth_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

  1. Your application sends a transaction through MiradorProvider
  2. The provider intercepts eth_sendTransaction / eth_sendRawTransaction
  3. It forwards the call to the underlying provider (e.g., MetaMask)
  4. On success: records the tx hash as a hint and adds a tx:sent event
  5. On failure: captures the error message, code, and revert data as a tx:error event
  6. 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:
You can pass 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:
This gives you the same automatic tx hint and error capture, but scoped to a specific trace method call.

Chain Detection

Both MiradorProvider 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: You can also use the chainIdToName() utility directly:

Error Capture

When a transaction fails (user rejection, insufficient funds, revert, etc.), the error is automatically captured:
The original error is always re-thrown so your application’s error handling continues to work normally.

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.