Overview
MiradorProvider wraps any EIP-1193 compatible provider and automatically captures transaction data into Mirador traces. It intercepts eth_sendTransaction and eth_sendRawTransaction calls, recording tx hints and errors, while passing all other RPC methods through unchanged.
Constructor
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
underlying | EIP1193Provider | Yes | The underlying wallet provider |
client | Client | Yes | Mirador client instance |
options | MiradorProviderOptions | No | Configuration options |
MiradorProviderOptions
| Option | Type | Description |
|---|---|---|
trace | Trace | Bind to an existing trace (otherwise a new trace per tx) |
traceOptions | TraceOptions | Options for auto-created traces (ignored if trace is set) |
Examples
Basic usage:Methods
request()
Send an RPC request through the provider. Implements the EIP-1193request interface.
Intercepted Methods
| Method | Behavior |
|---|---|
eth_sendTransaction | Captures tx hash, chain, input data, and errors |
eth_sendRawTransaction | Captures tx hash and errors |
| All other methods | Passed through to the underlying provider unchanged |
Parameters
| Parameter | Type | Description |
|---|---|---|
args.method | string | RPC method name |
args.params | unknown[] | Method parameters |
Returns
Promise<unknown> — the RPC response from the underlying provider
Examples
Captured Data
On Successful Transaction
Wheneth_sendTransaction succeeds, the following is captured in the trace:
- TxHint: transaction hash + chain + input data (calldata)
- Event
tx:sent:{ txHash, method: 'eth_sendTransaction' }
On Failed Transaction
When a transaction fails (user rejection, revert, etc.), the following is captured:- Event
tx:error:{ message, code, data, method }
Next Steps
EIP-1193 Provider Guide
Detailed guide with library integration examples
Types
EIP1193Provider, MiradorProviderOptions