abi_codec
ABI-encode values or decode ABI-encoded call, return, or log data. Supports typed arrays, standard and packed encoding.
Instructions
ABI-encode values or ABI-decode call/return/log data.
types is a list of ABI type strings (e.g. ["uint256", "address",
"(uint8,bytes)[]"]); aliases like uint/int/byte are normalized.
action=encode (needs values) -> {encoded, mode}. mode=packed is
abi.encodePacked (tight, no padding) and is encode-only. action=decode
(needs data, standard only) -> {values}; ints are returned as decimal
strings and addresses EIP-55 checksummed.
Example: abi_codec("encode", ["uint256"], [69]) -> encoded="0x00..0045" (the 32-byte word 0x...0045).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | 'encode' values to ABI bytes, or 'decode' ABI bytes. | |
| types | Yes | List of ABI type strings, e.g. ["uint256","address","(uint8,bytes)[]"]; aliases uint/int/byte are normalized. A stringified JSON array is accepted. | |
| values | No | Values to encode (required for action=encode), positionally matching `types`; ints accept int/decimal/0x-hex, bytes are 0x-hex, addresses are 0x-hex. A stringified JSON array is accepted. | |
| data | No | 0x-prefixed ABI-encoded bytes to decode (required for action=decode). | |
| mode | No | 'standard' head/tail ABI encoding, or 'packed' (abi.encodePacked: tight, no padding/length prefixes) — packed is encode-only as it is not uniquely decodable. | standard |