polkadot-cli 1.14.0 → 1.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +224 -162
  2. package/dist/cli.mjs +44 -34
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -19,7 +19,7 @@ Ships with Polkadot and all system parachains preconfigured with multiple fallba
19
19
  - ✅ Fuzzy matching with typo suggestions
20
20
  - ✅ Account management — BIP39 mnemonics, derivation paths, env-backed secrets, watch-only, dev accounts
21
21
  - ✅ Named address resolution across all commands
22
- - ✅ Runtime API calls — `dot apis.Core.version`
22
+ - ✅ Runtime API calls — `dot polkadot.apis.Core.version`
23
23
  - ✅ Chain topology — relay/parachain hierarchy with tree display and auto-detection
24
24
  - ✅ Batteries included — all system parachains and testnets already setup to be used
25
25
  - ✅ File-based commands — run any command from a YAML/JSON file with variable substitution
@@ -82,11 +82,11 @@ dot chain add my-para --rpc wss://rpc.example.com --relay polkadot --parachain-i
82
82
  dot chain list
83
83
 
84
84
  # Re-fetch metadata after a runtime upgrade
85
- dot chain update kusama # updates a specific chain
86
- dot chain update --all # updates all configured chains in parallel
85
+ dot chain update polkadot # updates a specific chain
86
+ dot chain update --all # updates all configured chains in parallel
87
87
 
88
- # Remove a chain
89
- dot chain remove westend
88
+ # Remove a chain (only user-added chains can be removed)
89
+ dot chain remove kusama
90
90
  ```
91
91
 
92
92
  #### Chain topology
@@ -129,7 +129,7 @@ dot polkadot.query.System.Number
129
129
  dot polkadot.query.System.Number --chain polkadot # ✗ errors
130
130
  ```
131
131
 
132
- Chain names are case-insensitive. The prefix form also works with the space-separated syntax (`dot query polkadot.System.Account ...`).
132
+ Chain names are case-insensitive (`Polkadot.query.System.Number` works the same).
133
133
 
134
134
  #### Export/import chain configuration
135
135
 
@@ -200,7 +200,7 @@ dot account import ci-signer --env MY_SECRET
200
200
  dot account derive treasury treasury-staking --path //staking
201
201
 
202
202
  # Use it — the env var is read at signing time
203
- MY_SECRET="word1 word2 ..." dot tx System.remark 0xdead --from ci-signer
203
+ MY_SECRET="word1 word2 ..." dot tx.System.remark 0xdead --from ci-signer --chain polkadot
204
204
 
205
205
  # Remove one or more accounts
206
206
  dot account remove my-validator
@@ -244,13 +244,13 @@ Named accounts (both watch-only and keyed) resolve automatically everywhere an A
244
244
 
245
245
  ```bash
246
246
  # Use a named account as transfer recipient
247
- dot tx Balances.transferKeepAlive treasury 1000000000000 --from alice
247
+ dot tx.Balances.transferKeepAlive treasury 1000000000000 --from alice --chain polkadot
248
248
 
249
249
  # Query by account name
250
- dot query System.Account treasury
250
+ dot polkadot.query.System.Account treasury
251
251
 
252
252
  # Dev accounts also resolve
253
- dot tx Balances.transferKeepAlive bob 1000000000000 --from alice
253
+ dot tx.Balances.transferKeepAlive bob 1000000000000 --from alice --chain polkadot
254
254
  ```
255
255
 
256
256
  Resolution order: dev account name > stored account name > SS58 address > hex public key. If the input doesn't match any, the CLI shows an error listing all available account names alphabetically, one per line. When the input is close to an existing name, a "Did you mean?" suggestion is included:
@@ -379,67 +379,59 @@ Security: default export replaces mnemonic/seed with `"<redacted>"`. `--include-
379
379
 
380
380
  ### Chain prefix
381
381
 
382
- Instead of the `--chain` flag, you can prefix any target with the chain name using dot notation:
382
+ Instead of the `--chain` flag, you can prefix the dot-path with the chain name. The prefix becomes the first segment of the dot-path:
383
383
 
384
384
  ```bash
385
- dot query kusama.System.Account 5GrwvaEF...
386
- dot const kusama.Balances.ExistentialDeposit
387
- dot tx kusama.Balances.transferKeepAlive 5FHneW46... 1000000000000 --from alice
388
- dot inspect kusama.System
389
- dot inspect kusama.System.Account
385
+ dot polkadot.query.System.Account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
386
+ dot polkadot.const.Balances.ExistentialDeposit
387
+ dot polkadot.tx.Balances.transferKeepAlive 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty 1000000000000 --from alice
388
+ dot inspect polkadot.System # for `inspect`, the prefix is the first arg
389
+ dot inspect polkadot.System.Account
390
390
  ```
391
391
 
392
- Chain names are case-insensitive — `Polkadot.System.Account`, `POLKADOT.System.Account`, and `polkadot.System.Account` all resolve the same way. The same applies to `--chain Polkadot`.
392
+ Chain names are case-insensitive — `Polkadot.query.System.Account`, `POLKADOT.query.System.Account`, and `polkadot.query.System.Account` all resolve the same way. The same applies to `--chain Polkadot`.
393
393
 
394
394
  Every invocation must specify a chain explicitly: either via a dotpath prefix (as above) or via `--chain <name>`. If both are provided, the CLI errors.
395
395
 
396
396
  ### Space-separated syntax
397
397
 
398
- Pallet and item segments can also be provided as separate arguments instead of dot notation. These forms are equivalent:
398
+ The `Pallet` and `Item` segments can be passed as separate arguments instead of dot-joined. These pairs are equivalent:
399
399
 
400
400
  ```bash
401
- # Dot notation vs space-separated — these are identical:
402
- dot query.System # dot notation
403
- dot query System # space-separated
401
+ # Dot notation vs fully space-separated — these are identical:
402
+ dot polkadot.query.System # dot notation
403
+ dot query System --chain polkadot # space-separated
404
404
 
405
- dot events.Balances.Transfer # dot notation
406
- dot events Balances Transfer # space-separated
405
+ dot polkadot.events.Balances.Transfer
406
+ dot events Balances Transfer --chain polkadot
407
407
 
408
- dot apis.Core # dot notation
409
- dot apis Core # space-separated
410
-
411
- # Especially useful with --chain flag:
412
- dot --chain kusama query System
413
- dot --chain kusama events Balances Transfer
414
- dot --chain kusama apis Core
408
+ dot polkadot.apis.Core
409
+ dot apis Core --chain polkadot
415
410
  ```
416
411
 
417
- This works for all categories (`query`, `tx`, `const`, `events`, `errors`, `apis`). Remaining arguments after the pallet and item are passed as method parameters as usual.
412
+ This works for all categories (`query`, `tx`, `const`, `events`, `errors`, `apis`). When passing positional method arguments, keep `Pallet` and `Item` either fully dot-joined (`query.System.Account 5Grw...`) or fully space-separated (`query System Account 5Grw...`) — mixing the two (`query System.Account 5Grw...`) does not work because the second arg gets parsed as a pallet name.
418
413
 
419
414
  ### Query storage
420
415
 
421
416
  ```bash
