@beclab/olaresid 0.1.7 ā 0.1.9
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/CLI.md +150 -33
- package/README.md +13 -13
- package/dist/cli.js +145 -34
- package/dist/cli.js.map +1 -1
- package/dist/domain/index.d.ts.map +1 -1
- package/dist/domain/index.js +6 -1
- package/dist/domain/index.js.map +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -0
- package/dist/index.js.map +1 -1
- package/dist/tag/tuple.js +2 -2
- package/dist/tag/tuple.js.map +1 -1
- package/package.json +1 -1
- package/src/cli.ts +178 -34
- package/src/domain/index.ts +6 -3
- package/src/index.ts +70 -0
- package/src/tag/tuple.ts +2 -2
package/CLI.md
CHANGED
|
@@ -35,7 +35,7 @@ did-cli info <domain> [options]
|
|
|
35
35
|
# Examples
|
|
36
36
|
did-cli info example.olares.com
|
|
37
37
|
did-cli info example.olares.com --json
|
|
38
|
-
did-cli info example.olares.com --network
|
|
38
|
+
did-cli info example.olares.com --network sepolia
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
#### Get Domain Owner
|
|
@@ -163,22 +163,22 @@ did-cli subdomain register parent.com child
|
|
|
163
163
|
did-cli subdomain register parent.com child --words 24
|
|
164
164
|
|
|
165
165
|
# Use an existing mnemonic for subdomain owner
|
|
166
|
-
export
|
|
166
|
+
export SUBDOMAIN_OWNER_MNEMONIC="your twelve word mnemonic phrase here that will derive the keys"
|
|
167
167
|
did-cli subdomain register parent.com child
|
|
168
168
|
|
|
169
169
|
# JSON output
|
|
170
170
|
did-cli subdomain register parent.com child --json
|
|
171
171
|
|
|
172
|
-
# Use
|
|
173
|
-
did-cli subdomain register parent.com child --network
|
|
172
|
+
# Use sepolia testnet
|
|
173
|
+
did-cli subdomain register parent.com child --network sepolia
|
|
174
174
|
```
|
|
175
175
|
|
|
176
176
|
**Important Notes:**
|
|
177
177
|
|
|
178
178
|
1. **Authentication**: You need the parent domain owner's private key or mnemonic via `PRIVATE_KEY_OR_MNEMONIC` environment variable
|
|
179
179
|
2. **Subdomain Owner Mnemonic**:
|
|
180
|
-
- Set via `
|
|
181
|
-
- If `
|
|
180
|
+
- Set via `SUBDOMAIN_OWNER_MNEMONIC` environment variable to use an existing mnemonic
|
|
181
|
+
- If `SUBDOMAIN_OWNER_MNEMONIC` is not set, a new one will be auto-generated and saved to `./subdomain-mnemonic.txt`
|
|
182
182
|
- The mnemonic derives the subdomain's owner address and DID
|
|
183
183
|
- **Save the mnemonic securely** - it's the only way to control the subdomain
|
|
184
184
|
3. **Full Domain**: If you register `child` under `parent.com`, the full domain will be `child.parent.com`
|
|
@@ -235,22 +235,22 @@ did-cli transfer example.com
|
|
|
235
235
|
did-cli transfer example.com --words 24
|
|
236
236
|
|
|
237
237
|
# Use specific mnemonic for new owner
|
|
238
|
-
export
|
|
238
|
+
export TO_MNEMONIC="new owner twelve word mnemonic phrase here"
|
|
239
239
|
did-cli transfer example.com
|
|
240
240
|
|
|
241
241
|
# JSON output
|
|
242
242
|
did-cli transfer example.com --json
|
|
243
243
|
|
|
244
|
-
# Use
|
|
245
|
-
did-cli transfer example.com --network
|
|
244
|
+
# Use sepolia testnet
|
|
245
|
+
did-cli transfer example.com --network sepolia
|
|
246
246
|
```
|
|
247
247
|
|
|
248
248
|
**Important Notes:**
|
|
249
249
|
|
|
250
250
|
1. **Authentication**: You need the current owner's private key or mnemonic via `PRIVATE_KEY_OR_MNEMONIC` environment variable
|
|
251
251
|
2. **New Owner Mnemonic**:
|
|
252
|
-
- Set via `
|
|
253
|
-
- If `
|
|
252
|
+
- Set via `TO_MNEMONIC` environment variable to use an existing mnemonic
|
|
253
|
+
- If `TO_MNEMONIC` is not set, a new one will be auto-generated and saved to `./transfer-new-owner-mnemonic.txt`
|
|
254
254
|
- The mnemonic derives the new owner's address and DID
|
|
255
255
|
- **Save the new owner's mnemonic securely** - it's the only way to control the domain after transfer
|
|
256
256
|
3. **Two Transactions**: The operation submits two transactions to the blockchain
|
|
@@ -470,8 +470,8 @@ did-cli wallet evm add example.com
|
|
|
470
470
|
# With JSON output
|
|
471
471
|
did-cli wallet evm add example.com --json
|
|
472
472
|
|
|
473
|
-
# On
|
|
474
|
-
did-cli wallet evm add example.com --network
|
|
473
|
+
# On sepolia testnet
|
|
474
|
+
did-cli wallet evm add example.com --network sepolia
|
|
475
475
|
```
|
|
476
476
|
|
|
477
477
|
**Output Example:**
|
|
@@ -629,29 +629,144 @@ did-cli wallet solana list example.com --json
|
|
|
629
629
|
4. **Storage**: Wallet addresses are stored in the RootTagger2 contract
|
|
630
630
|
5. **Backward Compatibility**: `list` command also fetches addresses from legacy RootResolver contract
|
|
631
631
|
|
|
632
|
-
###
|
|
632
|
+
### Admin Commands
|
|
633
|
+
|
|
634
|
+
Manage contract-level administrative functions including ownership and operator management.
|
|
635
|
+
|
|
636
|
+
#### Get Contract Owner
|
|
637
|
+
|
|
638
|
+
Get the current owner address of the DID contract.
|
|
639
|
+
|
|
640
|
+
```bash
|
|
641
|
+
did-cli admin get-owner [options]
|
|
642
|
+
|
|
643
|
+
# Examples
|
|
644
|
+
did-cli admin get-owner
|
|
645
|
+
did-cli admin get-owner --json
|
|
646
|
+
did-cli admin get-owner --network sepolia
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
**Output Example:**
|
|
650
|
+
|
|
651
|
+
```
|
|
652
|
+
š¤ Contract Owner: 0x1234567890abcdef...
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
#### Get Total Supply
|
|
656
|
+
|
|
657
|
+
Get the total number of registered domains.
|
|
658
|
+
|
|
659
|
+
```bash
|
|
660
|
+
did-cli admin get-totalsupply [options]
|
|
661
|
+
|
|
662
|
+
# Examples
|
|
663
|
+
did-cli admin get-totalsupply
|
|
664
|
+
did-cli admin get-totalsupply --json
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
**Output Example:**
|
|
668
|
+
|
|
669
|
+
```
|
|
670
|
+
š Total Domains: 12345
|
|
671
|
+
```
|
|
633
672
|
|
|
634
673
|
#### Get Operator Address
|
|
635
674
|
|
|
675
|
+
Get the current operator address (super admin).
|
|
676
|
+
|
|
636
677
|
```bash
|
|
637
|
-
did-cli
|
|
678
|
+
did-cli admin get-operator [options]
|
|
638
679
|
|
|
639
680
|
# Examples
|
|
640
|
-
did-cli
|
|
641
|
-
did-cli
|
|
642
|
-
did-cli
|
|
681
|
+
did-cli admin get-operator
|
|
682
|
+
did-cli admin get-operator --json
|
|
683
|
+
did-cli admin get-operator --network sepolia
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
**Output Example:**
|
|
687
|
+
|
|
688
|
+
```
|
|
689
|
+
š Operator: 0x5678901234abcdef...
|
|
643
690
|
```
|
|
644
691
|
|
|
645
692
|
#### Set Operator Address
|
|
646
693
|
|
|
694
|
+
Set the operator address. Only the contract owner can call this.
|
|
695
|
+
|
|
647
696
|
```bash
|
|
648
|
-
did-cli
|
|
697
|
+
did-cli admin set-operator <address>
|
|
649
698
|
|
|
650
699
|
# Examples
|
|
651
700
|
export PRIVATE_KEY_OR_MNEMONIC=0x1234...
|
|
652
|
-
did-cli
|
|
653
|
-
did-cli
|
|
701
|
+
did-cli admin set-operator 0x5678...
|
|
702
|
+
did-cli admin set-operator 0x5678... --json
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
**Output Example:**
|
|
706
|
+
|
|
707
|
+
```
|
|
708
|
+
ā
Operator set to 0x5678...
|
|
709
|
+
š Transaction: 0xabc123...
|
|
710
|
+
ā½ Gas used: 45000
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
#### Transfer Contract Ownership
|
|
714
|
+
|
|
715
|
+
Initiate transfer of contract ownership to a new address. The new owner must call `accept-ownership` to complete the transfer.
|
|
716
|
+
|
|
717
|
+
```bash
|
|
718
|
+
did-cli admin transfer-ownership <new-owner-address>
|
|
719
|
+
|
|
720
|
+
# Examples
|
|
721
|
+
export PRIVATE_KEY_OR_MNEMONIC=0x1234...
|
|
722
|
+
did-cli admin transfer-ownership 0x9999...
|
|
723
|
+
did-cli admin transfer-ownership 0x9999... --json
|
|
724
|
+
```
|
|
725
|
+
|
|
726
|
+
**Output Example:**
|
|
727
|
+
|
|
728
|
+
```
|
|
729
|
+
ā
Ownership transfer initiated to 0x9999...
|
|
730
|
+
š Transaction: 0xdef456...
|
|
731
|
+
ā½ Gas used: 50000
|
|
732
|
+
|
|
733
|
+
ā ļø Note: The new owner must call "admin accept-ownership" to complete the transfer
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
**Important Notes:**
|
|
737
|
+
|
|
738
|
+
- Only the current contract owner can initiate ownership transfer
|
|
739
|
+
- This is a two-step process for safety:
|
|
740
|
+
1. Current owner calls `transfer-ownership`
|
|
741
|
+
2. New owner calls `accept-ownership`
|
|
742
|
+
- The pending owner can be queried from the contract
|
|
743
|
+
|
|
744
|
+
#### Accept Ownership Transfer
|
|
745
|
+
|
|
746
|
+
Accept a pending ownership transfer. Must be called by the pending owner.
|
|
747
|
+
|
|
748
|
+
```bash
|
|
749
|
+
did-cli admin accept-ownership
|
|
750
|
+
|
|
751
|
+
# Examples
|
|
752
|
+
export PRIVATE_KEY_OR_MNEMONIC=0x9999... # New owner's private key
|
|
753
|
+
did-cli admin accept-ownership
|
|
754
|
+
did-cli admin accept-ownership --json
|
|
755
|
+
```
|
|
756
|
+
|
|
757
|
+
**Output Example:**
|
|
758
|
+
|
|
654
759
|
```
|
|
760
|
+
ā
Ownership transfer accepted successfully
|
|
761
|
+
š Transaction: 0xghi789...
|
|
762
|
+
ā½ Gas used: 48000
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
**Important Notes:**
|
|
766
|
+
|
|
767
|
+
- Only the pending owner (set by `transfer-ownership`) can accept
|
|
768
|
+
- After acceptance, you become the new contract owner
|
|
769
|
+
- This completes the ownership transfer process
|
|
655
770
|
|
|
656
771
|
### Utility Commands
|
|
657
772
|
|
|
@@ -1095,7 +1210,7 @@ did-cli tag remove example.com premium
|
|
|
1095
1210
|
|
|
1096
1211
|
| Option | Description | Default |
|
|
1097
1212
|
| --- | --- | --- |
|
|
1098
|
-
| `-n, --network <network>` | Network to use (sepolia\|mainnet) |
|
|
1213
|
+
| `-n, --network <network>` | Network to use (sepolia\|mainnet) | mainnet |
|
|
1099
1214
|
| `--rpc <url>` | Custom RPC endpoint URL | - |
|
|
1100
1215
|
| `--contract-did <address>` | Custom DID contract address | - |
|
|
1101
1216
|
| `--contract-resolver <address>` | Custom RootResolver contract address | - |
|
|
@@ -1117,7 +1232,9 @@ did-cli tag remove example.com premium
|
|
|
1117
1232
|
| Variable | Description |
|
|
1118
1233
|
| --- | --- |
|
|
1119
1234
|
| `PRIVATE_KEY_OR_MNEMONIC` | Private key (0x...) or BIP39 mnemonic phrase for signing transactions (required for write operations like transfer, set RSA key, set IP, wallet management, etc.) |
|
|
1120
|
-
| `
|
|
1235
|
+
| `SUBDOMAIN_OWNER_MNEMONIC` | BIP39 mnemonic phrase for generating subdomain owner identity (used in subdomain registration) |
|
|
1236
|
+
| `TO_MNEMONIC` | BIP39 mnemonic phrase for generating new owner identity (used in domain transfer) |
|
|
1237
|
+
| `MNEMONIC` | BIP39 mnemonic phrase for crypto utility commands (used in crypto address, did, privatekey, derive) |
|
|
1121
1238
|
| `EVM_PRIVATE_KEY` | EVM wallet private key (0x...) for wallet management operations (required for `wallet evm add/remove` commands) |
|
|
1122
1239
|
| `SOLANA_PRIVATE_KEY` | Solana wallet private key for wallet management operations (required for `wallet solana add/remove` commands). Supports base58 or JSON array format |
|
|
1123
1240
|
|
|
@@ -1142,7 +1259,16 @@ did-cli tag remove example.com premium
|
|
|
1142
1259
|
|
|
1143
1260
|
## Network Configuration
|
|
1144
1261
|
|
|
1145
|
-
###
|
|
1262
|
+
### Mainnet (Default)
|
|
1263
|
+
|
|
1264
|
+
- RPC: `https://optimism-rpc.publicnode.com`
|
|
1265
|
+
- DID Contract: `0x5DA4Fa8E567d86e52Ef8Da860de1be8f54cae97D`
|
|
1266
|
+
- RootResolver: `0xE2EABA0979277A90511F8873ae1e8cA26B54E740`
|
|
1267
|
+
- ABI Type: `0x9ae3F16bD99294Af1784beB1a0A5C84bf2636365`
|
|
1268
|
+
- RootResolver2: `0x7e7961aB771cA942CE4DB6e79579e016a33Dc95B`
|
|
1269
|
+
- Support Service: `https://api.olares.com/did/support`
|
|
1270
|
+
|
|
1271
|
+
### Sepolia Testnet
|
|
1146
1272
|
|
|
1147
1273
|
- RPC: `https://sepolia.optimism.io`
|
|
1148
1274
|
- DID Contract: `0xe2D7c3a9013960E04d4E9F5F9B63fff37eEd97A8`
|
|
@@ -1151,15 +1277,6 @@ did-cli tag remove example.com premium
|
|
|
1151
1277
|
- RootResolver2: `0xcbC02aa08c77a374eC0D5A0403E108b7573d96e8`
|
|
1152
1278
|
- Support Service: `https://api-test.olares.com/did/support`
|
|
1153
1279
|
|
|
1154
|
-
### Mainnet
|
|
1155
|
-
|
|
1156
|
-
- RPC: `https://optimism-rpc.publicnode.com`
|
|
1157
|
-
- DID Contract: `0x5DA4Fa8E567d86e52Ef8Da860de1be8f54cae97D`
|
|
1158
|
-
- RootResolver: `0xE2EABA0979277A90511F8873ae1e8cA26B54E740`
|
|
1159
|
-
- ABI Type: `0x9ae3F16bD99294Af1784beB1a0A5C84bf2636365`
|
|
1160
|
-
- RootResolver2: `0x50724411eb1817822e2590a43a8F0859FCc6fCD5`
|
|
1161
|
-
- Support Service: `https://api.olares.com/did/support`
|
|
1162
|
-
|
|
1163
1280
|
## Output Formats
|
|
1164
1281
|
|
|
1165
1282
|
### Human-Readable (Default)
|
package/README.md
CHANGED
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
```bash
|
|
12
12
|
npm install -g @beclab/olaresid
|
|
13
13
|
|
|
14
|
-
# Query Olares ID information on
|
|
14
|
+
# Query Olares ID information on mainnet (default)
|
|
15
15
|
did-cli info example.olares.com
|
|
16
16
|
|
|
17
|
-
# Query Olares ID information on
|
|
18
|
-
did-cli info example.olares.com --network
|
|
17
|
+
# Query Olares ID information on sepolia testnet
|
|
18
|
+
did-cli info example.olares.com --network sepolia
|
|
19
19
|
|
|
20
20
|
# Support Olares ID Format
|
|
21
21
|
did-cli info alice@example.com
|
|
@@ -71,7 +71,7 @@ npm link
|
|
|
71
71
|
|
|
72
72
|
# Test CLI functionality
|
|
73
73
|
did-cli info tw7613781.olares.com
|
|
74
|
-
did-cli info pengpeng8.olares.com --network
|
|
74
|
+
did-cli info pengpeng8.olares.com --network sepolia
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
### Testing Method 2: Debug via Example Code
|
|
@@ -95,18 +95,18 @@ After testing, feel free to submit a Pull Request!
|
|
|
95
95
|
|
|
96
96
|
## Network Configuration
|
|
97
97
|
|
|
98
|
-
####
|
|
99
|
-
|
|
100
|
-
- **RPC:** https://sepolia.optimism.io
|
|
101
|
-
- **DID Contract:** 0xe2D7c3a9013960E04d4E9F5F9B63fff37eEd97A8
|
|
102
|
-
- **Root Resolver:** 0xeF727cb066Fee98F88Db84555830063b4A24ddfc
|
|
103
|
-
- **Root Resolver2:** 0xcbC02aa08c77a374eC0D5A0403E108b7573d96e8
|
|
104
|
-
- **ABI Type:** 0x7386fCBae6Ad4CCE1499d9153D99bc950B589718
|
|
105
|
-
|
|
106
|
-
#### Mainnet
|
|
98
|
+
#### Mainnet (Default)
|
|
107
99
|
|
|
108
100
|
- **RPC:** https://optimism-rpc.publicnode.com
|
|
109
101
|
- **DID Contract:** 0x5DA4Fa8E567d86e52Ef8Da860de1be8f54cae97D
|
|
110
102
|
- **Root Resolver:** 0xE2EABA0979277A90511F8873ae1e8cA26B54E740
|
|
111
103
|
- **Root Resolver2:** 0x7e7961aB771cA942CE4DB6e79579e016a33Dc95B
|
|
112
104
|
- **ABI Type:** 0x9ae3F16bD99294Af1784beB1a0A5C84bf2636365
|
|
105
|
+
|
|
106
|
+
#### Sepolia Testnet
|
|
107
|
+
|
|
108
|
+
- **RPC:** https://sepolia.optimism.io
|
|
109
|
+
- **DID Contract:** 0xe2D7c3a9013960E04d4E9F5F9B63fff37eEd97A8
|
|
110
|
+
- **Root Resolver:** 0xeF727cb066Fee98F88Db84555830063b4A24ddfc
|
|
111
|
+
- **Root Resolver2:** 0xcbC02aa08c77a374eC0D5A0403E108b7573d96e8
|
|
112
|
+
- **ABI Type:** 0x7386fCBae6Ad4CCE1499d9153D99bc950B589718
|
package/dist/cli.js
CHANGED
|
@@ -64,7 +64,7 @@ const NETWORKS = {
|
|
|
64
64
|
function parseArgs() {
|
|
65
65
|
const args = process.argv.slice(2);
|
|
66
66
|
const options = {
|
|
67
|
-
network: '
|
|
67
|
+
network: 'mainnet',
|
|
68
68
|
json: false,
|
|
69
69
|
verbose: false,
|
|
70
70
|
debug: false,
|
|
@@ -94,7 +94,7 @@ function parseArgs() {
|
|
|
94
94
|
process.exit(0);
|
|
95
95
|
}
|
|
96
96
|
else if (arg === '--network' || arg === '-n') {
|
|
97
|
-
options.network = args[++i] || '
|
|
97
|
+
options.network = args[++i] || 'mainnet';
|
|
98
98
|
}
|
|
99
99
|
else if (arg === '--rpc') {
|
|
100
100
|
options.rpc = args[++i];
|
|
@@ -184,11 +184,11 @@ COMMANDS:
|
|
|
184
184
|
Subdomain Commands:
|
|
185
185
|
subdomain register <parent> <label>
|
|
186
186
|
Register a new subdomain (requires PRIVATE_KEY_OR_MNEMONIC)
|
|
187
|
-
Use
|
|
187
|
+
Use SUBDOMAIN_OWNER_MNEMONIC env var for subdomain owner or auto-generates one
|
|
188
188
|
|
|
189
189
|
Transfer Commands:
|
|
190
190
|
transfer <domain> Transfer domain ownership to a new owner (requires PRIVATE_KEY_OR_MNEMONIC)
|
|
191
|
-
Use
|
|
191
|
+
Use TO_MNEMONIC env var for new owner or auto-generates one
|
|
192
192
|
|
|
193
193
|
Wallet Management Commands:
|
|
194
194
|
wallet evm add <domain> Add EVM wallet to domain (requires PRIVATE_KEY_OR_MNEMONIC & EVM_PRIVATE_KEY)
|
|
@@ -219,9 +219,15 @@ COMMANDS:
|
|
|
219
219
|
tag get-tagger <domain> <tag-name>
|
|
220
220
|
Get tagger address for a tag (read-only)
|
|
221
221
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
Admin Commands:
|
|
223
|
+
admin get-owner Get contract owner address
|
|
224
|
+
admin get-totalsupply Get total number of registered domains
|
|
225
|
+
admin get-operator Get current operator address
|
|
226
|
+
admin set-operator <address>
|
|
227
|
+
Set operator address (requires PRIVATE_KEY_OR_MNEMONIC)
|
|
228
|
+
admin transfer-ownership <address>
|
|
229
|
+
Transfer contract ownership to new address (requires PRIVATE_KEY_OR_MNEMONIC)
|
|
230
|
+
admin accept-ownership Accept pending ownership transfer (requires PRIVATE_KEY_OR_MNEMONIC)
|
|
225
231
|
|
|
226
232
|
Crypto Utility Commands:
|
|
227
233
|
crypto generate Generate a new mnemonic phrase (--words option)
|
|
@@ -246,7 +252,7 @@ COMMANDS:
|
|
|
246
252
|
help Show this help message
|
|
247
253
|
|
|
248
254
|
OPTIONS:
|
|
249
|
-
-n, --network <network> Network to use (sepolia|mainnet) [default:
|
|
255
|
+
-n, --network <network> Network to use (sepolia|mainnet) [default: mainnet]
|
|
250
256
|
--rpc <url> Custom RPC endpoint URL
|
|
251
257
|
--contract-did <address> Custom DID contract address
|
|
252
258
|
--contract-resolver <address> Custom RootResolver contract address
|
|
@@ -265,8 +271,8 @@ OPTIONS:
|
|
|
265
271
|
|
|
266
272
|
EXAMPLES:
|
|
267
273
|
# Query domain info
|
|
268
|
-
did-cli info example.olares.com
|
|
269
|
-
did-cli owner example.olares.com
|
|
274
|
+
did-cli info example.olares.com
|
|
275
|
+
did-cli owner example.olares.com --network sepolia
|
|
270
276
|
export PRIVATE_KEY_OR_MNEMONIC=0xYOUR_PRIVATE_KEY
|
|
271
277
|
did-cli is-owner example.olares.com
|
|
272
278
|
|
|
@@ -295,7 +301,7 @@ EXAMPLES:
|
|
|
295
301
|
did-cli subdomain register parent.com child --words 24
|
|
296
302
|
|
|
297
303
|
# Subdomain management (use existing mnemonic for subdomain owner)
|
|
298
|
-
export
|
|
304
|
+
export SUBDOMAIN_OWNER_MNEMONIC="your twelve word mnemonic here"
|
|
299
305
|
did-cli subdomain register parent.com child
|
|
300
306
|
|
|
301
307
|
# Subdomain management (JSON output)
|
|
@@ -307,7 +313,7 @@ EXAMPLES:
|
|
|
307
313
|
did-cli transfer example.com --words 24
|
|
308
314
|
|
|
309
315
|
# Transfer domain ownership (use existing mnemonic for new owner)
|
|
310
|
-
export
|
|
316
|
+
export TO_MNEMONIC="your twelve word mnemonic here"
|
|
311
317
|
did-cli transfer example.com
|
|
312
318
|
|
|
313
319
|
# Crypto utilities
|
|
@@ -369,9 +375,13 @@ EXAMPLES:
|
|
|
369
375
|
# Remove tag
|
|
370
376
|
did-cli tag remove example.com email
|
|
371
377
|
|
|
372
|
-
#
|
|
373
|
-
did-cli
|
|
374
|
-
did-cli
|
|
378
|
+
# Admin management
|
|
379
|
+
did-cli admin get-owner
|
|
380
|
+
did-cli admin get-totalsupply
|
|
381
|
+
did-cli admin get-operator
|
|
382
|
+
did-cli admin set-operator 0x1234...
|
|
383
|
+
did-cli admin transfer-ownership 0x5678...
|
|
384
|
+
did-cli admin accept-ownership
|
|
375
385
|
|
|
376
386
|
# Utilities
|
|
377
387
|
did-cli convert pem-to-der ./public-key.pem
|
|
@@ -381,8 +391,12 @@ EXAMPLES:
|
|
|
381
391
|
ENVIRONMENT VARIABLES:
|
|
382
392
|
PRIVATE_KEY_OR_MNEMONIC Private key (0x...) or mnemonic phrase for signing transactions
|
|
383
393
|
(required for write operations)
|
|
384
|
-
|
|
385
|
-
(used in subdomain registration
|
|
394
|
+
SUBDOMAIN_OWNER_MNEMONIC Mnemonic phrase for generating subdomain owner identity
|
|
395
|
+
(used in subdomain registration)
|
|
396
|
+
TO_MNEMONIC Mnemonic phrase for generating new owner identity
|
|
397
|
+
(used in domain transfer)
|
|
398
|
+
MNEMONIC Mnemonic phrase for crypto utility commands
|
|
399
|
+
(used in crypto address, did, privatekey, derive)
|
|
386
400
|
EVM_PRIVATE_KEY EVM wallet private key for wallet management operations
|
|
387
401
|
(required for wallet evm add/remove commands)
|
|
388
402
|
SOLANA_PRIVATE_KEY Solana wallet private key for wallet management operations
|
|
@@ -738,8 +752,40 @@ async function removeIP(domain, options) {
|
|
|
738
752
|
}
|
|
739
753
|
}
|
|
740
754
|
// ============================================================================
|
|
741
|
-
//
|
|
755
|
+
// Admin Commands
|
|
742
756
|
// ============================================================================
|
|
757
|
+
async function getOwnerCli(options) {
|
|
758
|
+
try {
|
|
759
|
+
const didConsole = getConsole(options);
|
|
760
|
+
const owner = await didConsole.getOwner();
|
|
761
|
+
if (options.json) {
|
|
762
|
+
console.log(JSON.stringify({ owner }, null, 2));
|
|
763
|
+
}
|
|
764
|
+
else {
|
|
765
|
+
console.log(`š¤ Contract Owner: ${owner}`);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
catch (error) {
|
|
769
|
+
console.error('ā Error:', error instanceof Error ? error.message : String(error));
|
|
770
|
+
process.exit(1);
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
async function getTotalSupplyCli(options) {
|
|
774
|
+
try {
|
|
775
|
+
const didConsole = getConsole(options);
|
|
776
|
+
const totalSupply = await didConsole.getTotalSupply();
|
|
777
|
+
if (options.json) {
|
|
778
|
+
console.log(JSON.stringify({ totalSupply: totalSupply.toString() }, null, 2));
|
|
779
|
+
}
|
|
780
|
+
else {
|
|
781
|
+
console.log(`š Total Domains: ${totalSupply.toString()}`);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
catch (error) {
|
|
785
|
+
console.error('ā Error:', error instanceof Error ? error.message : String(error));
|
|
786
|
+
process.exit(1);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
743
789
|
async function getOperator(options) {
|
|
744
790
|
try {
|
|
745
791
|
const didConsole = getConsole(options);
|
|
@@ -779,6 +825,53 @@ async function setOperator(address, options) {
|
|
|
779
825
|
process.exit(1);
|
|
780
826
|
}
|
|
781
827
|
}
|
|
828
|
+
async function transferOwnershipCli(newOwner, options) {
|
|
829
|
+
try {
|
|
830
|
+
const privateKeyOrMnemonic = getPrivateKeyOrMnemonic();
|
|
831
|
+
const didConsole = getConsole(options);
|
|
832
|
+
await didConsole.setSigner(privateKeyOrMnemonic);
|
|
833
|
+
const result = await didConsole.transferOwnership(newOwner);
|
|
834
|
+
if (result.success) {
|
|
835
|
+
console.log(`ā
Ownership transfer initiated to ${newOwner}`);
|
|
836
|
+
console.log(`š Transaction: ${result.transactionHash}`);
|
|
837
|
+
if (result.gasUsed) {
|
|
838
|
+
console.log(`ā½ Gas used: ${result.gasUsed.toString()}`);
|
|
839
|
+
}
|
|
840
|
+
console.log('\nā ļø Note: The new owner must call "admin accept-ownership" to complete the transfer');
|
|
841
|
+
}
|
|
842
|
+
else {
|
|
843
|
+
console.error(`ā Failed: ${result.error}`);
|
|
844
|
+
process.exit(1);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
catch (error) {
|
|
848
|
+
console.error('ā Error:', error instanceof Error ? error.message : String(error));
|
|
849
|
+
process.exit(1);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
async function acceptOwnershipCli(options) {
|
|
853
|
+
try {
|
|
854
|
+
const privateKeyOrMnemonic = getPrivateKeyOrMnemonic();
|
|
855
|
+
const didConsole = getConsole(options);
|
|
856
|
+
await didConsole.setSigner(privateKeyOrMnemonic);
|
|
857
|
+
const result = await didConsole.acceptOwnership();
|
|
858
|
+
if (result.success) {
|
|
859
|
+
console.log('ā
Ownership transfer accepted successfully');
|
|
860
|
+
console.log(`š Transaction: ${result.transactionHash}`);
|
|
861
|
+
if (result.gasUsed) {
|
|
862
|
+
console.log(`ā½ Gas used: ${result.gasUsed.toString()}`);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
else {
|
|
866
|
+
console.error(`ā Failed: ${result.error}`);
|
|
867
|
+
process.exit(1);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
catch (error) {
|
|
871
|
+
console.error('ā Error:', error instanceof Error ? error.message : String(error));
|
|
872
|
+
process.exit(1);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
782
875
|
// ============================================================================
|
|
783
876
|
// Conversion Utilities
|
|
784
877
|
// ============================================================================
|
|
@@ -861,10 +954,10 @@ async function registerSubdomain(parentDomain, subdomain, options) {
|
|
|
861
954
|
const domain = didConsole.domain(parentDomain);
|
|
862
955
|
// Get or generate mnemonic for subdomain owner
|
|
863
956
|
let mnemonic;
|
|
864
|
-
const subdomainMnemonic = process.env.
|
|
957
|
+
const subdomainMnemonic = process.env.SUBDOMAIN_OWNER_MNEMONIC;
|
|
865
958
|
if (subdomainMnemonic) {
|
|
866
959
|
mnemonic = subdomainMnemonic;
|
|
867
|
-
console.log('š Using mnemonic from
|
|
960
|
+
console.log('š Using mnemonic from SUBDOMAIN_OWNER_MNEMONIC environment variable');
|
|
868
961
|
}
|
|
869
962
|
else {
|
|
870
963
|
const wordCount = options.words || 12;
|
|
@@ -884,7 +977,7 @@ async function registerSubdomain(parentDomain, subdomain, options) {
|
|
|
884
977
|
console.log(' ⢠Delete the file after copying to a secure location');
|
|
885
978
|
console.log(` ⢠Command: rm ${mnemonicFile}`);
|
|
886
979
|
console.log('\nš” To use this mnemonic for future operations:');
|
|
887
|
-
console.log(` export
|
|
980
|
+
console.log(` export SUBDOMAIN_OWNER_MNEMONIC="$(cat ${mnemonicFile})"\n`);
|
|
888
981
|
}
|
|
889
982
|
// Register subdomain
|
|
890
983
|
console.log(`š Registering subdomain: ${subdomain}.${parentDomain}`);
|
|
@@ -950,10 +1043,10 @@ async function transferDomain(domain, options) {
|
|
|
950
1043
|
const domainContext = didConsole.domain(domain);
|
|
951
1044
|
// Get or generate mnemonic for new owner
|
|
952
1045
|
let mnemonic;
|
|
953
|
-
const newOwnerMnemonic = process.env.
|
|
1046
|
+
const newOwnerMnemonic = process.env.TO_MNEMONIC;
|
|
954
1047
|
if (newOwnerMnemonic) {
|
|
955
1048
|
mnemonic = newOwnerMnemonic;
|
|
956
|
-
console.log('š Using mnemonic from
|
|
1049
|
+
console.log('š Using mnemonic from TO_MNEMONIC environment variable for new owner');
|
|
957
1050
|
}
|
|
958
1051
|
else {
|
|
959
1052
|
const wordCount = options.words || 12;
|
|
@@ -973,7 +1066,7 @@ async function transferDomain(domain, options) {
|
|
|
973
1066
|
console.log(' ⢠Delete the file after copying to a secure location');
|
|
974
1067
|
console.log(` ⢠Command: rm ${mnemonicFile}`);
|
|
975
1068
|
console.log('\nš” To use this mnemonic for future operations:');
|
|
976
|
-
console.log(` export
|
|
1069
|
+
console.log(` export TO_MNEMONIC="$(cat ${mnemonicFile})"\n`);
|
|
977
1070
|
}
|
|
978
1071
|
// Transfer domain
|
|
979
1072
|
console.log(`š Transferring domain: ${domain}`);
|
|
@@ -1831,7 +1924,7 @@ async function main() {
|
|
|
1831
1924
|
console.error('Usage: did-cli transfer <domain>');
|
|
1832
1925
|
console.error('Options: --words 12|24 (default: 12)');
|
|
1833
1926
|
console.error('Note: Set PRIVATE_KEY_OR_MNEMONIC environment variable first');
|
|
1834
|
-
console.error('Optional: Set
|
|
1927
|
+
console.error('Optional: Set TO_MNEMONIC environment variable for new owner (auto-generates if not set)');
|
|
1835
1928
|
process.exit(1);
|
|
1836
1929
|
}
|
|
1837
1930
|
await transferDomain(domain, options);
|
|
@@ -1925,7 +2018,7 @@ async function main() {
|
|
|
1925
2018
|
console.error('Usage: did-cli subdomain register <parent-domain> <subdomain-label>');
|
|
1926
2019
|
console.error('Options: --words 12|24 (default: 12)');
|
|
1927
2020
|
console.error('Note: Set PRIVATE_KEY_OR_MNEMONIC environment variable first');
|
|
1928
|
-
console.error('Optional: Set
|
|
2021
|
+
console.error('Optional: Set SUBDOMAIN_OWNER_MNEMONIC environment variable for subdomain owner (auto-generates if not set)');
|
|
1929
2022
|
process.exit(1);
|
|
1930
2023
|
}
|
|
1931
2024
|
await registerSubdomain(domain, value, options);
|
|
@@ -1935,28 +2028,46 @@ async function main() {
|
|
|
1935
2028
|
process.exit(1);
|
|
1936
2029
|
}
|
|
1937
2030
|
break;
|
|
1938
|
-
//
|
|
1939
|
-
case '
|
|
2031
|
+
// Admin commands
|
|
2032
|
+
case 'admin':
|
|
1940
2033
|
if (!subCommand) {
|
|
1941
|
-
console.error('ā Error:
|
|
1942
|
-
console.error('Usage: did-cli
|
|
2034
|
+
console.error('ā Error: Admin subcommand is required');
|
|
2035
|
+
console.error('Usage: did-cli admin <get-owner|get-totalsupply|get-operator|set-operator|transfer-ownership|accept-ownership> [args]');
|
|
1943
2036
|
process.exit(1);
|
|
1944
2037
|
}
|
|
1945
2038
|
switch (subCommand) {
|
|
1946
|
-
case 'get':
|
|
2039
|
+
case 'get-owner':
|
|
2040
|
+
await getOwnerCli(options);
|
|
2041
|
+
break;
|
|
2042
|
+
case 'get-totalsupply':
|
|
2043
|
+
await getTotalSupplyCli(options);
|
|
2044
|
+
break;
|
|
2045
|
+
case 'get-operator':
|
|
1947
2046
|
await getOperator(options);
|
|
1948
2047
|
break;
|
|
1949
|
-
case 'set':
|
|
2048
|
+
case 'set-operator':
|
|
1950
2049
|
if (!domain) {
|
|
1951
2050
|
console.error('ā Error: Operator address is required');
|
|
1952
|
-
console.error('Usage: did-cli
|
|
2051
|
+
console.error('Usage: did-cli admin set-operator <address>');
|
|
1953
2052
|
console.error('Note: Set PRIVATE_KEY_OR_MNEMONIC environment variable first');
|
|
1954
2053
|
process.exit(1);
|
|
1955
2054
|
}
|
|
1956
2055
|
await setOperator(domain, options);
|
|
1957
2056
|
break;
|
|
2057
|
+
case 'transfer-ownership':
|
|
2058
|
+
if (!domain) {
|
|
2059
|
+
console.error('ā Error: New owner address is required');
|
|
2060
|
+
console.error('Usage: did-cli admin transfer-ownership <address>');
|
|
2061
|
+
console.error('Note: Set PRIVATE_KEY_OR_MNEMONIC environment variable first');
|
|
2062
|
+
process.exit(1);
|
|
2063
|
+
}
|
|
2064
|
+
await transferOwnershipCli(domain, options);
|
|
2065
|
+
break;
|
|
2066
|
+
case 'accept-ownership':
|
|
2067
|
+
await acceptOwnershipCli(options);
|
|
2068
|
+
break;
|
|
1958
2069
|
default:
|
|
1959
|
-
console.error(`ā Unknown
|
|
2070
|
+
console.error(`ā Unknown admin subcommand: ${subCommand}`);
|
|
1960
2071
|
process.exit(1);
|
|
1961
2072
|
}
|
|
1962
2073
|
break;
|