@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
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-await-in-loop */
|
|
2
|
-
|
|
3
|
-
import { publicClient } from '../../tests/addTestContracts.js'
|
|
4
|
-
import getSubnames from './getSubnames.js'
|
|
5
|
-
import type { Name } from './utils.js'
|
|
6
|
-
|
|
7
|
-
it('returns with default values', async () => {
|
|
8
|
-
const result = await getSubnames(publicClient, {
|
|
9
|
-
name: 'with-subnames.eth',
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
expect(result).toBeTruthy()
|
|
13
|
-
// arbitrary number, just to make sure we get some results
|
|
14
|
-
expect(result.length).toBeGreaterThan(2)
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
it('has registration date on .eth names', async () => {
|
|
18
|
-
const result = await getSubnames(publicClient, {
|
|
19
|
-
name: 'eth',
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
if (!result.length) throw new Error('No names found')
|
|
23
|
-
for (const name of result) {
|
|
24
|
-
expect(name.registrationDate).toBeTruthy()
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
it('filters by search string', async () => {
|
|
29
|
-
const result = await getSubnames(publicClient, {
|
|
30
|
-
name: 'eth',
|
|
31
|
-
searchString: 'test',
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
if (!result.length) throw new Error('No names found')
|
|
35
|
-
for (const name of result) {
|
|
36
|
-
expect(name.labelName).toContain('test')
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
it('does not include expired names by default - .eth 2ld', async () => {
|
|
40
|
-
const result = await getSubnames(publicClient, {
|
|
41
|
-
name: 'eth',
|
|
42
|
-
pageSize: 1000,
|
|
43
|
-
})
|
|
44
|
-
if (!result.length) throw new Error('No names found')
|
|
45
|
-
for (const name of result) {
|
|
46
|
-
expect(name.expiryDate!.value).toBeGreaterThan(Date.now())
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
it('allows including expired names - .eth 2ld', async () => {
|
|
50
|
-
const result = await getSubnames(publicClient, {
|
|
51
|
-
name: 'eth',
|
|
52
|
-
allowExpired: true,
|
|
53
|
-
pageSize: 1000,
|
|
54
|
-
})
|
|
55
|
-
if (!result.length) throw new Error('No names found')
|
|
56
|
-
const expiredNames = result.filter(
|
|
57
|
-
(name) => name.expiryDate!.value < Date.now(),
|
|
58
|
-
)
|
|
59
|
-
expect(expiredNames.length).toBeGreaterThan(0)
|
|
60
|
-
})
|
|
61
|
-
it('includes names with no expiry', async () => {
|
|
62
|
-
const result = await getSubnames(publicClient, {
|
|
63
|
-
name: 'wrapped-with-expiring-subnames.eth',
|
|
64
|
-
pageSize: 1000,
|
|
65
|
-
})
|
|
66
|
-
if (!result.length) throw new Error('No names found')
|
|
67
|
-
const noExpiryNames = result.filter((name) => !name.expiryDate)
|
|
68
|
-
expect(noExpiryNames.length).toBeGreaterThan(0)
|
|
69
|
-
})
|
|
70
|
-
it('does not include expired names by default - other', async () => {
|
|
71
|
-
const result = await getSubnames(publicClient, {
|
|
72
|
-
name: 'wrapped-with-expiring-subnames.eth',
|
|
73
|
-
pageSize: 1000,
|
|
74
|
-
})
|
|
75
|
-
if (!result.length) throw new Error('No names found')
|
|
76
|
-
const namesWithExpiry = result.filter((name) => name.expiryDate)
|
|
77
|
-
expect(namesWithExpiry.length).toBeGreaterThan(0)
|
|
78
|
-
for (const name of namesWithExpiry) {
|
|
79
|
-
expect(name.expiryDate!.value).toBeGreaterThan(Date.now())
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
it('allows including expired names - other', async () => {
|
|
83
|
-
const result = await getSubnames(publicClient, {
|
|
84
|
-
name: 'wrapped-with-expiring-subnames.eth',
|
|
85
|
-
allowExpired: true,
|
|
86
|
-
pageSize: 1000,
|
|
87
|
-
})
|
|
88
|
-
if (!result.length) throw new Error('No names found')
|
|
89
|
-
const expiredNames = result.filter(
|
|
90
|
-
(name) => name.expiryDate && name.expiryDate.value < Date.now(),
|
|
91
|
-
)
|
|
92
|
-
expect(expiredNames.length).toBeGreaterThan(0)
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
describe.each([
|
|
96
|
-
{
|
|
97
|
-
orderBy: 'name',
|
|
98
|
-
orderDirection: 'asc',
|
|
99
|
-
compareFn: (a: Name, b: Name) => (a.name || '').localeCompare(b.name || ''),
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
orderBy: 'name',
|
|
103
|
-
orderDirection: 'desc',
|
|
104
|
-
compareFn: (a: Name, b: Name) => (b.name || '').localeCompare(a.name || ''),
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
orderBy: 'labelName',
|
|
108
|
-
orderDirection: 'asc',
|
|
109
|
-
compareFn: (a: Name, b: Name) => {
|
|
110
|
-
const aLabelName = a.labelName || ''
|
|
111
|
-
const bLabelName = b.labelName || ''
|
|
112
|
-
return aLabelName.localeCompare(bLabelName)
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
orderBy: 'labelName',
|
|
117
|
-
orderDirection: 'desc',
|
|
118
|
-
compareFn: (a: Name, b: Name) => {
|
|
119
|
-
const aLabelName = a.labelName || ''
|
|
120
|
-
const bLabelName = b.labelName || ''
|
|
121
|
-
return bLabelName.localeCompare(aLabelName)
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
orderBy: 'expiryDate',
|
|
126
|
-
orderDirection: 'asc',
|
|
127
|
-
compareFn: (a: Name, b: Name) => {
|
|
128
|
-
const aExpiryDate = a.expiryDate?.value || Infinity
|
|
129
|
-
const bExpiryDate = b.expiryDate?.value || Infinity
|
|
130
|
-
return aExpiryDate - bExpiryDate
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
orderBy: 'expiryDate',
|
|
135
|
-
orderDirection: 'desc',
|
|
136
|
-
compareFn: (a: Name, b: Name) => {
|
|
137
|
-
const aExpiryDate = a.expiryDate?.value || Infinity
|
|
138
|
-
const bExpiryDate = b.expiryDate?.value || Infinity
|
|
139
|
-
return bExpiryDate - aExpiryDate
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
orderBy: 'createdAt',
|
|
144
|
-
orderDirection: 'asc',
|
|
145
|
-
compareFn: (a: Name, b: Name) => {
|
|
146
|
-
const aCreatedAt = a.createdAt.value
|
|
147
|
-
const bCreatedAt = b.createdAt.value
|
|
148
|
-
return aCreatedAt - bCreatedAt
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
orderBy: 'createdAt',
|
|
153
|
-
orderDirection: 'desc',
|
|
154
|
-
compareFn: (a: Name, b: Name) => {
|
|
155
|
-
const aCreatedAt = a.createdAt.value
|
|
156
|
-
const bCreatedAt = b.createdAt.value
|
|
157
|
-
return bCreatedAt - aCreatedAt
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
])(
|
|
161
|
-
'filters by $orderBy $orderDirection',
|
|
162
|
-
({ orderBy, orderDirection, compareFn }) => {
|
|
163
|
-
it('is consistent between full result and paginated results', async () => {
|
|
164
|
-
const fullResult = await getSubnames(publicClient, {
|
|
165
|
-
name: 'eth',
|
|
166
|
-
orderBy: orderBy as any,
|
|
167
|
-
orderDirection: orderDirection as any,
|
|
168
|
-
pageSize: 1000,
|
|
169
|
-
})
|
|
170
|
-
if (!fullResult.length) throw new Error('No names found')
|
|
171
|
-
const paginatedResults = []
|
|
172
|
-
let lastResult: Name[] = []
|
|
173
|
-
do {
|
|
174
|
-
const result = await getSubnames(publicClient, {
|
|
175
|
-
name: 'eth',
|
|
176
|
-
orderBy: orderBy as any,
|
|
177
|
-
orderDirection: orderDirection as any,
|
|
178
|
-
previousPage: lastResult,
|
|
179
|
-
pageSize: 5,
|
|
180
|
-
})
|
|
181
|
-
paginatedResults.push(...result)
|
|
182
|
-
lastResult = result
|
|
183
|
-
} while (lastResult.length)
|
|
184
|
-
|
|
185
|
-
expect(paginatedResults.length).toBe(fullResult.length)
|
|
186
|
-
expect(JSON.stringify(paginatedResults)).toEqual(
|
|
187
|
-
JSON.stringify(fullResult),
|
|
188
|
-
)
|
|
189
|
-
})
|
|
190
|
-
it('is sorted correctly', async () => {
|
|
191
|
-
const fullResult = await getSubnames(publicClient, {
|
|
192
|
-
name: 'eth',
|
|
193
|
-
orderBy: orderBy as any,
|
|
194
|
-
orderDirection: orderDirection as any,
|
|
195
|
-
pageSize: 1000,
|
|
196
|
-
})
|
|
197
|
-
if (!fullResult.length) throw new Error('No names found')
|
|
198
|
-
const sortedResult = [...fullResult].sort(compareFn)
|
|
199
|
-
expect(fullResult).toStrictEqual(sortedResult)
|
|
200
|
-
})
|
|
201
|
-
},
|
|
202
|
-
)
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { Address, Hex } from 'viem'
|
|
2
|
-
import { ethRegistrarControllerCommitmentsSnippet } from '../../contracts/ethRegistrarController.js'
|
|
3
|
-
import { getChainContractAddress } from '../../contracts/getChainContractAddress.js'
|
|
4
|
-
import {
|
|
5
|
-
publicClient,
|
|
6
|
-
testClient,
|
|
7
|
-
waitForTransaction,
|
|
8
|
-
walletClient,
|
|
9
|
-
} from '../../tests/addTestContracts.js'
|
|
10
|
-
import {
|
|
11
|
-
makeCommitment,
|
|
12
|
-
type RegistrationParameters,
|
|
13
|
-
} from '../../utils/registerHelpers.js'
|
|
14
|
-
import commitName from './commitName.js'
|
|
15
|
-
|
|
16
|
-
let snapshot: Hex
|
|
17
|
-
let accounts: Address[]
|
|
18
|
-
|
|
19
|
-
beforeAll(async () => {
|
|
20
|
-
accounts = await walletClient.getAddresses()
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
beforeEach(async () => {
|
|
24
|
-
snapshot = await testClient.snapshot()
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
afterEach(async () => {
|
|
28
|
-
await testClient.revert({ id: snapshot })
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
const secret = `0x${'a'.repeat(64)}` as Hex
|
|
32
|
-
|
|
33
|
-
it('should return a commit transaction and succeed', async () => {
|
|
34
|
-
const params: RegistrationParameters = {
|
|
35
|
-
name: 'wrapped-with-subnames.eth',
|
|
36
|
-
duration: 31536000,
|
|
37
|
-
owner: accounts[1],
|
|
38
|
-
secret,
|
|
39
|
-
}
|
|
40
|
-
const tx = await commitName(walletClient, {
|
|
41
|
-
...params,
|
|
42
|
-
account: accounts[1],
|
|
43
|
-
})
|
|
44
|
-
expect(tx).toBeTruthy()
|
|
45
|
-
const receipt = await waitForTransaction(tx)
|
|
46
|
-
expect(receipt.status).toBe('success')
|
|
47
|
-
|
|
48
|
-
const commitment = await publicClient.readContract({
|
|
49
|
-
abi: ethRegistrarControllerCommitmentsSnippet,
|
|
50
|
-
functionName: 'commitments',
|
|
51
|
-
address: getChainContractAddress({
|
|
52
|
-
client: publicClient,
|
|
53
|
-
contract: 'ensEthRegistrarController',
|
|
54
|
-
}),
|
|
55
|
-
args: [makeCommitment(params)],
|
|
56
|
-
})
|
|
57
|
-
expect(commitment).toBeTruthy()
|
|
58
|
-
})
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { Address, Hex } from 'viem'
|
|
2
|
-
import { getChainContractAddress } from '../../contracts/getChainContractAddress.js'
|
|
3
|
-
import { nameWrapperOwnerOfSnippet } from '../../contracts/nameWrapper.js'
|
|
4
|
-
import { registryOwnerSnippet } from '../../contracts/registry.js'
|
|
5
|
-
import {
|
|
6
|
-
publicClient,
|
|
7
|
-
testClient,
|
|
8
|
-
waitForTransaction,
|
|
9
|
-
walletClient,
|
|
10
|
-
} from '../../tests/addTestContracts.js'
|
|
11
|
-
import { namehash } from '../../utils/normalise.js'
|
|
12
|
-
import createSubname from './createSubname.js'
|
|
13
|
-
|
|
14
|
-
let snapshot: Hex
|
|
15
|
-
let accounts: Address[]
|
|
16
|
-
|
|
17
|
-
beforeAll(async () => {
|
|
18
|
-
accounts = await walletClient.getAddresses()
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
beforeEach(async () => {
|
|
22
|
-
snapshot = await testClient.snapshot()
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
afterEach(async () => {
|
|
26
|
-
await testClient.revert({ id: snapshot })
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it('should allow creating a subname on the registry', async () => {
|
|
30
|
-
const tx = await createSubname(walletClient, {
|
|
31
|
-
name: 'test.test123.eth',
|
|
32
|
-
contract: 'registry',
|
|
33
|
-
owner: accounts[0],
|
|
34
|
-
account: accounts[1],
|
|
35
|
-
})
|
|
36
|
-
expect(tx).toBeTruthy()
|
|
37
|
-
const receipt = await waitForTransaction(tx)
|
|
38
|
-
expect(receipt.status).toBe('success')
|
|
39
|
-
|
|
40
|
-
const owner = await publicClient.readContract({
|
|
41
|
-
abi: registryOwnerSnippet,
|
|
42
|
-
functionName: 'owner',
|
|
43
|
-
address: getChainContractAddress({
|
|
44
|
-
client: publicClient,
|
|
45
|
-
contract: 'ensRegistry',
|
|
46
|
-
}),
|
|
47
|
-
args: [namehash('test.test123.eth')],
|
|
48
|
-
})
|
|
49
|
-
expect(owner).toBe(accounts[0])
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
it('should allow creating a subname on the namewrapper', async () => {
|
|
53
|
-
const tx = await createSubname(walletClient, {
|
|
54
|
-
name: 'test.wrapped.eth',
|
|
55
|
-
contract: 'nameWrapper',
|
|
56
|
-
owner: accounts[0],
|
|
57
|
-
account: accounts[1],
|
|
58
|
-
})
|
|
59
|
-
expect(tx).toBeTruthy()
|
|
60
|
-
const receipt = await waitForTransaction(tx)
|
|
61
|
-
expect(receipt.status).toBe('success')
|
|
62
|
-
|
|
63
|
-
const owner = await publicClient.readContract({
|
|
64
|
-
abi: nameWrapperOwnerOfSnippet,
|
|
65
|
-
functionName: 'ownerOf',
|
|
66
|
-
address: getChainContractAddress({
|
|
67
|
-
client: publicClient,
|
|
68
|
-
contract: 'ensNameWrapper',
|
|
69
|
-
}),
|
|
70
|
-
args: [BigInt(namehash('test.wrapped.eth'))],
|
|
71
|
-
})
|
|
72
|
-
expect(owner).toBe(accounts[0])
|
|
73
|
-
})
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import type { Address, Hex } from 'viem'
|
|
2
|
-
import { getChainContractAddress } from '../../contracts/getChainContractAddress.js'
|
|
3
|
-
import { nameWrapperOwnerOfSnippet } from '../../contracts/nameWrapper.js'
|
|
4
|
-
import {
|
|
5
|
-
registryOwnerSnippet,
|
|
6
|
-
registryResolverSnippet,
|
|
7
|
-
} from '../../contracts/registry.js'
|
|
8
|
-
import {
|
|
9
|
-
publicClient,
|
|
10
|
-
testClient,
|
|
11
|
-
waitForTransaction,
|
|
12
|
-
walletClient,
|
|
13
|
-
} from '../../tests/addTestContracts.js'
|
|
14
|
-
import { EMPTY_ADDRESS } from '../../utils/consts.js'
|
|
15
|
-
import { namehash } from '../../utils/normalise.js'
|
|
16
|
-
import deleteSubname from './deleteSubname.js'
|
|
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
|
-
const getOwner = async (name: string) => {
|
|
34
|
-
return publicClient.readContract({
|
|
35
|
-
abi: registryOwnerSnippet,
|
|
36
|
-
functionName: 'owner',
|
|
37
|
-
address: getChainContractAddress({
|
|
38
|
-
client: publicClient,
|
|
39
|
-
contract: 'ensRegistry',
|
|
40
|
-
}),
|
|
41
|
-
args: [namehash(name)],
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const getNameWrapperOwner = async (name: string) => {
|
|
46
|
-
return publicClient.readContract({
|
|
47
|
-
abi: nameWrapperOwnerOfSnippet,
|
|
48
|
-
functionName: 'ownerOf',
|
|
49
|
-
address: getChainContractAddress({
|
|
50
|
-
client: publicClient,
|
|
51
|
-
contract: 'ensNameWrapper',
|
|
52
|
-
}),
|
|
53
|
-
args: [BigInt(namehash(name))],
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const getResolver = async (name: string) => {
|
|
58
|
-
return publicClient.readContract({
|
|
59
|
-
abi: registryResolverSnippet,
|
|
60
|
-
functionName: 'resolver',
|
|
61
|
-
address: getChainContractAddress({
|
|
62
|
-
client: publicClient,
|
|
63
|
-
contract: 'ensRegistry',
|
|
64
|
-
}),
|
|
65
|
-
args: [namehash(name)],
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
it('should allow deleting a subname on the registry by parent owner', async () => {
|
|
70
|
-
const tx = await deleteSubname(walletClient, {
|
|
71
|
-
name: 'test.with-subnames.eth',
|
|
72
|
-
contract: 'registry',
|
|
73
|
-
account: accounts[1],
|
|
74
|
-
})
|
|
75
|
-
expect(tx).toBeTruthy()
|
|
76
|
-
const receipt = await waitForTransaction(tx)
|
|
77
|
-
expect(receipt.status).toBe('success')
|
|
78
|
-
|
|
79
|
-
const owner = await getOwner('test.with-subnames.eth')
|
|
80
|
-
expect(owner).toBe(EMPTY_ADDRESS)
|
|
81
|
-
|
|
82
|
-
const resolver = await getResolver('test.with-subnames.eth')
|
|
83
|
-
expect(resolver).toBe(EMPTY_ADDRESS)
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
it('should allow deleting a subname on the namewrapper by parent owner', async () => {
|
|
87
|
-
const tx = await deleteSubname(walletClient, {
|
|
88
|
-
name: 'test.wrapped-with-subnames.eth',
|
|
89
|
-
contract: 'nameWrapper',
|
|
90
|
-
account: accounts[1],
|
|
91
|
-
})
|
|
92
|
-
expect(tx).toBeTruthy()
|
|
93
|
-
const receipt = await waitForTransaction(tx)
|
|
94
|
-
expect(receipt.status).toBe('success')
|
|
95
|
-
|
|
96
|
-
const owner = await getOwner('test.wrapped-with-subnames.eth')
|
|
97
|
-
expect(owner).toBe(EMPTY_ADDRESS)
|
|
98
|
-
|
|
99
|
-
const resolver = await getResolver('test.wrapped-with-subnames.eth')
|
|
100
|
-
expect(resolver).toBe(EMPTY_ADDRESS)
|
|
101
|
-
|
|
102
|
-
const nameWrapperOwner = await getNameWrapperOwner(
|
|
103
|
-
'test.wrapped-with-subnames.eth',
|
|
104
|
-
)
|
|
105
|
-
expect(nameWrapperOwner).toBe(EMPTY_ADDRESS)
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
it('should allow deleting a subname on the namewrapper by name owner', async () => {
|
|
109
|
-
const tx = await deleteSubname(walletClient, {
|
|
110
|
-
name: 'addr.wrapped-with-subnames.eth',
|
|
111
|
-
contract: 'nameWrapper',
|
|
112
|
-
asOwner: true,
|
|
113
|
-
account: accounts[2],
|
|
114
|
-
})
|
|
115
|
-
expect(tx).toBeTruthy()
|
|
116
|
-
const receipt = await waitForTransaction(tx)
|
|
117
|
-
expect(receipt.status).toBe('success')
|
|
118
|
-
|
|
119
|
-
const owner = await getOwner('addr.wrapped-with-subnames.eth')
|
|
120
|
-
expect(owner).toBe(EMPTY_ADDRESS)
|
|
121
|
-
|
|
122
|
-
const resolver = await getResolver('addr.wrapped-with-subnames.eth')
|
|
123
|
-
expect(resolver).toBe(EMPTY_ADDRESS)
|
|
124
|
-
|
|
125
|
-
const nameWrapperOwner = await getNameWrapperOwner(
|
|
126
|
-
'addr.wrapped-with-subnames.eth',
|
|
127
|
-
)
|
|
128
|
-
expect(nameWrapperOwner).toBe(EMPTY_ADDRESS)
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
it('should not allow deleting top level domain', async () => {
|
|
132
|
-
await expect(
|
|
133
|
-
deleteSubname(walletClient, {
|
|
134
|
-
name: 'eth',
|
|
135
|
-
contract: 'nameWrapper',
|
|
136
|
-
asOwner: true,
|
|
137
|
-
account: accounts[1],
|
|
138
|
-
}),
|
|
139
|
-
).rejects.toThrow()
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
it('should not allow deleting second level domain', async () => {
|
|
143
|
-
await expect(
|
|
144
|
-
deleteSubname(walletClient, {
|
|
145
|
-
name: 'test123.eth',
|
|
146
|
-
contract: 'registry',
|
|
147
|
-
account: accounts[1],
|
|
148
|
-
}),
|
|
149
|
-
).rejects.toThrow()
|
|
150
|
-
})
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import type { Address, Hex } from 'viem'
|
|
2
|
-
import { getChainContractAddress } from '../../contracts/getChainContractAddress.js'
|
|
3
|
-
import { nameWrapperOwnerOfSnippet } from '../../contracts/nameWrapper.js'
|
|
4
|
-
import {
|
|
5
|
-
publicClient,
|
|
6
|
-
testClient,
|
|
7
|
-
waitForTransaction,
|
|
8
|
-
walletClient,
|
|
9
|
-
} from '../../tests/addTestContracts.js'
|
|
10
|
-
import { namehash } from '../../utils/normalise.js'
|
|
11
|
-
import type { RegistrationParameters } from '../../utils/registerHelpers.js'
|
|
12
|
-
import getPrice from '../public/getPrice.js'
|
|
13
|
-
import commitName from './commitName.js'
|
|
14
|
-
import registerName from './registerName.js'
|
|
15
|
-
|
|
16
|
-
let snapshot: Hex
|
|
17
|
-
let accounts: Address[]
|
|
18
|
-
|
|
19
|
-
beforeAll(async () => {
|
|
20
|
-
accounts = await walletClient.getAddresses()
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
beforeEach(async () => {
|
|
24
|
-
snapshot = await testClient.snapshot()
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
afterEach(async () => {
|
|
28
|
-
await testClient.revert({ id: snapshot })
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
const secret = `0x${'a'.repeat(64)}` as Hex
|
|
32
|
-
|
|
33
|
-
const getNameWrapperOwner = async (name: string) => {
|
|
34
|
-
return publicClient.readContract({
|
|
35
|
-
abi: nameWrapperOwnerOfSnippet,
|
|
36
|
-
functionName: 'ownerOf',
|
|
37
|
-
address: getChainContractAddress({
|
|
38
|
-
client: publicClient,
|
|
39
|
-
contract: 'ensNameWrapper',
|
|
40
|
-
}),
|
|
41
|
-
args: [BigInt(namehash(name))],
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
it('should return a registration transaction and succeed', async () => {
|
|
46
|
-
const params: RegistrationParameters = {
|
|
47
|
-
name: 'cool-swag.eth',
|
|
48
|
-
duration: 31536000,
|
|
49
|
-
owner: accounts[1],
|
|
50
|
-
secret,
|
|
51
|
-
}
|
|
52
|
-
const commitTx = await commitName(walletClient, {
|
|
53
|
-
...params,
|
|
54
|
-
account: accounts[1],
|
|
55
|
-
})
|
|
56
|
-
expect(commitTx).toBeTruthy()
|
|
57
|
-
const commitReceipt = await waitForTransaction(commitTx)
|
|
58
|
-
|
|
59
|
-
expect(commitReceipt.status).toBe('success')
|
|
60
|
-
|
|
61
|
-
await testClient.increaseTime({ seconds: 61 })
|
|
62
|
-
await testClient.mine({ blocks: 1 })
|
|
63
|
-
|
|
64
|
-
const price = await getPrice(publicClient, {
|
|
65
|
-
nameOrNames: params.name,
|
|
66
|
-
duration: params.duration,
|
|
67
|
-
})
|
|
68
|
-
const total = price!.base + price!.premium
|
|
69
|
-
|
|
70
|
-
const tx = await registerName(walletClient, {
|
|
71
|
-
...params,
|
|
72
|
-
account: accounts[1],
|
|
73
|
-
value: total,
|
|
74
|
-
})
|
|
75
|
-
expect(tx).toBeTruthy()
|
|
76
|
-
const receipt = await waitForTransaction(tx)
|
|
77
|
-
expect(receipt.status).toBe('success')
|
|
78
|
-
|
|
79
|
-
const owner = await getNameWrapperOwner(params.name)
|
|
80
|
-
expect(owner).toBe(accounts[1])
|
|
81
|
-
})
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { labelhash, type Address, type Hex } from 'viem'
|
|
2
|
-
import { baseRegistrarNameExpiresSnippet } from '../../contracts/baseRegistrar.js'
|
|
3
|
-
import { getChainContractAddress } from '../../contracts/getChainContractAddress.js'
|
|
4
|
-
import {
|
|
5
|
-
publicClient,
|
|
6
|
-
testClient,
|
|
7
|
-
waitForTransaction,
|
|
8
|
-
walletClient,
|
|
9
|
-
} from '../../tests/addTestContracts.js'
|
|
10
|
-
import getPrice from '../public/getPrice.js'
|
|
11
|
-
import renewNames from './renewNames.js'
|
|
12
|
-
|
|
13
|
-
let snapshot: Hex
|
|
14
|
-
let accounts: Address[]
|
|
15
|
-
|
|
16
|
-
beforeAll(async () => {
|
|
17
|
-
accounts = await walletClient.getAddresses()
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
beforeEach(async () => {
|
|
21
|
-
snapshot = await testClient.snapshot()
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
afterEach(async () => {
|
|
25
|
-
await testClient.revert({ id: snapshot })
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
const getExpiry = async (name: string) => {
|
|
29
|
-
return publicClient.readContract({
|
|
30
|
-
abi: baseRegistrarNameExpiresSnippet,
|
|
31
|
-
functionName: 'nameExpires',
|
|
32
|
-
address: getChainContractAddress({
|
|
33
|
-
client: publicClient,
|
|
34
|
-
contract: 'ensBaseRegistrarImplementation',
|
|
35
|
-
}),
|
|
36
|
-
args: [BigInt(labelhash(name.split('.')[0]))],
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
it('should return a renew transaction for a single name and succeed', async () => {
|
|
41
|
-
const name = 'to-be-renewed.eth'
|
|
42
|
-
const duration = 31536000n
|
|
43
|
-
|
|
44
|
-
const oldExpiry = await getExpiry(name)
|
|
45
|
-
|
|
46
|
-
const price = await getPrice(publicClient, {
|
|
47
|
-
nameOrNames: name,
|
|
48
|
-
duration,
|
|
49
|
-
})
|
|
50
|
-
const total = price!.base + price!.premium
|
|
51
|
-
|
|
52
|
-
const tx = await renewNames(walletClient, {
|
|
53
|
-
nameOrNames: name,
|
|
54
|
-
duration,
|
|
55
|
-
value: total,
|
|
56
|
-
account: accounts[0],
|
|
57
|
-
})
|
|
58
|
-
expect(tx).toBeTruthy()
|
|
59
|
-
const receipt = await waitForTransaction(tx)
|
|
60
|
-
expect(receipt.status).toBe('success')
|
|
61
|
-
|
|
62
|
-
const newExpiry = await getExpiry(name)
|
|
63
|
-
expect(newExpiry).toBe(oldExpiry + duration)
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
it('should return a renewAll transaction for multiple names and succeed', async () => {
|
|
67
|
-
const names = ['to-be-renewed.eth', 'test123.eth']
|
|
68
|
-
const duration = 31536000n
|
|
69
|
-
|
|
70
|
-
const oldExpiries = await Promise.all(names.map(getExpiry))
|
|
71
|
-
|
|
72
|
-
const price = await getPrice(publicClient, {
|
|
73
|
-
nameOrNames: names,
|
|
74
|
-
duration,
|
|
75
|
-
})
|
|
76
|
-
const total = price!.base + price!.premium
|
|
77
|
-
|
|
78
|
-
const tx = await renewNames(walletClient, {
|
|
79
|
-
nameOrNames: names,
|
|
80
|
-
duration,
|
|
81
|
-
value: total,
|
|
82
|
-
account: accounts[1],
|
|
83
|
-
})
|
|
84
|
-
expect(tx).toBeTruthy()
|
|
85
|
-
const receipt = await waitForTransaction(tx)
|
|
86
|
-
expect(receipt.status).toBe('success')
|
|
87
|
-
|
|
88
|
-
const newExpiries = await Promise.all(names.map(getExpiry))
|
|
89
|
-
for (let i = 0; i < names.length; i += 1) {
|
|
90
|
-
expect(newExpiries[i]).toBe(oldExpiries[i] + duration)
|
|
91
|
-
}
|
|
92
|
-
})
|