Abi.decodeData inspects calldata, matches the selector to a function in your ABI, and decodes the arguments. Use this when you have raw transaction calldata and want to recover the called function and parameters.
If the selector does not match any function in the ABI, Abi.decodeData throws AbiItemNotFoundError.
import { Abi, AbiItemNotFoundError, AbiInvalidSelectorError } from '@tevm/voltaire/Abi';try { abi.decodeData(calldata);} catch (error) { if (error instanceof AbiInvalidSelectorError) { console.error('Calldata too short to contain a selector'); } if (error instanceof AbiItemNotFoundError) { console.error('Unknown function selector'); }}