422
417
  # Plain storage value
423
- dot query System.Number
418
+ dot polkadot.query.System.Number
424
419
 
425
420
  # Map entry by key
426
- dot query System.Account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
421
+ dot polkadot.query.System.Account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
427
422
 
428
423
  # Map without key — shows help/usage (use --dump to fetch all entries)
429
- dot query System.Account
424
+ dot polkadot.query.System.Account
430
425
 
431
426
  # Dump all map entries (requires --dump)
432
- dot query System.Account --dump
433
-
434
- # Enum variant as map key (case-insensitive)
435
- dot query people-preview.ChunksManager.Chunks R2e9 1
427
+ dot polkadot.query.System.Account --dump
436
428
 
437
429
  # Pipe-safe — stdout is clean data, progress messages go to stderr
438
- dot query System.Account --dump | jq '.[0].value.data.free'
439
- dot query System.Number --json | jq '.+1'
430
+ dot polkadot.query.System.Account --dump | jq '.[0].value.data.free'
431
+ dot polkadot.query.System.Number --json | jq '.+1'
440
432
 
441
- # Query a specific chain using chain prefix
442
- dot query kusama.System.Account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
433
+ # --chain flag is equivalent to the dotpath prefix
434
+ dot query.System.Account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY --chain polkadot
443
435
  ```
444
436
 
445
437
  #### Partial key queries
@@ -450,13 +442,13 @@ prefix-based iteration and does not require `--dump`.
450
442
 
451
443
  ```bash
452
444
  # Full key — returns a single value
453
- dot query Staking.ErasStakers 100 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
445
+ dot polkadot.query.Staking.ErasStakers 100 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
454
446
 
455
447
  # Partial key — returns all entries matching the first key
456
- dot query Staking.ErasStakers 100
448
+ dot polkadot.query.Staking.ErasStakers 100
457
449
 
458
450
  # No keys — requires --dump (safety net for large maps)
459
- dot query Staking.ErasStakers --dump
451
+ dot polkadot.query.Staking.ErasStakers --dump
460
452
  ```
461
453
 
462
454
  #### Output formatting
@@ -469,47 +461,49 @@ Query results automatically convert on-chain types for readability:
469
461
 
470
462
  ```bash
471
463
  # Token metadata — symbol and name display as text, not {}
472
- dot query assethub-paseo.Assets.Metadata 50000413
464
+ dot paseo-asset-hub.query.Assets.Metadata 50000413
473
465
  # { "deposit": "6693666000", "name": "Paseo Token", "symbol": "PAS", ... }
474
466
  ```
475
467
 
476
468
  ### Look up constants
477
469
 
478
470
  ```bash
479
- dot const Balances.ExistentialDeposit
480
- dot const System.SS58Prefix --chain kusama
481
- dot const kusama.Balances.ExistentialDeposit
471
+ dot polkadot.const.Balances.ExistentialDeposit
472
+ dot polkadot.const.System.SS58Prefix
473
+
474
+ # --chain flag is equivalent
475
+ dot const.Balances.ExistentialDeposit --chain polkadot
482
476
 
483
477
  # Pipe-safe — stdout is clean JSON, progress messages go to stderr
484
- dot const Balances.ExistentialDeposit --json | jq
478
+ dot polkadot.const.Balances.ExistentialDeposit --json | jq
485
479
  ```
486
480
 
487
481
  ### Inspect metadata
488
482
 
489
- Works offline from cached metadata after the first fetch.
483
+ Works offline from cached metadata after the first fetch. The chain is required: pass it with `--chain` or as a prefix on the inspect target (e.g. `dot inspect polkadot.System`).
490
484
 
491
485
  ```bash
492
486
  # List all pallets (shows storage, constants, calls, events, and errors counts)
493
- dot inspect
487
+ dot inspect --chain polkadot
494
488
 
495
489
  # List a pallet's storage items, constants, calls, events, and errors
496
- dot inspect System
490
+ dot inspect System --chain polkadot
497
491
 
498
492
  # Detailed type info for a specific storage item or constant
499
- dot inspect System.Account
493
+ dot inspect System.Account --chain polkadot
500
494
 
501
495
  # Call detail — shows argument signature and docs
502
- dot inspect Balances.transfer_allow_death
496
+ dot inspect Balances.transfer_allow_death --chain polkadot
503
497
 
504
498
  # Event detail — shows field signature and docs
505
- dot inspect Balances.Transfer
499
+ dot inspect Balances.Transfer --chain polkadot
506
500
 
507
501
  # Error detail — shows docs
508
- dot inspect Balances.InsufficientBalance
502
+ dot inspect Balances.InsufficientBalance --chain polkadot
509
503
 
510
- # Inspect a specific chain using chain prefix
511
- dot inspect kusama.System
512
- dot inspect kusama.System.Account
504
+ # Chain prefix on the inspect target works too (note: `dot polkadot.inspect.X` does NOT — use either form below)
505
+ dot inspect polkadot.System
506
+ dot inspect polkadot.System.Account
513
507
  ```
514
508
 
515
509
  All listings — pallets, storage items, constants, calls, events, and errors — are sorted alphabetically, making it easy to find a specific item at a glance.
@@ -526,68 +520,126 @@ Documentation from the runtime metadata is shown on an indented line below each
526
520
 
527
521
  ### Runtime APIs
528
522
 
529
- Browse and call Substrate runtime APIs. These are top-level APIs exposed by the runtime (e.g. `Core`, `AccountNonceApi`, `TransactionPaymentApi`), accessed as `dot apis.ApiName.method`.
523
+ Browse and call Substrate runtime APIs. These are top-level APIs exposed by the runtime (e.g. `Core`, `AccountNonceApi`, `TransactionPaymentApi`), accessed as `dot <chain>.apis.ApiName.method`.
530
524
 
531
525
  ```bash
532
526
  # List all runtime APIs with method counts
533
- dot apis
527
+ dot polkadot.apis
534
528
 
535
529
  # List methods in a specific API (with signatures)
536
- dot apis.Core
530
+ dot polkadot.apis.Core
537
531
 
538
532
  # Call a runtime API method
539
- dot apis.Core.version
540
-
541
- # With chain prefix
542
533
  dot polkadot.apis.Core.version
543
534
 
