polkadot-cli 1.14.1 → 1.15.0

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 +316 -192
  2. package/dist/cli.mjs +395 -145
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -14,12 +14,12 @@ Ships with Polkadot and all system parachains preconfigured with multiple fallba
14
14
  - ✅ zsh, bash, and fish autocompletion
15
15
  - ✅ Exposes all on-chain metadata documentation
16
16
  - ✅ Encode, dry-run, and submit extrinsics
17
- - ✅ Support for custom signed extensions
17
+ - ✅ Support for custom signed extensions — and a `dot <chain>.extensions` inspector to discover them
18
18
  - ✅ Built with agent use in mind — structured JSON output on every command (`--json`)
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
@@ -29,6 +29,7 @@ Ships with Polkadot and all system parachains preconfigured with multiple fallba
29
29
  - ✅ Non-native fee payment — pay tx fees in any asset the chain accepts via `--asset` (asset-hub-style chains)
30
30
  - ✅ Bandersnatch member keys — derive Ring VRF member keys from mnemonics for on-chain member sets
31
31
  - ✅ Export/import — portable chain and account configuration for backup, sharing, and CI bootstrapping
32
+ - ✅ Claude Code skill — `dot-cli` skill installable as a plugin marketplace, teaches agents how to drive the CLI
32
33
 
33
34
  ### Preconfigured chains
34
35
 
@@ -57,6 +58,25 @@ npm install -g polkadot-cli@latest
57
58
 
58
59
  This installs the `dot` command globally.
59
60
 
