paritytech / paritytech/polkadot-cli
feat: add `dot decode` command for hex call data, storage values, and events
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10
- Forks
- 2
- Avg merge
- 12h 35m
- Merged PRs (30d)
- 4
Description
Parent Epic: #63
Summary
Add a decode command that decodes arbitrary hex-encoded data using chain metadata. Agents constantly encounter opaque hex (from block explorers, multisig proposals, governance, or their own tx results) and need to decode it.
Usage
dot decode call 0x0001076465616462656566 --output json
dot decode storage Balances.Account 0x... --output json
Proposed Implementation
Shared decode module (NEW: src/core/decode.ts)
Extract decodeCall() from tx.ts:267 into a shared module and add:
decodeCallData(meta, hex)— decode extrinsic call data usingviewBuilder.callDecoder()decodeStorageValue(meta, pallet, item, hex)— decode storage values usingmeta.builder.buildStorage()
Command (NEW: src/commands/decode.ts)
Subcommands:
dot decode call <hex>— decode call datadot decode storage <Pallet.Item> <hex>— decode a storage value
Pretty output: Human-readable like Balances.transferKeepAlive { dest: 5FHn..., value: 1000000000000 }
JSON output: Full nested object with all fields
Reuse existing code
decodeCall()intx.ts:267— extract to shared moduleformatDecoded()intx.ts:284— reuse for pretty outputreplacer()inoutput.ts:14— reuse for JSON serialization
Files
src/core/decode.ts— NEW shared decode logicsrc/commands/decode.ts— NEW command registrationsrc/cli.ts— register new commandsrc/commands/tx.ts— refactor to use shared decode module
Verification
- Encode a call:
dot tx System.remark 0xaa --encode→ get hex - Decode it:
dot decode call <hex> --output json→ verify round-trip - Decode a storage value from a known query result
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing decodeCall() and formatDecoded() in src/commands/tx.ts, plus replacer() in src/commands/output.ts. Review src/cli.ts and the proposed src/core/decode.ts and src/commands/decode.ts entry points, then verify the documented call round trip and decoding of a known storage value. Done means the call and storage subcommands support pretty and JSON output while tx decoding still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100