544
- # Show method signature and docs
545
- dot apis.Core.version --help
535
+ # --chain flag is equivalent
536
+ dot apis.Core.version --chain polkadot
537
+
538
+ # Show method signature and docs (chain still required to load metadata)
539
+ dot apis.Core.version --chain polkadot --help
546
540
  ```
547
541
 
548
542
  `api` is an alias for `apis`.
549
543
 
550
- Runtime API info requires v15 metadata. If `dot apis` shows 0 APIs, update the cached metadata:
544
+ Runtime API info requires v15 metadata. If `dot <chain>.apis` shows 0 APIs, update the cached metadata:
545
+
546
+ ```bash
547
+ dot chain update polkadot # specific chain
548
+ dot chain update --all # all configured chains
549
+ ```
550
+
551
+ #### Argument formats
552
+
553
+ Runtime API arguments accept the same shorthand as `dot tx` arguments:
554
+
555
+ | Type | Pass as | Example |
556
+ |------|---------|---------|
557
+ | Integers (`u8` … `u32`, `i8` … `i32`) | decimal | `0`, `42` |
558
+ | Big integers (`u64`, `u128`, `u256`, `i64` …) | decimal | `1000000000000` |
559
+ | `bool` | `true` / `false` | `true` |
560
+ | `AccountId32` | dev name, stored account, SS58, or `0x` + 64 hex pubkey | `alice`, `5GrwvaEF…` |
561
+ | `Vec<u8>` (unsized bytes) | `0x…` hex or text | `0xdeadbeef`, `hello` |
562
+ | `[u8; N]` (sized bytes, e.g. `H160`/`H256`/raw `AccountId`) | `0x` + exactly `2 * N` hex chars (recommended), or text | `0x970951a12f975e6762482aca81e57d5a2a4e73f4` |
563
+ | `Option<T>` | `null` (recommended), `none`, `undefined` — or a `T` value for `Some(value)` | `null` |
564
+ | `Vec<T>` (non-byte) | JSON array or comma-separated | `[1,2,3]`, `1,2,3` |
565
+ | Structs / nested enums | JSON | `{"type":"X1","value":{…}}` |
566
+
567
+ For sized byte arrays (`[u8; N]`) — common for Ethereum-style addresses (`H160`, `[u8; 20]`), 32-byte hashes (`H256`), and raw `AccountId32` bytes — pass a `0x`-prefixed hex string. Example: a contract call against the `pallet-revive` runtime API:
568
+
569
+ ```bash
570
+ ALICE=5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
571
+ CONTRACT=0x970951a12f975e6762482aca81e57d5a2a4e73f4 # H160, [u8; 20]
572
+ CALLDATA=$(cast calldata "set(uint256)" 42)
573
+
574
+ dot paseo-asset-hub.apis.ReviveApi.call \
575
+ "$ALICE" "$CONTRACT" 0 null null "$CALLDATA"
576
+ # ^ origin ^ dest ^ value ^ gas_limit (Option, none) ^ deposit (Option, none) ^ input_data (Vec<u8>)
577
+ ```
578
+
579
+ ##### Passing `Option<T>`
580
+
581
+ Absent options (`None`) can be written three ways, all equivalent:
551
582
 
552
583
  ```bash
553
- dot chain update people-paseo # specific chain
554
- dot chain update --all # all configured chains
584
+ dot paseo-asset-hub.apis.ReviveApi.call "$ALICE" "$CONTRACT" 0 null null "$CALLDATA"
585
+ dot paseo-asset-hub.apis.ReviveApi.call "$ALICE" "$CONTRACT" 0 none none "$CALLDATA"
586
+ dot paseo-asset-hub.apis.ReviveApi.call "$ALICE" "$CONTRACT" 0 undefined undefined "$CALLDATA"
555
587
  ```
556
588
 
557
- ### Focused commands
589
+ `null` is the **recommended** form — it matches JSON / YAML semantics, so args read identically on the CLI and inside [file-based command](#file-based-commands) YAML/JSON inputs.
558
590
 
559
- Browse specific metadata categories directly without using `dot inspect`:
591
+ A present option (`Some(value)`) is just the value itself — no wrapping:
560
592
 
561
593
  ```bash
562
- # List all pallets
563
- dot pallets
594
+ # gas_limit = Some({ ref_time: 1_000_000, proof_size: 100_000 })
595
+ dot paseo-asset-hub.apis.ReviveApi.call "$ALICE" "$CONTRACT" 0 \
596
+ '{"ref_time":1000000,"proof_size":100000}' \
597
+ null \
598
+ "$CALLDATA"
599
+ ```
600
+
601
+ Notes:
602
+ - The `null` / `none` / `undefined` literals are case-sensitive (lowercase only).
603
+ - There is no `Some(value)` prefix — bare values are already treated as `Some`.
564
604
 
565
- # List pallet calls with argument signatures
566
- dot calls Balances
567
- dot calls Balances.transfer_allow_death # call detail
605
+ Use `dot <chain>.apis.<ApiName>.<method> --help` to see the exact argument signature for any method.
568
606
 
569
- # List pallet events with field signatures
570
- dot events Balances
571
- dot events Balances.Transfer # event detail
607
+ ### Focused metadata listings
572
608
 
573
- # List pallet errors
574
- dot errors Balances
575
- dot errors Balances.InsufficientBalance # error detail
609
+ Each category supports partial dot-paths for browsing metadata. Category-only invocations list pallets (or APIs); pallet-level invocations list items; item-level invocations show detail. Singular and plural aliases work: `event` = `events`, `error` = `errors`, `api` = `apis`, `consts` = `constants` = `const`.
610
+
611
+ ```bash
612
+ # List pallets with calls (and the calls themselves)
613
+ dot polkadot.tx # pallets with calls
614
+ dot polkadot.tx.Balances # calls with arg signatures
615
+ dot polkadot.tx.Balances.transfer_allow_death # call detail (or use --help)
576
616
 
577
- # List pallet storage items with types
578
- dot storage System
579
- dot storage System.Account # storage detail
617
+ # Events
618
+ dot polkadot.events # pallets with events
619
+ dot polkadot.events.Balances # events with field signatures
620
+ dot polkadot.events.Balances.Transfer # event detail
580
621
 
581
- # List pallet constants (dual-purpose — also works as value lookup)
582
- dot const Balances # list constants
583
- dot const Balances.ExistentialDeposit # look up value
622
+ # Errors
623
+ dot polkadot.errors # pallets with errors
624
+ dot polkadot.errors.Balances # errors with docs
625
+ dot polkadot.errors.Balances.InsufficientBalance
584
626
 
585
- # List runtime APIs
586
- dot apis # list all APIs
587
- dot apis.Core # list methods in Core
627
+ # Storage (via the query category)
628
+ dot polkadot.query # pallets with storage items
629
+ dot polkadot.query.System # storage items with types
630
+ dot polkadot.query.System.Account # storage help (use --dump for all entries)
631
+
632
+ # Constants
633
+ dot polkadot.const # pallets with constants
634
+ dot polkadot.const.Balances # list constants (offline)
635
+ dot polkadot.const.Balances.ExistentialDeposit # look up value (connects to chain)
636
+
637
+ # Runtime APIs
638
+ dot polkadot.apis # all runtime APIs
639
+ dot polkadot.apis.Core # methods in Core
588
640
  ```
589
641
 
590
- Each command supports `--chain <name>`, `--rpc <url>`, and chain prefix syntax. Singular and plural forms are interchangeable (e.g. `dot call` = `dot calls`, `dot event` = `dot events`, `dot api` = `dot apis`).
642
+ `--chain <name>` works as an alternative to the prefix in every form (e.g. `dot tx.Balances --chain polkadot`). To browse pallets across all categories at once, use `dot inspect` (see [Inspect metadata](#inspect-metadata)).
591
643
 
592
644
  ### Submit extrinsics
593
645
 
@@ -595,21 +647,28 @@ Build, sign, and submit transactions. Pass a `Pallet.Call` with arguments, or a
595
647
 
596
648
  ```bash
