paritytech / paritytech/polkadot-cli

Type-aware query key parsing using metadata types

Open
#22 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
10
Forks
2
Avg merge
12h 35m
Merged PRs (30d)
4

Description

Problem

dot query uses generic parseValue() for storage map keys (query.ts:71), but the metadata knows the exact key types. This means users must manually format keys correctly — e.g., wrapping SS58 addresses won't happen automatically like it does for dot tx.

Proposal

Apply the same parseTypedArg() logic that dot tx uses to parse query keys, using the storage item's keyTypeId from metadata.

# Currently fails or requires manual formatting for some key types
dot query System.Account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY

# With this change: auto-coerces to AccountId32, just like dot tx does

Implementation

  • In src/commands/query.ts:71, replace keys.map(parseValue) with metadata-aware parsing
  • Use storageItem.keyTypeId to get the expected type from metadata
  • Reuse parseTypedArg() from tx.ts (or extract it into a shared utility)

Acceptance Criteria

  • dot query System.Account <ss58-address> works with auto-coercion
  • Complex key types (tuples, enums) are parsed correctly from CLI args
  • Dev account names work as keys where the type is AccountId32

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/commands/query.ts:71 to trace how query keys currently use parseValue, then read parseTypedArg() in tx.ts and the storage metadata path that provides storageItem.keyTypeId. Implement metadata-aware parsing for address, tuple, enum, and dev-account keys, and verify the listed dot query examples work with automatic coercion.

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
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.