@layerzerolabs/verify-contract 1.1.5 → 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.js
CHANGED
|
@@ -7022,9 +7022,9 @@ var require_winston_transport = __commonJS({
|
|
|
7022
7022
|
this.logv = options.logv;
|
|
7023
7023
|
if (options.close)
|
|
7024
7024
|
this.close = options.close;
|
|
7025
|
-
this.once("pipe", (
|
|
7026
|
-
this.levels =
|
|
7027
|
-
this.parent =
|
|
7025
|
+
this.once("pipe", (logger11) => {
|
|
7026
|
+
this.levels = logger11.levels;
|
|
7027
|
+
this.parent = logger11;
|
|
7028
7028
|
});
|
|
7029
7029
|
this.once("unpipe", (src) => {
|
|
7030
7030
|
if (src === this.parent) {
|
|
@@ -8000,7 +8000,7 @@ var require_diagnostics = __commonJS({
|
|
|
8000
8000
|
"node_modules/@dabh/diagnostics/diagnostics.js"(exports, module) {
|
|
8001
8001
|
var adapters = [];
|
|
8002
8002
|
var modifiers = [];
|
|
8003
|
-
var
|
|
8003
|
+
var logger11 = function devnull() {
|
|
8004
8004
|
};
|
|
8005
8005
|
function use(adapter) {
|
|
8006
8006
|
if (~adapters.indexOf(adapter))
|
|
@@ -8009,7 +8009,7 @@ var require_diagnostics = __commonJS({
|
|
|
8009
8009
|
return true;
|
|
8010
8010
|
}
|
|
8011
8011
|
function set(custom2) {
|
|
8012
|
-
|
|
8012
|
+
logger11 = custom2;
|
|
8013
8013
|
}
|
|
8014
8014
|
function enabled(namespace) {
|
|
8015
8015
|
var async = [];
|
|
@@ -8040,7 +8040,7 @@ var require_diagnostics = __commonJS({
|
|
|
8040
8040
|
return true;
|
|
8041
8041
|
}
|
|
8042
8042
|
function write() {
|
|
8043
|
-
|
|
8043
|
+
logger11.apply(logger11, arguments);
|
|
8044
8044
|
}
|
|
8045
8045
|
function process4(message) {
|
|
8046
8046
|
for (var i = 0; i < modifiers.length; i++) {
|
|
@@ -11194,11 +11194,11 @@ var require_exception_handler = __commonJS({
|
|
|
11194
11194
|
* TODO: add contructor description
|
|
11195
11195
|
* @param {!Logger} logger - TODO: add param description
|
|
11196
11196
|
*/
|
|
11197
|
-
constructor(
|
|
11198
|
-
if (!
|
|
11197
|
+
constructor(logger11) {
|
|
11198
|
+
if (!logger11) {
|
|
11199
11199
|
throw new Error("Logger is required to handle exceptions");
|
|
11200
11200
|
}
|
|
11201
|
-
this.logger =
|
|
11201
|
+
this.logger = logger11;
|
|
11202
11202
|
this.handlers = /* @__PURE__ */ new Map();
|
|
11203
11203
|
}
|
|
11204
11204
|
/**
|
|
@@ -11391,11 +11391,11 @@ var require_rejection_handler = __commonJS({
|
|
|
11391
11391
|
* TODO: add contructor description
|
|
11392
11392
|
* @param {!Logger} logger - TODO: add param description
|
|
11393
11393
|
*/
|
|
11394
|
-
constructor(
|
|
11395
|
-
if (!
|
|
11394
|
+
constructor(logger11) {
|
|
11395
|
+
if (!logger11) {
|
|
11396
11396
|
throw new Error("Logger is required to handle rejections");
|
|
11397
11397
|
}
|
|
11398
|
-
this.logger =
|
|
11398
|
+
this.logger = logger11;
|
|
11399
11399
|
this.handlers = /* @__PURE__ */ new Map();
|
|
11400
11400
|
}
|
|
11401
11401
|
/**
|
|
@@ -11591,11 +11591,11 @@ var require_profiler = __commonJS({
|
|
|
11591
11591
|
* @param {!Logger} logger - TODO: add param description.
|
|
11592
11592
|
* @private
|
|
11593
11593
|
*/
|
|
11594
|
-
constructor(
|
|
11595
|
-
if (!
|
|
11594
|
+
constructor(logger11) {
|
|
11595
|
+
if (!logger11) {
|
|
11596
11596
|
throw new Error("Logger is required for profiling.");
|
|
11597
11597
|
}
|
|
11598
|
-
this.logger =
|
|
11598
|
+
this.logger = logger11;
|
|
11599
11599
|
this.start = Date.now();
|
|
11600
11600
|
}
|
|
11601
11601
|
/**
|
|
@@ -11643,8 +11643,8 @@ var require_logger = __commonJS({
|
|
|
11643
11643
|
this.configure(options);
|
|
11644
11644
|
}
|
|
11645
11645
|
child(defaultRequestMetadata) {
|
|
11646
|
-
const
|
|
11647
|
-
return Object.create(
|
|
11646
|
+
const logger11 = this;
|
|
11647
|
+
return Object.create(logger11, {
|
|
11648
11648
|
write: {
|
|
11649
11649
|
value: function(info) {
|
|
11650
11650
|
const infoClone = Object.assign(
|
|
@@ -11656,7 +11656,7 @@ var require_logger = __commonJS({
|
|
|
11656
11656
|
infoClone.stack = info.stack;
|
|
11657
11657
|
infoClone.message = info.message;
|
|
11658
11658
|
}
|
|
11659
|
-
|
|
11659
|
+
logger11.write(infoClone);
|
|
11660
11660
|
}
|
|
11661
11661
|
}
|
|
11662
11662
|
});
|
|
@@ -12041,11 +12041,11 @@ var require_logger = __commonJS({
|
|
|
12041
12041
|
* @param {string} id Unique id of the profiler
|
|
12042
12042
|
* @returns {Logger} - TODO: add return description.
|
|
12043
12043
|
*/
|
|
12044
|
-
profile(
|
|
12044
|
+
profile(id2, ...args) {
|
|
12045
12045
|
const time = Date.now();
|
|
12046
|
-
if (this.profilers[
|
|
12047
|
-
const timeEnd = this.profilers[
|
|
12048
|
-
delete this.profilers[
|
|
12046
|
+
if (this.profilers[id2]) {
|
|
12047
|
+
const timeEnd = this.profilers[id2];
|
|
12048
|
+
delete this.profilers[id2];
|
|
12049
12049
|
if (typeof args[args.length - 2] === "function") {
|
|
12050
12050
|
console.warn(
|
|
12051
12051
|
"Callback function no longer supported as of winston@3.0.0"
|
|
@@ -12055,10 +12055,10 @@ var require_logger = __commonJS({
|
|
|
12055
12055
|
const info = typeof args[args.length - 1] === "object" ? args.pop() : {};
|
|
12056
12056
|
info.level = info.level || "info";
|
|
12057
12057
|
info.durationMs = time - timeEnd;
|
|
12058
|
-
info.message = info.message ||
|
|
12058
|
+
info.message = info.message || id2;
|
|
12059
12059
|
return this.write(info);
|
|
12060
12060
|
}
|
|
12061
|
-
this.profilers[
|
|
12061
|
+
this.profilers[id2] = time;
|
|
12062
12062
|
return this;
|
|
12063
12063
|
}
|
|
12064
12064
|
/**
|
|
@@ -12163,7 +12163,7 @@ var require_create_logger = __commonJS({
|
|
|
12163
12163
|
super(options);
|
|
12164
12164
|
}
|
|
12165
12165
|
}
|
|
12166
|
-
const
|
|
12166
|
+
const logger11 = new DerivedLogger(opts);
|
|
12167
12167
|
Object.keys(opts.levels).forEach(function(level) {
|
|
12168
12168
|
debug('Define prototype method for "%s"', level);
|
|
12169
12169
|
if (level === "log") {
|
|
@@ -12171,14 +12171,14 @@ var require_create_logger = __commonJS({
|
|
|
12171
12171
|
return;
|
|
12172
12172
|
}
|
|
12173
12173
|
DerivedLogger.prototype[level] = function(...args) {
|
|
12174
|
-
const self2 = this ||
|
|
12174
|
+
const self2 = this || logger11;
|
|
12175
12175
|
if (args.length === 1) {
|
|
12176
12176
|
const [msg] = args;
|
|
12177
12177
|
const info = msg && msg.message && msg || { message: msg };
|
|
12178
12178
|
info.level = info[LEVEL] = level;
|
|
12179
12179
|
self2._addDefaultMeta(info);
|
|
12180
12180
|
self2.write(info);
|
|
12181
|
-
return this ||
|
|
12181
|
+
return this || logger11;
|
|
12182
12182
|
}
|
|
12183
12183
|
if (args.length === 0) {
|
|
12184
12184
|
self2.log(level, "");
|
|
@@ -12187,10 +12187,10 @@ var require_create_logger = __commonJS({
|
|
|
12187
12187
|
return self2.log(level, ...args);
|
|
12188
12188
|
};
|
|
12189
12189
|
DerivedLogger.prototype[isLevelEnabledFunctionName(level)] = function() {
|
|
12190
|
-
return (this ||
|
|
12190
|
+
return (this || logger11).isLevelEnabled(level);
|
|
12191
12191
|
};
|
|
12192
12192
|
});
|
|
12193
|
-
return
|
|
12193
|
+
return logger11;
|
|
12194
12194
|
};
|
|
12195
12195
|
}
|
|
12196
12196
|
});
|
|
@@ -12216,8 +12216,8 @@ var require_container = __commonJS({
|
|
|
12216
12216
|
* @param {?Object} [options] - Options for the Logger instance.
|
|
12217
12217
|
* @returns {Logger} - A configured Logger instance with a specified id.
|
|
12218
12218
|
*/
|
|
12219
|
-
add(
|
|
12220
|
-
if (!this.loggers.has(
|
|
12219
|
+
add(id2, options) {
|
|
12220
|
+
if (!this.loggers.has(id2)) {
|
|
12221
12221
|
options = Object.assign({}, options || this.options);
|
|
12222
12222
|
const existing = options.transports || this.options.transports;
|
|
12223
12223
|
if (existing) {
|
|
@@ -12225,11 +12225,11 @@ var require_container = __commonJS({
|
|
|
12225
12225
|
} else {
|
|
12226
12226
|
options.transports = [];
|
|
12227
12227
|
}
|
|
12228
|
-
const
|
|
12229
|
-
|
|
12230
|
-
this.loggers.set(
|
|
12228
|
+
const logger11 = createLogger(options);
|
|
12229
|
+
logger11.on("close", () => this._delete(id2));
|
|
12230
|
+
this.loggers.set(id2, logger11);
|
|
12231
12231
|
}
|
|
12232
|
-
return this.loggers.get(
|
|
12232
|
+
return this.loggers.get(id2);
|
|
12233
12233
|
}
|
|
12234
12234
|
/**
|
|
12235
12235
|
* Retreives a `winston.Logger` instance for the specified `id`. If
|
|
@@ -12238,8 +12238,8 @@ var require_container = __commonJS({
|
|
|
12238
12238
|
* @param {?Object} [options] - Options for the Logger instance.
|
|
12239
12239
|
* @returns {Logger} - A configured Logger instance with a specified id.
|
|
12240
12240
|
*/
|
|
12241
|
-
get(
|
|
12242
|
-
return this.add(
|
|
12241
|
+
get(id2, options) {
|
|
12242
|
+
return this.add(id2, options);
|
|
12243
12243
|
}
|
|
12244
12244
|
/**
|
|
12245
12245
|
* Check if the container has a logger with the id.
|
|
@@ -12247,8 +12247,8 @@ var require_container = __commonJS({
|
|
|
12247
12247
|
* @returns {boolean} - Boolean value indicating if this instance has a
|
|
12248
12248
|
* logger with the specified `id`.
|
|
12249
12249
|
*/
|
|
12250
|
-
has(
|
|
12251
|
-
return !!this.loggers.has(
|
|
12250
|
+
has(id2) {
|
|
12251
|
+
return !!this.loggers.has(id2);
|
|
12252
12252
|
}
|
|
12253
12253
|
/**
|
|
12254
12254
|
* Closes a `Logger` instance with the specified `id` if it exists.
|
|
@@ -12256,9 +12256,9 @@ var require_container = __commonJS({
|
|
|
12256
12256
|
* @param {?string} id - The id of the Logger instance to close.
|
|
12257
12257
|
* @returns {undefined}
|
|
12258
12258
|
*/
|
|
12259
|
-
close(
|
|
12260
|
-
if (
|
|
12261
|
-
return this._removeLogger(
|
|
12259
|
+
close(id2) {
|
|
12260
|
+
if (id2) {
|
|
12261
|
+
return this._removeLogger(id2);
|
|
12262
12262
|
}
|
|
12263
12263
|
this.loggers.forEach((val, key) => this._removeLogger(key));
|
|
12264
12264
|
}
|
|
@@ -12268,13 +12268,13 @@ var require_container = __commonJS({
|
|
|
12268
12268
|
* @returns {undefined}
|
|
12269
12269
|
* @private
|
|
12270
12270
|
*/
|
|
12271
|
-
_removeLogger(
|
|
12272
|
-
if (!this.loggers.has(
|
|
12271
|
+
_removeLogger(id2) {
|
|
12272
|
+
if (!this.loggers.has(id2)) {
|
|
12273
12273
|
return;
|
|
12274
12274
|
}
|
|
12275
|
-
const
|
|
12276
|
-
|
|
12277
|
-
this._delete(
|
|
12275
|
+
const logger11 = this.loggers.get(id2);
|
|
12276
|
+
logger11.close();
|
|
12277
|
+
this._delete(id2);
|
|
12278
12278
|
}
|
|
12279
12279
|
/**
|
|
12280
12280
|
* Deletes a `Logger` instance with the specified `id`.
|
|
@@ -12283,8 +12283,8 @@ var require_container = __commonJS({
|
|
|
12283
12283
|
* @returns {undefined}
|
|
12284
12284
|
* @private
|
|
12285
12285
|
*/
|
|
12286
|
-
_delete(
|
|
12287
|
-
this.loggers.delete(
|
|
12286
|
+
_delete(id2) {
|
|
12287
|
+
this.loggers.delete(id2);
|
|
12288
12288
|
}
|
|
12289
12289
|
};
|
|
12290
12290
|
}
|
|
@@ -55335,18 +55335,18 @@ var anonymizeValue = (value) => {
|
|
|
55335
55335
|
const invisiblePart = Array.from({ length: invisibleLength }).fill("*").join("");
|
|
55336
55336
|
return `${visiblePart}${invisiblePart}`;
|
|
55337
55337
|
};
|
|
55338
|
-
var createRecordLogger = (
|
|
55339
|
-
|
|
55338
|
+
var createRecordLogger = (logger11, separator = " ") => (record) => {
|
|
55339
|
+
logger11.info("");
|
|
55340
55340
|
Object.entries(record).forEach(([label, value]) => {
|
|
55341
55341
|
if (Array.isArray(value)) {
|
|
55342
|
-
|
|
55342
|
+
logger11.info(`${label}:`);
|
|
55343
55343
|
value.forEach((item) => {
|
|
55344
|
-
|
|
55344
|
+
logger11.info(
|
|
55345
55345
|
`${separator} - ${import_chalk.default.bold(formatLoggableValue(item))}`
|
|
55346
55346
|
);
|
|
55347
55347
|
});
|
|
55348
55348
|
} else {
|
|
55349
|
-
|
|
55349
|
+
logger11.info(
|
|
55350
55350
|
`${label}:${separator}${import_chalk.default.bold(formatLoggableValue(value))}`
|
|
55351
55351
|
);
|
|
55352
55352
|
}
|
|
@@ -55367,7 +55367,7 @@ var FALSE_SYMBOL = COLORS.error`⚠`;
|
|
|
55367
55367
|
|
|
55368
55368
|
// src/common/config.ts
|
|
55369
55369
|
var import_chalk2 = __toESM(require_source());
|
|
55370
|
-
var parseNetworksConfig = (
|
|
55370
|
+
var parseNetworksConfig = (logger11, partialNetworksConfig) => {
|
|
55371
55371
|
return Object.entries(partialNetworksConfig != null ? partialNetworksConfig : {}).reduce(
|
|
55372
55372
|
(networksConfig, [networkName, networkConfig]) => {
|
|
55373
55373
|
if (networkConfig == null)
|
|
@@ -55388,7 +55388,7 @@ Please provide the API URL:
|
|
|
55388
55388
|
);
|
|
55389
55389
|
const apiKey = networkConfig.apiKey || getScanApiKeyFromEnv(networkName);
|
|
55390
55390
|
if (!apiKey) {
|
|
55391
|
-
|
|
55391
|
+
logger11.debug(`Could not find scan API key for network ${import_chalk2.default.bold(
|
|
55392
55392
|
networkName
|
|
55393
55393
|
)}
|
|
55394
55394
|
|
|
@@ -55400,7 +55400,7 @@ Please provide the API key:
|
|
|
55400
55400
|
}
|
|
55401
55401
|
const browserUrl = networkConfig.browserUrl || getScanBrowserUrlFromEnv(networkName) || tryGetScanBrowserUrlFromScanUrl(apiUrl);
|
|
55402
55402
|
if (!browserUrl) {
|
|
55403
|
-
|
|
55403
|
+
logger11.debug(`Could not find scan browser URL key for network ${import_chalk2.default.bold(
|
|
55404
55404
|
networkName
|
|
55405
55405
|
)}
|
|
55406
55406
|
|
|
@@ -64496,16 +64496,7 @@ z.record(
|
|
|
64496
64496
|
content: z.string()
|
|
64497
64497
|
})
|
|
64498
64498
|
);
|
|
64499
|
-
var MinimalAbiSchema = z.array(
|
|
64500
|
-
z.object({
|
|
64501
|
-
type: z.string(),
|
|
64502
|
-
inputs: z.array(
|
|
64503
|
-
z.object({
|
|
64504
|
-
type: z.string().optional()
|
|
64505
|
-
})
|
|
64506
|
-
).optional()
|
|
64507
|
-
})
|
|
64508
|
-
);
|
|
64499
|
+
var MinimalAbiSchema = z.array(z.record(z.string(), z.any()));
|
|
64509
64500
|
var MetadataSchema = z.object({
|
|
64510
64501
|
language: z.string(),
|
|
64511
64502
|
compiler: z.object({
|
|
@@ -65018,6 +65009,18 @@ function hexlify(value, options) {
|
|
|
65018
65009
|
}
|
|
65019
65010
|
return logger.throwArgumentError("invalid hexlify value", "value", value);
|
|
65020
65011
|
}
|
|
65012
|
+
function hexDataSlice(data, offset, endOffset) {
|
|
65013
|
+
if (typeof data !== "string") {
|
|
65014
|
+
data = hexlify(data);
|
|
65015
|
+
} else if (!isHexString(data) || data.length % 2) {
|
|
65016
|
+
logger.throwArgumentError("invalid hexData", "value", data);
|
|
65017
|
+
}
|
|
65018
|
+
offset = 2 + 2 * offset;
|
|
65019
|
+
if (endOffset != null) {
|
|
65020
|
+
return "0x" + data.substring(offset, 2 + 2 * endOffset);
|
|
65021
|
+
}
|
|
65022
|
+
return "0x" + data.substring(offset);
|
|
65023
|
+
}
|
|
65021
65024
|
function hexConcat(items) {
|
|
65022
65025
|
let result = "0x";
|
|
65023
65026
|
items.forEach((item) => {
|
|
@@ -65302,6 +65305,12 @@ function throwFault(fault, operation, value) {
|
|
|
65302
65305
|
function _base36To16(value) {
|
|
65303
65306
|
return new BN(value, 36).toString(16);
|
|
65304
65307
|
}
|
|
65308
|
+
|
|
65309
|
+
// node_modules/@ethersproject/properties/lib.esm/_version.js
|
|
65310
|
+
var version4 = "properties/5.7.0";
|
|
65311
|
+
|
|
65312
|
+
// node_modules/@ethersproject/properties/lib.esm/index.js
|
|
65313
|
+
var logger3 = new Logger(version4);
|
|
65305
65314
|
function defineReadOnly(object, name, value) {
|
|
65306
65315
|
Object.defineProperty(object, name, {
|
|
65307
65316
|
enumerable: true,
|
|
@@ -65309,6 +65318,73 @@ function defineReadOnly(object, name, value) {
|
|
|
65309
65318
|
writable: false
|
|
65310
65319
|
});
|
|
65311
65320
|
}
|
|
65321
|
+
function getStatic(ctor, key) {
|
|
65322
|
+
for (let i = 0; i < 32; i++) {
|
|
65323
|
+
if (ctor[key]) {
|
|
65324
|
+
return ctor[key];
|
|
65325
|
+
}
|
|
65326
|
+
if (!ctor.prototype || typeof ctor.prototype !== "object") {
|
|
65327
|
+
break;
|
|
65328
|
+
}
|
|
65329
|
+
ctor = Object.getPrototypeOf(ctor.prototype).constructor;
|
|
65330
|
+
}
|
|
65331
|
+
return null;
|
|
65332
|
+
}
|
|
65333
|
+
var opaque = { bigint: true, boolean: true, "function": true, number: true, string: true };
|
|
65334
|
+
function _isFrozen(object) {
|
|
65335
|
+
if (object === void 0 || object === null || opaque[typeof object]) {
|
|
65336
|
+
return true;
|
|
65337
|
+
}
|
|
65338
|
+
if (Array.isArray(object) || typeof object === "object") {
|
|
65339
|
+
if (!Object.isFrozen(object)) {
|
|
65340
|
+
return false;
|
|
65341
|
+
}
|
|
65342
|
+
const keys = Object.keys(object);
|
|
65343
|
+
for (let i = 0; i < keys.length; i++) {
|
|
65344
|
+
let value = null;
|
|
65345
|
+
try {
|
|
65346
|
+
value = object[keys[i]];
|
|
65347
|
+
} catch (error) {
|
|
65348
|
+
continue;
|
|
65349
|
+
}
|
|
65350
|
+
if (!_isFrozen(value)) {
|
|
65351
|
+
return false;
|
|
65352
|
+
}
|
|
65353
|
+
}
|
|
65354
|
+
return true;
|
|
65355
|
+
}
|
|
65356
|
+
return logger3.throwArgumentError(`Cannot deepCopy ${typeof object}`, "object", object);
|
|
65357
|
+
}
|
|
65358
|
+
function _deepCopy(object) {
|
|
65359
|
+
if (_isFrozen(object)) {
|
|
65360
|
+
return object;
|
|
65361
|
+
}
|
|
65362
|
+
if (Array.isArray(object)) {
|
|
65363
|
+
return Object.freeze(object.map((item) => deepCopy(item)));
|
|
65364
|
+
}
|
|
65365
|
+
if (typeof object === "object") {
|
|
65366
|
+
const result = {};
|
|
65367
|
+
for (const key in object) {
|
|
65368
|
+
const value = object[key];
|
|
65369
|
+
if (value === void 0) {
|
|
65370
|
+
continue;
|
|
65371
|
+
}
|
|
65372
|
+
defineReadOnly(result, key, deepCopy(value));
|
|
65373
|
+
}
|
|
65374
|
+
return result;
|
|
65375
|
+
}
|
|
65376
|
+
return logger3.throwArgumentError(`Cannot deepCopy ${typeof object}`, "object", object);
|
|
65377
|
+
}
|
|
65378
|
+
function deepCopy(object) {
|
|
65379
|
+
return _deepCopy(object);
|
|
65380
|
+
}
|
|
65381
|
+
var Description = class {
|
|
65382
|
+
constructor(info) {
|
|
65383
|
+
for (const key in info) {
|
|
65384
|
+
this[key] = deepCopy(info[key]);
|
|
65385
|
+
}
|
|
65386
|
+
}
|
|
65387
|
+
};
|
|
65312
65388
|
|
|
65313
65389
|
// node_modules/@ethersproject/abi/lib.esm/_version.js
|
|
65314
65390
|
var version5 = "abi/5.7.0";
|
|
@@ -65611,6 +65687,472 @@ var ParamType = class _ParamType {
|
|
|
65611
65687
|
return !!(value != null && value._isParamType);
|
|
65612
65688
|
}
|
|
65613
65689
|
};
|
|
65690
|
+
function parseParams(value, allowIndex) {
|
|
65691
|
+
return splitNesting(value).map((param) => ParamType.fromString(param, allowIndex));
|
|
65692
|
+
}
|
|
65693
|
+
var Fragment = class _Fragment {
|
|
65694
|
+
constructor(constructorGuard, params) {
|
|
65695
|
+
if (constructorGuard !== _constructorGuard2) {
|
|
65696
|
+
logger4.throwError("use a static from method", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
65697
|
+
operation: "new Fragment()"
|
|
65698
|
+
});
|
|
65699
|
+
}
|
|
65700
|
+
populate(this, params);
|
|
65701
|
+
this._isFragment = true;
|
|
65702
|
+
Object.freeze(this);
|
|
65703
|
+
}
|
|
65704
|
+
static from(value) {
|
|
65705
|
+
if (_Fragment.isFragment(value)) {
|
|
65706
|
+
return value;
|
|
65707
|
+
}
|
|
65708
|
+
if (typeof value === "string") {
|
|
65709
|
+
return _Fragment.fromString(value);
|
|
65710
|
+
}
|
|
65711
|
+
return _Fragment.fromObject(value);
|
|
65712
|
+
}
|
|
65713
|
+
static fromObject(value) {
|
|
65714
|
+
if (_Fragment.isFragment(value)) {
|
|
65715
|
+
return value;
|
|
65716
|
+
}
|
|
65717
|
+
switch (value.type) {
|
|
65718
|
+
case "function":
|
|
65719
|
+
return FunctionFragment.fromObject(value);
|
|
65720
|
+
case "event":
|
|
65721
|
+
return EventFragment.fromObject(value);
|
|
65722
|
+
case "constructor":
|
|
65723
|
+
return ConstructorFragment.fromObject(value);
|
|
65724
|
+
case "error":
|
|
65725
|
+
return ErrorFragment.fromObject(value);
|
|
65726
|
+
case "fallback":
|
|
65727
|
+
case "receive":
|
|
65728
|
+
return null;
|
|
65729
|
+
}
|
|
65730
|
+
return logger4.throwArgumentError("invalid fragment object", "value", value);
|
|
65731
|
+
}
|
|
65732
|
+
static fromString(value) {
|
|
65733
|
+
value = value.replace(/\s/g, " ");
|
|
65734
|
+
value = value.replace(/\(/g, " (").replace(/\)/g, ") ").replace(/\s+/g, " ");
|
|
65735
|
+
value = value.trim();
|
|
65736
|
+
if (value.split(" ")[0] === "event") {
|
|
65737
|
+
return EventFragment.fromString(value.substring(5).trim());
|
|
65738
|
+
} else if (value.split(" ")[0] === "function") {
|
|
65739
|
+
return FunctionFragment.fromString(value.substring(8).trim());
|
|
65740
|
+
} else if (value.split("(")[0].trim() === "constructor") {
|
|
65741
|
+
return ConstructorFragment.fromString(value.trim());
|
|
65742
|
+
} else if (value.split(" ")[0] === "error") {
|
|
65743
|
+
return ErrorFragment.fromString(value.substring(5).trim());
|
|
65744
|
+
}
|
|
65745
|
+
return logger4.throwArgumentError("unsupported fragment", "value", value);
|
|
65746
|
+
}
|
|
65747
|
+
static isFragment(value) {
|
|
65748
|
+
return !!(value && value._isFragment);
|
|
65749
|
+
}
|
|
65750
|
+
};
|
|
65751
|
+
var EventFragment = class _EventFragment extends Fragment {
|
|
65752
|
+
format(format2) {
|
|
65753
|
+
if (!format2) {
|
|
65754
|
+
format2 = FormatTypes.sighash;
|
|
65755
|
+
}
|
|
65756
|
+
if (!FormatTypes[format2]) {
|
|
65757
|
+
logger4.throwArgumentError("invalid format type", "format", format2);
|
|
65758
|
+
}
|
|
65759
|
+
if (format2 === FormatTypes.json) {
|
|
65760
|
+
return JSON.stringify({
|
|
65761
|
+
type: "event",
|
|
65762
|
+
anonymous: this.anonymous,
|
|
65763
|
+
name: this.name,
|
|
65764
|
+
inputs: this.inputs.map((input) => JSON.parse(input.format(format2)))
|
|
65765
|
+
});
|
|
65766
|
+
}
|
|
65767
|
+
let result = "";
|
|
65768
|
+
if (format2 !== FormatTypes.sighash) {
|
|
65769
|
+
result += "event ";
|
|
65770
|
+
}
|
|
65771
|
+
result += this.name + "(" + this.inputs.map((input) => input.format(format2)).join(format2 === FormatTypes.full ? ", " : ",") + ") ";
|
|
65772
|
+
if (format2 !== FormatTypes.sighash) {
|
|
65773
|
+
if (this.anonymous) {
|
|
65774
|
+
result += "anonymous ";
|
|
65775
|
+
}
|
|
65776
|
+
}
|
|
65777
|
+
return result.trim();
|
|
65778
|
+
}
|
|
65779
|
+
static from(value) {
|
|
65780
|
+
if (typeof value === "string") {
|
|
65781
|
+
return _EventFragment.fromString(value);
|
|
65782
|
+
}
|
|
65783
|
+
return _EventFragment.fromObject(value);
|
|
65784
|
+
}
|
|
65785
|
+
static fromObject(value) {
|
|
65786
|
+
if (_EventFragment.isEventFragment(value)) {
|
|
65787
|
+
return value;
|
|
65788
|
+
}
|
|
65789
|
+
if (value.type !== "event") {
|
|
65790
|
+
logger4.throwArgumentError("invalid event object", "value", value);
|
|
65791
|
+
}
|
|
65792
|
+
const params = {
|
|
65793
|
+
name: verifyIdentifier(value.name),
|
|
65794
|
+
anonymous: value.anonymous,
|
|
65795
|
+
inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : [],
|
|
65796
|
+
type: "event"
|
|
65797
|
+
};
|
|
65798
|
+
return new _EventFragment(_constructorGuard2, params);
|
|
65799
|
+
}
|
|
65800
|
+
static fromString(value) {
|
|
65801
|
+
let match = value.match(regexParen);
|
|
65802
|
+
if (!match) {
|
|
65803
|
+
logger4.throwArgumentError("invalid event string", "value", value);
|
|
65804
|
+
}
|
|
65805
|
+
let anonymous = false;
|
|
65806
|
+
match[3].split(" ").forEach((modifier) => {
|
|
65807
|
+
switch (modifier.trim()) {
|
|
65808
|
+
case "anonymous":
|
|
65809
|
+
anonymous = true;
|
|
65810
|
+
break;
|
|
65811
|
+
case "":
|
|
65812
|
+
break;
|
|
65813
|
+
default:
|
|
65814
|
+
logger4.warn("unknown modifier: " + modifier);
|
|
65815
|
+
}
|
|
65816
|
+
});
|
|
65817
|
+
return _EventFragment.fromObject({
|
|
65818
|
+
name: match[1].trim(),
|
|
65819
|
+
anonymous,
|
|
65820
|
+
inputs: parseParams(match[2], true),
|
|
65821
|
+
type: "event"
|
|
65822
|
+
});
|
|
65823
|
+
}
|
|
65824
|
+
static isEventFragment(value) {
|
|
65825
|
+
return value && value._isFragment && value.type === "event";
|
|
65826
|
+
}
|
|
65827
|
+
};
|
|
65828
|
+
function parseGas(value, params) {
|
|
65829
|
+
params.gas = null;
|
|
65830
|
+
let comps = value.split("@");
|
|
65831
|
+
if (comps.length !== 1) {
|
|
65832
|
+
if (comps.length > 2) {
|
|
65833
|
+
logger4.throwArgumentError("invalid human-readable ABI signature", "value", value);
|
|
65834
|
+
}
|
|
65835
|
+
if (!comps[1].match(/^[0-9]+$/)) {
|
|
65836
|
+
logger4.throwArgumentError("invalid human-readable ABI signature gas", "value", value);
|
|
65837
|
+
}
|
|
65838
|
+
params.gas = BigNumber.from(comps[1]);
|
|
65839
|
+
return comps[0];
|
|
65840
|
+
}
|
|
65841
|
+
return value;
|
|
65842
|
+
}
|
|
65843
|
+
function parseModifiers(value, params) {
|
|
65844
|
+
params.constant = false;
|
|
65845
|
+
params.payable = false;
|
|
65846
|
+
params.stateMutability = "nonpayable";
|
|
65847
|
+
value.split(" ").forEach((modifier) => {
|
|
65848
|
+
switch (modifier.trim()) {
|
|
65849
|
+
case "constant":
|
|
65850
|
+
params.constant = true;
|
|
65851
|
+
break;
|
|
65852
|
+
case "payable":
|
|
65853
|
+
params.payable = true;
|
|
65854
|
+
params.stateMutability = "payable";
|
|
65855
|
+
break;
|
|
65856
|
+
case "nonpayable":
|
|
65857
|
+
params.payable = false;
|
|
65858
|
+
params.stateMutability = "nonpayable";
|
|
65859
|
+
break;
|
|
65860
|
+
case "pure":
|
|
65861
|
+
params.constant = true;
|
|
65862
|
+
params.stateMutability = "pure";
|
|
65863
|
+
break;
|
|
65864
|
+
case "view":
|
|
65865
|
+
params.constant = true;
|
|
65866
|
+
params.stateMutability = "view";
|
|
65867
|
+
break;
|
|
65868
|
+
case "external":
|
|
65869
|
+
case "public":
|
|
65870
|
+
case "":
|
|
65871
|
+
break;
|
|
65872
|
+
default:
|
|
65873
|
+
console.log("unknown modifier: " + modifier);
|
|
65874
|
+
}
|
|
65875
|
+
});
|
|
65876
|
+
}
|
|
65877
|
+
function verifyState(value) {
|
|
65878
|
+
let result = {
|
|
65879
|
+
constant: false,
|
|
65880
|
+
payable: true,
|
|
65881
|
+
stateMutability: "payable"
|
|
65882
|
+
};
|
|
65883
|
+
if (value.stateMutability != null) {
|
|
65884
|
+
result.stateMutability = value.stateMutability;
|
|
65885
|
+
result.constant = result.stateMutability === "view" || result.stateMutability === "pure";
|
|
65886
|
+
if (value.constant != null) {
|
|
65887
|
+
if (!!value.constant !== result.constant) {
|
|
65888
|
+
logger4.throwArgumentError("cannot have constant function with mutability " + result.stateMutability, "value", value);
|
|
65889
|
+
}
|
|
65890
|
+
}
|
|
65891
|
+
result.payable = result.stateMutability === "payable";
|
|
65892
|
+
if (value.payable != null) {
|
|
65893
|
+
if (!!value.payable !== result.payable) {
|
|
65894
|
+
logger4.throwArgumentError("cannot have payable function with mutability " + result.stateMutability, "value", value);
|
|
65895
|
+
}
|
|
65896
|
+
}
|
|
65897
|
+
} else if (value.payable != null) {
|
|
65898
|
+
result.payable = !!value.payable;
|
|
65899
|
+
if (value.constant == null && !result.payable && value.type !== "constructor") {
|
|
65900
|
+
logger4.throwArgumentError("unable to determine stateMutability", "value", value);
|
|
65901
|
+
}
|
|
65902
|
+
result.constant = !!value.constant;
|
|
65903
|
+
if (result.constant) {
|
|
65904
|
+
result.stateMutability = "view";
|
|
65905
|
+
} else {
|
|
65906
|
+
result.stateMutability = result.payable ? "payable" : "nonpayable";
|
|
65907
|
+
}
|
|
65908
|
+
if (result.payable && result.constant) {
|
|
65909
|
+
logger4.throwArgumentError("cannot have constant payable function", "value", value);
|
|
65910
|
+
}
|
|
65911
|
+
} else if (value.constant != null) {
|
|
65912
|
+
result.constant = !!value.constant;
|
|
65913
|
+
result.payable = !result.constant;
|
|
65914
|
+
result.stateMutability = result.constant ? "view" : "payable";
|
|
65915
|
+
} else if (value.type !== "constructor") {
|
|
65916
|
+
logger4.throwArgumentError("unable to determine stateMutability", "value", value);
|
|
65917
|
+
}
|
|
65918
|
+
return result;
|
|
65919
|
+
}
|
|
65920
|
+
var ConstructorFragment = class _ConstructorFragment extends Fragment {
|
|
65921
|
+
format(format2) {
|
|
65922
|
+
if (!format2) {
|
|
65923
|
+
format2 = FormatTypes.sighash;
|
|
65924
|
+
}
|
|
65925
|
+
if (!FormatTypes[format2]) {
|
|
65926
|
+
logger4.throwArgumentError("invalid format type", "format", format2);
|
|
65927
|
+
}
|
|
65928
|
+
if (format2 === FormatTypes.json) {
|
|
65929
|
+
return JSON.stringify({
|
|
65930
|
+
type: "constructor",
|
|
65931
|
+
stateMutability: this.stateMutability !== "nonpayable" ? this.stateMutability : void 0,
|
|
65932
|
+
payable: this.payable,
|
|
65933
|
+
gas: this.gas ? this.gas.toNumber() : void 0,
|
|
65934
|
+
inputs: this.inputs.map((input) => JSON.parse(input.format(format2)))
|
|
65935
|
+
});
|
|
65936
|
+
}
|
|
65937
|
+
if (format2 === FormatTypes.sighash) {
|
|
65938
|
+
logger4.throwError("cannot format a constructor for sighash", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
65939
|
+
operation: "format(sighash)"
|
|
65940
|
+
});
|
|
65941
|
+
}
|
|
65942
|
+
let result = "constructor(" + this.inputs.map((input) => input.format(format2)).join(format2 === FormatTypes.full ? ", " : ",") + ") ";
|
|
65943
|
+
if (this.stateMutability && this.stateMutability !== "nonpayable") {
|
|
65944
|
+
result += this.stateMutability + " ";
|
|
65945
|
+
}
|
|
65946
|
+
return result.trim();
|
|
65947
|
+
}
|
|
65948
|
+
static from(value) {
|
|
65949
|
+
if (typeof value === "string") {
|
|
65950
|
+
return _ConstructorFragment.fromString(value);
|
|
65951
|
+
}
|
|
65952
|
+
return _ConstructorFragment.fromObject(value);
|
|
65953
|
+
}
|
|
65954
|
+
static fromObject(value) {
|
|
65955
|
+
if (_ConstructorFragment.isConstructorFragment(value)) {
|
|
65956
|
+
return value;
|
|
65957
|
+
}
|
|
65958
|
+
if (value.type !== "constructor") {
|
|
65959
|
+
logger4.throwArgumentError("invalid constructor object", "value", value);
|
|
65960
|
+
}
|
|
65961
|
+
let state = verifyState(value);
|
|
65962
|
+
if (state.constant) {
|
|
65963
|
+
logger4.throwArgumentError("constructor cannot be constant", "value", value);
|
|
65964
|
+
}
|
|
65965
|
+
const params = {
|
|
65966
|
+
name: null,
|
|
65967
|
+
type: value.type,
|
|
65968
|
+
inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : [],
|
|
65969
|
+
payable: state.payable,
|
|
65970
|
+
stateMutability: state.stateMutability,
|
|
65971
|
+
gas: value.gas ? BigNumber.from(value.gas) : null
|
|
65972
|
+
};
|
|
65973
|
+
return new _ConstructorFragment(_constructorGuard2, params);
|
|
65974
|
+
}
|
|
65975
|
+
static fromString(value) {
|
|
65976
|
+
let params = { type: "constructor" };
|
|
65977
|
+
value = parseGas(value, params);
|
|
65978
|
+
let parens = value.match(regexParen);
|
|
65979
|
+
if (!parens || parens[1].trim() !== "constructor") {
|
|
65980
|
+
logger4.throwArgumentError("invalid constructor string", "value", value);
|
|
65981
|
+
}
|
|
65982
|
+
params.inputs = parseParams(parens[2].trim(), false);
|
|
65983
|
+
parseModifiers(parens[3].trim(), params);
|
|
65984
|
+
return _ConstructorFragment.fromObject(params);
|
|
65985
|
+
}
|
|
65986
|
+
static isConstructorFragment(value) {
|
|
65987
|
+
return value && value._isFragment && value.type === "constructor";
|
|
65988
|
+
}
|
|
65989
|
+
};
|
|
65990
|
+
var FunctionFragment = class _FunctionFragment extends ConstructorFragment {
|
|
65991
|
+
format(format2) {
|
|
65992
|
+
if (!format2) {
|
|
65993
|
+
format2 = FormatTypes.sighash;
|
|
65994
|
+
}
|
|
65995
|
+
if (!FormatTypes[format2]) {
|
|
65996
|
+
logger4.throwArgumentError("invalid format type", "format", format2);
|
|
65997
|
+
}
|
|
65998
|
+
if (format2 === FormatTypes.json) {
|
|
65999
|
+
return JSON.stringify({
|
|
66000
|
+
type: "function",
|
|
66001
|
+
name: this.name,
|
|
66002
|
+
constant: this.constant,
|
|
66003
|
+
stateMutability: this.stateMutability !== "nonpayable" ? this.stateMutability : void 0,
|
|
66004
|
+
payable: this.payable,
|
|
66005
|
+
gas: this.gas ? this.gas.toNumber() : void 0,
|
|
66006
|
+
inputs: this.inputs.map((input) => JSON.parse(input.format(format2))),
|
|
66007
|
+
outputs: this.outputs.map((output) => JSON.parse(output.format(format2)))
|
|
66008
|
+
});
|
|
66009
|
+
}
|
|
66010
|
+
let result = "";
|
|
66011
|
+
if (format2 !== FormatTypes.sighash) {
|
|
66012
|
+
result += "function ";
|
|
66013
|
+
}
|
|
66014
|
+
result += this.name + "(" + this.inputs.map((input) => input.format(format2)).join(format2 === FormatTypes.full ? ", " : ",") + ") ";
|
|
66015
|
+
if (format2 !== FormatTypes.sighash) {
|
|
66016
|
+
if (this.stateMutability) {
|
|
66017
|
+
if (this.stateMutability !== "nonpayable") {
|
|
66018
|
+
result += this.stateMutability + " ";
|
|
66019
|
+
}
|
|
66020
|
+
} else if (this.constant) {
|
|
66021
|
+
result += "view ";
|
|
66022
|
+
}
|
|
66023
|
+
if (this.outputs && this.outputs.length) {
|
|
66024
|
+
result += "returns (" + this.outputs.map((output) => output.format(format2)).join(", ") + ") ";
|
|
66025
|
+
}
|
|
66026
|
+
if (this.gas != null) {
|
|
66027
|
+
result += "@" + this.gas.toString() + " ";
|
|
66028
|
+
}
|
|
66029
|
+
}
|
|
66030
|
+
return result.trim();
|
|
66031
|
+
}
|
|
66032
|
+
static from(value) {
|
|
66033
|
+
if (typeof value === "string") {
|
|
66034
|
+
return _FunctionFragment.fromString(value);
|
|
66035
|
+
}
|
|
66036
|
+
return _FunctionFragment.fromObject(value);
|
|
66037
|
+
}
|
|
66038
|
+
static fromObject(value) {
|
|
66039
|
+
if (_FunctionFragment.isFunctionFragment(value)) {
|
|
66040
|
+
return value;
|
|
66041
|
+
}
|
|
66042
|
+
if (value.type !== "function") {
|
|
66043
|
+
logger4.throwArgumentError("invalid function object", "value", value);
|
|
66044
|
+
}
|
|
66045
|
+
let state = verifyState(value);
|
|
66046
|
+
const params = {
|
|
66047
|
+
type: value.type,
|
|
66048
|
+
name: verifyIdentifier(value.name),
|
|
66049
|
+
constant: state.constant,
|
|
66050
|
+
inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : [],
|
|
66051
|
+
outputs: value.outputs ? value.outputs.map(ParamType.fromObject) : [],
|
|
66052
|
+
payable: state.payable,
|
|
66053
|
+
stateMutability: state.stateMutability,
|
|
66054
|
+
gas: value.gas ? BigNumber.from(value.gas) : null
|
|
66055
|
+
};
|
|
66056
|
+
return new _FunctionFragment(_constructorGuard2, params);
|
|
66057
|
+
}
|
|
66058
|
+
static fromString(value) {
|
|
66059
|
+
let params = { type: "function" };
|
|
66060
|
+
value = parseGas(value, params);
|
|
66061
|
+
let comps = value.split(" returns ");
|
|
66062
|
+
if (comps.length > 2) {
|
|
66063
|
+
logger4.throwArgumentError("invalid function string", "value", value);
|
|
66064
|
+
}
|
|
66065
|
+
let parens = comps[0].match(regexParen);
|
|
66066
|
+
if (!parens) {
|
|
66067
|
+
logger4.throwArgumentError("invalid function signature", "value", value);
|
|
66068
|
+
}
|
|
66069
|
+
params.name = parens[1].trim();
|
|
66070
|
+
if (params.name) {
|
|
66071
|
+
verifyIdentifier(params.name);
|
|
66072
|
+
}
|
|
66073
|
+
params.inputs = parseParams(parens[2], false);
|
|
66074
|
+
parseModifiers(parens[3].trim(), params);
|
|
66075
|
+
if (comps.length > 1) {
|
|
66076
|
+
let returns = comps[1].match(regexParen);
|
|
66077
|
+
if (returns[1].trim() != "" || returns[3].trim() != "") {
|
|
66078
|
+
logger4.throwArgumentError("unexpected tokens", "value", value);
|
|
66079
|
+
}
|
|
66080
|
+
params.outputs = parseParams(returns[2], false);
|
|
66081
|
+
} else {
|
|
66082
|
+
params.outputs = [];
|
|
66083
|
+
}
|
|
66084
|
+
return _FunctionFragment.fromObject(params);
|
|
66085
|
+
}
|
|
66086
|
+
static isFunctionFragment(value) {
|
|
66087
|
+
return value && value._isFragment && value.type === "function";
|
|
66088
|
+
}
|
|
66089
|
+
};
|
|
66090
|
+
function checkForbidden(fragment) {
|
|
66091
|
+
const sig = fragment.format();
|
|
66092
|
+
if (sig === "Error(string)" || sig === "Panic(uint256)") {
|
|
66093
|
+
logger4.throwArgumentError(`cannot specify user defined ${sig} error`, "fragment", fragment);
|
|
66094
|
+
}
|
|
66095
|
+
return fragment;
|
|
66096
|
+
}
|
|
66097
|
+
var ErrorFragment = class _ErrorFragment extends Fragment {
|
|
66098
|
+
format(format2) {
|
|
66099
|
+
if (!format2) {
|
|
66100
|
+
format2 = FormatTypes.sighash;
|
|
66101
|
+
}
|
|
66102
|
+
if (!FormatTypes[format2]) {
|
|
66103
|
+
logger4.throwArgumentError("invalid format type", "format", format2);
|
|
66104
|
+
}
|
|
66105
|
+
if (format2 === FormatTypes.json) {
|
|
66106
|
+
return JSON.stringify({
|
|
66107
|
+
type: "error",
|
|
66108
|
+
name: this.name,
|
|
66109
|
+
inputs: this.inputs.map((input) => JSON.parse(input.format(format2)))
|
|
66110
|
+
});
|
|
66111
|
+
}
|
|
66112
|
+
let result = "";
|
|
66113
|
+
if (format2 !== FormatTypes.sighash) {
|
|
66114
|
+
result += "error ";
|
|
66115
|
+
}
|
|
66116
|
+
result += this.name + "(" + this.inputs.map((input) => input.format(format2)).join(format2 === FormatTypes.full ? ", " : ",") + ") ";
|
|
66117
|
+
return result.trim();
|
|
66118
|
+
}
|
|
66119
|
+
static from(value) {
|
|
66120
|
+
if (typeof value === "string") {
|
|
66121
|
+
return _ErrorFragment.fromString(value);
|
|
66122
|
+
}
|
|
66123
|
+
return _ErrorFragment.fromObject(value);
|
|
66124
|
+
}
|
|
66125
|
+
static fromObject(value) {
|
|
66126
|
+
if (_ErrorFragment.isErrorFragment(value)) {
|
|
66127
|
+
return value;
|
|
66128
|
+
}
|
|
66129
|
+
if (value.type !== "error") {
|
|
66130
|
+
logger4.throwArgumentError("invalid error object", "value", value);
|
|
66131
|
+
}
|
|
66132
|
+
const params = {
|
|
66133
|
+
type: value.type,
|
|
66134
|
+
name: verifyIdentifier(value.name),
|
|
66135
|
+
inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : []
|
|
66136
|
+
};
|
|
66137
|
+
return checkForbidden(new _ErrorFragment(_constructorGuard2, params));
|
|
66138
|
+
}
|
|
66139
|
+
static fromString(value) {
|
|
66140
|
+
let params = { type: "error" };
|
|
66141
|
+
let parens = value.match(regexParen);
|
|
66142
|
+
if (!parens) {
|
|
66143
|
+
logger4.throwArgumentError("invalid error signature", "value", value);
|
|
66144
|
+
}
|
|
66145
|
+
params.name = parens[1].trim();
|
|
66146
|
+
if (params.name) {
|
|
66147
|
+
verifyIdentifier(params.name);
|
|
66148
|
+
}
|
|
66149
|
+
params.inputs = parseParams(parens[2], false);
|
|
66150
|
+
return checkForbidden(_ErrorFragment.fromObject(params));
|
|
66151
|
+
}
|
|
66152
|
+
static isErrorFragment(value) {
|
|
66153
|
+
return value && value._isFragment && value.type === "error";
|
|
66154
|
+
}
|
|
66155
|
+
};
|
|
65614
66156
|
function verifyType(type) {
|
|
65615
66157
|
if (type.match(/^uint($|[^1-9])/)) {
|
|
65616
66158
|
type = "uint256" + type.substring(4);
|
|
@@ -65619,6 +66161,41 @@ function verifyType(type) {
|
|
|
65619
66161
|
}
|
|
65620
66162
|
return type;
|
|
65621
66163
|
}
|
|
66164
|
+
var regexIdentifier = new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");
|
|
66165
|
+
function verifyIdentifier(value) {
|
|
66166
|
+
if (!value || !value.match(regexIdentifier)) {
|
|
66167
|
+
logger4.throwArgumentError(`invalid identifier "${value}"`, "value", value);
|
|
66168
|
+
}
|
|
66169
|
+
return value;
|
|
66170
|
+
}
|
|
66171
|
+
var regexParen = new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");
|
|
66172
|
+
function splitNesting(value) {
|
|
66173
|
+
value = value.trim();
|
|
66174
|
+
let result = [];
|
|
66175
|
+
let accum = "";
|
|
66176
|
+
let depth = 0;
|
|
66177
|
+
for (let offset = 0; offset < value.length; offset++) {
|
|
66178
|
+
let c = value[offset];
|
|
66179
|
+
if (c === "," && depth === 0) {
|
|
66180
|
+
result.push(accum);
|
|
66181
|
+
accum = "";
|
|
66182
|
+
} else {
|
|
66183
|
+
accum += c;
|
|
66184
|
+
if (c === "(") {
|
|
66185
|
+
depth++;
|
|
66186
|
+
} else if (c === ")") {
|
|
66187
|
+
depth--;
|
|
66188
|
+
if (depth === -1) {
|
|
66189
|
+
logger4.throwArgumentError("unbalanced parenthesis", "value", value);
|
|
66190
|
+
}
|
|
66191
|
+
}
|
|
66192
|
+
}
|
|
66193
|
+
}
|
|
66194
|
+
if (accum) {
|
|
66195
|
+
result.push(accum);
|
|
66196
|
+
}
|
|
66197
|
+
return result;
|
|
66198
|
+
}
|
|
65622
66199
|
|
|
65623
66200
|
// node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js
|
|
65624
66201
|
var logger5 = new Logger(version5);
|
|
@@ -66505,23 +67082,574 @@ var AbiCoder = class {
|
|
|
66505
67082
|
};
|
|
66506
67083
|
var defaultAbiCoder = new AbiCoder();
|
|
66507
67084
|
|
|
67085
|
+
// node_modules/@ethersproject/hash/lib.esm/id.js
|
|
67086
|
+
function id(text) {
|
|
67087
|
+
return keccak256(toUtf8Bytes(text));
|
|
67088
|
+
}
|
|
67089
|
+
|
|
67090
|
+
// node_modules/@ethersproject/abi/lib.esm/interface.js
|
|
67091
|
+
var logger10 = new Logger(version5);
|
|
67092
|
+
var LogDescription = class extends Description {
|
|
67093
|
+
};
|
|
67094
|
+
var TransactionDescription = class extends Description {
|
|
67095
|
+
};
|
|
67096
|
+
var ErrorDescription = class extends Description {
|
|
67097
|
+
};
|
|
67098
|
+
var Indexed = class extends Description {
|
|
67099
|
+
static isIndexed(value) {
|
|
67100
|
+
return !!(value && value._isIndexed);
|
|
67101
|
+
}
|
|
67102
|
+
};
|
|
67103
|
+
var BuiltinErrors = {
|
|
67104
|
+
"0x08c379a0": { signature: "Error(string)", name: "Error", inputs: ["string"], reason: true },
|
|
67105
|
+
"0x4e487b71": { signature: "Panic(uint256)", name: "Panic", inputs: ["uint256"] }
|
|
67106
|
+
};
|
|
67107
|
+
function wrapAccessError(property, error) {
|
|
67108
|
+
const wrap = new Error(`deferred error during ABI decoding triggered accessing ${property}`);
|
|
67109
|
+
wrap.error = error;
|
|
67110
|
+
return wrap;
|
|
67111
|
+
}
|
|
67112
|
+
var Interface = class {
|
|
67113
|
+
constructor(fragments) {
|
|
67114
|
+
let abi = [];
|
|
67115
|
+
if (typeof fragments === "string") {
|
|
67116
|
+
abi = JSON.parse(fragments);
|
|
67117
|
+
} else {
|
|
67118
|
+
abi = fragments;
|
|
67119
|
+
}
|
|
67120
|
+
defineReadOnly(this, "fragments", abi.map((fragment) => {
|
|
67121
|
+
return Fragment.from(fragment);
|
|
67122
|
+
}).filter((fragment) => fragment != null));
|
|
67123
|
+
defineReadOnly(this, "_abiCoder", getStatic(new.target, "getAbiCoder")());
|
|
67124
|
+
defineReadOnly(this, "functions", {});
|
|
67125
|
+
defineReadOnly(this, "errors", {});
|
|
67126
|
+
defineReadOnly(this, "events", {});
|
|
67127
|
+
defineReadOnly(this, "structs", {});
|
|
67128
|
+
this.fragments.forEach((fragment) => {
|
|
67129
|
+
let bucket = null;
|
|
67130
|
+
switch (fragment.type) {
|
|
67131
|
+
case "constructor":
|
|
67132
|
+
if (this.deploy) {
|
|
67133
|
+
logger10.warn("duplicate definition - constructor");
|
|
67134
|
+
return;
|
|
67135
|
+
}
|
|
67136
|
+
defineReadOnly(this, "deploy", fragment);
|
|
67137
|
+
return;
|
|
67138
|
+
case "function":
|
|
67139
|
+
bucket = this.functions;
|
|
67140
|
+
break;
|
|
67141
|
+
case "event":
|
|
67142
|
+
bucket = this.events;
|
|
67143
|
+
break;
|
|
67144
|
+
case "error":
|
|
67145
|
+
bucket = this.errors;
|
|
67146
|
+
break;
|
|
67147
|
+
default:
|
|
67148
|
+
return;
|
|
67149
|
+
}
|
|
67150
|
+
let signature = fragment.format();
|
|
67151
|
+
if (bucket[signature]) {
|
|
67152
|
+
logger10.warn("duplicate definition - " + signature);
|
|
67153
|
+
return;
|
|
67154
|
+
}
|
|
67155
|
+
bucket[signature] = fragment;
|
|
67156
|
+
});
|
|
67157
|
+
if (!this.deploy) {
|
|
67158
|
+
defineReadOnly(this, "deploy", ConstructorFragment.from({
|
|
67159
|
+
payable: false,
|
|
67160
|
+
type: "constructor"
|
|
67161
|
+
}));
|
|
67162
|
+
}
|
|
67163
|
+
defineReadOnly(this, "_isInterface", true);
|
|
67164
|
+
}
|
|
67165
|
+
format(format2) {
|
|
67166
|
+
if (!format2) {
|
|
67167
|
+
format2 = FormatTypes.full;
|
|
67168
|
+
}
|
|
67169
|
+
if (format2 === FormatTypes.sighash) {
|
|
67170
|
+
logger10.throwArgumentError("interface does not support formatting sighash", "format", format2);
|
|
67171
|
+
}
|
|
67172
|
+
const abi = this.fragments.map((fragment) => fragment.format(format2));
|
|
67173
|
+
if (format2 === FormatTypes.json) {
|
|
67174
|
+
return JSON.stringify(abi.map((j) => JSON.parse(j)));
|
|
67175
|
+
}
|
|
67176
|
+
return abi;
|
|
67177
|
+
}
|
|
67178
|
+
// Sub-classes can override these to handle other blockchains
|
|
67179
|
+
static getAbiCoder() {
|
|
67180
|
+
return defaultAbiCoder;
|
|
67181
|
+
}
|
|
67182
|
+
static getAddress(address) {
|
|
67183
|
+
return getAddress(address);
|
|
67184
|
+
}
|
|
67185
|
+
static getSighash(fragment) {
|
|
67186
|
+
return hexDataSlice(id(fragment.format()), 0, 4);
|
|
67187
|
+
}
|
|
67188
|
+
static getEventTopic(eventFragment) {
|
|
67189
|
+
return id(eventFragment.format());
|
|
67190
|
+
}
|
|
67191
|
+
// Find a function definition by any means necessary (unless it is ambiguous)
|
|
67192
|
+
getFunction(nameOrSignatureOrSighash) {
|
|
67193
|
+
if (isHexString(nameOrSignatureOrSighash)) {
|
|
67194
|
+
for (const name in this.functions) {
|
|
67195
|
+
if (nameOrSignatureOrSighash === this.getSighash(name)) {
|
|
67196
|
+
return this.functions[name];
|
|
67197
|
+
}
|
|
67198
|
+
}
|
|
67199
|
+
logger10.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash);
|
|
67200
|
+
}
|
|
67201
|
+
if (nameOrSignatureOrSighash.indexOf("(") === -1) {
|
|
67202
|
+
const name = nameOrSignatureOrSighash.trim();
|
|
67203
|
+
const matching = Object.keys(this.functions).filter((f) => f.split(
|
|
67204
|
+
"("
|
|
67205
|
+
/* fix:) */
|
|
67206
|
+
)[0] === name);
|
|
67207
|
+
if (matching.length === 0) {
|
|
67208
|
+
logger10.throwArgumentError("no matching function", "name", name);
|
|
67209
|
+
} else if (matching.length > 1) {
|
|
67210
|
+
logger10.throwArgumentError("multiple matching functions", "name", name);
|
|
67211
|
+
}
|
|
67212
|
+
return this.functions[matching[0]];
|
|
67213
|
+
}
|
|
67214
|
+
const result = this.functions[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
|
67215
|
+
if (!result) {
|
|
67216
|
+
logger10.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash);
|
|
67217
|
+
}
|
|
67218
|
+
return result;
|
|
67219
|
+
}
|
|
67220
|
+
// Find an event definition by any means necessary (unless it is ambiguous)
|
|
67221
|
+
getEvent(nameOrSignatureOrTopic) {
|
|
67222
|
+
if (isHexString(nameOrSignatureOrTopic)) {
|
|
67223
|
+
const topichash = nameOrSignatureOrTopic.toLowerCase();
|
|
67224
|
+
for (const name in this.events) {
|
|
67225
|
+
if (topichash === this.getEventTopic(name)) {
|
|
67226
|
+
return this.events[name];
|
|
67227
|
+
}
|
|
67228
|
+
}
|
|
67229
|
+
logger10.throwArgumentError("no matching event", "topichash", topichash);
|
|
67230
|
+
}
|
|
67231
|
+
if (nameOrSignatureOrTopic.indexOf("(") === -1) {
|
|
67232
|
+
const name = nameOrSignatureOrTopic.trim();
|
|
67233
|
+
const matching = Object.keys(this.events).filter((f) => f.split(
|
|
67234
|
+
"("
|
|
67235
|
+
/* fix:) */
|
|
67236
|
+
)[0] === name);
|
|
67237
|
+
if (matching.length === 0) {
|
|
67238
|
+
logger10.throwArgumentError("no matching event", "name", name);
|
|
67239
|
+
} else if (matching.length > 1) {
|
|
67240
|
+
logger10.throwArgumentError("multiple matching events", "name", name);
|
|
67241
|
+
}
|
|
67242
|
+
return this.events[matching[0]];
|
|
67243
|
+
}
|
|
67244
|
+
const result = this.events[EventFragment.fromString(nameOrSignatureOrTopic).format()];
|
|
67245
|
+
if (!result) {
|
|
67246
|
+
logger10.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic);
|
|
67247
|
+
}
|
|
67248
|
+
return result;
|
|
67249
|
+
}
|
|
67250
|
+
// Find a function definition by any means necessary (unless it is ambiguous)
|
|
67251
|
+
getError(nameOrSignatureOrSighash) {
|
|
67252
|
+
if (isHexString(nameOrSignatureOrSighash)) {
|
|
67253
|
+
const getSighash = getStatic(this.constructor, "getSighash");
|
|
67254
|
+
for (const name in this.errors) {
|
|
67255
|
+
const error = this.errors[name];
|
|
67256
|
+
if (nameOrSignatureOrSighash === getSighash(error)) {
|
|
67257
|
+
return this.errors[name];
|
|
67258
|
+
}
|
|
67259
|
+
}
|
|
67260
|
+
logger10.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash);
|
|
67261
|
+
}
|
|
67262
|
+
if (nameOrSignatureOrSighash.indexOf("(") === -1) {
|
|
67263
|
+
const name = nameOrSignatureOrSighash.trim();
|
|
67264
|
+
const matching = Object.keys(this.errors).filter((f) => f.split(
|
|
67265
|
+
"("
|
|
67266
|
+
/* fix:) */
|
|
67267
|
+
)[0] === name);
|
|
67268
|
+
if (matching.length === 0) {
|
|
67269
|
+
logger10.throwArgumentError("no matching error", "name", name);
|
|
67270
|
+
} else if (matching.length > 1) {
|
|
67271
|
+
logger10.throwArgumentError("multiple matching errors", "name", name);
|
|
67272
|
+
}
|
|
67273
|
+
return this.errors[matching[0]];
|
|
67274
|
+
}
|
|
67275
|
+
const result = this.errors[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
|
67276
|
+
if (!result) {
|
|
67277
|
+
logger10.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash);
|
|
67278
|
+
}
|
|
67279
|
+
return result;
|
|
67280
|
+
}
|
|
67281
|
+
// Get the sighash (the bytes4 selector) used by Solidity to identify a function
|
|
67282
|
+
getSighash(fragment) {
|
|
67283
|
+
if (typeof fragment === "string") {
|
|
67284
|
+
try {
|
|
67285
|
+
fragment = this.getFunction(fragment);
|
|
67286
|
+
} catch (error) {
|
|
67287
|
+
try {
|
|
67288
|
+
fragment = this.getError(fragment);
|
|
67289
|
+
} catch (_) {
|
|
67290
|
+
throw error;
|
|
67291
|
+
}
|
|
67292
|
+
}
|
|
67293
|
+
}
|
|
67294
|
+
return getStatic(this.constructor, "getSighash")(fragment);
|
|
67295
|
+
}
|
|
67296
|
+
// Get the topic (the bytes32 hash) used by Solidity to identify an event
|
|
67297
|
+
getEventTopic(eventFragment) {
|
|
67298
|
+
if (typeof eventFragment === "string") {
|
|
67299
|
+
eventFragment = this.getEvent(eventFragment);
|
|
67300
|
+
}
|
|
67301
|
+
return getStatic(this.constructor, "getEventTopic")(eventFragment);
|
|
67302
|
+
}
|
|
67303
|
+
_decodeParams(params, data) {
|
|
67304
|
+
return this._abiCoder.decode(params, data);
|
|
67305
|
+
}
|
|
67306
|
+
_encodeParams(params, values) {
|
|
67307
|
+
return this._abiCoder.encode(params, values);
|
|
67308
|
+
}
|
|
67309
|
+
encodeDeploy(values) {
|
|
67310
|
+
return this._encodeParams(this.deploy.inputs, values || []);
|
|
67311
|
+
}
|
|
67312
|
+
decodeErrorResult(fragment, data) {
|
|
67313
|
+
if (typeof fragment === "string") {
|
|
67314
|
+
fragment = this.getError(fragment);
|
|
67315
|
+
}
|
|
67316
|
+
const bytes = arrayify(data);
|
|
67317
|
+
if (hexlify(bytes.slice(0, 4)) !== this.getSighash(fragment)) {
|
|
67318
|
+
logger10.throwArgumentError(`data signature does not match error ${fragment.name}.`, "data", hexlify(bytes));
|
|
67319
|
+
}
|
|
67320
|
+
return this._decodeParams(fragment.inputs, bytes.slice(4));
|
|
67321
|
+
}
|
|
67322
|
+
encodeErrorResult(fragment, values) {
|
|
67323
|
+
if (typeof fragment === "string") {
|
|
67324
|
+
fragment = this.getError(fragment);
|
|
67325
|
+
}
|
|
67326
|
+
return hexlify(concat([
|
|
67327
|
+
this.getSighash(fragment),
|
|
67328
|
+
this._encodeParams(fragment.inputs, values || [])
|
|
67329
|
+
]));
|
|
67330
|
+
}
|
|
67331
|
+
// Decode the data for a function call (e.g. tx.data)
|
|
67332
|
+
decodeFunctionData(functionFragment, data) {
|
|
67333
|
+
if (typeof functionFragment === "string") {
|
|
67334
|
+
functionFragment = this.getFunction(functionFragment);
|
|
67335
|
+
}
|
|
67336
|
+
const bytes = arrayify(data);
|
|
67337
|
+
if (hexlify(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) {
|
|
67338
|
+
logger10.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, "data", hexlify(bytes));
|
|
67339
|
+
}
|
|
67340
|
+
return this._decodeParams(functionFragment.inputs, bytes.slice(4));
|
|
67341
|
+
}
|
|
67342
|
+
// Encode the data for a function call (e.g. tx.data)
|
|
67343
|
+
encodeFunctionData(functionFragment, values) {
|
|
67344
|
+
if (typeof functionFragment === "string") {
|
|
67345
|
+
functionFragment = this.getFunction(functionFragment);
|
|
67346
|
+
}
|
|
67347
|
+
return hexlify(concat([
|
|
67348
|
+
this.getSighash(functionFragment),
|
|
67349
|
+
this._encodeParams(functionFragment.inputs, values || [])
|
|
67350
|
+
]));
|
|
67351
|
+
}
|
|
67352
|
+
// Decode the result from a function call (e.g. from eth_call)
|
|
67353
|
+
decodeFunctionResult(functionFragment, data) {
|
|
67354
|
+
if (typeof functionFragment === "string") {
|
|
67355
|
+
functionFragment = this.getFunction(functionFragment);
|
|
67356
|
+
}
|
|
67357
|
+
let bytes = arrayify(data);
|
|
67358
|
+
let reason = null;
|
|
67359
|
+
let message = "";
|
|
67360
|
+
let errorArgs = null;
|
|
67361
|
+
let errorName = null;
|
|
67362
|
+
let errorSignature = null;
|
|
67363
|
+
switch (bytes.length % this._abiCoder._getWordSize()) {
|
|
67364
|
+
case 0:
|
|
67365
|
+
try {
|
|
67366
|
+
return this._abiCoder.decode(functionFragment.outputs, bytes);
|
|
67367
|
+
} catch (error) {
|
|
67368
|
+
}
|
|
67369
|
+
break;
|
|
67370
|
+
case 4: {
|
|
67371
|
+
const selector = hexlify(bytes.slice(0, 4));
|
|
67372
|
+
const builtin = BuiltinErrors[selector];
|
|
67373
|
+
if (builtin) {
|
|
67374
|
+
errorArgs = this._abiCoder.decode(builtin.inputs, bytes.slice(4));
|
|
67375
|
+
errorName = builtin.name;
|
|
67376
|
+
errorSignature = builtin.signature;
|
|
67377
|
+
if (builtin.reason) {
|
|
67378
|
+
reason = errorArgs[0];
|
|
67379
|
+
}
|
|
67380
|
+
if (errorName === "Error") {
|
|
67381
|
+
message = `; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(errorArgs[0])}`;
|
|
67382
|
+
} else if (errorName === "Panic") {
|
|
67383
|
+
message = `; VM Exception while processing transaction: reverted with panic code ${errorArgs[0]}`;
|
|
67384
|
+
}
|
|
67385
|
+
} else {
|
|
67386
|
+
try {
|
|
67387
|
+
const error = this.getError(selector);
|
|
67388
|
+
errorArgs = this._abiCoder.decode(error.inputs, bytes.slice(4));
|
|
67389
|
+
errorName = error.name;
|
|
67390
|
+
errorSignature = error.format();
|
|
67391
|
+
} catch (error) {
|
|
67392
|
+
}
|
|
67393
|
+
}
|
|
67394
|
+
break;
|
|
67395
|
+
}
|
|
67396
|
+
}
|
|
67397
|
+
return logger10.throwError("call revert exception" + message, Logger.errors.CALL_EXCEPTION, {
|
|
67398
|
+
method: functionFragment.format(),
|
|
67399
|
+
data: hexlify(data),
|
|
67400
|
+
errorArgs,
|
|
67401
|
+
errorName,
|
|
67402
|
+
errorSignature,
|
|
67403
|
+
reason
|
|
67404
|
+
});
|
|
67405
|
+
}
|
|
67406
|
+
// Encode the result for a function call (e.g. for eth_call)
|
|
67407
|
+
encodeFunctionResult(functionFragment, values) {
|
|
67408
|
+
if (typeof functionFragment === "string") {
|
|
67409
|
+
functionFragment = this.getFunction(functionFragment);
|
|
67410
|
+
}
|
|
67411
|
+
return hexlify(this._abiCoder.encode(functionFragment.outputs, values || []));
|
|
67412
|
+
}
|
|
67413
|
+
// Create the filter for the event with search criteria (e.g. for eth_filterLog)
|
|
67414
|
+
encodeFilterTopics(eventFragment, values) {
|
|
67415
|
+
if (typeof eventFragment === "string") {
|
|
67416
|
+
eventFragment = this.getEvent(eventFragment);
|
|
67417
|
+
}
|
|
67418
|
+
if (values.length > eventFragment.inputs.length) {
|
|
67419
|
+
logger10.throwError("too many arguments for " + eventFragment.format(), Logger.errors.UNEXPECTED_ARGUMENT, {
|
|
67420
|
+
argument: "values",
|
|
67421
|
+
value: values
|
|
67422
|
+
});
|
|
67423
|
+
}
|
|
67424
|
+
let topics = [];
|
|
67425
|
+
if (!eventFragment.anonymous) {
|
|
67426
|
+
topics.push(this.getEventTopic(eventFragment));
|
|
67427
|
+
}
|
|
67428
|
+
const encodeTopic = (param, value) => {
|
|
67429
|
+
if (param.type === "string") {
|
|
67430
|
+
return id(value);
|
|
67431
|
+
} else if (param.type === "bytes") {
|
|
67432
|
+
return keccak256(hexlify(value));
|
|
67433
|
+
}
|
|
67434
|
+
if (param.type === "bool" && typeof value === "boolean") {
|
|
67435
|
+
value = value ? "0x01" : "0x00";
|
|
67436
|
+
}
|
|
67437
|
+
if (param.type.match(/^u?int/)) {
|
|
67438
|
+
value = BigNumber.from(value).toHexString();
|
|
67439
|
+
}
|
|
67440
|
+
if (param.type === "address") {
|
|
67441
|
+
this._abiCoder.encode(["address"], [value]);
|
|
67442
|
+
}
|
|
67443
|
+
return hexZeroPad(hexlify(value), 32);
|
|
67444
|
+
};
|
|
67445
|
+
values.forEach((value, index) => {
|
|
67446
|
+
let param = eventFragment.inputs[index];
|
|
67447
|
+
if (!param.indexed) {
|
|
67448
|
+
if (value != null) {
|
|
67449
|
+
logger10.throwArgumentError("cannot filter non-indexed parameters; must be null", "contract." + param.name, value);
|
|
67450
|
+
}
|
|
67451
|
+
return;
|
|
67452
|
+
}
|
|
67453
|
+
if (value == null) {
|
|
67454
|
+
topics.push(null);
|
|
67455
|
+
} else if (param.baseType === "array" || param.baseType === "tuple") {
|
|
67456
|
+
logger10.throwArgumentError("filtering with tuples or arrays not supported", "contract." + param.name, value);
|
|
67457
|
+
} else if (Array.isArray(value)) {
|
|
67458
|
+
topics.push(value.map((value2) => encodeTopic(param, value2)));
|
|
67459
|
+
} else {
|
|
67460
|
+
topics.push(encodeTopic(param, value));
|
|
67461
|
+
}
|
|
67462
|
+
});
|
|
67463
|
+
while (topics.length && topics[topics.length - 1] === null) {
|
|
67464
|
+
topics.pop();
|
|
67465
|
+
}
|
|
67466
|
+
return topics;
|
|
67467
|
+
}
|
|
67468
|
+
encodeEventLog(eventFragment, values) {
|
|
67469
|
+
if (typeof eventFragment === "string") {
|
|
67470
|
+
eventFragment = this.getEvent(eventFragment);
|
|
67471
|
+
}
|
|
67472
|
+
const topics = [];
|
|
67473
|
+
const dataTypes = [];
|
|
67474
|
+
const dataValues = [];
|
|
67475
|
+
if (!eventFragment.anonymous) {
|
|
67476
|
+
topics.push(this.getEventTopic(eventFragment));
|
|
67477
|
+
}
|
|
67478
|
+
if (values.length !== eventFragment.inputs.length) {
|
|
67479
|
+
logger10.throwArgumentError("event arguments/values mismatch", "values", values);
|
|
67480
|
+
}
|
|
67481
|
+
eventFragment.inputs.forEach((param, index) => {
|
|
67482
|
+
const value = values[index];
|
|
67483
|
+
if (param.indexed) {
|
|
67484
|
+
if (param.type === "string") {
|
|
67485
|
+
topics.push(id(value));
|
|
67486
|
+
} else if (param.type === "bytes") {
|
|
67487
|
+
topics.push(keccak256(value));
|
|
67488
|
+
} else if (param.baseType === "tuple" || param.baseType === "array") {
|
|
67489
|
+
throw new Error("not implemented");
|
|
67490
|
+
} else {
|
|
67491
|
+
topics.push(this._abiCoder.encode([param.type], [value]));
|
|
67492
|
+
}
|
|
67493
|
+
} else {
|
|
67494
|
+
dataTypes.push(param);
|
|
67495
|
+
dataValues.push(value);
|
|
67496
|
+
}
|
|
67497
|
+
});
|
|
67498
|
+
return {
|
|
67499
|
+
data: this._abiCoder.encode(dataTypes, dataValues),
|
|
67500
|
+
topics
|
|
67501
|
+
};
|
|
67502
|
+
}
|
|
67503
|
+
// Decode a filter for the event and the search criteria
|
|
67504
|
+
decodeEventLog(eventFragment, data, topics) {
|
|
67505
|
+
if (typeof eventFragment === "string") {
|
|
67506
|
+
eventFragment = this.getEvent(eventFragment);
|
|
67507
|
+
}
|
|
67508
|
+
if (topics != null && !eventFragment.anonymous) {
|
|
67509
|
+
let topicHash = this.getEventTopic(eventFragment);
|
|
67510
|
+
if (!isHexString(topics[0], 32) || topics[0].toLowerCase() !== topicHash) {
|
|
67511
|
+
logger10.throwError("fragment/topic mismatch", Logger.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] });
|
|
67512
|
+
}
|
|
67513
|
+
topics = topics.slice(1);
|
|
67514
|
+
}
|
|
67515
|
+
let indexed = [];
|
|
67516
|
+
let nonIndexed = [];
|
|
67517
|
+
let dynamic = [];
|
|
67518
|
+
eventFragment.inputs.forEach((param, index) => {
|
|
67519
|
+
if (param.indexed) {
|
|
67520
|
+
if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") {
|
|
67521
|
+
indexed.push(ParamType.fromObject({ type: "bytes32", name: param.name }));
|
|
67522
|
+
dynamic.push(true);
|
|
67523
|
+
} else {
|
|
67524
|
+
indexed.push(param);
|
|
67525
|
+
dynamic.push(false);
|
|
67526
|
+
}
|
|
67527
|
+
} else {
|
|
67528
|
+
nonIndexed.push(param);
|
|
67529
|
+
dynamic.push(false);
|
|
67530
|
+
}
|
|
67531
|
+
});
|
|
67532
|
+
let resultIndexed = topics != null ? this._abiCoder.decode(indexed, concat(topics)) : null;
|
|
67533
|
+
let resultNonIndexed = this._abiCoder.decode(nonIndexed, data, true);
|
|
67534
|
+
let result = [];
|
|
67535
|
+
let nonIndexedIndex = 0, indexedIndex = 0;
|
|
67536
|
+
eventFragment.inputs.forEach((param, index) => {
|
|
67537
|
+
if (param.indexed) {
|
|
67538
|
+
if (resultIndexed == null) {
|
|
67539
|
+
result[index] = new Indexed({ _isIndexed: true, hash: null });
|
|
67540
|
+
} else if (dynamic[index]) {
|
|
67541
|
+
result[index] = new Indexed({ _isIndexed: true, hash: resultIndexed[indexedIndex++] });
|
|
67542
|
+
} else {
|
|
67543
|
+
try {
|
|
67544
|
+
result[index] = resultIndexed[indexedIndex++];
|
|
67545
|
+
} catch (error) {
|
|
67546
|
+
result[index] = error;
|
|
67547
|
+
}
|
|
67548
|
+
}
|
|
67549
|
+
} else {
|
|
67550
|
+
try {
|
|
67551
|
+
result[index] = resultNonIndexed[nonIndexedIndex++];
|
|
67552
|
+
} catch (error) {
|
|
67553
|
+
result[index] = error;
|
|
67554
|
+
}
|
|
67555
|
+
}
|
|
67556
|
+
if (param.name && result[param.name] == null) {
|
|
67557
|
+
const value = result[index];
|
|
67558
|
+
if (value instanceof Error) {
|
|
67559
|
+
Object.defineProperty(result, param.name, {
|
|
67560
|
+
enumerable: true,
|
|
67561
|
+
get: () => {
|
|
67562
|
+
throw wrapAccessError(`property ${JSON.stringify(param.name)}`, value);
|
|
67563
|
+
}
|
|
67564
|
+
});
|
|
67565
|
+
} else {
|
|
67566
|
+
result[param.name] = value;
|
|
67567
|
+
}
|
|
67568
|
+
}
|
|
67569
|
+
});
|
|
67570
|
+
for (let i = 0; i < result.length; i++) {
|
|
67571
|
+
const value = result[i];
|
|
67572
|
+
if (value instanceof Error) {
|
|
67573
|
+
Object.defineProperty(result, i, {
|
|
67574
|
+
enumerable: true,
|
|
67575
|
+
get: () => {
|
|
67576
|
+
throw wrapAccessError(`index ${i}`, value);
|
|
67577
|
+
}
|
|
67578
|
+
});
|
|
67579
|
+
}
|
|
67580
|
+
}
|
|
67581
|
+
return Object.freeze(result);
|
|
67582
|
+
}
|
|
67583
|
+
// Given a transaction, find the matching function fragment (if any) and
|
|
67584
|
+
// determine all its properties and call parameters
|
|
67585
|
+
parseTransaction(tx) {
|
|
67586
|
+
let fragment = this.getFunction(tx.data.substring(0, 10).toLowerCase());
|
|
67587
|
+
if (!fragment) {
|
|
67588
|
+
return null;
|
|
67589
|
+
}
|
|
67590
|
+
return new TransactionDescription({
|
|
67591
|
+
args: this._abiCoder.decode(fragment.inputs, "0x" + tx.data.substring(10)),
|
|
67592
|
+
functionFragment: fragment,
|
|
67593
|
+
name: fragment.name,
|
|
67594
|
+
signature: fragment.format(),
|
|
67595
|
+
sighash: this.getSighash(fragment),
|
|
67596
|
+
value: BigNumber.from(tx.value || "0")
|
|
67597
|
+
});
|
|
67598
|
+
}
|
|
67599
|
+
// @TODO
|
|
67600
|
+
//parseCallResult(data: BytesLike): ??
|
|
67601
|
+
// Given an event log, find the matching event fragment (if any) and
|
|
67602
|
+
// determine all its properties and values
|
|
67603
|
+
parseLog(log) {
|
|
67604
|
+
let fragment = this.getEvent(log.topics[0]);
|
|
67605
|
+
if (!fragment || fragment.anonymous) {
|
|
67606
|
+
return null;
|
|
67607
|
+
}
|
|
67608
|
+
return new LogDescription({
|
|
67609
|
+
eventFragment: fragment,
|
|
67610
|
+
name: fragment.name,
|
|
67611
|
+
signature: fragment.format(),
|
|
67612
|
+
topic: this.getEventTopic(fragment),
|
|
67613
|
+
args: this.decodeEventLog(fragment, log.data, log.topics)
|
|
67614
|
+
});
|
|
67615
|
+
}
|
|
67616
|
+
parseError(data) {
|
|
67617
|
+
const hexData = hexlify(data);
|
|
67618
|
+
let fragment = this.getError(hexData.substring(0, 10).toLowerCase());
|
|
67619
|
+
if (!fragment) {
|
|
67620
|
+
return null;
|
|
67621
|
+
}
|
|
67622
|
+
return new ErrorDescription({
|
|
67623
|
+
args: this._abiCoder.decode(fragment.inputs, "0x" + hexData.substring(10)),
|
|
67624
|
+
errorFragment: fragment,
|
|
67625
|
+
name: fragment.name,
|
|
67626
|
+
signature: fragment.format(),
|
|
67627
|
+
sighash: this.getSighash(fragment)
|
|
67628
|
+
});
|
|
67629
|
+
}
|
|
67630
|
+
/*
|
|
67631
|
+
static from(value: Array<Fragment | string | JsonAbi> | string | Interface) {
|
|
67632
|
+
if (Interface.isInterface(value)) {
|
|
67633
|
+
return value;
|
|
67634
|
+
}
|
|
67635
|
+
if (typeof(value) === "string") {
|
|
67636
|
+
return new Interface(JSON.parse(value));
|
|
67637
|
+
}
|
|
67638
|
+
return new Interface(value);
|
|
67639
|
+
}
|
|
67640
|
+
*/
|
|
67641
|
+
static isInterface(value) {
|
|
67642
|
+
return !!(value && value._isInterface);
|
|
67643
|
+
}
|
|
67644
|
+
};
|
|
67645
|
+
|
|
66508
67646
|
// src/common/abi.ts
|
|
66509
67647
|
var parser = __toESM(require_index_cjs());
|
|
66510
67648
|
var encodeContructorArguments = (abi, args) => {
|
|
66511
67649
|
if (args == null || args.length === 0)
|
|
66512
67650
|
return void 0;
|
|
66513
|
-
const
|
|
66514
|
-
|
|
66515
|
-
if (!parseResult.success)
|
|
66516
|
-
return [];
|
|
66517
|
-
return [parseResult.data];
|
|
66518
|
-
}).at(0);
|
|
66519
|
-
assert4__default.default(fragment != null, `Missing constructor fragment`);
|
|
66520
|
-
const constructorArgumentTypes = fragment.inputs.map(({ type }) => type);
|
|
66521
|
-
const encodedConstructorArguments = defaultAbiCoder.encode(
|
|
66522
|
-
constructorArgumentTypes,
|
|
66523
|
-
args
|
|
66524
|
-
);
|
|
67651
|
+
const iface = new Interface(abi);
|
|
67652
|
+
const encodedConstructorArguments = iface.encodeDeploy(args);
|
|
66525
67653
|
return encodedConstructorArguments.slice(2);
|
|
66526
67654
|
};
|
|
66527
67655
|
var getContructorABIFromSource = (source) => {
|
|
@@ -66567,10 +67695,6 @@ var getTypeFromTypeName = (typeName) => {
|
|
|
66567
67695
|
);
|
|
66568
67696
|
}
|
|
66569
67697
|
};
|
|
66570
|
-
var ConstructorSchema = z.object({
|
|
66571
|
-
inputs: z.array(z.object({ type: z.string() })),
|
|
66572
|
-
type: z.literal("constructor")
|
|
66573
|
-
});
|
|
66574
67698
|
var parsePathsConfig = (partialPathsConfig) => {
|
|
66575
67699
|
var _a;
|
|
66576
67700
|
return {
|
|
@@ -66615,11 +67739,11 @@ var isFile2 = (pathlike) => {
|
|
|
66615
67739
|
return false;
|
|
66616
67740
|
}
|
|
66617
67741
|
};
|
|
66618
|
-
var verifyNonTarget = async (config,
|
|
66619
|
-
const networks = parseNetworksConfig(
|
|
67742
|
+
var verifyNonTarget = async (config, logger11) => {
|
|
67743
|
+
const networks = parseNetworksConfig(logger11, config.networks);
|
|
66620
67744
|
const paths = parsePathsConfig(config.paths);
|
|
66621
|
-
const recordLogger = createRecordLogger(
|
|
66622
|
-
const verifyAll = createVerifyAll(
|
|
67745
|
+
const recordLogger = createRecordLogger(logger11);
|
|
67746
|
+
const verifyAll = createVerifyAll(logger11);
|
|
66623
67747
|
const logResult = createLogVerificationResult(recordLogger);
|
|
66624
67748
|
const verificationArtifacts = config.contracts.flatMap(
|
|
66625
67749
|
(contract) => {
|
|
@@ -66630,12 +67754,12 @@ var verifyNonTarget = async (config, logger10) => {
|
|
|
66630
67754
|
contractName,
|
|
66631
67755
|
deployment: deploymentPathOrBasename
|
|
66632
67756
|
} = contract;
|
|
66633
|
-
|
|
67757
|
+
logger11.info(
|
|
66634
67758
|
`Collectiong information for contract ${contractName} on network ${network}`
|
|
66635
67759
|
);
|
|
66636
67760
|
const networkConfig = networks[network];
|
|
66637
67761
|
if (networkConfig == null) {
|
|
66638
|
-
|
|
67762
|
+
logger11.info(
|
|
66639
67763
|
`No network configured for contract ${contractName} on network ${network}`
|
|
66640
67764
|
);
|
|
66641
67765
|
return [];
|
|
@@ -66650,7 +67774,7 @@ var verifyNonTarget = async (config, logger10) => {
|
|
|
66650
67774
|
deploymentPath
|
|
66651
67775
|
);
|
|
66652
67776
|
if (!isFile2(contractDeploymentPath)) {
|
|
66653
|
-
|
|
67777
|
+
logger11.error(
|
|
66654
67778
|
COLORS.error`Deployment file ${contractDeploymentPath} does not exist or is not a file`
|
|
66655
67779
|
);
|
|
66656
67780
|
return [];
|
|
@@ -66658,7 +67782,7 @@ var verifyNonTarget = async (config, logger10) => {
|
|
|
66658
67782
|
const rawDeployment = __require(contractDeploymentPath);
|
|
66659
67783
|
const deploymentParseResult = DeploymentSchema.safeParse(rawDeployment);
|
|
66660
67784
|
if (!deploymentParseResult.success) {
|
|
66661
|
-
|
|
67785
|
+
logger11.error(
|
|
66662
67786
|
COLORS.error`No network configured for contract ${contractName} on network ${network}`
|
|
66663
67787
|
);
|
|
66664
67788
|
return [];
|
|
@@ -66667,7 +67791,7 @@ var verifyNonTarget = async (config, logger10) => {
|
|
|
66667
67791
|
const contractClassName = path.basename(contractName, ".sol");
|
|
66668
67792
|
const source = deployment.metadata.sources[contractName];
|
|
66669
67793
|
if (source == null) {
|
|
66670
|
-
|
|
67794
|
+
logger11.error(
|
|
66671
67795
|
COLORS.error`Missing source for contract ${contractName} for network ${network} in ${deploymentPath}`
|
|
66672
67796
|
);
|
|
66673
67797
|
return [];
|
|
@@ -66711,38 +67835,38 @@ var verifyNonTarget = async (config, logger10) => {
|
|
|
66711
67835
|
}
|
|
66712
67836
|
);
|
|
66713
67837
|
if (verificationArtifacts.length === 0) {
|
|
66714
|
-
|
|
67838
|
+
logger11.warn("No contracts match the verification criteria, exiting");
|
|
66715
67839
|
return [];
|
|
66716
67840
|
}
|
|
66717
67841
|
if (config.dryRun) {
|
|
66718
|
-
|
|
67842
|
+
logger11.debug("Dry run enabled, exiting");
|
|
66719
67843
|
return [];
|
|
66720
67844
|
}
|
|
66721
67845
|
const results = await Promise.all(verifyAll(verificationArtifacts));
|
|
66722
67846
|
results.forEach(logResult);
|
|
66723
67847
|
return results;
|
|
66724
67848
|
};
|
|
66725
|
-
var verifyTarget = async (config,
|
|
67849
|
+
var verifyTarget = async (config, logger11) => {
|
|
66726
67850
|
const verify = parseFilterConfig(config.filter);
|
|
66727
|
-
const networks = parseNetworksConfig(
|
|
67851
|
+
const networks = parseNetworksConfig(logger11, config.networks);
|
|
66728
67852
|
const paths = parsePathsConfig(config.paths);
|
|
66729
|
-
const recordLogger = createRecordLogger(
|
|
66730
|
-
const verifyAll = createVerifyAll(
|
|
67853
|
+
const recordLogger = createRecordLogger(logger11);
|
|
67854
|
+
const verifyAll = createVerifyAll(logger11);
|
|
66731
67855
|
const logResult = createLogVerificationResult(recordLogger);
|
|
66732
67856
|
if (!isDirectory(paths.deployments)) {
|
|
66733
67857
|
throw new Error(`Path ${paths.deployments} is not a directory`);
|
|
66734
67858
|
}
|
|
66735
67859
|
const deployedNetworkNames = new Set(fs.readdirSync(paths.deployments));
|
|
66736
67860
|
const networkConfigEntries = Object.entries(networks);
|
|
66737
|
-
|
|
67861
|
+
logger11.debug("Verifying deployments for following networks:");
|
|
66738
67862
|
networkConfigEntries.forEach(([networkName, networkConfig]) => {
|
|
66739
|
-
|
|
67863
|
+
logger11.debug(` - ${networkName} (API URL ${networkConfig.apiUrl})`);
|
|
66740
67864
|
});
|
|
66741
67865
|
const verificationArtifacts = networkConfigEntries.flatMap(
|
|
66742
67866
|
([networkName, networkConfig]) => {
|
|
66743
|
-
|
|
67867
|
+
logger11.info(`Collecting deployments for ${networkName}...`);
|
|
66744
67868
|
if (!deployedNetworkNames.has(networkName)) {
|
|
66745
|
-
|
|
67869
|
+
logger11.warn(
|
|
66746
67870
|
`Could not find deployment for network ${networkName} in ${paths.deployments}`
|
|
66747
67871
|
);
|
|
66748
67872
|
return [];
|
|
@@ -66753,7 +67877,7 @@ var verifyTarget = async (config, logger10) => {
|
|
|
66753
67877
|
).filter((fileName) => fileName.endsWith(".json"));
|
|
66754
67878
|
return deployedContractFileNames.flatMap((fileName) => {
|
|
66755
67879
|
var _a;
|
|
66756
|
-
|
|
67880
|
+
logger11.info(
|
|
66757
67881
|
`Inspecting deployment file ${fileName} on network ${networkName}`
|
|
66758
67882
|
);
|
|
66759
67883
|
const contractDeploymentPath = path.resolve(
|
|
@@ -66774,7 +67898,7 @@ var verifyTarget = async (config, logger10) => {
|
|
|
66774
67898
|
(contractIdentifier) => compilationTargets[contractIdentifier] === contractName
|
|
66775
67899
|
);
|
|
66776
67900
|
if (compilationTarget == null) {
|
|
66777
|
-
|
|
67901
|
+
logger11.error(
|
|
66778
67902
|
COLORS.error`Could not find contract ${contractName} in the deployment file ${fileName} for network ${networkName}`
|
|
66779
67903
|
);
|
|
66780
67904
|
return [];
|
|
@@ -66785,14 +67909,14 @@ var verifyTarget = async (config, logger10) => {
|
|
|
66785
67909
|
networkName
|
|
66786
67910
|
);
|
|
66787
67911
|
if (!shouldVerifyHardhatDeploy) {
|
|
66788
|
-
|
|
67912
|
+
logger11.debug(
|
|
66789
67913
|
`No contracts to verify in ${fileName} on network ${networkName}, skipping`
|
|
66790
67914
|
);
|
|
66791
67915
|
return [];
|
|
66792
67916
|
}
|
|
66793
67917
|
const source = deployment.metadata.sources[compilationTarget];
|
|
66794
67918
|
if (source == null) {
|
|
66795
|
-
|
|
67919
|
+
logger11.error(
|
|
66796
67920
|
COLORS.error`Could not find source for ${contractName} (${compilationTarget})`
|
|
66797
67921
|
);
|
|
66798
67922
|
return [];
|
|
@@ -66834,43 +67958,43 @@ var verifyTarget = async (config, logger10) => {
|
|
|
66834
67958
|
}
|
|
66835
67959
|
);
|
|
66836
67960
|
if (verificationArtifacts.length === 0) {
|
|
66837
|
-
|
|
67961
|
+
logger11.warn("No contracts match the verification criteria, exiting");
|
|
66838
67962
|
return [];
|
|
66839
67963
|
}
|
|
66840
67964
|
if (config.dryRun) {
|
|
66841
|
-
|
|
67965
|
+
logger11.debug("Dry run enabled, exiting");
|
|
66842
67966
|
return [];
|
|
66843
67967
|
}
|
|
66844
67968
|
const results = await Promise.all(verifyAll(verificationArtifacts));
|
|
66845
67969
|
results.forEach(logResult);
|
|
66846
67970
|
return results;
|
|
66847
67971
|
};
|
|
66848
|
-
var createVerifyAll = (
|
|
67972
|
+
var createVerifyAll = (logger11) => (artifacts) => {
|
|
66849
67973
|
return artifacts.map(async (artifact, index) => {
|
|
66850
67974
|
const { submitProps } = artifact;
|
|
66851
67975
|
const paletteColor = COLORS.palette[index % COLORS.palette.length];
|
|
66852
67976
|
const counter = `[${index + 1}/${artifacts.length}]`;
|
|
66853
67977
|
const contractName = import_chalk3.default.bold(submitProps.contractName);
|
|
66854
67978
|
const networkName = import_chalk3.default.bold(artifact.networkName);
|
|
66855
|
-
|
|
67979
|
+
logger11.info(
|
|
66856
67980
|
paletteColor`Verifying contract ${contractName} for network ${networkName} ${counter}`
|
|
66857
67981
|
);
|
|
66858
67982
|
try {
|
|
66859
67983
|
const verification = createVerification(submitProps);
|
|
66860
67984
|
verification.on("poll", (guid) => {
|
|
66861
|
-
|
|
67985
|
+
logger11.info(
|
|
66862
67986
|
paletteColor`Polling for verification status of ${contractName} for network ${networkName} (GUID ${guid}) ${counter}`
|
|
66863
67987
|
);
|
|
66864
67988
|
});
|
|
66865
67989
|
verification.on("retry", (error, attempt) => {
|
|
66866
|
-
|
|
67990
|
+
logger11.info(
|
|
66867
67991
|
paletteColor`Retrying failed verification attempt of ${contractName} for network ${networkName} (attempt ${attempt + 1}) ${counter}`
|
|
66868
67992
|
);
|
|
66869
67993
|
});
|
|
66870
67994
|
const result = await verification.verify();
|
|
66871
67995
|
return { artifact, result };
|
|
66872
67996
|
} catch (error) {
|
|
66873
|
-
|
|
67997
|
+
logger11.error(
|
|
66874
67998
|
COLORS.error`Problem verifying contract ${contractName} for network ${networkName} ${counter}: ${error} `
|
|
66875
67999
|
);
|
|
66876
68000
|
return { artifact, error };
|