@ensdomains/ensjs 3.0.0-alpha.1 → 3.0.0-alpha.12
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/README.md +2 -0
- package/dist/cjs/GqlManager.d.ts +3 -0
- package/dist/cjs/GqlManager.js +62 -2
- 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.d.ts +3 -2
- package/dist/cjs/functions/burnFuses.js +4 -8
- package/dist/cjs/functions/createSubname.d.ts +3 -5
- package/dist/cjs/functions/createSubname.js +7 -8
- package/dist/cjs/functions/deleteSubname.d.ts +3 -3
- package/dist/cjs/functions/deleteSubname.js +6 -2
- package/dist/cjs/functions/getDNSOwner.d.ts +7 -0
- package/dist/cjs/functions/getDNSOwner.js +81 -0
- 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 +6 -14
- 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/getOwner.js +7 -6
- package/dist/cjs/functions/getProfile.d.ts +4 -1
- package/dist/cjs/functions/getProfile.js +102 -24
- package/dist/cjs/functions/getRecords.d.ts +1 -0
- package/dist/cjs/functions/getSpecificRecord.js +30 -6
- package/dist/cjs/functions/getSubnames.d.ts +1 -1
- package/dist/cjs/functions/getSubnames.js +7 -7
- package/dist/cjs/functions/setName.d.ts +4 -3
- package/dist/cjs/functions/setName.js +5 -10
- package/dist/cjs/functions/setRecord.d.ts +18 -0
- package/dist/cjs/functions/setRecord.js +27 -0
- package/dist/cjs/functions/setRecords.d.ts +4 -2
- package/dist/cjs/functions/setRecords.js +14 -12
- package/dist/cjs/functions/setResolver.d.ts +4 -4
- package/dist/cjs/functions/setResolver.js +6 -12
- package/dist/cjs/functions/transferName.d.ts +4 -3
- package/dist/cjs/functions/transferName.js +9 -13
- package/dist/cjs/functions/transferSubname.d.ts +13 -3
- package/dist/cjs/functions/transferSubname.js +7 -8
- package/dist/cjs/functions/unwrapName.d.ts +4 -3
- package/dist/cjs/functions/unwrapName.js +5 -9
- package/dist/cjs/functions/wrapName.d.ts +7 -3
- package/dist/cjs/functions/wrapName.js +38 -36
- 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 +62 -84
- package/dist/cjs/index.js +44 -21
- package/dist/cjs/utils/labels.js +5 -4
- package/dist/cjs/utils/makeHashIndexes.js +2 -2
- package/dist/cjs/utils/normalise.d.ts +1 -0
- package/dist/cjs/utils/normalise.js +27 -1
- package/dist/cjs/utils/recordHelpers.d.ts +3 -0
- package/dist/cjs/utils/recordHelpers.js +42 -15
- package/dist/cjs/utils/registerHelpers.js +3 -4
- package/dist/cjs/utils/wrapperExpiry.d.ts +5 -0
- package/dist/cjs/utils/wrapperExpiry.js +30 -0
- package/dist/cjs/utils/writeTx.d.ts +4 -0
- package/dist/cjs/utils/writeTx.js +3 -0
- package/dist/esm/GqlManager.d.ts +3 -0
- package/dist/esm/GqlManager.js +58 -2
- 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.d.ts +3 -2
- package/dist/esm/functions/burnFuses.js +4 -8
- package/dist/esm/functions/createSubname.d.ts +3 -5
- package/dist/esm/functions/createSubname.js +7 -8
- package/dist/esm/functions/deleteSubname.d.ts +3 -3
- package/dist/esm/functions/deleteSubname.js +6 -2
- package/dist/esm/functions/getDNSOwner.d.ts +7 -0
- package/dist/esm/functions/getDNSOwner.js +51 -0
- 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 +7 -15
- 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/getOwner.js +7 -6
- package/dist/esm/functions/getProfile.d.ts +4 -1
- package/dist/esm/functions/getProfile.js +102 -24
- package/dist/esm/functions/getRecords.d.ts +1 -0
- package/dist/esm/functions/getSpecificRecord.js +30 -6
- package/dist/esm/functions/getSubnames.d.ts +1 -1
- package/dist/esm/functions/getSubnames.js +4 -4
- package/dist/esm/functions/setName.d.ts +4 -3
- package/dist/esm/functions/setName.js +5 -10
- package/dist/esm/functions/setRecord.d.ts +18 -0
- package/dist/esm/functions/setRecord.js +24 -0
- package/dist/esm/functions/setRecords.d.ts +4 -2
- package/dist/esm/functions/setRecords.js +14 -12
- package/dist/esm/functions/setResolver.d.ts +4 -4
- package/dist/esm/functions/setResolver.js +6 -12
- package/dist/esm/functions/transferName.d.ts +4 -3
- package/dist/esm/functions/transferName.js +9 -13
- package/dist/esm/functions/transferSubname.d.ts +13 -3
- package/dist/esm/functions/transferSubname.js +7 -8
- package/dist/esm/functions/unwrapName.d.ts +4 -3
- package/dist/esm/functions/unwrapName.js +5 -9
- package/dist/esm/functions/wrapName.d.ts +7 -3
- package/dist/esm/functions/wrapName.js +38 -36
- 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 +62 -84
- package/dist/esm/index.js +44 -21
- package/dist/esm/utils/labels.js +5 -4
- package/dist/esm/utils/makeHashIndexes.js +2 -2
- package/dist/esm/utils/normalise.d.ts +1 -0
- package/dist/esm/utils/normalise.js +25 -0
- package/dist/esm/utils/recordHelpers.d.ts +3 -0
- package/dist/esm/utils/recordHelpers.js +40 -14
- package/dist/esm/utils/registerHelpers.js +3 -4
- package/dist/esm/utils/wrapperExpiry.d.ts +5 -0
- package/dist/esm/utils/wrapperExpiry.js +26 -0
- package/dist/esm/utils/writeTx.d.ts +4 -0
- package/dist/esm/utils/writeTx.js +1 -0
- package/package.json +24 -14
- package/src/@types/dns-packet/index.d.ts +114 -0
- package/src/ABIs/Multicall.json +452 -0
- package/src/GqlManager.test.ts +170 -0
- package/src/GqlManager.ts +67 -2
- package/src/contracts/index.ts +1 -1
- package/src/{tests → functions}/batch.test.ts +7 -7
- package/src/{tests → functions}/batchWrappers.test.ts +6 -6
- package/src/{tests → functions}/burnFuses.test.ts +12 -15
- package/src/functions/burnFuses.ts +9 -11
- package/src/{tests → functions}/createSubname.test.ts +9 -17
- package/src/functions/createSubname.ts +20 -14
- package/src/{tests → functions}/deleteSubname.test.ts +12 -31
- package/src/functions/deleteSubname.ts +10 -12
- package/src/functions/getDNSOwner.test.ts +118 -0
- package/src/functions/getDNSOwner.ts +61 -0
- package/src/functions/getExpiry.test.ts +59 -0
- package/src/functions/getExpiry.ts +87 -9
- package/src/{tests → functions}/getFuses.test.ts +16 -37
- package/src/functions/getFuses.ts +12 -17
- package/src/functions/getHistory.test.ts +29 -0
- package/src/functions/getHistory.ts +2 -127
- package/src/{tests → functions}/getName.test.ts +6 -6
- package/src/functions/getName.ts +1 -1
- package/src/{tests → functions}/getNames.test.ts +98 -69
- package/src/{tests → functions}/getOwner.test.ts +21 -24
- package/src/functions/getOwner.ts +7 -7
- package/src/functions/getProfile.test.ts +143 -0
- package/src/functions/getProfile.ts +151 -24
- package/src/functions/getRecords.ts +1 -0
- package/src/functions/getResolver.test.ts +15 -0
- package/src/{tests → functions}/getSpecificRecord.test.ts +17 -14
- package/src/functions/getSpecificRecord.ts +38 -12
- package/src/functions/getSubnames.test.ts +35 -0
- package/src/functions/getSubnames.ts +76 -67
- package/src/{tests → functions}/makeCommitment.test.ts +2 -2
- package/src/functions/normalise.test.ts +22 -0
- package/src/{tests → functions}/setName.test.ts +11 -11
- package/src/functions/setName.ts +15 -17
- package/src/functions/setRecord.test.ts +103 -0
- package/src/functions/setRecord.ts +63 -0
- package/src/{tests → functions}/setRecords.test.ts +16 -13
- package/src/functions/setRecords.ts +22 -16
- package/src/{tests → functions}/setResolver.test.ts +13 -19
- package/src/functions/setResolver.ts +15 -20
- package/src/{tests → functions}/transferName.test.ts +20 -35
- package/src/functions/transferName.ts +19 -22
- package/src/{tests → functions}/transferSubname.test.ts +14 -33
- package/src/functions/transferSubname.ts +39 -13
- package/src/{tests → functions}/unwrapName.test.ts +16 -30
- package/src/functions/unwrapName.ts +20 -15
- package/src/functions/wrapName.test.ts +142 -0
- package/src/functions/wrapName.ts +63 -49
- 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 +117 -47
- package/src/tests/populateTransaction.test.ts +40 -0
- package/src/tests/setup.ts +17 -13
- package/src/tests/signerInjection.test.ts +46 -0
- package/src/tests/withProvider.test.ts +3 -3
- package/src/utils/labels.ts +6 -4
- package/src/utils/makeHashIndexes.ts +4 -4
- package/src/utils/normalise.ts +29 -0
- package/src/utils/recordHelpers.ts +52 -18
- package/src/utils/registerHelpers.ts +3 -4
- package/src/utils/wrapperExpiry.ts +31 -0
- package/src/utils/writeTx.ts +6 -0
- 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/getExpiry.test.ts +0 -37
- package/src/tests/getHistory.test.ts +0 -101
- package/src/tests/getProfile.test.ts +0 -102
- package/src/tests/getResolver.test.ts +0 -19
- package/src/tests/getSubnames.test.ts +0 -31
- package/src/tests/wrapName.test.ts +0 -67
|
@@ -3,6 +3,7 @@ import { ethers } from 'ethers'
|
|
|
3
3
|
import { ENSArgs } from '..'
|
|
4
4
|
import { decodeContenthash, DecodedContentHash } from '../utils/contentHash'
|
|
5
5
|
import { hexEncodeName } from '../utils/hexEncodedName'
|
|
6
|
+
import { namehash } from '../utils/normalise'
|
|
6
7
|
import { parseInputType } from '../utils/validation'
|
|
7
8
|
|
|
8
9
|
type InternalProfileOptions = {
|
|
@@ -96,10 +97,27 @@ const makeMulticallData = async (
|
|
|
96
97
|
return { data: prRawData.data, calls }
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
const fetchWithoutResolverMulticall = async (
|
|
101
|
+
{ multicallWrapper }: ENSArgs<'multicallWrapper'>,
|
|
102
|
+
calls: {
|
|
103
|
+
key: string | number
|
|
104
|
+
data: {
|
|
105
|
+
to: string
|
|
106
|
+
data: string
|
|
107
|
+
}
|
|
108
|
+
type: 'addr' | 'text' | 'contentHash'
|
|
109
|
+
}[],
|
|
110
|
+
resolverAddress: string,
|
|
111
|
+
) => {
|
|
112
|
+
const callsWithResolver = calls.map((call) => ({
|
|
113
|
+
to: resolverAddress,
|
|
114
|
+
data: call.data.data,
|
|
115
|
+
}))
|
|
116
|
+
|
|
117
|
+
return (await multicallWrapper(callsWithResolver)).map(
|
|
118
|
+
(x: [boolean, string]) => x[1],
|
|
102
119
|
)
|
|
120
|
+
}
|
|
103
121
|
|
|
104
122
|
const getDataForName = async (
|
|
105
123
|
{
|
|
@@ -108,15 +126,19 @@ const getDataForName = async (
|
|
|
108
126
|
_getContentHash,
|
|
109
127
|
_getText,
|
|
110
128
|
resolverMulticallWrapper,
|
|
129
|
+
multicallWrapper,
|
|
111
130
|
}: ENSArgs<
|
|
112
131
|
| 'contracts'
|
|
113
132
|
| '_getText'
|
|
114
133
|
| '_getAddr'
|
|
115
134
|
| '_getContentHash'
|
|
116
135
|
| 'resolverMulticallWrapper'
|
|
136
|
+
| 'multicallWrapper'
|
|
117
137
|
>,
|
|
118
138
|
name: string,
|
|
119
139
|
options: InternalProfileOptions,
|
|
140
|
+
fallbackResolver?: string,
|
|
141
|
+
specificResolver?: string,
|
|
120
142
|
) => {
|
|
121
143
|
const universalResolver = await contracts?.getUniversalResolver()
|
|
122
144
|
|
|
@@ -126,14 +148,42 @@ const getDataForName = async (
|
|
|
126
148
|
options,
|
|
127
149
|
)
|
|
128
150
|
|
|
129
|
-
let
|
|
151
|
+
let resolvedData: any
|
|
152
|
+
let useFallbackResolver = false
|
|
130
153
|
try {
|
|
131
|
-
|
|
154
|
+
if (specificResolver) {
|
|
155
|
+
const publicResolver = await contracts?.getPublicResolver(
|
|
156
|
+
undefined,
|
|
157
|
+
specificResolver,
|
|
158
|
+
)
|
|
159
|
+
resolvedData = await publicResolver?.callStatic.multicall(
|
|
160
|
+
calls.map((x) => x.data),
|
|
161
|
+
)
|
|
162
|
+
} else {
|
|
163
|
+
resolvedData = await universalResolver?.resolve(hexEncodeName(name), data)
|
|
164
|
+
}
|
|
132
165
|
} catch {
|
|
133
|
-
|
|
166
|
+
useFallbackResolver = true
|
|
134
167
|
}
|
|
135
168
|
|
|
136
|
-
|
|
169
|
+
let resolverAddress: string
|
|
170
|
+
let recordData: any
|
|
171
|
+
|
|
172
|
+
if (useFallbackResolver) {
|
|
173
|
+
resolverAddress = specificResolver || fallbackResolver!
|
|
174
|
+
recordData = await fetchWithoutResolverMulticall(
|
|
175
|
+
{ multicallWrapper },
|
|
176
|
+
calls,
|
|
177
|
+
resolverAddress,
|
|
178
|
+
)
|
|
179
|
+
} else {
|
|
180
|
+
resolverAddress = specificResolver || resolvedData['1']
|
|
181
|
+
if (specificResolver) {
|
|
182
|
+
recordData = resolvedData
|
|
183
|
+
} else {
|
|
184
|
+
;[recordData] = await resolverMulticallWrapper.decode(resolvedData['0'])
|
|
185
|
+
}
|
|
186
|
+
}
|
|
137
187
|
|
|
138
188
|
const matchAddress = recordData[calls.findIndex((x) => x.key === '60')]
|
|
139
189
|
|
|
@@ -145,7 +195,7 @@ const getDataForName = async (
|
|
|
145
195
|
calls,
|
|
146
196
|
options,
|
|
147
197
|
),
|
|
148
|
-
resolverAddress
|
|
198
|
+
resolverAddress,
|
|
149
199
|
}
|
|
150
200
|
}
|
|
151
201
|
|
|
@@ -167,7 +217,7 @@ const formatRecords = async (
|
|
|
167
217
|
key: calls[i].key,
|
|
168
218
|
type: calls[i].type,
|
|
169
219
|
}
|
|
170
|
-
if (itemRet.type === '
|
|
220
|
+
if (itemRet.type === 'contenthash') {
|
|
171
221
|
decodedFromAbi = ethers.utils.defaultAbiCoder.decode(
|
|
172
222
|
['bytes'],
|
|
173
223
|
item,
|
|
@@ -264,10 +314,11 @@ const graphFetch = async (
|
|
|
264
314
|
{ gqlInstance }: ENSArgs<'gqlInstance'>,
|
|
265
315
|
name: string,
|
|
266
316
|
wantedRecords?: ProfileOptions,
|
|
317
|
+
resolverAddress?: string,
|
|
267
318
|
) => {
|
|
268
319
|
const query = gqlInstance.gql`
|
|
269
|
-
query getRecords($
|
|
270
|
-
|
|
320
|
+
query getRecords($id: String!) {
|
|
321
|
+
domain(id: $id) {
|
|
271
322
|
isMigrated
|
|
272
323
|
createdAt
|
|
273
324
|
resolver {
|
|
@@ -277,6 +328,24 @@ const graphFetch = async (
|
|
|
277
328
|
addr {
|
|
278
329
|
id
|
|
279
330
|
}
|
|
331
|
+
address
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
`
|
|
336
|
+
|
|
337
|
+
const customResolverQuery = gqlInstance.gql`
|
|
338
|
+
query getRecordsWithCustomResolver($id: String!, $resolverId: String!) {
|
|
339
|
+
domain(id: $id) {
|
|
340
|
+
isMigrated
|
|
341
|
+
createdAt
|
|
342
|
+
}
|
|
343
|
+
resolver(id: $resolverId) {
|
|
344
|
+
texts
|
|
345
|
+
coinTypes
|
|
346
|
+
contentHash
|
|
347
|
+
addr {
|
|
348
|
+
id
|
|
280
349
|
}
|
|
281
350
|
}
|
|
282
351
|
}
|
|
@@ -284,15 +353,36 @@ const graphFetch = async (
|
|
|
284
353
|
|
|
285
354
|
const client = gqlInstance.client
|
|
286
355
|
|
|
287
|
-
const
|
|
356
|
+
const id = namehash(name)
|
|
288
357
|
|
|
289
|
-
|
|
358
|
+
let domain: any
|
|
359
|
+
let resolverResponse: any
|
|
360
|
+
|
|
361
|
+
if (!resolverAddress) {
|
|
362
|
+
;({ domain } = await client.request(query, { id }))
|
|
363
|
+
resolverResponse = domain?.resolver
|
|
364
|
+
} else {
|
|
365
|
+
const resolverId = `${resolverAddress}-${id}`
|
|
366
|
+
;({ resolver: resolverResponse, domain } = await client.request(
|
|
367
|
+
customResolverQuery,
|
|
368
|
+
{ id, resolverId },
|
|
369
|
+
))
|
|
370
|
+
}
|
|
290
371
|
|
|
291
|
-
|
|
372
|
+
if (!domain) return
|
|
373
|
+
|
|
374
|
+
const { isMigrated, createdAt } = domain
|
|
292
375
|
|
|
293
376
|
let returnedRecords: ProfileResponse = {}
|
|
294
377
|
|
|
295
|
-
if (!
|
|
378
|
+
if (!resolverResponse) return { isMigrated, createdAt }
|
|
379
|
+
|
|
380
|
+
if (!wantedRecords)
|
|
381
|
+
return {
|
|
382
|
+
isMigrated,
|
|
383
|
+
createdAt,
|
|
384
|
+
graphResolverAddress: resolverResponse.address || resolverAddress,
|
|
385
|
+
}
|
|
296
386
|
|
|
297
387
|
Object.keys(wantedRecords).forEach((key: string) => {
|
|
298
388
|
const data = wantedRecords[key as keyof ProfileOptions]
|
|
@@ -305,7 +395,12 @@ const graphFetch = async (
|
|
|
305
395
|
}
|
|
306
396
|
})
|
|
307
397
|
|
|
308
|
-
return {
|
|
398
|
+
return {
|
|
399
|
+
...returnedRecords,
|
|
400
|
+
isMigrated,
|
|
401
|
+
createdAt,
|
|
402
|
+
graphResolverAddress: resolverResponse.address || resolverAddress,
|
|
403
|
+
}
|
|
309
404
|
}
|
|
310
405
|
|
|
311
406
|
type ProfileOptions = {
|
|
@@ -314,6 +409,10 @@ type ProfileOptions = {
|
|
|
314
409
|
coinTypes?: boolean | string[]
|
|
315
410
|
}
|
|
316
411
|
|
|
412
|
+
type InputProfileOptions = ProfileOptions & {
|
|
413
|
+
resolverAddress?: string
|
|
414
|
+
}
|
|
415
|
+
|
|
317
416
|
const getProfileFromName = async (
|
|
318
417
|
{
|
|
319
418
|
contracts,
|
|
@@ -322,6 +421,7 @@ const getProfileFromName = async (
|
|
|
322
421
|
_getContentHash,
|
|
323
422
|
_getText,
|
|
324
423
|
resolverMulticallWrapper,
|
|
424
|
+
multicallWrapper,
|
|
325
425
|
}: ENSArgs<
|
|
326
426
|
| 'contracts'
|
|
327
427
|
| 'gqlInstance'
|
|
@@ -329,22 +429,39 @@ const getProfileFromName = async (
|
|
|
329
429
|
| '_getAddr'
|
|
330
430
|
| '_getContentHash'
|
|
331
431
|
| 'resolverMulticallWrapper'
|
|
432
|
+
| 'multicallWrapper'
|
|
332
433
|
>,
|
|
333
434
|
name: string,
|
|
334
|
-
options?:
|
|
435
|
+
options?: InputProfileOptions,
|
|
335
436
|
) => {
|
|
437
|
+
const { resolverAddress, ..._options } = options || {}
|
|
438
|
+
const optsLength = Object.keys(_options).length
|
|
336
439
|
const usingOptions =
|
|
337
|
-
!
|
|
338
|
-
?
|
|
440
|
+
!optsLength || _options?.texts === true || _options?.coinTypes === true
|
|
441
|
+
? optsLength
|
|
442
|
+
? _options
|
|
443
|
+
: { contentHash: true, texts: true, coinTypes: true }
|
|
339
444
|
: undefined
|
|
340
|
-
|
|
445
|
+
|
|
446
|
+
const graphResult = await graphFetch(
|
|
447
|
+
{ gqlInstance },
|
|
448
|
+
name,
|
|
449
|
+
usingOptions,
|
|
450
|
+
resolverAddress,
|
|
451
|
+
)
|
|
341
452
|
if (!graphResult) return
|
|
342
453
|
const {
|
|
343
454
|
isMigrated,
|
|
344
455
|
createdAt,
|
|
456
|
+
graphResolverAddress,
|
|
345
457
|
...wantedRecords
|
|
346
|
-
}: {
|
|
347
|
-
|
|
458
|
+
}: {
|
|
459
|
+
isMigrated: boolean
|
|
460
|
+
createdAt: string
|
|
461
|
+
graphResolverAddress?: string
|
|
462
|
+
} & InternalProfileOptions = graphResult
|
|
463
|
+
if (!graphResolverAddress && !options?.resolverAddress)
|
|
464
|
+
return { isMigrated, createdAt, message: "Name doesn't have a resolver" }
|
|
348
465
|
const result = await getDataForName(
|
|
349
466
|
{
|
|
350
467
|
contracts,
|
|
@@ -352,9 +469,12 @@ const getProfileFromName = async (
|
|
|
352
469
|
_getContentHash,
|
|
353
470
|
_getText,
|
|
354
471
|
resolverMulticallWrapper,
|
|
472
|
+
multicallWrapper,
|
|
355
473
|
},
|
|
356
474
|
name,
|
|
357
475
|
usingOptions ? wantedRecords : (options as InternalProfileOptions),
|
|
476
|
+
graphResolverAddress,
|
|
477
|
+
options?.resolverAddress!,
|
|
358
478
|
)
|
|
359
479
|
if (!result)
|
|
360
480
|
return { isMigrated, createdAt, message: "Records fetch didn't complete" }
|
|
@@ -370,6 +490,7 @@ const getProfileFromAddress = async (
|
|
|
370
490
|
_getContentHash,
|
|
371
491
|
_getText,
|
|
372
492
|
resolverMulticallWrapper,
|
|
493
|
+
multicallWrapper,
|
|
373
494
|
}: ENSArgs<
|
|
374
495
|
| 'contracts'
|
|
375
496
|
| 'gqlInstance'
|
|
@@ -378,9 +499,10 @@ const getProfileFromAddress = async (
|
|
|
378
499
|
| '_getAddr'
|
|
379
500
|
| '_getContentHash'
|
|
380
501
|
| 'resolverMulticallWrapper'
|
|
502
|
+
| 'multicallWrapper'
|
|
381
503
|
>,
|
|
382
504
|
address: string,
|
|
383
|
-
options?:
|
|
505
|
+
options?: InputProfileOptions,
|
|
384
506
|
) => {
|
|
385
507
|
let name
|
|
386
508
|
try {
|
|
@@ -398,6 +520,7 @@ const getProfileFromAddress = async (
|
|
|
398
520
|
_getContentHash,
|
|
399
521
|
_getText,
|
|
400
522
|
resolverMulticallWrapper,
|
|
523
|
+
multicallWrapper,
|
|
401
524
|
},
|
|
402
525
|
name.name,
|
|
403
526
|
options,
|
|
@@ -420,6 +543,7 @@ export default async function (
|
|
|
420
543
|
_getContentHash,
|
|
421
544
|
_getText,
|
|
422
545
|
resolverMulticallWrapper,
|
|
546
|
+
multicallWrapper,
|
|
423
547
|
}: ENSArgs<
|
|
424
548
|
| 'contracts'
|
|
425
549
|
| 'gqlInstance'
|
|
@@ -428,9 +552,10 @@ export default async function (
|
|
|
428
552
|
| '_getAddr'
|
|
429
553
|
| '_getContentHash'
|
|
430
554
|
| 'resolverMulticallWrapper'
|
|
555
|
+
| 'multicallWrapper'
|
|
431
556
|
>,
|
|
432
557
|
nameOrAddress: string,
|
|
433
|
-
options?:
|
|
558
|
+
options?: InputProfileOptions,
|
|
434
559
|
): Promise<ResolvedProfile | undefined> {
|
|
435
560
|
if (options && options.coinTypes && typeof options.coinTypes !== 'boolean') {
|
|
436
561
|
options.coinTypes = options.coinTypes.map((coin: string) => {
|
|
@@ -458,6 +583,7 @@ export default async function (
|
|
|
458
583
|
_getContentHash,
|
|
459
584
|
_getText,
|
|
460
585
|
resolverMulticallWrapper,
|
|
586
|
+
multicallWrapper,
|
|
461
587
|
},
|
|
462
588
|
nameOrAddress,
|
|
463
589
|
options,
|
|
@@ -472,6 +598,7 @@ export default async function (
|
|
|
472
598
|
_getContentHash,
|
|
473
599
|
_getText,
|
|
474
600
|
resolverMulticallWrapper,
|
|
601
|
+
multicallWrapper,
|
|
475
602
|
},
|
|
476
603
|
nameOrAddress,
|
|
477
604
|
options,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ENS } from '..'
|
|
2
|
+
import setup from '../tests/setup'
|
|
3
|
+
|
|
4
|
+
let ENSInstance: ENS
|
|
5
|
+
|
|
6
|
+
beforeAll(async () => {
|
|
7
|
+
;({ ENSInstance } = await setup())
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
describe('getResolver', () => {
|
|
11
|
+
it('should find the resolver for a name with a resolver', async () => {
|
|
12
|
+
const result = await ENSInstance.getResolver('with-profile.eth')
|
|
13
|
+
expect(result).toBe('0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8')
|
|
14
|
+
})
|
|
15
|
+
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ENS } from '..'
|
|
2
|
-
import setup from '
|
|
2
|
+
import setup from '../tests/setup'
|
|
3
3
|
|
|
4
4
|
let ENSInstance: ENS
|
|
5
5
|
|
|
@@ -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
|
})
|
|
@@ -2,6 +2,7 @@ import { formatsByCoinType, formatsByName } from '@ensdomains/address-encoder'
|
|
|
2
2
|
import { ethers } from 'ethers'
|
|
3
3
|
import { ENSArgs } from '..'
|
|
4
4
|
import { decodeContenthash } from '../utils/contentHash'
|
|
5
|
+
import { namehash } from '../utils/normalise'
|
|
5
6
|
|
|
6
7
|
export const _getContentHash = {
|
|
7
8
|
raw: async ({ contracts }: ENSArgs<'contracts'>, name: string) => {
|
|
@@ -9,16 +10,22 @@ export const _getContentHash = {
|
|
|
9
10
|
return {
|
|
10
11
|
to: '0x0000000000000000000000000000000000000000',
|
|
11
12
|
data: publicResolver.interface.encodeFunctionData('contenthash', [
|
|
12
|
-
|
|
13
|
+
namehash(name),
|
|
13
14
|
]),
|
|
14
15
|
}
|
|
15
16
|
},
|
|
16
17
|
decode: async ({ contracts }: ENSArgs<'contracts'>, data: string) => {
|
|
18
|
+
let response: any
|
|
17
19
|
const publicResolver = await contracts?.getPublicResolver()!
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
try {
|
|
21
|
+
;[response] = publicResolver.interface.decodeFunctionResult(
|
|
22
|
+
'contenthash',
|
|
23
|
+
data,
|
|
24
|
+
)
|
|
25
|
+
} catch {
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
if (!response) {
|
|
23
30
|
return
|
|
24
31
|
}
|
|
@@ -66,7 +73,7 @@ export const _getText = {
|
|
|
66
73
|
return {
|
|
67
74
|
to: '0x0000000000000000000000000000000000000000',
|
|
68
75
|
data: publicResolver.interface.encodeFunctionData('text', [
|
|
69
|
-
|
|
76
|
+
namehash(name),
|
|
70
77
|
key,
|
|
71
78
|
]),
|
|
72
79
|
}
|
|
@@ -115,12 +122,22 @@ export const _getAddr = {
|
|
|
115
122
|
}
|
|
116
123
|
|
|
117
124
|
const publicResolver = await contracts?.getPublicResolver()!
|
|
125
|
+
|
|
126
|
+
if (coinType === 60 || coinType === '60') {
|
|
127
|
+
return {
|
|
128
|
+
to: '0x0000000000000000000000000000000000000000',
|
|
129
|
+
data: publicResolver.interface.encodeFunctionData('addr(bytes32)', [
|
|
130
|
+
namehash(name),
|
|
131
|
+
]),
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
118
135
|
if (bypassFormat) {
|
|
119
136
|
return {
|
|
120
137
|
to: '0x0000000000000000000000000000000000000000',
|
|
121
138
|
data: publicResolver.interface.encodeFunctionData(
|
|
122
139
|
'addr(bytes32,uint256)',
|
|
123
|
-
[
|
|
140
|
+
[namehash(name), coinType],
|
|
124
141
|
),
|
|
125
142
|
}
|
|
126
143
|
}
|
|
@@ -139,7 +156,7 @@ export const _getAddr = {
|
|
|
139
156
|
to: '0x0000000000000000000000000000000000000000',
|
|
140
157
|
data: publicResolver.interface.encodeFunctionData(
|
|
141
158
|
'addr(bytes32,uint256)',
|
|
142
|
-
[
|
|
159
|
+
[namehash(name), formatter.coinType],
|
|
143
160
|
),
|
|
144
161
|
}
|
|
145
162
|
},
|
|
@@ -163,10 +180,19 @@ export const _getAddr = {
|
|
|
163
180
|
typeof coinType === 'number' ? coinType : parseInt(coinType)
|
|
164
181
|
]
|
|
165
182
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
183
|
+
let response: string
|
|
184
|
+
|
|
185
|
+
if (coinType === 60 || coinType === '60') {
|
|
186
|
+
;[response] = publicResolver.interface.decodeFunctionResult(
|
|
187
|
+
'addr(bytes32)',
|
|
188
|
+
data,
|
|
189
|
+
)
|
|
190
|
+
} else {
|
|
191
|
+
;[response] = publicResolver.interface.decodeFunctionResult(
|
|
192
|
+
'addr(bytes32,uint256)',
|
|
193
|
+
data,
|
|
194
|
+
)
|
|
195
|
+
}
|
|
170
196
|
|
|
171
197
|
if (!response) return
|
|
172
198
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ENS } from '..'
|
|
2
|
+
import setup from '../tests/setup'
|
|
3
|
+
|
|
4
|
+
let ENSInstance: ENS
|
|
5
|
+
|
|
6
|
+
beforeAll(async () => {
|
|
7
|
+
;({ ENSInstance } = await setup())
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const testProperties = (obj: object, ...properties: string[]) =>
|
|
11
|
+
properties.map((property) => expect(obj).toHaveProperty(property))
|
|
12
|
+
|
|
13
|
+
describe('getSubnames', () => {
|
|
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
|
+
// })
|
|
35
|
+
})
|