@ensdomains/ensjs 3.0.0-beta.1 → 3.0.0-beta.3
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/clients/decorators/subgraph.js.map +1 -1
- package/dist/cjs/contracts/consts.js +52 -1
- package/dist/cjs/contracts/consts.js.map +1 -1
- package/dist/cjs/dns.js +3 -3
- package/dist/cjs/dns.js.map +1 -1
- package/dist/cjs/errors/subgraph.js.map +1 -1
- package/dist/cjs/errors/utils.js +15 -18
- package/dist/cjs/errors/utils.js.map +1 -1
- package/dist/cjs/errors/version.js +1 -1
- package/dist/cjs/functions/dns/{prepareDnsImport.js → getDnsImportData.js} +3 -3
- package/dist/cjs/functions/dns/{prepareDnsImport.js.map → getDnsImportData.js.map} +1 -1
- package/dist/cjs/functions/dns/importDnsName.js +7 -7
- package/dist/cjs/functions/dns/importDnsName.js.map +1 -1
- package/dist/cjs/functions/public/_getContentHash.js +1 -1
- package/dist/cjs/functions/public/getSupportedInterfaces.js +1 -1
- package/dist/cjs/functions/public/getSupportedInterfaces.js.map +1 -1
- package/dist/cjs/functions/public/getWrapperData.js.map +1 -1
- package/dist/cjs/functions/subgraph/filters.js +3 -0
- package/dist/cjs/functions/subgraph/filters.js.map +1 -0
- package/dist/cjs/functions/subgraph/getNameHistory.js +1 -1
- package/dist/cjs/functions/subgraph/getNamesForAddress.js +140 -182
- package/dist/cjs/functions/subgraph/getNamesForAddress.js.map +1 -1
- package/dist/cjs/functions/subgraph/getSubnames.js +95 -108
- package/dist/cjs/functions/subgraph/getSubnames.js.map +1 -1
- package/dist/cjs/functions/subgraph/types.js +3 -0
- package/dist/cjs/functions/subgraph/types.js.map +1 -0
- package/dist/cjs/functions/subgraph/utils.js.map +1 -1
- package/dist/cjs/functions/wallet/createSubname.js +1 -1
- package/dist/cjs/functions/wallet/createSubname.js.map +1 -1
- package/dist/cjs/functions/wallet/setChildFuses.js +1 -1
- package/dist/cjs/functions/wallet/setChildFuses.js.map +1 -1
- package/dist/cjs/functions/wallet/setFuses.js +1 -1
- package/dist/cjs/functions/wallet/setFuses.js.map +1 -1
- package/dist/cjs/functions/wallet/wrapName.js +3 -1
- package/dist/cjs/functions/wallet/wrapName.js.map +1 -1
- package/dist/cjs/index.js +1 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/contentHash.js +54 -131
- package/dist/cjs/utils/contentHash.js.map +1 -1
- package/dist/cjs/utils/encoders/encodeSetContentHash.js +1 -4
- package/dist/cjs/utils/encoders/encodeSetContentHash.js.map +1 -1
- package/dist/cjs/utils/format.js +1 -5
- package/dist/cjs/utils/format.js.map +1 -1
- package/dist/cjs/utils/fuses.js +181 -200
- package/dist/cjs/utils/fuses.js.map +1 -1
- package/dist/cjs/utils/index.js +4 -7
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/registerHelpers.js +3 -1
- package/dist/cjs/utils/registerHelpers.js.map +1 -1
- package/dist/esm/clients/decorators/subgraph.js.map +1 -1
- package/dist/esm/contracts/consts.js +52 -1
- package/dist/esm/contracts/consts.js.map +1 -1
- package/dist/esm/dns.js +1 -1
- package/dist/esm/dns.js.map +1 -1
- package/dist/esm/errors/subgraph.js.map +1 -1
- package/dist/esm/errors/utils.js +13 -16
- package/dist/esm/errors/utils.js.map +1 -1
- package/dist/esm/errors/version.js +1 -1
- package/dist/esm/functions/dns/{prepareDnsImport.js → getDnsImportData.js} +9 -10
- package/dist/esm/functions/dns/getDnsImportData.js.map +1 -0
- package/dist/esm/functions/dns/importDnsName.js +12 -12
- package/dist/esm/functions/dns/importDnsName.js.map +1 -1
- package/dist/esm/functions/public/_getContentHash.js +2 -2
- package/dist/esm/functions/public/getSupportedInterfaces.js +2 -2
- package/dist/esm/functions/public/getSupportedInterfaces.js.map +1 -1
- package/dist/esm/functions/public/getWrapperData.js.map +1 -1
- package/dist/esm/functions/subgraph/filters.js +2 -0
- package/dist/esm/functions/subgraph/filters.js.map +1 -0
- package/dist/esm/functions/subgraph/getNameHistory.js +2 -2
- package/dist/esm/functions/subgraph/getNamesForAddress.js +144 -183
- package/dist/esm/functions/subgraph/getNamesForAddress.js.map +1 -1
- package/dist/esm/functions/subgraph/getSubnames.js +101 -111
- package/dist/esm/functions/subgraph/getSubnames.js.map +1 -1
- package/dist/esm/functions/subgraph/types.js +2 -0
- package/dist/esm/functions/subgraph/types.js.map +1 -0
- package/dist/esm/functions/subgraph/utils.js.map +1 -1
- package/dist/esm/functions/wallet/createSubname.js +1 -1
- package/dist/esm/functions/wallet/createSubname.js.map +1 -1
- package/dist/esm/functions/wallet/setChildFuses.js +1 -1
- package/dist/esm/functions/wallet/setChildFuses.js.map +1 -1
- package/dist/esm/functions/wallet/setFuses.js +2 -2
- package/dist/esm/functions/wallet/setFuses.js.map +1 -1
- package/dist/esm/functions/wallet/wrapName.js +4 -2
- package/dist/esm/functions/wallet/wrapName.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/contentHash.js +51 -128
- package/dist/esm/utils/contentHash.js.map +1 -1
- package/dist/esm/utils/encoders/encodeSetContentHash.js +2 -5
- package/dist/esm/utils/encoders/encodeSetContentHash.js.map +1 -1
- package/dist/esm/utils/format.js +0 -2
- package/dist/esm/utils/format.js.map +1 -1
- package/dist/esm/utils/fuses.js +180 -201
- package/dist/esm/utils/fuses.js.map +1 -1
- package/dist/esm/utils/index.js +2 -2
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/registerHelpers.js +4 -2
- package/dist/esm/utils/registerHelpers.js.map +1 -1
- package/dist/types/clients/decorators/subgraph.d.ts +1 -1
- package/dist/types/clients/decorators/subgraph.d.ts.map +1 -1
- package/dist/types/clients/decorators/wallet.d.ts +12 -12
- package/dist/types/clients/public.d.ts +1 -1
- package/dist/types/clients/subgraph.d.ts +1 -1
- package/dist/types/clients/wallet.d.ts +43 -79
- package/dist/types/clients/wallet.d.ts.map +1 -1
- package/dist/types/contracts/consts.d.ts +51 -2
- package/dist/types/contracts/consts.d.ts.map +1 -1
- package/dist/types/dns.d.ts +1 -1
- package/dist/types/dns.d.ts.map +1 -1
- package/dist/types/errors/subgraph.d.ts +4 -4
- package/dist/types/errors/subgraph.d.ts.map +1 -1
- package/dist/types/errors/utils.d.ts +10 -13
- package/dist/types/errors/utils.d.ts.map +1 -1
- package/dist/types/errors/version.d.ts +1 -1
- package/dist/types/functions/dns/{prepareDnsImport.d.ts → getDnsImportData.d.ts} +11 -12
- package/dist/types/functions/dns/{prepareDnsImport.d.ts.map → getDnsImportData.d.ts.map} +1 -1
- package/dist/types/functions/dns/importDnsName.d.ts +36 -36
- package/dist/types/functions/dns/importDnsName.d.ts.map +1 -1
- package/dist/types/functions/public/getSupportedInterfaces.d.ts +19 -4
- package/dist/types/functions/public/getSupportedInterfaces.d.ts.map +1 -1
- package/dist/types/functions/public/getWrapperData.d.ts +2 -2
- package/dist/types/functions/public/getWrapperData.d.ts.map +1 -1
- package/dist/types/functions/subgraph/filters.d.ts +693 -0
- package/dist/types/functions/subgraph/filters.d.ts.map +1 -0
- package/dist/types/functions/subgraph/getNamesForAddress.d.ts +2 -0
- package/dist/types/functions/subgraph/getNamesForAddress.d.ts.map +1 -1
- package/dist/types/functions/subgraph/getSubnames.d.ts +3 -1
- package/dist/types/functions/subgraph/getSubnames.d.ts.map +1 -1
- package/dist/types/functions/subgraph/types.d.ts +13 -0
- package/dist/types/functions/subgraph/types.d.ts.map +1 -0
- package/dist/types/functions/subgraph/utils.d.ts +2 -2
- package/dist/types/functions/subgraph/utils.d.ts.map +1 -1
- package/dist/types/functions/wallet/commitName.d.ts +25 -25
- package/dist/types/functions/wallet/createSubname.d.ts +28 -28
- package/dist/types/functions/wallet/createSubname.d.ts.map +1 -1
- package/dist/types/functions/wallet/deleteSubname.d.ts +25 -25
- package/dist/types/functions/wallet/registerName.d.ts +24 -24
- package/dist/types/functions/wallet/renewNames.d.ts +24 -24
- package/dist/types/functions/wallet/setAbiRecord.d.ts +25 -25
- package/dist/types/functions/wallet/setAddressRecord.d.ts +25 -25
- package/dist/types/functions/wallet/setChildFuses.d.ts +27 -27
- package/dist/types/functions/wallet/setChildFuses.d.ts.map +1 -1
- package/dist/types/functions/wallet/setContentHashRecord.d.ts +25 -25
- package/dist/types/functions/wallet/setFuses.d.ts +27 -27
- package/dist/types/functions/wallet/setFuses.d.ts.map +1 -1
- package/dist/types/functions/wallet/setPrimaryName.d.ts +25 -25
- package/dist/types/functions/wallet/setRecords.d.ts +25 -25
- package/dist/types/functions/wallet/setResolver.d.ts +25 -25
- package/dist/types/functions/wallet/setTextRecord.d.ts +25 -25
- package/dist/types/functions/wallet/transferName.d.ts +25 -25
- package/dist/types/functions/wallet/unwrapName.d.ts +25 -25
- package/dist/types/functions/wallet/wrapName.d.ts +27 -27
- package/dist/types/functions/wallet/wrapName.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/utils/contentHash.d.ts +7 -11
- package/dist/types/utils/contentHash.d.ts.map +1 -1
- package/dist/types/utils/encoders/encodeSetContentHash.d.ts.map +1 -1
- package/dist/types/utils/format.d.ts +0 -2
- package/dist/types/utils/format.d.ts.map +1 -1
- package/dist/types/utils/fuses.d.ts +164 -125
- package/dist/types/utils/fuses.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +2 -2
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/registerHelpers.d.ts +2 -2
- package/dist/types/utils/registerHelpers.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/clients/decorators/subgraph.ts +1 -0
- package/src/contracts/consts.ts +57 -12
- package/src/dns.ts +5 -5
- package/src/errors/subgraph.ts +4 -4
- package/src/errors/utils.ts +21 -18
- package/src/errors/version.ts +1 -1
- package/src/functions/dns/{prepareDnsImport.ts → getDnsImportData.ts} +12 -13
- package/src/functions/dns/importDnsName.ts +20 -15
- package/src/functions/public/_getContentHash.ts +2 -2
- package/src/functions/public/getSupportedInterfaces.ts +48 -10
- package/src/functions/public/getWrapperData.ts +2 -2
- package/src/functions/subgraph/filters.ts +702 -0
- package/src/functions/subgraph/getNameHistory.ts +2 -2
- package/src/functions/subgraph/getNamesForAddress.ts +170 -186
- package/src/functions/subgraph/getSubnames.ts +121 -113
- package/src/functions/subgraph/types.ts +13 -0
- package/src/functions/subgraph/utils.ts +2 -2
- package/src/functions/wallet/createSubname.ts +4 -4
- package/src/functions/wallet/setChildFuses.ts +3 -3
- package/src/functions/wallet/setFuses.ts +6 -3
- package/src/functions/wallet/wrapName.ts +8 -3
- package/src/index.ts +0 -1
- package/src/utils/contentHash.ts +59 -113
- package/src/utils/encoders/encodeSetContentHash.ts +2 -4
- package/src/utils/format.ts +0 -6
- package/src/utils/fuses.ts +308 -308
- package/src/utils/index.ts +4 -5
- package/src/utils/registerHelpers.ts +5 -3
- package/dist/esm/functions/dns/prepareDnsImport.js.map +0 -1
- package/src/@types/@ensdomains/content-hash.d.ts +0 -1
- package/src/functions/dns/getDnsOwner.test.ts +0 -195
- package/src/functions/dns/importDnsName.test.ts +0 -117
- package/src/functions/dns/prepareDnsImport.test.ts +0 -115
- package/src/functions/public/batch.test.ts +0 -67
- package/src/functions/public/ccip.test.ts +0 -78
- package/src/functions/public/getAbiRecord.test.ts +0 -174
- package/src/functions/public/getAddressRecord.test.ts +0 -83
- package/src/functions/public/getAvailable.test.ts +0 -17
- package/src/functions/public/getContentHashRecord.test.ts +0 -28
- package/src/functions/public/getExpiry.test.ts +0 -48
- package/src/functions/public/getName.test.ts +0 -66
- package/src/functions/public/getOwner.test.ts +0 -87
- package/src/functions/public/getPrice.test.ts +0 -45
- package/src/functions/public/getRecords.test.ts +0 -49
- package/src/functions/public/getResolver.test.ts +0 -12
- package/src/functions/public/getTextRecord.test.ts +0 -20
- package/src/functions/public/getWrapperData.test.ts +0 -79
- package/src/functions/public/getWrapperName.test.ts +0 -19
- package/src/functions/subgraph/client.test.ts +0 -170
- package/src/functions/subgraph/getDecodedName.test.ts +0 -31
- package/src/functions/subgraph/getNameHistory.test.ts +0 -39
- package/src/functions/subgraph/getNamesForAddress.test.ts +0 -244
- package/src/functions/subgraph/getSubgraphRecords.test.ts +0 -74
- package/src/functions/subgraph/getSubgraphRegistrant.test.ts +0 -34
- package/src/functions/subgraph/getSubnames.test.ts +0 -202
- package/src/functions/wallet/commitName.test.ts +0 -58
- package/src/functions/wallet/createSubname.test.ts +0 -73
- package/src/functions/wallet/deleteSubname.test.ts +0 -150
- package/src/functions/wallet/registerName.test.ts +0 -81
- package/src/functions/wallet/renewNames.test.ts +0 -92
- package/src/functions/wallet/setAbiRecord.test.ts +0 -156
- package/src/functions/wallet/setAddressRecord.test.ts +0 -121
- package/src/functions/wallet/setChildFuses.test.ts +0 -97
- package/src/functions/wallet/setContentHashRecord.test.ts +0 -69
- package/src/functions/wallet/setFuses.test.ts +0 -287
- package/src/functions/wallet/setPrimaryName.test.ts +0 -71
- package/src/functions/wallet/setRecords.test.ts +0 -127
- package/src/functions/wallet/setResolver.test.ts +0 -114
- package/src/functions/wallet/setTextRecord.test.ts +0 -67
- package/src/functions/wallet/transferName.test.ts +0 -201
- package/src/functions/wallet/unwrapName.test.ts +0 -93
- package/src/functions/wallet/wrapName.test.ts +0 -195
- package/src/utils/generateRecordCallArray.test.ts +0 -84
- package/src/utils/labels.test.ts +0 -163
- package/src/utils/makeLabelNodeAndParent.test.ts +0 -11
- package/src/utils/makeSafeSecondsDate.test.ts +0 -14
- package/src/utils/normalise.test.ts +0 -35
- package/src/utils/ownerFromContract.test.ts +0 -52
- package/src/utils/registerHelpers.test.ts +0 -159
- package/src/utils/validation.test.ts +0 -170
- package/src/utils/wrapper.test.ts +0 -46
package/src/utils/index.ts
CHANGED
|
@@ -34,15 +34,14 @@ export {
|
|
|
34
34
|
} from './consts.js'
|
|
35
35
|
|
|
36
36
|
export {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
decodeContentHash,
|
|
38
|
+
encodeContentHash,
|
|
39
39
|
getProtocolType,
|
|
40
|
-
|
|
41
|
-
validateContent,
|
|
40
|
+
isValidContentHash,
|
|
42
41
|
type DecodedContentHash,
|
|
43
42
|
type ProtocolType,
|
|
44
43
|
} from './contentHash.js'
|
|
45
|
-
export {
|
|
44
|
+
export { truncateFormat } from './format.js'
|
|
46
45
|
export {
|
|
47
46
|
generateRecordCallArray,
|
|
48
47
|
type RecordOptions,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from 'viem'
|
|
11
11
|
import { CampaignReferenceTooLargeError } from '../errors/utils.js'
|
|
12
12
|
import { EMPTY_ADDRESS } from './consts.js'
|
|
13
|
-
import { encodeFuses,
|
|
13
|
+
import { encodeFuses, type EncodeChildFusesInputObject } from './fuses.js'
|
|
14
14
|
import {
|
|
15
15
|
generateRecordCallArray,
|
|
16
16
|
type RecordOptions,
|
|
@@ -33,7 +33,7 @@ export type RegistrationParameters = {
|
|
|
33
33
|
/** Sets primary name upon registration */
|
|
34
34
|
reverseRecord?: boolean
|
|
35
35
|
/** Fuses to set upon registration */
|
|
36
|
-
fuses?:
|
|
36
|
+
fuses?: EncodeChildFusesInputObject
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export type CommitmentTuple = [
|
|
@@ -95,7 +95,9 @@ export const makeCommitmentTuple = ({
|
|
|
95
95
|
}: RegistrationParameters): CommitmentTuple => {
|
|
96
96
|
const labelHash = labelhash(name.split('.')[0])
|
|
97
97
|
const hash = namehash(name)
|
|
98
|
-
const fuseData =
|
|
98
|
+
const fuseData = fuses
|
|
99
|
+
? encodeFuses({ restriction: 'child', input: fuses })
|
|
100
|
+
: 0
|
|
99
101
|
|
|
100
102
|
if (
|
|
101
103
|
reverseRecord &&
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prepareDnsImport.js","sourceRoot":"","sources":["../../../../src/functions/dns/prepareDnsImport.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
declare module '@ensdomains/content-hash'
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
-
import type { RequestListener } from 'http'
|
|
3
|
-
import { getVersion } from '../../errors/error-utils.js'
|
|
4
|
-
import { createHttpServer } from '../../tests/createHttpServer.js'
|
|
5
|
-
import getDnsOwner from './getDnsOwner.js'
|
|
6
|
-
|
|
7
|
-
const handler: jest.MockedFunction<RequestListener> = jest.fn()
|
|
8
|
-
let closeServer: () => Promise<unknown>
|
|
9
|
-
let serverUrl: `http://${string}` = 'http://'
|
|
10
|
-
|
|
11
|
-
beforeAll(async () => {
|
|
12
|
-
const { close, url } = await createHttpServer(handler)
|
|
13
|
-
closeServer = close
|
|
14
|
-
serverUrl = url
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
afterAll(async () => {
|
|
18
|
-
await closeServer()
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
handler.mockReset()
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it('returns valid address from valid domain and record', async () => {
|
|
26
|
-
let name
|
|
27
|
-
let type
|
|
28
|
-
handler.mockImplementation((req, res) => {
|
|
29
|
-
const url = new URL(req.url!, `http://${req.headers.host!}`)
|
|
30
|
-
name = url.searchParams.get('name')
|
|
31
|
-
type = url.searchParams.get('type')
|
|
32
|
-
|
|
33
|
-
res.writeHead(200, { 'Content-Type': 'application/dns-json' })
|
|
34
|
-
res.end(
|
|
35
|
-
JSON.stringify({
|
|
36
|
-
Status: 0,
|
|
37
|
-
AD: true,
|
|
38
|
-
Answer: [
|
|
39
|
-
{
|
|
40
|
-
name: '_ens.example.com',
|
|
41
|
-
type: 16,
|
|
42
|
-
TTL: 0,
|
|
43
|
-
data: '"a=0x8e8Db5CcEF88cca9d624701Db544989C996E3216"',
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
}),
|
|
47
|
-
)
|
|
48
|
-
res.destroy()
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
const result = await getDnsOwner({ name: 'example.com', endpoint: serverUrl })
|
|
52
|
-
expect(handler).toHaveBeenCalled()
|
|
53
|
-
expect(name).toBe('_ens.example.com.')
|
|
54
|
-
expect(type).toBe('TXT')
|
|
55
|
-
expect(result).toEqual('0x8e8Db5CcEF88cca9d624701Db544989C996E3216')
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
it('throws error if .eth', async () => {
|
|
59
|
-
await expect(getDnsOwner({ name: 'example.eth' })).rejects
|
|
60
|
-
.toThrowErrorMatchingInlineSnapshot(`
|
|
61
|
-
"Unsupported name type: eth-2ld
|
|
62
|
-
|
|
63
|
-
- Supported name types: other-2ld
|
|
64
|
-
|
|
65
|
-
Version: ${getVersion()}"
|
|
66
|
-
`)
|
|
67
|
-
})
|
|
68
|
-
it('throws error if >2ld', async () => {
|
|
69
|
-
await expect(getDnsOwner({ name: 'subdomain.example.com' })).rejects
|
|
70
|
-
.toThrowErrorMatchingInlineSnapshot(`
|
|
71
|
-
"Unsupported name type: other-subname
|
|
72
|
-
|
|
73
|
-
- Supported name types: other-2ld
|
|
74
|
-
|
|
75
|
-
Version: ${getVersion()}"
|
|
76
|
-
`)
|
|
77
|
-
})
|
|
78
|
-
it('returns error if DnsResponseStatus is not NOERROR', async () => {
|
|
79
|
-
handler.mockImplementation((_req, res) => {
|
|
80
|
-
res.writeHead(200, { 'Content-Type': 'application/dns-json' })
|
|
81
|
-
res.end(
|
|
82
|
-
JSON.stringify({
|
|
83
|
-
Status: 3, // NXDOMAIN
|
|
84
|
-
AD: true,
|
|
85
|
-
}),
|
|
86
|
-
)
|
|
87
|
-
res.destroy()
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
await expect(getDnsOwner({ name: 'example.com', endpoint: serverUrl }))
|
|
91
|
-
.rejects.toThrowErrorMatchingInlineSnapshot(`
|
|
92
|
-
"DNS query failed with status: NXDOMAIN
|
|
93
|
-
|
|
94
|
-
Version: ${getVersion()}"
|
|
95
|
-
`)
|
|
96
|
-
})
|
|
97
|
-
it('returns error if AD is false', async () => {
|
|
98
|
-
handler.mockImplementation((_req, res) => {
|
|
99
|
-
res.writeHead(200, { 'Content-Type': 'application/dns-json' })
|
|
100
|
-
res.end(
|
|
101
|
-
JSON.stringify({
|
|
102
|
-
Status: 0,
|
|
103
|
-
AD: false,
|
|
104
|
-
}),
|
|
105
|
-
)
|
|
106
|
-
res.destroy()
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
await expect(getDnsOwner({ name: 'example.com', endpoint: serverUrl }))
|
|
110
|
-
.rejects.toThrowErrorMatchingInlineSnapshot(`
|
|
111
|
-
"DNSSEC verification failed
|
|
112
|
-
|
|
113
|
-
Version: ${getVersion()}"
|
|
114
|
-
`)
|
|
115
|
-
})
|
|
116
|
-
it('returns error if no TXT record', async () => {
|
|
117
|
-
handler.mockImplementation((_req, res) => {
|
|
118
|
-
res.writeHead(200, { 'Content-Type': 'application/dns-json' })
|
|
119
|
-
res.end(
|
|
120
|
-
JSON.stringify({
|
|
121
|
-
Status: 0,
|
|
122
|
-
AD: true,
|
|
123
|
-
Answer: [],
|
|
124
|
-
}),
|
|
125
|
-
)
|
|
126
|
-
res.destroy()
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
await expect(getDnsOwner({ name: 'example.com', endpoint: serverUrl }))
|
|
130
|
-
.rejects.toThrowErrorMatchingInlineSnapshot(`
|
|
131
|
-
"No TXT record found
|
|
132
|
-
|
|
133
|
-
Version: ${getVersion()}"
|
|
134
|
-
`)
|
|
135
|
-
})
|
|
136
|
-
it('returns error if TXT record is not formatted correctly', async () => {
|
|
137
|
-
handler.mockImplementation((_req, res) => {
|
|
138
|
-
res.writeHead(200, { 'Content-Type': 'application/dns-json' })
|
|
139
|
-
res.end(
|
|
140
|
-
JSON.stringify({
|
|
141
|
-
Status: 0,
|
|
142
|
-
AD: true,
|
|
143
|
-
Answer: [
|
|
144
|
-
{
|
|
145
|
-
name: '_ens.example.com',
|
|
146
|
-
type: 16,
|
|
147
|
-
TTL: 0,
|
|
148
|
-
data: '"0x8e8Db5CcEF88cca9d624701Db544989C996E3216"',
|
|
149
|
-
},
|
|
150
|
-
],
|
|
151
|
-
}),
|
|
152
|
-
)
|
|
153
|
-
res.destroy()
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
await expect(getDnsOwner({ name: 'example.com', endpoint: serverUrl }))
|
|
157
|
-
.rejects.toThrowErrorMatchingInlineSnapshot(`
|
|
158
|
-
"Invalid TXT record: 0x8e8Db5CcEF88cca9d624701Db544989C996E3216
|
|
159
|
-
|
|
160
|
-
Version: ${getVersion()}"
|
|
161
|
-
`)
|
|
162
|
-
})
|
|
163
|
-
it('returns error if address is not checksummed', async () => {
|
|
164
|
-
handler.mockImplementation((_req, res) => {
|
|
165
|
-
res.writeHead(200, { 'Content-Type': 'application/dns-json' })
|
|
166
|
-
res.end(
|
|
167
|
-
JSON.stringify({
|
|
168
|
-
Status: 0,
|
|
169
|
-
AD: true,
|
|
170
|
-
Answer: [
|
|
171
|
-
{
|
|
172
|
-
name: '_ens.example.com',
|
|
173
|
-
type: 16,
|
|
174
|
-
TTL: 0,
|
|
175
|
-
data: '"a=0x8e8db5CcEF88cca9d624701Db544989C996E3216"',
|
|
176
|
-
},
|
|
177
|
-
],
|
|
178
|
-
}),
|
|
179
|
-
)
|
|
180
|
-
res.destroy()
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
await expect(getDnsOwner({ name: 'example.com', endpoint: serverUrl }))
|
|
184
|
-
.rejects.toThrowErrorMatchingInlineSnapshot(`
|
|
185
|
-
"Invalid address checksum: 0x8e8db5CcEF88cca9d624701Db544989C996E3216
|
|
186
|
-
|
|
187
|
-
Version: ${getVersion()}"
|
|
188
|
-
`)
|
|
189
|
-
})
|
|
190
|
-
it('real test', async () => {
|
|
191
|
-
const result = await getDnsOwner({
|
|
192
|
-
name: 'taytems.xyz',
|
|
193
|
-
})
|
|
194
|
-
expect(result).toEqual('0x8e8Db5CcEF88cca9d624701Db544989C996E3216')
|
|
195
|
-
})
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { parseEther, type Address, type Hex } from 'viem'
|
|
2
|
-
import { getChainContractAddress } from '../../contracts/getChainContractAddress.js'
|
|
3
|
-
import { getVersion } from '../../errors/error-utils.js'
|
|
4
|
-
import {
|
|
5
|
-
publicClient,
|
|
6
|
-
testClient,
|
|
7
|
-
waitForTransaction,
|
|
8
|
-
walletClient,
|
|
9
|
-
} from '../../tests/addTestContracts.js'
|
|
10
|
-
import getOwner from '../public/getOwner.js'
|
|
11
|
-
import getResolver from '../public/getResolver.js'
|
|
12
|
-
import importDnsName from './importDnsName.js'
|
|
13
|
-
import prepareDnsImport from './prepareDnsImport.js'
|
|
14
|
-
|
|
15
|
-
const name = 'taytems.xyz'
|
|
16
|
-
const address = '0x8e8Db5CcEF88cca9d624701Db544989C996E3216'
|
|
17
|
-
|
|
18
|
-
let snapshot: Hex
|
|
19
|
-
let accounts: Address[]
|
|
20
|
-
|
|
21
|
-
beforeAll(async () => {
|
|
22
|
-
accounts = await walletClient.getAddresses()
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
beforeEach(async () => {
|
|
26
|
-
snapshot = await testClient.snapshot()
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
afterEach(async () => {
|
|
30
|
-
await testClient.revert({ id: snapshot })
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
it('should import a DNS name with no address', async () => {
|
|
34
|
-
const tx = await importDnsName(walletClient, {
|
|
35
|
-
name,
|
|
36
|
-
preparedData: await prepareDnsImport(publicClient, { name }),
|
|
37
|
-
account: accounts[0],
|
|
38
|
-
})
|
|
39
|
-
expect(tx).toBeTruthy()
|
|
40
|
-
const receipt = await waitForTransaction(tx)
|
|
41
|
-
expect(receipt.status).toBe('success')
|
|
42
|
-
|
|
43
|
-
const owner = await getOwner(publicClient, { name })
|
|
44
|
-
expect(owner!.owner).toBe(address)
|
|
45
|
-
})
|
|
46
|
-
it('should import a DNS name with an address, using default resolver', async () => {
|
|
47
|
-
await testClient.impersonateAccount({ address })
|
|
48
|
-
await testClient.setBalance({
|
|
49
|
-
address,
|
|
50
|
-
value: parseEther('1'),
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
const tx = await importDnsName(walletClient, {
|
|
54
|
-
name,
|
|
55
|
-
address,
|
|
56
|
-
preparedData: await prepareDnsImport(publicClient, { name }),
|
|
57
|
-
account: address,
|
|
58
|
-
})
|
|
59
|
-
expect(tx).toBeTruthy()
|
|
60
|
-
const receipt = await waitForTransaction(tx)
|
|
61
|
-
expect(receipt.status).toBe('success')
|
|
62
|
-
|
|
63
|
-
const owner = await getOwner(publicClient, { name })
|
|
64
|
-
expect(owner!.owner).toBe(address)
|
|
65
|
-
const resolver = await getResolver(publicClient, { name })
|
|
66
|
-
expect(resolver).toBe(
|
|
67
|
-
getChainContractAddress({
|
|
68
|
-
client: publicClient,
|
|
69
|
-
contract: 'ensPublicResolver',
|
|
70
|
-
}),
|
|
71
|
-
)
|
|
72
|
-
})
|
|
73
|
-
it('should import a DNS name with an address, using a custom resolver', async () => {
|
|
74
|
-
await testClient.impersonateAccount({ address })
|
|
75
|
-
await testClient.setBalance({
|
|
76
|
-
address,
|
|
77
|
-
value: parseEther('1'),
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
const legacyResolverAddress = JSON.parse(
|
|
81
|
-
process.env.DEPLOYMENT_ADDRESSES!,
|
|
82
|
-
).LegacyPublicResolver
|
|
83
|
-
|
|
84
|
-
const tx = await importDnsName(walletClient, {
|
|
85
|
-
name,
|
|
86
|
-
address,
|
|
87
|
-
preparedData: await prepareDnsImport(publicClient, { name }),
|
|
88
|
-
account: address,
|
|
89
|
-
resolverAddress: legacyResolverAddress,
|
|
90
|
-
})
|
|
91
|
-
expect(tx).toBeTruthy()
|
|
92
|
-
const receipt = await waitForTransaction(tx)
|
|
93
|
-
expect(receipt.status).toBe('success')
|
|
94
|
-
|
|
95
|
-
const owner = await getOwner(publicClient, { name })
|
|
96
|
-
expect(owner!.owner).toBe(address)
|
|
97
|
-
const resolver = await getResolver(publicClient, { name })
|
|
98
|
-
expect(resolver).toBe(legacyResolverAddress)
|
|
99
|
-
})
|
|
100
|
-
it('should throw error if resolver is specified when claiming without an address', async () => {
|
|
101
|
-
await expect(
|
|
102
|
-
importDnsName(walletClient, {
|
|
103
|
-
name,
|
|
104
|
-
resolverAddress: address,
|
|
105
|
-
preparedData: await prepareDnsImport(publicClient, { name }),
|
|
106
|
-
account: accounts[0],
|
|
107
|
-
} as any),
|
|
108
|
-
).rejects.toThrowErrorMatchingInlineSnapshot(`
|
|
109
|
-
"Additional parameter specified: resolverAddress
|
|
110
|
-
|
|
111
|
-
- Allowed parameters: name, preparedData
|
|
112
|
-
|
|
113
|
-
Details: resolverAddress cannot be specified when claiming without an address
|
|
114
|
-
|
|
115
|
-
Version: ${getVersion()}"
|
|
116
|
-
`)
|
|
117
|
-
})
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { SignedSet } from '@ensdomains/dnsprovejs'
|
|
2
|
-
import type { Address, Hex } from 'viem'
|
|
3
|
-
import {
|
|
4
|
-
publicClient,
|
|
5
|
-
testClient,
|
|
6
|
-
waitForTransaction,
|
|
7
|
-
walletClient,
|
|
8
|
-
} from '../../tests/addTestContracts.js'
|
|
9
|
-
import importDnsName from './importDnsName.js'
|
|
10
|
-
import prepareDnsImport, { type RrSetWithSig } from './prepareDnsImport.js'
|
|
11
|
-
|
|
12
|
-
let snapshot: Hex
|
|
13
|
-
let accounts: Address[]
|
|
14
|
-
|
|
15
|
-
beforeAll(async () => {
|
|
16
|
-
accounts = await walletClient.getAddresses()
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
beforeEach(async () => {
|
|
20
|
-
snapshot = await testClient.snapshot()
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
afterEach(async () => {
|
|
24
|
-
await testClient.revert({ id: snapshot })
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
const decodeProofs = (proofs: RrSetWithSig[]) =>
|
|
28
|
-
proofs.map((proof) =>
|
|
29
|
-
SignedSet.fromWire(proof.rrset as Buffer, proof.sig as Buffer),
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
jest.setTimeout(10000)
|
|
33
|
-
|
|
34
|
-
const wait = async (ms: number) =>
|
|
35
|
-
// eslint-disable-next-line no-promise-executor-return
|
|
36
|
-
new Promise((resolve) => setTimeout(resolve, ms))
|
|
37
|
-
|
|
38
|
-
it('returns all rrsets when no proofs are known', async () => {
|
|
39
|
-
const result = await prepareDnsImport(publicClient, {
|
|
40
|
-
name: 'taytems.xyz',
|
|
41
|
-
})
|
|
42
|
-
expect(result.rrsets.length).toBeGreaterThan(0)
|
|
43
|
-
expect(result.proof).toBeInstanceOf(Uint8Array)
|
|
44
|
-
const decodedProofs = decodeProofs(result.rrsets)
|
|
45
|
-
const rootProofs = decodedProofs.filter((x) => x.signature.name === '.')
|
|
46
|
-
const tldProofs = decodedProofs.filter((x) => x.signature.name === 'xyz')
|
|
47
|
-
const twoLDProofs = decodedProofs.filter(
|
|
48
|
-
(x) => x.signature.name === 'taytems.xyz',
|
|
49
|
-
)
|
|
50
|
-
const threeLDProofs = decodedProofs.filter(
|
|
51
|
-
(x) => x.signature.name === '_ens.taytems.xyz',
|
|
52
|
-
)
|
|
53
|
-
expect(rootProofs.length).toBeGreaterThan(0)
|
|
54
|
-
expect(tldProofs.length).toBeGreaterThan(0)
|
|
55
|
-
expect(twoLDProofs.length).toBeGreaterThan(0)
|
|
56
|
-
expect(threeLDProofs.length).toBeGreaterThan(0)
|
|
57
|
-
})
|
|
58
|
-
it('returns rrsets up to the first unknown proof', async () => {
|
|
59
|
-
const tx = await importDnsName(walletClient, {
|
|
60
|
-
name: 'taytems.xyz',
|
|
61
|
-
account: accounts[0],
|
|
62
|
-
preparedData: await prepareDnsImport(publicClient, { name: 'taytems.xyz' }),
|
|
63
|
-
})
|
|
64
|
-
expect(tx).toBeTruthy()
|
|
65
|
-
const receipt = await waitForTransaction(tx)
|
|
66
|
-
expect(receipt.status).toBe('success')
|
|
67
|
-
|
|
68
|
-
await wait(5000)
|
|
69
|
-
|
|
70
|
-
const result = await prepareDnsImport(publicClient, {
|
|
71
|
-
name: 'lenster.xyz',
|
|
72
|
-
})
|
|
73
|
-
const decodedProofs = decodeProofs(result.rrsets)
|
|
74
|
-
const rootProofs = decodedProofs.filter((x) => x.signature.name === '.')
|
|
75
|
-
const tldProofs = decodedProofs.filter((x) => x.signature.name === 'xyz')
|
|
76
|
-
const twoLDProofs = decodedProofs.filter(
|
|
77
|
-
(x) => x.signature.name === 'lenster.xyz',
|
|
78
|
-
)
|
|
79
|
-
const threeLDProofs = decodedProofs.filter(
|
|
80
|
-
(x) => x.signature.name === '_ens.lenster.xyz',
|
|
81
|
-
)
|
|
82
|
-
expect(rootProofs).toHaveLength(0)
|
|
83
|
-
expect(tldProofs).toHaveLength(0)
|
|
84
|
-
expect(twoLDProofs.length).toBeGreaterThan(0)
|
|
85
|
-
expect(threeLDProofs.length).toBeGreaterThan(0)
|
|
86
|
-
})
|
|
87
|
-
it('returns empty rrsets for all known proofs when the last proof is known', async () => {
|
|
88
|
-
const tx = await importDnsName(walletClient, {
|
|
89
|
-
name: 'taytems.xyz',
|
|
90
|
-
account: accounts[0],
|
|
91
|
-
preparedData: await prepareDnsImport(publicClient, { name: 'taytems.xyz' }),
|
|
92
|
-
})
|
|
93
|
-
expect(tx).toBeTruthy()
|
|
94
|
-
const receipt = await waitForTransaction(tx)
|
|
95
|
-
expect(receipt.status).toBe('success')
|
|
96
|
-
|
|
97
|
-
await wait(5000)
|
|
98
|
-
|
|
99
|
-
const result = await prepareDnsImport(publicClient, {
|
|
100
|
-
name: 'taytems.xyz',
|
|
101
|
-
})
|
|
102
|
-
const decodedProofs = decodeProofs(result.rrsets)
|
|
103
|
-
const rootProofs = decodedProofs.filter((x) => x.signature.name === '.')
|
|
104
|
-
const tldProofs = decodedProofs.filter((x) => x.signature.name === 'xyz')
|
|
105
|
-
const twoLDProofs = decodedProofs.filter(
|
|
106
|
-
(x) => x.signature.name === 'taytems.xyz',
|
|
107
|
-
)
|
|
108
|
-
const threeLDProofs = decodedProofs.filter(
|
|
109
|
-
(x) => x.signature.name === '_ens.taytems.xyz',
|
|
110
|
-
)
|
|
111
|
-
expect(rootProofs).toHaveLength(0)
|
|
112
|
-
expect(tldProofs).toHaveLength(0)
|
|
113
|
-
expect(twoLDProofs).toHaveLength(0)
|
|
114
|
-
expect(threeLDProofs).toHaveLength(0)
|
|
115
|
-
})
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { createPublicClient, http } from 'viem'
|
|
2
|
-
import { mainnet } from 'viem/chains'
|
|
3
|
-
import { addEnsContracts } from '../../contracts/addEnsContracts.js'
|
|
4
|
-
import {
|
|
5
|
-
deploymentAddresses,
|
|
6
|
-
publicClient,
|
|
7
|
-
} from '../../tests/addTestContracts.js'
|
|
8
|
-
import batch from './batch.js'
|
|
9
|
-
import getAddressRecord from './getAddressRecord.js'
|
|
10
|
-
import getName from './getName.js'
|
|
11
|
-
import getText from './getTextRecord.js'
|
|
12
|
-
|
|
13
|
-
const mainnetPublicClient = createPublicClient({
|
|
14
|
-
chain: addEnsContracts(mainnet),
|
|
15
|
-
transport: http('https://web3.ens.domains/v1/mainnet'),
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
describe('batch', () => {
|
|
19
|
-
it('should batch calls together', async () => {
|
|
20
|
-
const result = await batch(
|
|
21
|
-
publicClient,
|
|
22
|
-
getText.batch({ name: 'with-profile.eth', key: 'description' }),
|
|
23
|
-
getAddressRecord.batch({ name: 'with-profile.eth' }),
|
|
24
|
-
getName.batch({ address: '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC' }),
|
|
25
|
-
)
|
|
26
|
-
expect(result).toMatchInlineSnapshot(`
|
|
27
|
-
[
|
|
28
|
-
"Hello2",
|
|
29
|
-
{
|
|
30
|
-
"id": 60,
|
|
31
|
-
"name": "ETH",
|
|
32
|
-
"value": "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"match": true,
|
|
36
|
-
"name": "with-profile.eth",
|
|
37
|
-
"resolverAddress": "${deploymentAddresses.LegacyPublicResolver}",
|
|
38
|
-
"reverseResolverAddress": "${deploymentAddresses.PublicResolver}",
|
|
39
|
-
},
|
|
40
|
-
]
|
|
41
|
-
`)
|
|
42
|
-
})
|
|
43
|
-
it('should batch a single call', async () => {
|
|
44
|
-
const result = await batch(
|
|
45
|
-
publicClient,
|
|
46
|
-
getText.batch({ name: 'with-profile.eth', key: 'description' }),
|
|
47
|
-
)
|
|
48
|
-
expect(result).toMatchInlineSnapshot(`
|
|
49
|
-
[
|
|
50
|
-
"Hello2",
|
|
51
|
-
]
|
|
52
|
-
`)
|
|
53
|
-
})
|
|
54
|
-
it('should batch ccip', async () => {
|
|
55
|
-
const result = await batch(
|
|
56
|
-
mainnetPublicClient,
|
|
57
|
-
getText.batch({ name: '1.offchainexample.eth', key: 'email' }),
|
|
58
|
-
getText.batch({ name: '2.offchainexample.eth', key: 'email' }),
|
|
59
|
-
)
|
|
60
|
-
expect(result).toMatchInlineSnapshot(`
|
|
61
|
-
[
|
|
62
|
-
"nick@ens.domains",
|
|
63
|
-
"nick@ens.domains",
|
|
64
|
-
]
|
|
65
|
-
`)
|
|
66
|
-
})
|
|
67
|
-
})
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { createPublicClient, http } from 'viem'
|
|
2
|
-
import { goerli } from 'viem/chains'
|
|
3
|
-
import { addEnsContracts } from '../../contracts/addEnsContracts.js'
|
|
4
|
-
import batch from './batch.js'
|
|
5
|
-
import getAddressRecord from './getAddressRecord.js'
|
|
6
|
-
import getRecords from './getRecords.js'
|
|
7
|
-
import getText from './getTextRecord.js'
|
|
8
|
-
|
|
9
|
-
const goerliPublicClient = createPublicClient({
|
|
10
|
-
chain: addEnsContracts(goerli),
|
|
11
|
-
transport: http('https://web3.ens.domains/v1/goerli'),
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
jest.setTimeout(30000)
|
|
15
|
-
|
|
16
|
-
describe('CCIP', () => {
|
|
17
|
-
describe('getProfile', () => {
|
|
18
|
-
it('should return a profile from a ccip-read name', async () => {
|
|
19
|
-
const result = await getRecords(goerliPublicClient, {
|
|
20
|
-
name: '1.offchainexample.eth',
|
|
21
|
-
records: {
|
|
22
|
-
texts: ['email', 'description'],
|
|
23
|
-
contentHash: true,
|
|
24
|
-
coins: ['LTC', '60'],
|
|
25
|
-
},
|
|
26
|
-
})
|
|
27
|
-
if (!result) throw new Error('No result')
|
|
28
|
-
expect(result.coins.find((x) => x.name === 'ETH')!.value).toBe(
|
|
29
|
-
'0x41563129cDbbD0c5D3e1c86cf9563926b243834d',
|
|
30
|
-
)
|
|
31
|
-
})
|
|
32
|
-
it('should return a profile from arb-resolver.eth', async () => {
|
|
33
|
-
const result = await getRecords(goerliPublicClient, {
|
|
34
|
-
name: 'arb-resolver.eth',
|
|
35
|
-
records: {
|
|
36
|
-
texts: ['email', 'description'],
|
|
37
|
-
contentHash: true,
|
|
38
|
-
coins: ['LTC', '60'],
|
|
39
|
-
},
|
|
40
|
-
})
|
|
41
|
-
if (!result) throw new Error('No result')
|
|
42
|
-
expect(result.coins.find((x) => x.name === 'ETH')!.value).toBe(
|
|
43
|
-
'0xA5313060f9FA6B607AC8Ca8728a851166c9f6127',
|
|
44
|
-
)
|
|
45
|
-
})
|
|
46
|
-
})
|
|
47
|
-
describe('batch', () => {
|
|
48
|
-
it('allows batch ccip', async () => {
|
|
49
|
-
const result = await batch(
|
|
50
|
-
goerliPublicClient,
|
|
51
|
-
getAddressRecord.batch({ name: '1.offchainexample.eth' }),
|
|
52
|
-
getAddressRecord.batch({ name: '1.offchainexample.eth', coin: 'LTC' }),
|
|
53
|
-
getText.batch({ name: '1.offchainexample.eth', key: 'email' }),
|
|
54
|
-
)
|
|
55
|
-
if (!result) throw new Error('No result')
|
|
56
|
-
expect(result[0]!.value).toBe(
|
|
57
|
-
'0x41563129cDbbD0c5D3e1c86cf9563926b243834d',
|
|
58
|
-
)
|
|
59
|
-
expect(result[1]).toStrictEqual({
|
|
60
|
-
id: 2,
|
|
61
|
-
name: 'LTC',
|
|
62
|
-
value: 'MQMcJhpWHYVeQArcZR3sBgyPZxxRtnH441',
|
|
63
|
-
})
|
|
64
|
-
expect(result[2]).toBe('nick@ens.domains')
|
|
65
|
-
expect(result).toBeTruthy()
|
|
66
|
-
})
|
|
67
|
-
it('allows nested batch ccip', async () => {
|
|
68
|
-
const result = await batch(
|
|
69
|
-
goerliPublicClient,
|
|
70
|
-
batch.batch(getAddressRecord.batch({ name: '1.offchainexample.eth' })),
|
|
71
|
-
)
|
|
72
|
-
if (!result) throw new Error('No result')
|
|
73
|
-
expect(result[0]![0].value).toBe(
|
|
74
|
-
'0x41563129cDbbD0c5D3e1c86cf9563926b243834d',
|
|
75
|
-
)
|
|
76
|
-
})
|
|
77
|
-
})
|
|
78
|
-
})
|