@ensdomains/ensjs 3.0.0-alpha.36 → 3.0.0-alpha.38

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 (68) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +7 -0
  3. package/dist/cjs/GqlManager.js +22 -20
  4. package/dist/cjs/contracts/getContractAddress.js +1 -1
  5. package/dist/cjs/contracts/index.js +44 -46
  6. package/dist/cjs/functions/batchWrappers.js +6 -6
  7. package/dist/cjs/functions/createSubname.js +1 -1
  8. package/dist/cjs/functions/getAvailable.js +2 -2
  9. package/dist/cjs/functions/getDNSOwner.js +4 -2
  10. package/dist/cjs/functions/getExpiry.js +4 -4
  11. package/dist/cjs/functions/getName.js +2 -2
  12. package/dist/cjs/functions/getNames.js +6 -6
  13. package/dist/cjs/functions/getOwner.js +10 -9
  14. package/dist/cjs/functions/getPrice.js +4 -4
  15. package/dist/cjs/functions/getProfile.js +10 -10
  16. package/dist/cjs/functions/getResolver.js +2 -2
  17. package/dist/cjs/functions/getSpecificRecord.js +6 -6
  18. package/dist/cjs/functions/getSubnames.js +4 -4
  19. package/dist/cjs/functions/getWrapperData.js +2 -2
  20. package/dist/cjs/functions/importDNSSECName.js +5 -5
  21. package/dist/cjs/functions/initialGetters.js +3 -1
  22. package/dist/cjs/functions/setName.js +3 -2
  23. package/dist/cjs/functions/setRecord.js +2 -1
  24. package/dist/cjs/functions/setRecords.js +2 -1
  25. package/dist/cjs/functions/setResolver.js +2 -2
  26. package/dist/cjs/functions/supportsTLD.js +48 -0
  27. package/dist/cjs/functions/transferController.js +2 -2
  28. package/dist/cjs/functions/transferName.js +3 -3
  29. package/dist/cjs/functions/wrapName.js +3 -3
  30. package/dist/cjs/generated/factories/BaseRegistrarImplementation__factory.js +1 -1
  31. package/dist/cjs/generated/factories/BulkRenewal__factory.js +1 -1
  32. package/dist/cjs/generated/factories/DNSRegistrar__factory.js +1 -1
  33. package/dist/cjs/generated/factories/DNSSECImpl__factory.js +1 -1
  34. package/dist/cjs/generated/factories/DefaultReverseResolver__factory.js +1 -1
  35. package/dist/cjs/generated/factories/ENSRegistry__factory.js +1 -1
  36. package/dist/cjs/generated/factories/ETHRegistrarController__factory.js +1 -1
  37. package/dist/cjs/generated/factories/Multicall__factory.js +1 -1
  38. package/dist/cjs/generated/factories/NameWrapper__factory.js +1 -1
  39. package/dist/cjs/generated/factories/P256SHA256Algorithm__factory.js +1 -1
  40. package/dist/cjs/generated/factories/PublicResolver__factory.js +1 -1
  41. package/dist/cjs/generated/factories/RSASHA1Algorithm__factory.js +1 -1
  42. package/dist/cjs/generated/factories/RSASHA256Algorithm__factory.js +1 -1
  43. package/dist/cjs/generated/factories/ReverseRegistrar__factory.js +1 -1
  44. package/dist/cjs/generated/factories/Root__factory.js +1 -1
  45. package/dist/cjs/generated/factories/SHA1Digest__factory.js +1 -1
  46. package/dist/cjs/generated/factories/SHA1NSEC3Digest__factory.js +1 -1
  47. package/dist/cjs/generated/factories/SHA256Digest__factory.js +1 -1
  48. package/dist/cjs/generated/factories/StaticMetadataService__factory.js +1 -1
  49. package/dist/cjs/generated/factories/TLDPublicSuffixList__factory.js +1 -1
  50. package/dist/cjs/generated/factories/UniversalResolver__factory.js +1 -1
  51. package/dist/cjs/index.js +295 -291
  52. package/dist/cjs/utils/labels.js +1 -1
  53. package/dist/cjs/utils/recordHelpers.js +1 -1
  54. package/dist/cjs/utils/registerHelpers.js +2 -1
  55. package/dist/cjs/utils/wrapper.js +1 -1
  56. package/dist/esm/contracts/getContractAddress.mjs +1 -1
  57. package/dist/esm/functions/initialGetters.mjs +3 -1
  58. package/dist/esm/functions/supportsTLD.mjs +29 -0
  59. package/dist/esm/index.mjs +9 -1
  60. package/dist/types/functions/initialGetters.d.ts +1 -0
  61. package/dist/types/functions/supportsTLD.d.ts +2 -0
  62. package/dist/types/index.d.ts +6 -1
  63. package/package.json +1 -1
  64. package/src/contracts/getContractAddress.ts +1 -1
  65. package/src/functions/initialGetters.ts +1 -0
  66. package/src/functions/supportsTLD.test.ts +45 -0
  67. package/src/functions/supportsTLD.ts +38 -0
  68. package/src/index.ts +12 -1