61
+ ## Claude Code skill
62
+
63
+ This repo ships a [Claude Code](https://claude.com/claude-code) skill that teaches Claude how to drive the `dot` CLI — query patterns, tx encoding, runtime API calls, and bash scripting gotchas.
64
+
65
+ Register the marketplace and install the skill:
66
+
67
+ ```
68
+ /plugin marketplace add peetzweg/polkadot-cli
69
+ /plugin install dot-cli@polkadot-cli
70
+ ```
71
+
72
+ The skill auto-triggers when you ask Claude about `dot`, Substrate storage queries, extrinsic submission, runtime APIs, or XCM. You can also invoke it directly with `/dot-cli`.
73
+
74
+ To pull the latest skill updates:
75
+
76
+ ```
77
+ /plugin marketplace update polkadot-cli
78
+ ```
79
+
60
80
  ## Usage
61
81
 
62
82
  ### Manage chains
@@ -82,11 +102,11 @@ dot chain add my-para --rpc wss://rpc.example.com --relay polkadot --parachain-i
82
102
  dot chain list
83
103
 
84
104
  # 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
105
+ dot chain update polkadot # updates a specific chain
106
+ dot chain update --all # updates all configured chains in parallel
87
107
 
88
- # Remove a chain
89
- dot chain remove westend
108
+ # Remove a chain (only user-added chains can be removed)
109
+ dot chain remove kusama
90
110
  ```
91
111
 
92
112
  #### Chain topology
@@ -129,11 +149,11 @@ dot polkadot.query.System.Number
129
149
  dot polkadot.query.System.Number --chain polkadot # ✗ errors
130
150
  ```
131
151
 
132
- Chain names are case-insensitive. The prefix form also works with the space-separated syntax (`dot query polkadot.System.Account ...`).
152
+ Chain names are case-insensitive (`Polkadot.query.System.Number` works the same).
133
153
 
134
154
  #### Export/import chain configuration
135
155
 
136
- Export and import chain configurations for backup, sharing across machines, or team collaboration. Metadata is not included — re-fetch with `dot chain update --all` after importing.
156
+ Export and import chain configurations for backup, sharing across machines, or team collaboration.
137
157
 
138
158
  ```bash
139
159
  # Export custom chains to stdout (pipe-friendly JSON)
@@ -157,12 +177,36 @@ dot chain import my-chains.json --dry-run
157
177
  # Overwrite existing chains
158
178
  dot chain import my-chains.json --overwrite
159
179
 
180
+ # Skip automatic metadata fetch (faster for offline/CI bootstrap)
181
+ dot chain import my-chains.json --no-metadata
182
+
160
183
  # Pipe between machines
161
184
  ssh remote-dev "dot chain export" | dot chain import -
162
185
  ```
163
186
 
164
187
  By default, `export` only includes user-added chains and built-ins with modified RPCs. Use `--all` to include everything. Import skips existing chains unless `--overwrite` is passed, and validates relay references with warnings for missing relays.
165
188
 
189
+ After a non-dry-run import, metadata is fetched automatically for each newly added or overwritten chain so tab completion and metadata-dependent commands work immediately. Pass `--no-metadata` to skip the fetch — you can always backfill later with `dot chain update --all`.
190
+
191
+ Output shows one line per chain with a status glyph and a terse summary:
192
+
193
+ ```
194
+ ✓ preview
195
+ ✓ preview-people
196
+ ⟳ polkadot (overwritten)
197
+ - paseo (skipped)
198
+
199
+ 2 added, 1 overwritten, 1 skipped
200
+
201
+ Updating metadata for 3 chain(s)...
202
+
203
+ ✓ preview
204
+ ✓ preview-people
205
+ ✓ polkadot
206
+ ```
207
+
208
+ Running `dot chain import` with no file path prints the subcommand help instead of blocking on stdin.
209
+
166
210
  ### Manage accounts
167
211
 
168
212
  Dev accounts (Alice, Bob, Charlie, Dave, Eve, Ferdie) are always available for testnets. Create or import your own accounts for any chain.
@@ -187,20 +231,20 @@ dot account create my-validator
187
231
  # Create with a derivation path
188
232
  dot account create my-staking --path //staking
189
233
 
190
- # Import from a BIP39 mnemonic
191
- dot account import treasury --secret "word1 word2 ... word12"
234
+ # Add a keyed account from a BIP39 mnemonic
235
+ dot account add treasury --secret "word1 word2 ... word12"
192
236
 
193
- # Import with a derivation path
194
- dot account import hot-wallet --secret "word1 word2 ... word12" --path //hot
237
+ # Add with a derivation path
238
+ dot account add hot-wallet --secret "word1 word2 ... word12" --path //hot
195
239
 
196
- # Import an env-var-backed account (secret stays off disk)
197
- dot account import ci-signer --env MY_SECRET
240
+ # Add an env-var-backed account (secret stays off disk)
241
+ dot account add ci-signer --env MY_SECRET
198
242
 
199
243
  # Derive a child account from an existing one
200
244
  dot account derive treasury treasury-staking --path //staking
201
245
 
202
246
  # Use it — the env var is read at signing time
203
- MY_SECRET="word1 word2 ..." dot tx System.remark 0xdead --from ci-signer
247
+ MY_SECRET="word1 word2 ..." dot tx.System.remark 0xdead --from ci-signer --chain polkadot
204
248
 
205
249
  # Remove one or more accounts
206
250
  dot account remove my-validator
@@ -212,9 +256,9 @@ dot account export --include-secrets --file backup.json
212
256
  dot account export --watch-only
213
257
 
214
258
  # Batch-import accounts from a file
215
- dot account import --file team-accounts.json
216
- dot account import --file accounts.json --dry-run
217
- dot account import --file accounts.json --overwrite
259
+ dot account import team-accounts.json
260
+ dot account import accounts.json --dry-run
261
+ dot account import accounts.json --overwrite
218
262
 
219
263
  # Inspect an account — show public key and SS58 address
220
264
  dot account inspect alice
@@ -236,7 +280,7 @@ dot account add council 0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684
236
280
 
237
281
  Watch-only accounts appear in `dot account list` with a `(watch-only)` badge and can be inspected and removed like any other account. They cannot be used with `--from` (signing) or as a source for `derive`.
238
282
 
239
- The `add` subcommand is context-sensitive: bare `add <name> <address>` creates a watch-only entry, while `add --secret` or `add --env` imports a keyed account (same as `import`).
283
+ The `add` subcommand is context-sensitive: bare `add <name> <address>` creates a watch-only entry, while `add --secret` or `add --env` imports a keyed account. `dot account import` is reserved for file-based batch import.
240
284
 
241
285
  #### Named address resolution
242
286
 
@@ -244,13 +288,13 @@ Named accounts (both watch-only and keyed) resolve automatically everywhere an A
244
288
 
245
289
  ```bash
246
290
  # Use a named account as transfer recipient
247
- dot tx Balances.transferKeepAlive treasury 1000000000000 --from alice
291
+ dot tx.Balances.transferKeepAlive treasury 1000000000000 --from alice --chain polkadot
248
292
 
249
293
  # Query by account name
250
- dot query System.Account treasury
294
+ dot polkadot.query.System.Account treasury
251
295
 
252
296
  # Dev accounts also resolve
253
- dot tx Balances.transferKeepAlive bob 1000000000000 --from alice
297
+ dot tx.Balances.transferKeepAlive bob 1000000000000 --from alice --chain polkadot
254
298
  ```
255
299
 
256
300
  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:
@@ -297,21 +341,32 @@ dot account inspect alice --json
297
341
  # {"publicKey":"0xd435...a27d","ss58":"5Grw...utQY","prefix":42,"name":"Alice"}
298
342
  ```
299
343
 
344
+ #### Reveal the sr25519 private key
345
+
346
+ For provisioning another signer (e.g. a server that expects a raw hex private key in an env var), add `--show-secret` to print the **64-byte sr25519 expanded secret** as `0x`-prefixed hex:
347
+
348
+ ```bash
349
+ dot account inspect dave --show-secret
350
+ # Private Key: 0x<128 hex chars> (sr25519 expanded, 64 bytes — never share)
351
+ ```
352
+
353
+ Works for dev accounts (derived on-the-fly from the standard dev mnemonic) and for stored accounts that have a secret (mnemonic or hex seed). Refuses on watch-only accounts, bare SS58 addresses, or hex public keys. The hex is the final secret after any derivation path is applied, so it can be fed directly to signers that don't accept a mnemonic+path (e.g. `@scure/sr25519`'s `sign`, or services like identity-backend that read a `PROXY_PRIVATE_KEY`). Combine with `--json` to include it under the `privateKey` field.
354
+
300
355
  #### Env-var-backed accounts
301
356
 
302
357
  For CI/CD and security-conscious workflows, store a reference to an environment variable instead of the secret itself:
303
358
 
304
359
  ```bash
305
- dot account import ci-signer --env MY_SECRET
360
+ dot account add ci-signer --env MY_SECRET
306
361
  ```
307
362
 
308
- `--secret` and `--env` are mutually exclusive. `add` is an alias for `import`.
363
+ `--secret` and `--env` are mutually exclusive. Use `dot account add` for single-account imports; `dot account import` is reserved for file-based batch import.
309
364
 
310
365
  The secret is never written to disk. At signing time, the CLI reads `$MY_SECRET` and derives the keypair. If the variable is not set, the CLI errors with a clear message. `account list` shows an `(env: MY_SECRET)` badge and resolves the address live when the variable is available.
311
366
 
312
367
  #### Derivation paths
313
368
 
314
- Use `--path` with `create`, `import`, or the `derive` action to derive child keys from the same secret. Different paths produce different keypairs, enabling key separation (e.g. staking vs. governance) without managing multiple mnemonics.
369
+ Use `--path` with `create`, `add`, or the `derive` action to derive child keys from the same secret. Different paths produce different keypairs, enabling key separation (e.g. staking vs. governance) without managing multiple mnemonics.
315
370
 
316
371
  ```bash
317
372
  # Create with a derivation path
@@ -320,8 +375,8 @@ dot account create my-staking --path //staking
320
375
  # Multi-segment path (hard + soft junctions)
321
376
  dot account create multi --path //polkadot//0/wallet
322
377
 
323
- # Import with a path
324
- dot account import hot --secret "word1 word2 ..." --path //hot
378
+ # Add with a path
379
+ dot account add hot --secret "word1 word2 ..." --path //hot
325
380
 
326
381
  # Derive a child from an existing account
327
382
  dot account derive treasury treasury-staking --path //staking
@@ -362,84 +417,80 @@ dot account export --include-secrets --file backup.json
362
417
  # Export only watch-only accounts (always safe)
363
418
  dot account export --watch-only
364
419
 
365
- # Batch-import accounts from a file
366
- dot account import --file team-accounts.json
420
+ # Batch-import accounts from a file (positional path, like `dot chain import`)
421
+ dot account import team-accounts.json
367
422
 
368
423
  # Preview without applying
369
- dot account import --file accounts.json --dry-run
424
+ dot account import accounts.json --dry-run
370
425
 
371
426
  # Overwrite existing accounts
372
- dot account import --file accounts.json --overwrite
427
+ dot account import accounts.json --overwrite
373
428
 
374
429
  # Pipe from another machine
375
- ssh remote-dev "dot account export --watch-only" | dot account import --file /dev/stdin
430
+ ssh remote-dev "dot account export --watch-only" | dot account import -
376
431
  ```
377
432
 
378
- Security: default export replaces mnemonic/seed with `"<redacted>"`. `--include-secrets` is required for actual secrets. Env-backed accounts export the variable *name* (e.g. `{"env": "MY_SECRET"}`), never the value. Redacted accounts import as watch-only (public key preserved, no signing capability). The existing single-account `import` (`--secret`/`--env`) is unchanged batch import uses `--file` to distinguish.
433
+ Output mirrors `dot chain import` one line per account with a status glyph (`✓` added, `⟳` overwritten, `-` skipped) and a terse count summary at the end. Running `dot account import` with no file path prints the subcommand help instead of blocking on stdin.
434
+
435
+ `dot account import` is file-only. For a single-account import from a mnemonic or env variable, use `dot account add <name> --secret "..."` or `dot account add <name> --env VAR`.
436
+
437
+ Security: default export replaces mnemonic/seed with `"<redacted>"`. `--include-secrets` is required for actual secrets. Env-backed accounts export the variable *name* (e.g. `{"env": "MY_SECRET"}`), never the value. Redacted accounts import as watch-only (public key preserved, no signing capability).
379
438
 
380
439
  ### Chain prefix
381
440
 
382
- Instead of the `--chain` flag, you can prefix any target with the chain name using dot notation:
441
+ 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
442
 
384
443
  ```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
444
+ dot polkadot.query.System.Account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
445
+ dot polkadot.const.Balances.ExistentialDeposit
446
+ dot polkadot.tx.Balances.transferKeepAlive 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty 1000000000000 --from alice
447
+ dot inspect polkadot.System # for `inspect`, the prefix is the first arg
448
+ dot inspect polkadot.System.Account
390
449
  ```
391
450
 
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`.
451
+ 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
452
 
394
453
  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
454
 
396
455
  ### Space-separated syntax
397
456
 
398
- Pallet and item segments can also be provided as separate arguments instead of dot notation. These forms are equivalent:
457
+ The `Pallet` and `Item` segments can be passed as separate arguments instead of dot-joined. These pairs are equivalent:
399
458
 
400
459
  ```bash
401
- # Dot notation vs space-separated — these are identical:
402
- dot query.System # dot notation
403
- dot query System # space-separated
404
-
405
- dot events.Balances.Transfer # dot notation
406
- dot events Balances Transfer # space-separated
460
+ # Dot notation vs fully space-separated — these are identical:
461
+ dot polkadot.query.System # dot notation
462
+ dot query System --chain polkadot # space-separated
407
463
 
408
- dot apis.Core # dot notation
409
- dot apis Core # space-separated
464
+ dot polkadot.events.Balances.Transfer
465
+ dot events Balances Transfer --chain polkadot
410
466
 
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
467
+ dot polkadot.apis.Core
468
+ dot apis Core --chain polkadot
415
469
  ```
416
470
 
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.
471
+ This works for all categories (`query`, `tx`, `const`, `events`, `errors`, `apis`, `extensions`). 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
472
 
419
473
  ### Query storage
420
474
 
421
475
  ```bash
422
476
  # Plain storage value
423
- dot query System.Number
477
+ dot polkadot.query.System.Number
424
478
 
425
479
  # Map entry by key
426
- dot query System.Account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
480
+ dot polkadot.query.System.Account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
427
481
 
428
482
  # Map without key — shows help/usage (use --dump to fetch all entries)
429
- dot query System.Account
483
+ dot polkadot.query.System.Account
430
484
 
431
485
  # 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
486
+ dot polkadot.query.System.Account --dump
436
487
 
437
488
  # 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'
489
+ dot polkadot.query.System.Account --dump | jq '.[0].value.data.free'
490
+ dot polkadot.query.System.Number --json | jq '.+1'
440
491
 
441
- # Query a specific chain using chain prefix
442
- dot query kusama.System.Account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
492
+ # --chain flag is equivalent to the dotpath prefix
493
+ dot query.System.Account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY --chain polkadot
443
494
  ```
444
495
 
445
496
  #### Partial key queries
@@ -450,13 +501,13 @@ prefix-based iteration and does not require `--dump`.
450
501
 
451
502
  ```bash
452
503
  # Full key — returns a single value
453
- dot query Staking.ErasStakers 100 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
504
+ dot polkadot.query.Staking.ErasStakers 100 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
454
505
 
455
506
  # Partial key — returns all entries matching the first key
456
- dot query Staking.ErasStakers 100
507
+ dot polkadot.query.Staking.ErasStakers 100
457
508
 
458
509
  # No keys — requires --dump (safety net for large maps)
459
- dot query Staking.ErasStakers --dump
510
+ dot polkadot.query.Staking.ErasStakers --dump
460
511
  ```
461
512
 
462
513
  #### Output formatting
@@ -469,47 +520,49 @@ Query results automatically convert on-chain types for readability:
469
520
 
470
521
  ```bash
471
522
  # Token metadata — symbol and name display as text, not {}
472
- dot query assethub-paseo.Assets.Metadata 50000413
523
+ dot paseo-asset-hub.query.Assets.Metadata 50000413
473
524
  # { "deposit": "6693666000", "name": "Paseo Token", "symbol": "PAS", ... }
474
525
  ```
475
526
 
476
527
  ### Look up constants
477
528
 
478
529
  ```bash
479
- dot const Balances.ExistentialDeposit
480
- dot const System.SS58Prefix --chain kusama
481
- dot const kusama.Balances.ExistentialDeposit
530
+ dot polkadot.const.Balances.ExistentialDeposit
531
+ dot polkadot.const.System.SS58Prefix
532
+
533
+ # --chain flag is equivalent
534
+ dot const.Balances.ExistentialDeposit --chain polkadot
482
535
 
483
536
  # Pipe-safe — stdout is clean JSON, progress messages go to stderr
484
- dot const Balances.ExistentialDeposit --json | jq
537
+ dot polkadot.const.Balances.ExistentialDeposit --json | jq
485
538
  ```
486
539
 
487
540
  ### Inspect metadata
488
541
 
489
- Works offline from cached metadata after the first fetch.
542
+ 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
543
 
491
544
  ```bash
492
545
  # List all pallets (shows storage, constants, calls, events, and errors counts)
493
- dot inspect
546
+ dot inspect --chain polkadot
494
547
 
495
548
  # List a pallet's storage items, constants, calls, events, and errors
496
- dot inspect System
549
+ dot inspect System --chain polkadot
497
550
 
498
551
  # Detailed type info for a specific storage item or constant
499
- dot inspect System.Account
552
+ dot inspect System.Account --chain polkadot
500
553
 
501
554
  # Call detail — shows argument signature and docs
502
- dot inspect Balances.transfer_allow_death
555
+ dot inspect Balances.transfer_allow_death --chain polkadot
503
556
 
504
557
  # Event detail — shows field signature and docs
505
- dot inspect Balances.Transfer
558
+ dot inspect Balances.Transfer --chain polkadot
506
559
 
507
560
  # Error detail — shows docs
508
- dot inspect Balances.InsufficientBalance
561
+ dot inspect Balances.InsufficientBalance --chain polkadot
509
562
 
510
- # Inspect a specific chain using chain prefix
511
- dot inspect kusama.System
512
- dot inspect kusama.System.Account
563
+ # Chain prefix on the inspect target works too (note: `dot polkadot.inspect.X` does NOT — use either form below)
564
+ dot inspect polkadot.System
565
+ dot inspect polkadot.System.Account
513
566
  ```
514
567
 
515
568
  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,32 +579,32 @@ Documentation from the runtime metadata is shown on an indented line below each
526
579
 
527
580
  ### Runtime APIs
528
581
 
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`.
582
+ 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
583
 
531
584
  ```bash
532
585
  # List all runtime APIs with method counts
533
- dot apis
586
+ dot polkadot.apis
534
587
 
535
588
  # List methods in a specific API (with signatures)
536
- dot apis.Core
589
+ dot polkadot.apis.Core
537
590
 
538
591
  # Call a runtime API method
539
- dot apis.Core.version
540
-
541
- # With chain prefix
542
592
  dot polkadot.apis.Core.version
543
593
 
544
- # Show method signature and docs
545
- dot apis.Core.version --help
594
+ # --chain flag is equivalent
595
+ dot apis.Core.version --chain polkadot
596
+
597
+ # Show method signature and docs (chain still required to load metadata)
598
+ dot apis.Core.version --chain polkadot --help
546
599
  ```
547
600
 
548
601
  `api` is an alias for `apis`.
549
602
 
550
- Runtime API info requires v15 metadata. If `dot apis` shows 0 APIs, update the cached metadata:
603
+ Runtime API info requires v15 metadata. If `dot <chain>.apis` shows 0 APIs, update the cached metadata:
551
604
 
552
605
  ```bash
553
- dot chain update people-paseo # specific chain
554
- dot chain update --all # all configured chains
606
+ dot chain update polkadot # specific chain
607
+ dot chain update --all # all configured chains
555
608
  ```
556
609
 
557
610
  #### Argument formats
@@ -577,7 +630,7 @@ ALICE=5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
577
630
  CONTRACT=0x970951a12f975e6762482aca81e57d5a2a4e73f4 # H160, [u8; 20]
578
631
  CALLDATA=$(cast calldata "set(uint256)" 42)
579
632
 
580
- dot --chain paseo-asset-hub apis.ReviveApi.call \
633
+ dot paseo-asset-hub.apis.ReviveApi.call \
581
634
  "$ALICE" "$CONTRACT" 0 null null "$CALLDATA"
582
635
  # ^ origin ^ dest ^ value ^ gas_limit (Option, none) ^ deposit (Option, none) ^ input_data (Vec<u8>)
583
636
  ```
@@ -587,9 +640,9 @@ dot --chain paseo-asset-hub apis.ReviveApi.call \
587
640
  Absent options (`None`) can be written three ways, all equivalent:
588
641
 
589
642
  ```bash
590
- dot apis.ReviveApi.call "$ALICE" "$CONTRACT" 0 null null "$CALLDATA"
591
- dot apis.ReviveApi.call "$ALICE" "$CONTRACT" 0 none none "$CALLDATA"
592
- dot apis.ReviveApi.call "$ALICE" "$CONTRACT" 0 undefined undefined "$CALLDATA"
643
+ dot paseo-asset-hub.apis.ReviveApi.call "$ALICE" "$CONTRACT" 0 null null "$CALLDATA"
644
+ dot paseo-asset-hub.apis.ReviveApi.call "$ALICE" "$CONTRACT" 0 none none "$CALLDATA"
645
+ dot paseo-asset-hub.apis.ReviveApi.call "$ALICE" "$CONTRACT" 0 undefined undefined "$CALLDATA"
593
646
  ```
594
647
 
595
648
  `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.
@@ -598,7 +651,7 @@ A present option (`Some(value)`) is just the value itself — no wrapping:
598
651
 
599
652
  ```bash
600
653
  # gas_limit = Some({ ref_time: 1_000_000, proof_size: 100_000 })
601
- dot apis.ReviveApi.call "$ALICE" "$CONTRACT" 0 \
654
+ dot paseo-asset-hub.apis.ReviveApi.call "$ALICE" "$CONTRACT" 0 \
602
655
  '{"ref_time":1000000,"proof_size":100000}' \
603
656
  null \
604
657
  "$CALLDATA"
@@ -608,42 +661,78 @@ Notes:
608
661
  - The `null` / `none` / `undefined` literals are case-sensitive (lowercase only).
609
662
  - There is no `Some(value)` prefix — bare values are already treated as `Some`.
610
663
 
611
- Use `dot apis.<ApiName>.<method> --help` to see the exact argument signature for any method.
664
+ Use `dot <chain>.apis.<ApiName>.<method> --help` to see the exact argument signature for any method.
612
665
 
613
- ### Focused commands
666
+ ### Focused metadata listings
614
667
 
615
- Browse specific metadata categories directly without using `dot inspect`:
668
+ 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`.
616
669
 
617
670
  ```bash
618
- # List all pallets
619
- dot pallets
671
+ # List pallets with calls (and the calls themselves)
672
+ dot polkadot.tx # pallets with calls
673
+ dot polkadot.tx.Balances # calls with arg signatures
674
+ dot polkadot.tx.Balances.transfer_allow_death # call detail (or use --help)
675
+
676
+ # Events
677
+ dot polkadot.events # pallets with events
678
+ dot polkadot.events.Balances # events with field signatures
679
+ dot polkadot.events.Balances.Transfer # event detail
680
+
681
+ # Errors
682
+ dot polkadot.errors # pallets with errors
683
+ dot polkadot.errors.Balances # errors with docs
684
+ dot polkadot.errors.Balances.InsufficientBalance
685
+
686
+ # Storage (via the query category)
687
+ dot polkadot.query # pallets with storage items
688
+ dot polkadot.query.System # storage items with types
689
+ dot polkadot.query.System.Account # storage help (use --dump for all entries)
690
+
691
+ # Constants
692
+ dot polkadot.const # pallets with constants
693
+ dot polkadot.const.Balances # list constants (offline)
694
+ dot polkadot.const.Balances.ExistentialDeposit # look up value (connects to chain)
695
+
696
+ # Runtime APIs
697
+ dot polkadot.apis # all runtime APIs
698
+ dot polkadot.apis.Core # methods in Core
620
699
 
621
- # List pallet calls with argument signatures
622
- dot calls Balances
623
- dot calls Balances.transfer_allow_death # call detail
700
+ # Transaction extensions (flat no pallet sub-level)
701
+ dot polkadot.extensions # all transaction extensions
702
+ dot polkadot.extensions.CheckMortality # extension detail
703
+ ```
704
+
705
+ `--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)).
706
+
707
+ ### Transaction extensions
708
+
709
+ List the transaction extensions (also known as signed extensions) a chain declares in its runtime, with types and a marker indicating whether `polkadot-api` handles the extension automatically or whether you need to provide a value via `--ext` when building a transaction (see [Submit extrinsics](#submit-extrinsics)).
624
710
 
625
- # List pallet events with field signatures
626
- dot events Balances
627
- dot events Balances.Transfer # event detail
711
+ ```bash
712
+ # List all transaction extensions on a chain
713
+ dot polkadot.extensions
628
714
 
629
- # List pallet errors
630
- dot errors Balances
631
- dot errors Balances.InsufficientBalance # error detail
715
+ # Detail view for a single extension
716
+ dot polkadot.extensions.CheckMortality
632
717
 
633
- # List pallet storage items with types
634
- dot storage System
635
- dot storage System.Account # storage detail
718
+ # --chain flag form is equivalent
719
+ dot extensions.ChargeTransactionPayment --chain polkadot
636
720
 
637
- # List pallet constants (dual-purpose also works as value lookup)
638
- dot const Balances # list constants
639
- dot const Balances.ExistentialDeposit # look up value
721
+ # Space-separated syntax also works
722
+ dot extensions CheckMortality --chain polkadot
640
723
 
641
- # List runtime APIs
642
- dot apis # list all APIs
643
- dot apis.Core # list methods in Core
724
+ # Structured output for scripts
725
+ dot polkadot.extensions --json
644
726
  ```
645
727
 
646
- 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`).
728
+ `extension` and `ext` are aliases for `extensions`. Shell completion suggests identifiers after `dot polkadot.extensions.<Tab>`.
729
+
730
+ The list view tags each entry:
731
+
732
+ - `[builtin]` — `polkadot-api` fills this in for you (e.g. `CheckMortality`, `CheckNonce`, `ChargeTransactionPayment`, `CheckMetadataHash`)
733
+ - `[custom]` — you must provide a value with `--ext` when signing, for example `--ext '{"<Identifier>":{"value":<v>}}'`
734
+
735
+ The detail view shows the extension's value type, its `additionalSigned` type, and a ready-to-adapt `--ext` snippet for custom extensions. Use this to discover what `--ext` payload a chain expects before submitting a `dot tx` command.
647
736
 
648
737
  ### Submit extrinsics
649
738
 
@@ -651,21 +740,28 @@ Build, sign, and submit transactions. Pass a `Pallet.Call` with arguments, or a
651
740
 
652
741
  ```bash
653
742
  # Simple remark
654
- dot tx System.remark 0xdeadbeef --from alice
743
+ dot tx.System.remark 0xdeadbeef --from alice --chain polkadot
655
744
 
656
745
  # Transfer (amount in plancks)
657
- dot tx Balances.transferKeepAlive 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty 1000000000000 --from alice
746
+ dot tx.Balances.transferKeepAlive 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty 1000000000000 --from alice --chain polkadot
658
747
 
659
748
  # Estimate fees without submitting
660
- dot tx Balances.transferKeepAlive 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty 1000000000000 --from alice --dry-run
749
+ dot tx.Balances.transferKeepAlive 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty 1000000000000 --from alice --chain polkadot --dry-run
661
750
 
662
751
  # Submit a raw SCALE-encoded call (e.g. from a multisig proposal or another tool)
663
- dot tx 0x0503008eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48 --from alice
752
+ dot tx 0x0503008eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48 --from alice --chain polkadot
664
753
 
665
754
  # Batch multiple transfers with Utility.batchAll (comma-separated encoded calls)
666
- A=$(dot tx Balances.transfer_keep_alive 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty 1000000000000 --encode)
667
- B=$(dot tx Balances.transfer_keep_alive 5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y 2000000000000 --encode)
668
- dot tx Utility.batchAll $A,$B --from alice
755
+ A=$(dot tx.Balances.transfer_keep_alive 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty 1000000000000 --encode --chain polkadot)
756
+ B=$(dot tx.Balances.transfer_keep_alive 5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y 2000000000000 --encode --chain polkadot)
757
+ dot tx.Utility.batchAll $A,$B --from alice --chain polkadot
758
+ ```
759
+
760
+ The dot-prefix form works for `tx` too — these are equivalent:
761
+
762
+ ```bash
763
+ dot tx.System.remark 0xdeadbeef --from alice --chain polkadot
764
+ dot polkadot.tx.System.remark 0xdeadbeef --from alice
669
765
  ```
670
766
 
671
767
  #### Enum shorthand
@@ -674,17 +770,17 @@ Enum arguments accept a concise `Variant(value)` syntax instead of verbose JSON:
674
770
 
675
771
  ```bash
676
772
  # Instead of: '{"type":"system","value":{"type":"Authorized"}}'
677
- dot tx Utility.dispatch_as 'system(Authorized)' $(dot tx System.remark 0xcafe --encode) --from alice
773
+ dot tx.Utility.dispatch_as 'system(Authorized)' $(dot tx.System.remark 0xcafe --encode --chain polkadot) --from alice --chain polkadot
678
774
 
679
775
  # Nested enums work too
680
- dot tx Utility.dispatch_as 'system(Signed(5FHneW46...))' <call> --from alice
776
+ dot tx.Utility.dispatch_as 'system(Signed(5FHneW46...))' <call> --from alice --chain polkadot
681
777
 
682
778
  # Void variants — empty parens or just the name
683
- dot tx ... 'Root()' ...
684
- dot tx ... 'Root' ...
779
+ dot tx.Pallet.call 'Root()' ... --from alice --chain polkadot
780
+ dot tx.Pallet.call 'Root' ... --from alice --chain polkadot
685
781
 
686
782
  # JSON inside parens for struct values
687
- dot tx ... 'AccountId32({"id":"0xd435..."})' ...
783
+ dot tx.Pallet.call 'AccountId32({"id":"0xd435..."})' ... --from alice --chain polkadot
688
784
  ```
689
785
 
690
786
  Variant matching is case-insensitive (`system` resolves to `system`, `authorized` to `Authorized`). All existing formats (JSON objects, hex, SS58 addresses) continue to work unchanged.
@@ -695,13 +791,13 @@ Encode a call to hex without signing or submitting. Useful for preparing calls t
695
791
 
696
792
  ```bash
697
793
  # Encode a remark call
698
- dot tx System.remark 0xdeadbeef --encode
794
+ dot tx.System.remark 0xdeadbeef --encode --chain polkadot
699
795
 
700
796
  # Encode a transfer (use the hex output in a batch or sudo call)
701
- dot tx Balances.transfer_keep_alive 5FHneW46... 1000000000000 --encode
797
+ dot tx.Balances.transfer_keep_alive 5FHneW46... 1000000000000 --encode --chain polkadot
702
798
 
703
799
  # Use encoded output with Sudo.sudo
704
- dot tx Sudo.sudo $(dot tx System.remark 0xcafe --encode) --from alice
800
+ dot tx.Sudo.sudo $(dot tx.System.remark 0xcafe --encode --chain polkadot) --from alice --chain polkadot
705
801
  ```
706
802
 
707
803
  #### Decode call data to YAML / JSON
@@ -710,18 +806,18 @@ Decode a hex-encoded call into a YAML or JSON file that is compatible with [file
710
806
 
711
807
  ```bash
712
808
  # Decode a raw hex call to YAML
713
- dot tx.0x0001076465616462656566 --to-yaml
809
+ dot tx.0x0001076465616462656566 --to-yaml --chain polkadot
714
810
 
715
811
  # Decode a raw hex call to JSON
716
- dot tx.0x0001076465616462656566 --to-json
812
+ dot tx.0x0001076465616462656566 --to-json --chain polkadot
717
813
 
718
814
  # Encode a named call and output as YAML
719
- dot tx.System.remark 0xdeadbeef --to-yaml
815
+ dot tx.System.remark 0xdeadbeef --to-yaml --chain polkadot
720
816
 
721
817
  # Round-trip: encode to hex, decode to YAML, re-encode from file
722
- dot tx.System.remark 0xdeadbeef --encode # 0x0001076465616462656566
723
- dot tx.0x0001076465616462656566 --to-yaml > remark.yaml
724
- dot ./remark.yaml --encode # same hex
818
+ dot tx.System.remark 0xdeadbeef --encode --chain polkadot # 0x0001076465616462656566
819
+ dot tx.0x0001076465616462656566 --to-yaml --chain polkadot > remark.yaml
820
+ dot ./remark.yaml --encode # chain comes from the file
725
821
  ```
726
822
 
727
823
  `--to-yaml` / `--to-json` are mutually exclusive with each other and with `--encode` and `--dry-run`.
@@ -746,7 +842,7 @@ Complex calls (e.g. XCM teleports) that the primary decoder cannot handle are au
746
842
  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`).
747
843
 
748
844
  ```bash
749
- dot tx Balances.transferKeepAlive 5FHneW46... 999999999999999999 --from alice
845
+ dot tx.Balances.transferKeepAlive 5FHneW46... 999999999999999999 --from alice --chain polkadot
750
846
  # ... events and explorer links ...
751
847
  # Error: Transaction dispatch error: Balances.InsufficientBalance
752
848
  echo $? # 1
@@ -757,7 +853,7 @@ echo $? # 1
757
853
  When a call argument is invalid, the CLI shows a contextual error message with the argument name, the expected type, and a hint:
758
854
 
759
855
  ```bash
760
- dot tx Balances.transferKeepAlive 5GrwvaEF... abc --encode
856
+ dot tx.Balances.transferKeepAlive 5GrwvaEF... abc --encode --chain polkadot
761
857
  # Error: Invalid value for argument 'value' (expected Compact<u128>): "abc"
762
858
  # Hint: Compact<u128>
763
859
  ```
@@ -770,15 +866,15 @@ By default, `dot tx` waits for finalization (~30s on Polkadot). Use `--wait` / `
770
866
 
771
867
  ```bash
772
868
  # Return as soon as the tx is broadcast (fastest)
773
- dot tx System.remark 0xdead --from alice --wait broadcast
869
+ dot tx.System.remark 0xdead --from alice --chain polkadot --wait broadcast
774
870
 
775
871
  # Return when included in a best block
776
- dot tx System.remark 0xdead --from alice -w best-block
777
- dot tx System.remark 0xdead --from alice -w best # alias
872
+ dot tx.System.remark 0xdead --from alice --chain polkadot -w best-block
873
+ dot tx.System.remark 0xdead --from alice --chain polkadot -w best # alias
778
874
 
779
875
  # Wait for finalization (default, unchanged)
780
- dot tx System.remark 0xdead --from alice --wait finalized
781
- dot tx System.remark 0xdead --from alice # same
876
+ dot tx.System.remark 0xdead --from alice --chain polkadot --wait finalized
877
+ dot tx.System.remark 0xdead --from alice --chain polkadot # same
782
878
  ```
783
879
 
784
880
  | Level | Resolves when | Events shown | Explorer links |
@@ -791,7 +887,7 @@ The `--wait` flag is silently ignored when combined with `--dry-run` or `--encod
791
887
 
792
888
  #### Custom signed extensions
793
889
 
794
- Chains with non-standard signed extensions (e.g. `people-preview`) are auto-handled:
890
+ Chains with non-standard signed extensions are auto-handled:
795
891
 
796
892
  - `void` → empty bytes
797
893
  - `Option<T>` → `None`
@@ -800,9 +896,11 @@ Chains with non-standard signed extensions (e.g. `people-preview`) are auto-hand
800
896
  For manual override, use `--ext` with a JSON object:
801
897
 
802
898
  ```bash
803
- dot tx System.remark 0xdeadbeef --from alice --ext '{"MyExtension":{"value":"..."}}'
899
+ dot tx.System.remark 0xdeadbeef --from alice --chain polkadot --ext '{"MyExtension":{"value":"..."}}'
804
900
  ```
805
901
 
902
+ Not sure which extensions a chain exposes? Run `dot <chain>.extensions` (see [Transaction extensions](#transaction-extensions)) to list them all with value types and a `[builtin]` / `[custom]` marker.
903
+
806
904
  #### Transaction options
807
905
 
808
906
  Override low-level transaction parameters. Useful for rapid-fire submission (custom nonce), priority fees (tip), or controlling transaction lifetime (mortality).
@@ -816,23 +914,23 @@ Override low-level transaction parameters. Useful for rapid-fire submission (cus
816
914
 
817
915
  ```bash
818
916
  # Fire-and-forget: submit two txs in rapid succession with manual nonces
819
- dot tx System.remark 0xdead --from alice --nonce 0 --wait broadcast
820
- dot tx System.remark 0xbeef --from alice --nonce 1 --wait broadcast
917
+ dot tx.System.remark 0xdead --from alice --chain polkadot --nonce 0 --wait broadcast
918
+ dot tx.System.remark 0xbeef --from alice --chain polkadot --nonce 1 --wait broadcast
821
919
 
822
920
  # Add a priority tip (in planck)
823
- dot tx Balances.transferKeepAlive 5FHneW46... 1000000000000 --from alice --tip 1000000
921
+ dot tx.Balances.transferKeepAlive 5FHneW46... 1000000000000 --from alice --chain polkadot --tip 1000000
824
922
 
825
923
  # Submit an immortal transaction (no expiry)
826
- dot tx System.remark 0xdead --from alice --mortality immortal
924
+ dot tx.System.remark 0xdead --from alice --chain polkadot --mortality immortal
827
925
 
828
926
  # Set a custom mortality period (rounds up to nearest power of two)
829
- dot tx System.remark 0xdead --from alice --mortality 128
927
+ dot tx.System.remark 0xdead --from alice --chain polkadot --mortality 128
830
928
 
831
929
  # Validate against a specific block hash
832
- dot tx System.remark 0xdead --from alice --at 0x1234...abcd
930
+ dot tx.System.remark 0xdead --from alice --chain polkadot --at 0x1234...abcd
833
931
 
834
932
  # Combine: rapid-fire with tip and broadcast-only
835
- dot tx System.remark 0xdead --from alice --nonce 5 --tip 500000 --wait broadcast
933
+ dot tx.System.remark 0xdead --from alice --chain polkadot --nonce 5 --tip 500000 --wait broadcast
836
934
  ```
837
935
 
838
936
  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).
@@ -843,12 +941,12 @@ On asset-hub-style chains (Polkadot Asset Hub, Paseo Asset Hub, etc.) the `Charg
843
941
 
844
942
  ```bash
845
943
  # Pay fees in USDT (asset id 1337, PalletInstance 50) on Polkadot Asset Hub
846
- dot tx Balances.transfer_keep_alive 5FHneW46... 1000000000000 \
944
+ dot tx.Balances.transfer_keep_alive 5FHneW46... 1000000000000 \
847
945
  --from alice --chain polkadot-asset-hub \
848
946
  --asset '{"parents":0,"interior":{"type":"X2","value":[{"type":"PalletInstance","value":50},{"type":"GeneralIndex","value":"1337"}]}}'
849
947
 
850
948
  # Dry-run to see the native-denominated fee estimate
851
- dot tx Balances.transfer_keep_alive 5FHneW46... 1000000000000 \
949
+ dot tx.Balances.transfer_keep_alive 5FHneW46... 1000000000000 \
852
950
  --from alice --chain polkadot-asset-hub --dry-run \
853
951
  --asset '{"parents":0,"interior":{"type":"X2","value":[{"type":"PalletInstance","value":50},{"type":"GeneralIndex","value":"1337"}]}}'
854
952
  ```
@@ -868,19 +966,19 @@ Submit transactions without a signer using `--unsigned`. This is for calls autho
868
966
 
869
967
  ```bash
870
968
  # Submit an authorized call on the People chain
871
- dot tx People.create_people_collection --unsigned --chain people
969
+ dot tx.People.create_people_collection --unsigned --chain polkadot-people
872
970
 
873
971
  # Dry-run to inspect before submitting
874
- dot tx People.create_people_collection --unsigned --chain people --dry-run
972
+ dot tx.People.create_people_collection --unsigned --chain polkadot-people --dry-run
875
973
 
876
974
  # Encode the full general transaction bytes
877
- dot tx People.create_people_collection --unsigned --chain people --encode
975
+ dot tx.People.create_people_collection --unsigned --chain polkadot-people --encode
878
976
 
879
977
  # With raw hex call data
880
- dot tx 0x3306 --unsigned --chain people
978
+ dot tx 0x3306 --unsigned --chain polkadot-people
881
979
 
882
980
  # JSON output for scripting
883
- dot tx People.create_people_collection --unsigned --chain people --json
981
+ dot tx.People.create_people_collection --unsigned --chain polkadot-people --json
884
982
  ```
885
983
 
886
984
  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.
@@ -888,7 +986,7 @@ The CLI constructs a v5 general transaction with all extension values auto-defau
888
986
  `--unsigned` is mutually exclusive with `--from`, `--nonce`, `--tip`, and `--mortality`. File-based input supports `unsigned: true`:
889
987
 
890
988
  ```yaml
891
- chain: people
989
+ chain: polkadot-people
892
990
  unsigned: true
893
991
  tx:
894
992
  People:
@@ -1076,7 +1174,7 @@ Hex values passed via `--var` are preserved as-is, including leading zeros. This
1076
1174
 
1077
1175
  ```bash
1078
1176
  # Encode a remark, then embed it in an XCM Transact via --var
1079
- CALL=$(dot tx.System.remark 0xdead --encode)
1177
+ CALL=$(dot tx.System.remark 0xdead --encode --chain polkadot)
1080
1178
  dot ./xcm-transact.yaml --var CALL=$CALL --encode
1081
1179
  ```
1082
1180
 
@@ -1201,21 +1299,24 @@ dot hash --help # same as `dot hash` — shows algorithms and examples
1201
1299
 
1202
1300
  #### Item-level help
1203
1301
 
1204
- Use `--help` on any fully-qualified dot-path to see metadata detail and category-specific usage hints all offline, no chain connection required:
1302
+ 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:
1205
1303
 
1206
1304
  ```bash
1207
- dot tx.System.remark --help # call args, docs, and tx options
1208
- dot query.System.Account --help # storage type, key/value info, and query options
1209
- dot const.Balances.ExistentialDeposit --help # constant type and docs
1210
- dot events.Balances.Transfer --help # event fields and docs
1211
- dot errors.Balances.InsufficientBalance --help # error docs
1212
- dot apis.Core.version --help # runtime API method signature and docs
1305
+ dot tx.System.remark --help --chain polkadot # call args, docs, and tx options
1306
+ dot query.System.Account --help --chain polkadot # storage type, key/value info, and query options
1307
+ dot const.Balances.ExistentialDeposit --help --chain polkadot # constant type and docs
1308
+ dot events.Balances.Transfer --help --chain polkadot # event fields and docs
1309
+ dot errors.Balances.InsufficientBalance --help --chain polkadot # error docs
1310
+ dot apis.Core.version --help --chain polkadot # runtime API method signature and docs
1311
+
1312
+ # A chain prefix is equivalent
1313
+ dot polkadot.tx.System.remark --help
1213
1314
  ```
1214
1315
 
1215
1316
  For `tx` commands, omitting both `--from` and `--encode` shows this same help output instead of an error:
1216
1317
 
1217
1318
  ```bash
1218
- dot tx.System.remark 0xdead # shows call help (no error)
1319
+ dot tx.System.remark 0xdead --chain polkadot # shows call help (no error)
1219
1320
  ```
1220
1321
 
1221
1322
  ### Global options
@@ -1236,20 +1337,20 @@ dot tx.System.remark 0xdead # shows call help (no error)
1236
1337
  Every command supports `--json` for machine-readable output. This works on data queries, metadata inspection, account management, chain configuration, and transaction submission:
1237
1338
 
1238
1339
  ```bash
1239
- dot inspect --json # All pallets as JSON
1240
- dot inspect Balances --json # Pallet detail with storage, constants, calls, events, errors
1241
- dot chain list --json # Configured chains
1242
- dot account list --json # Dev and stored accounts
1243
- dot account create my-key --json # New account details (mnemonic warning on stderr)
1244
- dot tx.System.remark 0xdead --encode --json # Encoded call hex wrapped in JSON
1245
- dot events.Balances --json # Event listing with field signatures
1246
- dot const.System --json # Constant listing with types
1340
+ dot inspect --json --chain polkadot # All pallets as JSON
1341
+ dot inspect Balances --json --chain polkadot # Pallet detail with storage, constants, calls, events, errors
1342
+ dot chain list --json # Configured chains
1343
+ dot account list --json # Dev and stored accounts
1344
+ dot account create my-key --json # New account details (mnemonic warning on stderr)
1345
+ dot polkadot.tx.System.remark 0xdead --encode --json # Encoded call hex wrapped in JSON
1346
+ dot polkadot.events.Balances --json # Event listing with field signatures
1347
+ dot polkadot.const.System --json # Constant listing with types
1247
1348
  ```
1248
1349
 
1249
1350
  For transaction submission, `--json` emits NDJSON (one JSON object per lifecycle event):
1250
1351
 
1251
1352
  ```bash
1252
- dot tx.System.remark 0xdead --from alice --json
1353
+ dot tx.System.remark 0xdead --from alice --chain polkadot --json
1253
1354
  # {"event":"signed","txHash":"0x..."}
1254
1355
  # {"event":"broadcasted","txHash":"0x..."}
1255
1356
  # {"event":"finalized","blockNumber":123,"blockHash":"0x...","ok":true,"events":[...]}
@@ -1260,11 +1361,11 @@ dot tx.System.remark 0xdead --from alice --json
1260
1361
  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:
1261
1362
 
1262
1363
  ```bash
1263
- dot const System.SS58Prefix --json | jq '.+1'
1264
- dot query System.Number --json | jq
1364
+ dot polkadot.const.System.SS58Prefix --json | jq '.+1'
1365
+ dot polkadot.query.System.Number --json | jq
1265
1366
  dot chain list --json | jq '.chains[].name'
1266
1367
  dot account list --json | jq '.stored[].address'
1267
- dot inspect --json | jq '.pallets[] | select(.events > 10) | .name'
1368
+ dot inspect --json --chain polkadot | jq '.pallets[] | select(.events > 10) | .name'
1268
1369
  ```
1269
1370
 
1270
1371
  In an interactive terminal, both streams render together so you see progress and results normally.
@@ -1308,7 +1409,7 @@ Completions are context-aware: `query.` shows pallets with storage items, `tx.`
1308
1409
  | **Read constants** | yes | yes | yes | — |
1309
1410
  | **Submit extrinsics** | yes, with dry-run | yes (via `--seed`) | — | ink! contract calls only |
1310
1411
  | **Inspect metadata** | yes | — | yes (excellent browser) | — |
1311
- | **Chain presets** | built-in aliases (`--chain kusama`) | — (manual `--ws` every call) | — | parachain templates |
1412
+ | **Chain presets** | built-in aliases (`--chain polkadot`) | — (manual `--ws` every call) | — | parachain templates |
1312
1413
  | **Tx tracking + explorer links** | spinner progress, block + explorer link | basic events | — | — |
1313
1414
 
1314
1415
  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.
@@ -1340,7 +1441,7 @@ The notification is automatically suppressed when:
1340
1441
 
1341
1442
  ## Configuration
1342
1443
 
1343
- Config and metadata caches live in `~/.polkadot/`:
1444
+ Config and metadata caches live in `~/.polkadot/` by default:
1344
1445
 
1345
1446
  ```
1346
1447
  ~/.polkadot/
@@ -1354,6 +1455,29 @@ Config and metadata caches live in `~/.polkadot/`:
1354
1455
 
1355
1456
  > **Warning:** `accounts.json` stores secrets (mnemonics and seeds) in **plain text**. Encrypted-at-rest storage is planned but not yet implemented. Keep appropriate file permissions (`chmod 600 ~/.polkadot/accounts.json`) and do not use this for high-value mainnet accounts.
1356
1457
 
1458
+ ### `DOT_HOME` — redirect the config directory
1459
+
1460
+ Set the `DOT_HOME` environment variable to point at a different directory. When set, the CLI reads and writes **everything** (config, accounts, metadata, update cache) under that path — no `.polkadot` suffix is appended.
1461
+
1462
+ ```bash
1463
+ # Use a scratch directory for experimentation
1464
+ DOT_HOME=/tmp/dot-scratch dot account create throwaway
1465
+
1466
+ # Isolated per-project state (e.g. in a repo-local shell)
1467
+ export DOT_HOME="$PWD/.dot"
1468
+ dot chain add local --rpc ws://localhost:9944
1469
+
1470
+ # Unset or empty DOT_HOME falls back to $HOME/.polkadot
1471
+ ```
1472
+
1473
+ Typical uses:
1474
+
1475
+ - **Run throwaway commands without touching your real accounts.** Point `DOT_HOME` at a tmpdir so `dot account create`, `dot chain add`, and similar never modify `~/.polkadot/`.
1476
+ - **CI and test harnesses.** Give each job its own `DOT_HOME` so parallel runs don't share state. The project's own test fixture (`runCli`) uses this mechanism.
1477
+ - **Multiple profiles on one machine.** Switch between environments (e.g. a mainnet profile and a local-dev profile) by changing `DOT_HOME`.
1478
+
1479
+ Empty-string `DOT_HOME=""` is treated as unset and falls back to `$HOME/.polkadot` — so a shell-quoting slip can't accidentally send writes to `/`.
1480
+
1357
1481
  ## Environment compatibility
1358
1482
 
1359
1483
  The CLI works in Node.js (v22+), Bun, and sandboxed runtimes (e.g. LLM tool-use / MCP environments). WebSocket connections use the native `WebSocket` implementation provided by the runtime — no external WebSocket package is required.
@@ -1364,7 +1488,7 @@ Requires [Bun](https://bun.sh).
1364
1488
 
1365
1489
  ```bash
1366
1490
  bun install
1367
- bun run dev -- query System.Number
1491
+ bun run dev -- polkadot.query.System.Number
1368
1492
  bun run build
1369
1493
  bun test
1370
1494
  ```