@ensdomains/ensjs 3.0.0-alpha.10 → 3.0.0-alpha.13
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/baseRegistrar.d.ts +1 -1
- package/dist/cjs/contracts/index.d.ts +3 -3
- package/dist/cjs/contracts/multicall.d.ts +1 -1
- package/dist/cjs/contracts/registry.d.ts +1 -1
- package/dist/cjs/functions/burnFuses.js +1 -1
- package/dist/cjs/functions/commitName.d.ts +26 -0
- package/dist/cjs/functions/commitName.js +24 -0
- package/dist/cjs/functions/createSubname.d.ts +3 -1
- package/dist/cjs/functions/createSubname.js +4 -2
- package/dist/cjs/functions/deleteSubname.d.ts +1 -1
- package/dist/cjs/functions/deleteSubname.js +3 -2
- package/dist/cjs/functions/getExpiry.d.ts +9 -2
- package/dist/cjs/functions/getExpiry.js +52 -7
- package/dist/cjs/functions/getFuses.d.ts +2 -3
- package/dist/cjs/functions/getFuses.js +4 -13
- package/dist/cjs/functions/getHistory.d.ts +0 -30
- package/dist/cjs/functions/getHistory.js +3 -99
- package/dist/cjs/functions/getName.d.ts +2 -2
- package/dist/cjs/functions/getName.js +1 -1
- package/dist/cjs/functions/getProfile.js +1 -1
- package/dist/cjs/functions/getSpecificRecord.js +8 -1
- package/dist/cjs/functions/getSubnames.d.ts +1 -1
- package/dist/cjs/functions/getSubnames.js +1 -1
- package/dist/cjs/functions/registerName.d.ts +11 -0
- package/dist/cjs/functions/registerName.js +19 -0
- package/dist/cjs/functions/renewName.d.ts +6 -0
- package/dist/cjs/functions/renewName.js +10 -0
- package/dist/cjs/functions/transferSubname.d.ts +12 -3
- package/dist/cjs/functions/transferSubname.js +5 -3
- package/dist/cjs/functions/wrapName.d.ts +3 -1
- package/dist/cjs/functions/wrapName.js +35 -29
- package/dist/cjs/generated/BaseRegistrarImplementation.d.ts +222 -201
- package/dist/cjs/generated/DNSRegistrar.d.ts +68 -64
- package/dist/cjs/generated/DNSSECImpl.d.ts +111 -111
- package/dist/cjs/generated/DefaultReverseResolver.d.ts +17 -17
- package/dist/cjs/generated/ENSRegistry.d.ts +126 -111
- package/dist/cjs/generated/ETHRegistrarController.d.ts +111 -109
- package/dist/cjs/generated/Multicall.d.ts +60 -60
- package/dist/cjs/generated/NameWrapper.d.ts +493 -354
- package/dist/cjs/generated/P256SHA256Algorithm.d.ts +11 -7
- package/dist/cjs/generated/PublicResolver.d.ts +259 -235
- package/dist/cjs/generated/RSASHA1Algorithm.d.ts +11 -7
- package/dist/cjs/generated/RSASHA256Algorithm.d.ts +11 -7
- package/dist/cjs/generated/ReverseRegistrar.d.ts +112 -103
- package/dist/cjs/generated/Root.d.ts +77 -77
- package/dist/cjs/generated/SHA1Digest.d.ts +7 -7
- package/dist/cjs/generated/SHA1NSEC3Digest.d.ts +11 -7
- package/dist/cjs/generated/SHA256Digest.d.ts +7 -7
- package/dist/cjs/generated/StaticMetadataService.d.ts +7 -7
- package/dist/cjs/generated/TLDPublicSuffixList.d.ts +7 -7
- package/dist/cjs/generated/UniversalResolver.d.ts +31 -31
- package/dist/cjs/generated/common.d.ts +1 -0
- package/dist/cjs/generated/factories/DNSRegistrar__factory.d.ts +3 -15
- package/dist/cjs/generated/factories/DNSRegistrar__factory.js +3 -26
- package/dist/cjs/generated/factories/DNSSECImpl__factory.d.ts +3 -15
- package/dist/cjs/generated/factories/DNSSECImpl__factory.js +3 -26
- package/dist/cjs/generated/factories/ETHRegistrarController__factory.js +14 -4
- package/dist/cjs/generated/factories/NameWrapper__factory.js +210 -79
- package/dist/cjs/generated/factories/P256SHA256Algorithm__factory.d.ts +3 -15
- package/dist/cjs/generated/factories/P256SHA256Algorithm__factory.js +3 -26
- package/dist/cjs/generated/factories/RSASHA1Algorithm__factory.d.ts +3 -15
- package/dist/cjs/generated/factories/RSASHA1Algorithm__factory.js +3 -26
- package/dist/cjs/generated/factories/RSASHA256Algorithm__factory.d.ts +3 -15
- package/dist/cjs/generated/factories/RSASHA256Algorithm__factory.js +3 -26
- package/dist/cjs/generated/factories/SHA1Digest__factory.d.ts +3 -15
- package/dist/cjs/generated/factories/SHA1Digest__factory.js +3 -26
- package/dist/cjs/generated/factories/SHA1NSEC3Digest__factory.d.ts +3 -15
- package/dist/cjs/generated/factories/SHA1NSEC3Digest__factory.js +3 -26
- package/dist/cjs/generated/factories/SHA256Digest__factory.d.ts +3 -15
- package/dist/cjs/generated/factories/SHA256Digest__factory.js +3 -26
- package/dist/cjs/generated/factories/TLDPublicSuffixList__factory.d.ts +3 -15
- package/dist/cjs/generated/factories/TLDPublicSuffixList__factory.js +3 -26
- package/dist/cjs/generated/factories/index.d.ts +14 -0
- package/dist/cjs/generated/factories/index.js +29 -1
- package/dist/cjs/generated/index.d.ts +29 -1
- package/dist/cjs/generated/index.js +31 -3
- package/dist/cjs/index.d.ts +24 -40
- package/dist/cjs/index.js +9 -5
- package/dist/cjs/utils/registerHelpers.d.ts +44 -16
- package/dist/cjs/utils/registerHelpers.js +43 -15
- package/dist/cjs/utils/wrapperExpiry.d.ts +5 -0
- package/dist/cjs/utils/wrapperExpiry.js +30 -0
- package/dist/cjs/utils/writeTx.d.ts +18 -1
- package/dist/cjs/utils/writeTx.js +4 -1
- package/dist/esm/contracts/baseRegistrar.d.ts +1 -1
- package/dist/esm/contracts/index.d.ts +3 -3
- package/dist/esm/contracts/multicall.d.ts +1 -1
- package/dist/esm/contracts/registry.d.ts +1 -1
- package/dist/esm/functions/burnFuses.js +1 -1
- package/dist/esm/functions/commitName.d.ts +26 -0
- package/dist/esm/functions/commitName.js +21 -0
- package/dist/esm/functions/createSubname.d.ts +3 -1
- package/dist/esm/functions/createSubname.js +4 -2
- package/dist/esm/functions/deleteSubname.d.ts +1 -1
- package/dist/esm/functions/deleteSubname.js +3 -2
- package/dist/esm/functions/getExpiry.d.ts +9 -2
- package/dist/esm/functions/getExpiry.js +52 -7
- package/dist/esm/functions/getFuses.d.ts +2 -3
- package/dist/esm/functions/getFuses.js +5 -14
- package/dist/esm/functions/getHistory.d.ts +0 -30
- package/dist/esm/functions/getHistory.js +2 -96
- package/dist/esm/functions/getName.d.ts +2 -2
- package/dist/esm/functions/getName.js +1 -1
- package/dist/esm/functions/getProfile.js +1 -1
- package/dist/esm/functions/getSpecificRecord.js +8 -1
- package/dist/esm/functions/getSubnames.d.ts +1 -1
- package/dist/esm/functions/getSubnames.js +1 -1
- package/dist/esm/functions/registerName.d.ts +11 -0
- package/dist/esm/functions/registerName.js +16 -0
- package/dist/esm/functions/renewName.d.ts +6 -0
- package/dist/esm/functions/renewName.js +7 -0
- package/dist/esm/functions/transferSubname.d.ts +12 -3
- package/dist/esm/functions/transferSubname.js +5 -3
- package/dist/esm/functions/wrapName.d.ts +3 -1
- package/dist/esm/functions/wrapName.js +35 -29
- package/dist/esm/generated/BaseRegistrarImplementation.d.ts +222 -201
- package/dist/esm/generated/DNSRegistrar.d.ts +68 -64
- package/dist/esm/generated/DNSSECImpl.d.ts +111 -111
- package/dist/esm/generated/DefaultReverseResolver.d.ts +17 -17
- package/dist/esm/generated/ENSRegistry.d.ts +126 -111
- package/dist/esm/generated/ETHRegistrarController.d.ts +111 -109
- package/dist/esm/generated/Multicall.d.ts +60 -60
- package/dist/esm/generated/NameWrapper.d.ts +493 -354
- package/dist/esm/generated/P256SHA256Algorithm.d.ts +11 -7
- package/dist/esm/generated/PublicResolver.d.ts +259 -235
- package/dist/esm/generated/RSASHA1Algorithm.d.ts +11 -7
- package/dist/esm/generated/RSASHA256Algorithm.d.ts +11 -7
- package/dist/esm/generated/ReverseRegistrar.d.ts +112 -103
- package/dist/esm/generated/Root.d.ts +77 -77
- package/dist/esm/generated/SHA1Digest.d.ts +7 -7
- package/dist/esm/generated/SHA1NSEC3Digest.d.ts +11 -7
- package/dist/esm/generated/SHA256Digest.d.ts +7 -7
- package/dist/esm/generated/StaticMetadataService.d.ts +7 -7
- package/dist/esm/generated/TLDPublicSuffixList.d.ts +7 -7
- package/dist/esm/generated/UniversalResolver.d.ts +31 -31
- package/dist/esm/generated/common.d.ts +1 -0
- package/dist/esm/generated/factories/DNSRegistrar__factory.d.ts +3 -15
- package/dist/esm/generated/factories/DNSRegistrar__factory.js +2 -25
- package/dist/esm/generated/factories/DNSSECImpl__factory.d.ts +3 -15
- package/dist/esm/generated/factories/DNSSECImpl__factory.js +2 -25
- package/dist/esm/generated/factories/ETHRegistrarController__factory.js +14 -4
- package/dist/esm/generated/factories/NameWrapper__factory.js +210 -79
- package/dist/esm/generated/factories/P256SHA256Algorithm__factory.d.ts +3 -15
- package/dist/esm/generated/factories/P256SHA256Algorithm__factory.js +2 -25
- package/dist/esm/generated/factories/RSASHA1Algorithm__factory.d.ts +3 -15
- package/dist/esm/generated/factories/RSASHA1Algorithm__factory.js +2 -25
- package/dist/esm/generated/factories/RSASHA256Algorithm__factory.d.ts +3 -15
- package/dist/esm/generated/factories/RSASHA256Algorithm__factory.js +2 -25
- package/dist/esm/generated/factories/SHA1Digest__factory.d.ts +3 -15
- package/dist/esm/generated/factories/SHA1Digest__factory.js +2 -25
- package/dist/esm/generated/factories/SHA1NSEC3Digest__factory.d.ts +3 -15
- package/dist/esm/generated/factories/SHA1NSEC3Digest__factory.js +2 -25
- package/dist/esm/generated/factories/SHA256Digest__factory.d.ts +3 -15
- package/dist/esm/generated/factories/SHA256Digest__factory.js +2 -25
- package/dist/esm/generated/factories/TLDPublicSuffixList__factory.d.ts +3 -15
- package/dist/esm/generated/factories/TLDPublicSuffixList__factory.js +2 -25
- package/dist/esm/generated/factories/index.d.ts +14 -0
- package/dist/esm/generated/factories/index.js +14 -0
- package/dist/esm/generated/index.d.ts +29 -1
- package/dist/esm/generated/index.js +15 -1
- package/dist/esm/index.d.ts +24 -40
- package/dist/esm/index.js +9 -5
- package/dist/esm/utils/registerHelpers.d.ts +44 -16
- package/dist/esm/utils/registerHelpers.js +40 -14
- package/dist/esm/utils/wrapperExpiry.d.ts +5 -0
- package/dist/esm/utils/wrapperExpiry.js +26 -0
- package/dist/esm/utils/writeTx.d.ts +18 -1
- package/dist/esm/utils/writeTx.js +4 -1
- package/package.json +27 -28
- package/src/ABIs/Multicall.json +452 -0
- package/src/contracts/index.ts +1 -1
- package/src/functions/batch.test.ts +6 -6
- package/src/functions/batchWrappers.test.ts +5 -5
- package/src/functions/burnFuses.test.ts +5 -10
- package/src/functions/burnFuses.ts +1 -1
- package/src/functions/commitName.test.ts +61 -0
- package/src/functions/commitName.ts +36 -0
- package/src/functions/createSubname.test.ts +6 -10
- package/src/functions/createSubname.ts +14 -2
- package/src/functions/deleteSubname.test.ts +9 -28
- package/src/functions/deleteSubname.ts +3 -2
- package/src/functions/getDNSOwner.test.ts +1 -5
- package/src/functions/getExpiry.test.ts +26 -4
- package/src/functions/getExpiry.ts +87 -9
- package/src/functions/getFuses.test.ts +10 -33
- package/src/functions/getFuses.ts +10 -16
- package/src/functions/getHistory.test.ts +7 -79
- package/src/functions/getHistory.ts +2 -127
- package/src/functions/getName.test.ts +5 -5
- package/src/functions/getName.ts +1 -1
- package/src/functions/getNames.test.ts +97 -68
- package/src/functions/getOwner.test.ts +10 -25
- package/src/functions/getProfile.test.ts +32 -24
- package/src/functions/getProfile.ts +1 -1
- package/src/functions/getResolver.test.ts +2 -6
- package/src/functions/getSpecificRecord.test.ts +16 -13
- package/src/functions/getSpecificRecord.ts +10 -4
- package/src/functions/getSubnames.test.ts +21 -17
- package/src/functions/getSubnames.ts +9 -2
- package/src/functions/makeCommitment.test.ts +2 -2
- package/src/functions/registerName.test.ts +59 -0
- package/src/functions/registerName.ts +38 -0
- package/src/functions/renewName.test.ts +44 -0
- package/src/functions/renewName.ts +22 -0
- package/src/functions/setName.test.ts +10 -11
- package/src/functions/setRecord.test.ts +12 -9
- package/src/functions/setRecords.test.ts +6 -5
- package/src/functions/setResolver.test.ts +6 -9
- package/src/functions/transferName.test.ts +13 -27
- package/src/functions/transferSubname.test.ts +11 -30
- package/src/functions/transferSubname.ts +28 -10
- package/src/functions/unwrapName.test.ts +13 -28
- package/src/functions/wrapName.test.ts +109 -34
- package/src/functions/wrapName.ts +45 -29
- package/src/generated/BaseRegistrarImplementation.ts +382 -296
- package/src/generated/DNSRegistrar.ts +103 -89
- package/src/generated/DNSSECImpl.ts +180 -149
- package/src/generated/DefaultReverseResolver.ts +37 -21
- package/src/generated/ENSRegistry.ts +257 -184
- package/src/generated/ETHRegistrarController.ts +252 -191
- package/src/generated/Multicall.ts +73 -57
- package/src/generated/NameWrapper.ts +979 -649
- package/src/generated/P256SHA256Algorithm.ts +21 -16
- package/src/generated/PublicResolver.ts +452 -362
- package/src/generated/RSASHA1Algorithm.ts +21 -16
- package/src/generated/RSASHA256Algorithm.ts +21 -16
- package/src/generated/ReverseRegistrar.ts +193 -141
- package/src/generated/Root.ts +146 -86
- package/src/generated/SHA1Digest.ts +12 -11
- package/src/generated/SHA1NSEC3Digest.ts +21 -16
- package/src/generated/SHA256Digest.ts +12 -11
- package/src/generated/StaticMetadataService.ts +22 -6
- package/src/generated/TLDPublicSuffixList.ts +10 -6
- package/src/generated/UniversalResolver.ts +44 -40
- package/src/generated/common.ts +2 -0
- package/src/generated/factories/DNSRegistrar__factory.ts +4 -56
- package/src/generated/factories/DNSSECImpl__factory.ts +4 -49
- package/src/generated/factories/ETHRegistrarController__factory.ts +14 -4
- package/src/generated/factories/NameWrapper__factory.ts +210 -79
- package/src/generated/factories/P256SHA256Algorithm__factory.ts +4 -40
- package/src/generated/factories/RSASHA1Algorithm__factory.ts +4 -40
- package/src/generated/factories/RSASHA256Algorithm__factory.ts +4 -40
- package/src/generated/factories/SHA1Digest__factory.ts +4 -40
- package/src/generated/factories/SHA1NSEC3Digest__factory.ts +4 -40
- package/src/generated/factories/SHA256Digest__factory.ts +4 -40
- package/src/generated/factories/TLDPublicSuffixList__factory.ts +4 -40
- package/src/generated/factories/index.ts +14 -0
- package/src/generated/index.ts +29 -1
- package/src/index.ts +28 -26
- package/src/utils/registerHelpers.ts +107 -49
- package/src/utils/wrapperExpiry.ts +31 -0
- package/src/utils/writeTx.ts +12 -2
- package/dist/cjs/contracts/doNotCallOnChainUniversalResolverProxy.d.ts +0 -3
- package/dist/cjs/contracts/doNotCallOnChainUniversalResolverProxy.js +0 -4
- package/dist/cjs/generated/DoNotCallOnChainUniversalResolverProxy.d.ts +0 -144
- package/dist/cjs/generated/DoNotCallOnChainUniversalResolverProxy.js +0 -2
- package/dist/cjs/generated/factories/DoNotCallOnChainUniversalResolverProxy__factory.d.ts +0 -56
- package/dist/cjs/generated/factories/DoNotCallOnChainUniversalResolverProxy__factory.js +0 -171
- package/dist/esm/contracts/doNotCallOnChainUniversalResolverProxy.d.ts +0 -3
- package/dist/esm/contracts/doNotCallOnChainUniversalResolverProxy.js +0 -2
- package/dist/esm/generated/DoNotCallOnChainUniversalResolverProxy.d.ts +0 -144
- package/dist/esm/generated/DoNotCallOnChainUniversalResolverProxy.js +0 -1
- package/dist/esm/generated/factories/DoNotCallOnChainUniversalResolverProxy__factory.d.ts +0 -56
- package/dist/esm/generated/factories/DoNotCallOnChainUniversalResolverProxy__factory.js +0 -167
- package/src/ABIs/ETHRegistrarController.json +0 -494
- package/src/ABIs/NameWrapper.json +0 -1183
- package/src/ABIs/PublicResolver.json +0 -875
- package/src/ABIs/ReverseRegistrar.json +0 -323
- package/src/ABIs/StaticMetadataService.json +0 -32
- package/src/ABIs/UniversalResolver.json +0 -187
- package/src/contracts/doNotCallOnChainUniversalResolverProxy.ts +0 -5
- package/src/generated/DoNotCallOnChainUniversalResolverProxy.ts +0 -285
- package/src/generated/factories/DoNotCallOnChainUniversalResolverProxy__factory.ts +0 -186
- package/src/tests/populateTransaction.test.ts +0 -40
- package/src/tests/setup.ts +0 -53
- package/src/tests/signerInjection.test.ts +0 -46
- package/src/tests/withProvider.test.ts +0 -28
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { ethers } from 'ethers'
|
|
1
2
|
import { ENS } from '..'
|
|
2
3
|
import setup from '../tests/setup'
|
|
3
4
|
|
|
4
5
|
let ENSInstance: ENS
|
|
5
6
|
let revert: Awaited<ReturnType<typeof setup>>['revert']
|
|
7
|
+
let provider: ethers.providers.JsonRpcProvider
|
|
8
|
+
let accounts: string[]
|
|
6
9
|
|
|
7
10
|
beforeAll(async () => {
|
|
8
|
-
;({ ENSInstance, revert } = await setup())
|
|
11
|
+
;({ ENSInstance, revert, provider } = await setup())
|
|
12
|
+
accounts = await provider.listAccounts()
|
|
9
13
|
})
|
|
10
14
|
|
|
11
15
|
afterAll(async () => {
|
|
@@ -15,14 +19,14 @@ afterAll(async () => {
|
|
|
15
19
|
const checkRecords = (
|
|
16
20
|
result: Record<string, any> | undefined,
|
|
17
21
|
textLength = 3,
|
|
18
|
-
coinTypeLength =
|
|
22
|
+
coinTypeLength = 3,
|
|
19
23
|
) => {
|
|
20
24
|
expect(result).toBeDefined()
|
|
21
25
|
if (result) {
|
|
22
26
|
expect(result.records?.texts).toHaveLength(textLength)
|
|
23
27
|
expect(result.records?.coinTypes).toHaveLength(coinTypeLength)
|
|
24
28
|
expect(result.resolverAddress).toBe(
|
|
25
|
-
'
|
|
29
|
+
'0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8',
|
|
26
30
|
)
|
|
27
31
|
}
|
|
28
32
|
}
|
|
@@ -33,30 +37,30 @@ describe('getProfile', () => {
|
|
|
33
37
|
describe('with an address', () => {
|
|
34
38
|
it('should return a profile object with no other args', async () => {
|
|
35
39
|
const result = await ENSInstance.getProfile(
|
|
36
|
-
'
|
|
40
|
+
'0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
|
|
37
41
|
)
|
|
38
42
|
expect(result).toBeDefined()
|
|
39
43
|
if (result) {
|
|
40
|
-
expect((result as any).name).toBe('
|
|
44
|
+
expect((result as any).name).toBe('with-profile.eth')
|
|
41
45
|
expect((result as any).address).toBeUndefined()
|
|
42
46
|
checkRecords(result)
|
|
43
47
|
}
|
|
44
48
|
})
|
|
45
49
|
it('should return a profile object with specified records', async () => {
|
|
46
50
|
const result = await ENSInstance.getProfile(
|
|
47
|
-
'
|
|
51
|
+
'0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
|
|
48
52
|
{ texts: ['description', 'url'], coinTypes: ['ETC', '0'] },
|
|
49
53
|
)
|
|
50
54
|
expect(result).toBeDefined()
|
|
51
55
|
if (result) {
|
|
52
|
-
expect((result as any).name).toBe('
|
|
56
|
+
expect((result as any).name).toBe('with-profile.eth')
|
|
53
57
|
expect((result as any).address).toBeUndefined()
|
|
54
58
|
checkRecords(result, 2, 3)
|
|
55
59
|
}
|
|
56
60
|
})
|
|
57
61
|
it('should return a profile object with all of each specified record type', async () => {
|
|
58
62
|
const result = await ENSInstance.getProfile(
|
|
59
|
-
'
|
|
63
|
+
'0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
|
|
60
64
|
{ texts: true, coinTypes: true },
|
|
61
65
|
)
|
|
62
66
|
checkRecords(result)
|
|
@@ -70,37 +74,42 @@ describe('getProfile', () => {
|
|
|
70
74
|
})
|
|
71
75
|
describe('with a name', () => {
|
|
72
76
|
it('should return a profile object with no other args', async () => {
|
|
73
|
-
const result = await ENSInstance.getProfile('
|
|
77
|
+
const result = await ENSInstance.getProfile('with-profile.eth')
|
|
74
78
|
expect((result as any).address).toBe(
|
|
75
|
-
'
|
|
79
|
+
'0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
|
|
76
80
|
)
|
|
77
81
|
checkRecords(result)
|
|
78
82
|
})
|
|
79
83
|
it('should return a profile object with specified records', async () => {
|
|
80
|
-
const result = await ENSInstance.getProfile('
|
|
84
|
+
const result = await ENSInstance.getProfile('with-profile.eth', {
|
|
81
85
|
texts: ['description', 'url'],
|
|
82
86
|
coinTypes: ['ETC', '0'],
|
|
83
87
|
})
|
|
84
88
|
expect((result as any).address).toBe(
|
|
85
|
-
'
|
|
89
|
+
'0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
|
|
86
90
|
)
|
|
87
91
|
checkRecords(result, 2, 3)
|
|
88
92
|
})
|
|
89
93
|
it('should return a profile object with all of each specified record type', async () => {
|
|
90
|
-
const result = await ENSInstance.getProfile('
|
|
94
|
+
const result = await ENSInstance.getProfile('with-profile.eth', {
|
|
91
95
|
texts: true,
|
|
92
96
|
coinTypes: true,
|
|
93
97
|
})
|
|
94
98
|
checkRecords(result)
|
|
95
99
|
})
|
|
96
100
|
it('should return a profile object for a specified resolver', async () => {
|
|
97
|
-
const
|
|
98
|
-
|
|
101
|
+
const tx = await ENSInstance.wrapName('test123.eth', {
|
|
102
|
+
wrappedOwner: accounts[1],
|
|
103
|
+
addressOrIndex: 1,
|
|
104
|
+
})
|
|
105
|
+
await tx.wait()
|
|
106
|
+
const result = await ENSInstance.getProfile('test123.eth', {
|
|
107
|
+
resolverAddress: '0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8',
|
|
99
108
|
})
|
|
100
109
|
expect(result).toBeDefined()
|
|
101
|
-
expect(result?.address).toBe(
|
|
110
|
+
expect(result?.address).toBe(accounts[1])
|
|
102
111
|
expect(result?.resolverAddress).toBe(
|
|
103
|
-
'
|
|
112
|
+
'0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8',
|
|
104
113
|
)
|
|
105
114
|
})
|
|
106
115
|
it('should return undefined for an unregistered name', async () => {
|
|
@@ -110,22 +119,21 @@ describe('getProfile', () => {
|
|
|
110
119
|
})
|
|
111
120
|
describe('with an old resolver', () => {
|
|
112
121
|
it('should use fallback methods for a name with an older resolver (no multicall)', async () => {
|
|
113
|
-
const result = await ENSInstance.getProfile('
|
|
122
|
+
const result = await ENSInstance.getProfile('with-legacy-resolver.eth')
|
|
114
123
|
expect(result).toBeDefined()
|
|
115
124
|
if (result) {
|
|
116
125
|
expect(result.address).toBe(
|
|
117
|
-
'
|
|
126
|
+
'0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
|
|
127
|
+
)
|
|
128
|
+
expect(result.resolverAddress).toBe(
|
|
129
|
+
'0x5f3f1dbd7b74c6b46e8c44f98792a1daf8d69154',
|
|
118
130
|
)
|
|
119
131
|
}
|
|
120
132
|
})
|
|
121
133
|
})
|
|
122
134
|
describe('with an unmigrated name', () => {
|
|
123
|
-
beforeAll(async () => {
|
|
124
|
-
;({ ENSInstance } = await setup(true))
|
|
125
|
-
jest.setTimeout(20000)
|
|
126
|
-
})
|
|
127
135
|
it('should return an object with isMigrated false and a message', async () => {
|
|
128
|
-
const result = await ENSInstance.getProfile('
|
|
136
|
+
const result = await ENSInstance.getProfile('legacy.test')
|
|
129
137
|
expect(result).toBeTruthy()
|
|
130
138
|
if (result) {
|
|
131
139
|
expect(result.isMigrated).toBe(false)
|
|
@@ -362,7 +362,7 @@ const graphFetch = async (
|
|
|
362
362
|
;({ domain } = await client.request(query, { id }))
|
|
363
363
|
resolverResponse = domain?.resolver
|
|
364
364
|
} else {
|
|
365
|
-
const resolverId = `${resolverAddress}-${id}`
|
|
365
|
+
const resolverId = `${resolverAddress.toLowerCase()}-${id}`
|
|
366
366
|
;({ resolver: resolverResponse, domain } = await client.request(
|
|
367
367
|
customResolverQuery,
|
|
368
368
|
{ id, resolverId },
|
|
@@ -9,11 +9,7 @@ beforeAll(async () => {
|
|
|
9
9
|
|
|
10
10
|
describe('getResolver', () => {
|
|
11
11
|
it('should find the resolver for a name with a resolver', async () => {
|
|
12
|
-
const result = await ENSInstance.getResolver('
|
|
13
|
-
expect(result).toBe('
|
|
14
|
-
})
|
|
15
|
-
it('should return .eth resolver for an unregistered name', async () => {
|
|
16
|
-
const result = await ENSInstance.getResolver('test123123cool.eth')
|
|
17
|
-
expect(result).toBe('0x3E8Dc215A6E404A7Ba811DE5Da3ff2A809AE94E2')
|
|
12
|
+
const result = await ENSInstance.getResolver('with-profile.eth')
|
|
13
|
+
expect(result).toBe('0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8')
|
|
18
14
|
})
|
|
19
15
|
})
|
|
@@ -14,11 +14,11 @@ describe('getSpecificRecord', () => {
|
|
|
14
14
|
expect(result).toBeUndefined()
|
|
15
15
|
})
|
|
16
16
|
it('should return null for a name with no contenthash record', async () => {
|
|
17
|
-
const result = await ENSInstance.getContentHash('
|
|
17
|
+
const result = await ENSInstance.getContentHash('with-profile.eth')
|
|
18
18
|
expect(result).toBeUndefined()
|
|
19
19
|
})
|
|
20
20
|
it('should return the contenthash for a name with the record set', async () => {
|
|
21
|
-
const result = await ENSInstance.getContentHash('
|
|
21
|
+
const result = await ENSInstance.getContentHash('with-contenthash.eth')
|
|
22
22
|
expect(result).toMatchObject({
|
|
23
23
|
protocolType: 'ipfs',
|
|
24
24
|
decoded: 'bafybeico3uuyj3vphxpvbowchdwjlrlrh62awxscrnii7w7flu5z6fk77y',
|
|
@@ -29,13 +29,16 @@ describe('getSpecificRecord', () => {
|
|
|
29
29
|
|
|
30
30
|
describe('getText', () => {
|
|
31
31
|
it('should return a record from a key', async () => {
|
|
32
|
-
const result = await ENSInstance.getText(
|
|
32
|
+
const result = await ENSInstance.getText(
|
|
33
|
+
'with-profile.eth',
|
|
34
|
+
'description',
|
|
35
|
+
)
|
|
33
36
|
expect(result).toBe('Hello2')
|
|
34
37
|
})
|
|
35
38
|
|
|
36
39
|
it('should return null for a non-existent key', async () => {
|
|
37
40
|
const result = await ENSInstance.getText(
|
|
38
|
-
'
|
|
41
|
+
'with-profile.eth',
|
|
39
42
|
'thiskeydoesntexist',
|
|
40
43
|
)
|
|
41
44
|
expect(result).toBeUndefined()
|
|
@@ -44,32 +47,32 @@ describe('getSpecificRecord', () => {
|
|
|
44
47
|
|
|
45
48
|
describe('getAddr', () => {
|
|
46
49
|
it('should return the ETH addr record if no coinType is provided', async () => {
|
|
47
|
-
const result = await ENSInstance.getAddr('
|
|
48
|
-
expect(result).toBe('
|
|
50
|
+
const result = await ENSInstance.getAddr('with-profile.eth')
|
|
51
|
+
expect(result).toBe('0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC')
|
|
49
52
|
})
|
|
50
53
|
it('should return the correct address based on a coin ID input as a number', async () => {
|
|
51
|
-
const result = await ENSInstance.getAddr('
|
|
54
|
+
const result = await ENSInstance.getAddr('with-profile.eth', 61)
|
|
52
55
|
expect((result as any).addr).toBe(
|
|
53
|
-
'
|
|
56
|
+
'0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
|
|
54
57
|
)
|
|
55
58
|
expect((result as any).coin).toBe('ETC')
|
|
56
59
|
})
|
|
57
60
|
it('should return the correct address based on a coin ID input as a string', async () => {
|
|
58
|
-
const result = await ENSInstance.getAddr('
|
|
61
|
+
const result = await ENSInstance.getAddr('with-profile.eth', '61')
|
|
59
62
|
expect((result as any).addr).toBe(
|
|
60
|
-
'
|
|
63
|
+
'0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
|
|
61
64
|
)
|
|
62
65
|
expect((result as any).coin).toBe('ETC')
|
|
63
66
|
})
|
|
64
67
|
it('should return the correct address based on a coin name', async () => {
|
|
65
|
-
const result = await ENSInstance.getAddr('
|
|
68
|
+
const result = await ENSInstance.getAddr('with-profile.eth', 'ETC')
|
|
66
69
|
expect((result as any).addr).toBe(
|
|
67
|
-
'
|
|
70
|
+
'0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
|
|
68
71
|
)
|
|
69
72
|
expect((result as any).coin).toBe('ETC')
|
|
70
73
|
})
|
|
71
74
|
it('should return null for a non-existent coin', async () => {
|
|
72
|
-
const result = await ENSInstance.getAddr('
|
|
75
|
+
const result = await ENSInstance.getAddr('with-profile.eth', 'BNB')
|
|
73
76
|
expect(result).toBeUndefined()
|
|
74
77
|
})
|
|
75
78
|
})
|
|
@@ -15,11 +15,17 @@ export const _getContentHash = {
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
decode: async ({ contracts }: ENSArgs<'contracts'>, data: string) => {
|
|
18
|
+
let response: any
|
|
18
19
|
const publicResolver = await contracts?.getPublicResolver()!
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
try {
|
|
21
|
+
;[response] = publicResolver.interface.decodeFunctionResult(
|
|
22
|
+
'contenthash',
|
|
23
|
+
data,
|
|
24
|
+
)
|
|
25
|
+
} catch {
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
if (!response) {
|
|
24
30
|
return
|
|
25
31
|
}
|
|
@@ -11,21 +11,25 @@ const testProperties = (obj: object, ...properties: string[]) =>
|
|
|
11
11
|
properties.map((property) => expect(obj).toHaveProperty(property))
|
|
12
12
|
|
|
13
13
|
describe('getSubnames', () => {
|
|
14
|
-
it('should get the subnames for a name'
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
14
|
+
it.todo('should get the subnames for a name')
|
|
15
|
+
// it('should get the subnames for a name', async () => {
|
|
16
|
+
// const result = await ENSInstance.getSubnames({
|
|
17
|
+
// name: 'with-profile.eth',
|
|
18
|
+
// })
|
|
19
|
+
// expect(result).toBeTruthy()
|
|
20
|
+
// if (result) {
|
|
21
|
+
// console.log(result)
|
|
22
|
+
// expect(result.length).toBeGreaterThan(0)
|
|
23
|
+
// testProperties(
|
|
24
|
+
// result[0],
|
|
25
|
+
// 'id',
|
|
26
|
+
// 'labelName',
|
|
27
|
+
// 'labelhash',
|
|
28
|
+
// 'name',
|
|
29
|
+
// 'isMigrated',
|
|
30
|
+
// 'owner',
|
|
31
|
+
// 'truncatedName',
|
|
32
|
+
// )
|
|
33
|
+
// }
|
|
34
|
+
// })
|
|
31
35
|
})
|
|
@@ -21,13 +21,20 @@ type Params = {
|
|
|
21
21
|
pageSize?: number
|
|
22
22
|
orderDirection?: 'asc' | 'desc'
|
|
23
23
|
orderBy?: 'createdAt' | 'labelName'
|
|
24
|
-
lastSubnames
|
|
24
|
+
lastSubnames?: Array<any>
|
|
25
25
|
isLargeQuery?: boolean
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const largeQuery = async (
|
|
29
29
|
{ gqlInstance }: ENSArgs<'gqlInstance'>,
|
|
30
|
-
{
|
|
30
|
+
{
|
|
31
|
+
name,
|
|
32
|
+
page,
|
|
33
|
+
pageSize = 10,
|
|
34
|
+
orderDirection,
|
|
35
|
+
orderBy,
|
|
36
|
+
lastSubnames = [],
|
|
37
|
+
}: Params,
|
|
31
38
|
) => {
|
|
32
39
|
const client = gqlInstance.client
|
|
33
40
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ENS } from '..'
|
|
2
|
-
import { makeCommitment } from '../utils/registerHelpers'
|
|
3
2
|
import setup from '../tests/setup'
|
|
3
|
+
import { makeCommitment } from '../utils/registerHelpers'
|
|
4
4
|
|
|
5
5
|
let ENSInstance: ENS
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ describe('makeCommitment', () => {
|
|
|
13
13
|
const resolver = await ENSInstance.contracts!.getPublicResolver()!
|
|
14
14
|
const commitment = makeCommitment({
|
|
15
15
|
name: 'test.eth',
|
|
16
|
-
owner: '
|
|
16
|
+
owner: '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
|
|
17
17
|
duration: 1 * 365 * 24 * 60 * 60,
|
|
18
18
|
resolver: resolver,
|
|
19
19
|
})
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ethers } from 'ethers'
|
|
2
|
+
import { ENS } from '..'
|
|
3
|
+
import setup from '../tests/setup'
|
|
4
|
+
import { namehash } from '../utils/normalise'
|
|
5
|
+
|
|
6
|
+
let ENSInstance: ENS
|
|
7
|
+
let revert: Awaited<ReturnType<typeof setup>>['revert']
|
|
8
|
+
let provider: ethers.providers.JsonRpcProvider
|
|
9
|
+
let accounts: string[]
|
|
10
|
+
|
|
11
|
+
beforeAll(async () => {
|
|
12
|
+
;({ ENSInstance, revert, provider } = await setup())
|
|
13
|
+
accounts = await provider.listAccounts()
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
afterAll(async () => {
|
|
17
|
+
await revert()
|
|
18
|
+
await provider.send('anvil_removeBlockTimestampInterval', [])
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
describe('registerName', () => {
|
|
22
|
+
beforeEach(async () => {
|
|
23
|
+
await revert()
|
|
24
|
+
})
|
|
25
|
+
it('should return a registration transaction and succeed', async () => {
|
|
26
|
+
const name = 'cool-swag.eth'
|
|
27
|
+
const duration = 31536000
|
|
28
|
+
const { customData, ...commitPopTx } =
|
|
29
|
+
await ENSInstance.commitName.populateTransaction(name, {
|
|
30
|
+
duration,
|
|
31
|
+
owner: accounts[1],
|
|
32
|
+
addressOrIndex: accounts[1],
|
|
33
|
+
})
|
|
34
|
+
const commitTx = await provider.getSigner().sendTransaction(commitPopTx)
|
|
35
|
+
await commitTx.wait()
|
|
36
|
+
|
|
37
|
+
await provider.send('evm_increaseTime', [60])
|
|
38
|
+
await provider.send('evm_mine', [])
|
|
39
|
+
|
|
40
|
+
const { secret, wrapperExpiry } = customData!
|
|
41
|
+
|
|
42
|
+
const controller = await ENSInstance.contracts!.getEthRegistrarController()!
|
|
43
|
+
const [price] = await controller.rentPrice(name, duration)
|
|
44
|
+
|
|
45
|
+
const tx = await ENSInstance.registerName(name, {
|
|
46
|
+
secret,
|
|
47
|
+
wrapperExpiry,
|
|
48
|
+
duration,
|
|
49
|
+
owner: accounts[1],
|
|
50
|
+
addressOrIndex: accounts[1],
|
|
51
|
+
value: price,
|
|
52
|
+
})
|
|
53
|
+
await tx.wait()
|
|
54
|
+
|
|
55
|
+
const nameWrapper = await ENSInstance.contracts!.getNameWrapper()!
|
|
56
|
+
const owner = await nameWrapper.ownerOf(namehash(name))
|
|
57
|
+
expect(owner).toBe(accounts[1])
|
|
58
|
+
})
|
|
59
|
+
})
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BigNumber } from 'ethers'
|
|
2
|
+
import { ENSArgs } from '..'
|
|
3
|
+
import {
|
|
4
|
+
CommitmentParams,
|
|
5
|
+
makeRegistrationData,
|
|
6
|
+
} from '../utils/registerHelpers'
|
|
7
|
+
|
|
8
|
+
type Params = Omit<CommitmentParams, 'name' | 'resolver'> & {
|
|
9
|
+
resolverAddress?: string
|
|
10
|
+
secret: string
|
|
11
|
+
wrapperExpiry: number
|
|
12
|
+
value: BigNumber
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default async function (
|
|
16
|
+
{ contracts }: ENSArgs<'contracts'>,
|
|
17
|
+
name: string,
|
|
18
|
+
{ resolverAddress, value, ...params }: Params,
|
|
19
|
+
) {
|
|
20
|
+
const labels = name.split('.')
|
|
21
|
+
if (labels.length !== 2 || labels[1] !== 'eth')
|
|
22
|
+
throw new Error('Currently only .eth TLD registrations are supported')
|
|
23
|
+
|
|
24
|
+
const controller = await contracts!.getEthRegistrarController()
|
|
25
|
+
const _resolver = await contracts!.getPublicResolver(
|
|
26
|
+
undefined,
|
|
27
|
+
resolverAddress,
|
|
28
|
+
)
|
|
29
|
+
const generatedParams = makeRegistrationData({
|
|
30
|
+
name,
|
|
31
|
+
resolver: _resolver,
|
|
32
|
+
...params,
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
return controller.populateTransaction.register(...generatedParams, {
|
|
36
|
+
value,
|
|
37
|
+
})
|
|
38
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ethers } from 'ethers'
|
|
2
|
+
import { ENS } from '..'
|
|
3
|
+
import setup from '../tests/setup'
|
|
4
|
+
import { labelhash } from '../utils/labels'
|
|
5
|
+
|
|
6
|
+
let ENSInstance: ENS
|
|
7
|
+
let revert: Awaited<ReturnType<typeof setup>>['revert']
|
|
8
|
+
let provider: ethers.providers.JsonRpcProvider
|
|
9
|
+
let accounts: string[]
|
|
10
|
+
|
|
11
|
+
beforeAll(async () => {
|
|
12
|
+
;({ ENSInstance, revert, provider } = await setup())
|
|
13
|
+
accounts = await provider.listAccounts()
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
afterAll(async () => {
|
|
17
|
+
await revert()
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
describe('registerName', () => {
|
|
21
|
+
beforeEach(async () => {
|
|
22
|
+
await revert()
|
|
23
|
+
})
|
|
24
|
+
it('should return a renew transaction and succeed', async () => {
|
|
25
|
+
const name = 'to-be-renewed.eth'
|
|
26
|
+
const label = name.split('.')[0]
|
|
27
|
+
const duration = 31536000
|
|
28
|
+
const baseRegistrar = await ENSInstance.contracts!.getBaseRegistrar()!
|
|
29
|
+
const oldExpiry = await baseRegistrar.nameExpires(labelhash(label))
|
|
30
|
+
|
|
31
|
+
const controller = await ENSInstance.contracts!.getEthRegistrarController()!
|
|
32
|
+
const [price] = await controller.rentPrice(label, duration)
|
|
33
|
+
|
|
34
|
+
const tx = await ENSInstance.renewName(name, {
|
|
35
|
+
value: price.mul(2),
|
|
36
|
+
duration,
|
|
37
|
+
addressOrIndex: accounts[1],
|
|
38
|
+
})
|
|
39
|
+
await tx.wait()
|
|
40
|
+
|
|
41
|
+
const newExpiry = await baseRegistrar.nameExpires(labelhash(label))
|
|
42
|
+
expect(newExpiry.toNumber()).toBe(oldExpiry.add(31536000).toNumber())
|
|
43
|
+
})
|
|
44
|
+
})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { BigNumber } from 'ethers'
|
|
2
|
+
import { ENSArgs } from '..'
|
|
3
|
+
|
|
4
|
+
export default async function (
|
|
5
|
+
{ contracts }: ENSArgs<'contracts'>,
|
|
6
|
+
name: string,
|
|
7
|
+
{
|
|
8
|
+
duration,
|
|
9
|
+
value,
|
|
10
|
+
}: {
|
|
11
|
+
duration: number
|
|
12
|
+
value: BigNumber
|
|
13
|
+
},
|
|
14
|
+
) {
|
|
15
|
+
const labels = name.split('.')
|
|
16
|
+
if (labels.length !== 2 || labels[1] !== 'eth')
|
|
17
|
+
throw new Error('Currently only .eth TLD renewals are supported')
|
|
18
|
+
|
|
19
|
+
const controller = await contracts!.getEthRegistrarController()
|
|
20
|
+
|
|
21
|
+
return controller.populateTransaction.renew(labels[0], duration, { value })
|
|
22
|
+
}
|
|
@@ -22,38 +22,37 @@ describe('setName', () => {
|
|
|
22
22
|
await revert()
|
|
23
23
|
})
|
|
24
24
|
it('should return a transaction for a name and set successfully', async () => {
|
|
25
|
-
const tx = await ENSInstance.setName('
|
|
25
|
+
const tx = await ENSInstance.setName('test123.eth', { addressOrIndex: 1 })
|
|
26
26
|
expect(tx).toBeTruthy()
|
|
27
27
|
await tx?.wait()
|
|
28
28
|
|
|
29
29
|
const universalResolver =
|
|
30
30
|
await ENSInstance.contracts!.getUniversalResolver()!
|
|
31
|
-
const reverseNode = accounts[
|
|
31
|
+
const reverseNode = accounts[1].toLowerCase().substring(2) + '.addr.reverse'
|
|
32
32
|
const result = await universalResolver.reverse(hexEncodeName(reverseNode))
|
|
33
|
-
expect(result[0]).toBe('
|
|
33
|
+
expect(result[0]).toBe('test123.eth')
|
|
34
34
|
})
|
|
35
35
|
it("should return a transaction for setting another address' name", async () => {
|
|
36
|
-
jest.setTimeout(20000)
|
|
37
36
|
const registry = (await ENSInstance.contracts!.getRegistry()!).connect(
|
|
38
|
-
provider.getSigner(),
|
|
37
|
+
provider.getSigner(1),
|
|
39
38
|
)
|
|
40
39
|
const setApprovedForAllTx = await registry.setApprovalForAll(
|
|
41
|
-
accounts[
|
|
40
|
+
accounts[2],
|
|
42
41
|
true,
|
|
43
42
|
)
|
|
44
43
|
await setApprovedForAllTx?.wait()
|
|
45
44
|
|
|
46
|
-
const tx = await ENSInstance.setName('
|
|
47
|
-
address: accounts[
|
|
48
|
-
addressOrIndex:
|
|
45
|
+
const tx = await ENSInstance.setName('test123.eth', {
|
|
46
|
+
address: accounts[1],
|
|
47
|
+
addressOrIndex: 2,
|
|
49
48
|
})
|
|
50
49
|
expect(tx).toBeTruthy()
|
|
51
50
|
await tx?.wait()
|
|
52
51
|
|
|
53
52
|
const universalResolver =
|
|
54
53
|
await ENSInstance.contracts!.getUniversalResolver()!
|
|
55
|
-
const reverseNode = accounts[
|
|
54
|
+
const reverseNode = accounts[1].toLowerCase().substring(2) + '.addr.reverse'
|
|
56
55
|
const result = await universalResolver.reverse(hexEncodeName(reverseNode))
|
|
57
|
-
expect(result[0]).toBe('
|
|
56
|
+
expect(result[0]).toBe('test123.eth')
|
|
58
57
|
})
|
|
59
58
|
})
|
|
@@ -17,9 +17,10 @@ afterAll(async () => {
|
|
|
17
17
|
|
|
18
18
|
describe('setRecord', () => {
|
|
19
19
|
it('should allow a text record set', async () => {
|
|
20
|
-
const tx = await ENSInstance.setRecord('
|
|
20
|
+
const tx = await ENSInstance.setRecord('test123.eth', {
|
|
21
21
|
type: 'text',
|
|
22
22
|
record: { key: 'foo', value: 'bar' },
|
|
23
|
+
addressOrIndex: 1,
|
|
23
24
|
})
|
|
24
25
|
expect(tx).toBeTruthy()
|
|
25
26
|
await tx.wait()
|
|
@@ -28,9 +29,9 @@ describe('setRecord', () => {
|
|
|
28
29
|
await ENSInstance.contracts!.getUniversalResolver()!
|
|
29
30
|
const publicResolver = await ENSInstance.contracts!.getPublicResolver()!
|
|
30
31
|
const encodedText = await universalResolver.resolve(
|
|
31
|
-
hexEncodeName('
|
|
32
|
+
hexEncodeName('test123.eth'),
|
|
32
33
|
publicResolver.interface.encodeFunctionData('text', [
|
|
33
|
-
namehash('
|
|
34
|
+
namehash('test123.eth'),
|
|
34
35
|
'foo',
|
|
35
36
|
]),
|
|
36
37
|
)
|
|
@@ -41,12 +42,13 @@ describe('setRecord', () => {
|
|
|
41
42
|
expect(resultText).toBe('bar')
|
|
42
43
|
})
|
|
43
44
|
it('should allow an address record set', async () => {
|
|
44
|
-
const tx = await ENSInstance.setRecord('
|
|
45
|
+
const tx = await ENSInstance.setRecord('test123.eth', {
|
|
45
46
|
type: 'addr',
|
|
46
47
|
record: {
|
|
47
48
|
key: 'ETC',
|
|
48
49
|
value: '0x42D63ae25990889E35F215bC95884039Ba354115',
|
|
49
50
|
},
|
|
51
|
+
addressOrIndex: 1,
|
|
50
52
|
})
|
|
51
53
|
expect(tx).toBeTruthy()
|
|
52
54
|
await tx.wait()
|
|
@@ -55,9 +57,9 @@ describe('setRecord', () => {
|
|
|
55
57
|
await ENSInstance.contracts!.getUniversalResolver()!
|
|
56
58
|
const publicResolver = await ENSInstance.contracts!.getPublicResolver()!
|
|
57
59
|
const encodedAddr = await universalResolver.resolve(
|
|
58
|
-
hexEncodeName('
|
|
60
|
+
hexEncodeName('test123.eth'),
|
|
59
61
|
publicResolver.interface.encodeFunctionData('addr(bytes32,uint256)', [
|
|
60
|
-
namehash('
|
|
62
|
+
namehash('test123.eth'),
|
|
61
63
|
'61',
|
|
62
64
|
]),
|
|
63
65
|
)
|
|
@@ -70,10 +72,11 @@ describe('setRecord', () => {
|
|
|
70
72
|
)
|
|
71
73
|
})
|
|
72
74
|
it('should allow a contenthash record set', async () => {
|
|
73
|
-
const tx = await ENSInstance.setRecord('
|
|
75
|
+
const tx = await ENSInstance.setRecord('test123.eth', {
|
|
74
76
|
type: 'contentHash',
|
|
75
77
|
record:
|
|
76
78
|
'ipns://k51qzi5uqu5dgox2z23r6e99oqency055a6xt92xzmyvpz8mwz5ycjavm0u150',
|
|
79
|
+
addressOrIndex: 1,
|
|
77
80
|
})
|
|
78
81
|
expect(tx).toBeTruthy()
|
|
79
82
|
await tx.wait()
|
|
@@ -82,9 +85,9 @@ describe('setRecord', () => {
|
|
|
82
85
|
await ENSInstance.contracts!.getUniversalResolver()!
|
|
83
86
|
const publicResolver = await ENSInstance.contracts!.getPublicResolver()!
|
|
84
87
|
const encodedContent = await universalResolver.resolve(
|
|
85
|
-
hexEncodeName('
|
|
88
|
+
hexEncodeName('test123.eth'),
|
|
86
89
|
publicResolver.interface.encodeFunctionData('contenthash', [
|
|
87
|
-
namehash('
|
|
90
|
+
namehash('test123.eth'),
|
|
88
91
|
]),
|
|
89
92
|
)
|
|
90
93
|
const [resultContent] = publicResolver.interface.decodeFunctionResult(
|