@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
|
@@ -16,13 +16,14 @@ afterAll(async () => {
|
|
|
16
16
|
|
|
17
17
|
describe('setRecords', () => {
|
|
18
18
|
it('should return a transaction to the resolver and set successfully', async () => {
|
|
19
|
-
const tx = await ENSInstance.setRecords('
|
|
19
|
+
const tx = await ENSInstance.setRecords('test123.eth', {
|
|
20
20
|
records: {
|
|
21
21
|
coinTypes: [
|
|
22
22
|
{ key: 'ETC', value: '0x42D63ae25990889E35F215bC95884039Ba354115' },
|
|
23
23
|
],
|
|
24
24
|
texts: [{ key: 'foo', value: 'bar' }],
|
|
25
25
|
},
|
|
26
|
+
addressOrIndex: 1,
|
|
26
27
|
})
|
|
27
28
|
expect(tx).toBeTruthy()
|
|
28
29
|
await tx.wait()
|
|
@@ -31,16 +32,16 @@ describe('setRecords', () => {
|
|
|
31
32
|
await ENSInstance.contracts!.getUniversalResolver()!
|
|
32
33
|
const publicResolver = await ENSInstance.contracts!.getPublicResolver()!
|
|
33
34
|
const encodedText = await universalResolver.resolve(
|
|
34
|
-
hexEncodeName('
|
|
35
|
+
hexEncodeName('test123.eth'),
|
|
35
36
|
publicResolver.interface.encodeFunctionData('text', [
|
|
36
|
-
namehash('
|
|
37
|
+
namehash('test123.eth'),
|
|
37
38
|
'foo',
|
|
38
39
|
]),
|
|
39
40
|
)
|
|
40
41
|
const encodedAddr = await universalResolver.resolve(
|
|
41
|
-
hexEncodeName('
|
|
42
|
+
hexEncodeName('test123.eth'),
|
|
42
43
|
publicResolver.interface.encodeFunctionData('addr(bytes32,uint256)', [
|
|
43
|
-
namehash('
|
|
44
|
+
namehash('test123.eth'),
|
|
44
45
|
'61',
|
|
45
46
|
]),
|
|
46
47
|
)
|
|
@@ -20,9 +20,10 @@ describe('setResolver', () => {
|
|
|
20
20
|
await revert()
|
|
21
21
|
})
|
|
22
22
|
it('should return a transaction to the registry and set successfully', async () => {
|
|
23
|
-
const tx = await ENSInstance.setResolver('
|
|
23
|
+
const tx = await ENSInstance.setResolver('test123.eth', {
|
|
24
24
|
contract: 'registry',
|
|
25
25
|
resolver: '0xAEfF4f4d8e2cB51854BEa2244B3C5Fb36b41C7fC',
|
|
26
|
+
addressOrIndex: 1,
|
|
26
27
|
})
|
|
27
28
|
expect(tx).toBeTruthy()
|
|
28
29
|
await tx.wait()
|
|
@@ -30,19 +31,15 @@ describe('setResolver', () => {
|
|
|
30
31
|
const universalResolver =
|
|
31
32
|
await ENSInstance.contracts!.getUniversalResolver()!
|
|
32
33
|
const [result] = await universalResolver.findResolver(
|
|
33
|
-
hexEncodeName('
|
|
34
|
+
hexEncodeName('test123.eth'),
|
|
34
35
|
)
|
|
35
36
|
expect(result).toBe('0xAEfF4f4d8e2cB51854BEa2244B3C5Fb36b41C7fC')
|
|
36
37
|
})
|
|
37
38
|
it('should return a transaction to the namewrapper and set successfully', async () => {
|
|
38
|
-
const
|
|
39
|
-
const wrapNameTx = await ENSInstance.wrapName('parthtejpal.eth', {
|
|
40
|
-
wrappedOwner: accounts[0],
|
|
41
|
-
})
|
|
42
|
-
await wrapNameTx.wait()
|
|
43
|
-
const tx = await ENSInstance.setResolver('parthtejpal.eth', {
|
|
39
|
+
const tx = await ENSInstance.setResolver('wrapped.eth', {
|
|
44
40
|
contract: 'nameWrapper',
|
|
45
41
|
resolver: '0xAEfF4f4d8e2cB51854BEa2244B3C5Fb36b41C7fC',
|
|
42
|
+
addressOrIndex: 1,
|
|
46
43
|
})
|
|
47
44
|
expect(tx).toBeTruthy()
|
|
48
45
|
await tx.wait()
|
|
@@ -50,7 +47,7 @@ describe('setResolver', () => {
|
|
|
50
47
|
const universalResolver =
|
|
51
48
|
await ENSInstance.contracts!.getUniversalResolver()!
|
|
52
49
|
const [result] = await universalResolver.findResolver(
|
|
53
|
-
hexEncodeName('
|
|
50
|
+
hexEncodeName('wrapped.eth'),
|
|
54
51
|
)
|
|
55
52
|
expect(result).toBe('0xAEfF4f4d8e2cB51854BEa2244B3C5Fb36b41C7fC')
|
|
56
53
|
})
|
|
@@ -22,58 +22,44 @@ describe('transferName', () => {
|
|
|
22
22
|
await revert()
|
|
23
23
|
})
|
|
24
24
|
it('should allow a transfer on the registrar', async () => {
|
|
25
|
-
const tx = await ENSInstance.transferName('
|
|
25
|
+
const tx = await ENSInstance.transferName('test123.eth', {
|
|
26
26
|
contract: 'baseRegistrar',
|
|
27
|
-
newOwner: accounts[
|
|
28
|
-
addressOrIndex:
|
|
27
|
+
newOwner: accounts[2],
|
|
28
|
+
addressOrIndex: 1,
|
|
29
29
|
})
|
|
30
30
|
expect(tx).toBeTruthy()
|
|
31
31
|
await tx.wait()
|
|
32
32
|
|
|
33
33
|
const baseRegistrar = await ENSInstance.contracts!.getBaseRegistrar()!
|
|
34
34
|
const result = await baseRegistrar.ownerOf(
|
|
35
|
-
utils.solidityKeccak256(['string'], ['
|
|
35
|
+
utils.solidityKeccak256(['string'], ['test123']),
|
|
36
36
|
)
|
|
37
|
-
expect(result).toBe(accounts[
|
|
37
|
+
expect(result).toBe(accounts[2])
|
|
38
38
|
})
|
|
39
39
|
it('should allow a transfer on the namewrapper', async () => {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
})
|
|
43
|
-
await wrapNameTx.wait()
|
|
44
|
-
const tx = await ENSInstance.transferName('parthtejpal.eth', {
|
|
45
|
-
newOwner: accounts[1],
|
|
40
|
+
const tx = await ENSInstance.transferName('wrapped.eth', {
|
|
41
|
+
newOwner: accounts[2],
|
|
46
42
|
contract: 'nameWrapper',
|
|
47
|
-
addressOrIndex:
|
|
43
|
+
addressOrIndex: 1,
|
|
48
44
|
})
|
|
49
45
|
expect(tx).toBeTruthy()
|
|
50
46
|
await tx.wait()
|
|
51
47
|
|
|
52
48
|
const nameWrapper = await ENSInstance.contracts!.getNameWrapper()!
|
|
53
|
-
const result = await nameWrapper.ownerOf(namehash('
|
|
54
|
-
expect(result).toBe(accounts[
|
|
49
|
+
const result = await nameWrapper.ownerOf(namehash('wrapped.eth'))
|
|
50
|
+
expect(result).toBe(accounts[2])
|
|
55
51
|
})
|
|
56
52
|
it('should allow a transfer on the registry', async () => {
|
|
57
|
-
const
|
|
58
|
-
'test.parthtejpal.eth',
|
|
59
|
-
{
|
|
60
|
-
contract: 'registry',
|
|
61
|
-
owner: accounts[0],
|
|
62
|
-
addressOrIndex: accounts[0],
|
|
63
|
-
},
|
|
64
|
-
)
|
|
65
|
-
await createSubnameTx.wait()
|
|
66
|
-
|
|
67
|
-
const tx = await ENSInstance.transferName('test.parthtejpal.eth', {
|
|
53
|
+
const tx = await ENSInstance.transferName('test.with-subnames.eth', {
|
|
68
54
|
newOwner: accounts[1],
|
|
69
55
|
contract: 'registry',
|
|
70
|
-
addressOrIndex: accounts[
|
|
56
|
+
addressOrIndex: accounts[2],
|
|
71
57
|
})
|
|
72
58
|
expect(tx).toBeTruthy()
|
|
73
59
|
await tx.wait()
|
|
74
60
|
|
|
75
61
|
const registry = await ENSInstance.contracts!.getRegistry()!
|
|
76
|
-
const result = await registry.owner(namehash('test.
|
|
62
|
+
const result = await registry.owner(namehash('test.with-subnames.eth'))
|
|
77
63
|
expect(result).toBe(accounts[1])
|
|
78
64
|
})
|
|
79
65
|
})
|
|
@@ -22,53 +22,34 @@ describe('transferSubname', () => {
|
|
|
22
22
|
await revert()
|
|
23
23
|
})
|
|
24
24
|
it('should allow transferring a subname on the registry', async () => {
|
|
25
|
-
const
|
|
26
|
-
'test.parthtejpal.eth',
|
|
27
|
-
{
|
|
28
|
-
contract: 'registry',
|
|
29
|
-
owner: accounts[0],
|
|
30
|
-
addressOrIndex: 0,
|
|
31
|
-
},
|
|
32
|
-
)
|
|
33
|
-
await createSubnameTx.wait()
|
|
34
|
-
|
|
35
|
-
const tx = await ENSInstance.transferSubname('test.parthtejpal.eth', {
|
|
25
|
+
const tx = await ENSInstance.transferSubname('test.with-subnames.eth', {
|
|
36
26
|
contract: 'registry',
|
|
37
|
-
|
|
38
|
-
addressOrIndex:
|
|
27
|
+
owner: accounts[1],
|
|
28
|
+
addressOrIndex: 1,
|
|
39
29
|
})
|
|
40
30
|
expect(tx).toBeTruthy()
|
|
41
31
|
await tx.wait()
|
|
42
32
|
|
|
43
33
|
const registry = await ENSInstance.contracts!.getRegistry()!
|
|
44
|
-
const result = await registry.owner(namehash('test.
|
|
34
|
+
const result = await registry.owner(namehash('test.with-subnames.eth'))
|
|
45
35
|
expect(result).toBe(accounts[1])
|
|
46
36
|
})
|
|
47
37
|
it('should allow transferring a subname on the nameWrapper', async () => {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
})
|
|
51
|
-
await wrapNameTx.wait()
|
|
52
|
-
const createSubnameTx = await ENSInstance.createSubname(
|
|
53
|
-
'test.parthtejpal.eth',
|
|
38
|
+
const tx = await ENSInstance.transferSubname(
|
|
39
|
+
'test.wrapped-with-subnames.eth',
|
|
54
40
|
{
|
|
55
41
|
contract: 'nameWrapper',
|
|
56
|
-
owner: accounts[
|
|
57
|
-
addressOrIndex:
|
|
42
|
+
owner: accounts[1],
|
|
43
|
+
addressOrIndex: 1,
|
|
58
44
|
},
|
|
59
45
|
)
|
|
60
|
-
await createSubnameTx.wait()
|
|
61
|
-
|
|
62
|
-
const tx = await ENSInstance.transferSubname('test.parthtejpal.eth', {
|
|
63
|
-
contract: 'nameWrapper',
|
|
64
|
-
address: accounts[1],
|
|
65
|
-
addressOrIndex: 0,
|
|
66
|
-
})
|
|
67
46
|
expect(tx).toBeTruthy()
|
|
68
47
|
await tx.wait()
|
|
69
48
|
|
|
70
49
|
const nameWrapper = await ENSInstance.contracts!.getNameWrapper()!
|
|
71
|
-
const result = await nameWrapper.ownerOf(
|
|
50
|
+
const result = await nameWrapper.ownerOf(
|
|
51
|
+
namehash('test.wrapped-with-subnames.eth'),
|
|
52
|
+
)
|
|
72
53
|
expect(result).toBe(accounts[1])
|
|
73
54
|
})
|
|
74
55
|
})
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import { ethers } from 'ethers'
|
|
2
2
|
import { ENSArgs } from '..'
|
|
3
3
|
import { namehash } from '../utils/normalise'
|
|
4
|
+
import { Expiry, makeExpiry } from '../utils/wrapperExpiry'
|
|
5
|
+
|
|
6
|
+
type BaseArgs = {
|
|
7
|
+
owner: string
|
|
8
|
+
resolverAddress?: string
|
|
9
|
+
contract: 'registry' | 'nameWrapper'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type NameWrapperArgs = {
|
|
13
|
+
contract: 'nameWrapper'
|
|
14
|
+
expiry?: Expiry
|
|
15
|
+
} & BaseArgs
|
|
16
|
+
|
|
17
|
+
type Args = BaseArgs | NameWrapperArgs
|
|
4
18
|
|
|
5
19
|
export default async function (
|
|
6
|
-
{ contracts, signer }: ENSArgs<'contracts' | 'signer'>,
|
|
7
|
-
name: string,
|
|
8
20
|
{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
21
|
+
contracts,
|
|
22
|
+
signer,
|
|
23
|
+
getExpiry,
|
|
24
|
+
}: ENSArgs<'contracts' | 'signer' | 'getExpiry'>,
|
|
25
|
+
name: string,
|
|
26
|
+
{ contract, owner, resolverAddress, ...wrapperArgs }: Args,
|
|
15
27
|
) {
|
|
16
28
|
const labels = name.split('.')
|
|
17
29
|
const label = labels.shift() as string
|
|
@@ -25,17 +37,23 @@ export default async function (
|
|
|
25
37
|
return registry.populateTransaction.setSubnodeOwner(
|
|
26
38
|
parentNodehash,
|
|
27
39
|
labelhash,
|
|
28
|
-
|
|
40
|
+
owner,
|
|
29
41
|
)
|
|
30
42
|
}
|
|
31
43
|
case 'nameWrapper': {
|
|
32
44
|
const nameWrapper = (await contracts?.getNameWrapper()!).connect(signer)
|
|
45
|
+
const expiry = await makeExpiry(
|
|
46
|
+
{ getExpiry },
|
|
47
|
+
labels.join('.'),
|
|
48
|
+
'expiry' in wrapperArgs ? wrapperArgs.expiry : undefined,
|
|
49
|
+
)
|
|
33
50
|
|
|
34
51
|
return nameWrapper.populateTransaction.setSubnodeOwner(
|
|
35
52
|
parentNodehash,
|
|
36
53
|
label,
|
|
37
|
-
|
|
54
|
+
owner,
|
|
38
55
|
'0',
|
|
56
|
+
expiry,
|
|
39
57
|
)
|
|
40
58
|
}
|
|
41
59
|
default: {
|
|
@@ -22,47 +22,32 @@ describe('unwrapName', () => {
|
|
|
22
22
|
await revert()
|
|
23
23
|
})
|
|
24
24
|
it('should return a .eth unwrap name transaction and succeed', async () => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const tx = await ENSInstance.unwrapName('parthtejpal.eth', {
|
|
31
|
-
newController: accounts[0],
|
|
32
|
-
newRegistrant: accounts[0],
|
|
25
|
+
const tx = await ENSInstance.unwrapName('wrapped.eth', {
|
|
26
|
+
newController: accounts[1],
|
|
27
|
+
newRegistrant: accounts[1],
|
|
28
|
+
addressOrIndex: 1,
|
|
33
29
|
})
|
|
34
30
|
expect(tx).toBeTruthy()
|
|
35
31
|
await tx.wait()
|
|
36
32
|
|
|
37
33
|
const baseRegistrar = await ENSInstance.contracts!.getBaseRegistrar()!
|
|
38
34
|
const result = await baseRegistrar.ownerOf(
|
|
39
|
-
utils.solidityKeccak256(['string'], ['
|
|
35
|
+
utils.solidityKeccak256(['string'], ['wrapped']),
|
|
40
36
|
)
|
|
41
|
-
expect(result).toBe(accounts[
|
|
37
|
+
expect(result).toBe(accounts[1])
|
|
42
38
|
})
|
|
43
39
|
it('should return a regular unwrap name transaction and succeed', async () => {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
await wrapNameTx.wait()
|
|
48
|
-
const createSubnameTx = await ENSInstance.createSubname(
|
|
49
|
-
'test.parthtejpal.eth',
|
|
50
|
-
{
|
|
51
|
-
contract: 'nameWrapper',
|
|
52
|
-
owner: accounts[0],
|
|
53
|
-
addressOrIndex: 0,
|
|
54
|
-
},
|
|
55
|
-
)
|
|
56
|
-
await createSubnameTx.wait()
|
|
57
|
-
|
|
58
|
-
const tx = await ENSInstance.unwrapName('test.parthtejpal.eth', {
|
|
59
|
-
newController: accounts[0],
|
|
40
|
+
const tx = await ENSInstance.unwrapName('test.wrapped-with-subnames.eth', {
|
|
41
|
+
newController: accounts[1],
|
|
42
|
+
addressOrIndex: 2,
|
|
60
43
|
})
|
|
61
44
|
expect(tx).toBeTruthy()
|
|
62
45
|
await tx.wait()
|
|
63
46
|
|
|
64
47
|
const registry = await ENSInstance.contracts!.getRegistry()!
|
|
65
|
-
const result = await registry.owner(
|
|
66
|
-
|
|
48
|
+
const result = await registry.owner(
|
|
49
|
+
namehash('test.wrapped-with-subnames.eth'),
|
|
50
|
+
)
|
|
51
|
+
expect(result).toBe(accounts[1])
|
|
67
52
|
})
|
|
68
53
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ethers } from 'ethers'
|
|
2
2
|
import { ENS } from '..'
|
|
3
3
|
import setup from '../tests/setup'
|
|
4
4
|
import { hexEncodeName } from '../utils/hexEncodedName'
|
|
@@ -19,49 +19,124 @@ afterAll(async () => {
|
|
|
19
19
|
await revert()
|
|
20
20
|
})
|
|
21
21
|
|
|
22
|
+
const approve = async () => {
|
|
23
|
+
const nameWrapper = await ENSInstance.contracts!.getNameWrapper()!
|
|
24
|
+
const registry = (await ENSInstance.contracts!.getRegistry()!).connect(
|
|
25
|
+
provider.getSigner(2),
|
|
26
|
+
)
|
|
27
|
+
const setApprovedForAllTx = await registry.setApprovalForAll(
|
|
28
|
+
nameWrapper.address,
|
|
29
|
+
true,
|
|
30
|
+
)
|
|
31
|
+
await setApprovedForAllTx?.wait()
|
|
32
|
+
}
|
|
33
|
+
|
|
22
34
|
describe('wrapName', () => {
|
|
23
35
|
beforeEach(async () => {
|
|
24
36
|
await revert()
|
|
25
37
|
})
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
38
|
+
describe('.eth', () => {
|
|
39
|
+
it('should return a wrap name transaction and succeed', async () => {
|
|
40
|
+
const tx = await ENSInstance.wrapName('test123.eth', {
|
|
41
|
+
wrappedOwner: accounts[2],
|
|
42
|
+
addressOrIndex: 1,
|
|
43
|
+
})
|
|
44
|
+
expect(tx).toBeTruthy()
|
|
45
|
+
await tx.wait()
|
|
46
|
+
|
|
47
|
+
const nameWrapper = await ENSInstance.contracts!.getNameWrapper()!
|
|
48
|
+
const [fuses] = await nameWrapper.getFuses(namehash('test123.eth'))
|
|
49
|
+
|
|
50
|
+
// parent cannot control
|
|
51
|
+
expect(fuses).toBe(64)
|
|
29
52
|
})
|
|
30
|
-
|
|
31
|
-
|
|
53
|
+
it('should allow initial fuses', async () => {
|
|
54
|
+
const tx = await ENSInstance.wrapName('test123.eth', {
|
|
55
|
+
wrappedOwner: accounts[2],
|
|
56
|
+
fuseOptions: {
|
|
57
|
+
cannotUnwrap: true,
|
|
58
|
+
cannotSetTtl: true,
|
|
59
|
+
},
|
|
60
|
+
addressOrIndex: 1,
|
|
61
|
+
})
|
|
62
|
+
expect(tx).toBeTruthy()
|
|
63
|
+
await tx.wait()
|
|
32
64
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
})
|
|
37
|
-
it('should allow initial fuses', async () => {
|
|
38
|
-
const tx = await ENSInstance.wrapName('parthtejpal.eth', {
|
|
39
|
-
wrappedOwner: accounts[0],
|
|
40
|
-
fuseOptions: {
|
|
41
|
-
cannotUnwrap: true,
|
|
42
|
-
cannotSetTtl: true,
|
|
43
|
-
},
|
|
65
|
+
const nameWrapper = await ENSInstance.contracts!.getNameWrapper()!
|
|
66
|
+
const [fuses] = await nameWrapper.getFuses(namehash('test123.eth'))
|
|
67
|
+
expect(fuses).toBe(81)
|
|
44
68
|
})
|
|
45
|
-
|
|
46
|
-
|
|
69
|
+
it('should allow an initial resolver address', async () => {
|
|
70
|
+
const tx = await ENSInstance.wrapName('test123.eth', {
|
|
71
|
+
wrappedOwner: accounts[2],
|
|
72
|
+
resolverAddress: '0x42D63ae25990889E35F215bC95884039Ba354115',
|
|
73
|
+
addressOrIndex: 1,
|
|
74
|
+
})
|
|
75
|
+
expect(tx).toBeTruthy()
|
|
76
|
+
await tx.wait()
|
|
47
77
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
78
|
+
const universalResolver =
|
|
79
|
+
await ENSInstance.contracts!.getUniversalResolver()!
|
|
80
|
+
const [result] = await universalResolver.findResolver(
|
|
81
|
+
hexEncodeName('test123.eth'),
|
|
82
|
+
)
|
|
83
|
+
expect(result).toBe('0x42D63ae25990889E35F215bC95884039Ba354115')
|
|
84
|
+
})
|
|
51
85
|
})
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
86
|
+
describe('other', () => {
|
|
87
|
+
it('should return a wrap name transaction and succeed', async () => {
|
|
88
|
+
await approve()
|
|
89
|
+
|
|
90
|
+
const tx = await ENSInstance.wrapName('test.with-subnames.eth', {
|
|
91
|
+
wrappedOwner: accounts[2],
|
|
92
|
+
addressOrIndex: 2,
|
|
93
|
+
})
|
|
94
|
+
expect(tx).toBeTruthy()
|
|
95
|
+
await tx.wait()
|
|
96
|
+
|
|
97
|
+
const nameWrapper = await ENSInstance.contracts!.getNameWrapper()!
|
|
98
|
+
const [fuses] = await nameWrapper.getFuses(
|
|
99
|
+
namehash('test.with-subnames.eth'),
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
expect(fuses).toBe(0)
|
|
56
103
|
})
|
|
57
|
-
|
|
58
|
-
|
|
104
|
+
it('should allow an initial resolver address', async () => {
|
|
105
|
+
await approve()
|
|
106
|
+
const tx = await ENSInstance.wrapName('test.with-subnames.eth', {
|
|
107
|
+
wrappedOwner: accounts[2],
|
|
108
|
+
resolverAddress: '0x42D63ae25990889E35F215bC95884039Ba354115',
|
|
109
|
+
addressOrIndex: 2,
|
|
110
|
+
})
|
|
111
|
+
expect(tx).toBeTruthy()
|
|
112
|
+
await tx.wait()
|
|
59
113
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
114
|
+
const universalResolver =
|
|
115
|
+
await ENSInstance.contracts!.getUniversalResolver()!
|
|
116
|
+
const [result] = await universalResolver.findResolver(
|
|
117
|
+
hexEncodeName('test.with-subnames.eth'),
|
|
118
|
+
)
|
|
119
|
+
expect(result).toBe('0x42D63ae25990889E35F215bC95884039Ba354115')
|
|
120
|
+
})
|
|
121
|
+
it('should throw an error if contract does not have approval', async () => {
|
|
122
|
+
await expect(
|
|
123
|
+
ENSInstance.wrapName('test.with-subnames.eth', {
|
|
124
|
+
wrappedOwner: accounts[2],
|
|
125
|
+
addressOrIndex: 2,
|
|
126
|
+
}),
|
|
127
|
+
).rejects.toThrow()
|
|
128
|
+
})
|
|
129
|
+
it('should throw an error if initial fuses are provided', async () => {
|
|
130
|
+
await expect(
|
|
131
|
+
ENSInstance.wrapName('test.with-subnames.eth', {
|
|
132
|
+
wrappedOwner: accounts[2],
|
|
133
|
+
fuseOptions: {
|
|
134
|
+
cannotUnwrap: true,
|
|
135
|
+
cannotSetTtl: true,
|
|
136
|
+
},
|
|
137
|
+
addressOrIndex: 1,
|
|
138
|
+
}),
|
|
139
|
+
).rejects.toThrow()
|
|
140
|
+
})
|
|
66
141
|
})
|
|
67
142
|
})
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { ethers } from 'ethers'
|
|
1
|
+
import { BigNumber, ethers } from 'ethers'
|
|
2
2
|
import { ENSArgs } from '..'
|
|
3
3
|
import type { FuseOptions } from '../@types/FuseOptions'
|
|
4
4
|
import generateFuseInput from '../utils/generateFuseInput'
|
|
5
5
|
import { hexEncodeName } from '../utils/hexEncodedName'
|
|
6
|
+
import { Expiry, makeExpiry } from '../utils/wrapperExpiry'
|
|
6
7
|
|
|
7
8
|
async function wrapETH(
|
|
8
9
|
{ contracts }: ENSArgs<'contracts'>,
|
|
9
10
|
labels: string[],
|
|
10
11
|
wrappedOwner: string,
|
|
12
|
+
expiry: BigNumber,
|
|
11
13
|
decodedFuses: string,
|
|
12
14
|
resolverAddress: string,
|
|
13
15
|
signer: ethers.Signer,
|
|
@@ -20,7 +22,7 @@ async function wrapETH(
|
|
|
20
22
|
|
|
21
23
|
const data = ethers.utils.defaultAbiCoder.encode(
|
|
22
24
|
['string', 'address', 'uint32', 'uint64', 'address'],
|
|
23
|
-
[labels[0], wrappedOwner,
|
|
25
|
+
[labels[0], wrappedOwner, decodedFuses, expiry, resolverAddress],
|
|
24
26
|
)
|
|
25
27
|
|
|
26
28
|
return baseRegistrar.populateTransaction[
|
|
@@ -32,7 +34,6 @@ async function wrapOther(
|
|
|
32
34
|
{ contracts }: ENSArgs<'contracts'>,
|
|
33
35
|
name: string,
|
|
34
36
|
wrappedOwner: string,
|
|
35
|
-
decodedFuses: string,
|
|
36
37
|
resolverAddress: string,
|
|
37
38
|
address: string,
|
|
38
39
|
signer: ethers.Signer,
|
|
@@ -54,21 +55,26 @@ async function wrapOther(
|
|
|
54
55
|
return nameWrapper.populateTransaction.wrap(
|
|
55
56
|
hexEncodeName(name),
|
|
56
57
|
wrappedOwner,
|
|
57
|
-
decodedFuses,
|
|
58
58
|
resolverAddress,
|
|
59
59
|
)
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export default async function (
|
|
63
|
-
{
|
|
63
|
+
{
|
|
64
|
+
contracts,
|
|
65
|
+
signer,
|
|
66
|
+
getExpiry,
|
|
67
|
+
}: ENSArgs<'contracts' | 'signer' | 'getExpiry'>,
|
|
64
68
|
name: string,
|
|
65
69
|
{
|
|
66
70
|
wrappedOwner,
|
|
67
71
|
fuseOptions,
|
|
72
|
+
expiry,
|
|
68
73
|
resolverAddress,
|
|
69
74
|
}: {
|
|
70
75
|
wrappedOwner: string
|
|
71
76
|
fuseOptions?: FuseOptions | string | number
|
|
77
|
+
expiry?: Expiry
|
|
72
78
|
resolverAddress?: string
|
|
73
79
|
},
|
|
74
80
|
) {
|
|
@@ -76,48 +82,58 @@ export default async function (
|
|
|
76
82
|
|
|
77
83
|
let decodedFuses: string
|
|
78
84
|
|
|
79
|
-
switch (typeof fuseOptions) {
|
|
80
|
-
case 'object': {
|
|
81
|
-
decodedFuses = generateFuseInput(fuseOptions)
|
|
82
|
-
break
|
|
83
|
-
}
|
|
84
|
-
case 'number': {
|
|
85
|
-
decodedFuses = fuseOptions.toString(16)
|
|
86
|
-
break
|
|
87
|
-
}
|
|
88
|
-
case 'string': {
|
|
89
|
-
decodedFuses = fuseOptions
|
|
90
|
-
break
|
|
91
|
-
}
|
|
92
|
-
case 'undefined': {
|
|
93
|
-
decodedFuses = '0'
|
|
94
|
-
break
|
|
95
|
-
}
|
|
96
|
-
default: {
|
|
97
|
-
throw new Error(`Invalid fuseOptions type: ${typeof fuseOptions}`)
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
85
|
const publicResolver = await contracts?.getPublicResolver()!
|
|
102
86
|
if (!resolverAddress) resolverAddress = publicResolver.address
|
|
103
87
|
|
|
104
88
|
const labels = name.split('.')
|
|
105
|
-
if (labels.length
|
|
89
|
+
if (labels.length === 2 && labels[1] === 'eth') {
|
|
90
|
+
switch (typeof fuseOptions) {
|
|
91
|
+
case 'object': {
|
|
92
|
+
decodedFuses = generateFuseInput(fuseOptions)
|
|
93
|
+
break
|
|
94
|
+
}
|
|
95
|
+
case 'number': {
|
|
96
|
+
decodedFuses = fuseOptions.toString(16)
|
|
97
|
+
break
|
|
98
|
+
}
|
|
99
|
+
case 'string': {
|
|
100
|
+
decodedFuses = fuseOptions
|
|
101
|
+
break
|
|
102
|
+
}
|
|
103
|
+
case 'undefined': {
|
|
104
|
+
decodedFuses = '0'
|
|
105
|
+
break
|
|
106
|
+
}
|
|
107
|
+
default: {
|
|
108
|
+
throw new Error(`Invalid fuseOptions type: ${typeof fuseOptions}`)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const expiryToUse = await makeExpiry({ getExpiry }, name, expiry)
|
|
113
|
+
|
|
106
114
|
return wrapETH(
|
|
107
115
|
{ contracts },
|
|
108
116
|
labels,
|
|
109
117
|
wrappedOwner,
|
|
118
|
+
expiryToUse,
|
|
110
119
|
decodedFuses,
|
|
111
120
|
resolverAddress,
|
|
112
121
|
signer,
|
|
113
122
|
address,
|
|
114
123
|
)
|
|
115
124
|
} else {
|
|
125
|
+
if (fuseOptions)
|
|
126
|
+
throw new Error(
|
|
127
|
+
'Fuses can not be initially set when wrapping a non .eth name',
|
|
128
|
+
)
|
|
129
|
+
if (expiry)
|
|
130
|
+
throw new Error(
|
|
131
|
+
'Expiry can not be initially set when wrapping a non .eth name',
|
|
132
|
+
)
|
|
116
133
|
return wrapOther(
|
|
117
134
|
{ contracts },
|
|
118
135
|
name,
|
|
119
136
|
wrappedOwner,
|
|
120
|
-
decodedFuses,
|
|
121
137
|
resolverAddress,
|
|
122
138
|
address,
|
|
123
139
|
signer,
|