Skip to content

refactor: replace manual call_data parsers with metadata-driven decoding#221

Closed
lcovar wants to merge 1 commit intomasterfrom
BTC-3062/metadata-driven-parser
Closed

refactor: replace manual call_data parsers with metadata-driven decoding#221
lcovar wants to merge 1 commit intomasterfrom
BTC-3062/metadata-driven-parser

Conversation

@lcovar
Copy link
Contributor

@lcovar lcovar commented Mar 19, 2026

Use scale_value::scale::decode_as_type() with the metadata type registry to generically decode any call_data against the RuntimeCall type. This eliminates ~400 lines of hardcoded per-method parsers (parse_transfer_args, parse_bond_args, parse_proxy_args, etc.) and replaces them with ~150 lines of generic Value-to-JSON conversion.

The no-metadata fallback now returns raw hex args since we cannot decode without type info. In practice, metadata is always provided.

BTC-3062

Use scale_value::scale::decode_as_type() with the metadata type registry
to generically decode any call_data against the RuntimeCall type. This
eliminates ~400 lines of hardcoded per-method parsers (parse_transfer_args,
parse_bond_args, parse_proxy_args, etc.) and replaces them with ~150 lines
of generic Value-to-JSON conversion.

The no-metadata fallback now returns raw hex args since we cannot decode
without type info. In practice, metadata is always provided.

BTC-3062
@lcovar lcovar force-pushed the BTC-3062/metadata-driven-parser branch from 12a5e65 to eb0ad7a Compare March 19, 2026 21:52
@lcovar lcovar closed this Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant