@talismn/on-chain-id 0.0.0-pr1673-20241022081611 → 0.0.0-pr1674-20241023064453
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.
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var
|
6
|
-
var api = require('@polkadot/api');
|
7
|
-
var util = require('@talismn/util');
|
5
|
+
var util$1 = require('@talismn/util');
|
8
6
|
var anylogger = require('anylogger');
|
7
|
+
var apiContract = require('@polkadot/api-contract');
|
8
|
+
var util = require('@polkadot/util');
|
9
9
|
|
10
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
11
11
|
|
@@ -13,7 +13,7 @@ var anylogger__default = /*#__PURE__*/_interopDefault(anylogger);
|
|
13
13
|
|
14
14
|
var packageJson = {
|
15
15
|
name: "@talismn/on-chain-id",
|
16
|
-
version: "0.0.0-
|
16
|
+
version: "0.0.0-pr1674-20241023064453",
|
17
17
|
author: "Talisman",
|
18
18
|
homepage: "https://talisman.xyz",
|
19
19
|
license: "GPL-3.0-or-later",
|
@@ -39,15 +39,16 @@ var packageJson = {
|
|
39
39
|
clean: "rm -rf dist .turbo node_modules"
|
40
40
|
},
|
41
41
|
dependencies: {
|
42
|
-
"@azns/resolver-core": "https://gitpkg.vercel.app/api/pkg.tgz?url=TalismanSociety%2Fazero-id-resolver%2Fpackages%2Fresolver-core&commit=1b1857e5f1385c9f40a5d99771445e2a7cd654b2",
|
43
42
|
"@talismn/balances": "workspace:*",
|
44
43
|
"@talismn/util": "workspace:*",
|
45
44
|
anylogger: "^1.0.11"
|
46
45
|
},
|
47
46
|
devDependencies: {
|
48
|
-
"@polkadot/api": "
|
49
|
-
"@polkadot/api-contract": "
|
50
|
-
"@polkadot/types": "
|
47
|
+
"@polkadot/api": "12.0.2",
|
48
|
+
"@polkadot/api-contract": "12.0.2",
|
49
|
+
"@polkadot/types": "12.0.2",
|
50
|
+
"@polkadot/rpc-provider": "12.0.2",
|
51
|
+
"@polkadot/util": "12.3.2",
|
51
52
|
"@talismn/eslint-config": "workspace:*",
|
52
53
|
"@talismn/tsconfig": "workspace:*",
|
53
54
|
"@types/jest": "^27.5.1",
|
@@ -59,7 +60,9 @@ var packageJson = {
|
|
59
60
|
peerDependencies: {
|
60
61
|
"@polkadot/api": "10.x",
|
61
62
|
"@polkadot/api-contract": "10.x",
|
62
|
-
"@polkadot/types": "10.x"
|
63
|
+
"@polkadot/types": "10.x",
|
64
|
+
"@polkadot/rpc-provider": "10.x",
|
65
|
+
"@polkadot/util": "10.x"
|
63
66
|
},
|
64
67
|
eslintConfig: {
|
65
68
|
root: true,
|
@@ -71,6 +74,1375 @@ var packageJson = {
|
|
71
74
|
|
72
75
|
var log = anylogger__default["default"](packageJson.name);
|
73
76
|
|
77
|
+
var aznsRouterAbiJson = {
|
78
|
+
source: {
|
79
|
+
hash: "0x63308c1311af44bb47082327c301fce559ca28f6bb010a61b9884d9246746abf",
|
80
|
+
language: "ink! 4.2.1",
|
81
|
+
compiler: "rustc 1.68.0-nightly",
|
82
|
+
build_info: {
|
83
|
+
build_mode: "Release",
|
84
|
+
cargo_contract_version: "3.0.1",
|
85
|
+
rust_toolchain: "nightly-aarch64-apple-darwin",
|
86
|
+
wasm_opt_settings: {
|
87
|
+
keep_debug_symbols: false,
|
88
|
+
optimization_passes: "Z"
|
89
|
+
}
|
90
|
+
}
|
91
|
+
},
|
92
|
+
contract: {
|
93
|
+
name: "azns_router",
|
94
|
+
version: "1.0.0",
|
95
|
+
authors: [
|
96
|
+
"AZERO.ID <hello@azero.id>"
|
97
|
+
]
|
98
|
+
},
|
99
|
+
spec: {
|
100
|
+
constructors: [
|
101
|
+
{
|
102
|
+
args: [
|
103
|
+
{
|
104
|
+
label: "admin",
|
105
|
+
type: {
|
106
|
+
displayName: [
|
107
|
+
"AccountId"
|
108
|
+
],
|
109
|
+
type: 0
|
110
|
+
}
|
111
|
+
}
|
112
|
+
],
|
113
|
+
"default": false,
|
114
|
+
docs: [
|
115
|
+
],
|
116
|
+
label: "new",
|
117
|
+
payable: false,
|
118
|
+
returnType: {
|
119
|
+
displayName: [
|
120
|
+
"ink_primitives",
|
121
|
+
"ConstructorResult"
|
122
|
+
],
|
123
|
+
type: 6
|
124
|
+
},
|
125
|
+
selector: "0x9bae9d5e"
|
126
|
+
}
|
127
|
+
],
|
128
|
+
docs: [
|
129
|
+
],
|
130
|
+
environment: {
|
131
|
+
accountId: {
|
132
|
+
displayName: [
|
133
|
+
"AccountId"
|
134
|
+
],
|
135
|
+
type: 0
|
136
|
+
},
|
137
|
+
balance: {
|
138
|
+
displayName: [
|
139
|
+
"Balance"
|
140
|
+
],
|
141
|
+
type: 25
|
142
|
+
},
|
143
|
+
blockNumber: {
|
144
|
+
displayName: [
|
145
|
+
"BlockNumber"
|
146
|
+
],
|
147
|
+
type: 28
|
148
|
+
},
|
149
|
+
chainExtension: {
|
150
|
+
displayName: [
|
151
|
+
"ChainExtension"
|
152
|
+
],
|
153
|
+
type: 29
|
154
|
+
},
|
155
|
+
hash: {
|
156
|
+
displayName: [
|
157
|
+
"Hash"
|
158
|
+
],
|
159
|
+
type: 26
|
160
|
+
},
|
161
|
+
maxEventTopics: 4,
|
162
|
+
timestamp: {
|
163
|
+
displayName: [
|
164
|
+
"Timestamp"
|
165
|
+
],
|
166
|
+
type: 27
|
167
|
+
}
|
168
|
+
},
|
169
|
+
events: [
|
170
|
+
],
|
171
|
+
lang_error: {
|
172
|
+
displayName: [
|
173
|
+
"ink",
|
174
|
+
"LangError"
|
175
|
+
],
|
176
|
+
type: 8
|
177
|
+
},
|
178
|
+
messages: [
|
179
|
+
{
|
180
|
+
args: [
|
181
|
+
{
|
182
|
+
label: "tld",
|
183
|
+
type: {
|
184
|
+
displayName: [
|
185
|
+
"Vec"
|
186
|
+
],
|
187
|
+
type: 4
|
188
|
+
}
|
189
|
+
},
|
190
|
+
{
|
191
|
+
label: "registry_addr",
|
192
|
+
type: {
|
193
|
+
displayName: [
|
194
|
+
"AccountId"
|
195
|
+
],
|
196
|
+
type: 0
|
197
|
+
}
|
198
|
+
}
|
199
|
+
],
|
200
|
+
"default": false,
|
201
|
+
docs: [
|
202
|
+
],
|
203
|
+
label: "add_registry",
|
204
|
+
mutates: true,
|
205
|
+
payable: false,
|
206
|
+
returnType: {
|
207
|
+
displayName: [
|
208
|
+
"ink",
|
209
|
+
"MessageResult"
|
210
|
+
],
|
211
|
+
type: 9
|
212
|
+
},
|
213
|
+
selector: "0xc997efe3"
|
214
|
+
},
|
215
|
+
{
|
216
|
+
args: [
|
217
|
+
{
|
218
|
+
label: "tld",
|
219
|
+
type: {
|
220
|
+
displayName: [
|
221
|
+
"Vec"
|
222
|
+
],
|
223
|
+
type: 4
|
224
|
+
}
|
225
|
+
},
|
226
|
+
{
|
227
|
+
label: "registry_addr",
|
228
|
+
type: {
|
229
|
+
displayName: [
|
230
|
+
"AccountId"
|
231
|
+
],
|
232
|
+
type: 0
|
233
|
+
}
|
234
|
+
}
|
235
|
+
],
|
236
|
+
"default": false,
|
237
|
+
docs: [
|
238
|
+
],
|
239
|
+
label: "update_registry",
|
240
|
+
mutates: true,
|
241
|
+
payable: false,
|
242
|
+
returnType: {
|
243
|
+
displayName: [
|
244
|
+
"ink",
|
245
|
+
"MessageResult"
|
246
|
+
],
|
247
|
+
type: 9
|
248
|
+
},
|
249
|
+
selector: "0x562de86b"
|
250
|
+
},
|
251
|
+
{
|
252
|
+
args: [
|
253
|
+
{
|
254
|
+
label: "registry_addr",
|
255
|
+
type: {
|
256
|
+
displayName: [
|
257
|
+
"AccountId"
|
258
|
+
],
|
259
|
+
type: 0
|
260
|
+
}
|
261
|
+
}
|
262
|
+
],
|
263
|
+
"default": false,
|
264
|
+
docs: [
|
265
|
+
],
|
266
|
+
label: "remove_registry_address",
|
267
|
+
mutates: true,
|
268
|
+
payable: false,
|
269
|
+
returnType: {
|
270
|
+
displayName: [
|
271
|
+
"ink",
|
272
|
+
"MessageResult"
|
273
|
+
],
|
274
|
+
type: 9
|
275
|
+
},
|
276
|
+
selector: "0xcc78aead"
|
277
|
+
},
|
278
|
+
{
|
279
|
+
args: [
|
280
|
+
],
|
281
|
+
"default": false,
|
282
|
+
docs: [
|
283
|
+
],
|
284
|
+
label: "get_all_registries",
|
285
|
+
mutates: false,
|
286
|
+
payable: false,
|
287
|
+
returnType: {
|
288
|
+
displayName: [
|
289
|
+
"ink",
|
290
|
+
"MessageResult"
|
291
|
+
],
|
292
|
+
type: 12
|
293
|
+
},
|
294
|
+
selector: "0xe6da7bf0"
|
295
|
+
},
|
296
|
+
{
|
297
|
+
args: [
|
298
|
+
],
|
299
|
+
"default": false,
|
300
|
+
docs: [
|
301
|
+
],
|
302
|
+
label: "get_all_tlds",
|
303
|
+
mutates: false,
|
304
|
+
payable: false,
|
305
|
+
returnType: {
|
306
|
+
displayName: [
|
307
|
+
"ink",
|
308
|
+
"MessageResult"
|
309
|
+
],
|
310
|
+
type: 15
|
311
|
+
},
|
312
|
+
selector: "0xf1a7af41"
|
313
|
+
},
|
314
|
+
{
|
315
|
+
args: [
|
316
|
+
{
|
317
|
+
label: "registry_addr",
|
318
|
+
type: {
|
319
|
+
displayName: [
|
320
|
+
"AccountId"
|
321
|
+
],
|
322
|
+
type: 0
|
323
|
+
}
|
324
|
+
}
|
325
|
+
],
|
326
|
+
"default": false,
|
327
|
+
docs: [
|
328
|
+
],
|
329
|
+
label: "get_associated_tlds",
|
330
|
+
mutates: false,
|
331
|
+
payable: false,
|
332
|
+
returnType: {
|
333
|
+
displayName: [
|
334
|
+
"ink",
|
335
|
+
"MessageResult"
|
336
|
+
],
|
337
|
+
type: 15
|
338
|
+
},
|
339
|
+
selector: "0xcb18f821"
|
340
|
+
},
|
341
|
+
{
|
342
|
+
args: [
|
343
|
+
{
|
344
|
+
label: "tld",
|
345
|
+
type: {
|
346
|
+
displayName: [
|
347
|
+
"String"
|
348
|
+
],
|
349
|
+
type: 5
|
350
|
+
}
|
351
|
+
}
|
352
|
+
],
|
353
|
+
"default": false,
|
354
|
+
docs: [
|
355
|
+
],
|
356
|
+
label: "get_registry",
|
357
|
+
mutates: false,
|
358
|
+
payable: false,
|
359
|
+
returnType: {
|
360
|
+
displayName: [
|
361
|
+
"ink",
|
362
|
+
"MessageResult"
|
363
|
+
],
|
364
|
+
type: 16
|
365
|
+
},
|
366
|
+
selector: "0x15a5d20a"
|
367
|
+
},
|
368
|
+
{
|
369
|
+
args: [
|
370
|
+
{
|
371
|
+
label: "domain",
|
372
|
+
type: {
|
373
|
+
displayName: [
|
374
|
+
"String"
|
375
|
+
],
|
376
|
+
type: 5
|
377
|
+
}
|
378
|
+
}
|
379
|
+
],
|
380
|
+
"default": false,
|
381
|
+
docs: [
|
382
|
+
],
|
383
|
+
label: "get_address",
|
384
|
+
mutates: false,
|
385
|
+
payable: false,
|
386
|
+
returnType: {
|
387
|
+
displayName: [
|
388
|
+
"ink",
|
389
|
+
"MessageResult"
|
390
|
+
],
|
391
|
+
type: 18
|
392
|
+
},
|
393
|
+
selector: "0xd259f7ba"
|
394
|
+
},
|
395
|
+
{
|
396
|
+
args: [
|
397
|
+
{
|
398
|
+
label: "account",
|
399
|
+
type: {
|
400
|
+
displayName: [
|
401
|
+
"AccountId"
|
402
|
+
],
|
403
|
+
type: 0
|
404
|
+
}
|
405
|
+
},
|
406
|
+
{
|
407
|
+
label: "tld",
|
408
|
+
type: {
|
409
|
+
displayName: [
|
410
|
+
"Option"
|
411
|
+
],
|
412
|
+
type: 20
|
413
|
+
}
|
414
|
+
}
|
415
|
+
],
|
416
|
+
"default": false,
|
417
|
+
docs: [
|
418
|
+
" @returns list of (registry-address, primary-domain) for given account"
|
419
|
+
],
|
420
|
+
label: "get_primary_domains",
|
421
|
+
mutates: false,
|
422
|
+
payable: false,
|
423
|
+
returnType: {
|
424
|
+
displayName: [
|
425
|
+
"ink",
|
426
|
+
"MessageResult"
|
427
|
+
],
|
428
|
+
type: 21
|
429
|
+
},
|
430
|
+
selector: "0xdf3a358e"
|
431
|
+
},
|
432
|
+
{
|
433
|
+
args: [
|
434
|
+
],
|
435
|
+
"default": false,
|
436
|
+
docs: [
|
437
|
+
],
|
438
|
+
label: "get_admin",
|
439
|
+
mutates: false,
|
440
|
+
payable: false,
|
441
|
+
returnType: {
|
442
|
+
displayName: [
|
443
|
+
"ink",
|
444
|
+
"MessageResult"
|
445
|
+
],
|
446
|
+
type: 24
|
447
|
+
},
|
448
|
+
selector: "0x57b8a8a7"
|
449
|
+
},
|
450
|
+
{
|
451
|
+
args: [
|
452
|
+
],
|
453
|
+
"default": false,
|
454
|
+
docs: [
|
455
|
+
],
|
456
|
+
label: "get_pending_admin",
|
457
|
+
mutates: false,
|
458
|
+
payable: false,
|
459
|
+
returnType: {
|
460
|
+
displayName: [
|
461
|
+
"ink",
|
462
|
+
"MessageResult"
|
463
|
+
],
|
464
|
+
type: 16
|
465
|
+
},
|
466
|
+
selector: "0xbcd31d76"
|
467
|
+
},
|
468
|
+
{
|
469
|
+
args: [
|
470
|
+
{
|
471
|
+
label: "account",
|
472
|
+
type: {
|
473
|
+
displayName: [
|
474
|
+
"Option"
|
475
|
+
],
|
476
|
+
type: 17
|
477
|
+
}
|
478
|
+
}
|
479
|
+
],
|
480
|
+
"default": false,
|
481
|
+
docs: [
|
482
|
+
],
|
483
|
+
label: "transfer_ownership",
|
484
|
+
mutates: true,
|
485
|
+
payable: false,
|
486
|
+
returnType: {
|
487
|
+
displayName: [
|
488
|
+
"ink",
|
489
|
+
"MessageResult"
|
490
|
+
],
|
491
|
+
type: 9
|
492
|
+
},
|
493
|
+
selector: "0x107e33ea"
|
494
|
+
},
|
495
|
+
{
|
496
|
+
args: [
|
497
|
+
],
|
498
|
+
"default": false,
|
499
|
+
docs: [
|
500
|
+
],
|
501
|
+
label: "accept_ownership",
|
502
|
+
mutates: true,
|
503
|
+
payable: false,
|
504
|
+
returnType: {
|
505
|
+
displayName: [
|
506
|
+
"ink",
|
507
|
+
"MessageResult"
|
508
|
+
],
|
509
|
+
type: 9
|
510
|
+
},
|
511
|
+
selector: "0xb55be9f0"
|
512
|
+
},
|
513
|
+
{
|
514
|
+
args: [
|
515
|
+
{
|
516
|
+
label: "code_hash",
|
517
|
+
type: {
|
518
|
+
displayName: [
|
519
|
+
],
|
520
|
+
type: 1
|
521
|
+
}
|
522
|
+
}
|
523
|
+
],
|
524
|
+
"default": false,
|
525
|
+
docs: [
|
526
|
+
],
|
527
|
+
label: "upgrade_contract",
|
528
|
+
mutates: true,
|
529
|
+
payable: false,
|
530
|
+
returnType: {
|
531
|
+
displayName: [
|
532
|
+
"ink",
|
533
|
+
"MessageResult"
|
534
|
+
],
|
535
|
+
type: 6
|
536
|
+
},
|
537
|
+
selector: "0x1345543d"
|
538
|
+
}
|
539
|
+
]
|
540
|
+
},
|
541
|
+
storage: {
|
542
|
+
root: {
|
543
|
+
layout: {
|
544
|
+
struct: {
|
545
|
+
fields: [
|
546
|
+
{
|
547
|
+
layout: {
|
548
|
+
leaf: {
|
549
|
+
key: "0x00000000",
|
550
|
+
ty: 0
|
551
|
+
}
|
552
|
+
},
|
553
|
+
name: "admin"
|
554
|
+
},
|
555
|
+
{
|
556
|
+
layout: {
|
557
|
+
"enum": {
|
558
|
+
dispatchKey: "0x00000000",
|
559
|
+
name: "Option",
|
560
|
+
variants: {
|
561
|
+
"0": {
|
562
|
+
fields: [
|
563
|
+
],
|
564
|
+
name: "None"
|
565
|
+
},
|
566
|
+
"1": {
|
567
|
+
fields: [
|
568
|
+
{
|
569
|
+
layout: {
|
570
|
+
leaf: {
|
571
|
+
key: "0x00000000",
|
572
|
+
ty: 0
|
573
|
+
}
|
574
|
+
},
|
575
|
+
name: "0"
|
576
|
+
}
|
577
|
+
],
|
578
|
+
name: "Some"
|
579
|
+
}
|
580
|
+
}
|
581
|
+
}
|
582
|
+
},
|
583
|
+
name: "pending_admin"
|
584
|
+
},
|
585
|
+
{
|
586
|
+
layout: {
|
587
|
+
leaf: {
|
588
|
+
key: "0x00000000",
|
589
|
+
ty: 3
|
590
|
+
}
|
591
|
+
},
|
592
|
+
name: "registry"
|
593
|
+
},
|
594
|
+
{
|
595
|
+
layout: {
|
596
|
+
root: {
|
597
|
+
layout: {
|
598
|
+
leaf: {
|
599
|
+
key: "0x00000064",
|
600
|
+
ty: 0
|
601
|
+
}
|
602
|
+
},
|
603
|
+
root_key: "0x00000064"
|
604
|
+
}
|
605
|
+
},
|
606
|
+
name: "routes"
|
607
|
+
},
|
608
|
+
{
|
609
|
+
layout: {
|
610
|
+
root: {
|
611
|
+
layout: {
|
612
|
+
leaf: {
|
613
|
+
key: "0x00000065",
|
614
|
+
ty: 4
|
615
|
+
}
|
616
|
+
},
|
617
|
+
root_key: "0x00000065"
|
618
|
+
}
|
619
|
+
},
|
620
|
+
name: "associated_tlds"
|
621
|
+
}
|
622
|
+
],
|
623
|
+
name: "Router"
|
624
|
+
}
|
625
|
+
},
|
626
|
+
root_key: "0x00000000"
|
627
|
+
}
|
628
|
+
},
|
629
|
+
types: [
|
630
|
+
{
|
631
|
+
id: 0,
|
632
|
+
type: {
|
633
|
+
def: {
|
634
|
+
composite: {
|
635
|
+
fields: [
|
636
|
+
{
|
637
|
+
type: 1,
|
638
|
+
typeName: "[u8; 32]"
|
639
|
+
}
|
640
|
+
]
|
641
|
+
}
|
642
|
+
},
|
643
|
+
path: [
|
644
|
+
"ink_primitives",
|
645
|
+
"types",
|
646
|
+
"AccountId"
|
647
|
+
]
|
648
|
+
}
|
649
|
+
},
|
650
|
+
{
|
651
|
+
id: 1,
|
652
|
+
type: {
|
653
|
+
def: {
|
654
|
+
array: {
|
655
|
+
len: 32,
|
656
|
+
type: 2
|
657
|
+
}
|
658
|
+
}
|
659
|
+
}
|
660
|
+
},
|
661
|
+
{
|
662
|
+
id: 2,
|
663
|
+
type: {
|
664
|
+
def: {
|
665
|
+
primitive: "u8"
|
666
|
+
}
|
667
|
+
}
|
668
|
+
},
|
669
|
+
{
|
670
|
+
id: 3,
|
671
|
+
type: {
|
672
|
+
def: {
|
673
|
+
sequence: {
|
674
|
+
type: 0
|
675
|
+
}
|
676
|
+
}
|
677
|
+
}
|
678
|
+
},
|
679
|
+
{
|
680
|
+
id: 4,
|
681
|
+
type: {
|
682
|
+
def: {
|
683
|
+
sequence: {
|
684
|
+
type: 5
|
685
|
+
}
|
686
|
+
}
|
687
|
+
}
|
688
|
+
},
|
689
|
+
{
|
690
|
+
id: 5,
|
691
|
+
type: {
|
692
|
+
def: {
|
693
|
+
primitive: "str"
|
694
|
+
}
|
695
|
+
}
|
696
|
+
},
|
697
|
+
{
|
698
|
+
id: 6,
|
699
|
+
type: {
|
700
|
+
def: {
|
701
|
+
variant: {
|
702
|
+
variants: [
|
703
|
+
{
|
704
|
+
fields: [
|
705
|
+
{
|
706
|
+
type: 7
|
707
|
+
}
|
708
|
+
],
|
709
|
+
index: 0,
|
710
|
+
name: "Ok"
|
711
|
+
},
|
712
|
+
{
|
713
|
+
fields: [
|
714
|
+
{
|
715
|
+
type: 8
|
716
|
+
}
|
717
|
+
],
|
718
|
+
index: 1,
|
719
|
+
name: "Err"
|
720
|
+
}
|
721
|
+
]
|
722
|
+
}
|
723
|
+
},
|
724
|
+
params: [
|
725
|
+
{
|
726
|
+
name: "T",
|
727
|
+
type: 7
|
728
|
+
},
|
729
|
+
{
|
730
|
+
name: "E",
|
731
|
+
type: 8
|
732
|
+
}
|
733
|
+
],
|
734
|
+
path: [
|
735
|
+
"Result"
|
736
|
+
]
|
737
|
+
}
|
738
|
+
},
|
739
|
+
{
|
740
|
+
id: 7,
|
741
|
+
type: {
|
742
|
+
def: {
|
743
|
+
tuple: [
|
744
|
+
]
|
745
|
+
}
|
746
|
+
}
|
747
|
+
},
|
748
|
+
{
|
749
|
+
id: 8,
|
750
|
+
type: {
|
751
|
+
def: {
|
752
|
+
variant: {
|
753
|
+
variants: [
|
754
|
+
{
|
755
|
+
index: 1,
|
756
|
+
name: "CouldNotReadInput"
|
757
|
+
}
|
758
|
+
]
|
759
|
+
}
|
760
|
+
},
|
761
|
+
path: [
|
762
|
+
"ink_primitives",
|
763
|
+
"LangError"
|
764
|
+
]
|
765
|
+
}
|
766
|
+
},
|
767
|
+
{
|
768
|
+
id: 9,
|
769
|
+
type: {
|
770
|
+
def: {
|
771
|
+
variant: {
|
772
|
+
variants: [
|
773
|
+
{
|
774
|
+
fields: [
|
775
|
+
{
|
776
|
+
type: 10
|
777
|
+
}
|
778
|
+
],
|
779
|
+
index: 0,
|
780
|
+
name: "Ok"
|
781
|
+
},
|
782
|
+
{
|
783
|
+
fields: [
|
784
|
+
{
|
785
|
+
type: 8
|
786
|
+
}
|
787
|
+
],
|
788
|
+
index: 1,
|
789
|
+
name: "Err"
|
790
|
+
}
|
791
|
+
]
|
792
|
+
}
|
793
|
+
},
|
794
|
+
params: [
|
795
|
+
{
|
796
|
+
name: "T",
|
797
|
+
type: 10
|
798
|
+
},
|
799
|
+
{
|
800
|
+
name: "E",
|
801
|
+
type: 8
|
802
|
+
}
|
803
|
+
],
|
804
|
+
path: [
|
805
|
+
"Result"
|
806
|
+
]
|
807
|
+
}
|
808
|
+
},
|
809
|
+
{
|
810
|
+
id: 10,
|
811
|
+
type: {
|
812
|
+
def: {
|
813
|
+
variant: {
|
814
|
+
variants: [
|
815
|
+
{
|
816
|
+
fields: [
|
817
|
+
{
|
818
|
+
type: 7
|
819
|
+
}
|
820
|
+
],
|
821
|
+
index: 0,
|
822
|
+
name: "Ok"
|
823
|
+
},
|
824
|
+
{
|
825
|
+
fields: [
|
826
|
+
{
|
827
|
+
type: 11
|
828
|
+
}
|
829
|
+
],
|
830
|
+
index: 1,
|
831
|
+
name: "Err"
|
832
|
+
}
|
833
|
+
]
|
834
|
+
}
|
835
|
+
},
|
836
|
+
params: [
|
837
|
+
{
|
838
|
+
name: "T",
|
839
|
+
type: 7
|
840
|
+
},
|
841
|
+
{
|
842
|
+
name: "E",
|
843
|
+
type: 11
|
844
|
+
}
|
845
|
+
],
|
846
|
+
path: [
|
847
|
+
"Result"
|
848
|
+
]
|
849
|
+
}
|
850
|
+
},
|
851
|
+
{
|
852
|
+
id: 11,
|
853
|
+
type: {
|
854
|
+
def: {
|
855
|
+
variant: {
|
856
|
+
variants: [
|
857
|
+
{
|
858
|
+
index: 0,
|
859
|
+
name: "NotAdmin"
|
860
|
+
},
|
861
|
+
{
|
862
|
+
index: 1,
|
863
|
+
name: "InvalidRegistryAddress"
|
864
|
+
},
|
865
|
+
{
|
866
|
+
fields: [
|
867
|
+
{
|
868
|
+
type: 5,
|
869
|
+
typeName: "String"
|
870
|
+
}
|
871
|
+
],
|
872
|
+
index: 2,
|
873
|
+
name: "TldAlreadyInUse"
|
874
|
+
},
|
875
|
+
{
|
876
|
+
fields: [
|
877
|
+
{
|
878
|
+
type: 5,
|
879
|
+
typeName: "String"
|
880
|
+
}
|
881
|
+
],
|
882
|
+
index: 3,
|
883
|
+
name: "TldNotFound"
|
884
|
+
},
|
885
|
+
{
|
886
|
+
index: 4,
|
887
|
+
name: "CouldNotResolveDomain"
|
888
|
+
},
|
889
|
+
{
|
890
|
+
index: 5,
|
891
|
+
name: "InvalidDomainName"
|
892
|
+
},
|
893
|
+
{
|
894
|
+
index: 6,
|
895
|
+
name: "EmptyList"
|
896
|
+
}
|
897
|
+
]
|
898
|
+
}
|
899
|
+
},
|
900
|
+
path: [
|
901
|
+
"azns_router",
|
902
|
+
"azns_router",
|
903
|
+
"Error"
|
904
|
+
]
|
905
|
+
}
|
906
|
+
},
|
907
|
+
{
|
908
|
+
id: 12,
|
909
|
+
type: {
|
910
|
+
def: {
|
911
|
+
variant: {
|
912
|
+
variants: [
|
913
|
+
{
|
914
|
+
fields: [
|
915
|
+
{
|
916
|
+
type: 13
|
917
|
+
}
|
918
|
+
],
|
919
|
+
index: 0,
|
920
|
+
name: "Ok"
|
921
|
+
},
|
922
|
+
{
|
923
|
+
fields: [
|
924
|
+
{
|
925
|
+
type: 8
|
926
|
+
}
|
927
|
+
],
|
928
|
+
index: 1,
|
929
|
+
name: "Err"
|
930
|
+
}
|
931
|
+
]
|
932
|
+
}
|
933
|
+
},
|
934
|
+
params: [
|
935
|
+
{
|
936
|
+
name: "T",
|
937
|
+
type: 13
|
938
|
+
},
|
939
|
+
{
|
940
|
+
name: "E",
|
941
|
+
type: 8
|
942
|
+
}
|
943
|
+
],
|
944
|
+
path: [
|
945
|
+
"Result"
|
946
|
+
]
|
947
|
+
}
|
948
|
+
},
|
949
|
+
{
|
950
|
+
id: 13,
|
951
|
+
type: {
|
952
|
+
def: {
|
953
|
+
sequence: {
|
954
|
+
type: 14
|
955
|
+
}
|
956
|
+
}
|
957
|
+
}
|
958
|
+
},
|
959
|
+
{
|
960
|
+
id: 14,
|
961
|
+
type: {
|
962
|
+
def: {
|
963
|
+
tuple: [
|
964
|
+
0,
|
965
|
+
4
|
966
|
+
]
|
967
|
+
}
|
968
|
+
}
|
969
|
+
},
|
970
|
+
{
|
971
|
+
id: 15,
|
972
|
+
type: {
|
973
|
+
def: {
|
974
|
+
variant: {
|
975
|
+
variants: [
|
976
|
+
{
|
977
|
+
fields: [
|
978
|
+
{
|
979
|
+
type: 4
|
980
|
+
}
|
981
|
+
],
|
982
|
+
index: 0,
|
983
|
+
name: "Ok"
|
984
|
+
},
|
985
|
+
{
|
986
|
+
fields: [
|
987
|
+
{
|
988
|
+
type: 8
|
989
|
+
}
|
990
|
+
],
|
991
|
+
index: 1,
|
992
|
+
name: "Err"
|
993
|
+
}
|
994
|
+
]
|
995
|
+
}
|
996
|
+
},
|
997
|
+
params: [
|
998
|
+
{
|
999
|
+
name: "T",
|
1000
|
+
type: 4
|
1001
|
+
},
|
1002
|
+
{
|
1003
|
+
name: "E",
|
1004
|
+
type: 8
|
1005
|
+
}
|
1006
|
+
],
|
1007
|
+
path: [
|
1008
|
+
"Result"
|
1009
|
+
]
|
1010
|
+
}
|
1011
|
+
},
|
1012
|
+
{
|
1013
|
+
id: 16,
|
1014
|
+
type: {
|
1015
|
+
def: {
|
1016
|
+
variant: {
|
1017
|
+
variants: [
|
1018
|
+
{
|
1019
|
+
fields: [
|
1020
|
+
{
|
1021
|
+
type: 17
|
1022
|
+
}
|
1023
|
+
],
|
1024
|
+
index: 0,
|
1025
|
+
name: "Ok"
|
1026
|
+
},
|
1027
|
+
{
|
1028
|
+
fields: [
|
1029
|
+
{
|
1030
|
+
type: 8
|
1031
|
+
}
|
1032
|
+
],
|
1033
|
+
index: 1,
|
1034
|
+
name: "Err"
|
1035
|
+
}
|
1036
|
+
]
|
1037
|
+
}
|
1038
|
+
},
|
1039
|
+
params: [
|
1040
|
+
{
|
1041
|
+
name: "T",
|
1042
|
+
type: 17
|
1043
|
+
},
|
1044
|
+
{
|
1045
|
+
name: "E",
|
1046
|
+
type: 8
|
1047
|
+
}
|
1048
|
+
],
|
1049
|
+
path: [
|
1050
|
+
"Result"
|
1051
|
+
]
|
1052
|
+
}
|
1053
|
+
},
|
1054
|
+
{
|
1055
|
+
id: 17,
|
1056
|
+
type: {
|
1057
|
+
def: {
|
1058
|
+
variant: {
|
1059
|
+
variants: [
|
1060
|
+
{
|
1061
|
+
index: 0,
|
1062
|
+
name: "None"
|
1063
|
+
},
|
1064
|
+
{
|
1065
|
+
fields: [
|
1066
|
+
{
|
1067
|
+
type: 0
|
1068
|
+
}
|
1069
|
+
],
|
1070
|
+
index: 1,
|
1071
|
+
name: "Some"
|
1072
|
+
}
|
1073
|
+
]
|
1074
|
+
}
|
1075
|
+
},
|
1076
|
+
params: [
|
1077
|
+
{
|
1078
|
+
name: "T",
|
1079
|
+
type: 0
|
1080
|
+
}
|
1081
|
+
],
|
1082
|
+
path: [
|
1083
|
+
"Option"
|
1084
|
+
]
|
1085
|
+
}
|
1086
|
+
},
|
1087
|
+
{
|
1088
|
+
id: 18,
|
1089
|
+
type: {
|
1090
|
+
def: {
|
1091
|
+
variant: {
|
1092
|
+
variants: [
|
1093
|
+
{
|
1094
|
+
fields: [
|
1095
|
+
{
|
1096
|
+
type: 19
|
1097
|
+
}
|
1098
|
+
],
|
1099
|
+
index: 0,
|
1100
|
+
name: "Ok"
|
1101
|
+
},
|
1102
|
+
{
|
1103
|
+
fields: [
|
1104
|
+
{
|
1105
|
+
type: 8
|
1106
|
+
}
|
1107
|
+
],
|
1108
|
+
index: 1,
|
1109
|
+
name: "Err"
|
1110
|
+
}
|
1111
|
+
]
|
1112
|
+
}
|
1113
|
+
},
|
1114
|
+
params: [
|
1115
|
+
{
|
1116
|
+
name: "T",
|
1117
|
+
type: 19
|
1118
|
+
},
|
1119
|
+
{
|
1120
|
+
name: "E",
|
1121
|
+
type: 8
|
1122
|
+
}
|
1123
|
+
],
|
1124
|
+
path: [
|
1125
|
+
"Result"
|
1126
|
+
]
|
1127
|
+
}
|
1128
|
+
},
|
1129
|
+
{
|
1130
|
+
id: 19,
|
1131
|
+
type: {
|
1132
|
+
def: {
|
1133
|
+
variant: {
|
1134
|
+
variants: [
|
1135
|
+
{
|
1136
|
+
fields: [
|
1137
|
+
{
|
1138
|
+
type: 0
|
1139
|
+
}
|
1140
|
+
],
|
1141
|
+
index: 0,
|
1142
|
+
name: "Ok"
|
1143
|
+
},
|
1144
|
+
{
|
1145
|
+
fields: [
|
1146
|
+
{
|
1147
|
+
type: 11
|
1148
|
+
}
|
1149
|
+
],
|
1150
|
+
index: 1,
|
1151
|
+
name: "Err"
|
1152
|
+
}
|
1153
|
+
]
|
1154
|
+
}
|
1155
|
+
},
|
1156
|
+
params: [
|
1157
|
+
{
|
1158
|
+
name: "T",
|
1159
|
+
type: 0
|
1160
|
+
},
|
1161
|
+
{
|
1162
|
+
name: "E",
|
1163
|
+
type: 11
|
1164
|
+
}
|
1165
|
+
],
|
1166
|
+
path: [
|
1167
|
+
"Result"
|
1168
|
+
]
|
1169
|
+
}
|
1170
|
+
},
|
1171
|
+
{
|
1172
|
+
id: 20,
|
1173
|
+
type: {
|
1174
|
+
def: {
|
1175
|
+
variant: {
|
1176
|
+
variants: [
|
1177
|
+
{
|
1178
|
+
index: 0,
|
1179
|
+
name: "None"
|
1180
|
+
},
|
1181
|
+
{
|
1182
|
+
fields: [
|
1183
|
+
{
|
1184
|
+
type: 5
|
1185
|
+
}
|
1186
|
+
],
|
1187
|
+
index: 1,
|
1188
|
+
name: "Some"
|
1189
|
+
}
|
1190
|
+
]
|
1191
|
+
}
|
1192
|
+
},
|
1193
|
+
params: [
|
1194
|
+
{
|
1195
|
+
name: "T",
|
1196
|
+
type: 5
|
1197
|
+
}
|
1198
|
+
],
|
1199
|
+
path: [
|
1200
|
+
"Option"
|
1201
|
+
]
|
1202
|
+
}
|
1203
|
+
},
|
1204
|
+
{
|
1205
|
+
id: 21,
|
1206
|
+
type: {
|
1207
|
+
def: {
|
1208
|
+
variant: {
|
1209
|
+
variants: [
|
1210
|
+
{
|
1211
|
+
fields: [
|
1212
|
+
{
|
1213
|
+
type: 22
|
1214
|
+
}
|
1215
|
+
],
|
1216
|
+
index: 0,
|
1217
|
+
name: "Ok"
|
1218
|
+
},
|
1219
|
+
{
|
1220
|
+
fields: [
|
1221
|
+
{
|
1222
|
+
type: 8
|
1223
|
+
}
|
1224
|
+
],
|
1225
|
+
index: 1,
|
1226
|
+
name: "Err"
|
1227
|
+
}
|
1228
|
+
]
|
1229
|
+
}
|
1230
|
+
},
|
1231
|
+
params: [
|
1232
|
+
{
|
1233
|
+
name: "T",
|
1234
|
+
type: 22
|
1235
|
+
},
|
1236
|
+
{
|
1237
|
+
name: "E",
|
1238
|
+
type: 8
|
1239
|
+
}
|
1240
|
+
],
|
1241
|
+
path: [
|
1242
|
+
"Result"
|
1243
|
+
]
|
1244
|
+
}
|
1245
|
+
},
|
1246
|
+
{
|
1247
|
+
id: 22,
|
1248
|
+
type: {
|
1249
|
+
def: {
|
1250
|
+
sequence: {
|
1251
|
+
type: 23
|
1252
|
+
}
|
1253
|
+
}
|
1254
|
+
}
|
1255
|
+
},
|
1256
|
+
{
|
1257
|
+
id: 23,
|
1258
|
+
type: {
|
1259
|
+
def: {
|
1260
|
+
tuple: [
|
1261
|
+
0,
|
1262
|
+
5
|
1263
|
+
]
|
1264
|
+
}
|
1265
|
+
}
|
1266
|
+
},
|
1267
|
+
{
|
1268
|
+
id: 24,
|
1269
|
+
type: {
|
1270
|
+
def: {
|
1271
|
+
variant: {
|
1272
|
+
variants: [
|
1273
|
+
{
|
1274
|
+
fields: [
|
1275
|
+
{
|
1276
|
+
type: 0
|
1277
|
+
}
|
1278
|
+
],
|
1279
|
+
index: 0,
|
1280
|
+
name: "Ok"
|
1281
|
+
},
|
1282
|
+
{
|
1283
|
+
fields: [
|
1284
|
+
{
|
1285
|
+
type: 8
|
1286
|
+
}
|
1287
|
+
],
|
1288
|
+
index: 1,
|
1289
|
+
name: "Err"
|
1290
|
+
}
|
1291
|
+
]
|
1292
|
+
}
|
1293
|
+
},
|
1294
|
+
params: [
|
1295
|
+
{
|
1296
|
+
name: "T",
|
1297
|
+
type: 0
|
1298
|
+
},
|
1299
|
+
{
|
1300
|
+
name: "E",
|
1301
|
+
type: 8
|
1302
|
+
}
|
1303
|
+
],
|
1304
|
+
path: [
|
1305
|
+
"Result"
|
1306
|
+
]
|
1307
|
+
}
|
1308
|
+
},
|
1309
|
+
{
|
1310
|
+
id: 25,
|
1311
|
+
type: {
|
1312
|
+
def: {
|
1313
|
+
primitive: "u128"
|
1314
|
+
}
|
1315
|
+
}
|
1316
|
+
},
|
1317
|
+
{
|
1318
|
+
id: 26,
|
1319
|
+
type: {
|
1320
|
+
def: {
|
1321
|
+
composite: {
|
1322
|
+
fields: [
|
1323
|
+
{
|
1324
|
+
type: 1,
|
1325
|
+
typeName: "[u8; 32]"
|
1326
|
+
}
|
1327
|
+
]
|
1328
|
+
}
|
1329
|
+
},
|
1330
|
+
path: [
|
1331
|
+
"ink_primitives",
|
1332
|
+
"types",
|
1333
|
+
"Hash"
|
1334
|
+
]
|
1335
|
+
}
|
1336
|
+
},
|
1337
|
+
{
|
1338
|
+
id: 27,
|
1339
|
+
type: {
|
1340
|
+
def: {
|
1341
|
+
primitive: "u64"
|
1342
|
+
}
|
1343
|
+
}
|
1344
|
+
},
|
1345
|
+
{
|
1346
|
+
id: 28,
|
1347
|
+
type: {
|
1348
|
+
def: {
|
1349
|
+
primitive: "u32"
|
1350
|
+
}
|
1351
|
+
}
|
1352
|
+
},
|
1353
|
+
{
|
1354
|
+
id: 29,
|
1355
|
+
type: {
|
1356
|
+
def: {
|
1357
|
+
variant: {
|
1358
|
+
}
|
1359
|
+
},
|
1360
|
+
path: [
|
1361
|
+
"ink_env",
|
1362
|
+
"types",
|
1363
|
+
"NoChainExtension"
|
1364
|
+
]
|
1365
|
+
}
|
1366
|
+
}
|
1367
|
+
],
|
1368
|
+
version: "4"
|
1369
|
+
};
|
1370
|
+
|
1371
|
+
const ROUTER_ABI = new apiContract.Abi(aznsRouterAbiJson);
|
1372
|
+
const ROUTER_ADDRESS = {
|
1373
|
+
"alephzero": "5FfRtDtpS3Vcr7BTChjPiQNrcAKu3VLv4E1NGF6ng6j3ZopJ",
|
1374
|
+
"alephzero-testnet": "5HXjj3xhtRMqRYCRaXTDcVPz3Mez2XBruyujw6UEkvn8PCiA"
|
1375
|
+
};
|
1376
|
+
const readContract = async (provider, registry, from, contractAddress, data) => {
|
1377
|
+
const rawResult = await provider.send("state_call", ["ContractsApi_call", util.u8aToHex(util.u8aConcatStrict([
|
1378
|
+
// origin
|
1379
|
+
registry.createType("AccountId", from).toU8a(),
|
1380
|
+
// dest
|
1381
|
+
registry.createType("AccountId", contractAddress).toU8a(),
|
1382
|
+
// value
|
1383
|
+
registry.createType("Balance", 0).toU8a(),
|
1384
|
+
// gasLimit
|
1385
|
+
registry.createType("Option<WeightV2>").toU8a(),
|
1386
|
+
// storageDepositLimit
|
1387
|
+
registry.createType("Option<Balance>").toU8a(),
|
1388
|
+
// inputData
|
1389
|
+
data]))]);
|
1390
|
+
return registry.createType("ContractExecResult", rawResult);
|
1391
|
+
};
|
1392
|
+
const resolveDomainToAddress = async (domain, {
|
1393
|
+
provider,
|
1394
|
+
registry,
|
1395
|
+
chainId
|
1396
|
+
}) => {
|
1397
|
+
try {
|
1398
|
+
const routerAddress = ROUTER_ADDRESS[chainId];
|
1399
|
+
if (!routerAddress) throw new Error(`No azns router address found for chainId: ${chainId}`);
|
1400
|
+
const message = ROUTER_ABI.findMessage("get_address");
|
1401
|
+
if (!message) throw new Error(`No get_address message found in aznsRouter abi`);
|
1402
|
+
const {
|
1403
|
+
result
|
1404
|
+
} = await readContract(provider, registry, routerAddress, routerAddress, message.toU8a([domain]));
|
1405
|
+
if (!result.isOk) throw result.asErr;
|
1406
|
+
const resultType = message.returnType.lookupName ?? message.returnType.type;
|
1407
|
+
const returnValue = registry.createTypeUnsafe(resultType, [result.asOk.data.toU8a(true)], {
|
1408
|
+
isPedantic: true
|
1409
|
+
});
|
1410
|
+
if (!returnValue.isOk) throw returnValue.asErr;
|
1411
|
+
if (!returnValue.asOk.isOk) throw returnValue.asOk.asErr;
|
1412
|
+
return returnValue.asOk.asOk.toString();
|
1413
|
+
} catch (cause) {
|
1414
|
+
throw new Error(`Failed to resolve azns domain ${domain} on ${chainId}`, {
|
1415
|
+
cause
|
1416
|
+
});
|
1417
|
+
}
|
1418
|
+
};
|
1419
|
+
const resolveAddressToDomain = async (address, {
|
1420
|
+
provider,
|
1421
|
+
registry,
|
1422
|
+
chainId
|
1423
|
+
}) => {
|
1424
|
+
try {
|
1425
|
+
const routerAddress = ROUTER_ADDRESS[chainId];
|
1426
|
+
if (!routerAddress) throw new Error(`No azns router address found for chainId: ${chainId}`);
|
1427
|
+
const message = ROUTER_ABI.findMessage("get_primary_domains");
|
1428
|
+
if (!message) throw new Error(`No get_address get_primary_domains found in aznsRouter abi`);
|
1429
|
+
const {
|
1430
|
+
result
|
1431
|
+
} = await readContract(provider, registry, routerAddress, routerAddress, message.toU8a([address, undefined]));
|
1432
|
+
if (!result.isOk) throw result.asErr;
|
1433
|
+
const resultType = message.returnType.lookupName ?? message.returnType.type;
|
1434
|
+
const returnValue = registry.createTypeUnsafe(resultType, [result.asOk.data.toU8a(true)], {
|
1435
|
+
isPedantic: true
|
1436
|
+
});
|
1437
|
+
if (!returnValue.isOk) throw returnValue.asErr;
|
1438
|
+
return returnValue.asOk[0]?.[1]?.toString() ?? null;
|
1439
|
+
} catch (cause) {
|
1440
|
+
throw new Error(`Failed to lookup azns domain for ${address} on ${chainId}`, {
|
1441
|
+
cause
|
1442
|
+
});
|
1443
|
+
}
|
1444
|
+
};
|
1445
|
+
|
74
1446
|
/**
|
75
1447
|
* Looks up the on-chain identifiers for some addresses.
|
76
1448
|
* Supports ENS and AZNS.
|
@@ -99,29 +1471,15 @@ const lookupAznsAddresses = async (config, addresses) => {
|
|
99
1471
|
return onChainIds;
|
100
1472
|
}
|
101
1473
|
const provider = config.chainConnectors.substrate.asProvider(config.chainIdAlephZero);
|
102
|
-
const customApi = new api.ApiPromise({
|
103
|
-
provider,
|
104
|
-
registry: config.registryAlephZero
|
105
|
-
});
|
106
|
-
await customApi.isReady;
|
107
1474
|
const results = await Promise.allSettled(addresses.map(async address => {
|
108
1475
|
// no need to do AZNS lookup for ethereum addresses
|
109
|
-
if (util.isEthereumAddress(address)) return;
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
const {
|
117
|
-
primaryDomain: domain
|
118
|
-
} = result;
|
119
|
-
domain !== null && onChainIds.set(address, domain);
|
120
|
-
} catch (cause) {
|
121
|
-
throw new Error(`Failed to resolve AZNS domain for address '${address}': ${String(cause)}`, {
|
122
|
-
cause
|
123
|
-
});
|
124
|
-
}
|
1476
|
+
if (util$1.isEthereumAddress(address)) return;
|
1477
|
+
const domain = await resolveAddressToDomain(address, {
|
1478
|
+
chainId: config.aznsSupportedChainIdAlephZero,
|
1479
|
+
registry: config.registryAlephZero,
|
1480
|
+
provider
|
1481
|
+
});
|
1482
|
+
if (domain) onChainIds.set(address, domain);
|
125
1483
|
}));
|
126
1484
|
results.forEach(result => result.status === "rejected" && log.warn(result.reason));
|
127
1485
|
return onChainIds;
|
@@ -139,7 +1497,7 @@ const lookupEnsAddresses = async (config, addresses) => {
|
|
139
1497
|
}
|
140
1498
|
const results = await Promise.allSettled(addresses.map(async address => {
|
141
1499
|
// no need to do ENS lookup for polkadot addresses
|
142
|
-
if (!util.isEthereumAddress(address)) return;
|
1500
|
+
if (!util$1.isEthereumAddress(address)) return;
|
143
1501
|
try {
|
144
1502
|
const domain = await client.getEnsName({
|
145
1503
|
address
|
@@ -156,10 +1514,10 @@ const lookupEnsAddresses = async (config, addresses) => {
|
|
156
1514
|
};
|
157
1515
|
|
158
1516
|
/** dot separated string with `azero` or `tzero` suffix e.g. `fontbois.tzero` or `talisman.tzero` */
|
159
|
-
const isPotentialAzns = name => typeof name === "string" && /^.+\.[ta]zero$/.test(name);
|
1517
|
+
const isPotentialAzns = name => typeof name === "string" && /^.+\.(([ta]zero)|(a0))$/.test(name);
|
160
1518
|
|
161
1519
|
/** dot separated string e.g. `ens.eth` or `hello.lol`, but not ending with `.azero` nor `.tzero` */
|
162
|
-
const isPotentialEns = name => typeof name === "string" &&
|
1520
|
+
const isPotentialEns = name => typeof name === "string" && /^.+\..+$/.test(name) && !isPotentialAzns(name);
|
163
1521
|
|
164
1522
|
const resolveNames = async (config, names) => {
|
165
1523
|
const resolvedNames = new Map(names.map(name => [name, null]));
|
@@ -190,31 +1548,16 @@ const resolveAznsNames = async (config, names) => {
|
|
190
1548
|
return resolvedNames;
|
191
1549
|
}
|
192
1550
|
const provider = config.chainConnectors.substrate.asProvider(config.chainIdAlephZero);
|
193
|
-
const customApi = new api.ApiPromise({
|
194
|
-
provider,
|
195
|
-
registry: config.registryAlephZero
|
196
|
-
});
|
197
|
-
await customApi.isReady;
|
198
1551
|
const results = await Promise.allSettled(names.map(async name => {
|
199
1552
|
if (!isPotentialAzns(name)) return;
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
const {
|
207
|
-
address
|
208
|
-
} = result;
|
209
|
-
address !== null && resolvedNames.set(name, [address, "azns"]);
|
210
|
-
} catch (cause) {
|
211
|
-
throw new Error(`Failed to resolve address for azns domain '${name}'`, {
|
212
|
-
cause
|
213
|
-
});
|
214
|
-
}
|
1553
|
+
const address = await resolveDomainToAddress(name, {
|
1554
|
+
chainId: config.aznsSupportedChainIdAlephZero,
|
1555
|
+
registry: config.registryAlephZero,
|
1556
|
+
provider
|
1557
|
+
});
|
1558
|
+
if (address) resolvedNames.set(name, [address, "azns"]);
|
215
1559
|
}));
|
216
1560
|
results.forEach(result => result.status === "rejected" && log.warn(result.reason));
|
217
|
-
customApi.disconnect();
|
218
1561
|
return resolvedNames;
|
219
1562
|
};
|
220
1563
|
|
@@ -236,7 +1579,7 @@ const resolveEnsNames = async (config, names) => {
|
|
236
1579
|
// this hangs forever in some cases (ex: try agyle.e first, then agyle.et => hangs) - couldn't explain it
|
237
1580
|
client.getEnsAddress({
|
238
1581
|
name
|
239
|
-
}), util.throwAfter(10_000, "Timeout")]);
|
1582
|
+
}), util$1.throwAfter(10_000, "Timeout")]);
|
240
1583
|
address !== null && resolvedNames.set(name, [address, "ens"]);
|
241
1584
|
} catch (cause) {
|
242
1585
|
throw new Error(`Failed to resolve address for ens domain '${name}'`, {
|