@ensdomains/ensjs 3.0.0-alpha.25 → 3.0.0-alpha.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/contracts/getContractAddress.js +4 -4
- package/dist/cjs/functions/batchWrappers.js +41 -8
- package/dist/cjs/functions/deleteSubname.js +2 -5
- package/dist/cjs/functions/getName.js +2 -2
- package/dist/cjs/functions/getOwner.js +4 -4
- package/dist/cjs/functions/getProfile.js +117 -87
- package/dist/cjs/generated/factories/NameWrapper__factory.js +13 -0
- package/dist/cjs/generated/factories/UniversalResolver__factory.js +277 -0
- package/dist/cjs/utils/ccip.js +128 -0
- package/dist/cjs/utils/singleCall.js +1 -1
- package/dist/esm/contracts/getContractAddress.mjs +4 -4
- package/dist/esm/functions/batchWrappers.mjs +35 -8
- package/dist/esm/functions/deleteSubname.mjs +2 -5
- package/dist/esm/functions/getName.mjs +2 -2
- package/dist/esm/functions/getOwner.mjs +4 -4
- package/dist/esm/functions/getProfile.mjs +117 -87
- package/dist/esm/generated/factories/NameWrapper__factory.mjs +13 -0
- package/dist/esm/generated/factories/UniversalResolver__factory.mjs +277 -0
- package/dist/esm/utils/ccip.mjs +114 -0
- package/dist/esm/utils/singleCall.mjs +1 -1
- package/dist/types/functions/batchWrappers.d.ts +58 -1
- package/dist/types/functions/getProfile.d.ts +6 -0
- package/dist/types/generated/NameWrapper.d.ts +9 -1
- package/dist/types/generated/UniversalResolver.d.ts +123 -21
- package/dist/types/index.d.ts +64 -2
- package/dist/types/utils/ccip.d.ts +3 -0
- package/package.json +3 -3
- package/src/contracts/getContractAddress.ts +4 -4
- package/src/functions/batchWrappers.ts +40 -9
- package/src/functions/deleteSubname.test.ts +21 -1
- package/src/functions/deleteSubname.ts +2 -6
- package/src/functions/getName.ts +2 -2
- package/src/functions/getOwner.ts +4 -2
- package/src/functions/getProfile-ccip.test.ts +29 -0
- package/src/functions/getProfile.test.ts +1 -1
- package/src/functions/getProfile.ts +160 -100
- package/src/functions/setName.test.ts +6 -2
- package/src/functions/setRecord.test.ts +3 -3
- package/src/functions/setRecords.test.ts +2 -2
- package/src/generated/NameWrapper.ts +14 -0
- package/src/generated/UniversalResolver.ts +382 -19
- package/src/generated/factories/NameWrapper__factory.ts +13 -0
- package/src/generated/factories/UniversalResolver__factory.ts +277 -0
- package/src/index.ts +1 -1
- package/src/utils/ccip.ts +148 -0
- package/src/utils/singleCall.ts +1 -1
|
@@ -29,6 +29,11 @@ const _abi = [
|
|
|
29
29
|
internalType: "address",
|
|
30
30
|
name: "_registry",
|
|
31
31
|
type: "address"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
internalType: "string[]",
|
|
35
|
+
name: "_urls",
|
|
36
|
+
type: "string[]"
|
|
32
37
|
}
|
|
33
38
|
],
|
|
34
39
|
stateMutability: "nonpayable",
|
|
@@ -65,6 +70,69 @@ const _abi = [
|
|
|
65
70
|
name: "OffchainLookup",
|
|
66
71
|
type: "error"
|
|
67
72
|
},
|
|
73
|
+
{
|
|
74
|
+
inputs: [
|
|
75
|
+
{
|
|
76
|
+
internalType: "bytes",
|
|
77
|
+
name: "name",
|
|
78
|
+
type: "bytes"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
internalType: "bytes",
|
|
82
|
+
name: "data",
|
|
83
|
+
type: "bytes"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
internalType: "string[]",
|
|
87
|
+
name: "gateways",
|
|
88
|
+
type: "string[]"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
internalType: "bytes4",
|
|
92
|
+
name: "callbackFunction",
|
|
93
|
+
type: "bytes4"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
internalType: "bytes",
|
|
97
|
+
name: "metaData",
|
|
98
|
+
type: "bytes"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
name: "_resolveSingle",
|
|
102
|
+
outputs: [
|
|
103
|
+
{
|
|
104
|
+
internalType: "bytes",
|
|
105
|
+
name: "",
|
|
106
|
+
type: "bytes"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
internalType: "address",
|
|
110
|
+
name: "",
|
|
111
|
+
type: "address"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
stateMutability: "view",
|
|
115
|
+
type: "function"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
inputs: [
|
|
119
|
+
{
|
|
120
|
+
internalType: "uint256",
|
|
121
|
+
name: "",
|
|
122
|
+
type: "uint256"
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
name: "batchGatewayURLs",
|
|
126
|
+
outputs: [
|
|
127
|
+
{
|
|
128
|
+
internalType: "string",
|
|
129
|
+
name: "",
|
|
130
|
+
type: "string"
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
stateMutability: "view",
|
|
134
|
+
type: "function"
|
|
135
|
+
},
|
|
68
136
|
{
|
|
69
137
|
inputs: [
|
|
70
138
|
{
|
|
@@ -102,6 +170,103 @@ const _abi = [
|
|
|
102
170
|
stateMutability: "view",
|
|
103
171
|
type: "function"
|
|
104
172
|
},
|
|
173
|
+
{
|
|
174
|
+
inputs: [
|
|
175
|
+
{
|
|
176
|
+
internalType: "bytes",
|
|
177
|
+
name: "name",
|
|
178
|
+
type: "bytes"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
internalType: "bytes",
|
|
182
|
+
name: "data",
|
|
183
|
+
type: "bytes"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
internalType: "string[]",
|
|
187
|
+
name: "gateways",
|
|
188
|
+
type: "string[]"
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
name: "resolve",
|
|
192
|
+
outputs: [
|
|
193
|
+
{
|
|
194
|
+
internalType: "bytes",
|
|
195
|
+
name: "",
|
|
196
|
+
type: "bytes"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
internalType: "address",
|
|
200
|
+
name: "",
|
|
201
|
+
type: "address"
|
|
202
|
+
}
|
|
203
|
+
],
|
|
204
|
+
stateMutability: "view",
|
|
205
|
+
type: "function"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
inputs: [
|
|
209
|
+
{
|
|
210
|
+
internalType: "bytes",
|
|
211
|
+
name: "name",
|
|
212
|
+
type: "bytes"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
internalType: "bytes[]",
|
|
216
|
+
name: "data",
|
|
217
|
+
type: "bytes[]"
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
name: "resolve",
|
|
221
|
+
outputs: [
|
|
222
|
+
{
|
|
223
|
+
internalType: "bytes[]",
|
|
224
|
+
name: "",
|
|
225
|
+
type: "bytes[]"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
internalType: "address",
|
|
229
|
+
name: "",
|
|
230
|
+
type: "address"
|
|
231
|
+
}
|
|
232
|
+
],
|
|
233
|
+
stateMutability: "view",
|
|
234
|
+
type: "function"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
inputs: [
|
|
238
|
+
{
|
|
239
|
+
internalType: "bytes",
|
|
240
|
+
name: "name",
|
|
241
|
+
type: "bytes"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
internalType: "bytes[]",
|
|
245
|
+
name: "data",
|
|
246
|
+
type: "bytes[]"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
internalType: "string[]",
|
|
250
|
+
name: "gateways",
|
|
251
|
+
type: "string[]"
|
|
252
|
+
}
|
|
253
|
+
],
|
|
254
|
+
name: "resolve",
|
|
255
|
+
outputs: [
|
|
256
|
+
{
|
|
257
|
+
internalType: "bytes[]",
|
|
258
|
+
name: "",
|
|
259
|
+
type: "bytes[]"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
internalType: "address",
|
|
263
|
+
name: "",
|
|
264
|
+
type: "address"
|
|
265
|
+
}
|
|
266
|
+
],
|
|
267
|
+
stateMutability: "view",
|
|
268
|
+
type: "function"
|
|
269
|
+
},
|
|
105
270
|
{
|
|
106
271
|
inputs: [
|
|
107
272
|
{
|
|
@@ -145,11 +310,84 @@ const _abi = [
|
|
|
145
310
|
}
|
|
146
311
|
],
|
|
147
312
|
name: "resolveCallback",
|
|
313
|
+
outputs: [
|
|
314
|
+
{
|
|
315
|
+
internalType: "bytes[]",
|
|
316
|
+
name: "",
|
|
317
|
+
type: "bytes[]"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
internalType: "address",
|
|
321
|
+
name: "",
|
|
322
|
+
type: "address"
|
|
323
|
+
}
|
|
324
|
+
],
|
|
325
|
+
stateMutability: "nonpayable",
|
|
326
|
+
type: "function"
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
inputs: [
|
|
330
|
+
{
|
|
331
|
+
internalType: "bytes",
|
|
332
|
+
name: "response",
|
|
333
|
+
type: "bytes"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
internalType: "bytes",
|
|
337
|
+
name: "extraData",
|
|
338
|
+
type: "bytes"
|
|
339
|
+
}
|
|
340
|
+
],
|
|
341
|
+
name: "resolveSingleCallback",
|
|
148
342
|
outputs: [
|
|
149
343
|
{
|
|
150
344
|
internalType: "bytes",
|
|
151
345
|
name: "",
|
|
152
346
|
type: "bytes"
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
internalType: "address",
|
|
350
|
+
name: "",
|
|
351
|
+
type: "address"
|
|
352
|
+
}
|
|
353
|
+
],
|
|
354
|
+
stateMutability: "nonpayable",
|
|
355
|
+
type: "function"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
inputs: [
|
|
359
|
+
{
|
|
360
|
+
internalType: "bytes",
|
|
361
|
+
name: "reverseName",
|
|
362
|
+
type: "bytes"
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
internalType: "string[]",
|
|
366
|
+
name: "gateways",
|
|
367
|
+
type: "string[]"
|
|
368
|
+
}
|
|
369
|
+
],
|
|
370
|
+
name: "reverse",
|
|
371
|
+
outputs: [
|
|
372
|
+
{
|
|
373
|
+
internalType: "string",
|
|
374
|
+
name: "",
|
|
375
|
+
type: "string"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
internalType: "address",
|
|
379
|
+
name: "",
|
|
380
|
+
type: "address"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
internalType: "address",
|
|
384
|
+
name: "",
|
|
385
|
+
type: "address"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
internalType: "address",
|
|
389
|
+
name: "",
|
|
390
|
+
type: "address"
|
|
153
391
|
}
|
|
154
392
|
],
|
|
155
393
|
stateMutability: "view",
|
|
@@ -189,6 +427,45 @@ const _abi = [
|
|
|
189
427
|
stateMutability: "view",
|
|
190
428
|
type: "function"
|
|
191
429
|
},
|
|
430
|
+
{
|
|
431
|
+
inputs: [
|
|
432
|
+
{
|
|
433
|
+
internalType: "bytes",
|
|
434
|
+
name: "response",
|
|
435
|
+
type: "bytes"
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
internalType: "bytes",
|
|
439
|
+
name: "extraData",
|
|
440
|
+
type: "bytes"
|
|
441
|
+
}
|
|
442
|
+
],
|
|
443
|
+
name: "reverseCallback",
|
|
444
|
+
outputs: [
|
|
445
|
+
{
|
|
446
|
+
internalType: "string",
|
|
447
|
+
name: "",
|
|
448
|
+
type: "string"
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
internalType: "address",
|
|
452
|
+
name: "",
|
|
453
|
+
type: "address"
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
internalType: "address",
|
|
457
|
+
name: "",
|
|
458
|
+
type: "address"
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
internalType: "address",
|
|
462
|
+
name: "",
|
|
463
|
+
type: "address"
|
|
464
|
+
}
|
|
465
|
+
],
|
|
466
|
+
stateMutability: "nonpayable",
|
|
467
|
+
type: "function"
|
|
468
|
+
},
|
|
192
469
|
{
|
|
193
470
|
inputs: [
|
|
194
471
|
{
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var ccip_exports = {};
|
|
20
|
+
__export(ccip_exports, {
|
|
21
|
+
default: () => ccip_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(ccip_exports);
|
|
24
|
+
var import_ethers = require("ethers");
|
|
25
|
+
var import_utils = require("ethers/lib/utils");
|
|
26
|
+
function bytesPad(value) {
|
|
27
|
+
if (value.length % 32 === 0) {
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
const result = new Uint8Array(Math.ceil(value.length / 32) * 32);
|
|
31
|
+
result.set(value);
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
function numPad(value) {
|
|
35
|
+
const result = (0, import_utils.arrayify)(value);
|
|
36
|
+
if (result.length > 32) {
|
|
37
|
+
throw new Error("internal; should not happen");
|
|
38
|
+
}
|
|
39
|
+
const padded = new Uint8Array(32);
|
|
40
|
+
padded.set(result, 32 - result.length);
|
|
41
|
+
return padded;
|
|
42
|
+
}
|
|
43
|
+
function encodeBytes(datas) {
|
|
44
|
+
const result = [];
|
|
45
|
+
let byteCount = 0;
|
|
46
|
+
for (let i = 0; i < datas.length; i += 1) {
|
|
47
|
+
result.push(new Uint8Array(0));
|
|
48
|
+
byteCount += 32;
|
|
49
|
+
}
|
|
50
|
+
for (let i = 0; i < datas.length; i += 1) {
|
|
51
|
+
const data = (0, import_utils.arrayify)(datas[i]);
|
|
52
|
+
result[i] = numPad(byteCount);
|
|
53
|
+
result.push(numPad(data.length));
|
|
54
|
+
result.push(bytesPad(data));
|
|
55
|
+
byteCount += 32 + Math.ceil(data.length / 32) * 32;
|
|
56
|
+
}
|
|
57
|
+
return (0, import_utils.hexConcat)(result);
|
|
58
|
+
}
|
|
59
|
+
function _parseBytes(result, start) {
|
|
60
|
+
if (result === "0x") {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const offset = import_ethers.BigNumber.from(
|
|
64
|
+
(0, import_utils.hexDataSlice)(result, start, start + 32)
|
|
65
|
+
).toNumber();
|
|
66
|
+
const length = import_ethers.BigNumber.from(
|
|
67
|
+
(0, import_utils.hexDataSlice)(result, offset, offset + 32)
|
|
68
|
+
).toNumber();
|
|
69
|
+
return (0, import_utils.hexDataSlice)(result, offset + 32, offset + 32 + length);
|
|
70
|
+
}
|
|
71
|
+
function _parseString(result, start) {
|
|
72
|
+
try {
|
|
73
|
+
const bytes = _parseBytes(result, start);
|
|
74
|
+
if (bytes == null)
|
|
75
|
+
return null;
|
|
76
|
+
return (0, import_utils.toUtf8String)(bytes);
|
|
77
|
+
} catch (error) {
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
const ccipLookup = async (provider, transaction, result) => {
|
|
82
|
+
const txSender = transaction.to;
|
|
83
|
+
try {
|
|
84
|
+
const data = (0, import_utils.hexDataSlice)(result, 4);
|
|
85
|
+
const sender = (0, import_utils.hexDataSlice)(data, 0, 32);
|
|
86
|
+
if (!import_ethers.BigNumber.from(sender).eq(txSender)) {
|
|
87
|
+
throw new Error("CCIP Read sender did not match");
|
|
88
|
+
}
|
|
89
|
+
const urls = [];
|
|
90
|
+
const urlsOffset = import_ethers.BigNumber.from((0, import_utils.hexDataSlice)(data, 32, 64)).toNumber();
|
|
91
|
+
const urlsLength = import_ethers.BigNumber.from(
|
|
92
|
+
(0, import_utils.hexDataSlice)(data, urlsOffset, urlsOffset + 32)
|
|
93
|
+
).toNumber();
|
|
94
|
+
const urlsData = (0, import_utils.hexDataSlice)(data, urlsOffset + 32);
|
|
95
|
+
for (let u = 0; u < urlsLength; u += 1) {
|
|
96
|
+
const url = _parseString(urlsData, u * 32);
|
|
97
|
+
if (url == null) {
|
|
98
|
+
throw new Error("CCIP Read contained corrupt URL string");
|
|
99
|
+
}
|
|
100
|
+
urls.push(url);
|
|
101
|
+
}
|
|
102
|
+
const calldata = _parseBytes(data, 64);
|
|
103
|
+
if (!import_ethers.BigNumber.from((0, import_utils.hexDataSlice)(data, 100, 128)).isZero()) {
|
|
104
|
+
throw new Error("CCIP Read callback selected included junk");
|
|
105
|
+
}
|
|
106
|
+
const callbackSelector = (0, import_utils.hexDataSlice)(data, 96, 100);
|
|
107
|
+
const extraData = _parseBytes(data, 128);
|
|
108
|
+
const ccipResult = await provider.ccipReadFetch(
|
|
109
|
+
transaction,
|
|
110
|
+
calldata,
|
|
111
|
+
urls
|
|
112
|
+
);
|
|
113
|
+
if (ccipResult == null) {
|
|
114
|
+
throw new Error("CCIP Read disabled or provided no URLs");
|
|
115
|
+
}
|
|
116
|
+
const tx = {
|
|
117
|
+
to: sender,
|
|
118
|
+
data: (0, import_utils.hexConcat)([
|
|
119
|
+
callbackSelector,
|
|
120
|
+
encodeBytes([ccipResult, extraData])
|
|
121
|
+
])
|
|
122
|
+
};
|
|
123
|
+
return await provider._call(tx, "latest", 1);
|
|
124
|
+
} catch (error) {
|
|
125
|
+
console.error(error);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
var ccip_default = ccipLookup;
|
|
@@ -21,4 +21,4 @@ __export(singleCall_exports, {
|
|
|
21
21
|
default: () => singleCall_default
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(singleCall_exports);
|
|
24
|
-
var singleCall_default = async (provider, ensData, func, ...data) => func.raw(ensData, ...data).then((rawData) => provider.call(rawData)).catch(() => null).then((ret) => func.decode(ensData, ret, ...data));
|
|
24
|
+
var singleCall_default = async (provider, ensData, func, ...data) => func.raw(ensData, ...data).then((rawData) => provider.call({ ...rawData, ccipReadEnabled: true })).catch(() => null).then((ret) => func.decode(ensData, ret, ...data));
|
|
@@ -15,19 +15,19 @@ var addresses = {
|
|
|
15
15
|
"1": "0x283af0b28c62c092c9727f1ee09c02ca627eb7f5",
|
|
16
16
|
"3": "0xa5627AB7Ae47063B533622C34FEBDb52d3281dF8",
|
|
17
17
|
"4": "0x283af0b28c62c092c9727f1ee09c02ca627eb7f5",
|
|
18
|
-
"5": "
|
|
18
|
+
"5": "0x9C51161bA2FB02Cc0a403332B607117685f34831"
|
|
19
19
|
},
|
|
20
20
|
Multicall: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
21
21
|
NameWrapper: {
|
|
22
22
|
"1": "0x0000000000000000000000000000000000000000",
|
|
23
23
|
"3": "0xF82155e2a43Be0871821E9654Fc8Ae894FB8307C",
|
|
24
24
|
"4": "0x0000000000000000000000000000000000000000",
|
|
25
|
-
"5": "
|
|
25
|
+
"5": "0x582224b8d4534F4749EFA4f22eF7241E0C56D4B8"
|
|
26
26
|
},
|
|
27
27
|
PublicResolver: {
|
|
28
28
|
"1": "0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41",
|
|
29
29
|
"3": "0x13F0659Ee6bb7484C884FEeFb7F75C93951ef837",
|
|
30
|
-
"5": "
|
|
30
|
+
"5": "0xE264d5bb84bA3b8061ADC38D3D76e6674aB91852"
|
|
31
31
|
},
|
|
32
32
|
ENSRegistryWithFallback: {
|
|
33
33
|
"1": "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e",
|
|
@@ -44,7 +44,7 @@ var addresses = {
|
|
|
44
44
|
"1": "0x580AF46E06DaaD47eb5940526FD64d95b815Cb70",
|
|
45
45
|
"3": "0x74e20bd2a1fe0cdbe45b9a1d89cb7e0a45b36376",
|
|
46
46
|
"4": "0x74e20bd2a1fe0cdbe45b9a1d89cb7e0a45b36376",
|
|
47
|
-
"5": "
|
|
47
|
+
"5": "0x687c30Cc44bFA39A1449e86E172BF002E7b3f0b0"
|
|
48
48
|
},
|
|
49
49
|
BulkRenewal: {
|
|
50
50
|
"1": "0xfF252725f6122A92551A5FA9a6b6bf10eb0Be035",
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
// src/functions/batchWrappers.ts
|
|
2
|
+
import ccipLookup from "../utils/ccip.mjs";
|
|
2
3
|
import { hexEncodeName } from "../utils/hexEncodedName.mjs";
|
|
3
4
|
var universalWrapper = {
|
|
4
5
|
raw: async ({ contracts }, name, data) => {
|
|
5
6
|
const universalResolver = await contracts?.getUniversalResolver();
|
|
6
7
|
return {
|
|
7
8
|
to: universalResolver.address,
|
|
8
|
-
data: universalResolver.interface.encodeFunctionData(
|
|
9
|
-
|
|
10
|
-
data
|
|
11
|
-
|
|
9
|
+
data: universalResolver.interface.encodeFunctionData(
|
|
10
|
+
"resolve(bytes,bytes)",
|
|
11
|
+
[hexEncodeName(name), data]
|
|
12
|
+
)
|
|
12
13
|
};
|
|
13
14
|
},
|
|
14
15
|
decode: async ({ contracts }, data) => {
|
|
15
16
|
const universalResolver = await contracts?.getUniversalResolver();
|
|
16
17
|
const response = universalResolver.interface.decodeFunctionResult(
|
|
17
|
-
"resolve",
|
|
18
|
+
"resolve(bytes,bytes)",
|
|
18
19
|
data
|
|
19
20
|
);
|
|
20
21
|
if (!response || !response[0]) {
|
|
@@ -60,7 +61,7 @@ var multicallWrapper = {
|
|
|
60
61
|
])
|
|
61
62
|
};
|
|
62
63
|
},
|
|
63
|
-
async decode({ contracts }, data) {
|
|
64
|
+
async decode({ contracts, provider }, data, transactions) {
|
|
64
65
|
if (!data)
|
|
65
66
|
return;
|
|
66
67
|
const multicall = await contracts?.getMulticall();
|
|
@@ -69,9 +70,35 @@ var multicallWrapper = {
|
|
|
69
70
|
"tryAggregate",
|
|
70
71
|
data
|
|
71
72
|
);
|
|
72
|
-
|
|
73
|
+
const ccipChecked = await Promise.all(
|
|
74
|
+
result.map(
|
|
75
|
+
async ([success, returnData], i) => {
|
|
76
|
+
let newArr = [success, returnData];
|
|
77
|
+
if (!success && returnData.startsWith("0x556f1830")) {
|
|
78
|
+
try {
|
|
79
|
+
const newData = await ccipLookup(
|
|
80
|
+
provider,
|
|
81
|
+
transactions[i],
|
|
82
|
+
returnData
|
|
83
|
+
);
|
|
84
|
+
if (newData) {
|
|
85
|
+
newArr = [true, newData];
|
|
86
|
+
}
|
|
87
|
+
} catch {
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
...newArr,
|
|
92
|
+
success: newArr[0],
|
|
93
|
+
returnData: newArr[1]
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
);
|
|
98
|
+
return ccipChecked;
|
|
73
99
|
} catch (e) {
|
|
74
|
-
|
|
100
|
+
console.error(e);
|
|
101
|
+
return;
|
|
75
102
|
}
|
|
76
103
|
}
|
|
77
104
|
};
|
|
@@ -3,11 +3,8 @@ import { ethers } from "ethers";
|
|
|
3
3
|
import { namehash } from "../utils/normalise.mjs";
|
|
4
4
|
async function deleteSubname_default({ contracts, signer }, name, { contract }) {
|
|
5
5
|
const labels = name.split(".");
|
|
6
|
-
if (labels.length
|
|
7
|
-
throw new Error(
|
|
8
|
-
}
|
|
9
|
-
if (labels[2] !== "eth") {
|
|
10
|
-
throw new Error("ENS.js currently only supports deleting .eth 2LDs");
|
|
6
|
+
if (labels.length < 3) {
|
|
7
|
+
throw new Error(`${name} is not a valid subname`);
|
|
11
8
|
}
|
|
12
9
|
const label = labels.shift();
|
|
13
10
|
const labelhash = ethers.utils.solidityKeccak256(["string"], [label]);
|
|
@@ -5,7 +5,7 @@ var raw = async ({ contracts }, address) => {
|
|
|
5
5
|
const reverseNode = `${address.toLowerCase().substring(2)}.addr.reverse`;
|
|
6
6
|
return {
|
|
7
7
|
to: universalResolver.address,
|
|
8
|
-
data: universalResolver.interface.encodeFunctionData("reverse", [
|
|
8
|
+
data: universalResolver.interface.encodeFunctionData("reverse(bytes)", [
|
|
9
9
|
hexEncodeName(reverseNode)
|
|
10
10
|
])
|
|
11
11
|
};
|
|
@@ -16,7 +16,7 @@ var decode = async ({ contracts }, data, address) => {
|
|
|
16
16
|
const universalResolver = await contracts?.getUniversalResolver();
|
|
17
17
|
try {
|
|
18
18
|
const result = universalResolver.interface.decodeFunctionResult(
|
|
19
|
-
"reverse",
|
|
19
|
+
"reverse(bytes)",
|
|
20
20
|
data
|
|
21
21
|
);
|
|
22
22
|
return {
|
|
@@ -66,7 +66,7 @@ var raw = async ({ contracts, multicallWrapper }, name, contract) => {
|
|
|
66
66
|
};
|
|
67
67
|
var singleContractOwnerDecode = (data) => ethers.utils.defaultAbiCoder.decode(["address"], data)[0];
|
|
68
68
|
var decode = async ({ contracts, multicallWrapper }, data, name, contract) => {
|
|
69
|
-
if (data
|
|
69
|
+
if (!data)
|
|
70
70
|
return;
|
|
71
71
|
const labels = name.split(".");
|
|
72
72
|
if (contract || labels.length === 1) {
|
|
@@ -86,7 +86,7 @@ var decode = async ({ contracts, multicallWrapper }, data, name, contract) => {
|
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
const result = await multicallWrapper.decode(data);
|
|
89
|
-
if (result
|
|
89
|
+
if (!result)
|
|
90
90
|
return;
|
|
91
91
|
const nameWrapper = await contracts?.getNameWrapper();
|
|
92
92
|
const decodedData = [result[0][1], result[1][1], result[2]?.[1]].map(
|
|
@@ -110,7 +110,7 @@ var decode = async ({ contracts, multicallWrapper }, data, name, contract) => {
|
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
if (labels.length > 2 && ethers.utils.hexStripZeros(registryOwner) !== "0x") {
|
|
113
|
-
if (registryOwner === nameWrapper.address && ethers.utils.hexStripZeros(nameWrapperOwner) !== "0x") {
|
|
113
|
+
if (registryOwner === nameWrapper.address && nameWrapperOwner && ethers.utils.hexStripZeros(nameWrapperOwner) !== "0x") {
|
|
114
114
|
return {
|
|
115
115
|
owner: nameWrapperOwner,
|
|
116
116
|
ownershipLevel: "nameWrapper"
|
|
@@ -123,7 +123,7 @@ var decode = async ({ contracts, multicallWrapper }, data, name, contract) => {
|
|
|
123
123
|
}
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
|
-
if (registryOwner === nameWrapper.address && ethers.utils.hexStripZeros(nameWrapperOwner) !== "0x") {
|
|
126
|
+
if (registryOwner === nameWrapper.address && nameWrapperOwner && ethers.utils.hexStripZeros(nameWrapperOwner) !== "0x") {
|
|
127
127
|
return {
|
|
128
128
|
owner: nameWrapperOwner,
|
|
129
129
|
ownershipLevel: "nameWrapper"
|