package/dist/cjs/index.js CHANGED
@@ -39,302 +39,306 @@ const graphURIEndpoints = {
39
39
  5: "https://api.thegraph.com/subgraphs/name/ensdomains/ensgoerli"
40
40
  };
41
41
  class ENS {
42
- options;
43
- provider;
44
- graphURI;
45
- initialProvider;
46
- contracts;
47
- getContractAddress = import_getContractAddress.getContractAddress;
48
- gqlInstance = new import_GqlManager.default();
49
42
  constructor(options) {
50
- this.options = options;
51
- this.getContractAddress = options?.getContractAddress || import_getContractAddress.getContractAddress;
52
- }
53
- checkInitialProvider = async () => {
54
- if (!this.initialProvider) {
55
- return;
56
- }
57
- await this.setProvider(this.initialProvider);
58
- };
59
- forwardDependenciesFromArray = (dependencies) => Object.fromEntries(
60
- dependencies.map((dep) => [dep, this[dep]])
61
- );
62
- importGenerator = (path, dependencies, exportName = "default", subFunc, passthrough) => {
63
- if (subFunc === "batch") {
64
- return (...args) => ({ args, ...passthrough });
65
- }
66
- const thisRef = this;
67
- const mainFunc = async function(...args) {
68
- await thisRef.checkInitialProvider();
69
- const mod = await import(
70
- /* webpackMode: "lazy", webpackChunkName: "[request]", webpackPreload: true, webpackExclude: /.*\.ts$/ */
71
- `./functions/${path}`
72
- );
73
- if (subFunc !== "combine") {
74
- const writeable = subFunc === "write" || subFunc === "populateTransaction";
75
- const func = subFunc && !writeable ? mod[exportName][subFunc] : mod[exportName];
76
- let dependenciesToForward2 = thisRef.forwardDependenciesFromArray(dependencies);
77
- if (writeable) {
78
- const options = args[1] || {};
79
- const signer = options.signer || thisRef.provider?.getSigner(options.addressOrIndex);
80
- const populate = subFunc === "populateTransaction";
81
- if (!signer) {
82
- throw new Error("No signer specified");
43
+ this.getContractAddress = import_getContractAddress.getContractAddress;
44
+ this.gqlInstance = new import_GqlManager.default();
45
+ this.checkInitialProvider = async () => {
46
+ if (!this.initialProvider) {
47
+ return;
48
+ }
49
+ await this.setProvider(this.initialProvider);
50
+ };
51
+ this.forwardDependenciesFromArray = (dependencies) => Object.fromEntries(
52
+ dependencies.map((dep) => [dep, this[dep]])
53
+ );
54
+ this.importGenerator = (path, dependencies, exportName = "default", subFunc, passthrough) => {
55
+ if (subFunc === "batch") {
56
+ return (...args) => ({ args, ...passthrough });
57
+ }
58
+ const thisRef = this;
59
+ const mainFunc = async function(...args) {
60
+ var _a, _b;
61
+ await thisRef.checkInitialProvider();
62
+ let mod = await import(
63
+ /* webpackMode: "lazy", webpackChunkName: "[request]", webpackPreload: true, webpackExclude: /.*\.ts$/ */
64
+ `./functions/${path}`
65
+ );
66
+ if ((_a = mod.default) == null ? void 0 : _a[exportName]) {
67
+ mod = mod.default;
68
+ }
69
+ if (subFunc !== "combine") {
70
+ const writeable = subFunc === "write" || subFunc === "populateTransaction";
71
+ const func = subFunc && !writeable ? mod[exportName][subFunc] : mod[exportName];
72
+ let dependenciesToForward2 = thisRef.forwardDependenciesFromArray(dependencies);
73
+ if (writeable) {
74
+ const options = args[1] || {};
75
+ const signer = options.signer || ((_b = thisRef.provider) == null ? void 0 : _b.getSigner(options.addressOrIndex));
76
+ const populate = subFunc === "populateTransaction";
77
+ if (!signer) {
78
+ throw new Error("No signer specified");
79
+ }
80
+ delete options.addressOrIndex;
81
+ delete options.signer;
82
+ dependenciesToForward2 = { ...dependenciesToForward2, signer };
83
+ return func(dependenciesToForward2, args[0], options).then(
84
+ (0, import_writeTx.default)(signer, populate)
85
+ );
83
86
  }
84
- delete options.addressOrIndex;
85
- delete options.signer;
86
- dependenciesToForward2 = { ...dependenciesToForward2, signer };
87
- return func(dependenciesToForward2, args[0], options).then(
88
- (0, import_writeTx.default)(signer, populate)
89
- );
87
+ return func(dependenciesToForward2, ...args);
90
88
  }
91
- return func(dependenciesToForward2, ...args);
89
+ const dependenciesToForward = thisRef.forwardDependenciesFromArray(dependencies);
90
+ return (0, import_singleCall.default)(
91
+ thisRef.provider,
92
+ dependenciesToForward,
93
+ mod[exportName],
94
+ ...args
95
+ );
96
+ };
97
+ if (subFunc === "combine") {
98
+ mainFunc.raw = this.importGenerator(
99
+ path,
100
+ dependencies,
101
+ exportName,
102
+ "raw"
103
+ );
104
+ mainFunc.decode = this.importGenerator(
105
+ path,
106
+ dependencies,
107
+ exportName,
108
+ "decode"
109
+ );
110
+ mainFunc.batch = this.importGenerator(
111
+ path,
112
+ dependencies,
113
+ exportName,
114
+ "batch",
115
+ { raw: mainFunc.raw, decode: mainFunc.decode }
116
+ );
117
+ } else if (subFunc === "write") {
118
+ mainFunc.populateTransaction = this.importGenerator(
119
+ path,
120
+ dependencies,
121
+ exportName,
122
+ "populateTransaction"
123
+ );
92
124
  }
93
- const dependenciesToForward = thisRef.forwardDependenciesFromArray(dependencies);
94
- return (0, import_singleCall.default)(
95
- thisRef.provider,
96
- dependenciesToForward,
97
- mod[exportName],
98
- ...args
99
- );
125
+ return mainFunc;
100
126
  };
101
- if (subFunc === "combine") {
102
- mainFunc.raw = this.importGenerator(
103
- path,
104
- dependencies,
105
- exportName,
106
- "raw"
107
- );
108
- mainFunc.decode = this.importGenerator(
109
- path,
110
- dependencies,
111
- exportName,
112
- "decode"
113
- );
114
- mainFunc.batch = this.importGenerator(
115
- path,
116
- dependencies,
117
- exportName,
118
- "batch",
119
- { raw: mainFunc.raw, decode: mainFunc.decode }
120
- );
121
- } else if (subFunc === "write") {
122
- mainFunc.populateTransaction = this.importGenerator(
123
- path,
124
- dependencies,
125
- exportName,
126
- "populateTransaction"
127
+ this.generateFunction = (path, dependencies, exportName = "default") => this.importGenerator(path, dependencies, exportName);
128
+ this.generateWriteFunction = (path, dependencies, exportName = "default") => this.importGenerator(
129
+ path,
130
+ dependencies,
131
+ exportName,
132
+ "write"
133
+ );
134
+ this.generateRawFunction = (path, dependencies, exportName = "default") => this.importGenerator(
135
+ path,
136
+ dependencies,
137
+ exportName,
138
+ "combine"
139
+ );
140
+ this.setProvider = async (provider) => {
141
+ this.provider = provider;
142
+ const network = (await this.provider.getNetwork()).chainId;
143
+ if (this.options && this.options.graphURI) {
144
+ this.graphURI = this.options.graphURI;
145
+ } else {
146
+ this.graphURI = graphURIEndpoints[network];
147
+ }
148
+ await this.gqlInstance.setUrl(this.graphURI);
149
+ this.contracts = new import_contracts.default(
150
+ this.provider,
151
+ this.getContractAddress(String(network))
127
152
  );
128
- }
129
- return mainFunc;
130
- };
131
- generateFunction = (path, dependencies, exportName = "default") => this.importGenerator(path, dependencies, exportName);
132
- generateWriteFunction = (path, dependencies, exportName = "default") => this.importGenerator(
133
- path,
134
- dependencies,
135
- exportName,
136
- "write"
137
- );
138
- generateRawFunction = (path, dependencies, exportName = "default") => this.importGenerator(
139
- path,
140
- dependencies,
141
- exportName,
142
- "combine"
143
- );
144
- setProvider = async (provider) => {
145
- this.provider = provider;
146
- const network = (await this.provider.getNetwork()).chainId;
147
- if (this.options && this.options.graphURI) {
148
- this.graphURI = this.options.graphURI;
149
- } else {
150
- this.graphURI = graphURIEndpoints[network];
151
- }
152
- await this.gqlInstance.setUrl(this.graphURI);
153
- this.contracts = new import_contracts.default(
154
- this.provider,
155
- this.getContractAddress(String(network))
156
- );
157
- };
158
- withProvider = (provider) => {
159
- const newENS = new ENS(this.options);
160
- newENS.initialProvider = provider;
161
- return newENS;
162
- };
163
- batch = this.generateRawFunction(
164
- "initialGetters",
165
- ["multicallWrapper"],
166
- "batch"
167
- );
168
- getProfile = this.generateFunction(
169
- "initialGetters",
170
- [
171
- "contracts",
172
- "gqlInstance",
173
- "getName",
174
- "resolverMulticallWrapper",
175
- "multicallWrapper",
176
- "_getAddr",
177
- "_getContentHash",
153
+ };
154
+ this.withProvider = (provider) => {
155
+ const newENS = new ENS(this.options);
156
+ newENS.initialProvider = provider;
157
+ return newENS;
158
+ };
159
+ this.batch = this.generateRawFunction(
160
+ "initialGetters",
161
+ ["multicallWrapper"],
162
+ "batch"
163
+ );
164
+ this.getProfile = this.generateFunction(
165
+ "initialGetters",
166
+ [
167
+ "contracts",
168
+ "gqlInstance",
169
+ "getName",
170
+ "resolverMulticallWrapper",
171
+ "multicallWrapper",
172
+ "_getAddr",
173
+ "_getContentHash",
174
+ "_getText"
175
+ ],
176
+ "getProfile"
177
+ );
178
+ this.getRecords = this.generateFunction(
179
+ "initialGetters",
180
+ ["getProfile"],
181
+ "getRecords"
182
+ );
183
+ this.getName = this.generateRawFunction(
184
+ "initialGetters",
185
+ ["contracts"],
186
+ "getName"
187
+ );
188
+ this.getResolver = this.generateRawFunction(
189
+ "getResolver",
190
+ ["contracts"]
191
+ );
192
+ this.getWrapperData = this.generateRawFunction(
193
+ "getWrapperData",
194
+ ["contracts"]
195
+ );
196
+ this.getHistory = this.generateFunction(
197
+ "getHistory",
198
+ ["gqlInstance"],
199
+ "getHistory"
200
+ );
201
+ this.getContentHash = this.generateRawFunction(
202
+ "initialGetters",
203
+ ["contracts", "universalWrapper"],
204
+ "getContentHash"
205
+ );
206
+ this._getContentHash = this.generateRawFunction(
207
+ "initialGetters",
208
+ ["contracts"],
209
+ "_getContentHash"
210
+ );
211
+ this.getAddr = this.generateRawFunction(
212
+ "initialGetters",
213
+ ["contracts", "universalWrapper"],
214
+ "getAddr"
215
+ );
216
+ this._getAddr = this.generateRawFunction(
217
+ "initialGetters",
218
+ ["contracts"],
219
+ "_getAddr"
220
+ );
221
+ this.getText = this.generateRawFunction(
222
+ "initialGetters",
223
+ ["contracts", "universalWrapper"],
224
+ "getText"
225
+ );
226
+ this._getText = this.generateRawFunction(
227
+ "initialGetters",
228
+ ["contracts"],
178
229
  "_getText"
179
- ],
180
- "getProfile"
181
- );
182
- getRecords = this.generateFunction(
183
- "initialGetters",
184
- ["getProfile"],
185
- "getRecords"
186
- );
187
- getName = this.generateRawFunction(
188
- "initialGetters",
189
- ["contracts"],
190
- "getName"
191
- );
192
- getResolver = this.generateRawFunction(
193
- "getResolver",
194
- ["contracts"]
195
- );
196
- getWrapperData = this.generateRawFunction(
197
- "getWrapperData",
198
- ["contracts"]
199
- );
200
- getHistory = this.generateFunction(
201
- "getHistory",
202
- ["gqlInstance"],
203
- "getHistory"
204
- );
205
- getContentHash = this.generateRawFunction(
206
- "initialGetters",
207
- ["contracts", "universalWrapper"],
208
- "getContentHash"
209
- );
210
- _getContentHash = this.generateRawFunction(
211
- "initialGetters",
212
- ["contracts"],
213
- "_getContentHash"
214
- );
215
- getAddr = this.generateRawFunction(
216
- "initialGetters",
217
- ["contracts", "universalWrapper"],
218
- "getAddr"
219
- );
220
- _getAddr = this.generateRawFunction(
221
- "initialGetters",
222
- ["contracts"],
223
- "_getAddr"
224
- );
225
- getText = this.generateRawFunction(
226
- "initialGetters",
227
- ["contracts", "universalWrapper"],
228
- "getText"
229
- );
230
- _getText = this.generateRawFunction(
231
- "initialGetters",
232
- ["contracts"],
233
- "_getText"
234
- );
235
- getOwner = this.generateRawFunction(
236
- "initialGetters",
237
- ["contracts", "multicallWrapper", "gqlInstance"],
238
- "getOwner"
239
- );
240
- getExpiry = this.generateRawFunction(
241
- "initialGetters",
242
- ["contracts", "multicallWrapper"],
243
- "getExpiry"
244
- );
245
- getSubnames = this.generateFunction(
246
- "initialGetters",
247
- ["gqlInstance"],
248
- "getSubnames"
249
- );
250
- getNames = this.generateFunction(
251
- "initialGetters",
252
- ["gqlInstance"],
253
- "getNames"
254
- );
255
- getPrice = this.generateRawFunction(
256
- "initialGetters",
257
- ["contracts", "multicallWrapper"],
258
- "getPrice"
259
- );
260
- getDNSOwner = this.generateFunction(
261
- "getDNSOwner",
262
- []
263
- );
264
- getAvailable = this.generateRawFunction(
265
- "getAvailable",
266
- ["contracts"]
267
- );
268
- universalWrapper = this.generateRawFunction(
269
- "initialGetters",
270
- ["contracts"],
271
- "universalWrapper"
272
- );
273
- resolverMulticallWrapper = this.generateRawFunction("initialGetters", ["contracts"], "resolverMulticallWrapper");
274
- multicallWrapper = this.generateRawFunction(
275
- "initialGetters",
276
- ["contracts"],
277
- "multicallWrapper"
278
- );
279
- setName = this.generateWriteFunction("setName", [
280
- "contracts"
281
- ]);
282
- setRecords = this.generateWriteFunction(
283
- "setRecords",
284
- ["contracts", "provider", "getResolver"]
285
- );
286
- setRecord = this.generateWriteFunction("setRecord", [
287
- "contracts",
288
- "provider",
289
- "getResolver"
290
- ]);
291
- setResolver = this.generateWriteFunction(
292
- "setResolver",
293
- ["contracts"]
294
- );
295
- transferName = this.generateWriteFunction(
296
- "transferName",
297
- ["contracts"]
298
- );
299
- transferController = this.generateWriteFunction("transferController", ["contracts"]);
300
- wrapName = this.generateWriteFunction("wrapName", [
301
- "contracts",
302
- "getExpiry"
303
- ]);
304
- unwrapName = this.generateWriteFunction(
305
- "unwrapName",
306
- ["contracts"]
307
- );
308
- burnFuses = this.generateWriteFunction("burnFuses", [
309
- "contracts"
310
- ]);
311
- importDNSSECName = this.generateWriteFunction(
312
- "importDNSSECName",
313
- ["contracts", "provider", "signer"]
314
- );
315
- createSubname = this.generateWriteFunction(
316
- "createSubname",
317
- ["contracts", "getExpiry"]
318
- );
319
- deleteSubname = this.generateWriteFunction(
320
- "deleteSubname",
321
- ["contracts"]
322
- );
323
- transferSubname = this.generateWriteFunction(
324
- "transferSubname",
325
- ["contracts", "getExpiry"]
326
- );
327
- commitName = this.generateWriteFunction(
328
- "commitName",
329
- ["contracts"]
330
- );
331
- registerName = this.generateWriteFunction(
332
- "registerName",
333
- ["contracts"]
334
- );
335
- renewNames = this.generateWriteFunction(
336
- "renewNames",
337
- ["contracts"]
338
- );
339
- renewNameWithData = this.generateWriteFunction("renewNames", ["contracts"], "renewNameWithData");
230
+ );
231
+ this.getOwner = this.generateRawFunction(
232
+ "initialGetters",
233
+ ["contracts", "multicallWrapper", "gqlInstance"],
234
+ "getOwner"
235
+ );
236
+ this.getExpiry = this.generateRawFunction(
237
+ "initialGetters",
238
+ ["contracts", "multicallWrapper"],
239
+ "getExpiry"
240
+ );
241
+ this.getSubnames = this.generateFunction(
242
+ "initialGetters",
243
+ ["gqlInstance"],
244
+ "getSubnames"
245
+ );
246
+ this.getNames = this.generateFunction(
247
+ "initialGetters",
248
+ ["gqlInstance"],
249
+ "getNames"
250
+ );
251
+ this.getPrice = this.generateRawFunction(
252
+ "initialGetters",
253
+ ["contracts", "multicallWrapper"],
254
+ "getPrice"
255
+ );
256
+ this.getDNSOwner = this.generateFunction(
257
+ "getDNSOwner",
258
+ []
259
+ );
260
+ this.supportsTLD = this.generateFunction(
261
+ "initialGetters",
262
+ ["getOwner", "provider"],
263
+ "supportsTLD"
264
+ );
265
+ this.getAvailable = this.generateRawFunction(
266
+ "getAvailable",
267
+ ["contracts"]
268
+ );
269
+ this.universalWrapper = this.generateRawFunction(
270
+ "initialGetters",
271
+ ["contracts"],
272
+ "universalWrapper"
273
+ );
274
+ this.resolverMulticallWrapper = this.generateRawFunction("initialGetters", ["contracts"], "resolverMulticallWrapper");
275
+ this.multicallWrapper = this.generateRawFunction(
276
+ "initialGetters",
277
+ ["contracts"],
278
+ "multicallWrapper"
279
+ );
280
+ this.setName = this.generateWriteFunction("setName", [
281
+ "contracts"
282
+ ]);
283
+ this.setRecords = this.generateWriteFunction(
284
+ "setRecords",
285
+ ["contracts", "provider", "getResolver"]
286
+ );
287
+ this.setRecord = this.generateWriteFunction("setRecord", [
288
+ "contracts",
289
+ "provider",
290
+ "getResolver"
291
+ ]);
292
+ this.setResolver = this.generateWriteFunction(
293
+ "setResolver",
294
+ ["contracts"]
295
+ );
296
+ this.transferName = this.generateWriteFunction(
297
+ "transferName",
298
+ ["contracts"]
299
+ );
300
+ this.transferController = this.generateWriteFunction("transferController", ["contracts"]);
301
+ this.wrapName = this.generateWriteFunction("wrapName", [
302
+ "contracts",
303
+ "getExpiry"
304
+ ]);
305
+ this.unwrapName = this.generateWriteFunction(
306
+ "unwrapName",
307
+ ["contracts"]
308
+ );
309
+ this.burnFuses = this.generateWriteFunction("burnFuses", [
310
+ "contracts"
311
+ ]);
312
+ this.importDNSSECName = this.generateWriteFunction(
313
+ "importDNSSECName",
314
+ ["contracts", "provider", "signer"]
315
+ );
316
+ this.createSubname = this.generateWriteFunction(
317
+ "createSubname",
318
+ ["contracts", "getExpiry"]
319
+ );
320
+ this.deleteSubname = this.generateWriteFunction(
321
+ "deleteSubname",
322
+ ["contracts"]
323
+ );
324
+ this.transferSubname = this.generateWriteFunction(
325
+ "transferSubname",
326
+ ["contracts", "getExpiry"]
327
+ );
328
+ this.commitName = this.generateWriteFunction(
329
+ "commitName",
330
+ ["contracts"]
331
+ );
332
+ this.registerName = this.generateWriteFunction(
333
+ "registerName",
334
+ ["contracts"]
335
+ );
336
+ this.renewNames = this.generateWriteFunction(
337
+ "renewNames",
338
+ ["contracts"]
339
+ );
340
+ this.renewNameWithData = this.generateWriteFunction("renewNames", ["contracts"], "renewNameWithData");
341
+ this.options = options;
342
+ this.getContractAddress = (options == null ? void 0 : options.getContractAddress) || import_getContractAddress.getContractAddress;
343
+ }
340
344
  }
@@ -109,7 +109,7 @@ function parseName(name) {
109
109
  return nameArray.map((label) => encodeLabel(label)).join(".");
110
110
  }
111
111
  function checkIsDecrypted(string) {
112
- return !string?.includes("[");
112
+ return !(string == null ? void 0 : string.includes("["));
113
113
  }
114
114
  function decryptName(name) {
115
115
  return name.split(".").map((label) => checkLabel(label) || label).join(".");
@@ -34,7 +34,7 @@ const generateSetAddr = (namehash, coinType, address, resolver) => {
34
34
  }
35
35
  const inputCoinType = coinTypeInstance.coinType;
36
36
  const encodedAddress = coinTypeInstance.decoder(address);
37
- return resolver?.interface.encodeFunctionData(
37
+ return resolver == null ? void 0 : resolver.interface.encodeFunctionData(
38
38
  "setAddr(bytes32,uint256,bytes)",
39
39
  [namehash, inputCoinType, encodedAddress]
40
40
  );
@@ -53,6 +53,7 @@ const makeCommitmentData = ({
53
53
  wrapperExpiry,
54
54
  secret
55
55
  }) => {
56
+ var _a;
56
57
  const label = (0, import_labels.labelhash)(name.split(".")[0]);
57
58
  const hash = (0, import_normalise.namehash)(name);
58
59
  const resolverAddress = resolver.address;
@@ -60,7 +61,7 @@ const makeCommitmentData = ({
60
61
  if (reverseRecord) {
61
62
  if (!records) {
62
63
  records = { coinTypes: [{ key: "ETH", value: owner }] };
63
- } else if (!records.coinTypes?.find((c) => c.key === "ETH")) {
64
+ } else if (!((_a = records.coinTypes) == null ? void 0 : _a.find((c) => c.key === "ETH"))) {
64
65
  if (!records.coinTypes)
65
66
  records.coinTypes = [];
66
67
  records.coinTypes.push({ key: "ETH", value: owner });
@@ -38,7 +38,7 @@ const makeExpiry = async ({ getExpiry }, name, expiry) => {
38
38
  }
39
39
  if (name.endsWith(".eth")) {
40
40
  const expResponse = await getExpiry(name);
41
- if (!expResponse?.expiry)
41
+ if (!(expResponse == null ? void 0 : expResponse.expiry))
42
42
  throw new Error("Couldn't get expiry for name, please provide one.");
43
43
  return import_ethers.BigNumber.from(expResponse.expiry.getTime() / 1e3);
44
44
  }
@@ -41,7 +41,7 @@ var addresses = {
41
41
  "5": "0xD5610A08E370051a01fdfe4bB3ddf5270af1aA48"
42
42
  },
43
43
  UniversalResolver: {
44
- "1": "0x580AF46E06DaaD47eb5940526FD64d95b815Cb70",
44
+ "1": "0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376",
45
45
  "3": "0x74e20bd2a1fe0cdbe45b9a1d89cb7e0a45b36376",
46
46
  "4": "0x74e20bd2a1fe0cdbe45b9a1d89cb7e0a45b36376",
47
47
  "5": "0x687c30Cc44bFA39A1449e86E172BF002E7b3f0b0"