@ensdomains/ensjs 3.0.0-alpha.20 → 3.0.0-alpha.21

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 (57) hide show
  1. package/dist/cjs/{functions/renewName.js → contracts/bulkRenewal.js} +6 -14
  2. package/dist/cjs/contracts/getContractAddress.js +2 -1
  3. package/dist/cjs/contracts/index.js +5 -0
  4. package/dist/cjs/functions/deleteSubname.js +40 -8
  5. package/dist/cjs/functions/getPrice.js +55 -8
  6. package/dist/cjs/functions/getSubnames.js +30 -94
  7. package/dist/cjs/functions/renewNames.js +42 -0
  8. package/dist/cjs/generated/BulkRenewal.js +16 -0
  9. package/dist/cjs/generated/factories/BulkRenewal__factory.js +120 -0
  10. package/dist/cjs/generated/factories/index.js +2 -0
  11. package/dist/cjs/generated/index.js +2 -0
  12. package/dist/cjs/index.js +5 -4
  13. package/dist/esm/contracts/bulkRenewal.mjs +6 -0
  14. package/dist/esm/contracts/getContractAddress.mjs +2 -1
  15. package/dist/esm/contracts/index.mjs +5 -0
  16. package/dist/esm/functions/deleteSubname.mjs +40 -8
  17. package/dist/esm/functions/getPrice.mjs +56 -9
  18. package/dist/esm/functions/getSubnames.mjs +30 -94
  19. package/dist/esm/functions/renewNames.mjs +23 -0
  20. package/dist/esm/generated/BulkRenewal.mjs +0 -0
  21. package/dist/esm/generated/factories/BulkRenewal__factory.mjs +108 -0
  22. package/dist/esm/generated/factories/index.mjs +2 -0
  23. package/dist/esm/generated/index.mjs +2 -0
  24. package/dist/esm/index.mjs +5 -4
  25. package/dist/types/contracts/bulkRenewal.d.ts +3 -0
  26. package/dist/types/contracts/index.d.ts +1 -0
  27. package/dist/types/contracts/types.d.ts +1 -1
  28. package/dist/types/functions/deleteSubname.d.ts +5 -2
  29. package/dist/types/functions/getPrice.d.ts +2 -2
  30. package/dist/types/functions/getSubnames.d.ts +1 -1
  31. package/dist/types/functions/{renewName.d.ts → renewNames.d.ts} +2 -2
  32. package/dist/types/generated/BulkRenewal.d.ts +76 -0
  33. package/dist/types/generated/factories/BulkRenewal__factory.d.ts +32 -0
  34. package/dist/types/generated/factories/index.d.ts +1 -0
  35. package/dist/types/generated/index.d.ts +2 -0
  36. package/dist/types/index.d.ts +5 -5
  37. package/package.json +1 -1
  38. package/src/contracts/bulkRenewal.ts +6 -0
  39. package/src/contracts/getContractAddress.ts +1 -0
  40. package/src/contracts/index.ts +6 -0
  41. package/src/contracts/types.ts +1 -0
  42. package/src/functions/deleteSubname.ts +51 -11
  43. package/src/functions/getNames.test.ts +10 -1
  44. package/src/functions/getPrice.test.ts +52 -0
  45. package/src/functions/getPrice.ts +61 -9
  46. package/src/functions/getProfile.test.ts +5 -1
  47. package/src/functions/getSubnames.test.ts +669 -29
  48. package/src/functions/getSubnames.ts +39 -98
  49. package/src/functions/{renewName.test.ts → renewNames.test.ts} +22 -2
  50. package/src/functions/renewNames.ts +30 -0
  51. package/src/generated/BulkRenewal.ts +197 -0
  52. package/src/generated/factories/BulkRenewal__factory.ts +108 -0
  53. package/src/generated/factories/index.ts +1 -0
  54. package/src/generated/index.ts +2 -0
  55. package/src/index.ts +6 -5
  56. package/dist/esm/functions/renewName.mjs +0 -14
  57. package/src/functions/renewName.ts +0 -22
