@talismn/on-chain-id 0.0.0-pr1671-20241021082009 → 0.0.0-pr1672-20241023070444

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