@ensdomains/ensjs 3.0.0-alpha.22 → 3.0.0-alpha.24

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.
Files changed (93) hide show
  1. package/dist/cjs/contracts/getContractAddress.js +22 -7
  2. package/dist/cjs/functions/burnFuses.js +1 -38
  3. package/dist/cjs/functions/commitName.js +2 -0
  4. package/dist/cjs/functions/createSubname.js +3 -2
  5. package/dist/cjs/functions/getHistory.js +19 -14
  6. package/dist/cjs/functions/getNames.js +1 -1
  7. package/dist/cjs/functions/{getFuses.js → getWrapperData.js} +10 -11
  8. package/dist/cjs/functions/registerName.js +2 -0
  9. package/dist/cjs/functions/renewNames.js +23 -3
  10. package/dist/cjs/functions/transferController.js +42 -0
  11. package/dist/cjs/functions/transferSubname.js +2 -2
  12. package/dist/cjs/functions/wrapName.js +3 -2
  13. package/dist/cjs/generated/factories/ETHRegistrarController__factory.js +137 -0
  14. package/dist/cjs/generated/factories/NameWrapper__factory.js +63 -39
  15. package/dist/cjs/generated/factories/PublicResolver__factory.js +69 -14
  16. package/dist/cjs/generated/factories/ReverseRegistrar__factory.js +13 -0
  17. package/dist/cjs/index.js +6 -3
  18. package/dist/cjs/utils/fuses.js +43 -1
  19. package/dist/cjs/utils/recordHelpers.js +5 -0
  20. package/dist/cjs/utils/registerHelpers.js +1 -0
  21. package/dist/cjs/utils/{wrapperExpiry.js → wrapper.js} +11 -4
  22. package/dist/esm/contracts/getContractAddress.mjs +22 -7
  23. package/dist/esm/functions/burnFuses.mjs +2 -42
  24. package/dist/esm/functions/commitName.mjs +2 -0
  25. package/dist/esm/functions/createSubname.mjs +2 -1
  26. package/dist/esm/functions/getHistory.mjs +19 -14
  27. package/dist/esm/functions/getNames.mjs +1 -1
  28. package/dist/esm/functions/{getFuses.mjs → getWrapperData.mjs} +8 -9
  29. package/dist/esm/functions/registerName.mjs +2 -0
  30. package/dist/esm/functions/renewNames.mjs +23 -3
  31. package/dist/esm/functions/transferController.mjs +23 -0
  32. package/dist/esm/functions/transferSubname.mjs +1 -1
  33. package/dist/esm/functions/wrapName.mjs +2 -1
  34. package/dist/esm/generated/factories/ETHRegistrarController__factory.mjs +137 -0
  35. package/dist/esm/generated/factories/NameWrapper__factory.mjs +63 -39
  36. package/dist/esm/generated/factories/PublicResolver__factory.mjs +69 -14
  37. package/dist/esm/generated/factories/ReverseRegistrar__factory.mjs +13 -0
  38. package/dist/esm/index.mjs +6 -3
  39. package/dist/esm/utils/fuses.mjs +43 -1
  40. package/dist/esm/utils/recordHelpers.mjs +5 -0
  41. package/dist/esm/utils/registerHelpers.mjs +1 -0
  42. package/dist/esm/utils/{wrapperExpiry.mjs → wrapper.mjs} +9 -2
  43. package/dist/types/functions/burnFuses.d.ts +1 -11
  44. package/dist/types/functions/createSubname.d.ts +1 -1
  45. package/dist/types/functions/{getFuses.d.ts → getWrapperData.d.ts} +1 -1
  46. package/dist/types/functions/renewNames.d.ts +9 -2
  47. package/dist/types/functions/transferController.d.ts +6 -0
  48. package/dist/types/functions/transferSubname.d.ts +1 -1
  49. package/dist/types/functions/wrapName.d.ts +1 -1
  50. package/dist/types/generated/ETHRegistrarController.d.ts +42 -1
  51. package/dist/types/generated/NameWrapper.d.ts +66 -78
  52. package/dist/types/generated/PublicResolver.d.ts +51 -23
  53. package/dist/types/generated/ReverseRegistrar.d.ts +11 -0
  54. package/dist/types/generated/factories/ETHRegistrarController__factory.d.ts +12 -1
  55. package/dist/types/index.d.ts +5 -2
  56. package/dist/types/utils/fuses.d.ts +11 -0
  57. package/dist/types/utils/recordHelpers.d.ts +1 -0
  58. package/dist/types/utils/registerHelpers.d.ts +1 -0
  59. package/dist/types/utils/{wrapperExpiry.d.ts → wrapper.d.ts} +2 -1
  60. package/package.json +5 -4
  61. package/src/contracts/getContractAddress.ts +19 -4
  62. package/src/functions/burnFuses.test.ts +4 -4
  63. package/src/functions/burnFuses.ts +2 -65
  64. package/src/functions/commitName.ts +3 -0
  65. package/src/functions/createSubname.ts +2 -1
  66. package/src/functions/getHistory.ts +19 -13
  67. package/src/functions/getNames.test.ts +0 -1
  68. package/src/functions/getNames.ts +1 -1
  69. package/src/functions/getPrice.test.ts +9 -6
  70. package/src/functions/getProfile.test.ts +5 -6
  71. package/src/functions/getResolver.test.ts +2 -2
  72. package/src/functions/{getFuses.test.ts → getWrapperData.test.ts} +8 -6
  73. package/src/functions/{getFuses.ts → getWrapperData.ts} +6 -7
  74. package/src/functions/registerName.ts +3 -0
  75. package/src/functions/renewNames.test.ts +3 -3
  76. package/src/functions/renewNames.ts +36 -6
  77. package/src/functions/transferController.ts +28 -0
  78. package/src/functions/transferSubname.ts +1 -1
  79. package/src/functions/wrapName.test.ts +12 -3
  80. package/src/functions/wrapName.ts +3 -1
  81. package/src/generated/ETHRegistrarController.ts +104 -0
  82. package/src/generated/NameWrapper.ts +127 -90
  83. package/src/generated/PublicResolver.ts +114 -33
  84. package/src/generated/ReverseRegistrar.ts +20 -0
  85. package/src/generated/factories/ETHRegistrarController__factory.ts +137 -0
  86. package/src/generated/factories/NameWrapper__factory.ts +63 -39
  87. package/src/generated/factories/PublicResolver__factory.ts +69 -14
  88. package/src/generated/factories/ReverseRegistrar__factory.ts +13 -0
  89. package/src/index.ts +19 -5
  90. package/src/utils/fuses.ts +64 -0
  91. package/src/utils/recordHelpers.ts +7 -0
  92. package/src/utils/registerHelpers.ts +1 -1
  93. package/src/utils/{wrapperExpiry.ts → wrapper.ts} +8 -1
@@ -2,6 +2,8 @@ import { formatsByCoinType } from '@ensdomains/address-encoder'
2
2
  import { ethers } from 'ethers'
3
3
  import { ENSArgs } from '..'
4
4
  import { decodeContenthash } from '../utils/contentHash'
5
+ import { labelhash } from '../utils/labels'
6
+ import { namehash } from '../utils/normalise'
5
7
 
6
8
  type DomainEvent = 'NewOwner' | 'NewResolver' | 'Transfer' | 'NewTTL'
7
9
  type RegistrationEvent = 'NameRegistered' | 'NameRenewed' | 'NameTransferred'
@@ -102,8 +104,8 @@ export async function getHistory(
102
104
  ) {
103
105
  const { client } = gqlInstance
104
106
  const query = gqlInstance.gql`
105
- query getHistory($name: String!, $label: String!) {
106
- domains(where: { name: $name }) {
107
+ query getHistory($namehash: String!, $labelhash: String!) {
108
+ domain(id: $namehash) {
107
109
  events {
108
110
  id
109
111
  blockNumber
@@ -129,7 +131,7 @@ export async function getHistory(
129
131
  }
130
132
  }
131
133
  owner {
132
- registrations (where: { labelName: $label }) {
134
+ registrations (where: { id: $labelhash }) {
133
135
  events {
134
136
  id
135
137
  blockNumber
@@ -201,19 +203,23 @@ export async function getHistory(
201
203
 
202
204
  const label = name.split('.')[0]
203
205
 
204
- const { domains } = await client.request(query, { name, label })
206
+ const nameHash = namehash(name)
207
+ const labelHash = labelhash(label)
205
208
 
206
- if (!domains || domains.length === 0) return
209
+ const { domain } = await client.request(query, {
210
+ namehash: nameHash,
211
+ labelhash: labelHash,
212
+ })
207
213
 
208
- const [
209
- {
210
- events: domainEvents,
211
- owner: {
212
- registrations: [{ events: registrationEvents }],
213
- },
214
- resolver: { events: resolverEvents },
214
+ if (!domain) return
215
+
216
+ const {
217
+ events: domainEvents,
218
+ owner: {
219
+ registrations: [{ events: registrationEvents }],
215
220
  },
216
- ] = domains
221
+ resolver: { events: resolverEvents },
222
+ } = domain
217
223
 
218
224
  const domainHistory = mapEvents(domainEvents, 'Domain')
219
225
  const registrationHistory = mapEvents(registrationEvents, 'Registration')
@@ -33,7 +33,6 @@ const domainLetterItems = [
33
33
  'x',
34
34
  'w',
35
35
  't',
36
- 't',
37
36
  'l',
38
37
  'a',
39
38
  '9',
@@ -76,7 +76,7 @@ const getNames = async (
76
76
  page,
77
77
  pageSize = 10,
78
78
  orderDirection,
79
- orderBy,
79
+ orderBy = 'labelName',
80
80
  }: Params,
81
81
  ) => {
82
82
  const address = _address.toLowerCase()
@@ -1,3 +1,4 @@
1
+ import { BigNumber } from 'ethers'
1
2
  import { ENS } from '..'
2
3
  import setup from '../tests/setup'
3
4
 
@@ -7,14 +8,16 @@ beforeAll(async () => {
7
8
  ;({ ensInstance } = await setup())
8
9
  })
9
10
 
11
+ const yearCost = BigNumber.from('8561643835626')
12
+
10
13
  describe('getPrice', () => {
11
- it('should return a base and premium price for an address', async () => {
14
+ it('should return a base and premium price for a name', async () => {
12
15
  const { base, premium } = (await ensInstance.getPrice(
13
16
  'test123',
14
17
  86400,
15
18
  false,
16
19
  ))!
17
- expect(base.toNumber()).toBe(86400)
20
+ expect(base.eq(yearCost)).toBe(true)
18
21
  expect(premium.toNumber()).toBe(0)
19
22
  })
20
23
 
@@ -24,18 +27,18 @@ describe('getPrice', () => {
24
27
  86400,
25
28
  false,
26
29
  ))!
27
- expect(base.toNumber()).toBe(86400 * 2)
30
+ expect(base.eq(yearCost.mul(2))).toBe(true)
28
31
  expect(premium.toNumber()).toBe(0)
29
32
  })
30
33
 
31
34
  describe('legacy mode', () => {
32
- it('should return a base and premium price for an address', async () => {
35
+ it('should return a base and premium price for a name', async () => {
33
36
  const { base, premium } = (await ensInstance.getPrice(
34
37
  'test123',
35
38
  86400,
36
39
  true,
37
40
  ))!
38
- expect(base.toNumber()).toBe(86400)
41
+ expect(base.eq(yearCost)).toBe(true)
39
42
  expect(premium.toNumber()).toBe(0)
40
43
  })
41
44
 
@@ -45,7 +48,7 @@ describe('getPrice', () => {
45
48
  86400,
46
49
  true,
47
50
  ))!
48
- expect(base.toNumber()).toBe(86400 * 2)
51
+ expect(base.eq(yearCost.mul(2))).toBe(true)
49
52
  expect(premium.toNumber()).toBe(0)
50
53
  })
51
54
  })
@@ -1,7 +1,7 @@
1
- import { ethers } from 'ethers'
2
1
  import dotenv from 'dotenv'
2
+ import { ethers } from 'ethers'
3
3
  import { ENS } from '..'
4
- import setup from '../tests/setup'
4
+ import setup, { deploymentAddresses } from '../tests/setup'
5
5
 
6
6
  dotenv.config()
7
7
 
@@ -29,7 +29,7 @@ const checkRecords = (
29
29
  expect(result.records?.texts).toHaveLength(textLength)
30
30
  expect(result.records?.coinTypes).toHaveLength(coinTypeLength)
31
31
  expect(result.resolverAddress).toBe(
32
- '0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8',
32
+ deploymentAddresses.LegacyPublicResolver,
33
33
  )
34
34
  }
35
35
  }
@@ -107,12 +107,12 @@ describe('getProfile', () => {
107
107
  })
108
108
  await tx.wait()
109
109
  const result = await ensInstance.getProfile('test123.eth', {
110
- resolverAddress: '0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8',
110
+ resolverAddress: deploymentAddresses.LegacyPublicResolver,
111
111
  })
112
112
  expect(result).toBeDefined()
113
113
  expect(result?.address).toBe(accounts[1])
114
114
  expect(result?.resolverAddress).toBe(
115
- '0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8',
115
+ deploymentAddresses.LegacyPublicResolver,
116
116
  )
117
117
  })
118
118
  it('should return undefined for an unregistered name', async () => {
@@ -123,7 +123,6 @@ describe('getProfile', () => {
123
123
  describe('with an old resolver', () => {
124
124
  it('should use fallback methods for a name with an older resolver (no multicall)', async () => {
125
125
  const result = await ensInstance.getProfile('with-legacy-resolver.eth')
126
- const deploymentAddresses = JSON.parse(process.env.DEPLOYMENT_ADDRESSES!)
127
126
  expect(result).toBeDefined()
128
127
  if (result) {
129
128
  expect(result.address).toBe(
@@ -1,5 +1,5 @@
1
1
  import { ENS } from '..'
2
- import setup from '../tests/setup'
2
+ import setup, { deploymentAddresses } from '../tests/setup'
3
3
 
4
4
  let ensInstance: ENS
5
5
 
@@ -10,6 +10,6 @@ beforeAll(async () => {
10
10
  describe('getResolver', () => {
11
11
  it('should find the resolver for a name with a resolver', async () => {
12
12
  const result = await ensInstance.getResolver('with-profile.eth')
13
- expect(result).toBe('0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8')
13
+ expect(result).toBe(deploymentAddresses.LegacyPublicResolver)
14
14
  })
15
15
  })
@@ -1,5 +1,5 @@
1
1
  import { BigNumber } from 'ethers'
2
- import { ENS } from '..'
2
+ import { ENS } from '../index'
3
3
  import setup from '../tests/setup'
4
4
 
5
5
  let ensInstance: ENS
@@ -38,15 +38,17 @@ afterAll(async () => {
38
38
  await revert()
39
39
  })
40
40
 
41
- describe('getFuses', () => {
41
+ describe('getWrapperData', () => {
42
42
  it('should return default data for an unwrapped name', async () => {
43
- const result = await ensInstance.getFuses('with-profile.eth')
43
+ const result = await ensInstance.getWrapperData('with-profile.eth')
44
44
  expect({ ...result, expiryDate: result?.expiryDate.toString() }).toEqual(
45
45
  unwrappedNameDefault,
46
46
  )
47
47
  })
48
48
  it('should return with CAN_DO_EVERYTHING set to true for a name with no fuses burned', async () => {
49
- const result = await ensInstance.getFuses('test.wrapped-with-subnames.eth')
49
+ const result = await ensInstance.getWrapperData(
50
+ 'test.wrapped-with-subnames.eth',
51
+ )
50
52
  expect(result).toBeTruthy()
51
53
  if (result) {
52
54
  expect(result.fuseObj.CAN_DO_EVERYTHING).toBe(true)
@@ -70,7 +72,7 @@ describe('getFuses', () => {
70
72
  })
71
73
  await tx.wait()
72
74
 
73
- const result = await ensInstance.getFuses('wrapped.eth')
75
+ const result = await ensInstance.getWrapperData('wrapped.eth')
74
76
  expect(result).toBeTruthy()
75
77
  if (result) {
76
78
  expect(result.fuseObj).toMatchObject({
@@ -87,7 +89,7 @@ describe('getFuses', () => {
87
89
  }
88
90
  })
89
91
  it('should return correct expiry', async () => {
90
- const result = await ensInstance.getFuses('wrapped.eth')
92
+ const result = await ensInstance.getWrapperData('wrapped.eth')
91
93
  expect(result).toBeTruthy()
92
94
  if (result) {
93
95
  expect(result.expiryDate).toBeInstanceOf(Date)
@@ -1,5 +1,5 @@
1
1
  import { BigNumber } from 'ethers'
2
- import { ENSArgs } from '..'
2
+ import { ENSArgs } from '../index'
3
3
  import { CurrentFuses, fuseEnum } from '../utils/fuses'
4
4
  import { namehash } from '../utils/normalise'
5
5
 
@@ -14,11 +14,10 @@ const raw = async ({ contracts }: ENSArgs<'contracts'>, name: string) => {
14
14
  const decode = async ({ contracts }: ENSArgs<'contracts'>, data: string) => {
15
15
  const nameWrapper = await contracts?.getNameWrapper()!
16
16
  try {
17
- const {
18
- owner,
19
- fuses: _fuses,
20
- expiry,
21
- } = nameWrapper.interface.decodeFunctionResult('getData', data)
17
+ const [owner, _fuses, expiry] = nameWrapper.interface.decodeFunctionResult(
18
+ 'getData',
19
+ data,
20
+ )
22
21
 
23
22
  const fuses = BigNumber.from(_fuses)
24
23
 
@@ -44,7 +43,7 @@ const decode = async ({ contracts }: ENSArgs<'contracts'>, data: string) => {
44
43
  owner,
45
44
  }
46
45
  } catch (e) {
47
- console.error('Error decoding fuses data: ', e)
46
+ console.error('Error decoding wrapper data: ', e)
48
47
  return
49
48
  }
50
49
  }
@@ -4,6 +4,7 @@ import {
4
4
  BaseRegistrationParams,
5
5
  makeRegistrationData,
6
6
  } from '../utils/registerHelpers'
7
+ import { wrappedLabelLengthCheck } from '../utils/wrapper'
7
8
 
8
9
  type Params = BaseRegistrationParams & {
9
10
  value: BigNumber
@@ -18,6 +19,8 @@ export default async function (
18
19
  if (labels.length !== 2 || labels[1] !== 'eth')
19
20
  throw new Error('Currently only .eth TLD registrations are supported')
20
21
 
22
+ wrappedLabelLengthCheck(labels[0])
23
+
21
24
  const controller = await contracts!.getEthRegistrarController()
22
25
  const _resolver = await contracts!.getPublicResolver(
23
26
  undefined,
@@ -34,7 +34,7 @@ describe('renewNames', () => {
34
34
  const tx = await ensInstance.renewNames(name, {
35
35
  value: price.mul(2),
36
36
  duration,
37
- addressOrIndex: accounts[1],
37
+ addressOrIndex: accounts[0],
38
38
  })
39
39
  await tx.wait()
40
40
 
@@ -48,8 +48,8 @@ describe('renewNames', () => {
48
48
  const duration = 31536000
49
49
  const baseRegistrar = await ensInstance.contracts!.getBaseRegistrar()!
50
50
  const oldExpiry = await baseRegistrar.nameExpires(labelhash(label))
51
- const controller = await ensInstance.contracts!.getEthRegistrarController()!
52
- const [price] = await controller.rentPrice(label, duration)
51
+ const bulkRenewal = await ensInstance.contracts!.getBulkRenewal()!
52
+ const price = await bulkRenewal.rentPrice(names, duration)
53
53
 
54
54
  const tx = await ensInstance.renewNames(names, {
55
55
  value: price.mul(4),
@@ -1,16 +1,46 @@
1
- import { BigNumber } from 'ethers'
1
+ import { BigNumber, BigNumberish } from 'ethers'
2
2
  import { ENSArgs } from '..'
3
+ import { FuseProps, validateFuses } from '../utils/fuses'
4
+ import { MAX_INT_64 } from '../utils/registerHelpers'
3
5
 
4
- export default async function (
6
+ type BaseProps = {
7
+ duration: number
8
+ value: BigNumber
9
+ }
10
+
11
+ export async function renewNameWithData(
5
12
  { contracts }: ENSArgs<'contracts'>,
6
- nameOrNames: string | string[],
13
+ name: string,
7
14
  {
8
15
  duration,
9
16
  value,
10
- }: {
11
- duration: number
12
- value: BigNumber
17
+ fuses,
18
+ wrapperExpiry = MAX_INT_64,
19
+ }: BaseProps & {
20
+ fuses?: FuseProps
21
+ wrapperExpiry?: BigNumberish
13
22
  },
23
+ ) {
24
+ const labels = name.split('.')
25
+ if (labels.length !== 2 || labels[1] !== 'eth') {
26
+ throw new Error('Currently only .eth TLD renewals are supported')
27
+ }
28
+
29
+ const encodedFuses = fuses ? validateFuses(fuses) : 0
30
+ const controller = await contracts!.getEthRegistrarController()
31
+ return controller.populateTransaction.renewWithFuses(
32
+ labels[0],
33
+ duration,
34
+ encodedFuses,
35
+ wrapperExpiry,
36
+ { value },
37
+ )
38
+ }
39
+
40
+ export default async function (
41
+ { contracts }: ENSArgs<'contracts'>,
42
+ nameOrNames: string | string[],
43
+ { duration, value }: BaseProps,
14
44
  ) {
15
45
  const names = Array.isArray(nameOrNames) ? nameOrNames : [nameOrNames]
16
46
  const labels = names.map((name) => {
@@ -0,0 +1,28 @@
1
+ import { ethers } from 'ethers'
2
+ import { ENSArgs } from '..'
3
+
4
+ export default async function (
5
+ { contracts, signer }: ENSArgs<'contracts' | 'signer'>,
6
+ name: string,
7
+ {
8
+ newOwner,
9
+ isOwner,
10
+ }: {
11
+ newOwner: string
12
+ isOwner: boolean
13
+ },
14
+ ) {
15
+ const baseRegistrar = (await contracts?.getBaseRegistrar())!.connect(signer)
16
+ const registry = (await contracts?.getRegistry())!.connect(signer)
17
+ const labels = name.split('.')
18
+ if (isOwner) {
19
+ return registry.populateTransaction.setOwner(
20
+ ethers.utils.solidityKeccak256(['string'], [labels[0]]),
21
+ newOwner,
22
+ )
23
+ }
24
+ return baseRegistrar.populateTransaction.reclaim(
25
+ ethers.utils.solidityKeccak256(['string'], [labels[0]]),
26
+ newOwner,
27
+ )
28
+ }
@@ -1,7 +1,7 @@
1
1
  import { ethers } from 'ethers'
2
2
  import { ENSArgs } from '..'
3
3
  import { namehash } from '../utils/normalise'
4
- import { Expiry, makeExpiry } from '../utils/wrapperExpiry'
4
+ import { Expiry, makeExpiry } from '../utils/wrapper'
5
5
 
6
6
  type BaseArgs = {
7
7
  owner: string
@@ -44,7 +44,7 @@ describe('wrapName', () => {
44
44
  await tx.wait()
45
45
 
46
46
  const nameWrapper = await ensInstance.contracts!.getNameWrapper()!
47
- const [fuses] = await nameWrapper.getFuses(namehash('test123.eth'))
47
+ const [, fuses] = await nameWrapper.getData(namehash('test123.eth'))
48
48
 
49
49
  // parent cannot control
50
50
  expect(fuses).toBe(64)
@@ -62,7 +62,7 @@ describe('wrapName', () => {
62
62
  await tx.wait()
63
63
 
64
64
  const nameWrapper = await ensInstance.contracts!.getNameWrapper()!
65
- const [fuses] = await nameWrapper.getFuses(namehash('test123.eth'))
65
+ const [, fuses] = await nameWrapper.getData(namehash('test123.eth'))
66
66
  expect(fuses).toBe(81)
67
67
  })
68
68
  it('should allow an initial resolver address', async () => {
@@ -81,6 +81,15 @@ describe('wrapName', () => {
81
81
  )
82
82
  expect(result).toBe('0x42D63ae25990889E35F215bC95884039Ba354115')
83
83
  })
84
+ it('should throw an error for labels longer than 255 bytes', async () => {
85
+ const label = 'a'.repeat(256)
86
+ await expect(
87
+ ensInstance.wrapName(`${label}.eth`, {
88
+ wrappedOwner: accounts[2],
89
+ addressOrIndex: 1,
90
+ }),
91
+ ).rejects.toThrow("Label can't be longer than 255 bytes")
92
+ })
84
93
  })
85
94
  describe('other', () => {
86
95
  it('should return a wrap name transaction and succeed', async () => {
@@ -94,7 +103,7 @@ describe('wrapName', () => {
94
103
  await tx.wait()
95
104
 
96
105
  const nameWrapper = await ensInstance.contracts!.getNameWrapper()!
97
- const [fuses] = await nameWrapper.getFuses(
106
+ const [, fuses] = await nameWrapper.getData(
98
107
  namehash('test.with-subnames.eth'),
99
108
  )
100
109
 
@@ -3,7 +3,7 @@ import { ENSArgs } from '..'
3
3
  import type { FuseOptions } from '../@types/FuseOptions'
4
4
  import generateFuseInput from '../utils/generateFuseInput'
5
5
  import { hexEncodeName } from '../utils/hexEncodedName'
6
- import { Expiry, makeExpiry } from '../utils/wrapperExpiry'
6
+ import { Expiry, makeExpiry, wrappedLabelLengthCheck } from '../utils/wrapper'
7
7
 
8
8
  async function wrapETH(
9
9
  { contracts }: ENSArgs<'contracts'>,
@@ -86,6 +86,8 @@ export default async function (
86
86
  if (!resolverAddress) resolverAddress = publicResolver.address
87
87
 
88
88
  const labels = name.split('.')
89
+ wrappedLabelLengthCheck(labels[0])
90
+
89
91
  if (labels.length === 2 && labels[1] === 'eth') {
90
92
  switch (typeof fuseOptions) {
91
93
  case 'object': {
@@ -52,8 +52,10 @@ export interface ETHRegistrarControllerInterface extends utils.Interface {
52
52
  "nameWrapper()": FunctionFragment;
53
53
  "owner()": FunctionFragment;
54
54
  "prices()": FunctionFragment;
55
+ "recoverFunds(address,address,uint256)": FunctionFragment;
55
56
  "register(string,address,uint256,bytes32,address,bytes[],bool,uint32,uint64)": FunctionFragment;
56
57
  "renew(string,uint256)": FunctionFragment;
58
+ "renewWithFuses(string,uint256,uint32,uint64)": FunctionFragment;
57
59
  "renounceOwnership()": FunctionFragment;
58
60
  "rentPrice(string,uint256)": FunctionFragment;
59
61
  "reverseRegistrar()": FunctionFragment;
@@ -75,8 +77,10 @@ export interface ETHRegistrarControllerInterface extends utils.Interface {
75
77
  | "nameWrapper"
76
78
  | "owner"
77
79
  | "prices"
80
+ | "recoverFunds"
78
81
  | "register"
79
82
  | "renew"
83
+ | "renewWithFuses"
80
84
  | "renounceOwnership"
81
85
  | "rentPrice"
82
86
  | "reverseRegistrar"
@@ -130,6 +134,14 @@ export interface ETHRegistrarControllerInterface extends utils.Interface {
130
134
  ): string;
131
135
  encodeFunctionData(functionFragment: "owner", values?: undefined): string;
132
136
  encodeFunctionData(functionFragment: "prices", values?: undefined): string;
137
+ encodeFunctionData(
138
+ functionFragment: "recoverFunds",
139
+ values: [
140
+ PromiseOrValue<string>,
141
+ PromiseOrValue<string>,
142
+ PromiseOrValue<BigNumberish>
143
+ ]
144
+ ): string;
133
145
  encodeFunctionData(
134
146
  functionFragment: "register",
135
147
  values: [
@@ -148,6 +160,15 @@ export interface ETHRegistrarControllerInterface extends utils.Interface {
148
160
  functionFragment: "renew",
149
161
  values: [PromiseOrValue<string>, PromiseOrValue<BigNumberish>]
150
162
  ): string;
163
+ encodeFunctionData(
164
+ functionFragment: "renewWithFuses",
165
+ values: [
166
+ PromiseOrValue<string>,
167
+ PromiseOrValue<BigNumberish>,
168
+ PromiseOrValue<BigNumberish>,
169
+ PromiseOrValue<BigNumberish>
170
+ ]
171
+ ): string;
151
172
  encodeFunctionData(
152
173
  functionFragment: "renounceOwnership",
153
174
  values?: undefined
@@ -202,8 +223,16 @@ export interface ETHRegistrarControllerInterface extends utils.Interface {
202
223
  ): Result;
203
224
  decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
204
225
  decodeFunctionResult(functionFragment: "prices", data: BytesLike): Result;
226
+ decodeFunctionResult(
227
+ functionFragment: "recoverFunds",
228
+ data: BytesLike
229
+ ): Result;
205
230
  decodeFunctionResult(functionFragment: "register", data: BytesLike): Result;
206
231
  decodeFunctionResult(functionFragment: "renew", data: BytesLike): Result;
232
+ decodeFunctionResult(
233
+ functionFragment: "renewWithFuses",
234
+ data: BytesLike
235
+ ): Result;
207
236
  decodeFunctionResult(
208
237
  functionFragment: "renounceOwnership",
209
238
  data: BytesLike
@@ -342,6 +371,13 @@ export interface ETHRegistrarController extends BaseContract {
342
371
 
343
372
  prices(overrides?: CallOverrides): Promise<[string]>;
344
373
 
374
+ recoverFunds(
375
+ _token: PromiseOrValue<string>,
376
+ _to: PromiseOrValue<string>,
377
+ _amount: PromiseOrValue<BigNumberish>,
378
+ overrides?: Overrides & { from?: PromiseOrValue<string> }
379
+ ): Promise<ContractTransaction>;
380
+
345
381
  register(
346
382
  name: PromiseOrValue<string>,
347
383
  owner: PromiseOrValue<string>,
@@ -361,6 +397,14 @@ export interface ETHRegistrarController extends BaseContract {
361
397
  overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
362
398
  ): Promise<ContractTransaction>;
363
399
 
400
+ renewWithFuses(
401
+ name: PromiseOrValue<string>,
402
+ duration: PromiseOrValue<BigNumberish>,
403
+ fuses: PromiseOrValue<BigNumberish>,
404
+ wrapperExpiry: PromiseOrValue<BigNumberish>,
405
+ overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
406
+ ): Promise<ContractTransaction>;
407
+
364
408
  renounceOwnership(
365
409
  overrides?: Overrides & { from?: PromiseOrValue<string> }
366
410
  ): Promise<ContractTransaction>;
@@ -437,6 +481,13 @@ export interface ETHRegistrarController extends BaseContract {
437
481
 
438
482
  prices(overrides?: CallOverrides): Promise<string>;
439
483
 
484
+ recoverFunds(
485
+ _token: PromiseOrValue<string>,
486
+ _to: PromiseOrValue<string>,
487
+ _amount: PromiseOrValue<BigNumberish>,
488
+ overrides?: Overrides & { from?: PromiseOrValue<string> }
489
+ ): Promise<ContractTransaction>;
490
+
440
491
  register(
441
492
  name: PromiseOrValue<string>,
442
493
  owner: PromiseOrValue<string>,
@@ -456,6 +507,14 @@ export interface ETHRegistrarController extends BaseContract {
456
507
  overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
457
508
  ): Promise<ContractTransaction>;
458
509
 
510
+ renewWithFuses(
511
+ name: PromiseOrValue<string>,
512
+ duration: PromiseOrValue<BigNumberish>,
513
+ fuses: PromiseOrValue<BigNumberish>,
514
+ wrapperExpiry: PromiseOrValue<BigNumberish>,
515
+ overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
516
+ ): Promise<ContractTransaction>;
517
+
459
518
  renounceOwnership(
460
519
  overrides?: Overrides & { from?: PromiseOrValue<string> }
461
520
  ): Promise<ContractTransaction>;
@@ -528,6 +587,13 @@ export interface ETHRegistrarController extends BaseContract {
528
587
 
529
588
  prices(overrides?: CallOverrides): Promise<string>;
530
589
 
590
+ recoverFunds(
591
+ _token: PromiseOrValue<string>,
592
+ _to: PromiseOrValue<string>,
593
+ _amount: PromiseOrValue<BigNumberish>,
594
+ overrides?: CallOverrides
595
+ ): Promise<void>;
596
+
531
597
  register(
532
598
  name: PromiseOrValue<string>,
533
599
  owner: PromiseOrValue<string>,
@@ -547,6 +613,14 @@ export interface ETHRegistrarController extends BaseContract {
547
613
  overrides?: CallOverrides
548
614
  ): Promise<void>;
549
615
 
616
+ renewWithFuses(
617
+ name: PromiseOrValue<string>,
618
+ duration: PromiseOrValue<BigNumberish>,
619
+ fuses: PromiseOrValue<BigNumberish>,
620
+ wrapperExpiry: PromiseOrValue<BigNumberish>,
621
+ overrides?: CallOverrides
622
+ ): Promise<void>;
623
+
550
624
  renounceOwnership(overrides?: CallOverrides): Promise<void>;
551
625
 
552
626
  rentPrice(
@@ -657,6 +731,13 @@ export interface ETHRegistrarController extends BaseContract {
657
731
 
658
732
  prices(overrides?: CallOverrides): Promise<BigNumber>;
659
733
 
734
+ recoverFunds(
735
+ _token: PromiseOrValue<string>,
736
+ _to: PromiseOrValue<string>,
737
+ _amount: PromiseOrValue<BigNumberish>,
738
+ overrides?: Overrides & { from?: PromiseOrValue<string> }
739
+ ): Promise<BigNumber>;
740
+
660
741
  register(
661
742
  name: PromiseOrValue<string>,
662
743
  owner: PromiseOrValue<string>,
@@ -676,6 +757,14 @@ export interface ETHRegistrarController extends BaseContract {
676
757
  overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
677
758
  ): Promise<BigNumber>;
678
759
 
760
+ renewWithFuses(
761
+ name: PromiseOrValue<string>,
762
+ duration: PromiseOrValue<BigNumberish>,
763
+ fuses: PromiseOrValue<BigNumberish>,
764
+ wrapperExpiry: PromiseOrValue<BigNumberish>,
765
+ overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
766
+ ): Promise<BigNumber>;
767
+
679
768
  renounceOwnership(
680
769
  overrides?: Overrides & { from?: PromiseOrValue<string> }
681
770
  ): Promise<BigNumber>;
@@ -751,6 +840,13 @@ export interface ETHRegistrarController extends BaseContract {
751
840
 
752
841
  prices(overrides?: CallOverrides): Promise<PopulatedTransaction>;
753
842
 
843
+ recoverFunds(
844
+ _token: PromiseOrValue<string>,
845
+ _to: PromiseOrValue<string>,
846
+ _amount: PromiseOrValue<BigNumberish>,
847
+ overrides?: Overrides & { from?: PromiseOrValue<string> }
848
+ ): Promise<PopulatedTransaction>;
849
+
754
850
  register(
755
851
  name: PromiseOrValue<string>,
756
852
  owner: PromiseOrValue<string>,
@@ -770,6 +866,14 @@ export interface ETHRegistrarController extends BaseContract {
770
866
  overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
771
867
  ): Promise<PopulatedTransaction>;
772
868
 
869
+ renewWithFuses(
870
+ name: PromiseOrValue<string>,
871
+ duration: PromiseOrValue<BigNumberish>,
872
+ fuses: PromiseOrValue<BigNumberish>,
873
+ wrapperExpiry: PromiseOrValue<BigNumberish>,
874
+ overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
875
+ ): Promise<PopulatedTransaction>;
876
+
773
877
  renounceOwnership(
774
878
  overrides?: Overrides & { from?: PromiseOrValue<string> }
775
879
  ): Promise<PopulatedTransaction>;