Skip to content

Commit b59877f

Browse files
authored
chore(cli): code cleanup (#178)
## Description This PR cleansup some dead code and minor fixes to the escrow views in the cli and ui ## Type - [x] Bug fix - [ ] Feature - [ ] Breaking change - [ ] Documentation - [ ] Chore ## Package - [ ] `@parity/dotns-cli` - [ ] Root/monorepo - [ ] Documentation ## Related Issues ## Fixes ## Checklist ### Code - [x] Follows project style - [x] `bun run lint` passes - [x] `bun run format` passes - [x] `bun run typecheck` passes ### Documentation - [ ] README updated if needed - [ ] Types updated if needed ### Breaking Changes - [ ] No breaking changes - [ ] Breaking changes documented below **Breaking changes:** ## Testing How to test: 1. 2. ## Notes
1 parent 2166c49 commit b59877f

56 files changed

Lines changed: 2244 additions & 593 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/cli/README.md

Lines changed: 99 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ existing keystores.
8686
| `DOTNS_RPC` | Asset Hub RPC endpoint |
8787
| `DOTNS_MNEMONIC` | BIP39 mnemonic phrase |
8888
| `DOTNS_KEY_URI` | Substrate key URI |
89-
| `DOTNS_MIN_BALANCE_PAS` | Minimum balance in PAS |
9089

9190
Select an environment with either an environment variable or a per-command option:
9291

@@ -112,29 +111,29 @@ dotns account whitelist 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY --env p
112111
All registration commands require authentication.
113112

114113
```bash
115-
# Register a base domain
116-
dotns --password test-password register domain --account default --name coolname42
114+
# Register a NoStatus name (stem ≥ 9, open to all)
115+
dotns --password test-password register domain --account default --name coolwebsite
117116

118-
# Register a name that requires PoP Lite
119-
dotns --password test-password register domain --account default --name alice99
117+
# Register a name that requires PoP Lite (stem 6-8 + 2-digit suffix)
118+
dotns --password test-password register domain --account default --name premium12
120119

121-
# Register a name that requires PoP Full
120+
# Register a name that requires PoP Full (stem 6-8, no suffix)
122121
dotns --password test-password register domain --account default --name premium
123122

124-
# Governance registration (≤5 chars, reserved names)
123+
# Governance registration (stem ≤ 5, reserved names)
125124
dotns --password test-password register domain --account default --name short --governance
126125

127126
# Register for another owner
128-
dotns --password test-password register domain --account default --name coolname42 --owner 0x000000000000000000000000000000000000dEaD
127+
dotns --password test-password register domain --account default --name coolwebsite --owner 0x000000000000000000000000000000000000dEaD
129128

130129
# Register and transfer
131-
dotns --password test-password register domain --account default --name coolname42 --transfer --to 0x000000000000000000000000000000000000dEaD
130+
dotns --password test-password register domain --account default --name coolwebsite --transfer --to 0x000000000000000000000000000000000000dEaD
132131

133132
# With reverse record
134-
dotns --password test-password register domain --account default --name coolname42 --reverse
133+
dotns --password test-password register domain --account default --name coolwebsite --reverse
135134

136135
# Auto-retry on failure, resuming from the cached commitment (here, up to 3 times)
137-
dotns --password test-password register domain --account default --name coolname42 --retry 3
136+
dotns --password test-password register domain --account default --name coolwebsite --retry 3
138137
```
139138

140139
### Resume and manage commitments
@@ -263,8 +262,10 @@ echo "https://alice.dev" | dotns --password test-password text set alice url --a
263262

264263
The CLI reads PoP status directly from the personhood precompile at
265264
`0x000000000000000000000000000000000a010000` using the `bytes32("dotns")`
266-
context. Returned tiers are `none`, `lite`, or `full`; DotNS does not set this
267-
status.
265+
context. Returned tiers are `none`, `lite`, `full`, or `reserved`; DotNS does
266+
not set this status. `pop info` also reports whether the account is whitelisted
267+
for governance-reserved registrations (independent of the PoP tier) and any
268+
names pending settlement into the Label Store (run `store sync` to settle them).
268269

269270
```bash
270271
# Check PoP status from the personhood precompile
@@ -273,7 +274,7 @@ dotns pop status --password test-password --account default
273274
dotns pop --mnemonic "bottom drive obey lake curtain smoke basket hold race lonely fit walk" status
274275
dotns pop --key-uri //Alice status
275276

276-
# View account info
277+
# Full info: status, whitelist eligibility, and pending names
277278
dotns pop --password test-password --account default info
278279
dotns pop --mnemonic "bottom drive obey lake curtain smoke basket hold race lonely fit walk" info
279280
dotns pop --key-uri //Alice info
@@ -456,14 +457,92 @@ dotns --password test-password store sync --account default
456457
dotns --password test-password store info --json --account default
457458
```
458459

460+
### Delegate
461+
462+
Grant another account control of your names. Per-name delegation surrenders full
463+
control of a single name; record delegation lets an operator edit records across
464+
all your names. Operators may be an EVM address, SS58 address, or `.dot` label.
465+
466+
```bash
467+
# Delegate full control of one name
468+
dotns --password test-password delegate set coolname42 alice --account default
469+
470+
# Revoke the delegate on a name
471+
dotns --password test-password delegate revoke coolname42 --account default
472+
473+
# Show the current delegate for a name (no auth)
474+
dotns delegate status coolname42
475+
476+
# Let an operator edit records on all your names
477+
dotns --password test-password delegate records alice --account default
478+
479+
# Revoke record-editing access
480+
dotns --password test-password delegate records alice --revoke --account default
481+
482+
# Show whether an operator may edit your records (no auth)
483+
dotns delegate records-status alice
484+
```
485+
486+
### Set Primary Name
487+
488+
Set the primary (reverse) name resolvers return for your account. You can only
489+
set a name you own; there is no on-chain "clear" beyond pointing it at a
490+
different name or transferring the current one away.
491+
492+
```bash
493+
# Set one of your names as the primary
494+
dotns --password test-password primary set coolname42 --account default
495+
496+
# Show the primary name for an account (defaults to your own, no auth)
497+
dotns primary status
498+
dotns primary status 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
499+
```
500+
501+
### Escrow
502+
503+
Names registered without PoP verification (NoStatus) hold a refundable deposit
504+
in escrow. Release a name to start its cooldown, withdraw the deposit onto the
505+
pull-payment ledger, then claim your balance.
506+
507+
```bash
508+
# Show the escrow position for a name (no auth)
509+
dotns escrow status coolwebsite
510+
511+
# List all your positions and the total locked
512+
dotns --password test-password escrow positions --account default
513+
514+
# Show your claimable pull-payment balance
515+
dotns --password test-password escrow balance --account default
516+
517+
# Release a name to start its refund cooldown
518+
dotns --password test-password escrow release coolwebsite --account default
519+
520+
# After cooldown, move the released deposit onto the pull-payment ledger
521+
dotns --password test-password escrow withdraw coolwebsite --account default
522+
523+
# Drain the pull-payment ledger
524+
dotns --password test-password escrow claim-withdrawal --account default
525+
526+
# List entries in the time-locked refund ledger
527+
dotns --password test-password escrow refunds list --account default
528+
529+
# Claim a refund entry (or several) once its cooldown elapses
530+
dotns --password test-password escrow refunds claim <entryId> --account default
531+
dotns --password test-password escrow refunds claim-batch <id1> <id2> --account default
532+
```
533+
459534
## Domain Classification
460535

461-
| Type | Length | Requirements |
462-
| -------- | -------------------- | ----------------- |
463-
| Reserved | 5 chars or less | Governance only |
464-
| PoP Full | 6-8 chars | Full verification |
465-
| PoP Lite | 6-8 chars + 2 digits | Lite verification |
466-
| NoStatus | 9+ chars + 2 digits | Open registration |
536+
A name's tier is decided by its **stem length** — the label length excluding an
537+
optional trailing digit suffix. The suffix must be either absent or exactly two
538+
digits; any other trailing-digit count is rejected.
539+
540+
| Type | Stem length | Digit suffix | Requirement |
541+
| -------- | ----------- | ------------ | ----------------- |
542+
| Reserved | ≤ 5 | none or 2 | Governance only |
543+
| PoP Full | 6–8 | none | Full verification |
544+
| PoP Lite | 6–8 | exactly 2 | Lite verification |
545+
| NoStatus | ≥ 9 | none or 2 | Open to all |
467546

468547
## Transfer Recipients
469548

0 commit comments

Comments
 (0)