polkadot-cli 0.6.0 → 0.6.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.
- package/README.md +25 -5
- package/dist/cli.mjs +975 -921
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -39,6 +39,8 @@ dot chain remove westend
|
|
|
39
39
|
|
|
40
40
|
Dev accounts (Alice, Bob, Charlie, Dave, Eve, Ferdie) are always available for testnets. Create or import your own accounts for any chain.
|
|
41
41
|
|
|
42
|
+
> **Security warning:** Account secrets (mnemonics and seeds) are currently stored **unencrypted** in `~/.polkadot/accounts.json`. Do not use this for high-value accounts on mainnet. Encrypted storage is planned for a future release.
|
|
43
|
+
|
|
42
44
|
```bash
|
|
43
45
|
# List all accounts (dev + stored)
|
|
44
46
|
dot account list
|
|
@@ -49,13 +51,19 @@ dot account create my-validator
|
|
|
49
51
|
# Import from a BIP39 mnemonic
|
|
50
52
|
dot account import treasury --secret "word1 word2 ... word12"
|
|
51
53
|
|
|
52
|
-
# Import from a hex seed
|
|
53
|
-
dot account import raw-key --secret 0xabcdef...
|
|
54
|
-
|
|
55
54
|
# Remove an account
|
|
56
55
|
dot account remove my-validator
|
|
57
56
|
```
|
|
58
57
|
|
|
58
|
+
**Supported secret formats for import:**
|
|
59
|
+
|
|
60
|
+
| Format | Example | Status |
|
|
61
|
+
|--------|---------|--------|
|
|
62
|
+
| BIP39 mnemonic (12/24 words) | `"abandon abandon ... about"` | Supported |
|
|
63
|
+
| Hex seed (`0x` + 64 hex chars) | `0xabcdef0123...` | Not supported via CLI (see below) |
|
|
64
|
+
|
|
65
|
+
**Known limitation:** Hex seed import (`--secret 0x...`) does not work from the command line. The CLI argument parser (`cac`) interprets `0x`-prefixed values as JavaScript numbers, which loses precision for 32-byte seeds. Use a BIP39 mnemonic instead. If you need to import a raw seed programmatically, write it directly to `~/.polkadot/accounts.json`.
|
|
66
|
+
|
|
59
67
|
### Query storage
|
|
60
68
|
|
|
61
69
|
```bash
|
|
@@ -136,10 +144,20 @@ Both dry-run and submission display the encoded call hex and a decoded human-rea
|
|
|
136
144
|
Call: 0x0001076465616462656566
|
|
137
145
|
Decode: System.remark(remark: 0xdeadbeef)
|
|
138
146
|
Tx: 0xabc123...
|
|
139
|
-
Block: #12345678 (0xdef...)
|
|
140
147
|
Status: ok
|
|
141
148
|
```
|
|
142
149
|
|
|
150
|
+
#### Exit codes
|
|
151
|
+
|
|
152
|
+
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`).
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
dot tx Balances.transferKeepAlive 5FHneW46... 999999999999999999 --from alice
|
|
156
|
+
# ... events and explorer links ...
|
|
157
|
+
# Error: Transaction dispatch error: Balances.InsufficientBalance
|
|
158
|
+
echo $? # 1
|
|
159
|
+
```
|
|
160
|
+
|
|
143
161
|
#### Custom signed extensions
|
|
144
162
|
|
|
145
163
|
Chains with non-standard signed extensions (e.g. `people-preview`) are auto-handled:
|
|
@@ -209,12 +227,14 @@ Config and metadata caches live in `~/.polkadot/`:
|
|
|
209
227
|
```
|
|
210
228
|
~/.polkadot/
|
|
211
229
|
├── config.json # chains and default chain
|
|
212
|
-
├── accounts.json # stored accounts (secrets
|
|
230
|
+
├── accounts.json # stored accounts (⚠️ secrets are NOT encrypted — see below)
|
|
213
231
|
└── chains/
|
|
214
232
|
└── polkadot/
|
|
215
233
|
└── metadata.bin # cached SCALE-encoded metadata
|
|
216
234
|
```
|
|
217
235
|
|
|
236
|
+
> **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.
|
|
237
|
+
|
|
218
238
|
## Development
|
|
219
239
|
|
|
220
240
|
Requires [Bun](https://bun.sh).
|