597
649
  # Simple remark
598
- dot tx System.remark 0xdeadbeef --from alice
650
+ dot tx.System.remark 0xdeadbeef --from alice --chain polkadot
599
651
 
600
652
  # Transfer (amount in plancks)
601
- dot tx Balances.transferKeepAlive 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty 1000000000000 --from alice
653
+ dot tx.Balances.transferKeepAlive 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty 1000000000000 --from alice --chain polkadot
602
654
 
603
655
  # Estimate fees without submitting
604
- dot tx Balances.transferKeepAlive 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty 1000000000000 --from alice --dry-run
656
+ dot tx.Balances.transferKeepAlive 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty 1000000000000 --from alice --chain polkadot --dry-run
605
657
 
606
658
  # Submit a raw SCALE-encoded call (e.g. from a multisig proposal or another tool)
607
- dot tx 0x0503008eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48 --from alice
659
+ dot tx 0x0503008eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48 --from alice --chain polkadot
608
660
 
609
661
  # Batch multiple transfers with Utility.batchAll (comma-separated encoded calls)
610
- A=$(dot tx Balances.transfer_keep_alive 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty 1000000000000 --encode)
611
- B=$(dot tx Balances.transfer_keep_alive 5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y 2000000000000 --encode)
612
- dot tx Utility.batchAll $A,$B --from alice
662
+ A=$(dot tx.Balances.transfer_keep_alive 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty 1000000000000 --encode --chain polkadot)
663
+ B=$(dot tx.Balances.transfer_keep_alive 5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y 2000000000000 --encode --chain polkadot)
664
+ dot tx.Utility.batchAll $A,$B --from alice --chain polkadot
665
+ ```
666
+
667
+ The dot-prefix form works for `tx` too — these are equivalent:
668
+
669
+ ```bash
670
+ dot tx.System.remark 0xdeadbeef --from alice --chain polkadot
671
+ dot polkadot.tx.System.remark 0xdeadbeef --from alice
613
672
  ```
614
673
 
615
674
  #### Enum shorthand
@@ -618,17 +677,17 @@ Enum arguments accept a concise `Variant(value)` syntax instead of verbose JSON:
618
677
 
619
678
  ```bash
620
679
  # Instead of: '{"type":"system","value":{"type":"Authorized"}}'
621
- dot tx Utility.dispatch_as 'system(Authorized)' $(dot tx System.remark 0xcafe --encode) --from alice
680
+ dot tx.Utility.dispatch_as 'system(Authorized)' $(dot tx.System.remark 0xcafe --encode --chain polkadot) --from alice --chain polkadot
622
681
 
623
682
  # Nested enums work too
624
- dot tx Utility.dispatch_as 'system(Signed(5FHneW46...))' <call> --from alice
683
+ dot tx.Utility.dispatch_as 'system(Signed(5FHneW46...))' <call> --from alice --chain polkadot
625
684
 
626
685
  # Void variants — empty parens or just the name
627
- dot tx ... 'Root()' ...
628
- dot tx ... 'Root' ...
686
+ dot tx.Pallet.call 'Root()' ... --from alice --chain polkadot
687
+ dot tx.Pallet.call 'Root' ... --from alice --chain polkadot
629
688
 
630
689
  # JSON inside parens for struct values
631
- dot tx ... 'AccountId32({"id":"0xd435..."})' ...
690
+ dot tx.Pallet.call 'AccountId32({"id":"0xd435..."})' ... --from alice --chain polkadot
632
691
  ```
633
692
 
634
693
  Variant matching is case-insensitive (`system` resolves to `system`, `authorized` to `Authorized`). All existing formats (JSON objects, hex, SS58 addresses) continue to work unchanged.
@@ -639,13 +698,13 @@ Encode a call to hex without signing or submitting. Useful for preparing calls t
639
698
 
640
699
  ```bash
641
700
  # Encode a remark call
642
- dot tx System.remark 0xdeadbeef --encode
701
+ dot tx.System.remark 0xdeadbeef --encode --chain polkadot
643
702
 
644
703
  # Encode a transfer (use the hex output in a batch or sudo call)
645
- dot tx Balances.transfer_keep_alive 5FHneW46... 1000000000000 --encode
704
+ dot tx.Balances.transfer_keep_alive 5FHneW46... 1000000000000 --encode --chain polkadot
646
705
 
647
706
  # Use encoded output with Sudo.sudo
648
- dot tx Sudo.sudo $(dot tx System.remark 0xcafe --encode) --from alice
707
+ dot tx.Sudo.sudo $(dot tx.System.remark 0xcafe --encode --chain polkadot) --from alice --chain polkadot
649
708
  ```
650
709
 
651
710
  #### Decode call data to YAML / JSON
@@ -654,18 +713,18 @@ Decode a hex-encoded call into a YAML or JSON file that is compatible with [file
654
713
 
655
714
  ```bash
656
715
  # Decode a raw hex call to YAML
657
- dot tx.0x0001076465616462656566 --to-yaml
716
+ dot tx.0x0001076465616462656566 --to-yaml --chain polkadot
658
717
 
659
718
  # Decode a raw hex call to JSON
660
- dot tx.0x0001076465616462656566 --to-json
719
+ dot tx.0x0001076465616462656566 --to-json --chain polkadot
661
720
 
662
721
  # Encode a named call and output as YAML
663
- dot tx.System.remark 0xdeadbeef --to-yaml
722
+ dot tx.System.remark 0xdeadbeef --to-yaml --chain polkadot
664
723
 
665
724
  # Round-trip: encode to hex, decode to YAML, re-encode from file
666
- dot tx.System.remark 0xdeadbeef --encode # 0x0001076465616462656566
667
- dot tx.0x0001076465616462656566 --to-yaml > remark.yaml
668
- dot ./remark.yaml --encode # same hex
725
+ dot tx.System.remark 0xdeadbeef --encode --chain polkadot # 0x0001076465616462656566
726
+ dot tx.0x0001076465616462656566 --to-yaml --chain polkadot > remark.yaml
727
+ dot ./remark.yaml --encode # chain comes from the file
669
728
  ```
670
729
 
671
730
  `--to-yaml` / `--to-json` are mutually exclusive with each other and with `--encode` and `--dry-run`.
@@ -690,7 +749,7 @@ Complex calls (e.g. XCM teleports) that the primary decoder cannot handle are au
690
749
  The CLI exits with code **1** when a finalized transaction has a dispatch error (e.g. insufficient balance, bad origin). The full transaction output (events, explorer links) is still printed before the error so you can debug the failure. Module errors are formatted as `PalletName.ErrorVariant` (e.g. `Balances.InsufficientBalance`).
691
750
 
692
751
  ```bash
693
- dot tx Balances.transferKeepAlive 5FHneW46... 999999999999999999 --from alice
752
+ dot tx.Balances.transferKeepAlive 5FHneW46... 999999999999999999 --from alice --chain polkadot
694
753
  # ... events and explorer links ...
695
754
  # Error: Transaction dispatch error: Balances.InsufficientBalance
696
755
  echo $? # 1
@@ -701,7 +760,7 @@ echo $? # 1
701
760
  When a call argument is invalid, the CLI shows a contextual error message with the argument name, the expected type, and a hint:
702
761
 
703
762
  ```bash
704
- dot tx Balances.transferKeepAlive 5GrwvaEF... abc --encode
763
+ dot tx.Balances.transferKeepAlive 5GrwvaEF... abc --encode --chain polkadot
705
764
  # Error: Invalid value for argument 'value' (expected Compact<u128>): "abc"
706
765
  # Hint: Compact<u128>
707
766
  ```
@@ -714,15 +773,15 @@ By default, `dot tx` waits for finalization (~30s on Polkadot). Use `--wait` / `
714
773
 
715
774
  ```bash
716
775
  # Return as soon as the tx is broadcast (fastest)
717
- dot tx System.remark 0xdead --from alice --wait broadcast
776
+ dot tx.System.remark 0xdead --from alice --chain polkadot --wait broadcast
718
777
 
719
778
  # Return when included in a best block
720
- dot tx System.remark 0xdead --from alice -w best-block
721
- dot tx System.remark 0xdead --from alice -w best # alias
779
+ dot tx.System.remark 0xdead --from alice --chain polkadot -w best-block
780
+ dot tx.System.remark 0xdead --from alice --chain polkadot -w best # alias
722
781
 
723
782
  # Wait for finalization (default, unchanged)
724
- dot tx System.remark 0xdead --from alice --wait finalized
725
- dot tx System.remark 0xdead --from alice # same
783
+ dot tx.System.remark 0xdead --from alice --chain polkadot --wait finalized
784
+ dot tx.System.remark 0xdead --from alice --chain polkadot # same
726
785
  ```
727
786
 
728
787
  | Level | Resolves when | Events shown | Explorer links |
@@ -735,7 +794,7 @@ The `--wait` flag is silently ignored when combined with `--dry-run` or `--encod
735
794
 
736
795
  #### Custom signed extensions
737
796
 
738
- Chains with non-standard signed extensions (e.g. `people-preview`) are auto-handled:
797
+ Chains with non-standard signed extensions are auto-handled:
739
798
 
740
799
  - `void` → empty bytes
741
800
  - `Option<T>` → `None`
@@ -744,7 +803,7 @@ Chains with non-standard signed extensions (e.g. `people-preview`) are auto-hand
744
803
  For manual override, use `--ext` with a JSON object:
745
804
 
746
805
  ```bash
747
- dot tx System.remark 0xdeadbeef --from alice --ext '{"MyExtension":{"value":"..."}}'
806
+ dot tx.System.remark 0xdeadbeef --from alice --chain polkadot --ext '{"MyExtension":{"value":"..."}}'
748
807
  ```
749
808
 
750
809
  #### Transaction options
@@ -760,23 +819,23 @@ Override low-level transaction parameters. Useful for rapid-fire submission (cus
760
819
 
761
820
  ```bash
762
821
  # Fire-and-forget: submit two txs in rapid succession with manual nonces
763
- dot tx System.remark 0xdead --from alice --nonce 0 --wait broadcast
764
- dot tx System.remark 0xbeef --from alice --nonce 1 --wait broadcast
822
+ dot tx.System.remark 0xdead --from alice --chain polkadot --nonce 0 --wait broadcast
823
+ dot tx.System.remark 0xbeef --from alice --chain polkadot --nonce 1 --wait broadcast
765
824
 
766
825
  # Add a priority tip (in planck)
767
- dot tx Balances.transferKeepAlive 5FHneW46... 1000000000000 --from alice --tip 1000000
826
+ dot tx.Balances.transferKeepAlive 5FHneW46... 1000000000000 --from alice --chain polkadot --tip 1000000
768
827
 
769
828
  # Submit an immortal transaction (no expiry)
770
- dot tx System.remark 0xdead --from alice --mortality immortal
829
+ dot tx.System.remark 0xdead --from alice --chain polkadot --mortality immortal
771
830
 
772
831
  # Set a custom mortality period (rounds up to nearest power of two)
773
- dot tx System.remark 0xdead --from alice --mortality 128
832
+ dot tx.System.remark 0xdead --from alice --chain polkadot --mortality 128
774
833
 
775
834
  # Validate against a specific block hash
776
- dot tx System.remark 0xdead --from alice --at 0x1234...abcd
835
+ dot tx.System.remark 0xdead --from alice --chain polkadot --at 0x1234...abcd
777
836
 
778
837
  # Combine: rapid-fire with tip and broadcast-only
779
- dot tx System.remark 0xdead --from alice --nonce 5 --tip 500000 --wait broadcast
838
+ dot tx.System.remark 0xdead --from alice --chain polkadot --nonce 5 --tip 500000 --wait broadcast
780
839
  ```
781
840
 
782
841
  When set, nonce / tip / mortality / at are shown in both `--dry-run` and submission output. These flags are silently ignored with `--encode`, `--to-yaml`, and `--to-json` (which return before signing).
@@ -787,12 +846,12 @@ On asset-hub-style chains (Polkadot Asset Hub, Paseo Asset Hub, etc.) the `Charg
787
846
 
788
847
  ```bash
789
848
  # Pay fees in USDT (asset id 1337, PalletInstance 50) on Polkadot Asset Hub
790
- dot tx Balances.transfer_keep_alive 5FHneW46... 1000000000000 \
849
+ dot tx.Balances.transfer_keep_alive 5FHneW46... 1000000000000 \
791
850
  --from alice --chain polkadot-asset-hub \
792
851
  --asset '{"parents":0,"interior":{"type":"X2","value":[{"type":"PalletInstance","value":50},{"type":"GeneralIndex","value":"1337"}]}}'
793
852
 
794
853
  # Dry-run to see the native-denominated fee estimate
795
- dot tx Balances.transfer_keep_alive 5FHneW46... 1000000000000 \
854
+ dot tx.Balances.transfer_keep_alive 5FHneW46... 1000000000000 \
796
855
  --from alice --chain polkadot-asset-hub --dry-run \
797
856
  --asset '{"parents":0,"interior":{"type":"X2","value":[{"type":"PalletInstance","value":50},{"type":"GeneralIndex","value":"1337"}]}}'
798
857
  ```
@@ -812,19 +871,19 @@ Submit transactions without a signer using `--unsigned`. This is for calls autho
812
871
 
813
872
  ```bash
814
873
  # Submit an authorized call on the People chain
815
- dot tx People.create_people_collection --unsigned --chain people
874
+ dot tx.People.create_people_collection --unsigned --chain polkadot-people
816
875
 
817
876
  # Dry-run to inspect before submitting
818
- dot tx People.create_people_collection --unsigned --chain people --dry-run
877
+ dot tx.People.create_people_collection --unsigned --chain polkadot-people --dry-run
819
878
 
820
879
  # Encode the full general transaction bytes
821
- dot tx People.create_people_collection --unsigned --chain people --encode
880
+ dot tx.People.create_people_collection --unsigned --chain polkadot-people --encode
822
881
 
823
882
  # With raw hex call data
824
- dot tx 0x3306 --unsigned --chain people
883
+ dot tx 0x3306 --unsigned --chain polkadot-people
825
884
 
826
885
  # JSON output for scripting
827
- dot tx People.create_people_collection --unsigned --chain people --json
886
+ dot tx.People.create_people_collection --unsigned --chain polkadot-people --json
828
887
  ```
829
888
 
830
889
  The CLI constructs a v5 general transaction with all extension values auto-defaulted (`VerifySignature::Disabled`, `Era::Immortal`, nonce `0`, tip `0`, etc.). Override individual extensions with `--ext` if needed.
@@ -832,7 +891,7 @@ The CLI constructs a v5 general transaction with all extension values auto-defau
832
891
  `--unsigned` is mutually exclusive with `--from`, `--nonce`, `--tip`, and `--mortality`. File-based input supports `unsigned: true`:
833
892
 
834
893
  ```yaml
835
- chain: people
894
+ chain: polkadot-people
836
895
  unsigned: true
837
896
  tx:
838
897
  People:
@@ -1020,7 +1079,7 @@ Hex values passed via `--var` are preserved as-is, including leading zeros. This
1020
1079
 
1021
1080
  ```bash
1022
1081
  # Encode a remark, then embed it in an XCM Transact via --var
1023
- CALL=$(dot tx.System.remark 0xdead --encode)
1082
+ CALL=$(dot tx.System.remark 0xdead --encode --chain polkadot)
1024
1083
  dot ./xcm-transact.yaml --var CALL=$CALL --encode
1025
1084
  ```
1026
1085
 
@@ -1145,21 +1204,24 @@ dot hash --help # same as `dot hash` — shows algorithms and examples
1145
1204
 
1146
1205
  #### Item-level help
1147
1206
 
1148
- Use `--help` on any fully-qualified dot-path to see metadata detail and category-specific usage hints all offline, no chain connection required:
1207
+ Use `--help` on any fully-qualified dot-path to see metadata detail and category-specific usage hints. The chain is required (so the CLI knows which metadata to load), but the call itself runs offline from the cache:
1149
1208
 
1150
1209
  ```bash
1151
- dot tx.System.remark --help # call args, docs, and tx options
1152
- dot query.System.Account --help # storage type, key/value info, and query options
1153
- dot const.Balances.ExistentialDeposit --help # constant type and docs
1154
- dot events.Balances.Transfer --help # event fields and docs
1155
- dot errors.Balances.InsufficientBalance --help # error docs
1156
- dot apis.Core.version --help # runtime API method signature and docs
1210
+ dot tx.System.remark --help --chain polkadot # call args, docs, and tx options
1211
+ dot query.System.Account --help --chain polkadot # storage type, key/value info, and query options
1212
+ dot const.Balances.ExistentialDeposit --help --chain polkadot # constant type and docs
1213
+ dot events.Balances.Transfer --help --chain polkadot # event fields and docs
1214
+ dot errors.Balances.InsufficientBalance --help --chain polkadot # error docs
1215
+ dot apis.Core.version --help --chain polkadot # runtime API method signature and docs
1216
+
1217
+ # A chain prefix is equivalent
1218
+ dot polkadot.tx.System.remark --help
1157
1219
  ```
1158
1220
 
1159
1221
  For `tx` commands, omitting both `--from` and `--encode` shows this same help output instead of an error:
1160
1222
 
1161
1223
  ```bash
1162
- dot tx.System.remark 0xdead # shows call help (no error)
1224
+ dot tx.System.remark 0xdead --chain polkadot # shows call help (no error)
1163
1225
  ```
1164
1226
 
1165
1227
  ### Global options
@@ -1180,20 +1242,20 @@ dot tx.System.remark 0xdead # shows call help (no error)
1180
1242
  Every command supports `--json` for machine-readable output. This works on data queries, metadata inspection, account management, chain configuration, and transaction submission:
1181
1243
 
1182
1244
  ```bash
1183
- dot inspect --json # All pallets as JSON
1184
- dot inspect Balances --json # Pallet detail with storage, constants, calls, events, errors
1185
- dot chain list --json # Configured chains
1186
- dot account list --json # Dev and stored accounts
1187
- dot account create my-key --json # New account details (mnemonic warning on stderr)
1188
- dot tx.System.remark 0xdead --encode --json # Encoded call hex wrapped in JSON
1189
- dot events.Balances --json # Event listing with field signatures
1190
- dot const.System --json # Constant listing with types
1245
+ dot inspect --json --chain polkadot # All pallets as JSON
1246
+ dot inspect Balances --json --chain polkadot # Pallet detail with storage, constants, calls, events, errors
1247
+ dot chain list --json # Configured chains
1248
+ dot account list --json # Dev and stored accounts
1249
+ dot account create my-key --json # New account details (mnemonic warning on stderr)
1250
+ dot polkadot.tx.System.remark 0xdead --encode --json # Encoded call hex wrapped in JSON
1251
+ dot polkadot.events.Balances --json # Event listing with field signatures
1252
+ dot polkadot.const.System --json # Constant listing with types
1191
1253
  ```
1192
1254
 
1193
1255
  For transaction submission, `--json` emits NDJSON (one JSON object per lifecycle event):
1194
1256
 
1195
1257
  ```bash
1196
- dot tx.System.remark 0xdead --from alice --json
1258
+ dot tx.System.remark 0xdead --from alice --chain polkadot --json
1197
1259
  # {"event":"signed","txHash":"0x..."}
1198
1260
  # {"event":"broadcasted","txHash":"0x..."}
1199
1261
  # {"event":"finalized","blockNumber":123,"blockHash":"0x...","ok":true,"events":[...]}
@@ -1204,11 +1266,11 @@ dot tx.System.remark 0xdead --from alice --json
1204
1266
  All commands follow Unix conventions: **data goes to stdout, progress goes to stderr**. This means you can safely pipe `--json` into `jq` or other tools without progress messages ("Fetching metadata...", spinner output, "Connecting...") corrupting the data stream:
1205
1267
 
1206
1268
  ```bash
1207
- dot const System.SS58Prefix --json | jq '.+1'
1208
- dot query System.Number --json | jq
1269
+ dot polkadot.const.System.SS58Prefix --json | jq '.+1'
1270
+ dot polkadot.query.System.Number --json | jq
1209
1271
  dot chain list --json | jq '.chains[].name'
1210
1272
  dot account list --json | jq '.stored[].address'
1211
- dot inspect --json | jq '.pallets[] | select(.events > 10) | .name'
1273
+ dot inspect --json --chain polkadot | jq '.pallets[] | select(.events > 10) | .name'
1212
1274
  ```
1213
1275
 
1214
1276
  In an interactive terminal, both streams render together so you see progress and results normally.
@@ -1252,7 +1314,7 @@ Completions are context-aware: `query.` shows pallets with storage items, `tx.`
1252
1314
  | **Read constants** | yes | yes | yes | — |
1253
1315
  | **Submit extrinsics** | yes, with dry-run | yes (via `--seed`) | — | ink! contract calls only |
1254
1316
  | **Inspect metadata** | yes | — | yes (excellent browser) | — |
1255
- | **Chain presets** | built-in aliases (`--chain kusama`) | — (manual `--ws` every call) | — | parachain templates |
1317
+ | **Chain presets** | built-in aliases (`--chain polkadot`) | — (manual `--ws` every call) | — | parachain templates |
1256
1318
  | **Tx tracking + explorer links** | spinner progress, block + explorer link | basic events | — | — |
1257
1319
 
1258
1320
  polkadot-cli aims to be the single tool for day-to-day chain interaction: storage reads, constant lookups, transaction submission, and metadata browsing with a polished terminal UX. @polkadot/api-cli covers similar ground but is in maintenance mode and requires verbose flags. subxt-cli has an excellent metadata explorer but cannot sign or submit transactions. Pop CLI targets a different workflow — scaffolding parachains and deploying ink! contracts rather than end-user chain queries.
@@ -1308,7 +1370,7 @@ Requires [Bun](https://bun.sh).
1308
1370
 
1309
1371
  ```bash
1310
1372
  bun install
1311
- bun run dev -- query System.Number
1373
+ bun run dev -- polkadot.query.System.Number
1312
1374
  bun run build
1313
1375
  bun test
1314
1376
  ```
package/dist/cli.mjs CHANGED
@@ -1262,7 +1262,10 @@ async function parseTypedArg(meta, entry, arg) {
1262
1262
  case "array": {
1263
1263
  const inner = entry.value;
1264
1264
  if (inner.type === "primitive" && inner.value === "u8") {
1265
- if (/^0x[0-9a-fA-F]*$/.test(arg))
1265
+ const isHex = /^0x[0-9a-fA-F]*$/.test(arg);
1266
+ if (entry.type === "array" && isHex)
1267
+ return arg;
1268
+ if (isHex)
1266
1269
  return Binary2.fromHex(arg);
1267
1270
  return Binary2.fromText(arg);
1268
1271
  }
@@ -1891,7 +1894,8 @@ async function showItemHelp(category, target, opts) {
1891
1894
  }
1892
1895
  console.log();
1893
1896
  console.log(`${BOLD}Usage:${RESET}`);
1894
- console.log(` dot apis.${api.name}.${method.name}`);
1897
+ console.log(` dot ${chainName}.apis.${api.name}.${method.name}`);
1898
+ console.log(` dot apis.${api.name}.${method.name} --chain ${chainName}`);
1895
1899
  console.log();
1896
1900
  return;
1897
1901
  }
@@ -1933,8 +1937,9 @@ async function showItemHelp(category, target, opts) {
1933
1937
  }
1934
1938
  console.log();
1935
1939
  console.log(`${BOLD}Usage:${RESET}`);
1936
- console.log(` dot tx.${pallet.name}.${callItem.name} --from <account>`);
1937
- console.log(` dot tx.${pallet.name}.${callItem.name} --encode`);
1940
+ console.log(` dot tx.${pallet.name}.${callItem.name} --from <account> --chain ${chainName}`);
1941
+ console.log(` dot tx.${pallet.name}.${callItem.name} --encode --chain ${chainName}`);
1942
+ console.log(` dot ${chainName}.tx.${pallet.name}.${callItem.name} --from <account>`);
1938
1943
  console.log();
1939
1944
  console.log(`${BOLD}Options:${RESET}`);
1940
1945
  console.log(` --from <name> Account to sign with`);
@@ -1963,11 +1968,11 @@ async function showItemHelp(category, target, opts) {
1963
1968
  console.log();
1964
1969
  if (storageItem.keyTypeId != null) {
1965
1970
  console.log(`${BOLD}Usage:${RESET}`);
1966
- console.log(` dot query.${pallet.name}.${storageItem.name} <key>`);
1967
- console.log(` dot query.${pallet.name}.${storageItem.name} --dump # all entries`);
1971
+ console.log(` dot ${chainName}.query.${pallet.name}.${storageItem.name} <key>`);
1972
+ console.log(` dot ${chainName}.query.${pallet.name}.${storageItem.name} --dump # all entries`);
1968
1973
  } else {
1969
1974
  console.log(`${BOLD}Usage:${RESET}`);
1970
- console.log(` dot query.${pallet.name}.${storageItem.name}`);
1975
+ console.log(` dot ${chainName}.query.${pallet.name}.${storageItem.name}`);
1971
1976
  }
1972
1977
  console.log();
1973
1978
  console.log(`${BOLD}Options:${RESET}`);
@@ -1989,7 +1994,7 @@ async function showItemHelp(category, target, opts) {
1989
1994
  }
1990
1995
  console.log();
1991
1996
  console.log(`${BOLD}Usage:${RESET}`);
1992
- console.log(` dot const.${pallet.name}.${constItem.name}`);
1997
+ console.log(` dot ${chainName}.const.${pallet.name}.${constItem.name}`);
1993
1998
  console.log();
1994
1999
  return;
1995
2000
  }
@@ -2008,7 +2013,7 @@ async function showItemHelp(category, target, opts) {
2008
2013
  }
2009
2014
  console.log();
2010
2015
  console.log(`${BOLD}Usage:${RESET}`);
2011
- console.log(` dot events.${pallet.name}.${eventItem.name}`);
2016
+ console.log(` dot ${chainName}.events.${pallet.name}.${eventItem.name}`);
2012
2017
  console.log();
2013
2018
  return;
2014
2019
  }
@@ -2024,7 +2029,7 @@ async function showItemHelp(category, target, opts) {
2024
2029
  }
2025
2030
  console.log();
2026
2031
  console.log(`${BOLD}Usage:${RESET}`);
2027
- console.log(` dot errors.${pallet.name}.${errorItem.name}`);
2032
+ console.log(` dot ${chainName}.errors.${pallet.name}.${errorItem.name}`);
2028
2033
  console.log();
2029
2034
  return;
2030
2035
  }
