@parity/dotns-cli 0.7.2 → 0.7.4
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 +85 -0
- package/dist/cli.js +112851 -85786
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -76,6 +76,43 @@ New keystore passwords supplied interactively, with `--password`, or with
|
|
|
76
76
|
`DOTNS_KEYSTORE_PASSWORD` must be at least 6 characters. Decryption remains compatible with
|
|
77
77
|
existing keystores.
|
|
78
78
|
|
|
79
|
+
### Mobile wallet signer (QR)
|
|
80
|
+
|
|
81
|
+
> **Experimental:** the QR mobile-wallet signer is still in development and the CLI prints a warning
|
|
82
|
+
> when it is used. The wallet must be on the same People-chain network as the pairing relay (see
|
|
83
|
+
> `--qr-people-rpc`); a production App Store wallet cannot pair with this testnet flow.
|
|
84
|
+
|
|
85
|
+
Instead of a local key, pair a Polkadot mobile wallet over a QR code with `--signer qr` (or
|
|
86
|
+
`DOTNS_SIGNER=qr`). The CLI prints a QR code, you scan it with the app, and every transaction is
|
|
87
|
+
approved on your phone, so no private key sits on the machine.
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
dotns register domain --name coolname42 --signer qr
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The account is the paired wallet, so `--signer qr` cannot be combined with the local-keystore
|
|
94
|
+
flags or their environment variables (`--account`, `--password`, `--keystore-path`,
|
|
95
|
+
`--mnemonic`, `--key-uri`, `DOTNS_MNEMONIC`, `DOTNS_KEY_URI`, `DOTNS_KEYSTORE_PASSWORD`); doing
|
|
96
|
+
so is rejected rather than silently ignored.
|
|
97
|
+
|
|
98
|
+
The first pairing is cached under `~/.polkadot-apps/`, so later commands reuse it without
|
|
99
|
+
re-scanning (the wallet's granted allowance also makes signing non-interactive). The pairing is
|
|
100
|
+
cryptographically bound to the host keys in the QR, so a malicious relay cannot forge it. Anyone
|
|
101
|
+
with read access to `~/.polkadot-apps/` can sign as the wallet until you re-pair; pass `--qr-fresh`
|
|
102
|
+
to force a fresh pairing (and re-approval) on a given run.
|
|
103
|
+
|
|
104
|
+
The pairing QR and prompts are written to stderr, so `--json` output on stdout stays machine-clean.
|
|
105
|
+
Requires Node ≥ 21 (for a global `WebSocket`); running under Bun works as-is. A freshly paired
|
|
106
|
+
account is usually not address-mapped, so run `dotns account map --signer qr` once before
|
|
107
|
+
registering or transferring. The wallet pairs under a single product id (default `dotns`) that
|
|
108
|
+
also seeds the signing account; override it with `--qr-app-id` / `DOTNS_QR_APP_ID`.
|
|
109
|
+
|
|
110
|
+
Pairing rendezvous happens on a People-chain relay, and the CLI and the wallet must be on the same
|
|
111
|
+
one or the wallet's response never arrives and pairing hangs. Select the relay to match the
|
|
112
|
+
wallet's network with `--qr-people-rpc` / `DOTNS_QR_PEOPLE_RPC`: `paseo` (default), `preview`,
|
|
113
|
+
`stable`, or a comma-separated list of `wss` URLs. Set `DOTNS_QR_DEBUG=1` to print the verbose
|
|
114
|
+
pairing handshake trace when diagnosing a stuck pairing.
|
|
115
|
+
|
|
79
116
|
## Environment Variables
|
|
80
117
|
|
|
81
118
|
| Variable | Description |
|
|
@@ -86,6 +123,10 @@ existing keystores.
|
|
|
86
123
|
| `DOTNS_RPC` | Asset Hub RPC endpoint |
|
|
87
124
|
| `DOTNS_MNEMONIC` | BIP39 mnemonic phrase |
|
|
88
125
|
| `DOTNS_KEY_URI` | Substrate key URI |
|
|
126
|
+
| `DOTNS_SIGNER` | Signer backend: `keystore` (default) or `qr` |
|
|
127
|
+
| `DOTNS_QR_APP_ID` | Product id for QR pairing (default `dotns`) |
|
|
128
|
+
| `DOTNS_QR_PEOPLE_RPC` | QR relay: `paseo`/`preview`/`stable` or wss URLs |
|
|
129
|
+
| `DOTNS_QR_DEBUG` | Set to print the verbose QR pairing trace |
|
|
89
130
|
|
|
90
131
|
Select an environment with either an environment variable or a per-command option:
|
|
91
132
|
|
|
@@ -104,6 +145,50 @@ dotns account whitelist 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY --env p
|
|
|
104
145
|
|
|
105
146
|
`--rpc` still overrides the endpoint URL, but it does not change the selected DotNS contract addresses. Use `--env`/`DOTNS_ENV` to select the DotNS deployment.
|
|
106
147
|
|
|
148
|
+
## Programmatic SDK
|
|
149
|
+
|
|
150
|
+
The operations the CLI runs are exported from `@parity/dotns-cli/core` as typed functions you can
|
|
151
|
+
call from your own TypeScript. You build a context with a chain client, an SS58 origin, and a
|
|
152
|
+
`PolkadotSigner` you supply; every operation takes that context. There is no raw-contract surface:
|
|
153
|
+
addresses come from `DOTNS_ENVIRONMENTS[id].contracts` and the ABI is applied internally, so callers
|
|
154
|
+
never pass an ABI, address, or calldata.
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
import { createClient } from "polkadot-api";
|
|
158
|
+
import { getWsProvider } from "polkadot-api/ws-provider/node";
|
|
159
|
+
import { paseo } from "@polkadot-api/descriptors";
|
|
160
|
+
import {
|
|
161
|
+
createDotnsContext,
|
|
162
|
+
ReviveClientWrapper,
|
|
163
|
+
registerName,
|
|
164
|
+
registerSubnode,
|
|
165
|
+
setContentHash,
|
|
166
|
+
getContentHash,
|
|
167
|
+
resolveTransferRecipient,
|
|
168
|
+
transferName,
|
|
169
|
+
} from "@parity/dotns-cli/core";
|
|
170
|
+
|
|
171
|
+
const client = createClient(getWsProvider("wss://paseo-asset-hub-next-rpc.polkadot.io"));
|
|
172
|
+
const ctx = createDotnsContext({
|
|
173
|
+
clientWrapper: new ReviveClientWrapper(client.getTypedApi(paseo)),
|
|
174
|
+
origin, // your SS58 address
|
|
175
|
+
signer, // your PolkadotSigner
|
|
176
|
+
environment: "paseo-v2",
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
await registerName(ctx, "alice"); // owner defaults to your mapped EVM address
|
|
180
|
+
await registerSubnode(ctx, "alice", "bob", ownerAddress); // alice.bob.dot
|
|
181
|
+
await setContentHash(ctx, "alice.dot", "bafy...cid");
|
|
182
|
+
const { cid } = await getContentHash(ctx, "alice.dot");
|
|
183
|
+
const recipient = await resolveTransferRecipient(ctx, "bob.dot"); // EVM, SS58, or .dot label
|
|
184
|
+
await transferName(ctx, "alice", recipient);
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
`createDotnsContext` rejects an EVM (H160) origin, and a write without a signer throws
|
|
188
|
+
`MissingSignerError`. The origin must be Revive address-mapped before `registerName`/`transferName`.
|
|
189
|
+
To sign with a QR-paired mobile wallet programmatically, build the signer with
|
|
190
|
+
`@parity/product-sdk-terminal` and pass it as `signer` (see `/docs/tools/sdk`).
|
|
191
|
+
|
|
107
192
|
## Commands
|
|
108
193
|
|
|
109
194
|
### Register Domains
|