@layerzerolabs/verify-contract 1.1.4 → 1.1.6
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/cli/index.js +2 -2
- package/dist/index.js +1237 -113
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1237 -113
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7006,9 +7006,9 @@ var require_winston_transport = __commonJS({
|
|
|
7006
7006
|
this.logv = options.logv;
|
|
7007
7007
|
if (options.close)
|
|
7008
7008
|
this.close = options.close;
|
|
7009
|
-
this.once("pipe", (
|
|
7010
|
-
this.levels =
|
|
7011
|
-
this.parent =
|
|
7009
|
+
this.once("pipe", (logger11) => {
|
|
7010
|
+
this.levels = logger11.levels;
|
|
7011
|
+
this.parent = logger11;
|
|
7012
7012
|
});
|
|
7013
7013
|
this.once("unpipe", (src) => {
|
|
7014
7014
|
if (src === this.parent) {
|
|
@@ -7984,7 +7984,7 @@ var require_diagnostics = __commonJS({
|
|
|
7984
7984
|
"node_modules/@dabh/diagnostics/diagnostics.js"(exports, module) {
|
|
7985
7985
|
var adapters = [];
|
|
7986
7986
|
var modifiers = [];
|
|
7987
|
-
var
|
|
7987
|
+
var logger11 = function devnull() {
|
|
7988
7988
|
};
|
|
7989
7989
|
function use(adapter) {
|
|
7990
7990
|
if (~adapters.indexOf(adapter))
|
|
@@ -7993,7 +7993,7 @@ var require_diagnostics = __commonJS({
|
|
|
7993
7993
|
return true;
|
|
7994
7994
|
}
|
|
7995
7995
|
function set(custom2) {
|
|
7996
|
-
|
|
7996
|
+
logger11 = custom2;
|
|
7997
7997
|
}
|
|
7998
7998
|
function enabled(namespace) {
|
|
7999
7999
|
var async = [];
|
|
@@ -8024,7 +8024,7 @@ var require_diagnostics = __commonJS({
|
|
|
8024
8024
|
return true;
|
|
8025
8025
|
}
|
|
8026
8026
|
function write() {
|
|
8027
|
-
|
|
8027
|
+
logger11.apply(logger11, arguments);
|
|
8028
8028
|
}
|
|
8029
8029
|
function process4(message) {
|
|
8030
8030
|
for (var i = 0; i < modifiers.length; i++) {
|
|
@@ -11178,11 +11178,11 @@ var require_exception_handler = __commonJS({
|
|
|
11178
11178
|
* TODO: add contructor description
|
|
11179
11179
|
* @param {!Logger} logger - TODO: add param description
|
|
11180
11180
|
*/
|
|
11181
|
-
constructor(
|
|
11182
|
-
if (!
|
|
11181
|
+
constructor(logger11) {
|
|
11182
|
+
if (!logger11) {
|
|
11183
11183
|
throw new Error("Logger is required to handle exceptions");
|
|
11184
11184
|
}
|
|
11185
|
-
this.logger =
|
|
11185
|
+
this.logger = logger11;
|
|
11186
11186
|
this.handlers = /* @__PURE__ */ new Map();
|
|
11187
11187
|
}
|
|
11188
11188
|
/**
|
|
@@ -11375,11 +11375,11 @@ var require_rejection_handler = __commonJS({
|
|
|
11375
11375
|
* TODO: add contructor description
|
|
11376
11376
|
* @param {!Logger} logger - TODO: add param description
|
|
11377
11377
|
*/
|
|
11378
|
-
constructor(
|
|
11379
|
-
if (!
|
|
11378
|
+
constructor(logger11) {
|
|
11379
|
+
if (!logger11) {
|
|
11380
11380
|
throw new Error("Logger is required to handle rejections");
|
|
11381
11381
|
}
|
|
11382
|
-
this.logger =
|
|
11382
|
+
this.logger = logger11;
|
|
11383
11383
|
this.handlers = /* @__PURE__ */ new Map();
|
|
11384
11384
|
}
|
|
11385
11385
|
/**
|
|
@@ -11575,11 +11575,11 @@ var require_profiler = __commonJS({
|
|
|
11575
11575
|
* @param {!Logger} logger - TODO: add param description.
|
|
11576
11576
|
* @private
|
|
11577
11577
|
*/
|
|
11578
|
-
constructor(
|
|
11579
|
-
if (!
|
|
11578
|
+
constructor(logger11) {
|
|
11579
|
+
if (!logger11) {
|
|
11580
11580
|
throw new Error("Logger is required for profiling.");
|
|
11581
11581
|
}
|
|
11582
|
-
this.logger =
|
|
11582
|
+
this.logger = logger11;
|
|
11583
11583
|
this.start = Date.now();
|
|
11584
11584
|
}
|
|
11585
11585
|
/**
|
|
@@ -11627,8 +11627,8 @@ var require_logger = __commonJS({
|
|
|
11627
11627
|
this.configure(options);
|
|
11628
11628
|
}
|
|
11629
11629
|
child(defaultRequestMetadata) {
|
|
11630
|
-
const
|
|
11631
|
-
return Object.create(
|
|
11630
|
+
const logger11 = this;
|
|
11631
|
+
return Object.create(logger11, {
|
|
11632
11632
|
write: {
|
|
11633
11633
|
value: function(info) {
|
|
11634
11634
|
const infoClone = Object.assign(
|
|
@@ -11640,7 +11640,7 @@ var require_logger = __commonJS({
|
|
|
11640
11640
|
infoClone.stack = info.stack;
|
|
11641
11641
|
infoClone.message = info.message;
|
|
11642
11642
|
}
|
|
11643
|
-
|
|
11643
|
+
logger11.write(infoClone);
|
|
11644
11644
|
}
|
|
11645
11645
|
}
|
|
11646
11646
|
});
|
|
@@ -12025,11 +12025,11 @@ var require_logger = __commonJS({
|
|
|
12025
12025
|
* @param {string} id Unique id of the profiler
|
|
12026
12026
|
* @returns {Logger} - TODO: add return description.
|
|
12027
12027
|
*/
|
|
12028
|
-
profile(
|
|
12028
|
+
profile(id2, ...args) {
|
|
12029
12029
|
const time = Date.now();
|
|
12030
|
-
if (this.profilers[
|
|
12031
|
-
const timeEnd = this.profilers[
|
|
12032
|
-
delete this.profilers[
|
|
12030
|
+
if (this.profilers[id2]) {
|
|
12031
|
+
const timeEnd = this.profilers[id2];
|
|
12032
|
+
delete this.profilers[id2];
|
|
12033
12033
|
if (typeof args[args.length - 2] === "function") {
|
|
12034
12034
|
console.warn(
|
|
12035
12035
|
"Callback function no longer supported as of winston@3.0.0"
|
|
@@ -12039,10 +12039,10 @@ var require_logger = __commonJS({
|
|
|
12039
12039
|
const info = typeof args[args.length - 1] === "object" ? args.pop() : {};
|
|
12040
12040
|
info.level = info.level || "info";
|
|
12041
12041
|
info.durationMs = time - timeEnd;
|
|
12042
|
-
info.message = info.message ||
|
|
12042
|
+
info.message = info.message || id2;
|
|
12043
12043
|
return this.write(info);
|
|
12044
12044
|
}
|
|
12045
|
-
this.profilers[
|
|
12045
|
+
this.profilers[id2] = time;
|
|
12046
12046
|
return this;
|
|
12047
12047
|
}
|
|
12048
12048
|
/**
|
|
@@ -12147,7 +12147,7 @@ var require_create_logger = __commonJS({
|
|
|
12147
12147
|
super(options);
|
|
12148
12148
|
}
|
|
12149
12149
|
}
|
|
12150
|
-
const
|
|
12150
|
+
const logger11 = new DerivedLogger(opts);
|
|
12151
12151
|
Object.keys(opts.levels).forEach(function(level) {
|
|
12152
12152
|
debug('Define prototype method for "%s"', level);
|
|
12153
12153
|
if (level === "log") {
|
|
@@ -12155,14 +12155,14 @@ var require_create_logger = __commonJS({
|
|
|
12155
12155
|
return;
|
|
12156
12156
|
}
|
|
12157
12157
|
DerivedLogger.prototype[level] = function(...args) {
|
|
12158
|
-
const self2 = this ||
|
|
12158
|
+
const self2 = this || logger11;
|
|
12159
12159
|
if (args.length === 1) {
|
|
12160
12160
|
const [msg] = args;
|
|
12161
12161
|
const info = msg && msg.message && msg || { message: msg };
|
|
12162
12162
|
info.level = info[LEVEL] = level;
|
|
12163
12163
|
self2._addDefaultMeta(info);
|
|
12164
12164
|
self2.write(info);
|
|
12165
|
-
return this ||
|
|
12165
|
+
return this || logger11;
|
|
12166
12166
|
}
|
|
12167
12167
|
if (args.length === 0) {
|
|
12168
12168
|
self2.log(level, "");
|
|
@@ -12171,10 +12171,10 @@ var require_create_logger = __commonJS({
|
|
|
12171
12171
|
return self2.log(level, ...args);
|
|
12172
12172
|
};
|
|
12173
12173
|
DerivedLogger.prototype[isLevelEnabledFunctionName(level)] = function() {
|
|
12174
|
-
return (this ||
|
|
12174
|
+
return (this || logger11).isLevelEnabled(level);
|
|
12175
12175
|
};
|
|
12176
12176
|
});
|
|
12177
|
-
return
|
|
12177
|
+
return logger11;
|
|
12178
12178
|
};
|
|
12179
12179
|
}
|
|
12180
12180
|
});
|
|
@@ -12200,8 +12200,8 @@ var require_container = __commonJS({
|
|
|
12200
12200
|
* @param {?Object} [options] - Options for the Logger instance.
|
|
12201
12201
|
* @returns {Logger} - A configured Logger instance with a specified id.
|
|
12202
12202
|
*/
|
|
12203
|
-
add(
|
|
12204
|
-
if (!this.loggers.has(
|
|
12203
|
+
add(id2, options) {
|
|
12204
|
+
if (!this.loggers.has(id2)) {
|
|
12205
12205
|
options = Object.assign({}, options || this.options);
|
|
12206
12206
|
const existing = options.transports || this.options.transports;
|
|
12207
12207
|
if (existing) {
|
|
@@ -12209,11 +12209,11 @@ var require_container = __commonJS({
|
|
|
12209
12209
|
} else {
|
|
12210
12210
|
options.transports = [];
|
|
12211
12211
|
}
|
|
12212
|
-
const
|
|
12213
|
-
|
|
12214
|
-
this.loggers.set(
|
|
12212
|
+
const logger11 = createLogger(options);
|
|
12213
|
+
logger11.on("close", () => this._delete(id2));
|
|
12214
|
+
this.loggers.set(id2, logger11);
|
|
12215
12215
|
}
|
|
12216
|
-
return this.loggers.get(
|
|
12216
|
+
return this.loggers.get(id2);
|
|
12217
12217
|
}
|
|
12218
12218
|
/**
|
|
12219
12219
|
* Retreives a `winston.Logger` instance for the specified `id`. If
|
|
@@ -12222,8 +12222,8 @@ var require_container = __commonJS({
|
|
|
12222
12222
|
* @param {?Object} [options] - Options for the Logger instance.
|
|
12223
12223
|
* @returns {Logger} - A configured Logger instance with a specified id.
|
|
12224
12224
|
*/
|
|
12225
|
-
get(
|
|
12226
|
-
return this.add(
|
|
12225
|
+
get(id2, options) {
|
|
12226
|
+
return this.add(id2, options);
|
|
12227
12227
|
}
|
|
12228
12228
|
/**
|
|
12229
12229
|
* Check if the container has a logger with the id.
|
|
@@ -12231,8 +12231,8 @@ var require_container = __commonJS({
|
|
|
12231
12231
|
* @returns {boolean} - Boolean value indicating if this instance has a
|
|
12232
12232
|
* logger with the specified `id`.
|
|
12233
12233
|
*/
|
|
12234
|
-
has(
|
|
12235
|
-
return !!this.loggers.has(
|
|
12234
|
+
has(id2) {
|
|
12235
|
+
return !!this.loggers.has(id2);
|
|
12236
12236
|
}
|
|
12237
12237
|
/**
|
|
12238
12238
|
* Closes a `Logger` instance with the specified `id` if it exists.
|
|
@@ -12240,9 +12240,9 @@ var require_container = __commonJS({
|
|
|
12240
12240
|
* @param {?string} id - The id of the Logger instance to close.
|
|
12241
12241
|
* @returns {undefined}
|
|
12242
12242
|
*/
|
|
12243
|
-
close(
|
|
12244
|
-
if (
|
|
12245
|
-
return this._removeLogger(
|
|
12243
|
+
close(id2) {
|
|
12244
|
+
if (id2) {
|
|
12245
|
+
return this._removeLogger(id2);
|
|
12246
12246
|
}
|
|
12247
12247
|
this.loggers.forEach((val, key) => this._removeLogger(key));
|
|
12248
12248
|
}
|
|
@@ -12252,13 +12252,13 @@ var require_container = __commonJS({
|
|
|
12252
12252
|
* @returns {undefined}
|
|
12253
12253
|
* @private
|
|
12254
12254
|
*/
|
|
12255
|
-
_removeLogger(
|
|
12256
|
-
if (!this.loggers.has(
|
|
12255
|
+
_removeLogger(id2) {
|
|
12256
|
+
if (!this.loggers.has(id2)) {
|
|
12257
12257
|
return;
|
|
12258
12258
|
}
|
|
12259
|
-
const
|
|
12260
|
-
|
|
12261
|
-
this._delete(
|
|
12259
|
+
const logger11 = this.loggers.get(id2);
|
|
12260
|
+
logger11.close();
|
|
12261
|
+
this._delete(id2);
|
|
12262
12262
|
}
|
|
12263
12263
|
/**
|
|
12264
12264
|
* Deletes a `Logger` instance with the specified `id`.
|
|
@@ -12267,8 +12267,8 @@ var require_container = __commonJS({
|
|
|
12267
12267
|
* @returns {undefined}
|
|
12268
12268
|
* @private
|
|
12269
12269
|
*/
|
|
12270
|
-
_delete(
|
|
12271
|
-
this.loggers.delete(
|
|
12270
|
+
_delete(id2) {
|
|
12271
|
+
this.loggers.delete(id2);
|
|
12272
12272
|
}
|
|
12273
12273
|
};
|
|
12274
12274
|
}
|
|
@@ -55319,18 +55319,18 @@ var anonymizeValue = (value) => {
|
|
|
55319
55319
|
const invisiblePart = Array.from({ length: invisibleLength }).fill("*").join("");
|
|
55320
55320
|
return `${visiblePart}${invisiblePart}`;
|
|
55321
55321
|
};
|
|
55322
|
-
var createRecordLogger = (
|
|
55323
|
-
|
|
55322
|
+
var createRecordLogger = (logger11, separator = " ") => (record) => {
|
|
55323
|
+
logger11.info("");
|
|
55324
55324
|
Object.entries(record).forEach(([label, value]) => {
|
|
55325
55325
|
if (Array.isArray(value)) {
|
|
55326
|
-
|
|
55326
|
+
logger11.info(`${label}:`);
|
|
55327
55327
|
value.forEach((item) => {
|
|
55328
|
-
|
|
55328
|
+
logger11.info(
|
|
55329
55329
|
`${separator} - ${import_chalk.default.bold(formatLoggableValue(item))}`
|
|
55330
55330
|
);
|
|
55331
55331
|
});
|
|
55332
55332
|
} else {
|
|
55333
|
-
|
|
55333
|
+
logger11.info(
|
|
55334
55334
|
`${label}:${separator}${import_chalk.default.bold(formatLoggableValue(value))}`
|
|
55335
55335
|
);
|
|
55336
55336
|
}
|
|
@@ -55351,7 +55351,7 @@ var FALSE_SYMBOL = COLORS.error`⚠`;
|
|
|
55351
55351
|
|
|
55352
55352
|
// src/common/config.ts
|
|
55353
55353
|
var import_chalk2 = __toESM(require_source());
|
|
55354
|
-
var parseNetworksConfig = (
|
|
55354
|
+
var parseNetworksConfig = (logger11, partialNetworksConfig) => {
|
|
55355
55355
|
return Object.entries(partialNetworksConfig != null ? partialNetworksConfig : {}).reduce(
|
|
55356
55356
|
(networksConfig, [networkName, networkConfig]) => {
|
|
55357
55357
|
if (networkConfig == null)
|
|
@@ -55372,7 +55372,7 @@ Please provide the API URL:
|
|
|
55372
55372
|
);
|
|
55373
55373
|
const apiKey = networkConfig.apiKey || getScanApiKeyFromEnv(networkName);
|
|
55374
55374
|
if (!apiKey) {
|
|
55375
|
-
|
|
55375
|
+
logger11.debug(`Could not find scan API key for network ${import_chalk2.default.bold(
|
|
55376
55376
|
networkName
|
|
55377
55377
|
)}
|
|
55378
55378
|
|
|
@@ -55384,7 +55384,7 @@ Please provide the API key:
|
|
|
55384
55384
|
}
|
|
55385
55385
|
const browserUrl = networkConfig.browserUrl || getScanBrowserUrlFromEnv(networkName) || tryGetScanBrowserUrlFromScanUrl(apiUrl);
|
|
55386
55386
|
if (!browserUrl) {
|
|
55387
|
-
|
|
55387
|
+
logger11.debug(`Could not find scan browser URL key for network ${import_chalk2.default.bold(
|
|
55388
55388
|
networkName
|
|
55389
55389
|
)}
|
|
55390
55390
|
|
|
@@ -64480,16 +64480,7 @@ z.record(
|
|
|
64480
64480
|
content: z.string()
|
|
64481
64481
|
})
|
|
64482
64482
|
);
|
|
64483
|
-
var MinimalAbiSchema = z.array(
|
|
64484
|
-
z.object({
|
|
64485
|
-
type: z.string(),
|
|
64486
|
-
inputs: z.array(
|
|
64487
|
-
z.object({
|
|
64488
|
-
type: z.string().optional()
|
|
64489
|
-
})
|
|
64490
|
-
).optional()
|
|
64491
|
-
})
|
|
64492
|
-
);
|
|
64483
|
+
var MinimalAbiSchema = z.array(z.record(z.string(), z.any()));
|
|
64493
64484
|
var MetadataSchema = z.object({
|
|
64494
64485
|
language: z.string(),
|
|
64495
64486
|
compiler: z.object({
|
|
@@ -65002,6 +64993,18 @@ function hexlify(value, options) {
|
|
|
65002
64993
|
}
|
|
65003
64994
|
return logger.throwArgumentError("invalid hexlify value", "value", value);
|
|
65004
64995
|
}
|
|
64996
|
+
function hexDataSlice(data, offset, endOffset) {
|
|
64997
|
+
if (typeof data !== "string") {
|
|
64998
|
+
data = hexlify(data);
|
|
64999
|
+
} else if (!isHexString(data) || data.length % 2) {
|
|
65000
|
+
logger.throwArgumentError("invalid hexData", "value", data);
|
|
65001
|
+
}
|
|
65002
|
+
offset = 2 + 2 * offset;
|
|
65003
|
+
if (endOffset != null) {
|
|
65004
|
+
return "0x" + data.substring(offset, 2 + 2 * endOffset);
|
|
65005
|
+
}
|
|
65006
|
+
return "0x" + data.substring(offset);
|
|
65007
|
+
}
|
|
65005
65008
|
function hexConcat(items) {
|
|
65006
65009
|
let result = "0x";
|
|
65007
65010
|
items.forEach((item) => {
|
|
@@ -65286,6 +65289,12 @@ function throwFault(fault, operation, value) {
|
|
|
65286
65289
|
function _base36To16(value) {
|
|
65287
65290
|
return new BN(value, 36).toString(16);
|
|
65288
65291
|
}
|
|
65292
|
+
|
|
65293
|
+
// node_modules/@ethersproject/properties/lib.esm/_version.js
|
|
65294
|
+
var version4 = "properties/5.7.0";
|
|
65295
|
+
|
|
65296
|
+
// node_modules/@ethersproject/properties/lib.esm/index.js
|
|
65297
|
+
var logger3 = new Logger(version4);
|
|
65289
65298
|
function defineReadOnly(object, name, value) {
|
|
65290
65299
|
Object.defineProperty(object, name, {
|
|
65291
65300
|
enumerable: true,
|
|
@@ -65293,6 +65302,73 @@ function defineReadOnly(object, name, value) {
|
|
|
65293
65302
|
writable: false
|
|
65294
65303
|
});
|
|
65295
65304
|
}
|
|
65305
|
+
function getStatic(ctor, key) {
|
|
65306
|
+
for (let i = 0; i < 32; i++) {
|
|
65307
|
+
if (ctor[key]) {
|
|
65308
|
+
return ctor[key];
|
|
65309
|
+
}
|
|
65310
|
+
if (!ctor.prototype || typeof ctor.prototype !== "object") {
|
|
65311
|
+
break;
|
|
65312
|
+
}
|
|
65313
|
+
ctor = Object.getPrototypeOf(ctor.prototype).constructor;
|
|
65314
|
+
}
|
|
65315
|
+
return null;
|
|
65316
|
+
}
|
|
65317
|
+
var opaque = { bigint: true, boolean: true, "function": true, number: true, string: true };
|
|
65318
|
+
function _isFrozen(object) {
|
|
65319
|
+
if (object === void 0 || object === null || opaque[typeof object]) {
|
|
65320
|
+
return true;
|
|
65321
|
+
}
|
|
65322
|
+
if (Array.isArray(object) || typeof object === "object") {
|
|
65323
|
+
if (!Object.isFrozen(object)) {
|
|
65324
|
+
return false;
|
|
65325
|
+
}
|
|
65326
|
+
const keys = Object.keys(object);
|
|
65327
|
+
for (let i = 0; i < keys.length; i++) {
|
|
65328
|
+
let value = null;
|
|
65329
|
+
try {
|
|
65330
|
+
value = object[keys[i]];
|
|
65331
|
+
} catch (error) {
|
|
65332
|
+
continue;
|
|
65333
|
+
}
|
|
65334
|
+
if (!_isFrozen(value)) {
|
|
65335
|
+
return false;
|
|
65336
|
+
}
|
|
65337
|
+
}
|
|
65338
|
+
return true;
|
|
65339
|
+
}
|
|
65340
|
+
return logger3.throwArgumentError(`Cannot deepCopy ${typeof object}`, "object", object);
|
|
65341
|
+
}
|
|
65342
|
+
function _deepCopy(object) {
|
|
65343
|
+
if (_isFrozen(object)) {
|
|
65344
|
+
return object;
|
|
65345
|
+
}
|
|
65346
|
+
if (Array.isArray(object)) {
|
|
65347
|
+
return Object.freeze(object.map((item) => deepCopy(item)));
|
|
65348
|
+
}
|
|
65349
|
+
if (typeof object === "object") {
|
|
65350
|
+
const result = {};
|
|
65351
|
+
for (const key in object) {
|
|
65352
|
+
const value = object[key];
|
|
65353
|
+
if (value === void 0) {
|
|
65354
|
+
continue;
|
|
65355
|
+
}
|
|
65356
|
+
defineReadOnly(result, key, deepCopy(value));
|
|
65357
|
+
}
|
|
65358
|
+
return result;
|
|
65359
|
+
}
|
|
65360
|
+
return logger3.throwArgumentError(`Cannot deepCopy ${typeof object}`, "object", object);
|
|
65361
|
+
}
|
|
65362
|
+
function deepCopy(object) {
|
|
65363
|
+
return _deepCopy(object);
|
|
65364
|
+
}
|
|
65365
|
+
var Description = class {
|
|
65366
|
+
constructor(info) {
|
|
65367
|
+
for (const key in info) {
|
|
65368
|
+
this[key] = deepCopy(info[key]);
|
|
65369
|
+
}
|
|
65370
|
+
}
|
|
65371
|
+
};
|
|
65296
65372
|
|
|
65297
65373
|
// node_modules/@ethersproject/abi/lib.esm/_version.js
|
|
65298
65374
|
var version5 = "abi/5.7.0";
|
|
@@ -65595,6 +65671,472 @@ var ParamType = class _ParamType {
|
|
|
65595
65671
|
return !!(value != null && value._isParamType);
|
|
65596
65672
|
}
|
|
65597
65673
|
};
|
|
65674
|
+
function parseParams(value, allowIndex) {
|
|
65675
|
+
return splitNesting(value).map((param) => ParamType.fromString(param, allowIndex));
|
|
65676
|
+
}
|
|
65677
|
+
var Fragment = class _Fragment {
|
|
65678
|
+
constructor(constructorGuard, params) {
|
|
65679
|
+
if (constructorGuard !== _constructorGuard2) {
|
|
65680
|
+
logger4.throwError("use a static from method", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
65681
|
+
operation: "new Fragment()"
|
|
65682
|
+
});
|
|
65683
|
+
}
|
|
65684
|
+
populate(this, params);
|
|
65685
|
+
this._isFragment = true;
|
|
65686
|
+
Object.freeze(this);
|
|
65687
|
+
}
|
|
65688
|
+
static from(value) {
|
|
65689
|
+
if (_Fragment.isFragment(value)) {
|
|
65690
|
+
return value;
|
|
65691
|
+
}
|
|
65692
|
+
if (typeof value === "string") {
|
|
65693
|
+
return _Fragment.fromString(value);
|
|
65694
|
+
}
|
|
65695
|
+
return _Fragment.fromObject(value);
|
|
65696
|
+
}
|
|
65697
|
+
static fromObject(value) {
|
|
65698
|
+
if (_Fragment.isFragment(value)) {
|
|
65699
|
+
return value;
|
|
65700
|
+
}
|
|
65701
|
+
switch (value.type) {
|
|
65702
|
+
case "function":
|
|
65703
|
+
return FunctionFragment.fromObject(value);
|
|
65704
|
+
case "event":
|
|
65705
|
+
return EventFragment.fromObject(value);
|
|
65706
|
+
case "constructor":
|
|
65707
|
+
return ConstructorFragment.fromObject(value);
|
|
65708
|
+
case "error":
|
|
65709
|
+
return ErrorFragment.fromObject(value);
|
|
65710
|
+
case "fallback":
|
|
65711
|
+
case "receive":
|
|
65712
|
+
return null;
|
|
65713
|
+
}
|
|
65714
|
+
return logger4.throwArgumentError("invalid fragment object", "value", value);
|
|
65715
|
+
}
|
|
65716
|
+
static fromString(value) {
|
|
65717
|
+
value = value.replace(/\s/g, " ");
|
|
65718
|
+
value = value.replace(/\(/g, " (").replace(/\)/g, ") ").replace(/\s+/g, " ");
|
|
65719
|
+
value = value.trim();
|
|
65720
|
+
if (value.split(" ")[0] === "event") {
|
|
65721
|
+
return EventFragment.fromString(value.substring(5).trim());
|
|
65722
|
+
} else if (value.split(" ")[0] === "function") {
|
|
65723
|
+
return FunctionFragment.fromString(value.substring(8).trim());
|
|
65724
|
+
} else if (value.split("(")[0].trim() === "constructor") {
|
|
65725
|
+
return ConstructorFragment.fromString(value.trim());
|
|
65726
|
+
} else if (value.split(" ")[0] === "error") {
|
|
65727
|
+
return ErrorFragment.fromString(value.substring(5).trim());
|
|
65728
|
+
}
|
|
65729
|
+
return logger4.throwArgumentError("unsupported fragment", "value", value);
|
|
65730
|
+
}
|
|
65731
|
+
static isFragment(value) {
|
|
65732
|
+
return !!(value && value._isFragment);
|
|
65733
|
+
}
|
|
65734
|
+
};
|
|
65735
|
+
var EventFragment = class _EventFragment extends Fragment {
|
|
65736
|
+
format(format2) {
|
|
65737
|
+
if (!format2) {
|
|
65738
|
+
format2 = FormatTypes.sighash;
|
|
65739
|
+
}
|
|
65740
|
+
if (!FormatTypes[format2]) {
|
|
65741
|
+
logger4.throwArgumentError("invalid format type", "format", format2);
|
|
65742
|
+
}
|
|
65743
|
+
if (format2 === FormatTypes.json) {
|
|
65744
|
+
return JSON.stringify({
|
|
65745
|
+
type: "event",
|
|
65746
|
+
anonymous: this.anonymous,
|
|
65747
|
+
name: this.name,
|
|
65748
|
+
inputs: this.inputs.map((input) => JSON.parse(input.format(format2)))
|
|
65749
|
+
});
|
|
65750
|
+
}
|
|
65751
|
+
let result = "";
|
|
65752
|
+
if (format2 !== FormatTypes.sighash) {
|
|
65753
|
+
result += "event ";
|
|
65754
|
+
}
|
|
65755
|
+
result += this.name + "(" + this.inputs.map((input) => input.format(format2)).join(format2 === FormatTypes.full ? ", " : ",") + ") ";
|
|
65756
|
+
if (format2 !== FormatTypes.sighash) {
|
|
65757
|
+
if (this.anonymous) {
|
|
65758
|
+
result += "anonymous ";
|
|
65759
|
+
}
|
|
65760
|
+
}
|
|
65761
|
+
return result.trim();
|
|
65762
|
+
}
|
|
65763
|
+
static from(value) {
|
|
65764
|
+
if (typeof value === "string") {
|
|
65765
|
+
return _EventFragment.fromString(value);
|
|
65766
|
+
}
|
|
65767
|
+
return _EventFragment.fromObject(value);
|
|
65768
|
+
}
|
|
65769
|
+
static fromObject(value) {
|
|
65770
|
+
if (_EventFragment.isEventFragment(value)) {
|
|
65771
|
+
return value;
|
|
65772
|
+
}
|
|
65773
|
+
if (value.type !== "event") {
|
|
65774
|
+
logger4.throwArgumentError("invalid event object", "value", value);
|
|
65775
|
+
}
|
|
65776
|
+
const params = {
|
|
65777
|
+
name: verifyIdentifier(value.name),
|
|
65778
|
+
anonymous: value.anonymous,
|
|
65779
|
+
inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : [],
|
|
65780
|
+
type: "event"
|
|
65781
|
+
};
|
|
65782
|
+
return new _EventFragment(_constructorGuard2, params);
|
|
65783
|
+
}
|
|
65784
|
+
static fromString(value) {
|
|
65785
|
+
let match = value.match(regexParen);
|
|
65786
|
+
if (!match) {
|
|
65787
|
+
logger4.throwArgumentError("invalid event string", "value", value);
|
|
65788
|
+
}
|
|
65789
|
+
let anonymous = false;
|
|
65790
|
+
match[3].split(" ").forEach((modifier) => {
|
|
65791
|
+
switch (modifier.trim()) {
|
|
65792
|
+
case "anonymous":
|
|
65793
|
+
anonymous = true;
|
|
65794
|
+
break;
|
|
65795
|
+
case "":
|
|
65796
|
+
break;
|
|
65797
|
+
default:
|
|
65798
|
+
logger4.warn("unknown modifier: " + modifier);
|
|
65799
|
+
}
|
|
65800
|
+
});
|
|
65801
|
+
return _EventFragment.fromObject({
|
|
65802
|
+
name: match[1].trim(),
|
|
65803
|
+
anonymous,
|
|
65804
|
+
inputs: parseParams(match[2], true),
|
|
65805
|
+
type: "event"
|
|
65806
|
+
});
|
|
65807
|
+
}
|
|
65808
|
+
static isEventFragment(value) {
|
|
65809
|
+
return value && value._isFragment && value.type === "event";
|
|
65810
|
+
}
|
|
65811
|
+
};
|
|
65812
|
+
function parseGas(value, params) {
|
|
65813
|
+
params.gas = null;
|
|
65814
|
+
let comps = value.split("@");
|
|
65815
|
+
if (comps.length !== 1) {
|
|
65816
|
+
if (comps.length > 2) {
|
|
65817
|
+
logger4.throwArgumentError("invalid human-readable ABI signature", "value", value);
|
|
65818
|
+
}
|
|
65819
|
+
if (!comps[1].match(/^[0-9]+$/)) {
|
|
65820
|
+
logger4.throwArgumentError("invalid human-readable ABI signature gas", "value", value);
|
|
65821
|
+
}
|
|
65822
|
+
params.gas = BigNumber.from(comps[1]);
|
|
65823
|
+
return comps[0];
|
|
65824
|
+
}
|
|
65825
|
+
return value;
|
|
65826
|
+
}
|
|
65827
|
+
function parseModifiers(value, params) {
|
|
65828
|
+
params.constant = false;
|
|
65829
|
+
params.payable = false;
|
|
65830
|
+
params.stateMutability = "nonpayable";
|
|
65831
|
+
value.split(" ").forEach((modifier) => {
|
|
65832
|
+
switch (modifier.trim()) {
|
|
65833
|
+
case "constant":
|
|
65834
|
+
params.constant = true;
|
|
65835
|
+
break;
|
|
65836
|
+
case "payable":
|
|
65837
|
+
params.payable = true;
|
|
65838
|
+
params.stateMutability = "payable";
|
|
65839
|
+
break;
|
|
65840
|
+
case "nonpayable":
|
|
65841
|
+
params.payable = false;
|
|
65842
|
+
params.stateMutability = "nonpayable";
|
|
65843
|
+
break;
|
|
65844
|
+
case "pure":
|
|
65845
|
+
params.constant = true;
|
|
65846
|
+
params.stateMutability = "pure";
|
|
65847
|
+
break;
|
|
65848
|
+
case "view":
|
|
65849
|
+
params.constant = true;
|
|
65850
|
+
params.stateMutability = "view";
|
|
65851
|
+
break;
|
|
65852
|
+
case "external":
|
|
65853
|
+
case "public":
|
|
65854
|
+
case "":
|
|
65855
|
+
break;
|
|
65856
|
+
default:
|
|
65857
|
+
console.log("unknown modifier: " + modifier);
|
|
65858
|
+
}
|
|
65859
|
+
});
|
|
65860
|
+
}
|
|
65861
|
+
function verifyState(value) {
|
|
65862
|
+
let result = {
|
|
65863
|
+
constant: false,
|
|
65864
|
+
payable: true,
|
|
65865
|
+
stateMutability: "payable"
|
|
65866
|
+
};
|
|
65867
|
+
if (value.stateMutability != null) {
|
|
65868
|
+
result.stateMutability = value.stateMutability;
|
|
65869
|
+
result.constant = result.stateMutability === "view" || result.stateMutability === "pure";
|
|
65870
|
+
if (value.constant != null) {
|
|
65871
|
+
if (!!value.constant !== result.constant) {
|
|
65872
|
+
logger4.throwArgumentError("cannot have constant function with mutability " + result.stateMutability, "value", value);
|
|
65873
|
+
}
|
|
65874
|
+
}
|
|
65875
|
+
result.payable = result.stateMutability === "payable";
|
|
65876
|
+
if (value.payable != null) {
|
|
65877
|
+
if (!!value.payable !== result.payable) {
|
|
65878
|
+
logger4.throwArgumentError("cannot have payable function with mutability " + result.stateMutability, "value", value);
|
|
65879
|
+
}
|
|
65880
|
+
}
|
|
65881
|
+
} else if (value.payable != null) {
|
|
65882
|
+
result.payable = !!value.payable;
|
|
65883
|
+
if (value.constant == null && !result.payable && value.type !== "constructor") {
|
|
65884
|
+
logger4.throwArgumentError("unable to determine stateMutability", "value", value);
|
|
65885
|
+
}
|
|
65886
|
+
result.constant = !!value.constant;
|
|
65887
|
+
if (result.constant) {
|
|
65888
|
+
result.stateMutability = "view";
|
|
65889
|
+
} else {
|
|
65890
|
+
result.stateMutability = result.payable ? "payable" : "nonpayable";
|
|
65891
|
+
}
|
|
65892
|
+
if (result.payable && result.constant) {
|
|
65893
|
+
logger4.throwArgumentError("cannot have constant payable function", "value", value);
|
|
65894
|
+
}
|
|
65895
|
+
} else if (value.constant != null) {
|
|
65896
|
+
result.constant = !!value.constant;
|
|
65897
|
+
result.payable = !result.constant;
|
|
65898
|
+
result.stateMutability = result.constant ? "view" : "payable";
|
|
65899
|
+
} else if (value.type !== "constructor") {
|
|
65900
|
+
logger4.throwArgumentError("unable to determine stateMutability", "value", value);
|
|
65901
|
+
}
|
|
65902
|
+
return result;
|
|
65903
|
+
}
|
|
65904
|
+
var ConstructorFragment = class _ConstructorFragment extends Fragment {
|
|
65905
|
+
format(format2) {
|
|
65906
|
+
if (!format2) {
|
|
65907
|
+
format2 = FormatTypes.sighash;
|
|
65908
|
+
}
|
|
65909
|
+
if (!FormatTypes[format2]) {
|
|
65910
|
+
logger4.throwArgumentError("invalid format type", "format", format2);
|
|
65911
|
+
}
|
|
65912
|
+
if (format2 === FormatTypes.json) {
|
|
65913
|
+
return JSON.stringify({
|
|
65914
|
+
type: "constructor",
|
|
65915
|
+
stateMutability: this.stateMutability !== "nonpayable" ? this.stateMutability : void 0,
|
|
65916
|
+
payable: this.payable,
|
|
65917
|
+
gas: this.gas ? this.gas.toNumber() : void 0,
|
|
65918
|
+
inputs: this.inputs.map((input) => JSON.parse(input.format(format2)))
|
|
65919
|
+
});
|
|
65920
|
+
}
|
|
65921
|
+
if (format2 === FormatTypes.sighash) {
|
|
65922
|
+
logger4.throwError("cannot format a constructor for sighash", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
65923
|
+
operation: "format(sighash)"
|
|
65924
|
+
});
|
|
65925
|
+
}
|
|
65926
|
+
let result = "constructor(" + this.inputs.map((input) => input.format(format2)).join(format2 === FormatTypes.full ? ", " : ",") + ") ";
|
|
65927
|
+
if (this.stateMutability && this.stateMutability !== "nonpayable") {
|
|
65928
|
+
result += this.stateMutability + " ";
|
|
65929
|
+
}
|
|
65930
|
+
return result.trim();
|
|
65931
|
+
}
|
|
65932
|
+
static from(value) {
|
|
65933
|
+
if (typeof value === "string") {
|
|
65934
|
+
return _ConstructorFragment.fromString(value);
|
|
65935
|
+
}
|
|
65936
|
+
return _ConstructorFragment.fromObject(value);
|
|
65937
|
+
}
|
|
65938
|
+
static fromObject(value) {
|
|
65939
|
+
if (_ConstructorFragment.isConstructorFragment(value)) {
|
|
65940
|
+
return value;
|
|
65941
|
+
}
|
|
65942
|
+
if (value.type !== "constructor") {
|
|
65943
|
+
logger4.throwArgumentError("invalid constructor object", "value", value);
|
|
65944
|
+
}
|
|
65945
|
+
let state = verifyState(value);
|
|
65946
|
+
if (state.constant) {
|
|
65947
|
+
logger4.throwArgumentError("constructor cannot be constant", "value", value);
|
|
65948
|
+
}
|
|
65949
|
+
const params = {
|
|
65950
|
+
name: null,
|
|
65951
|
+
type: value.type,
|
|
65952
|
+
inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : [],
|
|
65953
|
+
payable: state.payable,
|
|
65954
|
+
stateMutability: state.stateMutability,
|
|
65955
|
+
gas: value.gas ? BigNumber.from(value.gas) : null
|
|
65956
|
+
};
|
|
65957
|
+
return new _ConstructorFragment(_constructorGuard2, params);
|
|
65958
|
+
}
|
|
65959
|
+
static fromString(value) {
|
|
65960
|
+
let params = { type: "constructor" };
|
|
65961
|
+
value = parseGas(value, params);
|
|
65962
|
+
let parens = value.match(regexParen);
|
|
65963
|
+
if (!parens || parens[1].trim() !== "constructor") {
|
|
65964
|
+
logger4.throwArgumentError("invalid constructor string", "value", value);
|
|
65965
|
+
}
|
|
65966
|
+
params.inputs = parseParams(parens[2].trim(), false);
|
|
65967
|
+
parseModifiers(parens[3].trim(), params);
|
|
65968
|
+
return _ConstructorFragment.fromObject(params);
|
|
65969
|
+
}
|
|
65970
|
+
static isConstructorFragment(value) {
|
|
65971
|
+
return value && value._isFragment && value.type === "constructor";
|
|
65972
|
+
}
|
|
65973
|
+
};
|
|
65974
|
+
var FunctionFragment = class _FunctionFragment extends ConstructorFragment {
|
|
65975
|
+
format(format2) {
|
|
65976
|
+
if (!format2) {
|
|
65977
|
+
format2 = FormatTypes.sighash;
|
|
65978
|
+
}
|
|
65979
|
+
if (!FormatTypes[format2]) {
|
|
65980
|
+
logger4.throwArgumentError("invalid format type", "format", format2);
|
|
65981
|
+
}
|
|
65982
|
+
if (format2 === FormatTypes.json) {
|
|
65983
|
+
return JSON.stringify({
|
|
65984
|
+
type: "function",
|
|
65985
|
+
name: this.name,
|
|
65986
|
+
constant: this.constant,
|
|
65987
|
+
stateMutability: this.stateMutability !== "nonpayable" ? this.stateMutability : void 0,
|
|
65988
|
+
payable: this.payable,
|
|
65989
|
+
gas: this.gas ? this.gas.toNumber() : void 0,
|
|
65990
|
+
inputs: this.inputs.map((input) => JSON.parse(input.format(format2))),
|
|
65991
|
+
outputs: this.outputs.map((output) => JSON.parse(output.format(format2)))
|
|
65992
|
+
});
|
|
65993
|
+
}
|
|
65994
|
+
let result = "";
|
|
65995
|
+
if (format2 !== FormatTypes.sighash) {
|
|
65996
|
+
result += "function ";
|
|
65997
|
+
}
|
|
65998
|
+
result += this.name + "(" + this.inputs.map((input) => input.format(format2)).join(format2 === FormatTypes.full ? ", " : ",") + ") ";
|
|
65999
|
+
if (format2 !== FormatTypes.sighash) {
|
|
66000
|
+
if (this.stateMutability) {
|
|
66001
|
+
if (this.stateMutability !== "nonpayable") {
|
|
66002
|
+
result += this.stateMutability + " ";
|
|
66003
|
+
}
|
|
66004
|
+
} else if (this.constant) {
|
|
66005
|
+
result += "view ";
|
|
66006
|
+
}
|
|
66007
|
+
if (this.outputs && this.outputs.length) {
|
|
66008
|
+
result += "returns (" + this.outputs.map((output) => output.format(format2)).join(", ") + ") ";
|
|
66009
|
+
}
|
|
66010
|
+
if (this.gas != null) {
|
|
66011
|
+
result += "@" + this.gas.toString() + " ";
|
|
66012
|
+
}
|
|
66013
|
+
}
|
|
66014
|
+
return result.trim();
|
|
66015
|
+
}
|
|
66016
|
+
static from(value) {
|
|
66017
|
+
if (typeof value === "string") {
|
|
66018
|
+
return _FunctionFragment.fromString(value);
|
|
66019
|
+
}
|
|
66020
|
+
return _FunctionFragment.fromObject(value);
|
|
66021
|
+
}
|
|
66022
|
+
static fromObject(value) {
|
|
66023
|
+
if (_FunctionFragment.isFunctionFragment(value)) {
|
|
66024
|
+
return value;
|
|
66025
|
+
}
|
|
66026
|
+
if (value.type !== "function") {
|
|
66027
|
+
logger4.throwArgumentError("invalid function object", "value", value);
|
|
66028
|
+
}
|
|
66029
|
+
let state = verifyState(value);
|
|
66030
|
+
const params = {
|
|
66031
|
+
type: value.type,
|
|
66032
|
+
name: verifyIdentifier(value.name),
|
|
66033
|
+
constant: state.constant,
|
|
66034
|
+
inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : [],
|
|
66035
|
+
outputs: value.outputs ? value.outputs.map(ParamType.fromObject) : [],
|
|
66036
|
+
payable: state.payable,
|
|
66037
|
+
stateMutability: state.stateMutability,
|
|
66038
|
+
gas: value.gas ? BigNumber.from(value.gas) : null
|
|
66039
|
+
};
|
|
66040
|
+
return new _FunctionFragment(_constructorGuard2, params);
|
|
66041
|
+
}
|
|
66042
|
+
static fromString(value) {
|
|
66043
|
+
let params = { type: "function" };
|
|
66044
|
+
value = parseGas(value, params);
|
|
66045
|
+
let comps = value.split(" returns ");
|
|
66046
|
+
if (comps.length > 2) {
|
|
66047
|
+
logger4.throwArgumentError("invalid function string", "value", value);
|
|
66048
|
+
}
|
|
66049
|
+
let parens = comps[0].match(regexParen);
|
|
66050
|
+
if (!parens) {
|
|
66051
|
+
logger4.throwArgumentError("invalid function signature", "value", value);
|
|
66052
|
+
}
|
|
66053
|
+
params.name = parens[1].trim();
|
|
66054
|
+
if (params.name) {
|
|
66055
|
+
verifyIdentifier(params.name);
|
|
66056
|
+
}
|
|
66057
|
+
params.inputs = parseParams(parens[2], false);
|
|
66058
|
+
parseModifiers(parens[3].trim(), params);
|
|
66059
|
+
if (comps.length > 1) {
|
|
66060
|
+
let returns = comps[1].match(regexParen);
|
|
66061
|
+
if (returns[1].trim() != "" || returns[3].trim() != "") {
|
|
66062
|
+
logger4.throwArgumentError("unexpected tokens", "value", value);
|
|
66063
|
+
}
|
|
66064
|
+
params.outputs = parseParams(returns[2], false);
|
|
66065
|
+
} else {
|
|
66066
|
+
params.outputs = [];
|
|
66067
|
+
}
|
|
66068
|
+
return _FunctionFragment.fromObject(params);
|
|
66069
|
+
}
|
|
66070
|
+
static isFunctionFragment(value) {
|
|
66071
|
+
return value && value._isFragment && value.type === "function";
|
|
66072
|
+
}
|
|
66073
|
+
};
|
|
66074
|
+
function checkForbidden(fragment) {
|
|
66075
|
+
const sig = fragment.format();
|
|
66076
|
+
if (sig === "Error(string)" || sig === "Panic(uint256)") {
|
|
66077
|
+
logger4.throwArgumentError(`cannot specify user defined ${sig} error`, "fragment", fragment);
|
|
66078
|
+
}
|
|
66079
|
+
return fragment;
|
|
66080
|
+
}
|
|
66081
|
+
var ErrorFragment = class _ErrorFragment extends Fragment {
|
|
66082
|
+
format(format2) {
|
|
66083
|
+
if (!format2) {
|
|
66084
|
+
format2 = FormatTypes.sighash;
|
|
66085
|
+
}
|
|
66086
|
+
if (!FormatTypes[format2]) {
|
|
66087
|
+
logger4.throwArgumentError("invalid format type", "format", format2);
|
|
66088
|
+
}
|
|
66089
|
+
if (format2 === FormatTypes.json) {
|
|
66090
|
+
return JSON.stringify({
|
|
66091
|
+
type: "error",
|
|
66092
|
+
name: this.name,
|
|
66093
|
+
inputs: this.inputs.map((input) => JSON.parse(input.format(format2)))
|
|
66094
|
+
});
|
|
66095
|
+
}
|
|
66096
|
+
let result = "";
|
|
66097
|
+
if (format2 !== FormatTypes.sighash) {
|
|
66098
|
+
result += "error ";
|
|
66099
|
+
}
|
|
66100
|
+
result += this.name + "(" + this.inputs.map((input) => input.format(format2)).join(format2 === FormatTypes.full ? ", " : ",") + ") ";
|
|
66101
|
+
return result.trim();
|
|
66102
|
+
}
|
|
66103
|
+
static from(value) {
|
|
66104
|
+
if (typeof value === "string") {
|
|
66105
|
+
return _ErrorFragment.fromString(value);
|
|
66106
|
+
}
|
|
66107
|
+
return _ErrorFragment.fromObject(value);
|
|
66108
|
+
}
|
|
66109
|
+
static fromObject(value) {
|
|
66110
|
+
if (_ErrorFragment.isErrorFragment(value)) {
|
|
66111
|
+
return value;
|
|
66112
|
+
}
|
|
66113
|
+
if (value.type !== "error") {
|
|
66114
|
+
logger4.throwArgumentError("invalid error object", "value", value);
|
|
66115
|
+
}
|
|
66116
|
+
const params = {
|
|
66117
|
+
type: value.type,
|
|
66118
|
+
name: verifyIdentifier(value.name),
|
|
66119
|
+
inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : []
|
|
66120
|
+
};
|
|
66121
|
+
return checkForbidden(new _ErrorFragment(_constructorGuard2, params));
|
|
66122
|
+
}
|
|
66123
|
+
static fromString(value) {
|
|
66124
|
+
let params = { type: "error" };
|
|
66125
|
+
let parens = value.match(regexParen);
|
|
66126
|
+
if (!parens) {
|
|
66127
|
+
logger4.throwArgumentError("invalid error signature", "value", value);
|
|
66128
|
+
}
|
|
66129
|
+
params.name = parens[1].trim();
|
|
66130
|
+
if (params.name) {
|
|
66131
|
+
verifyIdentifier(params.name);
|
|
66132
|
+
}
|
|
66133
|
+
params.inputs = parseParams(parens[2], false);
|
|
66134
|
+
return checkForbidden(_ErrorFragment.fromObject(params));
|
|
66135
|
+
}
|
|
66136
|
+
static isErrorFragment(value) {
|
|
66137
|
+
return value && value._isFragment && value.type === "error";
|
|
66138
|
+
}
|
|
66139
|
+
};
|
|
65598
66140
|
function verifyType(type) {
|
|
65599
66141
|
if (type.match(/^uint($|[^1-9])/)) {
|
|
65600
66142
|
type = "uint256" + type.substring(4);
|
|
@@ -65603,6 +66145,41 @@ function verifyType(type) {
|
|
|
65603
66145
|
}
|
|
65604
66146
|
return type;
|
|
65605
66147
|
}
|
|
66148
|
+
var regexIdentifier = new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");
|
|
66149
|
+
function verifyIdentifier(value) {
|
|
66150
|
+
if (!value || !value.match(regexIdentifier)) {
|
|
66151
|
+
logger4.throwArgumentError(`invalid identifier "${value}"`, "value", value);
|
|
66152
|
+
}
|
|
66153
|
+
return value;
|
|
66154
|
+
}
|
|
66155
|
+
var regexParen = new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");
|
|
66156
|
+
function splitNesting(value) {
|
|
66157
|
+
value = value.trim();
|
|
66158
|
+
let result = [];
|
|
66159
|
+
let accum = "";
|
|
66160
|
+
let depth = 0;
|
|
66161
|
+
for (let offset = 0; offset < value.length; offset++) {
|
|
66162
|
+
let c = value[offset];
|
|
66163
|
+
if (c === "," && depth === 0) {
|
|
66164
|
+
result.push(accum);
|
|
66165
|
+
accum = "";
|
|
66166
|
+
} else {
|
|
66167
|
+
accum += c;
|
|
66168
|
+
if (c === "(") {
|
|
66169
|
+
depth++;
|
|
66170
|
+
} else if (c === ")") {
|
|
66171
|
+
depth--;
|
|
66172
|
+
if (depth === -1) {
|
|
66173
|
+
logger4.throwArgumentError("unbalanced parenthesis", "value", value);
|
|
66174
|
+
}
|
|
66175
|
+
}
|
|
66176
|
+
}
|
|
66177
|
+
}
|
|
66178
|
+
if (accum) {
|
|
66179
|
+
result.push(accum);
|
|
66180
|
+
}
|
|
66181
|
+
return result;
|
|
66182
|
+
}
|
|
65606
66183
|
|
|
65607
66184
|
// node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js
|
|
65608
66185
|
var logger5 = new Logger(version5);
|
|
@@ -66489,23 +67066,574 @@ var AbiCoder = class {
|
|
|
66489
67066
|
};
|
|
66490
67067
|
var defaultAbiCoder = new AbiCoder();
|
|
66491
67068
|
|
|
67069
|
+
// node_modules/@ethersproject/hash/lib.esm/id.js
|
|
67070
|
+
function id(text) {
|
|
67071
|
+
return keccak256(toUtf8Bytes(text));
|
|
67072
|
+
}
|
|
67073
|
+
|
|
67074
|
+
// node_modules/@ethersproject/abi/lib.esm/interface.js
|
|
67075
|
+
var logger10 = new Logger(version5);
|
|
67076
|
+
var LogDescription = class extends Description {
|
|
67077
|
+
};
|
|
67078
|
+
var TransactionDescription = class extends Description {
|
|
67079
|
+
};
|
|
67080
|
+
var ErrorDescription = class extends Description {
|
|
67081
|
+
};
|
|
67082
|
+
var Indexed = class extends Description {
|
|
67083
|
+
static isIndexed(value) {
|
|
67084
|
+
return !!(value && value._isIndexed);
|
|
67085
|
+
}
|
|
67086
|
+
};
|
|
67087
|
+
var BuiltinErrors = {
|
|
67088
|
+
"0x08c379a0": { signature: "Error(string)", name: "Error", inputs: ["string"], reason: true },
|
|
67089
|
+
"0x4e487b71": { signature: "Panic(uint256)", name: "Panic", inputs: ["uint256"] }
|
|
67090
|
+
};
|
|
67091
|
+
function wrapAccessError(property, error) {
|
|
67092
|
+
const wrap = new Error(`deferred error during ABI decoding triggered accessing ${property}`);
|
|
67093
|
+
wrap.error = error;
|
|
67094
|
+
return wrap;
|
|
67095
|
+
}
|
|
67096
|
+
var Interface = class {
|
|
67097
|
+
constructor(fragments) {
|
|
67098
|
+
let abi = [];
|
|
67099
|
+
if (typeof fragments === "string") {
|
|
67100
|
+
abi = JSON.parse(fragments);
|
|
67101
|
+
} else {
|
|
67102
|
+
abi = fragments;
|
|
67103
|
+
}
|
|
67104
|
+
defineReadOnly(this, "fragments", abi.map((fragment) => {
|
|
67105
|
+
return Fragment.from(fragment);
|
|
67106
|
+
}).filter((fragment) => fragment != null));
|
|
67107
|
+
defineReadOnly(this, "_abiCoder", getStatic(new.target, "getAbiCoder")());
|
|
67108
|
+
defineReadOnly(this, "functions", {});
|
|
67109
|
+
defineReadOnly(this, "errors", {});
|
|
67110
|
+
defineReadOnly(this, "events", {});
|
|
67111
|
+
defineReadOnly(this, "structs", {});
|
|
67112
|
+
this.fragments.forEach((fragment) => {
|
|
67113
|
+
let bucket = null;
|
|
67114
|
+
switch (fragment.type) {
|
|
67115
|
+
case "constructor":
|
|
67116
|
+
if (this.deploy) {
|
|
67117
|
+
logger10.warn("duplicate definition - constructor");
|
|
67118
|
+
return;
|
|
67119
|
+
}
|
|
67120
|
+
defineReadOnly(this, "deploy", fragment);
|
|
67121
|
+
return;
|
|
67122
|
+
case "function":
|
|
67123
|
+
bucket = this.functions;
|
|
67124
|
+
break;
|
|
67125
|
+
case "event":
|
|
67126
|
+
bucket = this.events;
|
|
67127
|
+
break;
|
|
67128
|
+
case "error":
|
|
67129
|
+
bucket = this.errors;
|
|
67130
|
+
break;
|
|
67131
|
+
default:
|
|
67132
|
+
return;
|
|
67133
|
+
}
|
|
67134
|
+
let signature = fragment.format();
|
|
67135
|
+
if (bucket[signature]) {
|
|
67136
|
+
logger10.warn("duplicate definition - " + signature);
|
|
67137
|
+
return;
|
|
67138
|
+
}
|
|
67139
|
+
bucket[signature] = fragment;
|
|
67140
|
+
});
|
|
67141
|
+
if (!this.deploy) {
|
|
67142
|
+
defineReadOnly(this, "deploy", ConstructorFragment.from({
|
|
67143
|
+
payable: false,
|
|
67144
|
+
type: "constructor"
|
|
67145
|
+
}));
|
|
67146
|
+
}
|
|
67147
|
+
defineReadOnly(this, "_isInterface", true);
|
|
67148
|
+
}
|
|
67149
|
+
format(format2) {
|
|
67150
|
+
if (!format2) {
|
|
67151
|
+
format2 = FormatTypes.full;
|
|
67152
|
+
}
|
|
67153
|
+
if (format2 === FormatTypes.sighash) {
|
|
67154
|
+
logger10.throwArgumentError("interface does not support formatting sighash", "format", format2);
|
|
67155
|
+
}
|
|
67156
|
+
const abi = this.fragments.map((fragment) => fragment.format(format2));
|
|
67157
|
+
if (format2 === FormatTypes.json) {
|
|
67158
|
+
return JSON.stringify(abi.map((j) => JSON.parse(j)));
|
|
67159
|
+
}
|
|
67160
|
+
return abi;
|
|
67161
|
+
}
|
|
67162
|
+
// Sub-classes can override these to handle other blockchains
|
|
67163
|
+
static getAbiCoder() {
|
|
67164
|
+
return defaultAbiCoder;
|
|
67165
|
+
}
|
|
67166
|
+
static getAddress(address) {
|
|
67167
|
+
return getAddress(address);
|
|
67168
|
+
}
|
|
67169
|
+
static getSighash(fragment) {
|
|
67170
|
+
return hexDataSlice(id(fragment.format()), 0, 4);
|
|
67171
|
+
}
|
|
67172
|
+
static getEventTopic(eventFragment) {
|
|
67173
|
+
return id(eventFragment.format());
|
|
67174
|
+
}
|
|
67175
|
+
// Find a function definition by any means necessary (unless it is ambiguous)
|
|
67176
|
+
getFunction(nameOrSignatureOrSighash) {
|
|
67177
|
+
if (isHexString(nameOrSignatureOrSighash)) {
|
|
67178
|
+
for (const name in this.functions) {
|
|
67179
|
+
if (nameOrSignatureOrSighash === this.getSighash(name)) {
|
|
67180
|
+
return this.functions[name];
|
|
67181
|
+
}
|
|
67182
|
+
}
|
|
67183
|
+
logger10.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash);
|
|
67184
|
+
}
|
|
67185
|
+
if (nameOrSignatureOrSighash.indexOf("(") === -1) {
|
|
67186
|
+
const name = nameOrSignatureOrSighash.trim();
|
|
67187
|
+
const matching = Object.keys(this.functions).filter((f) => f.split(
|
|
67188
|
+
"("
|
|
67189
|
+
/* fix:) */
|
|
67190
|
+
)[0] === name);
|
|
67191
|
+
if (matching.length === 0) {
|
|
67192
|
+
logger10.throwArgumentError("no matching function", "name", name);
|
|
67193
|
+
} else if (matching.length > 1) {
|
|
67194
|
+
logger10.throwArgumentError("multiple matching functions", "name", name);
|
|
67195
|
+
}
|
|
67196
|
+
return this.functions[matching[0]];
|
|
67197
|
+
}
|
|
67198
|
+
const result = this.functions[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
|
67199
|
+
if (!result) {
|
|
67200
|
+
logger10.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash);
|
|
67201
|
+
}
|
|
67202
|
+
return result;
|
|
67203
|
+
}
|
|
67204
|
+
// Find an event definition by any means necessary (unless it is ambiguous)
|
|
67205
|
+
getEvent(nameOrSignatureOrTopic) {
|
|
67206
|
+
if (isHexString(nameOrSignatureOrTopic)) {
|
|
67207
|
+
const topichash = nameOrSignatureOrTopic.toLowerCase();
|
|
67208
|
+
for (const name in this.events) {
|
|
67209
|
+
if (topichash === this.getEventTopic(name)) {
|
|
67210
|
+
return this.events[name];
|
|
67211
|
+
}
|
|
67212
|
+
}
|
|
67213
|
+
logger10.throwArgumentError("no matching event", "topichash", topichash);
|
|
67214
|
+
}
|
|
67215
|
+
if (nameOrSignatureOrTopic.indexOf("(") === -1) {
|
|
67216
|
+
const name = nameOrSignatureOrTopic.trim();
|
|
67217
|
+
const matching = Object.keys(this.events).filter((f) => f.split(
|
|
67218
|
+
"("
|
|
67219
|
+
/* fix:) */
|
|
67220
|
+
)[0] === name);
|
|
67221
|
+
if (matching.length === 0) {
|
|
67222
|
+
logger10.throwArgumentError("no matching event", "name", name);
|
|
67223
|
+
} else if (matching.length > 1) {
|
|
67224
|
+
logger10.throwArgumentError("multiple matching events", "name", name);
|
|
67225
|
+
}
|
|
67226
|
+
return this.events[matching[0]];
|
|
67227
|
+
}
|
|
67228
|
+
const result = this.events[EventFragment.fromString(nameOrSignatureOrTopic).format()];
|
|
67229
|
+
if (!result) {
|
|
67230
|
+
logger10.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic);
|
|
67231
|
+
}
|
|
67232
|
+
return result;
|
|
67233
|
+
}
|
|
67234
|
+
// Find a function definition by any means necessary (unless it is ambiguous)
|
|
67235
|
+
getError(nameOrSignatureOrSighash) {
|
|
67236
|
+
if (isHexString(nameOrSignatureOrSighash)) {
|
|
67237
|
+
const getSighash = getStatic(this.constructor, "getSighash");
|
|
67238
|
+
for (const name in this.errors) {
|
|
67239
|
+
const error = this.errors[name];
|
|
67240
|
+
if (nameOrSignatureOrSighash === getSighash(error)) {
|
|
67241
|
+
return this.errors[name];
|
|
67242
|
+
}
|
|
67243
|
+
}
|
|
67244
|
+
logger10.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash);
|
|
67245
|
+
}
|
|
67246
|
+
if (nameOrSignatureOrSighash.indexOf("(") === -1) {
|
|
67247
|
+
const name = nameOrSignatureOrSighash.trim();
|
|
67248
|
+
const matching = Object.keys(this.errors).filter((f) => f.split(
|
|
67249
|
+
"("
|
|
67250
|
+
/* fix:) */
|
|
67251
|
+
)[0] === name);
|
|
67252
|
+
if (matching.length === 0) {
|
|
67253
|
+
logger10.throwArgumentError("no matching error", "name", name);
|
|
67254
|
+
} else if (matching.length > 1) {
|
|
67255
|
+
logger10.throwArgumentError("multiple matching errors", "name", name);
|
|
67256
|
+
}
|
|
67257
|
+
return this.errors[matching[0]];
|
|
67258
|
+
}
|
|
67259
|
+
const result = this.errors[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
|
67260
|
+
if (!result) {
|
|
67261
|
+
logger10.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash);
|
|
67262
|
+
}
|
|
67263
|
+
return result;
|
|
67264
|
+
}
|
|
67265
|
+
// Get the sighash (the bytes4 selector) used by Solidity to identify a function
|
|
67266
|
+
getSighash(fragment) {
|
|
67267
|
+
if (typeof fragment === "string") {
|
|
67268
|
+
try {
|
|
67269
|
+
fragment = this.getFunction(fragment);
|
|
67270
|
+
} catch (error) {
|
|
67271
|
+
try {
|
|
67272
|
+
fragment = this.getError(fragment);
|
|
67273
|
+
} catch (_) {
|
|
67274
|
+
throw error;
|
|
67275
|
+
}
|
|
67276
|
+
}
|
|
67277
|
+
}
|
|
67278
|
+
return getStatic(this.constructor, "getSighash")(fragment);
|
|
67279
|
+
}
|
|
67280
|
+
// Get the topic (the bytes32 hash) used by Solidity to identify an event
|
|
67281
|
+
getEventTopic(eventFragment) {
|
|
67282
|
+
if (typeof eventFragment === "string") {
|
|
67283
|
+
eventFragment = this.getEvent(eventFragment);
|
|
67284
|
+
}
|
|
67285
|
+
return getStatic(this.constructor, "getEventTopic")(eventFragment);
|
|
67286
|
+
}
|
|
67287
|
+
_decodeParams(params, data) {
|
|
67288
|
+
return this._abiCoder.decode(params, data);
|
|
67289
|
+
}
|
|
67290
|
+
_encodeParams(params, values) {
|
|
67291
|
+
return this._abiCoder.encode(params, values);
|
|
67292
|
+
}
|
|
67293
|
+
encodeDeploy(values) {
|
|
67294
|
+
return this._encodeParams(this.deploy.inputs, values || []);
|
|
67295
|
+
}
|
|
67296
|
+
decodeErrorResult(fragment, data) {
|
|
67297
|
+
if (typeof fragment === "string") {
|
|
67298
|
+
fragment = this.getError(fragment);
|
|
67299
|
+
}
|
|
67300
|
+
const bytes = arrayify(data);
|
|
67301
|
+
if (hexlify(bytes.slice(0, 4)) !== this.getSighash(fragment)) {
|
|
67302
|
+
logger10.throwArgumentError(`data signature does not match error ${fragment.name}.`, "data", hexlify(bytes));
|
|
67303
|
+
}
|
|
67304
|
+
return this._decodeParams(fragment.inputs, bytes.slice(4));
|
|
67305
|
+
}
|
|
67306
|
+
encodeErrorResult(fragment, values) {
|
|
67307
|
+
if (typeof fragment === "string") {
|
|
67308
|
+
fragment = this.getError(fragment);
|
|
67309
|
+
}
|
|
67310
|
+
return hexlify(concat([
|
|
67311
|
+
this.getSighash(fragment),
|
|
67312
|
+
this._encodeParams(fragment.inputs, values || [])
|
|
67313
|
+
]));
|
|
67314
|
+
}
|
|
67315
|
+
// Decode the data for a function call (e.g. tx.data)
|
|
67316
|
+
decodeFunctionData(functionFragment, data) {
|
|
67317
|
+
if (typeof functionFragment === "string") {
|
|
67318
|
+
functionFragment = this.getFunction(functionFragment);
|
|
67319
|
+
}
|
|
67320
|
+
const bytes = arrayify(data);
|
|
67321
|
+
if (hexlify(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) {
|
|
67322
|
+
logger10.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, "data", hexlify(bytes));
|
|
67323
|
+
}
|
|
67324
|
+
return this._decodeParams(functionFragment.inputs, bytes.slice(4));
|
|
67325
|
+
}
|
|
67326
|
+
// Encode the data for a function call (e.g. tx.data)
|
|
67327
|
+
encodeFunctionData(functionFragment, values) {
|
|
67328
|
+
if (typeof functionFragment === "string") {
|
|
67329
|
+
functionFragment = this.getFunction(functionFragment);
|
|
67330
|
+
}
|
|
67331
|
+
return hexlify(concat([
|
|
67332
|
+
this.getSighash(functionFragment),
|
|
67333
|
+
this._encodeParams(functionFragment.inputs, values || [])
|
|
67334
|
+
]));
|
|
67335
|
+
}
|
|
67336
|
+
// Decode the result from a function call (e.g. from eth_call)
|
|
67337
|
+
decodeFunctionResult(functionFragment, data) {
|
|
67338
|
+
if (typeof functionFragment === "string") {
|
|
67339
|
+
functionFragment = this.getFunction(functionFragment);
|
|
67340
|
+
}
|
|
67341
|
+
let bytes = arrayify(data);
|
|
67342
|
+
let reason = null;
|
|
67343
|
+
let message = "";
|
|
67344
|
+
let errorArgs = null;
|
|
67345
|
+
let errorName = null;
|
|
67346
|
+
let errorSignature = null;
|
|
67347
|
+
switch (bytes.length % this._abiCoder._getWordSize()) {
|
|
67348
|
+
case 0:
|
|
67349
|
+
try {
|
|
67350
|
+
return this._abiCoder.decode(functionFragment.outputs, bytes);
|
|
67351
|
+
} catch (error) {
|
|
67352
|
+
}
|
|
67353
|
+
break;
|
|
67354
|
+
case 4: {
|
|
67355
|
+
const selector = hexlify(bytes.slice(0, 4));
|
|
67356
|
+
const builtin = BuiltinErrors[selector];
|
|
67357
|
+
if (builtin) {
|
|
67358
|
+
errorArgs = this._abiCoder.decode(builtin.inputs, bytes.slice(4));
|
|
67359
|
+
errorName = builtin.name;
|
|
67360
|
+
errorSignature = builtin.signature;
|
|
67361
|
+
if (builtin.reason) {
|
|
67362
|
+
reason = errorArgs[0];
|
|
67363
|
+
}
|
|
67364
|
+
if (errorName === "Error") {
|
|
67365
|
+
message = `; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(errorArgs[0])}`;
|
|
67366
|
+
} else if (errorName === "Panic") {
|
|
67367
|
+
message = `; VM Exception while processing transaction: reverted with panic code ${errorArgs[0]}`;
|
|
67368
|
+
}
|
|
67369
|
+
} else {
|
|
67370
|
+
try {
|
|
67371
|
+
const error = this.getError(selector);
|
|
67372
|
+
errorArgs = this._abiCoder.decode(error.inputs, bytes.slice(4));
|
|
67373
|
+
errorName = error.name;
|
|
67374
|
+
errorSignature = error.format();
|
|
67375
|
+
} catch (error) {
|
|
67376
|
+
}
|
|
67377
|
+
}
|
|
67378
|
+
break;
|
|
67379
|
+
}
|
|
67380
|
+
}
|
|
67381
|
+
return logger10.throwError("call revert exception" + message, Logger.errors.CALL_EXCEPTION, {
|
|
67382
|
+
method: functionFragment.format(),
|
|
67383
|
+
data: hexlify(data),
|
|
67384
|
+
errorArgs,
|
|
67385
|
+
errorName,
|
|
67386
|
+
errorSignature,
|
|
67387
|
+
reason
|
|
67388
|
+
});
|
|
67389
|
+
}
|
|
67390
|
+
// Encode the result for a function call (e.g. for eth_call)
|
|
67391
|
+
encodeFunctionResult(functionFragment, values) {
|
|
67392
|
+
if (typeof functionFragment === "string") {
|
|
67393
|
+
functionFragment = this.getFunction(functionFragment);
|
|
67394
|
+
}
|
|
67395
|
+
return hexlify(this._abiCoder.encode(functionFragment.outputs, values || []));
|
|
67396
|
+
}
|
|
67397
|
+
// Create the filter for the event with search criteria (e.g. for eth_filterLog)
|
|
67398
|
+
encodeFilterTopics(eventFragment, values) {
|
|
67399
|
+
if (typeof eventFragment === "string") {
|
|
67400
|
+
eventFragment = this.getEvent(eventFragment);
|
|
67401
|
+
}
|
|
67402
|
+
if (values.length > eventFragment.inputs.length) {
|
|
67403
|
+
logger10.throwError("too many arguments for " + eventFragment.format(), Logger.errors.UNEXPECTED_ARGUMENT, {
|
|
67404
|
+
argument: "values",
|
|
67405
|
+
value: values
|
|
67406
|
+
});
|
|
67407
|
+
}
|
|
67408
|
+
let topics = [];
|
|
67409
|
+
if (!eventFragment.anonymous) {
|
|
67410
|
+
topics.push(this.getEventTopic(eventFragment));
|
|
67411
|
+
}
|
|
67412
|
+
const encodeTopic = (param, value) => {
|
|
67413
|
+
if (param.type === "string") {
|
|
67414
|
+
return id(value);
|
|
67415
|
+
} else if (param.type === "bytes") {
|
|
67416
|
+
return keccak256(hexlify(value));
|
|
67417
|
+
}
|
|
67418
|
+
if (param.type === "bool" && typeof value === "boolean") {
|
|
67419
|
+
value = value ? "0x01" : "0x00";
|
|
67420
|
+
}
|
|
67421
|
+
if (param.type.match(/^u?int/)) {
|
|
67422
|
+
value = BigNumber.from(value).toHexString();
|
|
67423
|
+
}
|
|
67424
|
+
if (param.type === "address") {
|
|
67425
|
+
this._abiCoder.encode(["address"], [value]);
|
|
67426
|
+
}
|
|
67427
|
+
return hexZeroPad(hexlify(value), 32);
|
|
67428
|
+
};
|
|
67429
|
+
values.forEach((value, index) => {
|
|
67430
|
+
let param = eventFragment.inputs[index];
|
|
67431
|
+
if (!param.indexed) {
|
|
67432
|
+
if (value != null) {
|
|
67433
|
+
logger10.throwArgumentError("cannot filter non-indexed parameters; must be null", "contract." + param.name, value);
|
|
67434
|
+
}
|
|
67435
|
+
return;
|
|
67436
|
+
}
|
|
67437
|
+
if (value == null) {
|
|
67438
|
+
topics.push(null);
|
|
67439
|
+
} else if (param.baseType === "array" || param.baseType === "tuple") {
|
|
67440
|
+
logger10.throwArgumentError("filtering with tuples or arrays not supported", "contract." + param.name, value);
|
|
67441
|
+
} else if (Array.isArray(value)) {
|
|
67442
|
+
topics.push(value.map((value2) => encodeTopic(param, value2)));
|
|
67443
|
+
} else {
|
|
67444
|
+
topics.push(encodeTopic(param, value));
|
|
67445
|
+
}
|
|
67446
|
+
});
|
|
67447
|
+
while (topics.length && topics[topics.length - 1] === null) {
|
|
67448
|
+
topics.pop();
|
|
67449
|
+
}
|
|
67450
|
+
return topics;
|
|
67451
|
+
}
|
|
67452
|
+
encodeEventLog(eventFragment, values) {
|
|
67453
|
+
if (typeof eventFragment === "string") {
|
|
67454
|
+
eventFragment = this.getEvent(eventFragment);
|
|
67455
|
+
}
|
|
67456
|
+
const topics = [];
|
|
67457
|
+
const dataTypes = [];
|
|
67458
|
+
const dataValues = [];
|
|
67459
|
+
if (!eventFragment.anonymous) {
|
|
67460
|
+
topics.push(this.getEventTopic(eventFragment));
|
|
67461
|
+
}
|
|
67462
|
+
if (values.length !== eventFragment.inputs.length) {
|
|
67463
|
+
logger10.throwArgumentError("event arguments/values mismatch", "values", values);
|
|
67464
|
+
}
|
|
67465
|
+
eventFragment.inputs.forEach((param, index) => {
|
|
67466
|
+
const value = values[index];
|
|
67467
|
+
if (param.indexed) {
|
|
67468
|
+
if (param.type === "string") {
|
|
67469
|
+
topics.push(id(value));
|
|
67470
|
+
} else if (param.type === "bytes") {
|
|
67471
|
+
topics.push(keccak256(value));
|
|
67472
|
+
} else if (param.baseType === "tuple" || param.baseType === "array") {
|
|
67473
|
+
throw new Error("not implemented");
|
|
67474
|
+
} else {
|
|
67475
|
+
topics.push(this._abiCoder.encode([param.type], [value]));
|
|
67476
|
+
}
|
|
67477
|
+
} else {
|
|
67478
|
+
dataTypes.push(param);
|
|
67479
|
+
dataValues.push(value);
|
|
67480
|
+
}
|
|
67481
|
+
});
|
|
67482
|
+
return {
|
|
67483
|
+
data: this._abiCoder.encode(dataTypes, dataValues),
|
|
67484
|
+
topics
|
|
67485
|
+
};
|
|
67486
|
+
}
|
|
67487
|
+
// Decode a filter for the event and the search criteria
|
|
67488
|
+
decodeEventLog(eventFragment, data, topics) {
|
|
67489
|
+
if (typeof eventFragment === "string") {
|
|
67490
|
+
eventFragment = this.getEvent(eventFragment);
|
|
67491
|
+
}
|
|
67492
|
+
if (topics != null && !eventFragment.anonymous) {
|
|
67493
|
+
let topicHash = this.getEventTopic(eventFragment);
|
|
67494
|
+
if (!isHexString(topics[0], 32) || topics[0].toLowerCase() !== topicHash) {
|
|
67495
|
+
logger10.throwError("fragment/topic mismatch", Logger.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] });
|
|
67496
|
+
}
|
|
67497
|
+
topics = topics.slice(1);
|
|
67498
|
+
}
|
|
67499
|
+
let indexed = [];
|
|
67500
|
+
let nonIndexed = [];
|
|
67501
|
+
let dynamic = [];
|
|
67502
|
+
eventFragment.inputs.forEach((param, index) => {
|
|
67503
|
+
if (param.indexed) {
|
|
67504
|
+
if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") {
|
|
67505
|
+
indexed.push(ParamType.fromObject({ type: "bytes32", name: param.name }));
|
|
67506
|
+
dynamic.push(true);
|
|
67507
|
+
} else {
|
|
67508
|
+
indexed.push(param);
|
|
67509
|
+
dynamic.push(false);
|
|
67510
|
+
}
|
|
67511
|
+
} else {
|
|
67512
|
+
nonIndexed.push(param);
|
|
67513
|
+
dynamic.push(false);
|
|
67514
|
+
}
|
|
67515
|
+
});
|
|
67516
|
+
let resultIndexed = topics != null ? this._abiCoder.decode(indexed, concat(topics)) : null;
|
|
67517
|
+
let resultNonIndexed = this._abiCoder.decode(nonIndexed, data, true);
|
|
67518
|
+
let result = [];
|
|
67519
|
+
let nonIndexedIndex = 0, indexedIndex = 0;
|
|
67520
|
+
eventFragment.inputs.forEach((param, index) => {
|
|
67521
|
+
if (param.indexed) {
|
|
67522
|
+
if (resultIndexed == null) {
|
|
67523
|
+
result[index] = new Indexed({ _isIndexed: true, hash: null });
|
|
67524
|
+
} else if (dynamic[index]) {
|
|
67525
|
+
result[index] = new Indexed({ _isIndexed: true, hash: resultIndexed[indexedIndex++] });
|
|
67526
|
+
} else {
|
|
67527
|
+
try {
|
|
67528
|
+
result[index] = resultIndexed[indexedIndex++];
|
|
67529
|
+
} catch (error) {
|
|
67530
|
+
result[index] = error;
|
|
67531
|
+
}
|
|
67532
|
+
}
|
|
67533
|
+
} else {
|
|
67534
|
+
try {
|
|
67535
|
+
result[index] = resultNonIndexed[nonIndexedIndex++];
|
|
67536
|
+
} catch (error) {
|
|
67537
|
+
result[index] = error;
|
|
67538
|
+
}
|
|
67539
|
+
}
|
|
67540
|
+
if (param.name && result[param.name] == null) {
|
|
67541
|
+
const value = result[index];
|
|
67542
|
+
if (value instanceof Error) {
|
|
67543
|
+
Object.defineProperty(result, param.name, {
|
|
67544
|
+
enumerable: true,
|
|
67545
|
+
get: () => {
|
|
67546
|
+
throw wrapAccessError(`property ${JSON.stringify(param.name)}`, value);
|
|
67547
|
+
}
|
|
67548
|
+
});
|
|
67549
|
+
} else {
|
|
67550
|
+
result[param.name] = value;
|
|
67551
|
+
}
|
|
67552
|
+
}
|
|
67553
|
+
});
|
|
67554
|
+
for (let i = 0; i < result.length; i++) {
|
|
67555
|
+
const value = result[i];
|
|
67556
|
+
if (value instanceof Error) {
|
|
67557
|
+
Object.defineProperty(result, i, {
|
|
67558
|
+
enumerable: true,
|
|
67559
|
+
get: () => {
|
|
67560
|
+
throw wrapAccessError(`index ${i}`, value);
|
|
67561
|
+
}
|
|
67562
|
+
});
|
|
67563
|
+
}
|
|
67564
|
+
}
|
|
67565
|
+
return Object.freeze(result);
|
|
67566
|
+
}
|
|
67567
|
+
// Given a transaction, find the matching function fragment (if any) and
|
|
67568
|
+
// determine all its properties and call parameters
|
|
67569
|
+
parseTransaction(tx) {
|
|
67570
|
+
let fragment = this.getFunction(tx.data.substring(0, 10).toLowerCase());
|
|
67571
|
+
if (!fragment) {
|
|
67572
|
+
return null;
|
|
67573
|
+
}
|
|
67574
|
+
return new TransactionDescription({
|
|
67575
|
+
args: this._abiCoder.decode(fragment.inputs, "0x" + tx.data.substring(10)),
|
|
67576
|
+
functionFragment: fragment,
|
|
67577
|
+
name: fragment.name,
|
|
67578
|
+
signature: fragment.format(),
|
|
67579
|
+
sighash: this.getSighash(fragment),
|
|
67580
|
+
value: BigNumber.from(tx.value || "0")
|
|
67581
|
+
});
|
|
67582
|
+
}
|
|
67583
|
+
// @TODO
|
|
67584
|
+
//parseCallResult(data: BytesLike): ??
|
|
67585
|
+
// Given an event log, find the matching event fragment (if any) and
|
|
67586
|
+
// determine all its properties and values
|
|
67587
|
+
parseLog(log) {
|
|
67588
|
+
let fragment = this.getEvent(log.topics[0]);
|
|
67589
|
+
if (!fragment || fragment.anonymous) {
|
|
67590
|
+
return null;
|
|
67591
|
+
}
|
|
67592
|
+
return new LogDescription({
|
|
67593
|
+
eventFragment: fragment,
|
|
67594
|
+
name: fragment.name,
|
|
67595
|
+
signature: fragment.format(),
|
|
67596
|
+
topic: this.getEventTopic(fragment),
|
|
67597
|
+
args: this.decodeEventLog(fragment, log.data, log.topics)
|
|
67598
|
+
});
|
|
67599
|
+
}
|
|
67600
|
+
parseError(data) {
|
|
67601
|
+
const hexData = hexlify(data);
|
|
67602
|
+
let fragment = this.getError(hexData.substring(0, 10).toLowerCase());
|
|
67603
|
+
if (!fragment) {
|
|
67604
|
+
return null;
|
|
67605
|
+
}
|
|
67606
|
+
return new ErrorDescription({
|
|
67607
|
+
args: this._abiCoder.decode(fragment.inputs, "0x" + hexData.substring(10)),
|
|
67608
|
+
errorFragment: fragment,
|
|
67609
|
+
name: fragment.name,
|
|
67610
|
+
signature: fragment.format(),
|
|
67611
|
+
sighash: this.getSighash(fragment)
|
|
67612
|
+
});
|
|
67613
|
+
}
|
|
67614
|
+
/*
|
|
67615
|
+
static from(value: Array<Fragment | string | JsonAbi> | string | Interface) {
|
|
67616
|
+
if (Interface.isInterface(value)) {
|
|
67617
|
+
return value;
|
|
67618
|
+
}
|
|
67619
|
+
if (typeof(value) === "string") {
|
|
67620
|
+
return new Interface(JSON.parse(value));
|
|
67621
|
+
}
|
|
67622
|
+
return new Interface(value);
|
|
67623
|
+
}
|
|
67624
|
+
*/
|
|
67625
|
+
static isInterface(value) {
|
|
67626
|
+
return !!(value && value._isInterface);
|
|
67627
|
+
}
|
|
67628
|
+
};
|
|
67629
|
+
|
|
66492
67630
|
// src/common/abi.ts
|
|
66493
67631
|
var parser = __toESM(require_index_cjs());
|
|
66494
67632
|
var encodeContructorArguments = (abi, args) => {
|
|
66495
67633
|
if (args == null || args.length === 0)
|
|
66496
67634
|
return void 0;
|
|
66497
|
-
const
|
|
66498
|
-
|
|
66499
|
-
if (!parseResult.success)
|
|
66500
|
-
return [];
|
|
66501
|
-
return [parseResult.data];
|
|
66502
|
-
}).at(0);
|
|
66503
|
-
assert4(fragment != null, `Missing constructor fragment`);
|
|
66504
|
-
const constructorArgumentTypes = fragment.inputs.map(({ type }) => type);
|
|
66505
|
-
const encodedConstructorArguments = defaultAbiCoder.encode(
|
|
66506
|
-
constructorArgumentTypes,
|
|
66507
|
-
args
|
|
66508
|
-
);
|
|
67635
|
+
const iface = new Interface(abi);
|
|
67636
|
+
const encodedConstructorArguments = iface.encodeDeploy(args);
|
|
66509
67637
|
return encodedConstructorArguments.slice(2);
|
|
66510
67638
|
};
|
|
66511
67639
|
var getContructorABIFromSource = (source) => {
|
|
@@ -66551,10 +67679,6 @@ var getTypeFromTypeName = (typeName) => {
|
|
|
66551
67679
|
);
|
|
66552
67680
|
}
|
|
66553
67681
|
};
|
|
66554
|
-
var ConstructorSchema = z.object({
|
|
66555
|
-
inputs: z.array(z.object({ type: z.string() })),
|
|
66556
|
-
type: z.literal("constructor")
|
|
66557
|
-
});
|
|
66558
67682
|
var parsePathsConfig = (partialPathsConfig) => {
|
|
66559
67683
|
var _a;
|
|
66560
67684
|
return {
|
|
@@ -66599,11 +67723,11 @@ var isFile2 = (pathlike) => {
|
|
|
66599
67723
|
return false;
|
|
66600
67724
|
}
|
|
66601
67725
|
};
|
|
66602
|
-
var verifyNonTarget = async (config,
|
|
66603
|
-
const networks = parseNetworksConfig(
|
|
67726
|
+
var verifyNonTarget = async (config, logger11) => {
|
|
67727
|
+
const networks = parseNetworksConfig(logger11, config.networks);
|
|
66604
67728
|
const paths = parsePathsConfig(config.paths);
|
|
66605
|
-
const recordLogger = createRecordLogger(
|
|
66606
|
-
const verifyAll = createVerifyAll(
|
|
67729
|
+
const recordLogger = createRecordLogger(logger11);
|
|
67730
|
+
const verifyAll = createVerifyAll(logger11);
|
|
66607
67731
|
const logResult = createLogVerificationResult(recordLogger);
|
|
66608
67732
|
const verificationArtifacts = config.contracts.flatMap(
|
|
66609
67733
|
(contract) => {
|
|
@@ -66614,12 +67738,12 @@ var verifyNonTarget = async (config, logger10) => {
|
|
|
66614
67738
|
contractName,
|
|
66615
67739
|
deployment: deploymentPathOrBasename
|
|
66616
67740
|
} = contract;
|
|
66617
|
-
|
|
67741
|
+
logger11.info(
|
|
66618
67742
|
`Collectiong information for contract ${contractName} on network ${network}`
|
|
66619
67743
|
);
|
|
66620
67744
|
const networkConfig = networks[network];
|
|
66621
67745
|
if (networkConfig == null) {
|
|
66622
|
-
|
|
67746
|
+
logger11.info(
|
|
66623
67747
|
`No network configured for contract ${contractName} on network ${network}`
|
|
66624
67748
|
);
|
|
66625
67749
|
return [];
|
|
@@ -66634,7 +67758,7 @@ var verifyNonTarget = async (config, logger10) => {
|
|
|
66634
67758
|
deploymentPath
|
|
66635
67759
|
);
|
|
66636
67760
|
if (!isFile2(contractDeploymentPath)) {
|
|
66637
|
-
|
|
67761
|
+
logger11.error(
|
|
66638
67762
|
COLORS.error`Deployment file ${contractDeploymentPath} does not exist or is not a file`
|
|
66639
67763
|
);
|
|
66640
67764
|
return [];
|
|
@@ -66642,7 +67766,7 @@ var verifyNonTarget = async (config, logger10) => {
|
|
|
66642
67766
|
const rawDeployment = __require(contractDeploymentPath);
|
|
66643
67767
|
const deploymentParseResult = DeploymentSchema.safeParse(rawDeployment);
|
|
66644
67768
|
if (!deploymentParseResult.success) {
|
|
66645
|
-
|
|
67769
|
+
logger11.error(
|
|
66646
67770
|
COLORS.error`No network configured for contract ${contractName} on network ${network}`
|
|
66647
67771
|
);
|
|
66648
67772
|
return [];
|
|
@@ -66651,7 +67775,7 @@ var verifyNonTarget = async (config, logger10) => {
|
|
|
66651
67775
|
const contractClassName = basename(contractName, ".sol");
|
|
66652
67776
|
const source = deployment.metadata.sources[contractName];
|
|
66653
67777
|
if (source == null) {
|
|
66654
|
-
|
|
67778
|
+
logger11.error(
|
|
66655
67779
|
COLORS.error`Missing source for contract ${contractName} for network ${network} in ${deploymentPath}`
|
|
66656
67780
|
);
|
|
66657
67781
|
return [];
|
|
@@ -66695,38 +67819,38 @@ var verifyNonTarget = async (config, logger10) => {
|
|
|
66695
67819
|
}
|
|
66696
67820
|
);
|
|
66697
67821
|
if (verificationArtifacts.length === 0) {
|
|
66698
|
-
|
|
67822
|
+
logger11.warn("No contracts match the verification criteria, exiting");
|
|
66699
67823
|
return [];
|
|
66700
67824
|
}
|
|
66701
67825
|
if (config.dryRun) {
|
|
66702
|
-
|
|
67826
|
+
logger11.debug("Dry run enabled, exiting");
|
|
66703
67827
|
return [];
|
|
66704
67828
|
}
|
|
66705
67829
|
const results = await Promise.all(verifyAll(verificationArtifacts));
|
|
66706
67830
|
results.forEach(logResult);
|
|
66707
67831
|
return results;
|
|
66708
67832
|
};
|
|
66709
|
-
var verifyTarget = async (config,
|
|
67833
|
+
var verifyTarget = async (config, logger11) => {
|
|
66710
67834
|
const verify = parseFilterConfig(config.filter);
|
|
66711
|
-
const networks = parseNetworksConfig(
|
|
67835
|
+
const networks = parseNetworksConfig(logger11, config.networks);
|
|
66712
67836
|
const paths = parsePathsConfig(config.paths);
|
|
66713
|
-
const recordLogger = createRecordLogger(
|
|
66714
|
-
const verifyAll = createVerifyAll(
|
|
67837
|
+
const recordLogger = createRecordLogger(logger11);
|
|
67838
|
+
const verifyAll = createVerifyAll(logger11);
|
|
66715
67839
|
const logResult = createLogVerificationResult(recordLogger);
|
|
66716
67840
|
if (!isDirectory(paths.deployments)) {
|
|
66717
67841
|
throw new Error(`Path ${paths.deployments} is not a directory`);
|
|
66718
67842
|
}
|
|
66719
67843
|
const deployedNetworkNames = new Set(readdirSync(paths.deployments));
|
|
66720
67844
|
const networkConfigEntries = Object.entries(networks);
|
|
66721
|
-
|
|
67845
|
+
logger11.debug("Verifying deployments for following networks:");
|
|
66722
67846
|
networkConfigEntries.forEach(([networkName, networkConfig]) => {
|
|
66723
|
-
|
|
67847
|
+
logger11.debug(` - ${networkName} (API URL ${networkConfig.apiUrl})`);
|
|
66724
67848
|
});
|
|
66725
67849
|
const verificationArtifacts = networkConfigEntries.flatMap(
|
|
66726
67850
|
([networkName, networkConfig]) => {
|
|
66727
|
-
|
|
67851
|
+
logger11.info(`Collecting deployments for ${networkName}...`);
|
|
66728
67852
|
if (!deployedNetworkNames.has(networkName)) {
|
|
66729
|
-
|
|
67853
|
+
logger11.warn(
|
|
66730
67854
|
`Could not find deployment for network ${networkName} in ${paths.deployments}`
|
|
66731
67855
|
);
|
|
66732
67856
|
return [];
|
|
@@ -66737,7 +67861,7 @@ var verifyTarget = async (config, logger10) => {
|
|
|
66737
67861
|
).filter((fileName) => fileName.endsWith(".json"));
|
|
66738
67862
|
return deployedContractFileNames.flatMap((fileName) => {
|
|
66739
67863
|
var _a;
|
|
66740
|
-
|
|
67864
|
+
logger11.info(
|
|
66741
67865
|
`Inspecting deployment file ${fileName} on network ${networkName}`
|
|
66742
67866
|
);
|
|
66743
67867
|
const contractDeploymentPath = resolve(
|
|
@@ -66758,7 +67882,7 @@ var verifyTarget = async (config, logger10) => {
|
|
|
66758
67882
|
(contractIdentifier) => compilationTargets[contractIdentifier] === contractName
|
|
66759
67883
|
);
|
|
66760
67884
|
if (compilationTarget == null) {
|
|
66761
|
-
|
|
67885
|
+
logger11.error(
|
|
66762
67886
|
COLORS.error`Could not find contract ${contractName} in the deployment file ${fileName} for network ${networkName}`
|
|
66763
67887
|
);
|
|
66764
67888
|
return [];
|
|
@@ -66769,14 +67893,14 @@ var verifyTarget = async (config, logger10) => {
|
|
|
66769
67893
|
networkName
|
|
66770
67894
|
);
|
|
66771
67895
|
if (!shouldVerifyHardhatDeploy) {
|
|
66772
|
-
|
|
67896
|
+
logger11.debug(
|
|
66773
67897
|
`No contracts to verify in ${fileName} on network ${networkName}, skipping`
|
|
66774
67898
|
);
|
|
66775
67899
|
return [];
|
|
66776
67900
|
}
|
|
66777
67901
|
const source = deployment.metadata.sources[compilationTarget];
|
|
66778
67902
|
if (source == null) {
|
|
66779
|
-
|
|
67903
|
+
logger11.error(
|
|
66780
67904
|
COLORS.error`Could not find source for ${contractName} (${compilationTarget})`
|
|
66781
67905
|
);
|
|
66782
67906
|
return [];
|
|
@@ -66818,43 +67942,43 @@ var verifyTarget = async (config, logger10) => {
|
|
|
66818
67942
|
}
|
|
66819
67943
|
);
|
|
66820
67944
|
if (verificationArtifacts.length === 0) {
|
|
66821
|
-
|
|
67945
|
+
logger11.warn("No contracts match the verification criteria, exiting");
|
|
66822
67946
|
return [];
|
|
66823
67947
|
}
|
|
66824
67948
|
if (config.dryRun) {
|
|
66825
|
-
|
|
67949
|
+
logger11.debug("Dry run enabled, exiting");
|
|
66826
67950
|
return [];
|
|
66827
67951
|
}
|
|
66828
67952
|
const results = await Promise.all(verifyAll(verificationArtifacts));
|
|
66829
67953
|
results.forEach(logResult);
|
|
66830
67954
|
return results;
|
|
66831
67955
|
};
|
|
66832
|
-
var createVerifyAll = (
|
|
67956
|
+
var createVerifyAll = (logger11) => (artifacts) => {
|
|
66833
67957
|
return artifacts.map(async (artifact, index) => {
|
|
66834
67958
|
const { submitProps } = artifact;
|
|
66835
67959
|
const paletteColor = COLORS.palette[index % COLORS.palette.length];
|
|
66836
67960
|
const counter = `[${index + 1}/${artifacts.length}]`;
|
|
66837
67961
|
const contractName = import_chalk3.default.bold(submitProps.contractName);
|
|
66838
67962
|
const networkName = import_chalk3.default.bold(artifact.networkName);
|
|
66839
|
-
|
|
67963
|
+
logger11.info(
|
|
66840
67964
|
paletteColor`Verifying contract ${contractName} for network ${networkName} ${counter}`
|
|
66841
67965
|
);
|
|
66842
67966
|
try {
|
|
66843
67967
|
const verification = createVerification(submitProps);
|
|
66844
67968
|
verification.on("poll", (guid) => {
|
|
66845
|
-
|
|
67969
|
+
logger11.info(
|
|
66846
67970
|
paletteColor`Polling for verification status of ${contractName} for network ${networkName} (GUID ${guid}) ${counter}`
|
|
66847
67971
|
);
|
|
66848
67972
|
});
|
|
66849
67973
|
verification.on("retry", (error, attempt) => {
|
|
66850
|
-
|
|
67974
|
+
logger11.info(
|
|
66851
67975
|
paletteColor`Retrying failed verification attempt of ${contractName} for network ${networkName} (attempt ${attempt + 1}) ${counter}`
|
|
66852
67976
|
);
|
|
66853
67977
|
});
|
|
66854
67978
|
const result = await verification.verify();
|
|
66855
67979
|
return { artifact, result };
|
|
66856
67980
|
} catch (error) {
|
|
66857
|
-
|
|
67981
|
+
logger11.error(
|
|
66858
67982
|
COLORS.error`Problem verifying contract ${contractName} for network ${networkName} ${counter}: ${error} `
|
|
66859
67983
|
);
|
|
66860
67984
|
return { artifact, error };
|