@@ -2423,7 +2428,7 @@ var init_complete = __esm(() => {
2423
2428
  // src/cli.ts
2424
2429
  import cac from "cac";
2425
2430
  // package.json
2426
- var version = "1.14.0";
2431
+ var version = "1.14.2";
2427
2432
 
2428
2433
  // src/commands/account.ts
2429
2434
  init_accounts_store();
@@ -4227,7 +4232,8 @@ async function showItemHelp2(category, target, opts) {
4227
4232
  }
4228
4233
  console.log();
4229
4234
  console.log(`${BOLD}Usage:${RESET}`);
4230
- console.log(` dot apis.${api.name}.${method.name}`);
4235
+ console.log(` dot ${chainName}.apis.${api.name}.${method.name}`);
4236
+ console.log(` dot apis.${api.name}.${method.name} --chain ${chainName}`);
4231
4237
  console.log();
4232
4238
  return;
4233
4239
  }
@@ -4269,8 +4275,9 @@ async function showItemHelp2(category, target, opts) {
4269
4275
  }
4270
4276
  console.log();
4271
4277
  console.log(`${BOLD}Usage:${RESET}`);
4272
- console.log(` dot tx.${pallet.name}.${callItem.name} --from <account>`);
4273
- console.log(` dot tx.${pallet.name}.${callItem.name} --encode`);
4278
+ console.log(` dot tx.${pallet.name}.${callItem.name} --from <account> --chain ${chainName}`);
4279
+ console.log(` dot tx.${pallet.name}.${callItem.name} --encode --chain ${chainName}`);
4280
+ console.log(` dot ${chainName}.tx.${pallet.name}.${callItem.name} --from <account>`);
4274
4281
  console.log();
4275
4282
  console.log(`${BOLD}Options:${RESET}`);
4276
4283
  console.log(` --from <name> Account to sign with`);
@@ -4299,11 +4306,11 @@ async function showItemHelp2(category, target, opts) {
4299
4306
  console.log();
4300
4307
  if (storageItem.keyTypeId != null) {
4301
4308
  console.log(`${BOLD}Usage:${RESET}`);
4302
- console.log(` dot query.${pallet.name}.${storageItem.name} <key>`);
4303
- console.log(` dot query.${pallet.name}.${storageItem.name} --dump # all entries`);
4309
+ console.log(` dot ${chainName}.query.${pallet.name}.${storageItem.name} <key>`);
4310
+ console.log(` dot ${chainName}.query.${pallet.name}.${storageItem.name} --dump # all entries`);
4304
4311
  } else {
4305
4312
  console.log(`${BOLD}Usage:${RESET}`);
4306
- console.log(` dot query.${pallet.name}.${storageItem.name}`);
4313
+ console.log(` dot ${chainName}.query.${pallet.name}.${storageItem.name}`);
4307
4314
  }
4308
4315
  console.log();
4309
4316
  console.log(`${BOLD}Options:${RESET}`);
@@ -4325,7 +4332,7 @@ async function showItemHelp2(category, target, opts) {
4325
4332
  }
4326
4333
  console.log();
4327
4334
  console.log(`${BOLD}Usage:${RESET}`);
4328
- console.log(` dot const.${pallet.name}.${constItem.name}`);
4335
+ console.log(` dot ${chainName}.const.${pallet.name}.${constItem.name}`);
4329
4336
  console.log();
4330
4337
  return;
4331
4338
  }
@@ -4344,7 +4351,7 @@ async function showItemHelp2(category, target, opts) {
4344
4351
  }
4345
4352
  console.log();
4346
4353
  console.log(`${BOLD}Usage:${RESET}`);
4347
- console.log(` dot events.${pallet.name}.${eventItem.name}`);
4354
+ console.log(` dot ${chainName}.events.${pallet.name}.${eventItem.name}`);
4348
4355
  console.log();
4349
4356
  return;
4350
4357
  }
@@ -4360,7 +4367,7 @@ async function showItemHelp2(category, target, opts) {
4360
4367
  }
4361
4368
  console.log();
4362
4369
  console.log(`${BOLD}Usage:${RESET}`);
4363
- console.log(` dot errors.${pallet.name}.${errorItem.name}`);
4370
+ console.log(` dot ${chainName}.errors.${pallet.name}.${errorItem.name}`);
4364
4371
  console.log();
4365
4372
  return;
4366
4373
  }
@@ -5418,7 +5425,7 @@ async function handleTx(target, args, opts) {
5418
5425
  if (isRawCall) {
5419
5426
  if (args.length > 0) {
5420
5427
  throw new Error(`Extra arguments are not allowed when submitting a raw call hex.
5421
- ` + "Usage: dot tx 0x<call_hex> --from <account>");
5428
+ ` + "Usage: dot tx 0x<call_hex> --from <account> --chain <chain>");
5422
5429
  }
5423
5430
  callHex = target;
5424
5431
  if (opts.toYaml || opts.toJson) {
@@ -6260,7 +6267,10 @@ async function parseTypedArg2(meta, entry, arg) {
6260
6267
  case "array": {
6261
6268
  const inner = entry.value;
6262
6269
  if (inner.type === "primitive" && inner.value === "u8") {
6263
- if (/^0x[0-9a-fA-F]*$/.test(arg))
6270
+ const isHex = /^0x[0-9a-fA-F]*$/.test(arg);
6271
+ if (entry.type === "array" && isHex)
6272
+ return arg;
6273
+ if (isHex)
6264
6274
  return Binary3.fromHex(arg);
6265
6275
  return Binary3.fromText(arg);
6266
6276
  }
@@ -7100,18 +7110,18 @@ if (process.argv[2] === "__complete") {
7100
7110
  console.log(" apis Browse and call runtime APIs");
7101
7111
  console.log();
7102
7112
  console.log("Examples:");
7103
- console.log(" dot query.System.Account <addr> Query a storage item");
7104
- console.log(" dot query.System List storage items in System");
7105
- console.log(" dot tx.System.remark 0xdead --from alice");
7106
- console.log(" dot tx.System.remark 0xdead --unsigned Submit unsigned/bare tx");
7107
- console.log(" dot const.Balances.ExistentialDeposit");
7108
- console.log(" dot events.Balances List events in Balances");
7109
- console.log(" dot apis.Core.version Call a runtime API");
7110
- console.log(" dot polkadot.query.System.Number With chain prefix");
7111
- console.log(" dot ./transfer.yaml --from alice Run from file");
7112
- console.log(" dot tx.0x1f0003... --to-yaml Decode hex call to YAML");
7113
- console.log(" dot tx.System.remark 0xdead --to-json Encode & output as JSON file format");
7114
- console.log(" dot query.System.Number --json Output as JSON");
7113
+ console.log(" dot polkadot.query.System.Account <addr> Query a storage item");
7114
+ console.log(" dot polkadot.query.System List storage items in System");
7115
+ console.log(" dot tx.System.remark 0xdead --from alice --chain polkadot");
7116
+ console.log(" dot tx.People.create_people_collection --unsigned --chain polkadot-people");
7117
+ console.log(" dot polkadot.const.Balances.ExistentialDeposit");
7118
+ console.log(" dot polkadot.events.Balances List events in Balances");
7119
+ console.log(" dot polkadot.apis.Core.version Call a runtime API");
7120
+ console.log(" dot query.System.Number --chain polkadot --chain flag form");
7121
+ console.log(" dot ./transfer.yaml --from alice Run from file (chain in YAML)");
7122
+ console.log(" dot tx.0x1f0003... --to-yaml --chain polkadot Decode hex call to YAML");
7123
+ console.log(" dot tx.System.remark 0xdead --to-json --chain polkadot Output as JSON file format");
7124
+ console.log(" dot polkadot.query.System.Number --json JSON output");
7115
7125
  console.log();
7116
7126
  console.log("Commands:");
7117
7127
  console.log(" inspect [target] Inspect chain metadata (alias: explore)");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polkadot-cli",
3
- "version": "1.14.0",
3
+ "version": "1.14.2",
4
4
  "description": "CLI tool for querying Polkadot-ecosystem on-chain state",
5
5
  "type": "module",
6
6
  "bin": {