paritytech / paritytech/polkadot-cli
Refactor tx.ts: split into tx-parse, tx-submit, tx-display modules
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10
- Forks
- 2
- Avg merge
- 12h 35m
- Merged PRs (30d)
- 4
Description
Problem
tx.ts is ~850 lines and handles parsing, submission, and display — three distinct concerns in one file. This makes it harder to navigate, test, and reuse individual pieces (e.g., parseTypedArg is needed by query.ts too).
Proposal
Split into focused modules:
| New file | Responsibility | Key exports |
|---|---|---|
tx-parse.ts |
Argument parsing & type coercion | parseCallArgs, parseTypedArg, normalizeValue, parsePrimitive |
tx-submit.ts |
Transaction signing & submission | watchTransaction, signed extension handling |
tx-display.ts |
Output formatting | decodeCall, formatDecoded, formatEventValue, formatDispatchError |
tx.ts |
Command registration & orchestration | CAC command definition, wiring the above together |
Benefits
parseTypedArgbecomes importable byquery.ts(see type-aware query keys issue)- Each module is independently testable
- Easier to navigate and review
- Clear separation of concerns
Acceptance Criteria
-
tx.tsreduced to command registration and orchestration (~100-150 lines) - Parsing, submission, and display logic extracted to separate files
- No behavior changes — all existing tests pass
-
parseTypedArgis importable fromtx-parse.tsfor reuse
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 by reading tx.ts to map the parsing, submission, display, and CAC orchestration responsibilities, then check query.ts for the planned parseTypedArg reuse. Extract the listed exports into tx-parse.ts, tx-submit.ts, and tx-display.ts while keeping tx.ts focused on registration and wiring. Done means tx.ts is about 100–150 lines, parseTypedArg is importable, and all existing tests pass without behavior changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100