@revertwtf/parser
v0.1.2
Published
Ethereum error normalizer, revert decoder, and explainer
Maintainers
Readme
@revertwtf/parser
Ethereum error explainer.
pnpm add @revertwtf/parserComposes:
normalizeError(input)- walks arbitrary error-like objects and extracts messages, codes, method, action, errorName, candidate revert bytes, and failed trace frames.extractRevertData(input)- finds revert bytes nested anywhere (error.data,data.originalError.data, stringifiedbody, failed traceoutput, etc.).extractTraceFailures(input)- summarizes failed simulator/debugger call frames under paths such astrace,calls,callTrace,stack, andframes.decodeRevertData(data, { abi? })- decodesError(string),Panic(uint256), custom errors via provided ABI, and the built-in selector catalog.matchCatalog(normalized)- matches against@revertwtf/catalogpatterns.explain(input, { abi? })- full pipeline. Returns explanations with evidence.
import { explain } from "@revertwtf/parser/explain";
const { explanations } = explain(rawError);
console.log(explanations[0].title, explanations[0].confidence);Works from local decoding, selector data, and the reviewed catalog.
For browser bundles, keep @revertwtf/parser/explain on a server/API path or
call the hosted API through @revertwtf/client. Use lighter subpaths when you
do not need full catalog matching:
import { decodeRevertData } from "@revertwtf/parser/decode";
import { normalizeError } from "@revertwtf/parser/normalize";
import { extractRevertData } from "@revertwtf/parser/extract";