This package allows you to take any ABI-encoded blob of data, such as calldata, return data, or anything else that can be parsed with abi.decode()
, and reverse-engineer the types of the values inside that blob.
Note that this package will not be able to guess the types for any data which was encoded in a non-standard manner.
npm i @openchainxyz/abi-guesser
import { guessAbiEncodedData, guessFragment } from '@openchainxyz/abi-guesser'
const paramTypes: ParamType[] = guessAbiEncodedData(calldata)!;
const fragment: FunctionFragment = guessFragment(calldata)!;