@@ -22,22 +22,51 @@ type Params = {
22
22
  orderDirection?: 'asc' | 'desc'
23
23
  orderBy?: 'createdAt' | 'labelName'
24
24
  lastSubnames?: Array<any>
25
- isLargeQuery?: boolean
25
+ search?: string
26
26
  }
27
27
 
28
28
  const largeQuery = async (
29
29
  { gqlInstance }: ENSArgs<'gqlInstance'>,
30
- { name, pageSize = 10, orderDirection, orderBy, lastSubnames = [] }: Params,
30
+ {
31
+ name,
32
+ pageSize = 10,
33
+ orderDirection,
34
+ orderBy,
35
+ lastSubnames = [],
36
+ search = '',
37
+ }: Params,
31
38
  ) => {
32
39
  const { client } = gqlInstance
33
40
 
41
+ const lastSubname = lastSubnames?.[lastSubnames.length - 1]
42
+ const lastCreatedAt = lastSubname?.createdAt
43
+ const lastLabelName = lastSubname?.labelName
44
+
45
+ let whereFilter = ''
46
+ if (orderBy === 'createdAt' && lastCreatedAt) {
47
+ whereFilter +=
48
+ orderDirection === 'asc'
49
+ ? 'createdAt_gt: $lastCreatedAt'
50
+ : 'createdAt_lt: $lastCreatedAt'
51
+ } else if (orderBy === 'labelName' && lastLabelName) {
52
+ whereFilter +=
53
+ orderDirection === 'asc'
54
+ ? 'labelName_gt: $lastLabelName'
55
+ : 'labelName_lt: $lastLabelName'
56
+ }
57
+ if (search) {
58
+ whereFilter += ' labelName_contains: $search'
59
+ }
60
+
34
61
  const finalQuery = gqlInstance.gql`
35
62
  query getSubnames(
36
63
  $id: ID!
37
64
  $first: Int
38
65
  $lastCreatedAt: BigInt
66
+ $lastLabelName: String
39
67
  $orderBy: Domain_orderBy
40
68
  $orderDirection: OrderDirection
69
+ $search: String
41
70
  ) {
42
71
  domain(
43
72
  id: $id
@@ -47,7 +76,9 @@ const largeQuery = async (
47
76
  first: $first
48
77
  orderBy: $orderBy
49
78
  orderDirection: $orderDirection
50
- where: { createdAt_lt: $lastCreatedAt }
79
+ where: {
80
+ ${whereFilter}
81
+ }
51
82
  ) {
52
83
  id
53
84
  labelName
@@ -63,107 +94,20 @@ const largeQuery = async (
63
94
  }
64
95
  }
65
96
  `
97
+
66
98
  const queryVars = {
67
99
  id: namehash(name),
68
100
  first: pageSize,
69
- lastCreatedAt: lastSubnames[lastSubnames.length - 1]?.createdAt,
101
+ lastCreatedAt,
102
+ lastLabelName,
70
103
  orderBy,
71
104
  orderDirection,
105
+ search: search?.toLowerCase(),
72
106
  }
73
107
  const { domain } = await client.request(finalQuery, queryVars)
74
108
  const subdomains = domain.subdomains.map((subname: any) => {
75
109
  const decrypted = decryptName(subname.name)
76
- return {
77
- ...subname,
78
- name: decrypted,
79
- truncatedName: truncateFormat(decrypted),
80
- }
81
- })
82
110
 
83
- return {
84
- subnames: subdomains,
85
- subnameCount: domain.subdomainCount,
86
- }
87
- }
88
-
89
- const smallQuery = async (
90
- { gqlInstance }: ENSArgs<'gqlInstance'>,
91
- { name, page, pageSize = 10, orderDirection, orderBy }: Params,
92
- ) => {
93
- const { client } = gqlInstance
94
- const subdomainsGql = `
95
- id
96
- labelName
97
- labelhash
98
- isMigrated
99
- name
100
- subdomainCount
101
- createdAt
102
- owner {
103
- id
104
- }
105
- `
106
- let queryVars = {}
107
- let finalQuery = ''
108
- if (typeof page !== 'number') {
109
- finalQuery = gqlInstance.gql`
110
- query getSubnames(
111
- $id: ID!
112
- $orderBy: Domain_orderBy
113
- $orderDirection: OrderDirection
114
- ) {
115
- domain(
116
- id: $id
117
- ) {
118
- subdomains(
119
- orderBy: $orderBy
120
- orderDirection: $orderDirection
121
- ) {
122
- ${subdomainsGql}
123
- }
124
- }
125
- }
126
- `
127
- queryVars = {
128
- id: namehash(name),
129
- orderBy,
130
- orderDirection,
131
- }
132
- } else {
133
- finalQuery = gqlInstance.gql`
134
- query getSubnames(
135
- $id: ID!
136
- $first: Int
137
- $skip: Int
138
- $orderBy: Domain_orderBy
139
- $orderDirection: OrderDirection
140
- ) {
141
- domain(
142
- id: $id
143
- ) {
144
- subdomainCount
145
- subdomains(
146
- first: $first
147
- skip: $skip
148
- orderBy: $orderBy
149
- orderDirection: $orderDirection
150
- ) {
151
- ${subdomainsGql}
152
- }
153
- }
154
- }
155
- `
156
- queryVars = {
157
- id: namehash(name),
158
- first: pageSize,
159
- skip: (page || 0) * pageSize,
160
- orderBy,
161
- orderDirection,
162
- }
163
- }
164
- const { domain } = await client.request(finalQuery, queryVars)
165
- const subdomains = domain.subdomains.map((subname: any) => {
166
- const decrypted = decryptName(subname.name)
167
111
  return {
168
112
  ...subname,
169
113
  name: decrypted,
@@ -181,10 +125,7 @@ const getSubnames = (
181
125
  injected: ENSArgs<'gqlInstance'>,
182
126
  functionArgs: Params,
183
127
  ): Promise<{ subnames: Subname[]; subnameCount: number }> => {
184
- if (functionArgs.isLargeQuery) {
185
- return largeQuery(injected, functionArgs)
186
- }
187
- return smallQuery(injected, functionArgs)
128
+ return largeQuery(injected, functionArgs)
188
129
  }
189
130
 
190
131
  export default getSubnames
@@ -17,7 +17,7 @@ afterAll(async () => {
17
17
  await revert()
18
18
  })
19
19
 
20
- describe('registerName', () => {
20
+ describe('renewNames', () => {
21
21
  beforeEach(async () => {
22
22
  await revert()
23
23
  })
@@ -31,7 +31,7 @@ describe('registerName', () => {
31
31
  const controller = await ensInstance.contracts!.getEthRegistrarController()!
32
32
  const [price] = await controller.rentPrice(label, duration)
33
33
 
34
- const tx = await ensInstance.renewName(name, {
34
+ const tx = await ensInstance.renewNames(name, {
35
35
  value: price.mul(2),
36
36
  duration,
37
37
  addressOrIndex: accounts[1],
@@ -41,4 +41,24 @@ describe('registerName', () => {
41
41
  const newExpiry = await baseRegistrar.nameExpires(labelhash(label))
42
42
  expect(newExpiry.toNumber()).toBe(oldExpiry.add(31536000).toNumber())
43
43
  })
44
+
45
+ it('should return a renew transaction and succeed', async () => {
46
+ const names = ['to-be-renewed.eth', 'test123.eth']
47
+ const label = names[0].split('.')[0]
48
+ const duration = 31536000
49
+ const baseRegistrar = await ensInstance.contracts!.getBaseRegistrar()!
50
+ const oldExpiry = await baseRegistrar.nameExpires(labelhash(label))
51
+ const controller = await ensInstance.contracts!.getEthRegistrarController()!
52
+ const [price] = await controller.rentPrice(label, duration)
53
+
54
+ const tx = await ensInstance.renewNames(names, {
55
+ value: price.mul(4),
56
+ duration,
57
+ addressOrIndex: accounts[1],
58
+ })
59
+ await tx.wait()
60
+
61
+ const newExpiry = await baseRegistrar.nameExpires(labelhash(label))
62
+ expect(newExpiry.toNumber()).toBe(oldExpiry.add(31536000).toNumber())
63
+ })
44
64
  })
@@ -0,0 +1,30 @@
1
+ import { BigNumber } from 'ethers'
2
+ import { ENSArgs } from '..'
3
+
4
+ export default async function (
5
+ { contracts }: ENSArgs<'contracts'>,
6
+ nameOrNames: string | string[],
7
+ {
8
+ duration,
9
+ value,
10
+ }: {
11
+ duration: number
12
+ value: BigNumber
13
+ },
14
+ ) {
15
+ const names = Array.isArray(nameOrNames) ? nameOrNames : [nameOrNames]
16
+ const labels = names.map((name) => {
17
+ const label = name.split('.')
18
+ if (label.length !== 2 || label[1] !== 'eth') {
19
+ throw new Error('Currently only .eth TLD renewals are supported')
20
+ }
21
+ return label[0]
22
+ })
23
+
24
+ if (labels.length === 1) {
25
+ const controller = await contracts!.getEthRegistrarController()
26
+ return controller.populateTransaction.renew(labels[0], duration, { value })
27
+ }
28
+ const bulkRenewal = await contracts!.getBulkRenewal()
29
+ return bulkRenewal.populateTransaction.renewAll(labels, duration, { value })
30
+ }
@@ -0,0 +1,197 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ import type {
5
+ BaseContract,
6
+ BigNumber,
7
+ BigNumberish,
8
+ BytesLike,
9
+ CallOverrides,
10
+ ContractTransaction,
11
+ PayableOverrides,
12
+ PopulatedTransaction,
13
+ Signer,
14
+ utils,
15
+ } from "ethers";
16
+ import type { FunctionFragment, Result } from "@ethersproject/abi";
17
+ import type { Listener, Provider } from "@ethersproject/providers";
18
+ import type {
19
+ TypedEventFilter,
20
+ TypedEvent,
21
+ TypedListener,
22
+ OnEvent,
23
+ PromiseOrValue,
24
+ } from "./common";
25
+
26
+ export interface BulkRenewalInterface extends utils.Interface {
27
+ functions: {
28
+ "ens()": FunctionFragment;
29
+ "renewAll(string[],uint256)": FunctionFragment;
30
+ "rentPrice(string[],uint256)": FunctionFragment;
31
+ "supportsInterface(bytes4)": FunctionFragment;
32
+ };
33
+
34
+ getFunction(
35
+ nameOrSignatureOrTopic:
36
+ | "ens"
37
+ | "renewAll"
38
+ | "rentPrice"
39
+ | "supportsInterface"
40
+ ): FunctionFragment;
41
+
42
+ encodeFunctionData(functionFragment: "ens", values?: undefined): string;
43
+ encodeFunctionData(
44
+ functionFragment: "renewAll",
45
+ values: [PromiseOrValue<string>[], PromiseOrValue<BigNumberish>]
46
+ ): string;
47
+ encodeFunctionData(
48
+ functionFragment: "rentPrice",
49
+ values: [PromiseOrValue<string>[], PromiseOrValue<BigNumberish>]
50
+ ): string;
51
+ encodeFunctionData(
52
+ functionFragment: "supportsInterface",
53
+ values: [PromiseOrValue<BytesLike>]
54
+ ): string;
55
+
56
+ decodeFunctionResult(functionFragment: "ens", data: BytesLike): Result;
57
+ decodeFunctionResult(functionFragment: "renewAll", data: BytesLike): Result;
58
+ decodeFunctionResult(functionFragment: "rentPrice", data: BytesLike): Result;
59
+ decodeFunctionResult(
60
+ functionFragment: "supportsInterface",
61
+ data: BytesLike
62
+ ): Result;
63
+
64
+ events: {};
65
+ }
66
+
67
+ export interface BulkRenewal extends BaseContract {
68
+ connect(signerOrProvider: Signer | Provider | string): this;
69
+ attach(addressOrName: string): this;
70
+ deployed(): Promise<this>;
71
+
72
+ interface: BulkRenewalInterface;
73
+
74
+ queryFilter<TEvent extends TypedEvent>(
75
+ event: TypedEventFilter<TEvent>,
76
+ fromBlockOrBlockhash?: string | number | undefined,
77
+ toBlock?: string | number | undefined
78
+ ): Promise<Array<TEvent>>;
79
+
80
+ listeners<TEvent extends TypedEvent>(
81
+ eventFilter?: TypedEventFilter<TEvent>
82
+ ): Array<TypedListener<TEvent>>;
83
+ listeners(eventName?: string): Array<Listener>;
84
+ removeAllListeners<TEvent extends TypedEvent>(
85
+ eventFilter: TypedEventFilter<TEvent>
86
+ ): this;
87
+ removeAllListeners(eventName?: string): this;
88
+ off: OnEvent<this>;
89
+ on: OnEvent<this>;
90
+ once: OnEvent<this>;
91
+ removeListener: OnEvent<this>;
92
+
93
+ functions: {
94
+ ens(overrides?: CallOverrides): Promise<[string]>;
95
+
96
+ renewAll(
97
+ names: PromiseOrValue<string>[],
98
+ duration: PromiseOrValue<BigNumberish>,
99
+ overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
100
+ ): Promise<ContractTransaction>;
101
+
102
+ rentPrice(
103
+ names: PromiseOrValue<string>[],
104
+ duration: PromiseOrValue<BigNumberish>,
105
+ overrides?: CallOverrides
106
+ ): Promise<[BigNumber] & { total: BigNumber }>;
107
+
108
+ supportsInterface(
109
+ interfaceID: PromiseOrValue<BytesLike>,
110
+ overrides?: CallOverrides
111
+ ): Promise<[boolean]>;
112
+ };
113
+
114
+ ens(overrides?: CallOverrides): Promise<string>;
115
+
116
+ renewAll(
117
+ names: PromiseOrValue<string>[],
118
+ duration: PromiseOrValue<BigNumberish>,
119
+ overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
120
+ ): Promise<ContractTransaction>;
121
+
122
+ rentPrice(
123
+ names: PromiseOrValue<string>[],
124
+ duration: PromiseOrValue<BigNumberish>,
125
+ overrides?: CallOverrides
126
+ ): Promise<BigNumber>;
127
+
128
+ supportsInterface(
129
+ interfaceID: PromiseOrValue<BytesLike>,
130
+ overrides?: CallOverrides
131
+ ): Promise<boolean>;
132
+
133
+ callStatic: {
134
+ ens(overrides?: CallOverrides): Promise<string>;
135
+
136
+ renewAll(
137
+ names: PromiseOrValue<string>[],
138
+ duration: PromiseOrValue<BigNumberish>,
139
+ overrides?: CallOverrides
140
+ ): Promise<void>;
141
+
142
+ rentPrice(
143
+ names: PromiseOrValue<string>[],
144
+ duration: PromiseOrValue<BigNumberish>,
145
+ overrides?: CallOverrides
146
+ ): Promise<BigNumber>;
147
+
148
+ supportsInterface(
149
+ interfaceID: PromiseOrValue<BytesLike>,
150
+ overrides?: CallOverrides
151
+ ): Promise<boolean>;
152
+ };
153
+
154
+ filters: {};
155
+
156
+ estimateGas: {
157
+ ens(overrides?: CallOverrides): Promise<BigNumber>;
158
+
159
+ renewAll(
160
+ names: PromiseOrValue<string>[],
161
+ duration: PromiseOrValue<BigNumberish>,
162
+ overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
163
+ ): Promise<BigNumber>;
164
+
165
+ rentPrice(
166
+ names: PromiseOrValue<string>[],
167
+ duration: PromiseOrValue<BigNumberish>,
168
+ overrides?: CallOverrides
169
+ ): Promise<BigNumber>;
170
+
171
+ supportsInterface(
172
+ interfaceID: PromiseOrValue<BytesLike>,
173
+ overrides?: CallOverrides
174
+ ): Promise<BigNumber>;
175
+ };
176
+
177
+ populateTransaction: {
178
+ ens(overrides?: CallOverrides): Promise<PopulatedTransaction>;
179
+
180
+ renewAll(
181
+ names: PromiseOrValue<string>[],
182
+ duration: PromiseOrValue<BigNumberish>,
183
+ overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
184
+ ): Promise<PopulatedTransaction>;
185
+
186
+ rentPrice(
187
+ names: PromiseOrValue<string>[],
188
+ duration: PromiseOrValue<BigNumberish>,
189
+ overrides?: CallOverrides
190
+ ): Promise<PopulatedTransaction>;
191
+
192
+ supportsInterface(
193
+ interfaceID: PromiseOrValue<BytesLike>,
194
+ overrides?: CallOverrides
195
+ ): Promise<PopulatedTransaction>;
196
+ };
197
+ }
@@ -0,0 +1,108 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ import { Contract, Signer, utils } from "ethers";
6
+ import type { Provider } from "@ethersproject/providers";
7
+ import type { BulkRenewal, BulkRenewalInterface } from "../BulkRenewal";
8
+
9
+ const _abi = [
10
+ {
11
+ inputs: [
12
+ {
13
+ internalType: "contract ENS",
14
+ name: "_ens",
15
+ type: "address",
16
+ },
17
+ ],
18
+ stateMutability: "nonpayable",
19
+ type: "constructor",
20
+ },
21
+ {
22
+ inputs: [],
23
+ name: "ens",
24
+ outputs: [
25
+ {
26
+ internalType: "contract ENS",
27
+ name: "",
28
+ type: "address",
29
+ },
30
+ ],
31
+ stateMutability: "view",
32
+ type: "function",
33
+ },
34
+ {
35
+ inputs: [
36
+ {
37
+ internalType: "string[]",
38
+ name: "names",
39
+ type: "string[]",
40
+ },
41
+ {
42
+ internalType: "uint256",
43
+ name: "duration",
44
+ type: "uint256",
45
+ },
46
+ ],
47
+ name: "renewAll",
48
+ outputs: [],
49
+ stateMutability: "payable",
50
+ type: "function",
51
+ },
52
+ {
53
+ inputs: [
54
+ {
55
+ internalType: "string[]",
56
+ name: "names",
57
+ type: "string[]",
58
+ },
59
+ {
60
+ internalType: "uint256",
61
+ name: "duration",
62
+ type: "uint256",
63
+ },
64
+ ],
65
+ name: "rentPrice",
66
+ outputs: [
67
+ {
68
+ internalType: "uint256",
69
+ name: "total",
70
+ type: "uint256",
71
+ },
72
+ ],
73
+ stateMutability: "view",
74
+ type: "function",
75
+ },
76
+ {
77
+ inputs: [
78
+ {
79
+ internalType: "bytes4",
80
+ name: "interfaceID",
81
+ type: "bytes4",
82
+ },
83
+ ],
84
+ name: "supportsInterface",
85
+ outputs: [
86
+ {
87
+ internalType: "bool",
88
+ name: "",
89
+ type: "bool",
90
+ },
91
+ ],
92
+ stateMutability: "pure",
93
+ type: "function",
94
+ },
95
+ ];
96
+
97
+ export class BulkRenewal__factory {
98
+ static readonly abi = _abi;
99
+ static createInterface(): BulkRenewalInterface {
100
+ return new utils.Interface(_abi) as BulkRenewalInterface;
101
+ }
102
+ static connect(
103
+ address: string,
104
+ signerOrProvider: Signer | Provider
105
+ ): BulkRenewal {
106
+ return new Contract(address, _abi, signerOrProvider) as BulkRenewal;
107
+ }
108
+ }
@@ -2,6 +2,7 @@
2
2
  /* tslint:disable */
3
3
  /* eslint-disable */
4
4
  export { BaseRegistrarImplementation__factory } from "./BaseRegistrarImplementation__factory";
5
+ export { BulkRenewal__factory } from "./BulkRenewal__factory";
5
6
  export { DNSRegistrar__factory } from "./DNSRegistrar__factory";
6
7
  export { DNSSECImpl__factory } from "./DNSSECImpl__factory";
7
8
  export { DefaultReverseResolver__factory } from "./DefaultReverseResolver__factory";
@@ -2,6 +2,7 @@
2
2
  /* tslint:disable */
3
3
  /* eslint-disable */
4
4
  export type { BaseRegistrarImplementation } from "./BaseRegistrarImplementation";
5
+ export type { BulkRenewal } from "./BulkRenewal";
5
6
  export type { DNSRegistrar } from "./DNSRegistrar";
6
7
  export type { DNSSECImpl } from "./DNSSECImpl";
7
8
  export type { DefaultReverseResolver } from "./DefaultReverseResolver";
@@ -42,3 +43,4 @@ export { Multicall__factory } from "./factories/Multicall__factory";
42
43
  export { NameWrapper__factory } from "./factories/NameWrapper__factory";
43
44
  export { StaticMetadataService__factory } from "./factories/StaticMetadataService__factory";
44
45
  export { UniversalResolver__factory } from "./factories/UniversalResolver__factory";
46
+ export { BulkRenewal__factory } from "./factories/BulkRenewal__factory";
package/src/index.ts CHANGED
@@ -34,7 +34,7 @@ import type {
34
34
  } from './functions/getSpecificRecord'
35
35
  import type getSubnames from './functions/getSubnames'
36
36
  import type registerName from './functions/registerName'
37
- import type renewName from './functions/renewName'
37
+ import type renewNames from './functions/renewNames'
38
38
  import type setName from './functions/setName'
39
39
  import type setRecord from './functions/setRecord'
40
40
  import type setRecords from './functions/setRecords'
@@ -588,7 +588,7 @@ export class ENS {
588
588
 
589
589
  public deleteSubname = this.generateWriteFunction<typeof deleteSubname>(
590
590
  'deleteSubname',
591
- ['transferSubname'],
591
+ ['contracts'],
592
592
  )
593
593
 
594
594
  public transferSubname = this.generateWriteFunction<typeof transferSubname>(
@@ -606,7 +606,8 @@ export class ENS {
606
606
  ['contracts'],
607
607
  )
608
608
 
609
- public renewName = this.generateWriteFunction<typeof renewName>('renewName', [
610
- 'contracts',
611
- ])
609
+ public renewNames = this.generateWriteFunction<typeof renewNames>(
610
+ 'renewNames',
611
+ ['contracts'],
612
+ )
612
613
  }
@@ -1,14 +0,0 @@
1
- // src/functions/renewName.ts
2
- async function renewName_default({ contracts }, name, {
3
- duration,
4
- value
5
- }) {
6
- const labels = name.split(".");
7
- if (labels.length !== 2 || labels[1] !== "eth")
8
- throw new Error("Currently only .eth TLD renewals are supported");
9
- const controller = await contracts.getEthRegistrarController();
10
- return controller.populateTransaction.renew(labels[0], duration, { value });
11
- }
12
- export {
13
- renewName_default as default
14
- };
@@ -1,22 +0,0 @@
1
- import type { BigNumber } from 'ethers'
2
- import { ENSArgs } from '..'
3
-
4
- export default async function (
5
- { contracts }: ENSArgs<'contracts'>,
6
- name: string,
7
- {
8
- duration,
9
- value,
10
- }: {
11
- duration: number
12
- value: BigNumber
13
- },
14
- ) {
15
- const labels = name.split('.')
16
- if (labels.length !== 2 || labels[1] !== 'eth')
17
- throw new Error('Currently only .eth TLD renewals are supported')
18
-
19
- const controller = await contracts!.getEthRegistrarController()
20
-
21
- return controller.populateTransaction.renew(labels[0], duration, { value })
22
- }