Skip to content

feat: add tokenTicker and chainId calldata formatters - #319

Merged
fsamier merged 3 commits into
mainfrom
feat/new-v2-formatters
Aug 6, 2026
Merged

feat: add tokenTicker and chainId calldata formatters#319
fsamier merged 3 commits into
mainfrom
feat/new-v2-formatters

Conversation

@fsamier

@fsamier fsamier commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements two new ERC-7730 v2 field formatters in the calldata (TLV) conversion path, mapping them to the corresponding app-ethereum generic parser structs:

  • tokenTickerPARAM_TOKEN (ParamType 0x0a): the field value is the token address; the device resolves the ticker.
  • chainIdPARAM_NETWORK (ParamType 0x0b): the field value references the chain ID; the device resolves the network name and falls back to the raw chain ID if unknown.

Both were previously unsupported and fell through to an "Unsupported format" error.

Details

tokenTicker / PARAM_TOKEN

  • Added CalldataDescriptorParamTokenV1 model (TOKEN = 0x0A) with native_currencies kept for TLV fidelity to the struct's NATIVE_CURRENCY tag (not populated by tokenTicker).
  • Added the tlv_param_token encoder and tag enum (VERSION / ADDRESS / NATIVE_CURRENCY).
  • tokenTicker parameters (chainId / chainIdPath) are optional per schema and have no equivalent tag in PARAM_TOKEN, so they are ignored with a warning.
  • Fixed the resolved converter to treat tokenTicker params as optional (previously errored on a bare field).

chainId / PARAM_NETWORK

  • Added CalldataDescriptorParamNetworkV1 model (NETWORK = 0x0B).
  • Added the tlv_param_network encoder and tag enum (VERSION / VALUE).
  • Added the CHAIN_ID case to the v2 → calldata converter.

Testing

  • New unit tests asserting each format serializes the correct PARAM_TYPE tag (0x0a / 0x0b) in the TLV output.
  • Full calldata + v2 suites pass (74 passed); ruff, mypy, bandit clean via pre-commit.

Reference

Structs follow the app-ethereum TLV spec: doc/tlv_structs.md.

fsamier added 2 commits August 6, 2026 12:15
…ersion

Map the ERC-7730 v2 tokenTicker field format to the PARAM_TOKEN TLV struct.
tokenTicker parameters (chainId/chainIdPath) are optional per schema and are
not encodable in PARAM_TOKEN, so they are ignored with a warning.
…sion

Map the ERC-7730 v2 chainId field format to the PARAM_NETWORK TLV struct
(ParamType 0x0b). The field value references the chain ID; the device resolves
the network name and falls back to the raw chain ID if unknown.
@fsamier
fsamier requested a review from a team as a code owner August 6, 2026 10:24
@fsamier
fsamier enabled auto-merge (squash) August 6, 2026 11:52
@fsamier
fsamier merged commit a8ff863 into main Aug 6, 2026
13 checks passed
@fsamier
fsamier deleted the feat/new-v2-formatters branch August 6, 2026 11:53
@fsamier fsamier changed the title Add tokenTicker and chainId calldata formatters (PARAM_TOKEN, PARAM_NETWORK) feat: add tokenTicker and chainId calldata formatters Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants