@ensdomains/ensjs 3.0.0-alpha.57 → 3.0.0-alpha.59
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 +4 -16
- package/dist/cjs/utils/recordHelpers.js +3 -1
- package/dist/esm/contracts/getContractAddress.mjs +4 -16
- package/dist/esm/utils/recordHelpers.mjs +3 -1
- package/package.json +1 -1
- package/src/contracts/getContractAddress.ts +4 -16
- package/src/utils/recordHelpers.test.ts +18 -1
- package/src/utils/recordHelpers.ts +3 -1
|
@@ -24,42 +24,31 @@ module.exports = __toCommonJS(getContractAddress_exports);
|
|
|
24
24
|
const addresses = {
|
|
25
25
|
BaseRegistrarImplementation: {
|
|
26
26
|
"1": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
|
|
27
|
-
"3": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
|
|
28
|
-
"4": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
|
|
29
27
|
"5": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85"
|
|
30
28
|
},
|
|
31
29
|
DNSRegistrar: {
|
|
32
30
|
"1": "0x58774Bb8acD458A640aF0B88238369A167546ef2",
|
|
33
|
-
"3": "0xdB328BA5FEcb432AF325Ca59E3778441eF5aa14F",
|
|
34
31
|
"5": "0x8edc487D26F6c8Fa76e032066A3D4F87E273515d"
|
|
35
32
|
},
|
|
36
33
|
ETHRegistrarController: {
|
|
37
|
-
"1": "
|
|
38
|
-
"3": "0xa5627AB7Ae47063B533622C34FEBDb52d3281dF8",
|
|
39
|
-
"4": "0x283af0b28c62c092c9727f1ee09c02ca627eb7f5",
|
|
34
|
+
"1": "0x253553366Da8546fC250F225fe3d25d0C782303b",
|
|
40
35
|
"5": "0xCc5e7dB10E65EED1BBD105359e7268aa660f6734"
|
|
41
36
|
},
|
|
42
37
|
Multicall: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
43
38
|
NameWrapper: {
|
|
44
|
-
"1": "
|
|
45
|
-
"3": "0xF82155e2a43Be0871821E9654Fc8Ae894FB8307C",
|
|
46
|
-
"4": "0x0000000000000000000000000000000000000000",
|
|
39
|
+
"1": "0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401",
|
|
47
40
|
"5": "0x114D4603199df73e7D157787f8778E21fCd13066"
|
|
48
41
|
},
|
|
49
42
|
PublicResolver: {
|
|
50
|
-
"1": "
|
|
51
|
-
"3": "0x13F0659Ee6bb7484C884FEeFb7F75C93951ef837",
|
|
43
|
+
"1": "0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63",
|
|
52
44
|
"5": "0xd7a4F6473f32aC2Af804B3686AE8F1932bC35750"
|
|
53
45
|
},
|
|
54
46
|
ENSRegistry: {
|
|
55
47
|
"1": "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e",
|
|
56
|
-
"3": "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e",
|
|
57
|
-
"4": "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e",
|
|
58
48
|
"5": "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e"
|
|
59
49
|
},
|
|
60
50
|
ReverseRegistrar: {
|
|
61
|
-
"1": "
|
|
62
|
-
"3": "0x806246b52f8cB61655d3038c58D2f63Aa55d4edE",
|
|
51
|
+
"1": "0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb",
|
|
63
52
|
"5": "0x4f7A657451358a22dc397d5eE7981FfC526cd856"
|
|
64
53
|
},
|
|
65
54
|
UniversalResolver: {
|
|
@@ -68,7 +57,6 @@ const addresses = {
|
|
|
68
57
|
},
|
|
69
58
|
BulkRenewal: {
|
|
70
59
|
"1": "0xfF252725f6122A92551A5FA9a6b6bf10eb0Be035",
|
|
71
|
-
"3": "0x051b02245D826757EfaF5C6209D4D79FB39FBC45",
|
|
72
60
|
"5": "0xa9e1df95a79C768aA435805b28E1B54Bb5ead063"
|
|
73
61
|
}
|
|
74
62
|
};
|
|
@@ -86,6 +86,8 @@ function generateSingleRecordCall(namehash, resolver, type) {
|
|
|
86
86
|
if (encoded.error)
|
|
87
87
|
throw new Error(encoded.error);
|
|
88
88
|
_contentHash = encoded.encoded;
|
|
89
|
+
} else {
|
|
90
|
+
_contentHash = "0x";
|
|
89
91
|
}
|
|
90
92
|
return resolver.interface.encodeFunctionData("setContenthash", [
|
|
91
93
|
namehash,
|
|
@@ -130,7 +132,7 @@ const generateRecordCallArray = (namehash, records, resolver) => {
|
|
|
130
132
|
resolver.interface.encodeFunctionData("clearRecords", [namehash])
|
|
131
133
|
);
|
|
132
134
|
}
|
|
133
|
-
if (records.contentHash) {
|
|
135
|
+
if (typeof records.contentHash === "string") {
|
|
134
136
|
const data = generateSingleRecordCall(
|
|
135
137
|
namehash,
|
|
136
138
|
resolver,
|
|
@@ -2,42 +2,31 @@
|
|
|
2
2
|
var addresses = {
|
|
3
3
|
BaseRegistrarImplementation: {
|
|
4
4
|
"1": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
|
|
5
|
-
"3": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
|
|
6
|
-
"4": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
|
|
7
5
|
"5": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85"
|
|
8
6
|
},
|
|
9
7
|
DNSRegistrar: {
|
|
10
8
|
"1": "0x58774Bb8acD458A640aF0B88238369A167546ef2",
|
|
11
|
-
"3": "0xdB328BA5FEcb432AF325Ca59E3778441eF5aa14F",
|
|
12
9
|
"5": "0x8edc487D26F6c8Fa76e032066A3D4F87E273515d"
|
|
13
10
|
},
|
|
14
11
|
ETHRegistrarController: {
|
|
15
|
-
"1": "
|
|
16
|
-
"3": "0xa5627AB7Ae47063B533622C34FEBDb52d3281dF8",
|
|
17
|
-
"4": "0x283af0b28c62c092c9727f1ee09c02ca627eb7f5",
|
|
12
|
+
"1": "0x253553366Da8546fC250F225fe3d25d0C782303b",
|
|
18
13
|
"5": "0xCc5e7dB10E65EED1BBD105359e7268aa660f6734"
|
|
19
14
|
},
|
|
20
15
|
Multicall: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
21
16
|
NameWrapper: {
|
|
22
|
-
"1": "
|
|
23
|
-
"3": "0xF82155e2a43Be0871821E9654Fc8Ae894FB8307C",
|
|
24
|
-
"4": "0x0000000000000000000000000000000000000000",
|
|
17
|
+
"1": "0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401",
|
|
25
18
|
"5": "0x114D4603199df73e7D157787f8778E21fCd13066"
|
|
26
19
|
},
|
|
27
20
|
PublicResolver: {
|
|
28
|
-
"1": "
|
|
29
|
-
"3": "0x13F0659Ee6bb7484C884FEeFb7F75C93951ef837",
|
|
21
|
+
"1": "0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63",
|
|
30
22
|
"5": "0xd7a4F6473f32aC2Af804B3686AE8F1932bC35750"
|
|
31
23
|
},
|
|
32
24
|
ENSRegistry: {
|
|
33
25
|
"1": "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e",
|
|
34
|
-
"3": "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e",
|
|
35
|
-
"4": "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e",
|
|
36
26
|
"5": "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e"
|
|
37
27
|
},
|
|
38
28
|
ReverseRegistrar: {
|
|
39
|
-
"1": "
|
|
40
|
-
"3": "0x806246b52f8cB61655d3038c58D2f63Aa55d4edE",
|
|
29
|
+
"1": "0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb",
|
|
41
30
|
"5": "0x4f7A657451358a22dc397d5eE7981FfC526cd856"
|
|
42
31
|
},
|
|
43
32
|
UniversalResolver: {
|
|
@@ -46,7 +35,6 @@ var addresses = {
|
|
|
46
35
|
},
|
|
47
36
|
BulkRenewal: {
|
|
48
37
|
"1": "0xfF252725f6122A92551A5FA9a6b6bf10eb0Be035",
|
|
49
|
-
"3": "0x051b02245D826757EfaF5C6209D4D79FB39FBC45",
|
|
50
38
|
"5": "0xa9e1df95a79C768aA435805b28E1B54Bb5ead063"
|
|
51
39
|
}
|
|
52
40
|
};
|
|
@@ -55,6 +55,8 @@ function generateSingleRecordCall(namehash, resolver, type) {
|
|
|
55
55
|
if (encoded.error)
|
|
56
56
|
throw new Error(encoded.error);
|
|
57
57
|
_contentHash = encoded.encoded;
|
|
58
|
+
} else {
|
|
59
|
+
_contentHash = "0x";
|
|
58
60
|
}
|
|
59
61
|
return resolver.interface.encodeFunctionData("setContenthash", [
|
|
60
62
|
namehash,
|
|
@@ -99,7 +101,7 @@ var generateRecordCallArray = (namehash, records, resolver) => {
|
|
|
99
101
|
resolver.interface.encodeFunctionData("clearRecords", [namehash])
|
|
100
102
|
);
|
|
101
103
|
}
|
|
102
|
-
if (records.contentHash) {
|
|
104
|
+
if (typeof records.contentHash === "string") {
|
|
103
105
|
const data = generateSingleRecordCall(
|
|
104
106
|
namehash,
|
|
105
107
|
resolver,
|
package/package.json
CHANGED
|
@@ -7,42 +7,31 @@ const addresses: Record<
|
|
|
7
7
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
8
8
|
BaseRegistrarImplementation: {
|
|
9
9
|
'1': '0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85',
|
|
10
|
-
'3': '0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85',
|
|
11
|
-
'4': '0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85',
|
|
12
10
|
'5': '0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85',
|
|
13
11
|
},
|
|
14
12
|
DNSRegistrar: {
|
|
15
13
|
'1': '0x58774Bb8acD458A640aF0B88238369A167546ef2',
|
|
16
|
-
'3': '0xdB328BA5FEcb432AF325Ca59E3778441eF5aa14F',
|
|
17
14
|
'5': '0x8edc487D26F6c8Fa76e032066A3D4F87E273515d',
|
|
18
15
|
},
|
|
19
16
|
ETHRegistrarController: {
|
|
20
|
-
'1': '
|
|
21
|
-
'3': '0xa5627AB7Ae47063B533622C34FEBDb52d3281dF8',
|
|
22
|
-
'4': '0x283af0b28c62c092c9727f1ee09c02ca627eb7f5',
|
|
17
|
+
'1': '0x253553366Da8546fC250F225fe3d25d0C782303b',
|
|
23
18
|
'5': '0xCc5e7dB10E65EED1BBD105359e7268aa660f6734',
|
|
24
19
|
},
|
|
25
20
|
Multicall: '0xcA11bde05977b3631167028862bE2a173976CA11',
|
|
26
21
|
NameWrapper: {
|
|
27
|
-
'1': '
|
|
28
|
-
'3': '0xF82155e2a43Be0871821E9654Fc8Ae894FB8307C',
|
|
29
|
-
'4': '0x0000000000000000000000000000000000000000',
|
|
22
|
+
'1': '0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401',
|
|
30
23
|
'5': '0x114D4603199df73e7D157787f8778E21fCd13066',
|
|
31
24
|
},
|
|
32
25
|
PublicResolver: {
|
|
33
|
-
'1': '
|
|
34
|
-
'3': '0x13F0659Ee6bb7484C884FEeFb7F75C93951ef837',
|
|
26
|
+
'1': '0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63',
|
|
35
27
|
'5': '0xd7a4F6473f32aC2Af804B3686AE8F1932bC35750',
|
|
36
28
|
},
|
|
37
29
|
ENSRegistry: {
|
|
38
30
|
'1': '0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e',
|
|
39
|
-
'3': '0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e',
|
|
40
|
-
'4': '0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e',
|
|
41
31
|
'5': '0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e',
|
|
42
32
|
},
|
|
43
33
|
ReverseRegistrar: {
|
|
44
|
-
'1': '
|
|
45
|
-
'3': '0x806246b52f8cB61655d3038c58D2f63Aa55d4edE',
|
|
34
|
+
'1': '0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb',
|
|
46
35
|
'5': '0x4f7A657451358a22dc397d5eE7981FfC526cd856',
|
|
47
36
|
},
|
|
48
37
|
UniversalResolver: {
|
|
@@ -51,7 +40,6 @@ const addresses: Record<
|
|
|
51
40
|
},
|
|
52
41
|
BulkRenewal: {
|
|
53
42
|
'1': '0xfF252725f6122A92551A5FA9a6b6bf10eb0Be035',
|
|
54
|
-
'3': '0x051b02245D826757EfaF5C6209D4D79FB39FBC45',
|
|
55
43
|
'5': '0xa9e1df95a79C768aA435805b28E1B54Bb5ead063',
|
|
56
44
|
},
|
|
57
45
|
/* eslint-enable @typescript-eslint/naming-convention */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PublicResolver__factory } from '../generated'
|
|
2
2
|
import { namehash } from './normalise'
|
|
3
|
-
import { generateSetAddr } from './recordHelpers'
|
|
3
|
+
import { generateRecordCallArray, generateSetAddr } from './recordHelpers'
|
|
4
4
|
|
|
5
5
|
describe('generateSetAddr()', () => {
|
|
6
6
|
it('should allow empty string as address', () => {
|
|
@@ -17,3 +17,20 @@ describe('generateSetAddr()', () => {
|
|
|
17
17
|
).not.toThrowError()
|
|
18
18
|
})
|
|
19
19
|
})
|
|
20
|
+
|
|
21
|
+
describe('generateRecordCallArray()', () => {
|
|
22
|
+
it('should allow empty string as contenthash', () => {
|
|
23
|
+
expect(
|
|
24
|
+
generateRecordCallArray(
|
|
25
|
+
namehash('test'),
|
|
26
|
+
{ contentHash: '' },
|
|
27
|
+
PublicResolver__factory.connect(
|
|
28
|
+
'0x0000000000000000000000000000000000000000',
|
|
29
|
+
undefined as any,
|
|
30
|
+
),
|
|
31
|
+
),
|
|
32
|
+
).toEqual([
|
|
33
|
+
'0x304e6ade04f740db81dc36c853ab4205bddd785f46e79ccedca351fc6dfcbd8cc9a33dd600000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000',
|
|
34
|
+
])
|
|
35
|
+
})
|
|
36
|
+
})
|
|
@@ -99,6 +99,8 @@ export function generateSingleRecordCall<T extends RecordTypes>(
|
|
|
99
99
|
const encoded = encodeContenthash(record)
|
|
100
100
|
if (encoded.error) throw new Error(encoded.error)
|
|
101
101
|
_contentHash = encoded.encoded as string
|
|
102
|
+
} else {
|
|
103
|
+
_contentHash = '0x'
|
|
102
104
|
}
|
|
103
105
|
return resolver.interface.encodeFunctionData('setContenthash', [
|
|
104
106
|
namehash,
|
|
@@ -150,7 +152,7 @@ export const generateRecordCallArray = (
|
|
|
150
152
|
)
|
|
151
153
|
}
|
|
152
154
|
|
|
153
|
-
if (records.contentHash) {
|
|
155
|
+
if (typeof records.contentHash === 'string') {
|
|
154
156
|
const data = generateSingleRecordCall(
|
|
155
157
|
namehash,
|
|
156
158
|
resolver,
|