@ensdomains/ensjs 3.0.0-alpha.56 → 3.0.0-alpha.58
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/functions/getWrapperData.js +10 -2
- package/dist/cjs/utils/consts.js +2 -0
- package/dist/esm/contracts/getContractAddress.mjs +4 -16
- package/dist/esm/functions/getWrapperData.mjs +10 -2
- package/dist/esm/utils/consts.mjs +2 -0
- package/dist/types/utils/consts.d.ts +1 -0
- package/package.json +1 -1
- package/src/contracts/getContractAddress.ts +4 -16
- package/src/functions/getWrapperData.test.ts +18 -0
- package/src/functions/getWrapperData.ts +11 -4
- package/src/utils/consts.ts +1 -0
|
@@ -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
|
};
|
|
@@ -21,7 +21,7 @@ __export(getWrapperData_exports, {
|
|
|
21
21
|
default: () => getWrapperData_default
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(getWrapperData_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_consts = require("../utils/consts");
|
|
25
25
|
var import_fuses = require("../utils/fuses");
|
|
26
26
|
var import_normalise = require("../utils/normalise");
|
|
27
27
|
const raw = async ({ contracts }, name) => {
|
|
@@ -39,7 +39,15 @@ const decode = async ({ contracts }, data) => {
|
|
|
39
39
|
data
|
|
40
40
|
);
|
|
41
41
|
const fuseObj = (0, import_fuses.decodeFuses)(fuses);
|
|
42
|
-
|
|
42
|
+
let expiryDate;
|
|
43
|
+
if (expiry.gt(0)) {
|
|
44
|
+
const msBigNumber = expiry.mul(1e3);
|
|
45
|
+
if (msBigNumber.gte(import_consts.MAX_DATE_INT)) {
|
|
46
|
+
expiryDate = new Date(import_consts.MAX_DATE_INT);
|
|
47
|
+
} else {
|
|
48
|
+
expiryDate = new Date(msBigNumber.toNumber());
|
|
49
|
+
}
|
|
50
|
+
}
|
|
43
51
|
return {
|
|
44
52
|
...fuseObj,
|
|
45
53
|
expiryDate,
|
package/dist/cjs/utils/consts.js
CHANGED
|
@@ -19,10 +19,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var consts_exports = {};
|
|
20
20
|
__export(consts_exports, {
|
|
21
21
|
EMPTY_ADDRESS: () => EMPTY_ADDRESS,
|
|
22
|
+
MAX_DATE_INT: () => MAX_DATE_INT,
|
|
22
23
|
MAX_INT_64: () => MAX_INT_64,
|
|
23
24
|
MINIMUM_DOT_ETH_CHARS: () => MINIMUM_DOT_ETH_CHARS
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(consts_exports);
|
|
26
27
|
const EMPTY_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
27
28
|
const MAX_INT_64 = BigInt("18446744073709551615");
|
|
29
|
+
const MAX_DATE_INT = 864e13;
|
|
28
30
|
const MINIMUM_DOT_ETH_CHARS = 3;
|
|
@@ -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
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/functions/getWrapperData.ts
|
|
2
|
-
import {
|
|
2
|
+
import { MAX_DATE_INT } from "../utils/consts.mjs";
|
|
3
3
|
import { decodeFuses } from "../utils/fuses.mjs";
|
|
4
4
|
import { namehash } from "../utils/normalise.mjs";
|
|
5
5
|
var raw = async ({ contracts }, name) => {
|
|
@@ -17,7 +17,15 @@ var decode = async ({ contracts }, data) => {
|
|
|
17
17
|
data
|
|
18
18
|
);
|
|
19
19
|
const fuseObj = decodeFuses(fuses);
|
|
20
|
-
|
|
20
|
+
let expiryDate;
|
|
21
|
+
if (expiry.gt(0)) {
|
|
22
|
+
const msBigNumber = expiry.mul(1e3);
|
|
23
|
+
if (msBigNumber.gte(MAX_DATE_INT)) {
|
|
24
|
+
expiryDate = new Date(MAX_DATE_INT);
|
|
25
|
+
} else {
|
|
26
|
+
expiryDate = new Date(msBigNumber.toNumber());
|
|
27
|
+
}
|
|
28
|
+
}
|
|
21
29
|
return {
|
|
22
30
|
...fuseObj,
|
|
23
31
|
expiryDate,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// src/utils/consts.ts
|
|
2
2
|
var EMPTY_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
3
3
|
var MAX_INT_64 = BigInt("18446744073709551615");
|
|
4
|
+
var MAX_DATE_INT = 864e13;
|
|
4
5
|
var MINIMUM_DOT_ETH_CHARS = 3;
|
|
5
6
|
export {
|
|
6
7
|
EMPTY_ADDRESS,
|
|
8
|
+
MAX_DATE_INT,
|
|
7
9
|
MAX_INT_64,
|
|
8
10
|
MINIMUM_DOT_ETH_CHARS
|
|
9
11
|
};
|
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 */
|
|
@@ -69,4 +69,22 @@ describe('getWrapperData', () => {
|
|
|
69
69
|
expect(Number.isNaN(result.expiryDate?.getTime())).toBe(false)
|
|
70
70
|
}
|
|
71
71
|
})
|
|
72
|
+
it('should return correct expiry for large expiry', async () => {
|
|
73
|
+
const result = await ensInstance.getWrapperData('wrapped-big-duration.eth')
|
|
74
|
+
expect(result).toBeTruthy()
|
|
75
|
+
if (result) {
|
|
76
|
+
expect(result.expiryDate).toBeInstanceOf(Date)
|
|
77
|
+
expect(result.expiryDate!.getFullYear()).toBe(275760)
|
|
78
|
+
expect(Number.isNaN(result.expiryDate?.getTime())).toBe(false)
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
it('should return correct max expiry for expiry larger than maximum for date', async () => {
|
|
82
|
+
const result = await ensInstance.getWrapperData('wrapped-max-duration.eth')
|
|
83
|
+
expect(result).toBeTruthy()
|
|
84
|
+
if (result) {
|
|
85
|
+
expect(result.expiryDate).toBeInstanceOf(Date)
|
|
86
|
+
expect(result.expiryDate!.getFullYear()).toBe(275760)
|
|
87
|
+
expect(Number.isNaN(result.expiryDate?.getTime())).toBe(false)
|
|
88
|
+
}
|
|
89
|
+
})
|
|
72
90
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BigNumber } from '@ethersproject/bignumber'
|
|
2
2
|
import { ENSArgs } from '../index'
|
|
3
|
+
import { MAX_DATE_INT } from '../utils/consts'
|
|
3
4
|
import { decodeFuses } from '../utils/fuses'
|
|
4
5
|
import { namehash } from '../utils/normalise'
|
|
5
6
|
|
|
@@ -21,10 +22,16 @@ const decode = async ({ contracts }: ENSArgs<'contracts'>, data: string) => {
|
|
|
21
22
|
|
|
22
23
|
const fuseObj = decodeFuses(fuses)
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
let expiryDate: Date | undefined
|
|
26
|
+
|
|
27
|
+
if (expiry.gt(0)) {
|
|
28
|
+
const msBigNumber = expiry.mul(1000)
|
|
29
|
+
if (msBigNumber.gte(MAX_DATE_INT)) {
|
|
30
|
+
expiryDate = new Date(MAX_DATE_INT)
|
|
31
|
+
} else {
|
|
32
|
+
expiryDate = new Date(msBigNumber.toNumber())
|
|
33
|
+
}
|
|
34
|
+
}
|
|
28
35
|
|
|
29
36
|
return {
|
|
30
37
|
...fuseObj,
|
package/src/utils/consts.ts
CHANGED