polkadot-cli 0.13.0 → 1.1.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 +79 -5
  2. package/dist/cli.mjs +1443 -317
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -220,7 +220,7 @@ dot query System.Account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
220
220
  # All map entries (default limit: 100)
221
221
  dot query System.Account --limit 10
222
222
 
223
- # Pipe to jq — stdout is clean JSON, no extra text
223
+ # Pipe-safe — stdout is clean data, progress messages go to stderr
224
224
  dot query System.Account --limit 5 | jq '.[0].value.data.free'
225
225
  dot query System.Number --output json | jq '.+1'
226
226
 
@@ -249,7 +249,7 @@ dot const Balances.ExistentialDeposit
249
249
  dot const System.SS58Prefix --chain kusama
250
250
  dot const kusama.Balances.ExistentialDeposit
251
251
 
252
- # Pipe to jq — stdout is clean JSON, no extra text
252
+ # Pipe-safe — stdout is clean JSON, progress messages go to stderr
253
253
  dot const Balances.ExistentialDeposit --output json | jq
254
254
  ```
255
255
 
@@ -258,10 +258,10 @@ dot const Balances.ExistentialDeposit --output json | jq
258
258
  Works offline from cached metadata after the first fetch.
259
259
 
260
260
  ```bash
261
- # List all pallets (shows storage, constants, and calls counts)
261
+ # List all pallets (shows storage, constants, calls, events, and errors counts)
262
262
  dot inspect
263
263
 
264
- # List a pallet's storage items, constants, and calls
264
+ # List a pallet's storage items, constants, calls, events, and errors
265
265
  dot inspect System
266
266
 
267
267
  # Detailed type info for a specific storage item or constant
@@ -270,12 +270,57 @@ dot inspect System.Account
270
270
  # Call detail — shows argument signature and docs
271
271
  dot inspect Balances.transfer_allow_death
272
272
 
273
+ # Event detail — shows field signature and docs
274
+ dot inspect Balances.Transfer
275
+
276
+ # Error detail — shows docs
277
+ dot inspect Balances.InsufficientBalance
278
+
273
279
  # Inspect a specific chain using chain prefix
274
280
  dot inspect kusama.System
275
281
  dot inspect kusama.System.Account
276
282
  ```
277
283
 
278
- Use call inspection to discover argument names and types before constructing `dot tx` commands.
284
+ The pallet listing view shows type information inline so you can understand item shapes at a glance:
285
+
286
+ - **Storage**: key/value types with `[map]` tag for map items (e.g. `Account: AccountId32 → { nonce: u32, ... } [map]`)
287
+ - **Constants**: the constant's type (e.g. `ExistentialDeposit: u128`)
288
+ - **Calls**: full argument signature (e.g. `transfer_allow_death(dest: enum(5 variants), value: Compact<u128>)`)
289
+ - **Events**: field signature (e.g. `Transfer(from: AccountId32, to: AccountId32, amount: u128)`)
290
+ - **Errors**: name and documentation (e.g. `InsufficientBalance`)
291
+
292
+ Documentation from the runtime metadata is shown on an indented line below each item. The detail view (`dot inspect Balances.transfer_allow_death`) shows the full argument signature and complete documentation text. Use call inspection to discover argument names, types, and docs before constructing `dot tx` commands.
293
+
294
+ ### Focused commands
295
+
296
+ Browse specific metadata categories directly without using `dot inspect`:
297
+
298
+ ```bash
299
+ # List all pallets
300
+ dot pallets
301
+
302
+ # List pallet calls with argument signatures
303
+ dot calls Balances
304
+ dot calls Balances.transfer_allow_death # call detail
305
+
306
+ # List pallet events with field signatures
307
+ dot events Balances
308
+ dot events Balances.Transfer # event detail
309
+
310
+ # List pallet errors
311
+ dot errors Balances
312
+ dot errors Balances.InsufficientBalance # error detail
313
+
314
+ # List pallet storage items with types
315
+ dot storage System
316
+ dot storage System.Account # storage detail
317
+
318
+ # List pallet constants (dual-purpose — also works as value lookup)
319
+ dot const Balances # list constants
320
+ dot const Balances.ExistentialDeposit # look up value
321
+ ```
322
+
323
+ 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`).
279
324
 
280
325
  ### Submit extrinsics
281
326
 
@@ -420,6 +465,24 @@ dot chain --help # same as `dot chain` — shows chain actions
420
465
  dot hash --help # same as `dot hash` — shows algorithms and examples
421
466
  ```
422
467
 
468
+ #### Item-level help
469
+
470
+ Use `--help` on any fully-qualified dot-path to see metadata detail and category-specific usage hints — all offline, no chain connection required:
471
+
472
+ ```bash
473
+ dot tx.System.remark --help # call args, docs, and tx options
474
+ dot query.System.Account --help # storage type, key/value info, and query options
475
+ dot const.Balances.ExistentialDeposit --help # constant type and docs
476
+ dot events.Balances.Transfer --help # event fields and docs
477
+ dot errors.Balances.InsufficientBalance --help # error docs
478
+ ```
479
+
480
+ For `tx` commands, omitting both `--from` and `--encode` shows this same help output instead of an error:
481
+
482
+ ```bash
483
+ dot tx.System.remark 0xdead # shows call help (no error)
484
+ ```
485
+
423
486
  ### Global options
424
487
 
425
488
  | Flag | Description |
@@ -431,6 +494,17 @@ dot hash --help # same as `dot hash` — shows algorithms and examples
431
494
  | `--output json` | Raw JSON output (default: pretty) |
432
495
  | `--limit <n>` | Max entries for map queries (0 = unlimited, default: 100) |
433
496
 
497
+ ### Pipe-safe output
498
+
499
+ All commands follow Unix conventions: **data goes to stdout, progress goes to stderr**. This means you can safely pipe `--output json` into `jq` or other tools without progress messages ("Fetching metadata...", spinner output, "Connecting...") corrupting the data stream:
500
+
501
+ ```bash
502
+ dot const System.SS58Prefix --output json | jq '.+1'
503
+ dot query System.Number --output json | jq
504
+ ```
505
+
506
+ In an interactive terminal, both streams render together so you see progress and results normally.
507
+
434
508
  ## How it compares
435
509
 
436
510
  | | polkadot-cli | @polkadot/api-cli | subxt-cli | Pop CLI |