@ensdomains/ensjs 3.0.0-alpha.37 → 3.0.0-alpha.39

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 (62) 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/setName.js +3 -2
  22. package/dist/cjs/functions/setRecord.js +2 -1
  23. package/dist/cjs/functions/setRecords.js +2 -1
  24. package/dist/cjs/functions/setResolver.js +2 -2
  25. package/dist/cjs/functions/supportsTLD.js +1 -1
  26. package/dist/cjs/functions/transferController.js +2 -2
  27. package/dist/cjs/functions/transferName.js +3 -3
  28. package/dist/cjs/functions/wrapName.js +3 -3
  29. package/dist/cjs/generated/factories/BaseRegistrarImplementation__factory.js +1 -1
  30. package/dist/cjs/generated/factories/BulkRenewal__factory.js +1 -1
  31. package/dist/cjs/generated/factories/DNSRegistrar__factory.js +1 -1
  32. package/dist/cjs/generated/factories/DNSSECImpl__factory.js +1 -1
  33. package/dist/cjs/generated/factories/DefaultReverseResolver__factory.js +1 -1
  34. package/dist/cjs/generated/factories/ENSRegistry__factory.js +1 -1
  35. package/dist/cjs/generated/factories/ETHRegistrarController__factory.js +1 -1
  36. package/dist/cjs/generated/factories/Multicall__factory.js +1 -1
  37. package/dist/cjs/generated/factories/NameWrapper__factory.js +1 -1
  38. package/dist/cjs/generated/factories/P256SHA256Algorithm__factory.js +1 -1
  39. package/dist/cjs/generated/factories/PublicResolver__factory.js +1 -1
  40. package/dist/cjs/generated/factories/RSASHA1Algorithm__factory.js +1 -1
  41. package/dist/cjs/generated/factories/RSASHA256Algorithm__factory.js +1 -1
  42. package/dist/cjs/generated/factories/ReverseRegistrar__factory.js +1 -1
  43. package/dist/cjs/generated/factories/Root__factory.js +1 -1
  44. package/dist/cjs/generated/factories/SHA1Digest__factory.js +1 -1
  45. package/dist/cjs/generated/factories/SHA1NSEC3Digest__factory.js +1 -1
  46. package/dist/cjs/generated/factories/SHA256Digest__factory.js +1 -1
  47. package/dist/cjs/generated/factories/StaticMetadataService__factory.js +1 -1
  48. package/dist/cjs/generated/factories/TLDPublicSuffixList__factory.js +1 -1
  49. package/dist/cjs/generated/factories/UniversalResolver__factory.js +1 -1
  50. package/dist/cjs/index.js +295 -296
  51. package/dist/cjs/utils/contentHash.js +3 -3
  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/index.mjs +4 -1
  58. package/dist/esm/utils/contentHash.mjs +3 -3
  59. package/package.json +1 -1
  60. package/src/contracts/getContractAddress.ts +1 -1
  61. package/src/index.ts +6 -2
  62. package/src/utils/contentHash.ts +3 -3
package/dist/cjs/index.js CHANGED
@@ -39,307 +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
- supportsTLD = this.generateFunction(
265
- "initialGetters",
266
- ["getOwner", "provider"],
267
- "supportsTLD"
268
- );
269
- getAvailable = this.generateRawFunction(
270
- "getAvailable",
271
- ["contracts"]
272
- );
273
- universalWrapper = this.generateRawFunction(
274
- "initialGetters",
275
- ["contracts"],
276
- "universalWrapper"
277
- );
278
- resolverMulticallWrapper = this.generateRawFunction("initialGetters", ["contracts"], "resolverMulticallWrapper");
279
- multicallWrapper = this.generateRawFunction(
280
- "initialGetters",
281
- ["contracts"],
282
- "multicallWrapper"
283
- );
284
- setName = this.generateWriteFunction("setName", [
285
- "contracts"
286
- ]);
287
- setRecords = this.generateWriteFunction(
288
- "setRecords",
289
- ["contracts", "provider", "getResolver"]
290
- );
291
- setRecord = this.generateWriteFunction("setRecord", [
292
- "contracts",
293
- "provider",
294
- "getResolver"
295
- ]);
296
- setResolver = this.generateWriteFunction(
297
- "setResolver",
298
- ["contracts"]
299
- );
300
- transferName = this.generateWriteFunction(
301
- "transferName",
302
- ["contracts"]
303
- );
304
- transferController = this.generateWriteFunction("transferController", ["contracts"]);
305
- wrapName = this.generateWriteFunction("wrapName", [
306
- "contracts",
307
- "getExpiry"
308
- ]);
309
- unwrapName = this.generateWriteFunction(
310
- "unwrapName",
311
- ["contracts"]
312
- );
313
- burnFuses = this.generateWriteFunction("burnFuses", [
314
- "contracts"
315
- ]);
316
- importDNSSECName = this.generateWriteFunction(
317
- "importDNSSECName",
318
- ["contracts", "provider", "signer"]
319
- );
320
- createSubname = this.generateWriteFunction(
321
- "createSubname",
322
- ["contracts", "getExpiry"]
323
- );
324
- deleteSubname = this.generateWriteFunction(
325
- "deleteSubname",
326
- ["contracts"]
327
- );
328
- transferSubname = this.generateWriteFunction(
329
- "transferSubname",
330
- ["contracts", "getExpiry"]
331
- );
332
- commitName = this.generateWriteFunction(
333
- "commitName",
334
- ["contracts"]
335
- );
336
- registerName = this.generateWriteFunction(
337
- "registerName",
338
- ["contracts"]
339
- );
340
- renewNames = this.generateWriteFunction(
341
- "renewNames",
342
- ["contracts"]
343
- );
344
- 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
+ }
345
344
  }
@@ -43,7 +43,7 @@ const supportedCodecs = [
43
43
  "arweave-ns"
44
44
  ];
45
45
  function matchProtocol(text) {
46
- return text.match(/^(ipfs|sia|ipns|bzz|onion|onion3|arweave):\/\/(.*)/) || text.match(/\/(ipfs)\/(.*)/) || text.match(/\/(ipns)\/(.*)/);
46
+ return text.match(/^(ipfs|sia|ipns|bzz|onion|onion3|arweave|ar):\/\/(.*)/) || text.match(/\/(ipfs)\/(.*)/) || text.match(/\/(ipns)\/(.*)/);
47
47
  }
48
48
  function decodeContenthash(encoded) {
49
49
  let decoded;
@@ -75,7 +75,7 @@ function decodeContenthash(encoded) {
75
75
  } else if (codec === "skynet-ns") {
76
76
  protocolType = "sia";
77
77
  } else if (codec === "arweave-ns") {
78
- protocolType = "arweave";
78
+ protocolType = "ar";
79
79
  } else {
80
80
  decoded = encoded;
81
81
  }
@@ -147,7 +147,7 @@ function encodeContenthash(text) {
147
147
  if (content.length === 46) {
148
148
  encoded = `0x${import_content_hash.default.encode("skynet-ns", content)}`;
149
149
  }
150
- } else if (contentType === "arweave") {
150
+ } else if (contentType === "arweave" || contentType === "ar") {
151
151
  if (content.length === 43) {
152
152
  encoded = `0x${import_content_hash.default.encode("arweave-ns", content)}`;
153
153
  }
@@ -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
  );