@parity/dotns-cli 0.5.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 +406 -0
  2. package/dist/cli.js +268050 -0
  3. package/package.json +71 -0
package/README.md ADDED
@@ -0,0 +1,406 @@
1
+ # dotns developer CLI
2
+
3
+ A command-line tool for registering and managing `.dot` domains on Polkadot.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @parity/dotns-cli
9
+ ```
10
+
11
+ <details>
12
+ <summary>Other package managers</summary>
13
+
14
+ | Package Manager | Command |
15
+ | :-------------- | :---------------------------------- |
16
+ | npm | `npm install -g @parity/dotns-cli` |
17
+ | yarn | `yarn global add @parity/dotns-cli` |
18
+ | pnpm | `pnpm add -g @parity/dotns-cli` |
19
+ | bun | `bun add -g @parity/dotns-cli` |
20
+
21
+ </details>
22
+
23
+ Verify:
24
+
25
+ ```bash
26
+ dotns --version
27
+ ```
28
+
29
+ ## Quick Start
30
+
31
+ ```bash
32
+ bun install
33
+ bun run build
34
+ ```
35
+
36
+ > **Note**: Throughout this README, `dotns` refers to the built CLI. During development, replace `dotns` with `bun run dev`.
37
+
38
+ ## Authentication
39
+
40
+ All write operations require authentication. The CLI supports three methods:
41
+
42
+ ```bash
43
+ # Keystore
44
+ dotns --keystore-path ./keystore --password test-password --account default <command>
45
+
46
+ # Mnemonic
47
+ dotns --mnemonic "bottom drive obey lake curtain smoke basket hold race lonely fit walk" <command>
48
+
49
+ # Development key URI
50
+ dotns --key-uri //Alice <command>
51
+ ```
52
+
53
+ Set environment variables to simplify usage:
54
+
55
+ ```bash
56
+ export DOTNS_KEYSTORE_PATH=./keystore
57
+ export DOTNS_KEYSTORE_PASSWORD=test-password
58
+
59
+ # Then simply use --account
60
+ dotns register domain --account karim --name coolname42
61
+ dotns content set dotns bafybei... --account karim
62
+ dotns pop set lite --account karim
63
+ ```
64
+
65
+ ## Environment Variables
66
+
67
+ | Variable | Description |
68
+ | ------------------------- | -------------------------- |
69
+ | `DOTNS_KEYSTORE_PATH` | Path to keystore directory |
70
+ | `DOTNS_KEYSTORE_PASSWORD` | Keystore password |
71
+ | `DOTNS_RPC` | Asset Hub RPC endpoint |
72
+ | `DOTNS_MNEMONIC` | BIP39 mnemonic phrase |
73
+ | `DOTNS_KEY_URI` | Substrate key URI |
74
+ | `DOTNS_MIN_BALANCE_PAS` | Minimum balance in PAS |
75
+
76
+ ## Commands
77
+
78
+ ### Register Domains
79
+
80
+ All registration commands require authentication.
81
+
82
+ ```bash
83
+ # Register a base domain
84
+ dotns --password test-password register domain --account default --name coolname42
85
+
86
+ # With PoP Lite status
87
+ dotns --password test-password register domain --account default --name alice99 --status lite
88
+
89
+ # With PoP Full status
90
+ dotns --password test-password register domain --account default --name premium --status full
91
+
92
+ # Governance registration (≤5 chars, reserved names)
93
+ dotns --password test-password register domain --account default --name short --governance
94
+
95
+ # Register for another owner
96
+ dotns --password test-password register domain --account default --name coolname42 --owner 0x000000000000000000000000000000000000dEaD
97
+
98
+ # Register and transfer
99
+ dotns --password test-password register domain --account default --name coolname42 --transfer --to 0x000000000000000000000000000000000000dEaD
100
+
101
+ # With reverse record
102
+ dotns --password test-password register domain --account default --name coolname42 --reverse
103
+ ```
104
+
105
+ ### Register Subnames
106
+
107
+ ```bash
108
+ # Register a subname under an existing domain
109
+ dotns --password test-password register subname --name blog --parent coolname42 --account default
110
+
111
+ # Register subname for a different owner
112
+ dotns --password test-password register subname --name blog --parent coolname42 --owner 0x000000000000000000000000000000000000dEaD --account default
113
+ ```
114
+
115
+ ### Lookup (no auth required)
116
+
117
+ ```bash
118
+ # Domain information
119
+ dotns lookup name dotns
120
+
121
+ # Check ownership
122
+ dotns lookup owner-of dotns
123
+
124
+ # Using alias
125
+ dotns lookup oo dotns
126
+
127
+ # Using --name flag
128
+ dotns lookup --name dotns
129
+
130
+ # JSON output
131
+ dotns lookup name dotns --json
132
+ ```
133
+
134
+ ### Transfer Domains
135
+
136
+ ```bash
137
+ # Transfer to EVM address
138
+ dotns lookup transfer coolname42 --destination 0x000000000000000000000000000000000000dEaD
139
+
140
+ # Transfer to Substrate address
141
+ dotns lookup transfer coolname42 --destination 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
142
+
143
+ # Transfer to domain label
144
+ dotns lookup transfer coolname42 --destination alice
145
+
146
+ # JSON output
147
+ dotns lookup transfer coolname42 --destination alice --json
148
+ ```
149
+
150
+ ### Content Hash
151
+
152
+ View does not require authentication:
153
+
154
+ ```bash
155
+ dotns content view dotns
156
+ ```
157
+
158
+ Set requires authentication:
159
+
160
+ ```bash
161
+ dotns --password test-password content set dotns bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi --account default
162
+ ```
163
+
164
+ ### Text Records
165
+
166
+ View does not require authentication:
167
+
168
+ ```bash
169
+ dotns text view dotns email
170
+ dotns text view dotns url
171
+ ```
172
+
173
+ Set requires authentication (reads from stdin if value is omitted):
174
+
175
+ ```bash
176
+ # Set a text record
177
+ dotns --password test-password text set alice email "alice@example.com" --account default
178
+
179
+ # Set from stdin
180
+ echo "https://alice.dev" | dotns --password test-password text set alice url --account default
181
+ ```
182
+
183
+ ### Proof of Personhood
184
+
185
+ ```bash
186
+ # Set PoP status with keystore
187
+ dotns pop --password test-password --account default set lite
188
+ dotns pop set full --password test-password --account default
189
+
190
+ # Set PoP status with mnemonic
191
+ dotns pop --mnemonic "bottom drive obey lake curtain smoke basket hold race lonely fit walk" set lite
192
+
193
+ # Set PoP status with key-uri
194
+ dotns pop --key-uri //Alice set lite
195
+
196
+ # View account info
197
+ dotns pop --password test-password --account default info
198
+ dotns pop --mnemonic "bottom drive obey lake curtain smoke basket hold race lonely fit walk" info
199
+ dotns pop --key-uri //Alice info
200
+ ```
201
+
202
+ ### Bulletin Storage
203
+
204
+ All bulletin commands require authentication.
205
+
206
+ ```bash
207
+ # Upload file
208
+ dotns --password test-password bulletin upload ./image.png --account default
209
+
210
+ # Upload directory
211
+ dotns --password test-password bulletin upload ./dist --account default
212
+
213
+ # Upload directory with concurrency control (max: 4)
214
+ dotns --password test-password bulletin upload ./dist --concurrency 4 --account default
215
+
216
+ # Force chunked upload for large files (streams from disk, low memory)
217
+ dotns --password test-password bulletin upload ./large-file.zip --force-chunked --chunk-size 1048576 --account default
218
+
219
+ # Resume an interrupted upload
220
+ dotns --password test-password bulletin upload ./large-file.zip --force-chunked --resume --account default
221
+
222
+ # Retry transient failures (default: 5, capped at 20)
223
+ dotns --password test-password bulletin upload ./dist --max-retries 10 --account default
224
+
225
+ # Print contenthash
226
+ dotns --password test-password bulletin upload ./site.html --print-contenthash --account default
227
+
228
+ # JSON output
229
+ dotns --password test-password bulletin upload ./image.png --json --account default
230
+
231
+ # Upload profiling
232
+ dotns --password test-password bulletin upload ./dist --profile-upload --account default
233
+ dotns --password test-password bulletin upload ./dist --profile-upload --profile-output ./report.json --account default
234
+
235
+ # Custom RPC
236
+ dotns --password test-password bulletin upload ./image.png --bulletin-rpc wss://paseo-bulletin-rpc.polkadot.io --account default
237
+
238
+ # Skip history
239
+ dotns --password test-password bulletin upload ./image.png --no-history --account default
240
+ ```
241
+
242
+ ### Bulletin History
243
+
244
+ ```bash
245
+ # List upload history
246
+ dotns bulletin history
247
+
248
+ # List as JSON
249
+ dotns bulletin history --json
250
+
251
+ # Remove entry by CID
252
+ dotns bulletin history:remove bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi
253
+
254
+ # Clear all history
255
+ dotns bulletin history:clear
256
+ ```
257
+
258
+ ### Bulletin Authorization
259
+
260
+ Authorise accounts to upload to Bulletin chain. Requires sudo.
261
+
262
+ ```bash
263
+ # Authorise account
264
+ dotns --key-uri //Alice bulletin authorize 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty
265
+
266
+ # With custom limits
267
+ dotns --key-uri //Alice bulletin authorize 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty --transactions 500000 --bytes 549755813888
268
+
269
+ # Force re-authorisation
270
+ dotns --key-uri //Alice bulletin authorize 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty --force
271
+
272
+ # JSON output
273
+ dotns --key-uri //Alice bulletin authorize 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty --json
274
+
275
+ # Custom RPC
276
+ dotns --key-uri //Alice bulletin authorize 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty --bulletin-rpc wss://paseo-bulletin-rpc.polkadot.io
277
+ ```
278
+
279
+ ### Bulletin Status
280
+
281
+ Check authorisation status for an account.
282
+
283
+ ```bash
284
+ # Check status
285
+ dotns bulletin status 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty
286
+
287
+ # JSON output
288
+ dotns bulletin status 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty --json
289
+
290
+ # Resolve account from keystore
291
+ dotns --password test-password bulletin status --account default
292
+ ```
293
+
294
+ ### Account Management
295
+
296
+ ```bash
297
+ # Store mnemonic
298
+ dotns auth --keystore-path ./keystore --password test-password set --account default --mnemonic "bottom drive obey lake curtain smoke basket hold race lonely fit walk"
299
+
300
+ # Store key-uri
301
+ dotns auth --keystore-path ./keystore --password test-password set --account alice --key-uri //Alice
302
+
303
+ # List stored accounts
304
+ dotns auth --keystore-path ./keystore --password test-password list
305
+
306
+ # Switch default account
307
+ dotns auth --keystore-path ./keystore --password test-password use default
308
+
309
+ # Remove account
310
+ dotns auth --keystore-path ./keystore --password test-password remove default
311
+
312
+ # Clear all credentials
313
+ dotns auth --keystore-path ./keystore clear
314
+ ```
315
+
316
+ ### Account
317
+
318
+ ```bash
319
+ # Print substrate address (no RPC needed)
320
+ dotns account address --key-uri //Alice
321
+
322
+ # Account info (balances, mapping status)
323
+ dotns account info --key-uri //Alice
324
+
325
+ # Map Substrate account to EVM address
326
+ dotns --password test-password account map --account default
327
+
328
+ # Check if address is mapped on-chain
329
+ dotns account is-mapped 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
330
+
331
+ # Check if address is whitelisted
332
+ dotns account is-whitelisted 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
333
+
334
+ # Whitelist an address (admin only)
335
+ dotns --key-uri //Alice account whitelist 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
336
+
337
+ # Remove from whitelist
338
+ dotns --key-uri //Alice account whitelist 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY --remove
339
+ ```
340
+
341
+ ### Store
342
+
343
+ ```bash
344
+ # Show Store address and deployment status
345
+ dotns --password test-password store info --account default
346
+
347
+ # List all values
348
+ dotns --password test-password store list --account default
349
+
350
+ # Get / set / delete values
351
+ dotns --password test-password store get mykey --account default
352
+ dotns --password test-password store set mykey "my value" --account default
353
+ dotns --password test-password store delete mykey --account default
354
+
355
+ # Authorization management
356
+ dotns --password test-password store check 0x000000000000000000000000000000000000dEaD --account default
357
+ dotns --password test-password store authorize 0x000000000000000000000000000000000000dEaD --account default
358
+ dotns --password test-password store unauthorize 0x000000000000000000000000000000000000dEaD --account default
359
+
360
+ # DotNS controller authorisation
361
+ dotns --password test-password store authorize-controller 0x000000000000000000000000000000000000dEaD --account default
362
+ dotns --password test-password store unauthorize-controller 0x000000000000000000000000000000000000dEaD --account default
363
+
364
+ # Ensure all required authorizations
365
+ dotns --password test-password store ensure-auth --account default
366
+
367
+ # JSON output (all subcommands)
368
+ dotns --password test-password store info --json --account default
369
+ ```
370
+
371
+ ## Domain Classification
372
+
373
+ | Type | Length | Requirements |
374
+ | -------- | -------------------- | ----------------- |
375
+ | Reserved | 5 chars or less | Governance only |
376
+ | PoP Full | 6-8 chars | Full verification |
377
+ | PoP Lite | 6-8 chars + 2 digits | Lite verification |
378
+ | NoStatus | 9+ chars + 2 digits | Open registration |
379
+
380
+ ## Transfer Recipients
381
+
382
+ The `--to` flag accepts:
383
+
384
+ - EVM address: `0x000000000000000000000000000000000000dEaD`
385
+ - Substrate address: `5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY`
386
+ - Domain label: `alice` (resolves to owner of `alice.dot`)
387
+
388
+ ## Development
389
+
390
+ ```bash
391
+ bun run dev <command>
392
+ bun run typecheck
393
+ bun run lint
394
+ bun run lint:fix
395
+ bun run format
396
+ bun run format:fix
397
+ bun test
398
+ ```
399
+
400
+ ## Contributing
401
+
402
+ See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for guidelines.
403
+
404
+ ## License
405
+
406
+ Apache-2.0