@ensdomains/ensjs 3.0.0-alpha.22 → 3.0.0-alpha.24
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/dist/cjs/contracts/getContractAddress.js +22 -7
- package/dist/cjs/functions/burnFuses.js +1 -38
- package/dist/cjs/functions/commitName.js +2 -0
- package/dist/cjs/functions/createSubname.js +3 -2
- package/dist/cjs/functions/getHistory.js +19 -14
- package/dist/cjs/functions/getNames.js +1 -1
- package/dist/cjs/functions/{getFuses.js → getWrapperData.js} +10 -11
- package/dist/cjs/functions/registerName.js +2 -0
- package/dist/cjs/functions/renewNames.js +23 -3
- package/dist/cjs/functions/transferController.js +42 -0
- package/dist/cjs/functions/transferSubname.js +2 -2
- package/dist/cjs/functions/wrapName.js +3 -2
- package/dist/cjs/generated/factories/ETHRegistrarController__factory.js +137 -0
- package/dist/cjs/generated/factories/NameWrapper__factory.js +63 -39
- package/dist/cjs/generated/factories/PublicResolver__factory.js +69 -14
- package/dist/cjs/generated/factories/ReverseRegistrar__factory.js +13 -0
- package/dist/cjs/index.js +6 -3
- package/dist/cjs/utils/fuses.js +43 -1
- package/dist/cjs/utils/recordHelpers.js +5 -0
- package/dist/cjs/utils/registerHelpers.js +1 -0
- package/dist/cjs/utils/{wrapperExpiry.js → wrapper.js} +11 -4
- package/dist/esm/contracts/getContractAddress.mjs +22 -7
- package/dist/esm/functions/burnFuses.mjs +2 -42
- package/dist/esm/functions/commitName.mjs +2 -0
- package/dist/esm/functions/createSubname.mjs +2 -1
- package/dist/esm/functions/getHistory.mjs +19 -14
- package/dist/esm/functions/getNames.mjs +1 -1
- package/dist/esm/functions/{getFuses.mjs → getWrapperData.mjs} +8 -9
- package/dist/esm/functions/registerName.mjs +2 -0
- package/dist/esm/functions/renewNames.mjs +23 -3
- package/dist/esm/functions/transferController.mjs +23 -0
- package/dist/esm/functions/transferSubname.mjs +1 -1
- package/dist/esm/functions/wrapName.mjs +2 -1
- package/dist/esm/generated/factories/ETHRegistrarController__factory.mjs +137 -0
- package/dist/esm/generated/factories/NameWrapper__factory.mjs +63 -39
- package/dist/esm/generated/factories/PublicResolver__factory.mjs +69 -14
- package/dist/esm/generated/factories/ReverseRegistrar__factory.mjs +13 -0
- package/dist/esm/index.mjs +6 -3
- package/dist/esm/utils/fuses.mjs +43 -1
- package/dist/esm/utils/recordHelpers.mjs +5 -0
- package/dist/esm/utils/registerHelpers.mjs +1 -0
- package/dist/esm/utils/{wrapperExpiry.mjs → wrapper.mjs} +9 -2
- package/dist/types/functions/burnFuses.d.ts +1 -11
- package/dist/types/functions/createSubname.d.ts +1 -1
- package/dist/types/functions/{getFuses.d.ts → getWrapperData.d.ts} +1 -1
- package/dist/types/functions/renewNames.d.ts +9 -2
- package/dist/types/functions/transferController.d.ts +6 -0
- package/dist/types/functions/transferSubname.d.ts +1 -1
- package/dist/types/functions/wrapName.d.ts +1 -1
- package/dist/types/generated/ETHRegistrarController.d.ts +42 -1
- package/dist/types/generated/NameWrapper.d.ts +66 -78
- package/dist/types/generated/PublicResolver.d.ts +51 -23
- package/dist/types/generated/ReverseRegistrar.d.ts +11 -0
- package/dist/types/generated/factories/ETHRegistrarController__factory.d.ts +12 -1
- package/dist/types/index.d.ts +5 -2
- package/dist/types/utils/fuses.d.ts +11 -0
- package/dist/types/utils/recordHelpers.d.ts +1 -0
- package/dist/types/utils/registerHelpers.d.ts +1 -0
- package/dist/types/utils/{wrapperExpiry.d.ts → wrapper.d.ts} +2 -1
- package/package.json +5 -4
- package/src/contracts/getContractAddress.ts +19 -4
- package/src/functions/burnFuses.test.ts +4 -4
- package/src/functions/burnFuses.ts +2 -65
- package/src/functions/commitName.ts +3 -0
- package/src/functions/createSubname.ts +2 -1
- package/src/functions/getHistory.ts +19 -13
- package/src/functions/getNames.test.ts +0 -1
- package/src/functions/getNames.ts +1 -1
- package/src/functions/getPrice.test.ts +9 -6
- package/src/functions/getProfile.test.ts +5 -6
- package/src/functions/getResolver.test.ts +2 -2
- package/src/functions/{getFuses.test.ts → getWrapperData.test.ts} +8 -6
- package/src/functions/{getFuses.ts → getWrapperData.ts} +6 -7
- package/src/functions/registerName.ts +3 -0
- package/src/functions/renewNames.test.ts +3 -3
- package/src/functions/renewNames.ts +36 -6
- package/src/functions/transferController.ts +28 -0
- package/src/functions/transferSubname.ts +1 -1
- package/src/functions/wrapName.test.ts +12 -3
- package/src/functions/wrapName.ts +3 -1
- package/src/generated/ETHRegistrarController.ts +104 -0
- package/src/generated/NameWrapper.ts +127 -90
- package/src/generated/PublicResolver.ts +114 -33
- package/src/generated/ReverseRegistrar.ts +20 -0
- package/src/generated/factories/ETHRegistrarController__factory.ts +137 -0
- package/src/generated/factories/NameWrapper__factory.ts +63 -39
- package/src/generated/factories/PublicResolver__factory.ts +69 -14
- package/src/generated/factories/ReverseRegistrar__factory.ts +13 -0
- package/src/index.ts +19 -5
- package/src/utils/fuses.ts +64 -0
- package/src/utils/recordHelpers.ts +7 -0
- package/src/utils/registerHelpers.ts +1 -1
- package/src/utils/{wrapperExpiry.ts → wrapper.ts} +8 -1
|
@@ -102,11 +102,6 @@ const _abi = [
|
|
|
102
102
|
name: "LabelTooShort",
|
|
103
103
|
type: "error"
|
|
104
104
|
},
|
|
105
|
-
{
|
|
106
|
-
inputs: [],
|
|
107
|
-
name: "NameNotFound",
|
|
108
|
-
type: "error"
|
|
109
|
-
},
|
|
110
105
|
{
|
|
111
106
|
inputs: [
|
|
112
107
|
{
|
|
@@ -498,7 +493,7 @@ const _abi = [
|
|
|
498
493
|
inputs: [
|
|
499
494
|
{
|
|
500
495
|
internalType: "uint256",
|
|
501
|
-
name: "
|
|
496
|
+
name: "id",
|
|
502
497
|
type: "uint256"
|
|
503
498
|
}
|
|
504
499
|
],
|
|
@@ -506,17 +501,17 @@ const _abi = [
|
|
|
506
501
|
outputs: [
|
|
507
502
|
{
|
|
508
503
|
internalType: "address",
|
|
509
|
-
name: "
|
|
504
|
+
name: "",
|
|
510
505
|
type: "address"
|
|
511
506
|
},
|
|
512
507
|
{
|
|
513
508
|
internalType: "uint32",
|
|
514
|
-
name: "
|
|
509
|
+
name: "",
|
|
515
510
|
type: "uint32"
|
|
516
511
|
},
|
|
517
512
|
{
|
|
518
513
|
internalType: "uint64",
|
|
519
|
-
name: "
|
|
514
|
+
name: "",
|
|
520
515
|
type: "uint64"
|
|
521
516
|
}
|
|
522
517
|
],
|
|
@@ -526,22 +521,22 @@ const _abi = [
|
|
|
526
521
|
{
|
|
527
522
|
inputs: [
|
|
528
523
|
{
|
|
529
|
-
internalType: "
|
|
530
|
-
name: "
|
|
531
|
-
type: "
|
|
524
|
+
internalType: "address",
|
|
525
|
+
name: "account",
|
|
526
|
+
type: "address"
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
internalType: "address",
|
|
530
|
+
name: "operator",
|
|
531
|
+
type: "address"
|
|
532
532
|
}
|
|
533
533
|
],
|
|
534
|
-
name: "
|
|
534
|
+
name: "isApprovedForAll",
|
|
535
535
|
outputs: [
|
|
536
536
|
{
|
|
537
|
-
internalType: "
|
|
538
|
-
name: "
|
|
539
|
-
type: "
|
|
540
|
-
},
|
|
541
|
-
{
|
|
542
|
-
internalType: "uint64",
|
|
543
|
-
name: "expiry",
|
|
544
|
-
type: "uint64"
|
|
537
|
+
internalType: "bool",
|
|
538
|
+
name: "",
|
|
539
|
+
type: "bool"
|
|
545
540
|
}
|
|
546
541
|
],
|
|
547
542
|
stateMutability: "view",
|
|
@@ -550,17 +545,17 @@ const _abi = [
|
|
|
550
545
|
{
|
|
551
546
|
inputs: [
|
|
552
547
|
{
|
|
553
|
-
internalType: "
|
|
554
|
-
name: "
|
|
555
|
-
type: "
|
|
548
|
+
internalType: "bytes32",
|
|
549
|
+
name: "node",
|
|
550
|
+
type: "bytes32"
|
|
556
551
|
},
|
|
557
552
|
{
|
|
558
553
|
internalType: "address",
|
|
559
|
-
name: "
|
|
554
|
+
name: "addr",
|
|
560
555
|
type: "address"
|
|
561
556
|
}
|
|
562
557
|
],
|
|
563
|
-
name: "
|
|
558
|
+
name: "isTokenOwnerOrApproved",
|
|
564
559
|
outputs: [
|
|
565
560
|
{
|
|
566
561
|
internalType: "bool",
|
|
@@ -577,14 +572,9 @@ const _abi = [
|
|
|
577
572
|
internalType: "bytes32",
|
|
578
573
|
name: "node",
|
|
579
574
|
type: "bytes32"
|
|
580
|
-
},
|
|
581
|
-
{
|
|
582
|
-
internalType: "address",
|
|
583
|
-
name: "addr",
|
|
584
|
-
type: "address"
|
|
585
575
|
}
|
|
586
576
|
],
|
|
587
|
-
name: "
|
|
577
|
+
name: "isWrapped",
|
|
588
578
|
outputs: [
|
|
589
579
|
{
|
|
590
580
|
internalType: "bool",
|
|
@@ -693,6 +683,29 @@ const _abi = [
|
|
|
693
683
|
stateMutability: "view",
|
|
694
684
|
type: "function"
|
|
695
685
|
},
|
|
686
|
+
{
|
|
687
|
+
inputs: [
|
|
688
|
+
{
|
|
689
|
+
internalType: "address",
|
|
690
|
+
name: "_token",
|
|
691
|
+
type: "address"
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
internalType: "address",
|
|
695
|
+
name: "_to",
|
|
696
|
+
type: "address"
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
internalType: "uint256",
|
|
700
|
+
name: "_amount",
|
|
701
|
+
type: "uint256"
|
|
702
|
+
}
|
|
703
|
+
],
|
|
704
|
+
name: "recoverFunds",
|
|
705
|
+
outputs: [],
|
|
706
|
+
stateMutability: "nonpayable",
|
|
707
|
+
type: "function"
|
|
708
|
+
},
|
|
696
709
|
{
|
|
697
710
|
inputs: [
|
|
698
711
|
{
|
|
@@ -762,6 +775,11 @@ const _abi = [
|
|
|
762
775
|
name: "duration",
|
|
763
776
|
type: "uint256"
|
|
764
777
|
},
|
|
778
|
+
{
|
|
779
|
+
internalType: "uint32",
|
|
780
|
+
name: "fuses",
|
|
781
|
+
type: "uint32"
|
|
782
|
+
},
|
|
765
783
|
{
|
|
766
784
|
internalType: "uint64",
|
|
767
785
|
name: "expiry",
|
|
@@ -944,7 +962,7 @@ const _abi = [
|
|
|
944
962
|
inputs: [
|
|
945
963
|
{
|
|
946
964
|
internalType: "contract IMetadataService",
|
|
947
|
-
name: "
|
|
965
|
+
name: "_metadataService",
|
|
948
966
|
type: "address"
|
|
949
967
|
}
|
|
950
968
|
],
|
|
@@ -1013,7 +1031,7 @@ const _abi = [
|
|
|
1013
1031
|
},
|
|
1014
1032
|
{
|
|
1015
1033
|
internalType: "address",
|
|
1016
|
-
name: "
|
|
1034
|
+
name: "owner",
|
|
1017
1035
|
type: "address"
|
|
1018
1036
|
},
|
|
1019
1037
|
{
|
|
@@ -1052,7 +1070,7 @@ const _abi = [
|
|
|
1052
1070
|
},
|
|
1053
1071
|
{
|
|
1054
1072
|
internalType: "address",
|
|
1055
|
-
name: "
|
|
1073
|
+
name: "owner",
|
|
1056
1074
|
type: "address"
|
|
1057
1075
|
},
|
|
1058
1076
|
{
|
|
@@ -1077,7 +1095,13 @@ const _abi = [
|
|
|
1077
1095
|
}
|
|
1078
1096
|
],
|
|
1079
1097
|
name: "setSubnodeRecord",
|
|
1080
|
-
outputs: [
|
|
1098
|
+
outputs: [
|
|
1099
|
+
{
|
|
1100
|
+
internalType: "bytes32",
|
|
1101
|
+
name: "node",
|
|
1102
|
+
type: "bytes32"
|
|
1103
|
+
}
|
|
1104
|
+
],
|
|
1081
1105
|
stateMutability: "nonpayable",
|
|
1082
1106
|
type: "function"
|
|
1083
1107
|
},
|
|
@@ -1158,7 +1182,7 @@ const _abi = [
|
|
|
1158
1182
|
},
|
|
1159
1183
|
{
|
|
1160
1184
|
internalType: "address",
|
|
1161
|
-
name: "
|
|
1185
|
+
name: "controller",
|
|
1162
1186
|
type: "address"
|
|
1163
1187
|
}
|
|
1164
1188
|
],
|
|
@@ -1176,12 +1200,12 @@ const _abi = [
|
|
|
1176
1200
|
},
|
|
1177
1201
|
{
|
|
1178
1202
|
internalType: "address",
|
|
1179
|
-
name: "
|
|
1203
|
+
name: "registrant",
|
|
1180
1204
|
type: "address"
|
|
1181
1205
|
},
|
|
1182
1206
|
{
|
|
1183
1207
|
internalType: "address",
|
|
1184
|
-
name: "
|
|
1208
|
+
name: "controller",
|
|
1185
1209
|
type: "address"
|
|
1186
1210
|
}
|
|
1187
1211
|
],
|
|
@@ -212,19 +212,6 @@ const _abi = [
|
|
|
212
212
|
name: "DNSRecordDeleted",
|
|
213
213
|
type: "event"
|
|
214
214
|
},
|
|
215
|
-
{
|
|
216
|
-
anonymous: false,
|
|
217
|
-
inputs: [
|
|
218
|
-
{
|
|
219
|
-
indexed: true,
|
|
220
|
-
internalType: "bytes32",
|
|
221
|
-
name: "node",
|
|
222
|
-
type: "bytes32"
|
|
223
|
-
}
|
|
224
|
-
],
|
|
225
|
-
name: "DNSZoneCleared",
|
|
226
|
-
type: "event"
|
|
227
|
-
},
|
|
228
215
|
{
|
|
229
216
|
anonymous: false,
|
|
230
217
|
inputs: [
|
|
@@ -339,11 +326,36 @@ const _abi = [
|
|
|
339
326
|
internalType: "string",
|
|
340
327
|
name: "key",
|
|
341
328
|
type: "string"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
indexed: false,
|
|
332
|
+
internalType: "string",
|
|
333
|
+
name: "value",
|
|
334
|
+
type: "string"
|
|
342
335
|
}
|
|
343
336
|
],
|
|
344
337
|
name: "TextChanged",
|
|
345
338
|
type: "event"
|
|
346
339
|
},
|
|
340
|
+
{
|
|
341
|
+
anonymous: false,
|
|
342
|
+
inputs: [
|
|
343
|
+
{
|
|
344
|
+
indexed: true,
|
|
345
|
+
internalType: "bytes32",
|
|
346
|
+
name: "node",
|
|
347
|
+
type: "bytes32"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
indexed: false,
|
|
351
|
+
internalType: "uint64",
|
|
352
|
+
name: "newVersion",
|
|
353
|
+
type: "uint64"
|
|
354
|
+
}
|
|
355
|
+
],
|
|
356
|
+
name: "VersionChanged",
|
|
357
|
+
type: "event"
|
|
358
|
+
},
|
|
347
359
|
{
|
|
348
360
|
inputs: [
|
|
349
361
|
{
|
|
@@ -424,7 +436,7 @@ const _abi = [
|
|
|
424
436
|
type: "bytes32"
|
|
425
437
|
}
|
|
426
438
|
],
|
|
427
|
-
name: "
|
|
439
|
+
name: "clearRecords",
|
|
428
440
|
outputs: [],
|
|
429
441
|
stateMutability: "nonpayable",
|
|
430
442
|
type: "function"
|
|
@@ -568,6 +580,30 @@ const _abi = [
|
|
|
568
580
|
stateMutability: "nonpayable",
|
|
569
581
|
type: "function"
|
|
570
582
|
},
|
|
583
|
+
{
|
|
584
|
+
inputs: [
|
|
585
|
+
{
|
|
586
|
+
internalType: "bytes32",
|
|
587
|
+
name: "nodehash",
|
|
588
|
+
type: "bytes32"
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
internalType: "bytes[]",
|
|
592
|
+
name: "data",
|
|
593
|
+
type: "bytes[]"
|
|
594
|
+
}
|
|
595
|
+
],
|
|
596
|
+
name: "multicallWithNodeCheck",
|
|
597
|
+
outputs: [
|
|
598
|
+
{
|
|
599
|
+
internalType: "bytes[]",
|
|
600
|
+
name: "results",
|
|
601
|
+
type: "bytes[]"
|
|
602
|
+
}
|
|
603
|
+
],
|
|
604
|
+
stateMutability: "nonpayable",
|
|
605
|
+
type: "function"
|
|
606
|
+
},
|
|
571
607
|
{
|
|
572
608
|
inputs: [
|
|
573
609
|
{
|
|
@@ -611,6 +647,25 @@ const _abi = [
|
|
|
611
647
|
stateMutability: "view",
|
|
612
648
|
type: "function"
|
|
613
649
|
},
|
|
650
|
+
{
|
|
651
|
+
inputs: [
|
|
652
|
+
{
|
|
653
|
+
internalType: "bytes32",
|
|
654
|
+
name: "",
|
|
655
|
+
type: "bytes32"
|
|
656
|
+
}
|
|
657
|
+
],
|
|
658
|
+
name: "recordVersions",
|
|
659
|
+
outputs: [
|
|
660
|
+
{
|
|
661
|
+
internalType: "uint64",
|
|
662
|
+
name: "",
|
|
663
|
+
type: "uint64"
|
|
664
|
+
}
|
|
665
|
+
],
|
|
666
|
+
stateMutability: "view",
|
|
667
|
+
type: "function"
|
|
668
|
+
},
|
|
614
669
|
{
|
|
615
670
|
inputs: [
|
|
616
671
|
{
|
|
@@ -53,6 +53,19 @@ const _abi = [
|
|
|
53
53
|
name: "ControllerChanged",
|
|
54
54
|
type: "event"
|
|
55
55
|
},
|
|
56
|
+
{
|
|
57
|
+
anonymous: false,
|
|
58
|
+
inputs: [
|
|
59
|
+
{
|
|
60
|
+
indexed: true,
|
|
61
|
+
internalType: "contract NameResolver",
|
|
62
|
+
name: "resolver",
|
|
63
|
+
type: "address"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
name: "DefaultResolverChanged",
|
|
67
|
+
type: "event"
|
|
68
|
+
},
|
|
56
69
|
{
|
|
57
70
|
anonymous: false,
|
|
58
71
|
inputs: [
|
package/dist/cjs/index.js
CHANGED
|
@@ -193,9 +193,10 @@ class ENS {
|
|
|
193
193
|
"getResolver",
|
|
194
194
|
["contracts"]
|
|
195
195
|
);
|
|
196
|
-
|
|
197
|
-
"
|
|
198
|
-
|
|
196
|
+
getWrapperData = this.generateRawFunction(
|
|
197
|
+
"getWrapperData",
|
|
198
|
+
["contracts"]
|
|
199
|
+
);
|
|
199
200
|
getHistory = this.generateFunction(
|
|
200
201
|
"getHistory",
|
|
201
202
|
["gqlInstance"],
|
|
@@ -291,6 +292,7 @@ class ENS {
|
|
|
291
292
|
"transferName",
|
|
292
293
|
["contracts"]
|
|
293
294
|
);
|
|
295
|
+
transferController = this.generateWriteFunction("transferController", ["contracts"]);
|
|
294
296
|
wrapName = this.generateWriteFunction("wrapName", [
|
|
295
297
|
"contracts",
|
|
296
298
|
"getExpiry"
|
|
@@ -326,4 +328,5 @@ class ENS {
|
|
|
326
328
|
"renewNames",
|
|
327
329
|
["contracts"]
|
|
328
330
|
);
|
|
331
|
+
renewNameWithData = this.generateWriteFunction("renewNames", ["contracts"], "renewNameWithData");
|
|
329
332
|
}
|
package/dist/cjs/utils/fuses.js
CHANGED
|
@@ -20,7 +20,8 @@ var fuses_exports = {};
|
|
|
20
20
|
__export(fuses_exports, {
|
|
21
21
|
default: () => fuses_default,
|
|
22
22
|
fuseEnum: () => fuseEnum,
|
|
23
|
-
unnamedFuses: () => unnamedFuses
|
|
23
|
+
unnamedFuses: () => unnamedFuses,
|
|
24
|
+
validateFuses: () => validateFuses
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(fuses_exports);
|
|
26
27
|
const CANNOT_UNWRAP = 1;
|
|
@@ -72,4 +73,45 @@ const fullFuseEnum = {
|
|
|
72
73
|
...fuseEnum,
|
|
73
74
|
CAN_DO_EVERYTHING
|
|
74
75
|
};
|
|
76
|
+
const validateFuses = (fuses) => {
|
|
77
|
+
const isNumber = "fuseNumberToBurn" in fuses;
|
|
78
|
+
const hasNamedArray = "namedFusesToBurn" in fuses;
|
|
79
|
+
const hasUnnamedArray = "unnamedFusesToBurn" in fuses;
|
|
80
|
+
let encodedFuses = 0;
|
|
81
|
+
if (isNumber) {
|
|
82
|
+
if (fuses.fuseNumberToBurn > 2 ** 32 || fuses.fuseNumberToBurn < 1) {
|
|
83
|
+
throw new Error(
|
|
84
|
+
`Fuse number must be limited to uint32, ${fuses.fuseNumberToBurn} was too ${fuses.fuseNumberToBurn < 1 ? "low" : "high"}.`
|
|
85
|
+
);
|
|
86
|
+
} else if (fuses.fuseNumberToBurn % 1 !== 0) {
|
|
87
|
+
throw new Error(
|
|
88
|
+
`Fuse number must be an integer, ${fuses.fuseNumberToBurn} was not.`
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
encodedFuses = fuses.fuseNumberToBurn;
|
|
92
|
+
} else {
|
|
93
|
+
if (!hasNamedArray && !hasUnnamedArray) {
|
|
94
|
+
throw new Error("Please provide fuses to burn");
|
|
95
|
+
}
|
|
96
|
+
if (hasNamedArray) {
|
|
97
|
+
for (const fuse of fuses.namedFusesToBurn) {
|
|
98
|
+
if (!(fuse in fuseEnum)) {
|
|
99
|
+
throw new Error(`${fuse} is not a valid named fuse.`);
|
|
100
|
+
}
|
|
101
|
+
encodedFuses |= fuseEnum[fuse];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (hasUnnamedArray) {
|
|
105
|
+
for (const fuse of fuses.unnamedFusesToBurn) {
|
|
106
|
+
if (!unnamedFuses.includes(fuse)) {
|
|
107
|
+
throw new Error(
|
|
108
|
+
`${fuse} is not a valid unnamed fuse. If you are trying to burn a named fuse, use the namedFusesToBurn property.`
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
encodedFuses |= fuse;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return encodedFuses;
|
|
116
|
+
};
|
|
75
117
|
var fuses_default = fullFuseEnum;
|
|
@@ -70,6 +70,11 @@ function generateSingleRecordCall(namehash, resolver, type) {
|
|
|
70
70
|
}
|
|
71
71
|
const generateRecordCallArray = (namehash, records, resolver) => {
|
|
72
72
|
const calls = [];
|
|
73
|
+
if (records.clearRecords) {
|
|
74
|
+
calls.push(
|
|
75
|
+
resolver.interface.encodeFunctionData("clearRecords", [namehash])
|
|
76
|
+
);
|
|
77
|
+
}
|
|
73
78
|
if (records.contentHash) {
|
|
74
79
|
const data = generateSingleRecordCall(
|
|
75
80
|
namehash,
|
|
@@ -24,6 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
25
|
var registerHelpers_exports = {};
|
|
26
26
|
__export(registerHelpers_exports, {
|
|
27
|
+
MAX_INT_64: () => MAX_INT_64,
|
|
27
28
|
_makeCommitment: () => _makeCommitment,
|
|
28
29
|
makeCommitment: () => makeCommitment,
|
|
29
30
|
makeCommitmentData: () => makeCommitmentData,
|
|
@@ -16,13 +16,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var wrapper_exports = {};
|
|
20
|
+
__export(wrapper_exports, {
|
|
21
21
|
MAX_EXPIRY: () => MAX_EXPIRY,
|
|
22
|
-
makeExpiry: () => makeExpiry
|
|
22
|
+
makeExpiry: () => makeExpiry,
|
|
23
|
+
wrappedLabelLengthCheck: () => wrappedLabelLengthCheck
|
|
23
24
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
25
|
+
module.exports = __toCommonJS(wrapper_exports);
|
|
25
26
|
var import_ethers = require("ethers");
|
|
27
|
+
var import_utils = require("ethers/lib/utils");
|
|
26
28
|
const MAX_EXPIRY = import_ethers.BigNumber.from(2).pow(64).sub(1);
|
|
27
29
|
const makeExpiry = async ({ getExpiry }, name, expiry) => {
|
|
28
30
|
if (expiry) {
|
|
@@ -42,3 +44,8 @@ const makeExpiry = async ({ getExpiry }, name, expiry) => {
|
|
|
42
44
|
}
|
|
43
45
|
return MAX_EXPIRY;
|
|
44
46
|
};
|
|
47
|
+
const wrappedLabelLengthCheck = (label) => {
|
|
48
|
+
const bytes = (0, import_utils.toUtf8Bytes)(label);
|
|
49
|
+
if (bytes.byteLength > 255)
|
|
50
|
+
throw new Error("Label can't be longer than 255 bytes");
|
|
51
|
+
};
|
|
@@ -8,14 +8,21 @@ var addresses = {
|
|
|
8
8
|
},
|
|
9
9
|
ETHRegistrarController: {
|
|
10
10
|
"1": "0x283af0b28c62c092c9727f1ee09c02ca627eb7f5",
|
|
11
|
-
"3": "
|
|
11
|
+
"3": "0xa5627AB7Ae47063B533622C34FEBDb52d3281dF8",
|
|
12
12
|
"4": "0x283af0b28c62c092c9727f1ee09c02ca627eb7f5",
|
|
13
|
-
"5": "
|
|
13
|
+
"5": "0x4a16c6Bbee697b66706E7dc0101BfCA1d60cdE76"
|
|
14
14
|
},
|
|
15
15
|
Multicall: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
16
|
-
NameWrapper:
|
|
16
|
+
NameWrapper: {
|
|
17
|
+
"1": "0x0000000000000000000000000000000000000000",
|
|
18
|
+
"3": "0xF82155e2a43Be0871821E9654Fc8Ae894FB8307C",
|
|
19
|
+
"4": "0x0000000000000000000000000000000000000000",
|
|
20
|
+
"5": "0x9c4C40960B53e9A01af429D3f90aEf02Bd0c4c72"
|
|
21
|
+
},
|
|
17
22
|
PublicResolver: {
|
|
18
|
-
"1": "0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41"
|
|
23
|
+
"1": "0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41",
|
|
24
|
+
"3": "0x13F0659Ee6bb7484C884FEeFb7F75C93951ef837",
|
|
25
|
+
"5": "0x58e4627848223BF59F8Ce34265c426E7B05E8625"
|
|
19
26
|
},
|
|
20
27
|
ENSRegistryWithFallback: {
|
|
21
28
|
"1": "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e",
|
|
@@ -24,13 +31,21 @@ var addresses = {
|
|
|
24
31
|
"5": "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e"
|
|
25
32
|
},
|
|
26
33
|
ReverseRegistrar: {
|
|
27
|
-
"1": "0x084b1c3C81545d370f3634392De611CaaBFf8148"
|
|
34
|
+
"1": "0x084b1c3C81545d370f3634392De611CaaBFf8148",
|
|
35
|
+
"3": "0x806246b52f8cB61655d3038c58D2f63Aa55d4edE",
|
|
36
|
+
"5": "0xD5610A08E370051a01fdfe4bB3ddf5270af1aA48"
|
|
28
37
|
},
|
|
29
38
|
UniversalResolver: {
|
|
30
39
|
"1": "0x580AF46E06DaaD47eb5940526FD64d95b815Cb70",
|
|
31
|
-
"
|
|
40
|
+
"3": "0x74e20bd2a1fe0cdbe45b9a1d89cb7e0a45b36376",
|
|
41
|
+
"4": "0x74e20bd2a1fe0cdbe45b9a1d89cb7e0a45b36376",
|
|
42
|
+
"5": "0x9380F1974D2B7064eA0c0EC251968D8c69f0Ae31"
|
|
32
43
|
},
|
|
33
|
-
BulkRenewal:
|
|
44
|
+
BulkRenewal: {
|
|
45
|
+
"1": "0xfF252725f6122A92551A5FA9a6b6bf10eb0Be035",
|
|
46
|
+
"3": "0x051b02245D826757EfaF5C6209D4D79FB39FBC45",
|
|
47
|
+
"5": "0xa9e1df95a79C768aA435805b28E1B54Bb5ead063"
|
|
48
|
+
}
|
|
34
49
|
};
|
|
35
50
|
var getContractAddress = (networkId) => (contractName) => {
|
|
36
51
|
try {
|
|
@@ -1,48 +1,8 @@
|
|
|
1
1
|
// src/functions/burnFuses.ts
|
|
2
|
-
import {
|
|
3
|
-
fuseEnum,
|
|
4
|
-
unnamedFuses
|
|
5
|
-
} from "../utils/fuses.mjs";
|
|
2
|
+
import { validateFuses } from "../utils/fuses.mjs";
|
|
6
3
|
import { namehash } from "../utils/normalise.mjs";
|
|
7
4
|
async function burnFuses_default({ contracts, signer }, name, props) {
|
|
8
|
-
const
|
|
9
|
-
const hasNamedArray = "namedFusesToBurn" in props;
|
|
10
|
-
const hasUnnamedArray = "unnamedFusesToBurn" in props;
|
|
11
|
-
let encodedFuses = 0;
|
|
12
|
-
if (isNumber) {
|
|
13
|
-
if (props.fuseNumberToBurn > 2 ** 32 || props.fuseNumberToBurn < 1) {
|
|
14
|
-
throw new Error(
|
|
15
|
-
`Fuse number must be limited to uint32, ${props.fuseNumberToBurn} was too ${props.fuseNumberToBurn < 1 ? "low" : "high"}.`
|
|
16
|
-
);
|
|
17
|
-
} else if (props.fuseNumberToBurn % 1 !== 0) {
|
|
18
|
-
throw new Error(
|
|
19
|
-
`Fuse number must be an integer, ${props.fuseNumberToBurn} was not.`
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
encodedFuses = props.fuseNumberToBurn;
|
|
23
|
-
} else {
|
|
24
|
-
if (!hasNamedArray && !hasUnnamedArray) {
|
|
25
|
-
throw new Error("Please provide fuses to burn");
|
|
26
|
-
}
|
|
27
|
-
if (hasNamedArray) {
|
|
28
|
-
for (const fuse of props.namedFusesToBurn) {
|
|
29
|
-
if (!(fuse in fuseEnum)) {
|
|
30
|
-
throw new Error(`${fuse} is not a valid named fuse.`);
|
|
31
|
-
}
|
|
32
|
-
encodedFuses |= fuseEnum[fuse];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if (hasUnnamedArray) {
|
|
36
|
-
for (const fuse of props.unnamedFusesToBurn) {
|
|
37
|
-
if (!unnamedFuses.includes(fuse)) {
|
|
38
|
-
throw new Error(
|
|
39
|
-
`${fuse} is not a valid unnamed fuse. If you are trying to burn a named fuse, use the namedFusesToBurn property.`
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
encodedFuses |= fuse;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
5
|
+
const encodedFuses = validateFuses(props);
|
|
46
6
|
const nameWrapper = (await contracts.getNameWrapper()).connect(signer);
|
|
47
7
|
const hash = namehash(name);
|
|
48
8
|
return nameWrapper.populateTransaction.setFuses(hash, encodedFuses);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// src/functions/commitName.ts
|
|
2
2
|
import { makeCommitment } from "../utils/registerHelpers.mjs";
|
|
3
|
+
import { wrappedLabelLengthCheck } from "../utils/wrapper.mjs";
|
|
3
4
|
async function commitName_default({ contracts }, name, { resolverAddress, ...params }) {
|
|
4
5
|
const labels = name.split(".");
|
|
5
6
|
if (labels.length !== 2 || labels[1] !== "eth")
|
|
6
7
|
throw new Error("Currently only .eth TLD registrations are supported");
|
|
8
|
+
wrappedLabelLengthCheck(labels[0]);
|
|
7
9
|
const controller = await contracts.getEthRegistrarController();
|
|
8
10
|
const resolver = await contracts.getPublicResolver(
|
|
9
11
|
void 0,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ethers } from "ethers";
|
|
3
3
|
import generateFuseInput from "../utils/generateFuseInput.mjs";
|
|
4
4
|
import { namehash } from "../utils/normalise.mjs";
|
|
5
|
-
import { makeExpiry } from "../utils/
|
|
5
|
+
import { makeExpiry, wrappedLabelLengthCheck } from "../utils/wrapper.mjs";
|
|
6
6
|
async function createSubname_default({
|
|
7
7
|
contracts,
|
|
8
8
|
signer,
|
|
@@ -33,6 +33,7 @@ async function createSubname_default({
|
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
case "nameWrapper": {
|
|
36
|
+
wrappedLabelLengthCheck(label);
|
|
36
37
|
const nameWrapper = (await contracts.getNameWrapper()).connect(signer);
|
|
37
38
|
const expiry = await makeExpiry(
|
|
38
39
|
{ getExpiry },
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { formatsByCoinType } from "@ensdomains/address-encoder";
|
|
3
3
|
import { ethers } from "ethers";
|
|
4
4
|
import { decodeContenthash } from "../utils/contentHash.mjs";
|
|
5
|
+
import { labelhash } from "../utils/labels.mjs";
|
|
6
|
+
import { namehash } from "../utils/normalise.mjs";
|
|
5
7
|
var eventFormat = {
|
|
6
8
|
Domain: {
|
|
7
9
|
NewOwner: (args) => ({ owner: args.owner.id }),
|
|
@@ -68,8 +70,8 @@ var mapEvents = (eventArray, type) => eventArray.map(
|
|
|
68
70
|
async function getHistory({ gqlInstance }, name) {
|
|
69
71
|
const { client } = gqlInstance;
|
|
70
72
|
const query = gqlInstance.gql`
|
|
71
|
-
query getHistory($
|
|
72
|
-
|
|
73
|
+
query getHistory($namehash: String!, $labelhash: String!) {
|
|
74
|
+
domain(id: $namehash) {
|
|
73
75
|
events {
|
|
74
76
|
id
|
|
75
77
|
blockNumber
|
|
@@ -95,7 +97,7 @@ async function getHistory({ gqlInstance }, name) {
|
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
owner {
|
|
98
|
-
registrations (where: {
|
|
100
|
+
registrations (where: { id: $labelhash }) {
|
|
99
101
|
events {
|
|
100
102
|
id
|
|
101
103
|
blockNumber
|
|
@@ -165,18 +167,21 @@ async function getHistory({ gqlInstance }, name) {
|
|
|
165
167
|
}
|
|
166
168
|
`;
|
|
167
169
|
const label = name.split(".")[0];
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
+
const nameHash = namehash(name);
|
|
171
|
+
const labelHash = labelhash(label);
|
|
172
|
+
const { domain } = await client.request(query, {
|
|
173
|
+
namehash: nameHash,
|
|
174
|
+
labelhash: labelHash
|
|
175
|
+
});
|
|
176
|
+
if (!domain)
|
|
170
177
|
return;
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
] = domains;
|
|
178
|
+
const {
|
|
179
|
+
events: domainEvents,
|
|
180
|
+
owner: {
|
|
181
|
+
registrations: [{ events: registrationEvents }]
|
|
182
|
+
},
|
|
183
|
+
resolver: { events: resolverEvents }
|
|
184
|
+
} = domain;
|
|
180
185
|
const domainHistory = mapEvents(domainEvents, "Domain");
|
|
181
186
|
const registrationHistory = mapEvents(registrationEvents, "Registration");
|
|
182
187
|
const resolverHistory = mapEvents(
|