@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
|
@@ -86,11 +86,6 @@ const _abi = [
|
|
|
86
86
|
name: "LabelTooShort",
|
|
87
87
|
type: "error",
|
|
88
88
|
},
|
|
89
|
-
{
|
|
90
|
-
inputs: [],
|
|
91
|
-
name: "NameNotFound",
|
|
92
|
-
type: "error",
|
|
93
|
-
},
|
|
94
89
|
{
|
|
95
90
|
inputs: [
|
|
96
91
|
{
|
|
@@ -482,7 +477,7 @@ const _abi = [
|
|
|
482
477
|
inputs: [
|
|
483
478
|
{
|
|
484
479
|
internalType: "uint256",
|
|
485
|
-
name: "
|
|
480
|
+
name: "id",
|
|
486
481
|
type: "uint256",
|
|
487
482
|
},
|
|
488
483
|
],
|
|
@@ -490,17 +485,17 @@ const _abi = [
|
|
|
490
485
|
outputs: [
|
|
491
486
|
{
|
|
492
487
|
internalType: "address",
|
|
493
|
-
name: "
|
|
488
|
+
name: "",
|
|
494
489
|
type: "address",
|
|
495
490
|
},
|
|
496
491
|
{
|
|
497
492
|
internalType: "uint32",
|
|
498
|
-
name: "
|
|
493
|
+
name: "",
|
|
499
494
|
type: "uint32",
|
|
500
495
|
},
|
|
501
496
|
{
|
|
502
497
|
internalType: "uint64",
|
|
503
|
-
name: "
|
|
498
|
+
name: "",
|
|
504
499
|
type: "uint64",
|
|
505
500
|
},
|
|
506
501
|
],
|
|
@@ -510,22 +505,22 @@ const _abi = [
|
|
|
510
505
|
{
|
|
511
506
|
inputs: [
|
|
512
507
|
{
|
|
513
|
-
internalType: "
|
|
514
|
-
name: "
|
|
515
|
-
type: "
|
|
508
|
+
internalType: "address",
|
|
509
|
+
name: "account",
|
|
510
|
+
type: "address",
|
|
516
511
|
},
|
|
517
|
-
],
|
|
518
|
-
name: "getFuses",
|
|
519
|
-
outputs: [
|
|
520
512
|
{
|
|
521
|
-
internalType: "
|
|
522
|
-
name: "
|
|
523
|
-
type: "
|
|
513
|
+
internalType: "address",
|
|
514
|
+
name: "operator",
|
|
515
|
+
type: "address",
|
|
524
516
|
},
|
|
517
|
+
],
|
|
518
|
+
name: "isApprovedForAll",
|
|
519
|
+
outputs: [
|
|
525
520
|
{
|
|
526
|
-
internalType: "
|
|
527
|
-
name: "
|
|
528
|
-
type: "
|
|
521
|
+
internalType: "bool",
|
|
522
|
+
name: "",
|
|
523
|
+
type: "bool",
|
|
529
524
|
},
|
|
530
525
|
],
|
|
531
526
|
stateMutability: "view",
|
|
@@ -534,17 +529,17 @@ const _abi = [
|
|
|
534
529
|
{
|
|
535
530
|
inputs: [
|
|
536
531
|
{
|
|
537
|
-
internalType: "
|
|
538
|
-
name: "
|
|
539
|
-
type: "
|
|
532
|
+
internalType: "bytes32",
|
|
533
|
+
name: "node",
|
|
534
|
+
type: "bytes32",
|
|
540
535
|
},
|
|
541
536
|
{
|
|
542
537
|
internalType: "address",
|
|
543
|
-
name: "
|
|
538
|
+
name: "addr",
|
|
544
539
|
type: "address",
|
|
545
540
|
},
|
|
546
541
|
],
|
|
547
|
-
name: "
|
|
542
|
+
name: "isTokenOwnerOrApproved",
|
|
548
543
|
outputs: [
|
|
549
544
|
{
|
|
550
545
|
internalType: "bool",
|
|
@@ -562,13 +557,8 @@ const _abi = [
|
|
|
562
557
|
name: "node",
|
|
563
558
|
type: "bytes32",
|
|
564
559
|
},
|
|
565
|
-
{
|
|
566
|
-
internalType: "address",
|
|
567
|
-
name: "addr",
|
|
568
|
-
type: "address",
|
|
569
|
-
},
|
|
570
560
|
],
|
|
571
|
-
name: "
|
|
561
|
+
name: "isWrapped",
|
|
572
562
|
outputs: [
|
|
573
563
|
{
|
|
574
564
|
internalType: "bool",
|
|
@@ -677,6 +667,29 @@ const _abi = [
|
|
|
677
667
|
stateMutability: "view",
|
|
678
668
|
type: "function",
|
|
679
669
|
},
|
|
670
|
+
{
|
|
671
|
+
inputs: [
|
|
672
|
+
{
|
|
673
|
+
internalType: "address",
|
|
674
|
+
name: "_token",
|
|
675
|
+
type: "address",
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
internalType: "address",
|
|
679
|
+
name: "_to",
|
|
680
|
+
type: "address",
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
internalType: "uint256",
|
|
684
|
+
name: "_amount",
|
|
685
|
+
type: "uint256",
|
|
686
|
+
},
|
|
687
|
+
],
|
|
688
|
+
name: "recoverFunds",
|
|
689
|
+
outputs: [],
|
|
690
|
+
stateMutability: "nonpayable",
|
|
691
|
+
type: "function",
|
|
692
|
+
},
|
|
680
693
|
{
|
|
681
694
|
inputs: [
|
|
682
695
|
{
|
|
@@ -746,6 +759,11 @@ const _abi = [
|
|
|
746
759
|
name: "duration",
|
|
747
760
|
type: "uint256",
|
|
748
761
|
},
|
|
762
|
+
{
|
|
763
|
+
internalType: "uint32",
|
|
764
|
+
name: "fuses",
|
|
765
|
+
type: "uint32",
|
|
766
|
+
},
|
|
749
767
|
{
|
|
750
768
|
internalType: "uint64",
|
|
751
769
|
name: "expiry",
|
|
@@ -928,7 +946,7 @@ const _abi = [
|
|
|
928
946
|
inputs: [
|
|
929
947
|
{
|
|
930
948
|
internalType: "contract IMetadataService",
|
|
931
|
-
name: "
|
|
949
|
+
name: "_metadataService",
|
|
932
950
|
type: "address",
|
|
933
951
|
},
|
|
934
952
|
],
|
|
@@ -997,7 +1015,7 @@ const _abi = [
|
|
|
997
1015
|
},
|
|
998
1016
|
{
|
|
999
1017
|
internalType: "address",
|
|
1000
|
-
name: "
|
|
1018
|
+
name: "owner",
|
|
1001
1019
|
type: "address",
|
|
1002
1020
|
},
|
|
1003
1021
|
{
|
|
@@ -1036,7 +1054,7 @@ const _abi = [
|
|
|
1036
1054
|
},
|
|
1037
1055
|
{
|
|
1038
1056
|
internalType: "address",
|
|
1039
|
-
name: "
|
|
1057
|
+
name: "owner",
|
|
1040
1058
|
type: "address",
|
|
1041
1059
|
},
|
|
1042
1060
|
{
|
|
@@ -1061,7 +1079,13 @@ const _abi = [
|
|
|
1061
1079
|
},
|
|
1062
1080
|
],
|
|
1063
1081
|
name: "setSubnodeRecord",
|
|
1064
|
-
outputs: [
|
|
1082
|
+
outputs: [
|
|
1083
|
+
{
|
|
1084
|
+
internalType: "bytes32",
|
|
1085
|
+
name: "node",
|
|
1086
|
+
type: "bytes32",
|
|
1087
|
+
},
|
|
1088
|
+
],
|
|
1065
1089
|
stateMutability: "nonpayable",
|
|
1066
1090
|
type: "function",
|
|
1067
1091
|
},
|
|
@@ -1142,7 +1166,7 @@ const _abi = [
|
|
|
1142
1166
|
},
|
|
1143
1167
|
{
|
|
1144
1168
|
internalType: "address",
|
|
1145
|
-
name: "
|
|
1169
|
+
name: "controller",
|
|
1146
1170
|
type: "address",
|
|
1147
1171
|
},
|
|
1148
1172
|
],
|
|
@@ -1160,12 +1184,12 @@ const _abi = [
|
|
|
1160
1184
|
},
|
|
1161
1185
|
{
|
|
1162
1186
|
internalType: "address",
|
|
1163
|
-
name: "
|
|
1187
|
+
name: "registrant",
|
|
1164
1188
|
type: "address",
|
|
1165
1189
|
},
|
|
1166
1190
|
{
|
|
1167
1191
|
internalType: "address",
|
|
1168
|
-
name: "
|
|
1192
|
+
name: "controller",
|
|
1169
1193
|
type: "address",
|
|
1170
1194
|
},
|
|
1171
1195
|
],
|
|
@@ -199,19 +199,6 @@ const _abi = [
|
|
|
199
199
|
name: "DNSRecordDeleted",
|
|
200
200
|
type: "event",
|
|
201
201
|
},
|
|
202
|
-
{
|
|
203
|
-
anonymous: false,
|
|
204
|
-
inputs: [
|
|
205
|
-
{
|
|
206
|
-
indexed: true,
|
|
207
|
-
internalType: "bytes32",
|
|
208
|
-
name: "node",
|
|
209
|
-
type: "bytes32",
|
|
210
|
-
},
|
|
211
|
-
],
|
|
212
|
-
name: "DNSZoneCleared",
|
|
213
|
-
type: "event",
|
|
214
|
-
},
|
|
215
202
|
{
|
|
216
203
|
anonymous: false,
|
|
217
204
|
inputs: [
|
|
@@ -327,10 +314,35 @@ const _abi = [
|
|
|
327
314
|
name: "key",
|
|
328
315
|
type: "string",
|
|
329
316
|
},
|
|
317
|
+
{
|
|
318
|
+
indexed: false,
|
|
319
|
+
internalType: "string",
|
|
320
|
+
name: "value",
|
|
321
|
+
type: "string",
|
|
322
|
+
},
|
|
330
323
|
],
|
|
331
324
|
name: "TextChanged",
|
|
332
325
|
type: "event",
|
|
333
326
|
},
|
|
327
|
+
{
|
|
328
|
+
anonymous: false,
|
|
329
|
+
inputs: [
|
|
330
|
+
{
|
|
331
|
+
indexed: true,
|
|
332
|
+
internalType: "bytes32",
|
|
333
|
+
name: "node",
|
|
334
|
+
type: "bytes32",
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
indexed: false,
|
|
338
|
+
internalType: "uint64",
|
|
339
|
+
name: "newVersion",
|
|
340
|
+
type: "uint64",
|
|
341
|
+
},
|
|
342
|
+
],
|
|
343
|
+
name: "VersionChanged",
|
|
344
|
+
type: "event",
|
|
345
|
+
},
|
|
334
346
|
{
|
|
335
347
|
inputs: [
|
|
336
348
|
{
|
|
@@ -411,7 +423,7 @@ const _abi = [
|
|
|
411
423
|
type: "bytes32",
|
|
412
424
|
},
|
|
413
425
|
],
|
|
414
|
-
name: "
|
|
426
|
+
name: "clearRecords",
|
|
415
427
|
outputs: [],
|
|
416
428
|
stateMutability: "nonpayable",
|
|
417
429
|
type: "function",
|
|
@@ -555,6 +567,30 @@ const _abi = [
|
|
|
555
567
|
stateMutability: "nonpayable",
|
|
556
568
|
type: "function",
|
|
557
569
|
},
|
|
570
|
+
{
|
|
571
|
+
inputs: [
|
|
572
|
+
{
|
|
573
|
+
internalType: "bytes32",
|
|
574
|
+
name: "nodehash",
|
|
575
|
+
type: "bytes32",
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
internalType: "bytes[]",
|
|
579
|
+
name: "data",
|
|
580
|
+
type: "bytes[]",
|
|
581
|
+
},
|
|
582
|
+
],
|
|
583
|
+
name: "multicallWithNodeCheck",
|
|
584
|
+
outputs: [
|
|
585
|
+
{
|
|
586
|
+
internalType: "bytes[]",
|
|
587
|
+
name: "results",
|
|
588
|
+
type: "bytes[]",
|
|
589
|
+
},
|
|
590
|
+
],
|
|
591
|
+
stateMutability: "nonpayable",
|
|
592
|
+
type: "function",
|
|
593
|
+
},
|
|
558
594
|
{
|
|
559
595
|
inputs: [
|
|
560
596
|
{
|
|
@@ -598,6 +634,25 @@ const _abi = [
|
|
|
598
634
|
stateMutability: "view",
|
|
599
635
|
type: "function",
|
|
600
636
|
},
|
|
637
|
+
{
|
|
638
|
+
inputs: [
|
|
639
|
+
{
|
|
640
|
+
internalType: "bytes32",
|
|
641
|
+
name: "",
|
|
642
|
+
type: "bytes32",
|
|
643
|
+
},
|
|
644
|
+
],
|
|
645
|
+
name: "recordVersions",
|
|
646
|
+
outputs: [
|
|
647
|
+
{
|
|
648
|
+
internalType: "uint64",
|
|
649
|
+
name: "",
|
|
650
|
+
type: "uint64",
|
|
651
|
+
},
|
|
652
|
+
],
|
|
653
|
+
stateMutability: "view",
|
|
654
|
+
type: "function",
|
|
655
|
+
},
|
|
601
656
|
{
|
|
602
657
|
inputs: [
|
|
603
658
|
{
|
|
@@ -40,6 +40,19 @@ const _abi = [
|
|
|
40
40
|
name: "ControllerChanged",
|
|
41
41
|
type: "event",
|
|
42
42
|
},
|
|
43
|
+
{
|
|
44
|
+
anonymous: false,
|
|
45
|
+
inputs: [
|
|
46
|
+
{
|
|
47
|
+
indexed: true,
|
|
48
|
+
internalType: "contract NameResolver",
|
|
49
|
+
name: "resolver",
|
|
50
|
+
type: "address",
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
name: "DefaultResolverChanged",
|
|
54
|
+
type: "event",
|
|
55
|
+
},
|
|
43
56
|
{
|
|
44
57
|
anonymous: false,
|
|
45
58
|
inputs: [
|
package/src/index.ts
CHANGED
|
@@ -15,7 +15,6 @@ import type createSubname from './functions/createSubname'
|
|
|
15
15
|
import type deleteSubname from './functions/deleteSubname'
|
|
16
16
|
import type getDNSOwner from './functions/getDNSOwner'
|
|
17
17
|
import type getExpiry from './functions/getExpiry'
|
|
18
|
-
import type getFuses from './functions/getFuses'
|
|
19
18
|
import type { getHistory } from './functions/getHistory'
|
|
20
19
|
import type getName from './functions/getName'
|
|
21
20
|
import type getNames from './functions/getNames'
|
|
@@ -33,13 +32,19 @@ import type {
|
|
|
33
32
|
_getText,
|
|
34
33
|
} from './functions/getSpecificRecord'
|
|
35
34
|
import type getSubnames from './functions/getSubnames'
|
|
35
|
+
import type getWrapperData from './functions/getWrapperData'
|
|
36
36
|
import type registerName from './functions/registerName'
|
|
37
|
-
import type
|
|
37
|
+
import type {
|
|
38
|
+
// eslint-disable-next-line import/no-named-default
|
|
39
|
+
default as renewNames,
|
|
40
|
+
renewNameWithData,
|
|
41
|
+
} from './functions/renewNames'
|
|
38
42
|
import type setName from './functions/setName'
|
|
39
43
|
import type setRecord from './functions/setRecord'
|
|
40
44
|
import type setRecords from './functions/setRecords'
|
|
41
45
|
import type setResolver from './functions/setResolver'
|
|
42
46
|
import type transferName from './functions/transferName'
|
|
47
|
+
import type transferController from './functions/transferController'
|
|
43
48
|
import type transferSubname from './functions/transferSubname'
|
|
44
49
|
import type unwrapName from './functions/unwrapName'
|
|
45
50
|
import type wrapName from './functions/wrapName'
|
|
@@ -445,9 +450,10 @@ export class ENS {
|
|
|
445
450
|
['contracts'],
|
|
446
451
|
)
|
|
447
452
|
|
|
448
|
-
public
|
|
449
|
-
'
|
|
450
|
-
|
|
453
|
+
public getWrapperData = this.generateRawFunction<typeof getWrapperData>(
|
|
454
|
+
'getWrapperData',
|
|
455
|
+
['contracts'],
|
|
456
|
+
)
|
|
451
457
|
|
|
452
458
|
public getHistory = this.generateFunction<typeof getHistory>(
|
|
453
459
|
'getHistory',
|
|
@@ -567,6 +573,10 @@ export class ENS {
|
|
|
567
573
|
['contracts'],
|
|
568
574
|
)
|
|
569
575
|
|
|
576
|
+
public transferController = this.generateWriteFunction<
|
|
577
|
+
typeof transferController
|
|
578
|
+
>('transferController', ['contracts'])
|
|
579
|
+
|
|
570
580
|
public wrapName = this.generateWriteFunction<typeof wrapName>('wrapName', [
|
|
571
581
|
'contracts',
|
|
572
582
|
'getExpiry',
|
|
@@ -610,4 +620,8 @@ export class ENS {
|
|
|
610
620
|
'renewNames',
|
|
611
621
|
['contracts'],
|
|
612
622
|
)
|
|
623
|
+
|
|
624
|
+
public renewNameWithData = this.generateWriteFunction<
|
|
625
|
+
typeof renewNameWithData
|
|
626
|
+
>('renewNames', ['contracts'], 'renewNameWithData')
|
|
613
627
|
}
|
package/src/utils/fuses.ts
CHANGED
|
@@ -70,4 +70,68 @@ type FusesWithoutDuplicates<A, B = never> = A extends FuseArrayPossibilities
|
|
|
70
70
|
|
|
71
71
|
export type NamedFusesToBurn = FusesWithoutDuplicates<FuseArrayPossibilities>
|
|
72
72
|
|
|
73
|
+
export type FusePropsNamedArray = {
|
|
74
|
+
namedFusesToBurn: NamedFusesToBurn
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type FusePropsUnnamedArray = {
|
|
78
|
+
unnamedFusesToBurn: UnnamedFuseValues[]
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type FusePropsNumber = {
|
|
82
|
+
fuseNumberToBurn: number
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type FuseProps =
|
|
86
|
+
| (Partial<FusePropsNamedArray> & FusePropsUnnamedArray)
|
|
87
|
+
| (FusePropsNamedArray & Partial<FusePropsUnnamedArray>)
|
|
88
|
+
| FusePropsNumber
|
|
89
|
+
|
|
90
|
+
export const validateFuses = (fuses: FuseProps) => {
|
|
91
|
+
const isNumber = 'fuseNumberToBurn' in fuses
|
|
92
|
+
const hasNamedArray = 'namedFusesToBurn' in fuses
|
|
93
|
+
const hasUnnamedArray = 'unnamedFusesToBurn' in fuses
|
|
94
|
+
|
|
95
|
+
let encodedFuses: number = 0
|
|
96
|
+
|
|
97
|
+
if (isNumber) {
|
|
98
|
+
if (fuses.fuseNumberToBurn > 2 ** 32 || fuses.fuseNumberToBurn < 1) {
|
|
99
|
+
throw new Error(
|
|
100
|
+
`Fuse number must be limited to uint32, ${
|
|
101
|
+
fuses.fuseNumberToBurn
|
|
102
|
+
} was too ${fuses.fuseNumberToBurn < 1 ? 'low' : 'high'}.`,
|
|
103
|
+
)
|
|
104
|
+
} else if (fuses.fuseNumberToBurn % 1 !== 0) {
|
|
105
|
+
throw new Error(
|
|
106
|
+
`Fuse number must be an integer, ${fuses.fuseNumberToBurn} was not.`,
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
encodedFuses = fuses.fuseNumberToBurn
|
|
110
|
+
} else {
|
|
111
|
+
if (!hasNamedArray && !hasUnnamedArray) {
|
|
112
|
+
throw new Error('Please provide fuses to burn')
|
|
113
|
+
}
|
|
114
|
+
if (hasNamedArray) {
|
|
115
|
+
for (const fuse of fuses.namedFusesToBurn!) {
|
|
116
|
+
if (!(fuse in fuseEnum)) {
|
|
117
|
+
throw new Error(`${fuse} is not a valid named fuse.`)
|
|
118
|
+
}
|
|
119
|
+
encodedFuses |= fuseEnum[fuse]
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (hasUnnamedArray) {
|
|
123
|
+
for (const fuse of fuses.unnamedFusesToBurn!) {
|
|
124
|
+
if (!unnamedFuses.includes(fuse)) {
|
|
125
|
+
throw new Error(
|
|
126
|
+
`${fuse} is not a valid unnamed fuse. If you are trying to burn a named fuse, use the namedFusesToBurn property.`,
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
encodedFuses |= fuse
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return encodedFuses
|
|
135
|
+
}
|
|
136
|
+
|
|
73
137
|
export default fullFuseEnum
|
|
@@ -8,6 +8,7 @@ type RecordItem = {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export type RecordOptions = {
|
|
11
|
+
clearRecords?: boolean
|
|
11
12
|
contentHash?: string
|
|
12
13
|
texts?: RecordItem[]
|
|
13
14
|
coinTypes?: RecordItem[]
|
|
@@ -79,6 +80,12 @@ export const generateRecordCallArray = (
|
|
|
79
80
|
) => {
|
|
80
81
|
const calls: string[] = []
|
|
81
82
|
|
|
83
|
+
if (records.clearRecords) {
|
|
84
|
+
calls.push(
|
|
85
|
+
resolver.interface.encodeFunctionData('clearRecords', [namehash]),
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
82
89
|
if (records.contentHash) {
|
|
83
90
|
const data = generateSingleRecordCall(
|
|
84
91
|
namehash,
|
|
@@ -6,7 +6,7 @@ import { labelhash } from './labels'
|
|
|
6
6
|
import { namehash } from './normalise'
|
|
7
7
|
import { generateRecordCallArray, RecordOptions } from './recordHelpers'
|
|
8
8
|
|
|
9
|
-
const MAX_INT_64 = 2n ** 64n - 1n
|
|
9
|
+
export const MAX_INT_64 = 2n ** 64n - 1n
|
|
10
10
|
|
|
11
11
|
export type BaseRegistrationParams = {
|
|
12
12
|
owner: string
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BigNumber } from 'ethers'
|
|
2
|
-
import {
|
|
2
|
+
import { toUtf8Bytes } from 'ethers/lib/utils'
|
|
3
|
+
import { ENSArgs } from '../index'
|
|
3
4
|
|
|
4
5
|
export type Expiry = string | number | Date | BigNumber
|
|
5
6
|
|
|
@@ -27,3 +28,9 @@ export const makeExpiry = async (
|
|
|
27
28
|
}
|
|
28
29
|
return MAX_EXPIRY
|
|
29
30
|
}
|
|
31
|
+
|
|
32
|
+
export const wrappedLabelLengthCheck = (label: string) => {
|
|
33
|
+
const bytes = toUtf8Bytes(label)
|
|
34
|
+
if (bytes.byteLength > 255)
|
|
35
|
+
throw new Error("Label can't be longer than 255 bytes")
|
|
36
|
+
}
|