import type { NetworkClientId } from '@metamask/network-controller'; import type { Hex } from '@metamask/utils'; import type { TransactionControllerMessenger } from '../TransactionController.js'; import type { Revert, TransactionParams } from '../types.js'; /** * Input accepted by `decodeRevert`. Either raw revert data hex, or a * thrown JSON-RPC error carrying the data on `data` (standard) or * nested `data.data` (some older node forks). */ type RevertInput = Hex | undefined | { data?: Hex | { data?: Hex; } | null; } | null; /** * Error thrown by `PendingTransactionTracker` when a transaction failed * on-chain, carrying any decoded revert. */ export declare class OnChainFailureError extends Error { readonly revert?: Revert; constructor(revert?: Revert); } /** * Decode an EVM revert into a `Revert` containing both the decoded * human-readable message and the original raw `data`. Accepts either a * raw revert data hex string, or a thrown JSON-RPC error of the shape * `{ data: Hex | { data: Hex } }`. Handles `Error(string)`, * `Panic(uint256)`, and falls back to a raw `Custom error: 0x` * reference for unknown custom errors. * * @param input - Raw revert data hex, or a thrown JSON-RPC error. * @param source - Optional label included in debug logs to identify the * caller (e.g. `gas`, `simulation`). * @returns A `Revert` if any data was found, otherwise `undefined`. */ export declare function decodeRevert(input: RevertInput, source?: string): Revert | undefined; /** * Replay a transaction that failed on-chain via `eth_estimateGas` to * recover the revert reason. `eth_estimateGas` is used instead of * `eth_call` to avoid `RetryOnEmptyMiddleware`, which retries reverted * `eth_call` responses 10 times and discards the original error data. * * Always resolves; never throws. * * @param input - Extraction inputs. * @param input.messenger - Transaction controller messenger. * @param input.networkClientId - Network client ID to replay against. * @param input.txParams - Transaction parameters for the failed tx. * @returns A `Revert`, or `undefined` if none could be observed. */ export declare function extractRevert({ messenger, networkClientId, txParams, }: { messenger: TransactionControllerMessenger; networkClientId: NetworkClientId; txParams: TransactionParams; }): Promise; export {}; //# sourceMappingURL=revert-reason.d.ts.map