@gearbox-protocol/deploy-tools 1.1.4 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +2 -0
  2. package/dist/index.js +573 -525
  3. package/package.json +11 -11
package/dist/index.js CHANGED
@@ -167,7 +167,7 @@ var require_argument = __commonJS({
167
167
  /**
168
168
  * Set the default value, and optionally supply the description to be displayed in the help.
169
169
  *
170
- * @param {any} value
170
+ * @param {*} value
171
171
  * @param {string} [description]
172
172
  * @return {Argument}
173
173
  */
@@ -312,8 +312,8 @@ var require_help = __commonJS({
312
312
  if (!this.showGlobalOptions)
313
313
  return [];
314
314
  const globalOptions = [];
315
- for (let parentCmd = cmd.parent; parentCmd; parentCmd = parentCmd.parent) {
316
- const visibleOptions = parentCmd.options.filter((option) => !option.hidden);
315
+ for (let ancestorCmd = cmd.parent; ancestorCmd; ancestorCmd = ancestorCmd.parent) {
316
+ const visibleOptions = ancestorCmd.options.filter((option) => !option.hidden);
317
317
  globalOptions.push(...visibleOptions);
318
318
  }
319
319
  if (this.sortOptions) {
@@ -329,12 +329,12 @@ var require_help = __commonJS({
329
329
  */
330
330
  visibleArguments(cmd) {
331
331
  if (cmd._argsDescription) {
332
- cmd._args.forEach((argument) => {
332
+ cmd.registeredArguments.forEach((argument) => {
333
333
  argument.description = argument.description || cmd._argsDescription[argument.name()] || "";
334
334
  });
335
335
  }
336
- if (cmd._args.find((argument) => argument.description)) {
337
- return cmd._args;
336
+ if (cmd.registeredArguments.find((argument) => argument.description)) {
337
+ return cmd.registeredArguments;
338
338
  }
339
339
  return [];
340
340
  }
@@ -345,7 +345,7 @@ var require_help = __commonJS({
345
345
  * @returns {string}
346
346
  */
347
347
  subcommandTerm(cmd) {
348
- const args = cmd._args.map((arg) => humanReadableArgName(arg)).join(" ");
348
+ const args = cmd.registeredArguments.map((arg) => humanReadableArgName(arg)).join(" ");
349
349
  return cmd._name + (cmd._aliases[0] ? "|" + cmd._aliases[0] : "") + (cmd.options.length ? " [options]" : "") + // simplistic check for non-help option
350
350
  (args ? " " + args : "");
351
351
  }
@@ -426,11 +426,11 @@ var require_help = __commonJS({
426
426
  if (cmd._aliases[0]) {
427
427
  cmdName = cmdName + "|" + cmd._aliases[0];
428
428
  }
429
- let parentCmdNames = "";
430
- for (let parentCmd = cmd.parent; parentCmd; parentCmd = parentCmd.parent) {
431
- parentCmdNames = parentCmd.name() + " " + parentCmdNames;
429
+ let ancestorCmdNames = "";
430
+ for (let ancestorCmd = cmd.parent; ancestorCmd; ancestorCmd = ancestorCmd.parent) {
431
+ ancestorCmdNames = ancestorCmd.name() + " " + ancestorCmdNames;
432
432
  }
433
- return parentCmdNames + cmdName + " " + cmd.usage();
433
+ return ancestorCmdNames + cmdName + " " + cmd.usage();
434
434
  }
435
435
  /**
436
436
  * Get the description for the command.
@@ -654,7 +654,7 @@ var require_option = __commonJS({
654
654
  /**
655
655
  * Set the default value, and optionally supply the description to be displayed in the help.
656
656
  *
657
- * @param {any} value
657
+ * @param {*} value
658
658
  * @param {string} [description]
659
659
  * @return {Option}
660
660
  */
@@ -671,7 +671,7 @@ var require_option = __commonJS({
671
671
  * new Option('--color').default('GREYSCALE').preset('RGB');
672
672
  * new Option('--donate [amount]').preset('20').argParser(parseFloat);
673
673
  *
674
- * @param {any} arg
674
+ * @param {*} arg
675
675
  * @return {Option}
676
676
  */
677
677
  preset(arg) {
@@ -852,7 +852,7 @@ var require_option = __commonJS({
852
852
  /**
853
853
  * Did the value come from the option, and not from possible matching dual option?
854
854
  *
855
- * @param {any} value
855
+ * @param {*} value
856
856
  * @param {Option} option
857
857
  * @returns {boolean}
858
858
  */
@@ -997,7 +997,8 @@ var require_command = __commonJS({
997
997
  this.parent = null;
998
998
  this._allowUnknownOption = false;
999
999
  this._allowExcessArguments = true;
1000
- this._args = [];
1000
+ this.registeredArguments = [];
1001
+ this._args = this.registeredArguments;
1001
1002
  this.args = [];
1002
1003
  this.rawArgs = [];
1003
1004
  this.processedArgs = [];
@@ -1069,6 +1070,17 @@ var require_command = __commonJS({
1069
1070
  this._showSuggestionAfterError = sourceCommand._showSuggestionAfterError;
1070
1071
  return this;
1071
1072
  }
1073
+ /**
1074
+ * @returns {Command[]}
1075
+ * @api private
1076
+ */
1077
+ _getCommandAndAncestors() {
1078
+ const result = [];
1079
+ for (let command = this; command; command = command.parent) {
1080
+ result.push(command);
1081
+ }
1082
+ return result;
1083
+ }
1072
1084
  /**
1073
1085
  * Define a command.
1074
1086
  *
@@ -1286,14 +1298,14 @@ var require_command = __commonJS({
1286
1298
  * @return {Command} `this` command for chaining
1287
1299
  */
1288
1300
  addArgument(argument) {
1289
- const previousArgument = this._args.slice(-1)[0];
1301
+ const previousArgument = this.registeredArguments.slice(-1)[0];
1290
1302
  if (previousArgument && previousArgument.variadic) {
1291
1303
  throw new Error(`only the last argument can be variadic '${previousArgument.name()}'`);
1292
1304
  }
1293
1305
  if (argument.required && argument.defaultValue !== void 0 && argument.parseArg === void 0) {
1294
1306
  throw new Error(`a default value for a required argument is never used: '${argument.name()}'`);
1295
1307
  }
1296
- this._args.push(argument);
1308
+ this.registeredArguments.push(argument);
1297
1309
  return this;
1298
1310
  }
1299
1311
  /**
@@ -1398,7 +1410,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1398
1410
  */
1399
1411
  action(fn) {
1400
1412
  const listener = (args) => {
1401
- const expectedArgsCount = this._args.length;
1413
+ const expectedArgsCount = this.registeredArguments.length;
1402
1414
  const actionArgs = args.slice(0, expectedArgsCount);
1403
1415
  if (this._storeOptionsAsProperties) {
1404
1416
  actionArgs[expectedArgsCount] = this;
@@ -1424,6 +1436,26 @@ Expecting one of '${allowedValues.join("', '")}'`);
1424
1436
  createOption(flags, description) {
1425
1437
  return new Option2(flags, description);
1426
1438
  }
1439
+ /**
1440
+ * Wrap parseArgs to catch 'commander.invalidArgument'.
1441
+ *
1442
+ * @param {Option | Argument} target
1443
+ * @param {string} value
1444
+ * @param {*} previous
1445
+ * @param {string} invalidArgumentMessage
1446
+ * @api private
1447
+ */
1448
+ _callParseArg(target, value, previous, invalidArgumentMessage) {
1449
+ try {
1450
+ return target.parseArg(value, previous);
1451
+ } catch (err) {
1452
+ if (err.code === "commander.invalidArgument") {
1453
+ const message = `${invalidArgumentMessage} ${err.message}`;
1454
+ this.error(message, { exitCode: err.exitCode, code: err.code });
1455
+ }
1456
+ throw err;
1457
+ }
1458
+ }
1427
1459
  /**
1428
1460
  * Add an option.
1429
1461
  *
@@ -1448,15 +1480,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1448
1480
  }
1449
1481
  const oldValue = this.getOptionValue(name);
1450
1482
  if (val !== null && option.parseArg) {
1451
- try {
1452
- val = option.parseArg(val, oldValue);
1453
- } catch (err) {
1454
- if (err.code === "commander.invalidArgument") {
1455
- const message = `${invalidValueMessage} ${err.message}`;
1456
- this.error(message, { exitCode: err.exitCode, code: err.code });
1457
- }
1458
- throw err;
1459
- }
1483
+ val = this._callParseArg(option, val, oldValue, invalidValueMessage);
1460
1484
  } else if (val !== null && option.variadic) {
1461
1485
  val = option._concatValue(val, oldValue);
1462
1486
  }
@@ -1509,56 +1533,28 @@ Expecting one of '${allowedValues.join("', '")}'`);
1509
1533
  return this.addOption(option);
1510
1534
  }
1511
1535
  /**
1512
- * Define option with `flags`, `description` and optional
1513
- * coercion `fn`.
1536
+ * Define option with `flags`, `description`, and optional argument parsing function or `defaultValue` or both.
1514
1537
  *
1515
- * The `flags` string contains the short and/or long flags,
1516
- * separated by comma, a pipe or space. The following are all valid
1517
- * all will output this way when `--help` is used.
1538
+ * The `flags` string contains the short and/or long flags, separated by comma, a pipe or space. A required
1539
+ * option-argument is indicated by `<>` and an optional option-argument by `[]`.
1518
1540
  *
1519
- * "-p, --pepper"
1520
- * "-p|--pepper"
1521
- * "-p --pepper"
1541
+ * See the README for more details, and see also addOption() and requiredOption().
1522
1542
  *
1523
1543
  * @example
1524
- * // simple boolean defaulting to undefined
1525
- * program.option('-p, --pepper', 'add pepper');
1526
- *
1527
- * program.pepper
1528
- * // => undefined
1529
- *
1530
- * --pepper
1531
- * program.pepper
1532
- * // => true
1533
- *
1534
- * // simple boolean defaulting to true (unless non-negated option is also defined)
1535
- * program.option('-C, --no-cheese', 'remove cheese');
1536
- *
1537
- * program.cheese
1538
- * // => true
1539
- *
1540
- * --no-cheese
1541
- * program.cheese
1542
- * // => false
1543
- *
1544
- * // required argument
1545
- * program.option('-C, --chdir <path>', 'change the working directory');
1546
- *
1547
- * --chdir /tmp
1548
- * program.chdir
1549
- * // => "/tmp"
1550
- *
1551
- * // optional argument
1552
- * program.option('-c, --cheese [type]', 'add cheese [marble]');
1544
+ * program
1545
+ * .option('-p, --pepper', 'add pepper')
1546
+ * .option('-p, --pizza-type <TYPE>', 'type of pizza') // required option-argument
1547
+ * .option('-c, --cheese [CHEESE]', 'add extra cheese', 'mozzarella') // optional option-argument with default
1548
+ * .option('-t, --tip <VALUE>', 'add tip to purchase cost', parseFloat) // custom parse function
1553
1549
  *
1554
1550
  * @param {string} flags
1555
1551
  * @param {string} [description]
1556
- * @param {Function|*} [fn] - custom option processing function or default value
1552
+ * @param {Function|*} [parseArg] - custom option processing function or default value
1557
1553
  * @param {*} [defaultValue]
1558
1554
  * @return {Command} `this` command for chaining
1559
1555
  */
1560
- option(flags, description, fn, defaultValue) {
1561
- return this._optionEx({}, flags, description, fn, defaultValue);
1556
+ option(flags, description, parseArg, defaultValue) {
1557
+ return this._optionEx({}, flags, description, parseArg, defaultValue);
1562
1558
  }
1563
1559
  /**
1564
1560
  * Add a required option which must have a value after parsing. This usually means
@@ -1568,12 +1564,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
1568
1564
  *
1569
1565
  * @param {string} flags
1570
1566
  * @param {string} [description]
1571
- * @param {Function|*} [fn] - custom option processing function or default value
1567
+ * @param {Function|*} [parseArg] - custom option processing function or default value
1572
1568
  * @param {*} [defaultValue]
1573
1569
  * @return {Command} `this` command for chaining
1574
1570
  */
1575
- requiredOption(flags, description, fn, defaultValue) {
1576
- return this._optionEx({ mandatory: true }, flags, description, fn, defaultValue);
1571
+ requiredOption(flags, description, parseArg, defaultValue) {
1572
+ return this._optionEx({ mandatory: true }, flags, description, parseArg, defaultValue);
1577
1573
  }
1578
1574
  /**
1579
1575
  * Alter parsing of short flags with optional values.
@@ -1644,10 +1640,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1644
1640
  * @return {Command} `this` command for chaining
1645
1641
  */
1646
1642
  storeOptionsAsProperties(storeAsProperties = true) {
1647
- this._storeOptionsAsProperties = !!storeAsProperties;
1648
1643
  if (this.options.length) {
1649
1644
  throw new Error("call .storeOptionsAsProperties() before adding options");
1650
1645
  }
1646
+ this._storeOptionsAsProperties = !!storeAsProperties;
1651
1647
  return this;
1652
1648
  }
1653
1649
  /**
@@ -1708,7 +1704,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1708
1704
  */
1709
1705
  getOptionValueSourceWithGlobals(key) {
1710
1706
  let source;
1711
- getCommandAndParents(this).forEach((cmd) => {
1707
+ this._getCommandAndAncestors().forEach((cmd) => {
1712
1708
  if (cmd.getOptionValueSource(key) !== void 0) {
1713
1709
  source = cmd.getOptionValueSource(key);
1714
1710
  }
@@ -1907,16 +1903,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
1907
1903
  const subCommand = this._findCommand(commandName);
1908
1904
  if (!subCommand)
1909
1905
  this.help({ error: true });
1910
- let hookResult;
1911
- hookResult = this._chainOrCallSubCommandHook(hookResult, subCommand, "preSubcommand");
1912
- hookResult = this._chainOrCall(hookResult, () => {
1906
+ let promiseChain;
1907
+ promiseChain = this._chainOrCallSubCommandHook(promiseChain, subCommand, "preSubcommand");
1908
+ promiseChain = this._chainOrCall(promiseChain, () => {
1913
1909
  if (subCommand._executableHandler) {
1914
1910
  this._executeSubCommand(subCommand, operands.concat(unknown));
1915
1911
  } else {
1916
1912
  return subCommand._parseCommand(operands, unknown);
1917
1913
  }
1918
1914
  });
1919
- return hookResult;
1915
+ return promiseChain;
1920
1916
  }
1921
1917
  /**
1922
1918
  * Invoke help directly if possible, or dispatch if necessary.
@@ -1932,28 +1928,30 @@ Expecting one of '${allowedValues.join("', '")}'`);
1932
1928
  if (subCommand && !subCommand._executableHandler) {
1933
1929
  subCommand.help();
1934
1930
  }
1935
- return this._dispatchSubcommand(subcommandName, [], [this._helpLongFlag]);
1931
+ return this._dispatchSubcommand(subcommandName, [], [
1932
+ this._helpLongFlag || this._helpShortFlag
1933
+ ]);
1936
1934
  }
1937
1935
  /**
1938
- * Check this.args against expected this._args.
1936
+ * Check this.args against expected this.registeredArguments.
1939
1937
  *
1940
1938
  * @api private
1941
1939
  */
1942
1940
  _checkNumberOfArguments() {
1943
- this._args.forEach((arg, i) => {
1941
+ this.registeredArguments.forEach((arg, i) => {
1944
1942
  if (arg.required && this.args[i] == null) {
1945
1943
  this.missingArgument(arg.name());
1946
1944
  }
1947
1945
  });
1948
- if (this._args.length > 0 && this._args[this._args.length - 1].variadic) {
1946
+ if (this.registeredArguments.length > 0 && this.registeredArguments[this.registeredArguments.length - 1].variadic) {
1949
1947
  return;
1950
1948
  }
1951
- if (this.args.length > this._args.length) {
1949
+ if (this.args.length > this.registeredArguments.length) {
1952
1950
  this._excessArguments(this.args);
1953
1951
  }
1954
1952
  }
1955
1953
  /**
1956
- * Process this.args using this._args and save as this.processedArgs!
1954
+ * Process this.args using this.registeredArguments and save as this.processedArgs!
1957
1955
  *
1958
1956
  * @api private
1959
1957
  */
@@ -1961,21 +1959,14 @@ Expecting one of '${allowedValues.join("', '")}'`);
1961
1959
  const myParseArg = (argument, value, previous) => {
1962
1960
  let parsedValue = value;
1963
1961
  if (value !== null && argument.parseArg) {
1964
- try {
1965
- parsedValue = argument.parseArg(value, previous);
1966
- } catch (err) {
1967
- if (err.code === "commander.invalidArgument") {
1968
- const message = `error: command-argument value '${value}' is invalid for argument '${argument.name()}'. ${err.message}`;
1969
- this.error(message, { exitCode: err.exitCode, code: err.code });
1970
- }
1971
- throw err;
1972
- }
1962
+ const invalidValueMessage = `error: command-argument value '${value}' is invalid for argument '${argument.name()}'.`;
1963
+ parsedValue = this._callParseArg(argument, value, previous, invalidValueMessage);
1973
1964
  }
1974
1965
  return parsedValue;
1975
1966
  };
1976
1967
  this._checkNumberOfArguments();
1977
1968
  const processedArgs = [];
1978
- this._args.forEach((declaredArg, index) => {
1969
+ this.registeredArguments.forEach((declaredArg, index) => {
1979
1970
  let value = declaredArg.defaultValue;
1980
1971
  if (declaredArg.variadic) {
1981
1972
  if (index < this.args.length) {
@@ -2022,7 +2013,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2022
2013
  _chainOrCallHooks(promise, event) {
2023
2014
  let result = promise;
2024
2015
  const hooks = [];
2025
- getCommandAndParents(this).reverse().filter((cmd) => cmd._lifeCycleHooks[event] !== void 0).forEach((hookedCommand) => {
2016
+ this._getCommandAndAncestors().reverse().filter((cmd) => cmd._lifeCycleHooks[event] !== void 0).forEach((hookedCommand) => {
2026
2017
  hookedCommand._lifeCycleHooks[event].forEach((callback) => {
2027
2018
  hooks.push({ hookedCommand, callback });
2028
2019
  });
@@ -2094,16 +2085,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
2094
2085
  if (this._actionHandler) {
2095
2086
  checkForUnknownOptions();
2096
2087
  this._processArguments();
2097
- let actionResult;
2098
- actionResult = this._chainOrCallHooks(actionResult, "preAction");
2099
- actionResult = this._chainOrCall(actionResult, () => this._actionHandler(this.processedArgs));
2088
+ let promiseChain;
2089
+ promiseChain = this._chainOrCallHooks(promiseChain, "preAction");
2090
+ promiseChain = this._chainOrCall(promiseChain, () => this._actionHandler(this.processedArgs));
2100
2091
  if (this.parent) {
2101
- actionResult = this._chainOrCall(actionResult, () => {
2092
+ promiseChain = this._chainOrCall(promiseChain, () => {
2102
2093
  this.parent.emit(commandEvent, operands, unknown);
2103
2094
  });
2104
2095
  }
2105
- actionResult = this._chainOrCallHooks(actionResult, "postAction");
2106
- return actionResult;
2096
+ promiseChain = this._chainOrCallHooks(promiseChain, "postAction");
2097
+ return promiseChain;
2107
2098
  }
2108
2099
  if (this.parent && this.parent.listenerCount(commandEvent)) {
2109
2100
  checkForUnknownOptions();
@@ -2156,13 +2147,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
2156
2147
  * @api private
2157
2148
  */
2158
2149
  _checkForMissingMandatoryOptions() {
2159
- for (let cmd = this; cmd; cmd = cmd.parent) {
2150
+ this._getCommandAndAncestors().forEach((cmd) => {
2160
2151
  cmd.options.forEach((anOption) => {
2161
2152
  if (anOption.mandatory && cmd.getOptionValue(anOption.attributeName()) === void 0) {
2162
2153
  cmd.missingMandatoryOptionValue(anOption);
2163
2154
  }
2164
2155
  });
2165
- }
2156
+ });
2166
2157
  }
2167
2158
  /**
2168
2159
  * Display an error message if conflicting options are used together in this.
@@ -2198,9 +2189,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2198
2189
  * @api private
2199
2190
  */
2200
2191
  _checkForConflictingOptions() {
2201
- for (let cmd = this; cmd; cmd = cmd.parent) {
2192
+ this._getCommandAndAncestors().forEach((cmd) => {
2202
2193
  cmd._checkForConflictingLocalOptions();
2203
- }
2194
+ });
2204
2195
  }
2205
2196
  /**
2206
2197
  * Parse options from `argv` removing known options,
@@ -2334,7 +2325,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2334
2325
  * @return {Object}
2335
2326
  */
2336
2327
  optsWithGlobals() {
2337
- return getCommandAndParents(this).reduce(
2328
+ return this._getCommandAndAncestors().reduce(
2338
2329
  (combinedOptions, cmd) => Object.assign(combinedOptions, cmd.opts()),
2339
2330
  {}
2340
2331
  );
@@ -2490,7 +2481,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2490
2481
  _excessArguments(receivedArgs) {
2491
2482
  if (this._allowExcessArguments)
2492
2483
  return;
2493
- const expected = this._args.length;
2484
+ const expected = this.registeredArguments.length;
2494
2485
  const s = expected === 1 ? "" : "s";
2495
2486
  const forSubcommand = this.parent ? ` for '${this.name()}'` : "";
2496
2487
  const message = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s} but got ${receivedArgs.length}.`;
@@ -2517,17 +2508,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
2517
2508
  this.error(message, { code: "commander.unknownCommand" });
2518
2509
  }
2519
2510
  /**
2520
- * Set the program version to `str`.
2511
+ * Get or set the program version.
2521
2512
  *
2522
- * This method auto-registers the "-V, --version" flag
2523
- * which will print the version number when passed.
2513
+ * This method auto-registers the "-V, --version" option which will print the version number.
2524
2514
  *
2525
- * You can optionally supply the flags and description to override the defaults.
2515
+ * You can optionally supply the flags and description to override the defaults.
2526
2516
  *
2527
- * @param {string} str
2517
+ * @param {string} [str]
2528
2518
  * @param {string} [flags]
2529
2519
  * @param {string} [description]
2530
- * @return {this | string} `this` command for chaining, or version string if no arguments
2520
+ * @return {this | string | undefined} `this` command for chaining, or version string if no arguments
2531
2521
  */
2532
2522
  version(str, flags, description) {
2533
2523
  if (str === void 0)
@@ -2617,13 +2607,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
2617
2607
  if (str === void 0) {
2618
2608
  if (this._usage)
2619
2609
  return this._usage;
2620
- const args = this._args.map((arg) => {
2610
+ const args = this.registeredArguments.map((arg) => {
2621
2611
  return humanReadableArgName(arg);
2622
2612
  });
2623
2613
  return [].concat(
2624
2614
  this.options.length || this._hasHelpOption ? "[options]" : [],
2625
2615
  this.commands.length ? "[command]" : [],
2626
- this._args.length ? args : []
2616
+ this.registeredArguments.length ? args : []
2627
2617
  ).join(" ");
2628
2618
  }
2629
2619
  this._usage = str;
@@ -2666,7 +2656,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2666
2656
  * program.executableDir('subcommands');
2667
2657
  *
2668
2658
  * @param {string} [path]
2669
- * @return {string|Command}
2659
+ * @return {string|null|Command}
2670
2660
  */
2671
2661
  executableDir(path5) {
2672
2662
  if (path5 === void 0)
@@ -2717,7 +2707,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2717
2707
  contextOptions = void 0;
2718
2708
  }
2719
2709
  const context = this._getHelpContext(contextOptions);
2720
- getCommandAndParents(this).reverse().forEach((command) => command.emit("beforeAllHelp", context));
2710
+ this._getCommandAndAncestors().reverse().forEach((command) => command.emit("beforeAllHelp", context));
2721
2711
  this.emit("beforeHelp", context);
2722
2712
  let helpInformation = this.helpInformation(context);
2723
2713
  if (deprecatedCallback) {
@@ -2727,9 +2717,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
2727
2717
  }
2728
2718
  }
2729
2719
  context.write(helpInformation);
2730
- this.emit(this._helpLongFlag);
2720
+ if (this._helpLongFlag) {
2721
+ this.emit(this._helpLongFlag);
2722
+ }
2731
2723
  this.emit("afterHelp", context);
2732
- getCommandAndParents(this).forEach((command) => command.emit("afterAllHelp", context));
2724
+ this._getCommandAndAncestors().forEach((command) => command.emit("afterAllHelp", context));
2733
2725
  }
2734
2726
  /**
2735
2727
  * You can pass in flags and a description to override the help
@@ -2835,13 +2827,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
2835
2827
  return arg;
2836
2828
  });
2837
2829
  }
2838
- function getCommandAndParents(startCommand) {
2839
- const result = [];
2840
- for (let command = startCommand; command; command = command.parent) {
2841
- result.push(command);
2842
- }
2843
- return result;
2844
- }
2845
2830
  exports2.Command = Command2;
2846
2831
  }
2847
2832
  });
@@ -2856,13 +2841,13 @@ var require_commander = __commonJS({
2856
2841
  var { Option: Option2 } = require_option();
2857
2842
  exports2 = module2.exports = new Command2();
2858
2843
  exports2.program = exports2;
2859
- exports2.Argument = Argument2;
2860
2844
  exports2.Command = Command2;
2861
- exports2.CommanderError = CommanderError2;
2845
+ exports2.Option = Option2;
2846
+ exports2.Argument = Argument2;
2862
2847
  exports2.Help = Help2;
2848
+ exports2.CommanderError = CommanderError2;
2863
2849
  exports2.InvalidArgumentError = InvalidArgumentError2;
2864
2850
  exports2.InvalidOptionArgumentError = InvalidArgumentError2;
2865
- exports2.Option = Option2;
2866
2851
  }
2867
2852
  });
2868
2853
 
@@ -7112,14 +7097,14 @@ var require_errors = __commonJS({
7112
7097
  return error;
7113
7098
  }
7114
7099
  exports2.makeError = makeError;
7115
- function assert2(check, message, code, info) {
7100
+ function assert(check, message, code, info) {
7116
7101
  if (!check) {
7117
7102
  throw makeError(message, code, info);
7118
7103
  }
7119
7104
  }
7120
- exports2.assert = assert2;
7105
+ exports2.assert = assert;
7121
7106
  function assertArgument(check, message, name, value) {
7122
- assert2(check, message, "INVALID_ARGUMENT", { argument: name, value });
7107
+ assert(check, message, "INVALID_ARGUMENT", { argument: name, value });
7123
7108
  }
7124
7109
  exports2.assertArgument = assertArgument;
7125
7110
  function assertArgumentCount(count, expectedCount, message) {
@@ -7129,11 +7114,11 @@ var require_errors = __commonJS({
7129
7114
  if (message) {
7130
7115
  message = ": " + message;
7131
7116
  }
7132
- assert2(count >= expectedCount, "missing arguemnt" + message, "MISSING_ARGUMENT", {
7117
+ assert(count >= expectedCount, "missing arguemnt" + message, "MISSING_ARGUMENT", {
7133
7118
  count,
7134
7119
  expectedCount
7135
7120
  });
7136
- assert2(count <= expectedCount, "too many arguemnts" + message, "UNEXPECTED_ARGUMENT", {
7121
+ assert(count <= expectedCount, "too many arguemnts" + message, "UNEXPECTED_ARGUMENT", {
7137
7122
  count,
7138
7123
  expectedCount
7139
7124
  });
@@ -7158,7 +7143,7 @@ var require_errors = __commonJS({
7158
7143
  return accum;
7159
7144
  }, []);
7160
7145
  function assertNormalize(form) {
7161
- assert2(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", {
7146
+ assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", {
7162
7147
  operation: "String.prototype.normalize",
7163
7148
  info: { form }
7164
7149
  });
@@ -7174,7 +7159,7 @@ var require_errors = __commonJS({
7174
7159
  method += ".";
7175
7160
  operation += " " + className;
7176
7161
  }
7177
- assert2(false, `private constructor; use ${method}from* methods`, "UNSUPPORTED_OPERATION", {
7162
+ assert(false, `private constructor; use ${method}from* methods`, "UNSUPPORTED_OPERATION", {
7178
7163
  operation
7179
7164
  });
7180
7165
  }
@@ -10004,7 +9989,7 @@ var require_assert = __commonJS({
10004
9989
  }
10005
9990
  }
10006
9991
  exports2.output = output;
10007
- var assert2 = {
9992
+ var assert = {
10008
9993
  number,
10009
9994
  bool,
10010
9995
  bytes,
@@ -10012,7 +9997,7 @@ var require_assert = __commonJS({
10012
9997
  exists,
10013
9998
  output
10014
9999
  };
10015
- exports2.default = assert2;
10000
+ exports2.default = assert;
10016
10001
  }
10017
10002
  });
10018
10003
 
@@ -42624,7 +42609,7 @@ var require_follow_redirects = __commonJS({
42624
42609
  var http = require("http");
42625
42610
  var https = require("https");
42626
42611
  var Writable = require("stream").Writable;
42627
- var assert2 = require("assert");
42612
+ var assert = require("assert");
42628
42613
  var debug = require_debug2();
42629
42614
  var events = ["abort", "aborted", "connect", "error", "socket", "timeout"];
42630
42615
  var eventHandlers = /* @__PURE__ */ Object.create(null);
@@ -42990,7 +42975,7 @@ var require_follow_redirects = __commonJS({
42990
42975
  if (!isString(options.host) && !isString(options.hostname)) {
42991
42976
  options.hostname = "::1";
42992
42977
  }
42993
- assert2.equal(options.protocol, protocol, "protocol mismatch");
42978
+ assert.equal(options.protocol, protocol, "protocol mismatch");
42994
42979
  debug("options", options);
42995
42980
  return new RedirectableRequest(options, callback);
42996
42981
  }
@@ -43056,7 +43041,7 @@ var require_follow_redirects = __commonJS({
43056
43041
  request.destroy(error);
43057
43042
  }
43058
43043
  function isSubdomain(subdomain, domain) {
43059
- assert2(isString(subdomain) && isString(domain));
43044
+ assert(isString(subdomain) && isString(domain));
43060
43045
  var dot = subdomain.length - domain.length - 1;
43061
43046
  return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
43062
43047
  }
@@ -59918,7 +59903,7 @@ var require_bn = __commonJS({
59918
59903
  "node_modules/bn.js/lib/bn.js"(exports2, module2) {
59919
59904
  (function(module3, exports3) {
59920
59905
  "use strict";
59921
- function assert2(val, msg) {
59906
+ function assert(val, msg) {
59922
59907
  if (!val)
59923
59908
  throw new Error(msg || "Assertion failed");
59924
59909
  }
@@ -59988,7 +59973,7 @@ var require_bn = __commonJS({
59988
59973
  if (base === "hex") {
59989
59974
  base = 16;
59990
59975
  }
59991
- assert2(base === (base | 0) && base >= 2 && base <= 36);
59976
+ assert(base === (base | 0) && base >= 2 && base <= 36);
59992
59977
  number = number.toString().replace(/\s+/g, "");
59993
59978
  var start = 0;
59994
59979
  if (number[0] === "-") {
@@ -60021,7 +60006,7 @@ var require_bn = __commonJS({
60021
60006
  ];
60022
60007
  this.length = 2;
60023
60008
  } else {
60024
- assert2(number < 9007199254740992);
60009
+ assert(number < 9007199254740992);
60025
60010
  this.words = [
60026
60011
  number & 67108863,
60027
60012
  number / 67108864 & 67108863,
@@ -60034,7 +60019,7 @@ var require_bn = __commonJS({
60034
60019
  this._initArray(this.toArray(), base, endian);
60035
60020
  };
60036
60021
  BN.prototype._initArray = function _initArray(number, base, endian) {
60037
- assert2(typeof number.length === "number");
60022
+ assert(typeof number.length === "number");
60038
60023
  if (number.length <= 0) {
60039
60024
  this.words = [0];
60040
60025
  this.length = 1;
@@ -60081,7 +60066,7 @@ var require_bn = __commonJS({
60081
60066
  } else if (c >= 97 && c <= 102) {
60082
60067
  return c - 87;
60083
60068
  } else {
60084
- assert2(false, "Invalid character in " + string);
60069
+ assert(false, "Invalid character in " + string);
60085
60070
  }
60086
60071
  }
60087
60072
  function parseHexByte(string, lowerBound, index) {
@@ -60142,7 +60127,7 @@ var require_bn = __commonJS({
60142
60127
  } else {
60143
60128
  b = c;
60144
60129
  }
60145
- assert2(c >= 0 && b < mul, "Invalid character");
60130
+ assert(c >= 0 && b < mul, "Invalid character");
60146
60131
  r += b;
60147
60132
  }
60148
60133
  return r;
@@ -60402,7 +60387,7 @@ var require_bn = __commonJS({
60402
60387
  }
60403
60388
  return out;
60404
60389
  }
60405
- assert2(false, "Base should be between 2 and 36");
60390
+ assert(false, "Base should be between 2 and 36");
60406
60391
  };
60407
60392
  BN.prototype.toNumber = function toNumber() {
60408
60393
  var ret = this.words[0];
@@ -60411,7 +60396,7 @@ var require_bn = __commonJS({
60411
60396
  } else if (this.length === 3 && this.words[2] === 1) {
60412
60397
  ret += 4503599627370496 + this.words[1] * 67108864;
60413
60398
  } else if (this.length > 2) {
60414
- assert2(false, "Number can only safely store up to 53 bits");
60399
+ assert(false, "Number can only safely store up to 53 bits");
60415
60400
  }
60416
60401
  return this.negative !== 0 ? -ret : ret;
60417
60402
  };
@@ -60436,8 +60421,8 @@ var require_bn = __commonJS({
60436
60421
  this._strip();
60437
60422
  var byteLength = this.byteLength();
60438
60423
  var reqLength = length || Math.max(1, byteLength);
60439
- assert2(byteLength <= reqLength, "byte array longer than desired length");
60440
- assert2(reqLength > 0, "Requested array length <= 0");
60424
+ assert(byteLength <= reqLength, "byte array longer than desired length");
60425
+ assert(reqLength > 0, "Requested array length <= 0");
60441
60426
  var res = allocate(ArrayType, reqLength);
60442
60427
  var postfix = endian === "le" ? "LE" : "BE";
60443
60428
  this["_toArrayLike" + postfix](res, byteLength);
@@ -60619,7 +60604,7 @@ var require_bn = __commonJS({
60619
60604
  return this._strip();
60620
60605
  };
60621
60606
  BN.prototype.ior = function ior(num) {
60622
- assert2((this.negative | num.negative) === 0);
60607
+ assert((this.negative | num.negative) === 0);
60623
60608
  return this.iuor(num);
60624
60609
  };
60625
60610
  BN.prototype.or = function or(num) {
@@ -60646,7 +60631,7 @@ var require_bn = __commonJS({
60646
60631
  return this._strip();
60647
60632
  };
60648
60633
  BN.prototype.iand = function iand(num) {
60649
- assert2((this.negative | num.negative) === 0);
60634
+ assert((this.negative | num.negative) === 0);
60650
60635
  return this.iuand(num);
60651
60636
  };
60652
60637
  BN.prototype.and = function and(num) {
@@ -60681,7 +60666,7 @@ var require_bn = __commonJS({
60681
60666
  return this._strip();
60682
60667
  };
60683
60668
  BN.prototype.ixor = function ixor(num) {
60684
- assert2((this.negative | num.negative) === 0);
60669
+ assert((this.negative | num.negative) === 0);
60685
60670
  return this.iuxor(num);
60686
60671
  };
60687
60672
  BN.prototype.xor = function xor(num) {
@@ -60695,7 +60680,7 @@ var require_bn = __commonJS({
60695
60680
  return num.clone().iuxor(this);
60696
60681
  };
60697
60682
  BN.prototype.inotn = function inotn(width) {
60698
- assert2(typeof width === "number" && width >= 0);
60683
+ assert(typeof width === "number" && width >= 0);
60699
60684
  var bytesNeeded = Math.ceil(width / 26) | 0;
60700
60685
  var bitsLeft = width % 26;
60701
60686
  this._expand(bytesNeeded);
@@ -60714,7 +60699,7 @@ var require_bn = __commonJS({
60714
60699
  return this.clone().inotn(width);
60715
60700
  };
60716
60701
  BN.prototype.setn = function setn(bit, val) {
60717
- assert2(typeof bit === "number" && bit >= 0);
60702
+ assert(typeof bit === "number" && bit >= 0);
60718
60703
  var off = bit / 26 | 0;
60719
60704
  var wbit = bit % 26;
60720
60705
  this._expand(off + 1);
@@ -61580,8 +61565,8 @@ var require_bn = __commonJS({
61580
61565
  for (i = 2 * len; i < N; ++i) {
61581
61566
  rws[i] = 0;
61582
61567
  }
61583
- assert2(carry === 0);
61584
- assert2((carry & ~8191) === 0);
61568
+ assert(carry === 0);
61569
+ assert((carry & ~8191) === 0);
61585
61570
  };
61586
61571
  FFTM.prototype.stub = function stub(N) {
61587
61572
  var ph = new Array(N);
@@ -61636,8 +61621,8 @@ var require_bn = __commonJS({
61636
61621
  var isNegNum = num < 0;
61637
61622
  if (isNegNum)
61638
61623
  num = -num;
61639
- assert2(typeof num === "number");
61640
- assert2(num < 67108864);
61624
+ assert(typeof num === "number");
61625
+ assert(num < 67108864);
61641
61626
  var carry = 0;
61642
61627
  for (var i = 0; i < this.length; i++) {
61643
61628
  var w = (this.words[i] | 0) * num;
@@ -61681,7 +61666,7 @@ var require_bn = __commonJS({
61681
61666
  return res;
61682
61667
  };
61683
61668
  BN.prototype.iushln = function iushln(bits) {
61684
- assert2(typeof bits === "number" && bits >= 0);
61669
+ assert(typeof bits === "number" && bits >= 0);
61685
61670
  var r = bits % 26;
61686
61671
  var s = (bits - r) / 26;
61687
61672
  var carryMask = 67108863 >>> 26 - r << 26 - r;
@@ -61711,11 +61696,11 @@ var require_bn = __commonJS({
61711
61696
  return this._strip();
61712
61697
  };
61713
61698
  BN.prototype.ishln = function ishln(bits) {
61714
- assert2(this.negative === 0);
61699
+ assert(this.negative === 0);
61715
61700
  return this.iushln(bits);
61716
61701
  };
61717
61702
  BN.prototype.iushrn = function iushrn(bits, hint, extended) {
61718
- assert2(typeof bits === "number" && bits >= 0);
61703
+ assert(typeof bits === "number" && bits >= 0);
61719
61704
  var h;
61720
61705
  if (hint) {
61721
61706
  h = (hint - hint % 26) / 26;
@@ -61760,7 +61745,7 @@ var require_bn = __commonJS({
61760
61745
  return this._strip();
61761
61746
  };
61762
61747
  BN.prototype.ishrn = function ishrn(bits, hint, extended) {
61763
- assert2(this.negative === 0);
61748
+ assert(this.negative === 0);
61764
61749
  return this.iushrn(bits, hint, extended);
61765
61750
  };
61766
61751
  BN.prototype.shln = function shln(bits) {
@@ -61776,7 +61761,7 @@ var require_bn = __commonJS({
61776
61761
  return this.clone().iushrn(bits);
61777
61762
  };
61778
61763
  BN.prototype.testn = function testn(bit) {
61779
- assert2(typeof bit === "number" && bit >= 0);
61764
+ assert(typeof bit === "number" && bit >= 0);
61780
61765
  var r = bit % 26;
61781
61766
  var s = (bit - r) / 26;
61782
61767
  var q = 1 << r;
@@ -61786,10 +61771,10 @@ var require_bn = __commonJS({
61786
61771
  return !!(w & q);
61787
61772
  };
61788
61773
  BN.prototype.imaskn = function imaskn(bits) {
61789
- assert2(typeof bits === "number" && bits >= 0);
61774
+ assert(typeof bits === "number" && bits >= 0);
61790
61775
  var r = bits % 26;
61791
61776
  var s = (bits - r) / 26;
61792
- assert2(this.negative === 0, "imaskn works only with positive numbers");
61777
+ assert(this.negative === 0, "imaskn works only with positive numbers");
61793
61778
  if (this.length <= s) {
61794
61779
  return this;
61795
61780
  }
@@ -61807,8 +61792,8 @@ var require_bn = __commonJS({
61807
61792
  return this.clone().imaskn(bits);
61808
61793
  };
61809
61794
  BN.prototype.iaddn = function iaddn(num) {
61810
- assert2(typeof num === "number");
61811
- assert2(num < 67108864);
61795
+ assert(typeof num === "number");
61796
+ assert(num < 67108864);
61812
61797
  if (num < 0)
61813
61798
  return this.isubn(-num);
61814
61799
  if (this.negative !== 0) {
@@ -61838,8 +61823,8 @@ var require_bn = __commonJS({
61838
61823
  return this;
61839
61824
  };
61840
61825
  BN.prototype.isubn = function isubn(num) {
61841
- assert2(typeof num === "number");
61842
- assert2(num < 67108864);
61826
+ assert(typeof num === "number");
61827
+ assert(num < 67108864);
61843
61828
  if (num < 0)
61844
61829
  return this.iaddn(-num);
61845
61830
  if (this.negative !== 0) {
@@ -61893,7 +61878,7 @@ var require_bn = __commonJS({
61893
61878
  }
61894
61879
  if (carry === 0)
61895
61880
  return this._strip();
61896
- assert2(carry === -1);
61881
+ assert(carry === -1);
61897
61882
  carry = 0;
61898
61883
  for (i = 0; i < this.length; i++) {
61899
61884
  w = -(this.words[i] | 0) + carry;
@@ -61961,7 +61946,7 @@ var require_bn = __commonJS({
61961
61946
  };
61962
61947
  };
61963
61948
  BN.prototype.divmod = function divmod(num, mode, positive) {
61964
- assert2(!num.isZero());
61949
+ assert(!num.isZero());
61965
61950
  if (this.isZero()) {
61966
61951
  return {
61967
61952
  div: new BN(0),
@@ -62059,7 +62044,7 @@ var require_bn = __commonJS({
62059
62044
  var isNegNum = num < 0;
62060
62045
  if (isNegNum)
62061
62046
  num = -num;
62062
- assert2(num <= 67108863);
62047
+ assert(num <= 67108863);
62063
62048
  var p = (1 << 26) % num;
62064
62049
  var acc = 0;
62065
62050
  for (var i = this.length - 1; i >= 0; i--) {
@@ -62074,7 +62059,7 @@ var require_bn = __commonJS({
62074
62059
  var isNegNum = num < 0;
62075
62060
  if (isNegNum)
62076
62061
  num = -num;
62077
- assert2(num <= 67108863);
62062
+ assert(num <= 67108863);
62078
62063
  var carry = 0;
62079
62064
  for (var i = this.length - 1; i >= 0; i--) {
62080
62065
  var w = (this.words[i] | 0) + carry * 67108864;
@@ -62088,8 +62073,8 @@ var require_bn = __commonJS({
62088
62073
  return this.clone().idivn(num);
62089
62074
  };
62090
62075
  BN.prototype.egcd = function egcd(p) {
62091
- assert2(p.negative === 0);
62092
- assert2(!p.isZero());
62076
+ assert(p.negative === 0);
62077
+ assert(!p.isZero());
62093
62078
  var x = this;
62094
62079
  var y = p.clone();
62095
62080
  if (x.negative !== 0) {
@@ -62153,8 +62138,8 @@ var require_bn = __commonJS({
62153
62138
  };
62154
62139
  };
62155
62140
  BN.prototype._invmp = function _invmp(p) {
62156
- assert2(p.negative === 0);
62157
- assert2(!p.isZero());
62141
+ assert(p.negative === 0);
62142
+ assert(!p.isZero());
62158
62143
  var a = this;
62159
62144
  var b = p.clone();
62160
62145
  if (a.negative !== 0) {
@@ -62252,7 +62237,7 @@ var require_bn = __commonJS({
62252
62237
  return this.words[0] & num;
62253
62238
  };
62254
62239
  BN.prototype.bincn = function bincn(bit) {
62255
- assert2(typeof bit === "number");
62240
+ assert(typeof bit === "number");
62256
62241
  var r = bit % 26;
62257
62242
  var s = (bit - r) / 26;
62258
62243
  var q = 1 << r;
@@ -62292,7 +62277,7 @@ var require_bn = __commonJS({
62292
62277
  if (negative) {
62293
62278
  num = -num;
62294
62279
  }
62295
- assert2(num <= 67108863, "Number is too big");
62280
+ assert(num <= 67108863, "Number is too big");
62296
62281
  var w = this.words[0] | 0;
62297
62282
  res = w === num ? 0 : w < num ? -1 : 1;
62298
62283
  }
@@ -62364,12 +62349,12 @@ var require_bn = __commonJS({
62364
62349
  return new Red(num);
62365
62350
  };
62366
62351
  BN.prototype.toRed = function toRed(ctx) {
62367
- assert2(!this.red, "Already a number in reduction context");
62368
- assert2(this.negative === 0, "red works only with positives");
62352
+ assert(!this.red, "Already a number in reduction context");
62353
+ assert(this.negative === 0, "red works only with positives");
62369
62354
  return ctx.convertTo(this)._forceRed(ctx);
62370
62355
  };
62371
62356
  BN.prototype.fromRed = function fromRed() {
62372
- assert2(this.red, "fromRed works only with numbers in reduction context");
62357
+ assert(this.red, "fromRed works only with numbers in reduction context");
62373
62358
  return this.red.convertFrom(this);
62374
62359
  };
62375
62360
  BN.prototype._forceRed = function _forceRed(ctx) {
@@ -62377,66 +62362,66 @@ var require_bn = __commonJS({
62377
62362
  return this;
62378
62363
  };
62379
62364
  BN.prototype.forceRed = function forceRed(ctx) {
62380
- assert2(!this.red, "Already a number in reduction context");
62365
+ assert(!this.red, "Already a number in reduction context");
62381
62366
  return this._forceRed(ctx);
62382
62367
  };
62383
62368
  BN.prototype.redAdd = function redAdd(num) {
62384
- assert2(this.red, "redAdd works only with red numbers");
62369
+ assert(this.red, "redAdd works only with red numbers");
62385
62370
  return this.red.add(this, num);
62386
62371
  };
62387
62372
  BN.prototype.redIAdd = function redIAdd(num) {
62388
- assert2(this.red, "redIAdd works only with red numbers");
62373
+ assert(this.red, "redIAdd works only with red numbers");
62389
62374
  return this.red.iadd(this, num);
62390
62375
  };
62391
62376
  BN.prototype.redSub = function redSub(num) {
62392
- assert2(this.red, "redSub works only with red numbers");
62377
+ assert(this.red, "redSub works only with red numbers");
62393
62378
  return this.red.sub(this, num);
62394
62379
  };
62395
62380
  BN.prototype.redISub = function redISub(num) {
62396
- assert2(this.red, "redISub works only with red numbers");
62381
+ assert(this.red, "redISub works only with red numbers");
62397
62382
  return this.red.isub(this, num);
62398
62383
  };
62399
62384
  BN.prototype.redShl = function redShl(num) {
62400
- assert2(this.red, "redShl works only with red numbers");
62385
+ assert(this.red, "redShl works only with red numbers");
62401
62386
  return this.red.shl(this, num);
62402
62387
  };
62403
62388
  BN.prototype.redMul = function redMul(num) {
62404
- assert2(this.red, "redMul works only with red numbers");
62389
+ assert(this.red, "redMul works only with red numbers");
62405
62390
  this.red._verify2(this, num);
62406
62391
  return this.red.mul(this, num);
62407
62392
  };
62408
62393
  BN.prototype.redIMul = function redIMul(num) {
62409
- assert2(this.red, "redMul works only with red numbers");
62394
+ assert(this.red, "redMul works only with red numbers");
62410
62395
  this.red._verify2(this, num);
62411
62396
  return this.red.imul(this, num);
62412
62397
  };
62413
62398
  BN.prototype.redSqr = function redSqr() {
62414
- assert2(this.red, "redSqr works only with red numbers");
62399
+ assert(this.red, "redSqr works only with red numbers");
62415
62400
  this.red._verify1(this);
62416
62401
  return this.red.sqr(this);
62417
62402
  };
62418
62403
  BN.prototype.redISqr = function redISqr() {
62419
- assert2(this.red, "redISqr works only with red numbers");
62404
+ assert(this.red, "redISqr works only with red numbers");
62420
62405
  this.red._verify1(this);
62421
62406
  return this.red.isqr(this);
62422
62407
  };
62423
62408
  BN.prototype.redSqrt = function redSqrt() {
62424
- assert2(this.red, "redSqrt works only with red numbers");
62409
+ assert(this.red, "redSqrt works only with red numbers");
62425
62410
  this.red._verify1(this);
62426
62411
  return this.red.sqrt(this);
62427
62412
  };
62428
62413
  BN.prototype.redInvm = function redInvm() {
62429
- assert2(this.red, "redInvm works only with red numbers");
62414
+ assert(this.red, "redInvm works only with red numbers");
62430
62415
  this.red._verify1(this);
62431
62416
  return this.red.invm(this);
62432
62417
  };
62433
62418
  BN.prototype.redNeg = function redNeg() {
62434
- assert2(this.red, "redNeg works only with red numbers");
62419
+ assert(this.red, "redNeg works only with red numbers");
62435
62420
  this.red._verify1(this);
62436
62421
  return this.red.neg(this);
62437
62422
  };
62438
62423
  BN.prototype.redPow = function redPow(num) {
62439
- assert2(this.red && !num.red, "redPow(normalNum)");
62424
+ assert(this.red && !num.red, "redPow(normalNum)");
62440
62425
  this.red._verify1(this);
62441
62426
  return this.red.pow(this, num);
62442
62427
  };
@@ -62604,18 +62589,18 @@ var require_bn = __commonJS({
62604
62589
  this.m = prime.p;
62605
62590
  this.prime = prime;
62606
62591
  } else {
62607
- assert2(m.gtn(1), "modulus must be greater than 1");
62592
+ assert(m.gtn(1), "modulus must be greater than 1");
62608
62593
  this.m = m;
62609
62594
  this.prime = null;
62610
62595
  }
62611
62596
  }
62612
62597
  Red.prototype._verify1 = function _verify1(a) {
62613
- assert2(a.negative === 0, "red works only with positives");
62614
- assert2(a.red, "red works only with red numbers");
62598
+ assert(a.negative === 0, "red works only with positives");
62599
+ assert(a.red, "red works only with red numbers");
62615
62600
  };
62616
62601
  Red.prototype._verify2 = function _verify2(a, b) {
62617
- assert2((a.negative | b.negative) === 0, "red works only with positives");
62618
- assert2(
62602
+ assert((a.negative | b.negative) === 0, "red works only with positives");
62603
+ assert(
62619
62604
  a.red && a.red === b.red,
62620
62605
  "red works only with red numbers"
62621
62606
  );
@@ -62686,7 +62671,7 @@ var require_bn = __commonJS({
62686
62671
  if (a.isZero())
62687
62672
  return a.clone();
62688
62673
  var mod3 = this.m.andln(3);
62689
- assert2(mod3 % 2 === 1);
62674
+ assert(mod3 % 2 === 1);
62690
62675
  if (mod3 === 3) {
62691
62676
  var pow = this.m.add(new BN(1)).iushrn(2);
62692
62677
  return this.pow(a, pow);
@@ -62697,7 +62682,7 @@ var require_bn = __commonJS({
62697
62682
  s++;
62698
62683
  q.iushrn(1);
62699
62684
  }
62700
- assert2(!q.isZero());
62685
+ assert(!q.isZero());
62701
62686
  var one = new BN(1).toRed(this);
62702
62687
  var nOne = one.redNeg();
62703
62688
  var lpow = this.m.subn(1).iushrn(1);
@@ -62715,7 +62700,7 @@ var require_bn = __commonJS({
62715
62700
  for (var i = 0; tmp.cmp(one) !== 0; i++) {
62716
62701
  tmp = tmp.redSqr();
62717
62702
  }
62718
- assert2(i < m);
62703
+ assert(i < m);
62719
62704
  var b = this.pow(c, new BN(1).iushln(m - i - 1));
62720
62705
  r = r.redMul(b);
62721
62706
  c = b.redSqr();
@@ -71309,7 +71294,7 @@ var require_bn2 = __commonJS({
71309
71294
  "node_modules/elliptic/node_modules/bn.js/lib/bn.js"(exports2, module2) {
71310
71295
  (function(module3, exports3) {
71311
71296
  "use strict";
71312
- function assert2(val, msg) {
71297
+ function assert(val, msg) {
71313
71298
  if (!val)
71314
71299
  throw new Error(msg || "Assertion failed");
71315
71300
  }
@@ -71379,7 +71364,7 @@ var require_bn2 = __commonJS({
71379
71364
  if (base === "hex") {
71380
71365
  base = 16;
71381
71366
  }
71382
- assert2(base === (base | 0) && base >= 2 && base <= 36);
71367
+ assert(base === (base | 0) && base >= 2 && base <= 36);
71383
71368
  number = number.toString().replace(/\s+/g, "");
71384
71369
  var start = 0;
71385
71370
  if (number[0] === "-") {
@@ -71412,7 +71397,7 @@ var require_bn2 = __commonJS({
71412
71397
  ];
71413
71398
  this.length = 2;
71414
71399
  } else {
71415
- assert2(number < 9007199254740992);
71400
+ assert(number < 9007199254740992);
71416
71401
  this.words = [
71417
71402
  number & 67108863,
71418
71403
  number / 67108864 & 67108863,
@@ -71425,7 +71410,7 @@ var require_bn2 = __commonJS({
71425
71410
  this._initArray(this.toArray(), base, endian);
71426
71411
  };
71427
71412
  BN.prototype._initArray = function _initArray(number, base, endian) {
71428
- assert2(typeof number.length === "number");
71413
+ assert(typeof number.length === "number");
71429
71414
  if (number.length <= 0) {
71430
71415
  this.words = [0];
71431
71416
  this.length = 1;
@@ -71770,7 +71755,7 @@ var require_bn2 = __commonJS({
71770
71755
  }
71771
71756
  return out;
71772
71757
  }
71773
- assert2(false, "Base should be between 2 and 36");
71758
+ assert(false, "Base should be between 2 and 36");
71774
71759
  };
71775
71760
  BN.prototype.toNumber = function toNumber() {
71776
71761
  var ret = this.words[0];
@@ -71779,7 +71764,7 @@ var require_bn2 = __commonJS({
71779
71764
  } else if (this.length === 3 && this.words[2] === 1) {
71780
71765
  ret += 4503599627370496 + this.words[1] * 67108864;
71781
71766
  } else if (this.length > 2) {
71782
- assert2(false, "Number can only safely store up to 53 bits");
71767
+ assert(false, "Number can only safely store up to 53 bits");
71783
71768
  }
71784
71769
  return this.negative !== 0 ? -ret : ret;
71785
71770
  };
@@ -71787,7 +71772,7 @@ var require_bn2 = __commonJS({
71787
71772
  return this.toString(16);
71788
71773
  };
71789
71774
  BN.prototype.toBuffer = function toBuffer(endian, length) {
71790
- assert2(typeof Buffer2 !== "undefined");
71775
+ assert(typeof Buffer2 !== "undefined");
71791
71776
  return this.toArrayLike(Buffer2, endian, length);
71792
71777
  };
71793
71778
  BN.prototype.toArray = function toArray(endian, length) {
@@ -71796,8 +71781,8 @@ var require_bn2 = __commonJS({
71796
71781
  BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {
71797
71782
  var byteLength = this.byteLength();
71798
71783
  var reqLength = length || Math.max(1, byteLength);
71799
- assert2(byteLength <= reqLength, "byte array longer than desired length");
71800
- assert2(reqLength > 0, "Requested array length <= 0");
71784
+ assert(byteLength <= reqLength, "byte array longer than desired length");
71785
+ assert(reqLength > 0, "Requested array length <= 0");
71801
71786
  this.strip();
71802
71787
  var littleEndian = endian === "le";
71803
71788
  var res = new ArrayType(reqLength);
@@ -71940,7 +71925,7 @@ var require_bn2 = __commonJS({
71940
71925
  return this.strip();
71941
71926
  };
71942
71927
  BN.prototype.ior = function ior(num) {
71943
- assert2((this.negative | num.negative) === 0);
71928
+ assert((this.negative | num.negative) === 0);
71944
71929
  return this.iuor(num);
71945
71930
  };
71946
71931
  BN.prototype.or = function or(num) {
@@ -71967,7 +71952,7 @@ var require_bn2 = __commonJS({
71967
71952
  return this.strip();
71968
71953
  };
71969
71954
  BN.prototype.iand = function iand(num) {
71970
- assert2((this.negative | num.negative) === 0);
71955
+ assert((this.negative | num.negative) === 0);
71971
71956
  return this.iuand(num);
71972
71957
  };
71973
71958
  BN.prototype.and = function and(num) {
@@ -72002,7 +71987,7 @@ var require_bn2 = __commonJS({
72002
71987
  return this.strip();
72003
71988
  };
72004
71989
  BN.prototype.ixor = function ixor(num) {
72005
- assert2((this.negative | num.negative) === 0);
71990
+ assert((this.negative | num.negative) === 0);
72006
71991
  return this.iuxor(num);
72007
71992
  };
72008
71993
  BN.prototype.xor = function xor(num) {
@@ -72016,7 +72001,7 @@ var require_bn2 = __commonJS({
72016
72001
  return num.clone().iuxor(this);
72017
72002
  };
72018
72003
  BN.prototype.inotn = function inotn(width) {
72019
- assert2(typeof width === "number" && width >= 0);
72004
+ assert(typeof width === "number" && width >= 0);
72020
72005
  var bytesNeeded = Math.ceil(width / 26) | 0;
72021
72006
  var bitsLeft = width % 26;
72022
72007
  this._expand(bytesNeeded);
@@ -72035,7 +72020,7 @@ var require_bn2 = __commonJS({
72035
72020
  return this.clone().inotn(width);
72036
72021
  };
72037
72022
  BN.prototype.setn = function setn(bit, val) {
72038
- assert2(typeof bit === "number" && bit >= 0);
72023
+ assert(typeof bit === "number" && bit >= 0);
72039
72024
  var off = bit / 26 | 0;
72040
72025
  var wbit = bit % 26;
72041
72026
  this._expand(off + 1);
@@ -72902,8 +72887,8 @@ var require_bn2 = __commonJS({
72902
72887
  for (i = 2 * len; i < N; ++i) {
72903
72888
  rws[i] = 0;
72904
72889
  }
72905
- assert2(carry === 0);
72906
- assert2((carry & ~8191) === 0);
72890
+ assert(carry === 0);
72891
+ assert((carry & ~8191) === 0);
72907
72892
  };
72908
72893
  FFTM.prototype.stub = function stub(N) {
72909
72894
  var ph = new Array(N);
@@ -72955,8 +72940,8 @@ var require_bn2 = __commonJS({
72955
72940
  return this.clone().mulTo(num, this);
72956
72941
  };
72957
72942
  BN.prototype.imuln = function imuln(num) {
72958
- assert2(typeof num === "number");
72959
- assert2(num < 67108864);
72943
+ assert(typeof num === "number");
72944
+ assert(num < 67108864);
72960
72945
  var carry = 0;
72961
72946
  for (var i = 0; i < this.length; i++) {
72962
72947
  var w = (this.words[i] | 0) * num;
@@ -73000,7 +72985,7 @@ var require_bn2 = __commonJS({
73000
72985
  return res;
73001
72986
  };
73002
72987
  BN.prototype.iushln = function iushln(bits) {
73003
- assert2(typeof bits === "number" && bits >= 0);
72988
+ assert(typeof bits === "number" && bits >= 0);
73004
72989
  var r = bits % 26;
73005
72990
  var s = (bits - r) / 26;
73006
72991
  var carryMask = 67108863 >>> 26 - r << 26 - r;
@@ -73030,11 +73015,11 @@ var require_bn2 = __commonJS({
73030
73015
  return this.strip();
73031
73016
  };
73032
73017
  BN.prototype.ishln = function ishln(bits) {
73033
- assert2(this.negative === 0);
73018
+ assert(this.negative === 0);
73034
73019
  return this.iushln(bits);
73035
73020
  };
73036
73021
  BN.prototype.iushrn = function iushrn(bits, hint, extended) {
73037
- assert2(typeof bits === "number" && bits >= 0);
73022
+ assert(typeof bits === "number" && bits >= 0);
73038
73023
  var h;
73039
73024
  if (hint) {
73040
73025
  h = (hint - hint % 26) / 26;
@@ -73079,7 +73064,7 @@ var require_bn2 = __commonJS({
73079
73064
  return this.strip();
73080
73065
  };
73081
73066
  BN.prototype.ishrn = function ishrn(bits, hint, extended) {
73082
- assert2(this.negative === 0);
73067
+ assert(this.negative === 0);
73083
73068
  return this.iushrn(bits, hint, extended);
73084
73069
  };
73085
73070
  BN.prototype.shln = function shln(bits) {
@@ -73095,7 +73080,7 @@ var require_bn2 = __commonJS({
73095
73080
  return this.clone().iushrn(bits);
73096
73081
  };
73097
73082
  BN.prototype.testn = function testn(bit) {
73098
- assert2(typeof bit === "number" && bit >= 0);
73083
+ assert(typeof bit === "number" && bit >= 0);
73099
73084
  var r = bit % 26;
73100
73085
  var s = (bit - r) / 26;
73101
73086
  var q = 1 << r;
@@ -73105,10 +73090,10 @@ var require_bn2 = __commonJS({
73105
73090
  return !!(w & q);
73106
73091
  };
73107
73092
  BN.prototype.imaskn = function imaskn(bits) {
73108
- assert2(typeof bits === "number" && bits >= 0);
73093
+ assert(typeof bits === "number" && bits >= 0);
73109
73094
  var r = bits % 26;
73110
73095
  var s = (bits - r) / 26;
73111
- assert2(this.negative === 0, "imaskn works only with positive numbers");
73096
+ assert(this.negative === 0, "imaskn works only with positive numbers");
73112
73097
  if (this.length <= s) {
73113
73098
  return this;
73114
73099
  }
@@ -73126,8 +73111,8 @@ var require_bn2 = __commonJS({
73126
73111
  return this.clone().imaskn(bits);
73127
73112
  };
73128
73113
  BN.prototype.iaddn = function iaddn(num) {
73129
- assert2(typeof num === "number");
73130
- assert2(num < 67108864);
73114
+ assert(typeof num === "number");
73115
+ assert(num < 67108864);
73131
73116
  if (num < 0)
73132
73117
  return this.isubn(-num);
73133
73118
  if (this.negative !== 0) {
@@ -73157,8 +73142,8 @@ var require_bn2 = __commonJS({
73157
73142
  return this;
73158
73143
  };
73159
73144
  BN.prototype.isubn = function isubn(num) {
73160
- assert2(typeof num === "number");
73161
- assert2(num < 67108864);
73145
+ assert(typeof num === "number");
73146
+ assert(num < 67108864);
73162
73147
  if (num < 0)
73163
73148
  return this.iaddn(-num);
73164
73149
  if (this.negative !== 0) {
@@ -73212,7 +73197,7 @@ var require_bn2 = __commonJS({
73212
73197
  }
73213
73198
  if (carry === 0)
73214
73199
  return this.strip();
73215
- assert2(carry === -1);
73200
+ assert(carry === -1);
73216
73201
  carry = 0;
73217
73202
  for (i = 0; i < this.length; i++) {
73218
73203
  w = -(this.words[i] | 0) + carry;
@@ -73280,7 +73265,7 @@ var require_bn2 = __commonJS({
73280
73265
  };
73281
73266
  };
73282
73267
  BN.prototype.divmod = function divmod(num, mode, positive) {
73283
- assert2(!num.isZero());
73268
+ assert(!num.isZero());
73284
73269
  if (this.isZero()) {
73285
73270
  return {
73286
73271
  div: new BN(0),
@@ -73375,7 +73360,7 @@ var require_bn2 = __commonJS({
73375
73360
  return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
73376
73361
  };
73377
73362
  BN.prototype.modn = function modn(num) {
73378
- assert2(num <= 67108863);
73363
+ assert(num <= 67108863);
73379
73364
  var p = (1 << 26) % num;
73380
73365
  var acc = 0;
73381
73366
  for (var i = this.length - 1; i >= 0; i--) {
@@ -73384,7 +73369,7 @@ var require_bn2 = __commonJS({
73384
73369
  return acc;
73385
73370
  };
73386
73371
  BN.prototype.idivn = function idivn(num) {
73387
- assert2(num <= 67108863);
73372
+ assert(num <= 67108863);
73388
73373
  var carry = 0;
73389
73374
  for (var i = this.length - 1; i >= 0; i--) {
73390
73375
  var w = (this.words[i] | 0) + carry * 67108864;
@@ -73397,8 +73382,8 @@ var require_bn2 = __commonJS({
73397
73382
  return this.clone().idivn(num);
73398
73383
  };
73399
73384
  BN.prototype.egcd = function egcd(p) {
73400
- assert2(p.negative === 0);
73401
- assert2(!p.isZero());
73385
+ assert(p.negative === 0);
73386
+ assert(!p.isZero());
73402
73387
  var x = this;
73403
73388
  var y = p.clone();
73404
73389
  if (x.negative !== 0) {
@@ -73462,8 +73447,8 @@ var require_bn2 = __commonJS({
73462
73447
  };
73463
73448
  };
73464
73449
  BN.prototype._invmp = function _invmp(p) {
73465
- assert2(p.negative === 0);
73466
- assert2(!p.isZero());
73450
+ assert(p.negative === 0);
73451
+ assert(!p.isZero());
73467
73452
  var a = this;
73468
73453
  var b = p.clone();
73469
73454
  if (a.negative !== 0) {
@@ -73561,7 +73546,7 @@ var require_bn2 = __commonJS({
73561
73546
  return this.words[0] & num;
73562
73547
  };
73563
73548
  BN.prototype.bincn = function bincn(bit) {
73564
- assert2(typeof bit === "number");
73549
+ assert(typeof bit === "number");
73565
73550
  var r = bit % 26;
73566
73551
  var s = (bit - r) / 26;
73567
73552
  var q = 1 << r;
@@ -73601,7 +73586,7 @@ var require_bn2 = __commonJS({
73601
73586
  if (negative) {
73602
73587
  num = -num;
73603
73588
  }
73604
- assert2(num <= 67108863, "Number is too big");
73589
+ assert(num <= 67108863, "Number is too big");
73605
73590
  var w = this.words[0] | 0;
73606
73591
  res = w === num ? 0 : w < num ? -1 : 1;
73607
73592
  }
@@ -73673,12 +73658,12 @@ var require_bn2 = __commonJS({
73673
73658
  return new Red(num);
73674
73659
  };
73675
73660
  BN.prototype.toRed = function toRed(ctx) {
73676
- assert2(!this.red, "Already a number in reduction context");
73677
- assert2(this.negative === 0, "red works only with positives");
73661
+ assert(!this.red, "Already a number in reduction context");
73662
+ assert(this.negative === 0, "red works only with positives");
73678
73663
  return ctx.convertTo(this)._forceRed(ctx);
73679
73664
  };
73680
73665
  BN.prototype.fromRed = function fromRed() {
73681
- assert2(this.red, "fromRed works only with numbers in reduction context");
73666
+ assert(this.red, "fromRed works only with numbers in reduction context");
73682
73667
  return this.red.convertFrom(this);
73683
73668
  };
73684
73669
  BN.prototype._forceRed = function _forceRed(ctx) {
@@ -73686,66 +73671,66 @@ var require_bn2 = __commonJS({
73686
73671
  return this;
73687
73672
  };
73688
73673
  BN.prototype.forceRed = function forceRed(ctx) {
73689
- assert2(!this.red, "Already a number in reduction context");
73674
+ assert(!this.red, "Already a number in reduction context");
73690
73675
  return this._forceRed(ctx);
73691
73676
  };
73692
73677
  BN.prototype.redAdd = function redAdd(num) {
73693
- assert2(this.red, "redAdd works only with red numbers");
73678
+ assert(this.red, "redAdd works only with red numbers");
73694
73679
  return this.red.add(this, num);
73695
73680
  };
73696
73681
  BN.prototype.redIAdd = function redIAdd(num) {
73697
- assert2(this.red, "redIAdd works only with red numbers");
73682
+ assert(this.red, "redIAdd works only with red numbers");
73698
73683
  return this.red.iadd(this, num);
73699
73684
  };
73700
73685
  BN.prototype.redSub = function redSub(num) {
73701
- assert2(this.red, "redSub works only with red numbers");
73686
+ assert(this.red, "redSub works only with red numbers");
73702
73687
  return this.red.sub(this, num);
73703
73688
  };
73704
73689
  BN.prototype.redISub = function redISub(num) {
73705
- assert2(this.red, "redISub works only with red numbers");
73690
+ assert(this.red, "redISub works only with red numbers");
73706
73691
  return this.red.isub(this, num);
73707
73692
  };
73708
73693
  BN.prototype.redShl = function redShl(num) {
73709
- assert2(this.red, "redShl works only with red numbers");
73694
+ assert(this.red, "redShl works only with red numbers");
73710
73695
  return this.red.shl(this, num);
73711
73696
  };
73712
73697
  BN.prototype.redMul = function redMul(num) {
73713
- assert2(this.red, "redMul works only with red numbers");
73698
+ assert(this.red, "redMul works only with red numbers");
73714
73699
  this.red._verify2(this, num);
73715
73700
  return this.red.mul(this, num);
73716
73701
  };
73717
73702
  BN.prototype.redIMul = function redIMul(num) {
73718
- assert2(this.red, "redMul works only with red numbers");
73703
+ assert(this.red, "redMul works only with red numbers");
73719
73704
  this.red._verify2(this, num);
73720
73705
  return this.red.imul(this, num);
73721
73706
  };
73722
73707
  BN.prototype.redSqr = function redSqr() {
73723
- assert2(this.red, "redSqr works only with red numbers");
73708
+ assert(this.red, "redSqr works only with red numbers");
73724
73709
  this.red._verify1(this);
73725
73710
  return this.red.sqr(this);
73726
73711
  };
73727
73712
  BN.prototype.redISqr = function redISqr() {
73728
- assert2(this.red, "redISqr works only with red numbers");
73713
+ assert(this.red, "redISqr works only with red numbers");
73729
73714
  this.red._verify1(this);
73730
73715
  return this.red.isqr(this);
73731
73716
  };
73732
73717
  BN.prototype.redSqrt = function redSqrt() {
73733
- assert2(this.red, "redSqrt works only with red numbers");
73718
+ assert(this.red, "redSqrt works only with red numbers");
73734
73719
  this.red._verify1(this);
73735
73720
  return this.red.sqrt(this);
73736
73721
  };
73737
73722
  BN.prototype.redInvm = function redInvm() {
73738
- assert2(this.red, "redInvm works only with red numbers");
73723
+ assert(this.red, "redInvm works only with red numbers");
73739
73724
  this.red._verify1(this);
73740
73725
  return this.red.invm(this);
73741
73726
  };
73742
73727
  BN.prototype.redNeg = function redNeg() {
73743
- assert2(this.red, "redNeg works only with red numbers");
73728
+ assert(this.red, "redNeg works only with red numbers");
73744
73729
  this.red._verify1(this);
73745
73730
  return this.red.neg(this);
73746
73731
  };
73747
73732
  BN.prototype.redPow = function redPow(num) {
73748
- assert2(this.red && !num.red, "redPow(normalNum)");
73733
+ assert(this.red && !num.red, "redPow(normalNum)");
73749
73734
  this.red._verify1(this);
73750
73735
  return this.red.pow(this, num);
73751
73736
  };
@@ -73913,18 +73898,18 @@ var require_bn2 = __commonJS({
73913
73898
  this.m = prime.p;
73914
73899
  this.prime = prime;
73915
73900
  } else {
73916
- assert2(m.gtn(1), "modulus must be greater than 1");
73901
+ assert(m.gtn(1), "modulus must be greater than 1");
73917
73902
  this.m = m;
73918
73903
  this.prime = null;
73919
73904
  }
73920
73905
  }
73921
73906
  Red.prototype._verify1 = function _verify1(a) {
73922
- assert2(a.negative === 0, "red works only with positives");
73923
- assert2(a.red, "red works only with red numbers");
73907
+ assert(a.negative === 0, "red works only with positives");
73908
+ assert(a.red, "red works only with red numbers");
73924
73909
  };
73925
73910
  Red.prototype._verify2 = function _verify2(a, b) {
73926
- assert2((a.negative | b.negative) === 0, "red works only with positives");
73927
- assert2(
73911
+ assert((a.negative | b.negative) === 0, "red works only with positives");
73912
+ assert(
73928
73913
  a.red && a.red === b.red,
73929
73914
  "red works only with red numbers"
73930
73915
  );
@@ -73994,7 +73979,7 @@ var require_bn2 = __commonJS({
73994
73979
  if (a.isZero())
73995
73980
  return a.clone();
73996
73981
  var mod3 = this.m.andln(3);
73997
- assert2(mod3 % 2 === 1);
73982
+ assert(mod3 % 2 === 1);
73998
73983
  if (mod3 === 3) {
73999
73984
  var pow = this.m.add(new BN(1)).iushrn(2);
74000
73985
  return this.pow(a, pow);
@@ -74005,7 +73990,7 @@ var require_bn2 = __commonJS({
74005
73990
  s++;
74006
73991
  q.iushrn(1);
74007
73992
  }
74008
- assert2(!q.isZero());
73993
+ assert(!q.isZero());
74009
73994
  var one = new BN(1).toRed(this);
74010
73995
  var nOne = one.redNeg();
74011
73996
  var lpow = this.m.subn(1).iushrn(1);
@@ -74023,7 +74008,7 @@ var require_bn2 = __commonJS({
74023
74008
  for (var i = 0; tmp.cmp(one) !== 0; i++) {
74024
74009
  tmp = tmp.redSqr();
74025
74010
  }
74026
- assert2(i < m);
74011
+ assert(i < m);
74027
74012
  var b = this.pow(c, new BN(1).iushln(m - i - 1));
74028
74013
  r = r.redMul(b);
74029
74014
  c = b.redSqr();
@@ -74160,12 +74145,12 @@ var require_bn2 = __commonJS({
74160
74145
  // node_modules/minimalistic-assert/index.js
74161
74146
  var require_minimalistic_assert = __commonJS({
74162
74147
  "node_modules/minimalistic-assert/index.js"(exports2, module2) {
74163
- module2.exports = assert2;
74164
- function assert2(val, msg) {
74148
+ module2.exports = assert;
74149
+ function assert(val, msg) {
74165
74150
  if (!val)
74166
74151
  throw new Error(msg || "Assertion failed");
74167
74152
  }
74168
- assert2.equal = function assertEqual(l, r, msg) {
74153
+ assert.equal = function assertEqual(l, r, msg) {
74169
74154
  if (l != r)
74170
74155
  throw new Error(msg || "Assertion failed: " + l + " != " + r);
74171
74156
  };
@@ -74399,7 +74384,7 @@ var require_base = __commonJS({
74399
74384
  var utils = require_utils9();
74400
74385
  var getNAF = utils.getNAF;
74401
74386
  var getJSF = utils.getJSF;
74402
- var assert2 = utils.assert;
74387
+ var assert = utils.assert;
74403
74388
  function BaseCurve(type, conf) {
74404
74389
  this.type = type;
74405
74390
  this.p = new BN(conf.p, 16);
@@ -74430,7 +74415,7 @@ var require_base = __commonJS({
74430
74415
  throw new Error("Not implemented");
74431
74416
  };
74432
74417
  BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
74433
- assert2(p.precomputed);
74418
+ assert(p.precomputed);
74434
74419
  var doubles = p._getDoubles();
74435
74420
  var naf = getNAF(k, 1, this._bitLength);
74436
74421
  var I = (1 << doubles.step + 1) - (doubles.step % 2 === 0 ? 2 : 1);
@@ -74474,7 +74459,7 @@ var require_base = __commonJS({
74474
74459
  if (i < 0)
74475
74460
  break;
74476
74461
  var z = naf[i];
74477
- assert2(z !== 0);
74462
+ assert(z !== 0);
74478
74463
  if (p.type === "affine") {
74479
74464
  if (z > 0)
74480
74465
  acc = acc.mixedAdd(wnd[z - 1 >> 1]);
@@ -74625,9 +74610,9 @@ var require_base = __commonJS({
74625
74610
  var len = this.p.byteLength();
74626
74611
  if ((bytes[0] === 4 || bytes[0] === 6 || bytes[0] === 7) && bytes.length - 1 === 2 * len) {
74627
74612
  if (bytes[0] === 6)
74628
- assert2(bytes[bytes.length - 1] % 2 === 0);
74613
+ assert(bytes[bytes.length - 1] % 2 === 0);
74629
74614
  else if (bytes[0] === 7)
74630
- assert2(bytes[bytes.length - 1] % 2 === 1);
74615
+ assert(bytes[bytes.length - 1] % 2 === 1);
74631
74616
  var res = this.point(
74632
74617
  bytes.slice(1, 1 + len),
74633
74618
  bytes.slice(1 + len, 1 + 2 * len)
@@ -74721,7 +74706,7 @@ var require_short = __commonJS({
74721
74706
  var BN = require_bn2();
74722
74707
  var inherits = require_inherits();
74723
74708
  var Base = require_base();
74724
- var assert2 = utils.assert;
74709
+ var assert = utils.assert;
74725
74710
  function ShortCurve(conf) {
74726
74711
  Base.call(this, "short", conf);
74727
74712
  this.a = new BN(conf.a, 16).toRed(this.red);
@@ -74755,7 +74740,7 @@ var require_short = __commonJS({
74755
74740
  lambda = lambdas[0];
74756
74741
  } else {
74757
74742
  lambda = lambdas[1];
74758
- assert2(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);
74743
+ assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);
74759
74744
  }
74760
74745
  }
74761
74746
  var basis;
@@ -75547,7 +75532,7 @@ var require_edwards = __commonJS({
75547
75532
  var BN = require_bn2();
75548
75533
  var inherits = require_inherits();
75549
75534
  var Base = require_base();
75550
- var assert2 = utils.assert;
75535
+ var assert = utils.assert;
75551
75536
  function EdwardsCurve(conf) {
75552
75537
  this.twisted = (conf.a | 0) !== 1;
75553
75538
  this.mOneA = this.twisted && (conf.a | 0) === -1;
@@ -75559,7 +75544,7 @@ var require_edwards = __commonJS({
75559
75544
  this.c2 = this.c.redSqr();
75560
75545
  this.d = new BN(conf.d, 16).toRed(this.red);
75561
75546
  this.dd = this.d.redAdd(this.d);
75562
- assert2(!this.twisted || this.c.fromRed().cmpn(1) === 0);
75547
+ assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);
75563
75548
  this.oneC = (conf.c | 0) === 1;
75564
75549
  }
75565
75550
  inherits(EdwardsCurve, Base);
@@ -75856,7 +75841,7 @@ var require_curve = __commonJS({
75856
75841
  var require_utils10 = __commonJS({
75857
75842
  "node_modules/hash.js/lib/hash/utils.js"(exports2) {
75858
75843
  "use strict";
75859
- var assert2 = require_minimalistic_assert();
75844
+ var assert = require_minimalistic_assert();
75860
75845
  var inherits = require_inherits();
75861
75846
  exports2.inherits = inherits;
75862
75847
  function isSurrogatePair(msg, i) {
@@ -75961,7 +75946,7 @@ var require_utils10 = __commonJS({
75961
75946
  exports2.zero8 = zero8;
75962
75947
  function join32(msg, start, end, endian) {
75963
75948
  var len = end - start;
75964
- assert2(len % 4 === 0);
75949
+ assert(len % 4 === 0);
75965
75950
  var res = new Array(len / 4);
75966
75951
  for (var i = 0, k = start; i < res.length; i++, k += 4) {
75967
75952
  var w;
@@ -76102,7 +76087,7 @@ var require_common3 = __commonJS({
76102
76087
  "node_modules/hash.js/lib/hash/common.js"(exports2) {
76103
76088
  "use strict";
76104
76089
  var utils = require_utils10();
76105
- var assert2 = require_minimalistic_assert();
76090
+ var assert = require_minimalistic_assert();
76106
76091
  function BlockHash() {
76107
76092
  this.pending = null;
76108
76093
  this.pendingTotal = 0;
@@ -76136,7 +76121,7 @@ var require_common3 = __commonJS({
76136
76121
  };
76137
76122
  BlockHash.prototype.digest = function digest(enc) {
76138
76123
  this.update(this._pad());
76139
- assert2(this.pending === null);
76124
+ assert(this.pending === null);
76140
76125
  return this._digest(enc);
76141
76126
  };
76142
76127
  BlockHash.prototype._pad = function pad() {
@@ -76301,7 +76286,7 @@ var require__2 = __commonJS({
76301
76286
  var utils = require_utils10();
76302
76287
  var common = require_common3();
76303
76288
  var shaCommon = require_common4();
76304
- var assert2 = require_minimalistic_assert();
76289
+ var assert = require_minimalistic_assert();
76305
76290
  var sum32 = utils.sum32;
76306
76291
  var sum32_4 = utils.sum32_4;
76307
76292
  var sum32_5 = utils.sum32_5;
@@ -76415,7 +76400,7 @@ var require__2 = __commonJS({
76415
76400
  var f = this.h[5];
76416
76401
  var g = this.h[6];
76417
76402
  var h = this.h[7];
76418
- assert2(this.k.length === W.length);
76403
+ assert(this.k.length === W.length);
76419
76404
  for (i = 0; i < W.length; i++) {
76420
76405
  var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);
76421
76406
  var T2 = sum32(s0_256(a), maj32(a, b, c));
@@ -76488,7 +76473,7 @@ var require__4 = __commonJS({
76488
76473
  "use strict";
76489
76474
  var utils = require_utils10();
76490
76475
  var common = require_common3();
76491
- var assert2 = require_minimalistic_assert();
76476
+ var assert = require_minimalistic_assert();
76492
76477
  var rotr64_hi = utils.rotr64_hi;
76493
76478
  var rotr64_lo = utils.rotr64_lo;
76494
76479
  var shr64_hi = utils.shr64_hi;
@@ -76748,7 +76733,7 @@ var require__4 = __commonJS({
76748
76733
  var gl = this.h[13];
76749
76734
  var hh = this.h[14];
76750
76735
  var hl = this.h[15];
76751
- assert2(this.k.length === W.length);
76736
+ assert(this.k.length === W.length);
76752
76737
  for (var i = 0; i < W.length; i += 2) {
76753
76738
  var c0_hi = hh;
76754
76739
  var c0_lo = hl;
@@ -77423,7 +77408,7 @@ var require_hmac3 = __commonJS({
77423
77408
  "node_modules/hash.js/lib/hash/hmac.js"(exports2, module2) {
77424
77409
  "use strict";
77425
77410
  var utils = require_utils10();
77426
- var assert2 = require_minimalistic_assert();
77411
+ var assert = require_minimalistic_assert();
77427
77412
  function Hmac(hash, key, enc) {
77428
77413
  if (!(this instanceof Hmac))
77429
77414
  return new Hmac(hash, key, enc);
@@ -77438,7 +77423,7 @@ var require_hmac3 = __commonJS({
77438
77423
  Hmac.prototype._init = function init(key) {
77439
77424
  if (key.length > this.blockSize)
77440
77425
  key = new this.Hash().update(key).digest();
77441
- assert2(key.length <= this.blockSize);
77426
+ assert(key.length <= this.blockSize);
77442
77427
  for (var i = key.length; i < this.blockSize; i++)
77443
77428
  key.push(0);
77444
77429
  for (i = 0; i < key.length; i++)
@@ -78271,7 +78256,7 @@ var require_curves = __commonJS({
78271
78256
  var hash = require_hash2();
78272
78257
  var curve = require_curve();
78273
78258
  var utils = require_utils9();
78274
- var assert2 = utils.assert;
78259
+ var assert = utils.assert;
78275
78260
  function PresetCurve(options) {
78276
78261
  if (options.type === "short")
78277
78262
  this.curve = new curve.short(options);
@@ -78282,8 +78267,8 @@ var require_curves = __commonJS({
78282
78267
  this.g = this.curve.g;
78283
78268
  this.n = this.curve.n;
78284
78269
  this.hash = options.hash;
78285
- assert2(this.g.validate(), "Invalid curve");
78286
- assert2(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O");
78270
+ assert(this.g.validate(), "Invalid curve");
78271
+ assert(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O");
78287
78272
  }
78288
78273
  curves.PresetCurve = PresetCurve;
78289
78274
  function defineCurve(name, options) {
@@ -78445,7 +78430,7 @@ var require_hmac_drbg = __commonJS({
78445
78430
  "use strict";
78446
78431
  var hash = require_hash2();
78447
78432
  var utils = require_utils8();
78448
- var assert2 = require_minimalistic_assert();
78433
+ var assert = require_minimalistic_assert();
78449
78434
  function HmacDRBG(options) {
78450
78435
  if (!(this instanceof HmacDRBG))
78451
78436
  return new HmacDRBG(options);
@@ -78460,7 +78445,7 @@ var require_hmac_drbg = __commonJS({
78460
78445
  var entropy = utils.toArray(options.entropy, options.entropyEnc || "hex");
78461
78446
  var nonce = utils.toArray(options.nonce, options.nonceEnc || "hex");
78462
78447
  var pers = utils.toArray(options.pers, options.persEnc || "hex");
78463
- assert2(
78448
+ assert(
78464
78449
  entropy.length >= this.minEntropy / 8,
78465
78450
  "Not enough entropy. Minimum is: " + this.minEntropy + " bits"
78466
78451
  );
@@ -78501,7 +78486,7 @@ var require_hmac_drbg = __commonJS({
78501
78486
  }
78502
78487
  entropy = utils.toArray(entropy, entropyEnc);
78503
78488
  add = utils.toArray(add, addEnc);
78504
- assert2(
78489
+ assert(
78505
78490
  entropy.length >= this.minEntropy / 8,
78506
78491
  "Not enough entropy. Minimum is: " + this.minEntropy + " bits"
78507
78492
  );
@@ -78539,7 +78524,7 @@ var require_key = __commonJS({
78539
78524
  "use strict";
78540
78525
  var BN = require_bn2();
78541
78526
  var utils = require_utils9();
78542
- var assert2 = utils.assert;
78527
+ var assert = utils.assert;
78543
78528
  function KeyPair(ec, options) {
78544
78529
  this.ec = ec;
78545
78530
  this.priv = null;
@@ -78600,9 +78585,9 @@ var require_key = __commonJS({
78600
78585
  KeyPair.prototype._importPublic = function _importPublic(key, enc) {
78601
78586
  if (key.x || key.y) {
78602
78587
  if (this.ec.curve.type === "mont") {
78603
- assert2(key.x, "Need x coordinate");
78588
+ assert(key.x, "Need x coordinate");
78604
78589
  } else if (this.ec.curve.type === "short" || this.ec.curve.type === "edwards") {
78605
- assert2(key.x && key.y, "Need both x and y coordinate");
78590
+ assert(key.x && key.y, "Need both x and y coordinate");
78606
78591
  }
78607
78592
  this.pub = this.ec.curve.point(key.x, key.y);
78608
78593
  return;
@@ -78611,7 +78596,7 @@ var require_key = __commonJS({
78611
78596
  };
78612
78597
  KeyPair.prototype.derive = function derive(pub) {
78613
78598
  if (!pub.validate()) {
78614
- assert2(pub.validate(), "public point not validated");
78599
+ assert(pub.validate(), "public point not validated");
78615
78600
  }
78616
78601
  return pub.mul(this.priv).getX();
78617
78602
  };
@@ -78633,13 +78618,13 @@ var require_signature3 = __commonJS({
78633
78618
  "use strict";
78634
78619
  var BN = require_bn2();
78635
78620
  var utils = require_utils9();
78636
- var assert2 = utils.assert;
78621
+ var assert = utils.assert;
78637
78622
  function Signature(options, enc) {
78638
78623
  if (options instanceof Signature)
78639
78624
  return options;
78640
78625
  if (this._importDER(options, enc))
78641
78626
  return;
78642
- assert2(options.r && options.s, "Signature without r or s");
78627
+ assert(options.r && options.s, "Signature without r or s");
78643
78628
  this.r = new BN(options.r, 16);
78644
78629
  this.s = new BN(options.s, 16);
78645
78630
  if (options.recoveryParam === void 0)
@@ -78782,14 +78767,14 @@ var require_ec = __commonJS({
78782
78767
  var utils = require_utils9();
78783
78768
  var curves = require_curves();
78784
78769
  var rand = require_brorand();
78785
- var assert2 = utils.assert;
78770
+ var assert = utils.assert;
78786
78771
  var KeyPair = require_key();
78787
78772
  var Signature = require_signature3();
78788
78773
  function EC(options) {
78789
78774
  if (!(this instanceof EC))
78790
78775
  return new EC(options);
78791
78776
  if (typeof options === "string") {
78792
- assert2(
78777
+ assert(
78793
78778
  Object.prototype.hasOwnProperty.call(curves, options),
78794
78779
  "Unknown curve " + options
78795
78780
  );
@@ -78915,7 +78900,7 @@ var require_ec = __commonJS({
78915
78900
  return p.eqXToP(r);
78916
78901
  };
78917
78902
  EC.prototype.recoverPubKey = function(msg, signature, j, enc) {
78918
- assert2((3 & j) === j, "The recovery param is more than two bits");
78903
+ assert((3 & j) === j, "The recovery param is more than two bits");
78919
78904
  signature = new Signature(signature, enc);
78920
78905
  var n = this.n;
78921
78906
  var e = new BN(msg);
@@ -78958,7 +78943,7 @@ var require_key2 = __commonJS({
78958
78943
  "node_modules/elliptic/lib/elliptic/eddsa/key.js"(exports2, module2) {
78959
78944
  "use strict";
78960
78945
  var utils = require_utils9();
78961
- var assert2 = utils.assert;
78946
+ var assert = utils.assert;
78962
78947
  var parseBytes = utils.parseBytes;
78963
78948
  var cachedProperty = utils.cachedProperty;
78964
78949
  function KeyPair(eddsa, params) {
@@ -79010,14 +78995,14 @@ var require_key2 = __commonJS({
79010
78995
  return this.hash().slice(this.eddsa.encodingLength);
79011
78996
  });
79012
78997
  KeyPair.prototype.sign = function sign(message) {
79013
- assert2(this._secret, "KeyPair can only verify");
78998
+ assert(this._secret, "KeyPair can only verify");
79014
78999
  return this.eddsa.sign(message, this);
79015
79000
  };
79016
79001
  KeyPair.prototype.verify = function verify(message, sig) {
79017
79002
  return this.eddsa.verify(message, sig, this);
79018
79003
  };
79019
79004
  KeyPair.prototype.getSecret = function getSecret(enc) {
79020
- assert2(this._secret, "KeyPair is public only");
79005
+ assert(this._secret, "KeyPair is public only");
79021
79006
  return utils.encode(this.secret(), enc);
79022
79007
  };
79023
79008
  KeyPair.prototype.getPublic = function getPublic(enc) {
@@ -79033,7 +79018,7 @@ var require_signature4 = __commonJS({
79033
79018
  "use strict";
79034
79019
  var BN = require_bn2();
79035
79020
  var utils = require_utils9();
79036
- var assert2 = utils.assert;
79021
+ var assert = utils.assert;
79037
79022
  var cachedProperty = utils.cachedProperty;
79038
79023
  var parseBytes = utils.parseBytes;
79039
79024
  function Signature(eddsa, sig) {
@@ -79046,7 +79031,7 @@ var require_signature4 = __commonJS({
79046
79031
  S: sig.slice(eddsa.encodingLength)
79047
79032
  };
79048
79033
  }
79049
- assert2(sig.R && sig.S, "Signature without R or S");
79034
+ assert(sig.R && sig.S, "Signature without R or S");
79050
79035
  if (eddsa.isPoint(sig.R))
79051
79036
  this._R = sig.R;
79052
79037
  if (sig.S instanceof BN)
@@ -79083,12 +79068,12 @@ var require_eddsa = __commonJS({
79083
79068
  var hash = require_hash2();
79084
79069
  var curves = require_curves();
79085
79070
  var utils = require_utils9();
79086
- var assert2 = utils.assert;
79071
+ var assert = utils.assert;
79087
79072
  var parseBytes = utils.parseBytes;
79088
79073
  var KeyPair = require_key2();
79089
79074
  var Signature = require_signature4();
79090
79075
  function EDDSA(curve) {
79091
- assert2(curve === "ed25519", "only tested with ed25519 so far");
79076
+ assert(curve === "ed25519", "only tested with ed25519 so far");
79092
79077
  if (!(this instanceof EDDSA))
79093
79078
  return new EDDSA(curve);
79094
79079
  curve = curves[curve].curve;
@@ -100168,25 +100153,25 @@ var require_lib41 = __commonJS({
100168
100153
  RECOVER: "Public key could not be recover",
100169
100154
  ECDH: "Scalar was invalid (zero or overflow)"
100170
100155
  };
100171
- function assert2(cond, msg) {
100156
+ function assert(cond, msg) {
100172
100157
  if (!cond)
100173
100158
  throw new Error(msg);
100174
100159
  }
100175
100160
  function isUint8Array(name, value, length) {
100176
- assert2(value instanceof Uint8Array, `Expected ${name} to be an Uint8Array`);
100161
+ assert(value instanceof Uint8Array, `Expected ${name} to be an Uint8Array`);
100177
100162
  if (length !== void 0) {
100178
100163
  if (Array.isArray(length)) {
100179
100164
  const numbers = length.join(", ");
100180
100165
  const msg = `Expected ${name} to be an Uint8Array with length [${numbers}]`;
100181
- assert2(length.includes(value.length), msg);
100166
+ assert(length.includes(value.length), msg);
100182
100167
  } else {
100183
100168
  const msg = `Expected ${name} to be an Uint8Array with length ${length}`;
100184
- assert2(value.length === length, msg);
100169
+ assert(value.length === length, msg);
100185
100170
  }
100186
100171
  }
100187
100172
  }
100188
100173
  function isCompressed(value) {
100189
- assert2(toTypeString(value) === "Boolean", "Expected compressed to be a Boolean");
100174
+ assert(toTypeString(value) === "Boolean", "Expected compressed to be a Boolean");
100190
100175
  }
100191
100176
  function getAssertedOutput(output = (len) => new Uint8Array(len), length) {
100192
100177
  if (typeof output === "function")
@@ -100200,7 +100185,7 @@ var require_lib41 = __commonJS({
100200
100185
  module2.exports = (secp256k1) => {
100201
100186
  return {
100202
100187
  contextRandomize(seed) {
100203
- assert2(
100188
+ assert(
100204
100189
  seed === null || seed instanceof Uint8Array,
100205
100190
  "Expected seed to be an Uint8Array or null"
100206
100191
  );
@@ -100290,8 +100275,8 @@ var require_lib41 = __commonJS({
100290
100275
  }
100291
100276
  },
100292
100277
  publicKeyCombine(pubkeys, compressed = true, output) {
100293
- assert2(Array.isArray(pubkeys), "Expected public keys to be an Array");
100294
- assert2(pubkeys.length > 0, "Expected public keys array will have more than zero items");
100278
+ assert(Array.isArray(pubkeys), "Expected public keys to be an Array");
100279
+ assert(pubkeys.length > 0, "Expected public keys array will have more than zero items");
100295
100280
  for (const pubkey of pubkeys) {
100296
100281
  isUint8Array("public key", pubkey, [33, 65]);
100297
100282
  }
@@ -100373,11 +100358,11 @@ var require_lib41 = __commonJS({
100373
100358
  ecdsaSign(msg32, seckey, options = {}, output) {
100374
100359
  isUint8Array("message", msg32, 32);
100375
100360
  isUint8Array("private key", seckey, 32);
100376
- assert2(toTypeString(options) === "Object", "Expected options to be an Object");
100361
+ assert(toTypeString(options) === "Object", "Expected options to be an Object");
100377
100362
  if (options.data !== void 0)
100378
100363
  isUint8Array("options.data", options.data);
100379
100364
  if (options.noncefn !== void 0)
100380
- assert2(toTypeString(options.noncefn) === "Function", "Expected options.noncefn to be a Function");
100365
+ assert(toTypeString(options.noncefn) === "Function", "Expected options.noncefn to be a Function");
100381
100366
  output = getAssertedOutput(output, 64);
100382
100367
  const obj = { signature: output, recid: null };
100383
100368
  switch (secp256k1.ecdsaSign(obj, msg32, seckey, options.data, options.noncefn)) {
@@ -100406,7 +100391,7 @@ var require_lib41 = __commonJS({
100406
100391
  },
100407
100392
  ecdsaRecover(sig, recid, msg32, compressed = true, output) {
100408
100393
  isUint8Array("signature", sig, 64);
100409
- assert2(
100394
+ assert(
100410
100395
  toTypeString(recid) === "Number" && recid >= 0 && recid <= 3,
100411
100396
  "Expected recovery id to be a Number within interval [0, 3]"
100412
100397
  );
@@ -100427,11 +100412,11 @@ var require_lib41 = __commonJS({
100427
100412
  ecdh(pubkey, seckey, options = {}, output) {
100428
100413
  isUint8Array("public key", pubkey, [33, 65]);
100429
100414
  isUint8Array("private key", seckey, 32);
100430
- assert2(toTypeString(options) === "Object", "Expected options to be an Object");
100415
+ assert(toTypeString(options) === "Object", "Expected options to be an Object");
100431
100416
  if (options.data !== void 0)
100432
100417
  isUint8Array("options.data", options.data);
100433
100418
  if (options.hashfn !== void 0) {
100434
- assert2(toTypeString(options.hashfn) === "Function", "Expected options.hashfn to be a Function");
100419
+ assert(toTypeString(options.hashfn) === "Function", "Expected options.hashfn to be a Function");
100435
100420
  if (options.xbuf !== void 0)
100436
100421
  isUint8Array("options.xbuf", options.xbuf, 32);
100437
100422
  if (options.ybuf !== void 0)
@@ -124568,7 +124553,7 @@ var require_bn3 = __commonJS({
124568
124553
  "node_modules/ethjs-unit/node_modules/bn.js/lib/bn.js"(exports2, module2) {
124569
124554
  (function(module3, exports3) {
124570
124555
  "use strict";
124571
- function assert2(val, msg) {
124556
+ function assert(val, msg) {
124572
124557
  if (!val)
124573
124558
  throw new Error(msg || "Assertion failed");
124574
124559
  }
@@ -124634,7 +124619,7 @@ var require_bn3 = __commonJS({
124634
124619
  if (base === "hex") {
124635
124620
  base = 16;
124636
124621
  }
124637
- assert2(base === (base | 0) && base >= 2 && base <= 36);
124622
+ assert(base === (base | 0) && base >= 2 && base <= 36);
124638
124623
  number = number.toString().replace(/\s+/g, "");
124639
124624
  var start = 0;
124640
124625
  if (number[0] === "-") {
@@ -124668,7 +124653,7 @@ var require_bn3 = __commonJS({
124668
124653
  ];
124669
124654
  this.length = 2;
124670
124655
  } else {
124671
- assert2(number < 9007199254740992);
124656
+ assert(number < 9007199254740992);
124672
124657
  this.words = [
124673
124658
  number & 67108863,
124674
124659
  number / 67108864 & 67108863,
@@ -124681,7 +124666,7 @@ var require_bn3 = __commonJS({
124681
124666
  this._initArray(this.toArray(), base, endian);
124682
124667
  };
124683
124668
  BN.prototype._initArray = function _initArray(number, base, endian) {
124684
- assert2(typeof number.length === "number");
124669
+ assert(typeof number.length === "number");
124685
124670
  if (number.length <= 0) {
124686
124671
  this.words = [0];
124687
124672
  this.length = 1;
@@ -125012,7 +124997,7 @@ var require_bn3 = __commonJS({
125012
124997
  }
125013
124998
  return out;
125014
124999
  }
125015
- assert2(false, "Base should be between 2 and 36");
125000
+ assert(false, "Base should be between 2 and 36");
125016
125001
  };
125017
125002
  BN.prototype.toNumber = function toNumber() {
125018
125003
  var ret = this.words[0];
@@ -125021,7 +125006,7 @@ var require_bn3 = __commonJS({
125021
125006
  } else if (this.length === 3 && this.words[2] === 1) {
125022
125007
  ret += 4503599627370496 + this.words[1] * 67108864;
125023
125008
  } else if (this.length > 2) {
125024
- assert2(false, "Number can only safely store up to 53 bits");
125009
+ assert(false, "Number can only safely store up to 53 bits");
125025
125010
  }
125026
125011
  return this.negative !== 0 ? -ret : ret;
125027
125012
  };
@@ -125029,7 +125014,7 @@ var require_bn3 = __commonJS({
125029
125014
  return this.toString(16);
125030
125015
  };
125031
125016
  BN.prototype.toBuffer = function toBuffer(endian, length) {
125032
- assert2(typeof Buffer2 !== "undefined");
125017
+ assert(typeof Buffer2 !== "undefined");
125033
125018
  return this.toArrayLike(Buffer2, endian, length);
125034
125019
  };
125035
125020
  BN.prototype.toArray = function toArray(endian, length) {
@@ -125038,8 +125023,8 @@ var require_bn3 = __commonJS({
125038
125023
  BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {
125039
125024
  var byteLength = this.byteLength();
125040
125025
  var reqLength = length || Math.max(1, byteLength);
125041
- assert2(byteLength <= reqLength, "byte array longer than desired length");
125042
- assert2(reqLength > 0, "Requested array length <= 0");
125026
+ assert(byteLength <= reqLength, "byte array longer than desired length");
125027
+ assert(reqLength > 0, "Requested array length <= 0");
125043
125028
  this.strip();
125044
125029
  var littleEndian = endian === "le";
125045
125030
  var res = new ArrayType(reqLength);
@@ -125182,7 +125167,7 @@ var require_bn3 = __commonJS({
125182
125167
  return this.strip();
125183
125168
  };
125184
125169
  BN.prototype.ior = function ior(num) {
125185
- assert2((this.negative | num.negative) === 0);
125170
+ assert((this.negative | num.negative) === 0);
125186
125171
  return this.iuor(num);
125187
125172
  };
125188
125173
  BN.prototype.or = function or(num) {
@@ -125209,7 +125194,7 @@ var require_bn3 = __commonJS({
125209
125194
  return this.strip();
125210
125195
  };
125211
125196
  BN.prototype.iand = function iand(num) {
125212
- assert2((this.negative | num.negative) === 0);
125197
+ assert((this.negative | num.negative) === 0);
125213
125198
  return this.iuand(num);
125214
125199
  };
125215
125200
  BN.prototype.and = function and(num) {
@@ -125244,7 +125229,7 @@ var require_bn3 = __commonJS({
125244
125229
  return this.strip();
125245
125230
  };
125246
125231
  BN.prototype.ixor = function ixor(num) {
125247
- assert2((this.negative | num.negative) === 0);
125232
+ assert((this.negative | num.negative) === 0);
125248
125233
  return this.iuxor(num);
125249
125234
  };
125250
125235
  BN.prototype.xor = function xor(num) {
@@ -125258,7 +125243,7 @@ var require_bn3 = __commonJS({
125258
125243
  return num.clone().iuxor(this);
125259
125244
  };
125260
125245
  BN.prototype.inotn = function inotn(width) {
125261
- assert2(typeof width === "number" && width >= 0);
125246
+ assert(typeof width === "number" && width >= 0);
125262
125247
  var bytesNeeded = Math.ceil(width / 26) | 0;
125263
125248
  var bitsLeft = width % 26;
125264
125249
  this._expand(bytesNeeded);
@@ -125277,7 +125262,7 @@ var require_bn3 = __commonJS({
125277
125262
  return this.clone().inotn(width);
125278
125263
  };
125279
125264
  BN.prototype.setn = function setn(bit, val) {
125280
- assert2(typeof bit === "number" && bit >= 0);
125265
+ assert(typeof bit === "number" && bit >= 0);
125281
125266
  var off = bit / 26 | 0;
125282
125267
  var wbit = bit % 26;
125283
125268
  this._expand(off + 1);
@@ -126144,8 +126129,8 @@ var require_bn3 = __commonJS({
126144
126129
  for (i = 2 * len; i < N; ++i) {
126145
126130
  rws[i] = 0;
126146
126131
  }
126147
- assert2(carry === 0);
126148
- assert2((carry & ~8191) === 0);
126132
+ assert(carry === 0);
126133
+ assert((carry & ~8191) === 0);
126149
126134
  };
126150
126135
  FFTM.prototype.stub = function stub(N) {
126151
126136
  var ph = new Array(N);
@@ -126197,8 +126182,8 @@ var require_bn3 = __commonJS({
126197
126182
  return this.clone().mulTo(num, this);
126198
126183
  };
126199
126184
  BN.prototype.imuln = function imuln(num) {
126200
- assert2(typeof num === "number");
126201
- assert2(num < 67108864);
126185
+ assert(typeof num === "number");
126186
+ assert(num < 67108864);
126202
126187
  var carry = 0;
126203
126188
  for (var i = 0; i < this.length; i++) {
126204
126189
  var w = (this.words[i] | 0) * num;
@@ -126242,7 +126227,7 @@ var require_bn3 = __commonJS({
126242
126227
  return res;
126243
126228
  };
126244
126229
  BN.prototype.iushln = function iushln(bits) {
126245
- assert2(typeof bits === "number" && bits >= 0);
126230
+ assert(typeof bits === "number" && bits >= 0);
126246
126231
  var r = bits % 26;
126247
126232
  var s = (bits - r) / 26;
126248
126233
  var carryMask = 67108863 >>> 26 - r << 26 - r;
@@ -126272,11 +126257,11 @@ var require_bn3 = __commonJS({
126272
126257
  return this.strip();
126273
126258
  };
126274
126259
  BN.prototype.ishln = function ishln(bits) {
126275
- assert2(this.negative === 0);
126260
+ assert(this.negative === 0);
126276
126261
  return this.iushln(bits);
126277
126262
  };
126278
126263
  BN.prototype.iushrn = function iushrn(bits, hint, extended) {
126279
- assert2(typeof bits === "number" && bits >= 0);
126264
+ assert(typeof bits === "number" && bits >= 0);
126280
126265
  var h;
126281
126266
  if (hint) {
126282
126267
  h = (hint - hint % 26) / 26;
@@ -126321,7 +126306,7 @@ var require_bn3 = __commonJS({
126321
126306
  return this.strip();
126322
126307
  };
126323
126308
  BN.prototype.ishrn = function ishrn(bits, hint, extended) {
126324
- assert2(this.negative === 0);
126309
+ assert(this.negative === 0);
126325
126310
  return this.iushrn(bits, hint, extended);
126326
126311
  };
126327
126312
  BN.prototype.shln = function shln(bits) {
@@ -126337,7 +126322,7 @@ var require_bn3 = __commonJS({
126337
126322
  return this.clone().iushrn(bits);
126338
126323
  };
126339
126324
  BN.prototype.testn = function testn(bit) {
126340
- assert2(typeof bit === "number" && bit >= 0);
126325
+ assert(typeof bit === "number" && bit >= 0);
126341
126326
  var r = bit % 26;
126342
126327
  var s = (bit - r) / 26;
126343
126328
  var q = 1 << r;
@@ -126347,10 +126332,10 @@ var require_bn3 = __commonJS({
126347
126332
  return !!(w & q);
126348
126333
  };
126349
126334
  BN.prototype.imaskn = function imaskn(bits) {
126350
- assert2(typeof bits === "number" && bits >= 0);
126335
+ assert(typeof bits === "number" && bits >= 0);
126351
126336
  var r = bits % 26;
126352
126337
  var s = (bits - r) / 26;
126353
- assert2(this.negative === 0, "imaskn works only with positive numbers");
126338
+ assert(this.negative === 0, "imaskn works only with positive numbers");
126354
126339
  if (this.length <= s) {
126355
126340
  return this;
126356
126341
  }
@@ -126368,8 +126353,8 @@ var require_bn3 = __commonJS({
126368
126353
  return this.clone().imaskn(bits);
126369
126354
  };
126370
126355
  BN.prototype.iaddn = function iaddn(num) {
126371
- assert2(typeof num === "number");
126372
- assert2(num < 67108864);
126356
+ assert(typeof num === "number");
126357
+ assert(num < 67108864);
126373
126358
  if (num < 0)
126374
126359
  return this.isubn(-num);
126375
126360
  if (this.negative !== 0) {
@@ -126399,8 +126384,8 @@ var require_bn3 = __commonJS({
126399
126384
  return this;
126400
126385
  };
126401
126386
  BN.prototype.isubn = function isubn(num) {
126402
- assert2(typeof num === "number");
126403
- assert2(num < 67108864);
126387
+ assert(typeof num === "number");
126388
+ assert(num < 67108864);
126404
126389
  if (num < 0)
126405
126390
  return this.iaddn(-num);
126406
126391
  if (this.negative !== 0) {
@@ -126454,7 +126439,7 @@ var require_bn3 = __commonJS({
126454
126439
  }
126455
126440
  if (carry === 0)
126456
126441
  return this.strip();
126457
- assert2(carry === -1);
126442
+ assert(carry === -1);
126458
126443
  carry = 0;
126459
126444
  for (i = 0; i < this.length; i++) {
126460
126445
  w = -(this.words[i] | 0) + carry;
@@ -126522,7 +126507,7 @@ var require_bn3 = __commonJS({
126522
126507
  };
126523
126508
  };
126524
126509
  BN.prototype.divmod = function divmod(num, mode, positive) {
126525
- assert2(!num.isZero());
126510
+ assert(!num.isZero());
126526
126511
  if (this.isZero()) {
126527
126512
  return {
126528
126513
  div: new BN(0),
@@ -126617,7 +126602,7 @@ var require_bn3 = __commonJS({
126617
126602
  return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
126618
126603
  };
126619
126604
  BN.prototype.modn = function modn(num) {
126620
- assert2(num <= 67108863);
126605
+ assert(num <= 67108863);
126621
126606
  var p = (1 << 26) % num;
126622
126607
  var acc = 0;
126623
126608
  for (var i = this.length - 1; i >= 0; i--) {
@@ -126626,7 +126611,7 @@ var require_bn3 = __commonJS({
126626
126611
  return acc;
126627
126612
  };
126628
126613
  BN.prototype.idivn = function idivn(num) {
126629
- assert2(num <= 67108863);
126614
+ assert(num <= 67108863);
126630
126615
  var carry = 0;
126631
126616
  for (var i = this.length - 1; i >= 0; i--) {
126632
126617
  var w = (this.words[i] | 0) + carry * 67108864;
@@ -126639,8 +126624,8 @@ var require_bn3 = __commonJS({
126639
126624
  return this.clone().idivn(num);
126640
126625
  };
126641
126626
  BN.prototype.egcd = function egcd(p) {
126642
- assert2(p.negative === 0);
126643
- assert2(!p.isZero());
126627
+ assert(p.negative === 0);
126628
+ assert(!p.isZero());
126644
126629
  var x = this;
126645
126630
  var y = p.clone();
126646
126631
  if (x.negative !== 0) {
@@ -126704,8 +126689,8 @@ var require_bn3 = __commonJS({
126704
126689
  };
126705
126690
  };
126706
126691
  BN.prototype._invmp = function _invmp(p) {
126707
- assert2(p.negative === 0);
126708
- assert2(!p.isZero());
126692
+ assert(p.negative === 0);
126693
+ assert(!p.isZero());
126709
126694
  var a = this;
126710
126695
  var b = p.clone();
126711
126696
  if (a.negative !== 0) {
@@ -126803,7 +126788,7 @@ var require_bn3 = __commonJS({
126803
126788
  return this.words[0] & num;
126804
126789
  };
126805
126790
  BN.prototype.bincn = function bincn(bit) {
126806
- assert2(typeof bit === "number");
126791
+ assert(typeof bit === "number");
126807
126792
  var r = bit % 26;
126808
126793
  var s = (bit - r) / 26;
126809
126794
  var q = 1 << r;
@@ -126843,7 +126828,7 @@ var require_bn3 = __commonJS({
126843
126828
  if (negative) {
126844
126829
  num = -num;
126845
126830
  }
126846
- assert2(num <= 67108863, "Number is too big");
126831
+ assert(num <= 67108863, "Number is too big");
126847
126832
  var w = this.words[0] | 0;
126848
126833
  res = w === num ? 0 : w < num ? -1 : 1;
126849
126834
  }
@@ -126915,12 +126900,12 @@ var require_bn3 = __commonJS({
126915
126900
  return new Red(num);
126916
126901
  };
126917
126902
  BN.prototype.toRed = function toRed(ctx) {
126918
- assert2(!this.red, "Already a number in reduction context");
126919
- assert2(this.negative === 0, "red works only with positives");
126903
+ assert(!this.red, "Already a number in reduction context");
126904
+ assert(this.negative === 0, "red works only with positives");
126920
126905
  return ctx.convertTo(this)._forceRed(ctx);
126921
126906
  };
126922
126907
  BN.prototype.fromRed = function fromRed() {
126923
- assert2(this.red, "fromRed works only with numbers in reduction context");
126908
+ assert(this.red, "fromRed works only with numbers in reduction context");
126924
126909
  return this.red.convertFrom(this);
126925
126910
  };
126926
126911
  BN.prototype._forceRed = function _forceRed(ctx) {
@@ -126928,66 +126913,66 @@ var require_bn3 = __commonJS({
126928
126913
  return this;
126929
126914
  };
126930
126915
  BN.prototype.forceRed = function forceRed(ctx) {
126931
- assert2(!this.red, "Already a number in reduction context");
126916
+ assert(!this.red, "Already a number in reduction context");
126932
126917
  return this._forceRed(ctx);
126933
126918
  };
126934
126919
  BN.prototype.redAdd = function redAdd(num) {
126935
- assert2(this.red, "redAdd works only with red numbers");
126920
+ assert(this.red, "redAdd works only with red numbers");
126936
126921
  return this.red.add(this, num);
126937
126922
  };
126938
126923
  BN.prototype.redIAdd = function redIAdd(num) {
126939
- assert2(this.red, "redIAdd works only with red numbers");
126924
+ assert(this.red, "redIAdd works only with red numbers");
126940
126925
  return this.red.iadd(this, num);
126941
126926
  };
126942
126927
  BN.prototype.redSub = function redSub(num) {
126943
- assert2(this.red, "redSub works only with red numbers");
126928
+ assert(this.red, "redSub works only with red numbers");
126944
126929
  return this.red.sub(this, num);
126945
126930
  };
126946
126931
  BN.prototype.redISub = function redISub(num) {
126947
- assert2(this.red, "redISub works only with red numbers");
126932
+ assert(this.red, "redISub works only with red numbers");
126948
126933
  return this.red.isub(this, num);
126949
126934
  };
126950
126935
  BN.prototype.redShl = function redShl(num) {
126951
- assert2(this.red, "redShl works only with red numbers");
126936
+ assert(this.red, "redShl works only with red numbers");
126952
126937
  return this.red.shl(this, num);
126953
126938
  };
126954
126939
  BN.prototype.redMul = function redMul(num) {
126955
- assert2(this.red, "redMul works only with red numbers");
126940
+ assert(this.red, "redMul works only with red numbers");
126956
126941
  this.red._verify2(this, num);
126957
126942
  return this.red.mul(this, num);
126958
126943
  };
126959
126944
  BN.prototype.redIMul = function redIMul(num) {
126960
- assert2(this.red, "redMul works only with red numbers");
126945
+ assert(this.red, "redMul works only with red numbers");
126961
126946
  this.red._verify2(this, num);
126962
126947
  return this.red.imul(this, num);
126963
126948
  };
126964
126949
  BN.prototype.redSqr = function redSqr() {
126965
- assert2(this.red, "redSqr works only with red numbers");
126950
+ assert(this.red, "redSqr works only with red numbers");
126966
126951
  this.red._verify1(this);
126967
126952
  return this.red.sqr(this);
126968
126953
  };
126969
126954
  BN.prototype.redISqr = function redISqr() {
126970
- assert2(this.red, "redISqr works only with red numbers");
126955
+ assert(this.red, "redISqr works only with red numbers");
126971
126956
  this.red._verify1(this);
126972
126957
  return this.red.isqr(this);
126973
126958
  };
126974
126959
  BN.prototype.redSqrt = function redSqrt() {
126975
- assert2(this.red, "redSqrt works only with red numbers");
126960
+ assert(this.red, "redSqrt works only with red numbers");
126976
126961
  this.red._verify1(this);
126977
126962
  return this.red.sqrt(this);
126978
126963
  };
126979
126964
  BN.prototype.redInvm = function redInvm() {
126980
- assert2(this.red, "redInvm works only with red numbers");
126965
+ assert(this.red, "redInvm works only with red numbers");
126981
126966
  this.red._verify1(this);
126982
126967
  return this.red.invm(this);
126983
126968
  };
126984
126969
  BN.prototype.redNeg = function redNeg() {
126985
- assert2(this.red, "redNeg works only with red numbers");
126970
+ assert(this.red, "redNeg works only with red numbers");
126986
126971
  this.red._verify1(this);
126987
126972
  return this.red.neg(this);
126988
126973
  };
126989
126974
  BN.prototype.redPow = function redPow(num) {
126990
- assert2(this.red && !num.red, "redPow(normalNum)");
126975
+ assert(this.red && !num.red, "redPow(normalNum)");
126991
126976
  this.red._verify1(this);
126992
126977
  return this.red.pow(this, num);
126993
126978
  };
@@ -127151,18 +127136,18 @@ var require_bn3 = __commonJS({
127151
127136
  this.m = prime.p;
127152
127137
  this.prime = prime;
127153
127138
  } else {
127154
- assert2(m.gtn(1), "modulus must be greater than 1");
127139
+ assert(m.gtn(1), "modulus must be greater than 1");
127155
127140
  this.m = m;
127156
127141
  this.prime = null;
127157
127142
  }
127158
127143
  }
127159
127144
  Red.prototype._verify1 = function _verify1(a) {
127160
- assert2(a.negative === 0, "red works only with positives");
127161
- assert2(a.red, "red works only with red numbers");
127145
+ assert(a.negative === 0, "red works only with positives");
127146
+ assert(a.red, "red works only with red numbers");
127162
127147
  };
127163
127148
  Red.prototype._verify2 = function _verify2(a, b) {
127164
- assert2((a.negative | b.negative) === 0, "red works only with positives");
127165
- assert2(
127149
+ assert((a.negative | b.negative) === 0, "red works only with positives");
127150
+ assert(
127166
127151
  a.red && a.red === b.red,
127167
127152
  "red works only with red numbers"
127168
127153
  );
@@ -127232,7 +127217,7 @@ var require_bn3 = __commonJS({
127232
127217
  if (a.isZero())
127233
127218
  return a.clone();
127234
127219
  var mod3 = this.m.andln(3);
127235
- assert2(mod3 % 2 === 1);
127220
+ assert(mod3 % 2 === 1);
127236
127221
  if (mod3 === 3) {
127237
127222
  var pow = this.m.add(new BN(1)).iushrn(2);
127238
127223
  return this.pow(a, pow);
@@ -127243,7 +127228,7 @@ var require_bn3 = __commonJS({
127243
127228
  s++;
127244
127229
  q.iushrn(1);
127245
127230
  }
127246
- assert2(!q.isZero());
127231
+ assert(!q.isZero());
127247
127232
  var one = new BN(1).toRed(this);
127248
127233
  var nOne = one.redNeg();
127249
127234
  var lpow = this.m.subn(1).iushrn(1);
@@ -127261,7 +127246,7 @@ var require_bn3 = __commonJS({
127261
127246
  for (var i = 0; tmp.cmp(one) !== 0; i++) {
127262
127247
  tmp = tmp.redSqr();
127263
127248
  }
127264
- assert2(i < m);
127249
+ assert(i < m);
127265
127250
  var b = this.pow(c, new BN(1).iushln(m - i - 1));
127266
127251
  r = r.redMul(b);
127267
127252
  c = b.redSqr();
@@ -127400,7 +127385,7 @@ var require_bn4 = __commonJS({
127400
127385
  "node_modules/number-to-bn/node_modules/bn.js/lib/bn.js"(exports2, module2) {
127401
127386
  (function(module3, exports3) {
127402
127387
  "use strict";
127403
- function assert2(val, msg) {
127388
+ function assert(val, msg) {
127404
127389
  if (!val)
127405
127390
  throw new Error(msg || "Assertion failed");
127406
127391
  }
@@ -127466,7 +127451,7 @@ var require_bn4 = __commonJS({
127466
127451
  if (base === "hex") {
127467
127452
  base = 16;
127468
127453
  }
127469
- assert2(base === (base | 0) && base >= 2 && base <= 36);
127454
+ assert(base === (base | 0) && base >= 2 && base <= 36);
127470
127455
  number = number.toString().replace(/\s+/g, "");
127471
127456
  var start = 0;
127472
127457
  if (number[0] === "-") {
@@ -127500,7 +127485,7 @@ var require_bn4 = __commonJS({
127500
127485
  ];
127501
127486
  this.length = 2;
127502
127487
  } else {
127503
- assert2(number < 9007199254740992);
127488
+ assert(number < 9007199254740992);
127504
127489
  this.words = [
127505
127490
  number & 67108863,
127506
127491
  number / 67108864 & 67108863,
@@ -127513,7 +127498,7 @@ var require_bn4 = __commonJS({
127513
127498
  this._initArray(this.toArray(), base, endian);
127514
127499
  };
127515
127500
  BN.prototype._initArray = function _initArray(number, base, endian) {
127516
- assert2(typeof number.length === "number");
127501
+ assert(typeof number.length === "number");
127517
127502
  if (number.length <= 0) {
127518
127503
  this.words = [0];
127519
127504
  this.length = 1;
@@ -127844,7 +127829,7 @@ var require_bn4 = __commonJS({
127844
127829
  }
127845
127830
  return out;
127846
127831
  }
127847
- assert2(false, "Base should be between 2 and 36");
127832
+ assert(false, "Base should be between 2 and 36");
127848
127833
  };
127849
127834
  BN.prototype.toNumber = function toNumber() {
127850
127835
  var ret = this.words[0];
@@ -127853,7 +127838,7 @@ var require_bn4 = __commonJS({
127853
127838
  } else if (this.length === 3 && this.words[2] === 1) {
127854
127839
  ret += 4503599627370496 + this.words[1] * 67108864;
127855
127840
  } else if (this.length > 2) {
127856
- assert2(false, "Number can only safely store up to 53 bits");
127841
+ assert(false, "Number can only safely store up to 53 bits");
127857
127842
  }
127858
127843
  return this.negative !== 0 ? -ret : ret;
127859
127844
  };
@@ -127861,7 +127846,7 @@ var require_bn4 = __commonJS({
127861
127846
  return this.toString(16);
127862
127847
  };
127863
127848
  BN.prototype.toBuffer = function toBuffer(endian, length) {
127864
- assert2(typeof Buffer2 !== "undefined");
127849
+ assert(typeof Buffer2 !== "undefined");
127865
127850
  return this.toArrayLike(Buffer2, endian, length);
127866
127851
  };
127867
127852
  BN.prototype.toArray = function toArray(endian, length) {
@@ -127870,8 +127855,8 @@ var require_bn4 = __commonJS({
127870
127855
  BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {
127871
127856
  var byteLength = this.byteLength();
127872
127857
  var reqLength = length || Math.max(1, byteLength);
127873
- assert2(byteLength <= reqLength, "byte array longer than desired length");
127874
- assert2(reqLength > 0, "Requested array length <= 0");
127858
+ assert(byteLength <= reqLength, "byte array longer than desired length");
127859
+ assert(reqLength > 0, "Requested array length <= 0");
127875
127860
  this.strip();
127876
127861
  var littleEndian = endian === "le";
127877
127862
  var res = new ArrayType(reqLength);
@@ -128014,7 +127999,7 @@ var require_bn4 = __commonJS({
128014
127999
  return this.strip();
128015
128000
  };
128016
128001
  BN.prototype.ior = function ior(num) {
128017
- assert2((this.negative | num.negative) === 0);
128002
+ assert((this.negative | num.negative) === 0);
128018
128003
  return this.iuor(num);
128019
128004
  };
128020
128005
  BN.prototype.or = function or(num) {
@@ -128041,7 +128026,7 @@ var require_bn4 = __commonJS({
128041
128026
  return this.strip();
128042
128027
  };
128043
128028
  BN.prototype.iand = function iand(num) {
128044
- assert2((this.negative | num.negative) === 0);
128029
+ assert((this.negative | num.negative) === 0);
128045
128030
  return this.iuand(num);
128046
128031
  };
128047
128032
  BN.prototype.and = function and(num) {
@@ -128076,7 +128061,7 @@ var require_bn4 = __commonJS({
128076
128061
  return this.strip();
128077
128062
  };
128078
128063
  BN.prototype.ixor = function ixor(num) {
128079
- assert2((this.negative | num.negative) === 0);
128064
+ assert((this.negative | num.negative) === 0);
128080
128065
  return this.iuxor(num);
128081
128066
  };
128082
128067
  BN.prototype.xor = function xor(num) {
@@ -128090,7 +128075,7 @@ var require_bn4 = __commonJS({
128090
128075
  return num.clone().iuxor(this);
128091
128076
  };
128092
128077
  BN.prototype.inotn = function inotn(width) {
128093
- assert2(typeof width === "number" && width >= 0);
128078
+ assert(typeof width === "number" && width >= 0);
128094
128079
  var bytesNeeded = Math.ceil(width / 26) | 0;
128095
128080
  var bitsLeft = width % 26;
128096
128081
  this._expand(bytesNeeded);
@@ -128109,7 +128094,7 @@ var require_bn4 = __commonJS({
128109
128094
  return this.clone().inotn(width);
128110
128095
  };
128111
128096
  BN.prototype.setn = function setn(bit, val) {
128112
- assert2(typeof bit === "number" && bit >= 0);
128097
+ assert(typeof bit === "number" && bit >= 0);
128113
128098
  var off = bit / 26 | 0;
128114
128099
  var wbit = bit % 26;
128115
128100
  this._expand(off + 1);
@@ -128976,8 +128961,8 @@ var require_bn4 = __commonJS({
128976
128961
  for (i = 2 * len; i < N; ++i) {
128977
128962
  rws[i] = 0;
128978
128963
  }
128979
- assert2(carry === 0);
128980
- assert2((carry & ~8191) === 0);
128964
+ assert(carry === 0);
128965
+ assert((carry & ~8191) === 0);
128981
128966
  };
128982
128967
  FFTM.prototype.stub = function stub(N) {
128983
128968
  var ph = new Array(N);
@@ -129029,8 +129014,8 @@ var require_bn4 = __commonJS({
129029
129014
  return this.clone().mulTo(num, this);
129030
129015
  };
129031
129016
  BN.prototype.imuln = function imuln(num) {
129032
- assert2(typeof num === "number");
129033
- assert2(num < 67108864);
129017
+ assert(typeof num === "number");
129018
+ assert(num < 67108864);
129034
129019
  var carry = 0;
129035
129020
  for (var i = 0; i < this.length; i++) {
129036
129021
  var w = (this.words[i] | 0) * num;
@@ -129074,7 +129059,7 @@ var require_bn4 = __commonJS({
129074
129059
  return res;
129075
129060
  };
129076
129061
  BN.prototype.iushln = function iushln(bits) {
129077
- assert2(typeof bits === "number" && bits >= 0);
129062
+ assert(typeof bits === "number" && bits >= 0);
129078
129063
  var r = bits % 26;
129079
129064
  var s = (bits - r) / 26;
129080
129065
  var carryMask = 67108863 >>> 26 - r << 26 - r;
@@ -129104,11 +129089,11 @@ var require_bn4 = __commonJS({
129104
129089
  return this.strip();
129105
129090
  };
129106
129091
  BN.prototype.ishln = function ishln(bits) {
129107
- assert2(this.negative === 0);
129092
+ assert(this.negative === 0);
129108
129093
  return this.iushln(bits);
129109
129094
  };
129110
129095
  BN.prototype.iushrn = function iushrn(bits, hint, extended) {
129111
- assert2(typeof bits === "number" && bits >= 0);
129096
+ assert(typeof bits === "number" && bits >= 0);
129112
129097
  var h;
129113
129098
  if (hint) {
129114
129099
  h = (hint - hint % 26) / 26;
@@ -129153,7 +129138,7 @@ var require_bn4 = __commonJS({
129153
129138
  return this.strip();
129154
129139
  };
129155
129140
  BN.prototype.ishrn = function ishrn(bits, hint, extended) {
129156
- assert2(this.negative === 0);
129141
+ assert(this.negative === 0);
129157
129142
  return this.iushrn(bits, hint, extended);
129158
129143
  };
129159
129144
  BN.prototype.shln = function shln(bits) {
@@ -129169,7 +129154,7 @@ var require_bn4 = __commonJS({
129169
129154
  return this.clone().iushrn(bits);
129170
129155
  };
129171
129156
  BN.prototype.testn = function testn(bit) {
129172
- assert2(typeof bit === "number" && bit >= 0);
129157
+ assert(typeof bit === "number" && bit >= 0);
129173
129158
  var r = bit % 26;
129174
129159
  var s = (bit - r) / 26;
129175
129160
  var q = 1 << r;
@@ -129179,10 +129164,10 @@ var require_bn4 = __commonJS({
129179
129164
  return !!(w & q);
129180
129165
  };
129181
129166
  BN.prototype.imaskn = function imaskn(bits) {
129182
- assert2(typeof bits === "number" && bits >= 0);
129167
+ assert(typeof bits === "number" && bits >= 0);
129183
129168
  var r = bits % 26;
129184
129169
  var s = (bits - r) / 26;
129185
- assert2(this.negative === 0, "imaskn works only with positive numbers");
129170
+ assert(this.negative === 0, "imaskn works only with positive numbers");
129186
129171
  if (this.length <= s) {
129187
129172
  return this;
129188
129173
  }
@@ -129200,8 +129185,8 @@ var require_bn4 = __commonJS({
129200
129185
  return this.clone().imaskn(bits);
129201
129186
  };
129202
129187
  BN.prototype.iaddn = function iaddn(num) {
129203
- assert2(typeof num === "number");
129204
- assert2(num < 67108864);
129188
+ assert(typeof num === "number");
129189
+ assert(num < 67108864);
129205
129190
  if (num < 0)
129206
129191
  return this.isubn(-num);
129207
129192
  if (this.negative !== 0) {
@@ -129231,8 +129216,8 @@ var require_bn4 = __commonJS({
129231
129216
  return this;
129232
129217
  };
129233
129218
  BN.prototype.isubn = function isubn(num) {
129234
- assert2(typeof num === "number");
129235
- assert2(num < 67108864);
129219
+ assert(typeof num === "number");
129220
+ assert(num < 67108864);
129236
129221
  if (num < 0)
129237
129222
  return this.iaddn(-num);
129238
129223
  if (this.negative !== 0) {
@@ -129286,7 +129271,7 @@ var require_bn4 = __commonJS({
129286
129271
  }
129287
129272
  if (carry === 0)
129288
129273
  return this.strip();
129289
- assert2(carry === -1);
129274
+ assert(carry === -1);
129290
129275
  carry = 0;
129291
129276
  for (i = 0; i < this.length; i++) {
129292
129277
  w = -(this.words[i] | 0) + carry;
@@ -129354,7 +129339,7 @@ var require_bn4 = __commonJS({
129354
129339
  };
129355
129340
  };
129356
129341
  BN.prototype.divmod = function divmod(num, mode, positive) {
129357
- assert2(!num.isZero());
129342
+ assert(!num.isZero());
129358
129343
  if (this.isZero()) {
129359
129344
  return {
129360
129345
  div: new BN(0),
@@ -129449,7 +129434,7 @@ var require_bn4 = __commonJS({
129449
129434
  return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
129450
129435
  };
129451
129436
  BN.prototype.modn = function modn(num) {
129452
- assert2(num <= 67108863);
129437
+ assert(num <= 67108863);
129453
129438
  var p = (1 << 26) % num;
129454
129439
  var acc = 0;
129455
129440
  for (var i = this.length - 1; i >= 0; i--) {
@@ -129458,7 +129443,7 @@ var require_bn4 = __commonJS({
129458
129443
  return acc;
129459
129444
  };
129460
129445
  BN.prototype.idivn = function idivn(num) {
129461
- assert2(num <= 67108863);
129446
+ assert(num <= 67108863);
129462
129447
  var carry = 0;
129463
129448
  for (var i = this.length - 1; i >= 0; i--) {
129464
129449
  var w = (this.words[i] | 0) + carry * 67108864;
@@ -129471,8 +129456,8 @@ var require_bn4 = __commonJS({
129471
129456
  return this.clone().idivn(num);
129472
129457
  };
129473
129458
  BN.prototype.egcd = function egcd(p) {
129474
- assert2(p.negative === 0);
129475
- assert2(!p.isZero());
129459
+ assert(p.negative === 0);
129460
+ assert(!p.isZero());
129476
129461
  var x = this;
129477
129462
  var y = p.clone();
129478
129463
  if (x.negative !== 0) {
@@ -129536,8 +129521,8 @@ var require_bn4 = __commonJS({
129536
129521
  };
129537
129522
  };
129538
129523
  BN.prototype._invmp = function _invmp(p) {
129539
- assert2(p.negative === 0);
129540
- assert2(!p.isZero());
129524
+ assert(p.negative === 0);
129525
+ assert(!p.isZero());
129541
129526
  var a = this;
129542
129527
  var b = p.clone();
129543
129528
  if (a.negative !== 0) {
@@ -129635,7 +129620,7 @@ var require_bn4 = __commonJS({
129635
129620
  return this.words[0] & num;
129636
129621
  };
129637
129622
  BN.prototype.bincn = function bincn(bit) {
129638
- assert2(typeof bit === "number");
129623
+ assert(typeof bit === "number");
129639
129624
  var r = bit % 26;
129640
129625
  var s = (bit - r) / 26;
129641
129626
  var q = 1 << r;
@@ -129675,7 +129660,7 @@ var require_bn4 = __commonJS({
129675
129660
  if (negative) {
129676
129661
  num = -num;
129677
129662
  }
129678
- assert2(num <= 67108863, "Number is too big");
129663
+ assert(num <= 67108863, "Number is too big");
129679
129664
  var w = this.words[0] | 0;
129680
129665
  res = w === num ? 0 : w < num ? -1 : 1;
129681
129666
  }
@@ -129747,12 +129732,12 @@ var require_bn4 = __commonJS({
129747
129732
  return new Red(num);
129748
129733
  };
129749
129734
  BN.prototype.toRed = function toRed(ctx) {
129750
- assert2(!this.red, "Already a number in reduction context");
129751
- assert2(this.negative === 0, "red works only with positives");
129735
+ assert(!this.red, "Already a number in reduction context");
129736
+ assert(this.negative === 0, "red works only with positives");
129752
129737
  return ctx.convertTo(this)._forceRed(ctx);
129753
129738
  };
129754
129739
  BN.prototype.fromRed = function fromRed() {
129755
- assert2(this.red, "fromRed works only with numbers in reduction context");
129740
+ assert(this.red, "fromRed works only with numbers in reduction context");
129756
129741
  return this.red.convertFrom(this);
129757
129742
  };
129758
129743
  BN.prototype._forceRed = function _forceRed(ctx) {
@@ -129760,66 +129745,66 @@ var require_bn4 = __commonJS({
129760
129745
  return this;
129761
129746
  };
129762
129747
  BN.prototype.forceRed = function forceRed(ctx) {
129763
- assert2(!this.red, "Already a number in reduction context");
129748
+ assert(!this.red, "Already a number in reduction context");
129764
129749
  return this._forceRed(ctx);
129765
129750
  };
129766
129751
  BN.prototype.redAdd = function redAdd(num) {
129767
- assert2(this.red, "redAdd works only with red numbers");
129752
+ assert(this.red, "redAdd works only with red numbers");
129768
129753
  return this.red.add(this, num);
129769
129754
  };
129770
129755
  BN.prototype.redIAdd = function redIAdd(num) {
129771
- assert2(this.red, "redIAdd works only with red numbers");
129756
+ assert(this.red, "redIAdd works only with red numbers");
129772
129757
  return this.red.iadd(this, num);
129773
129758
  };
129774
129759
  BN.prototype.redSub = function redSub(num) {
129775
- assert2(this.red, "redSub works only with red numbers");
129760
+ assert(this.red, "redSub works only with red numbers");
129776
129761
  return this.red.sub(this, num);
129777
129762
  };
129778
129763
  BN.prototype.redISub = function redISub(num) {
129779
- assert2(this.red, "redISub works only with red numbers");
129764
+ assert(this.red, "redISub works only with red numbers");
129780
129765
  return this.red.isub(this, num);
129781
129766
  };
129782
129767
  BN.prototype.redShl = function redShl(num) {
129783
- assert2(this.red, "redShl works only with red numbers");
129768
+ assert(this.red, "redShl works only with red numbers");
129784
129769
  return this.red.shl(this, num);
129785
129770
  };
129786
129771
  BN.prototype.redMul = function redMul(num) {
129787
- assert2(this.red, "redMul works only with red numbers");
129772
+ assert(this.red, "redMul works only with red numbers");
129788
129773
  this.red._verify2(this, num);
129789
129774
  return this.red.mul(this, num);
129790
129775
  };
129791
129776
  BN.prototype.redIMul = function redIMul(num) {
129792
- assert2(this.red, "redMul works only with red numbers");
129777
+ assert(this.red, "redMul works only with red numbers");
129793
129778
  this.red._verify2(this, num);
129794
129779
  return this.red.imul(this, num);
129795
129780
  };
129796
129781
  BN.prototype.redSqr = function redSqr() {
129797
- assert2(this.red, "redSqr works only with red numbers");
129782
+ assert(this.red, "redSqr works only with red numbers");
129798
129783
  this.red._verify1(this);
129799
129784
  return this.red.sqr(this);
129800
129785
  };
129801
129786
  BN.prototype.redISqr = function redISqr() {
129802
- assert2(this.red, "redISqr works only with red numbers");
129787
+ assert(this.red, "redISqr works only with red numbers");
129803
129788
  this.red._verify1(this);
129804
129789
  return this.red.isqr(this);
129805
129790
  };
129806
129791
  BN.prototype.redSqrt = function redSqrt() {
129807
- assert2(this.red, "redSqrt works only with red numbers");
129792
+ assert(this.red, "redSqrt works only with red numbers");
129808
129793
  this.red._verify1(this);
129809
129794
  return this.red.sqrt(this);
129810
129795
  };
129811
129796
  BN.prototype.redInvm = function redInvm() {
129812
- assert2(this.red, "redInvm works only with red numbers");
129797
+ assert(this.red, "redInvm works only with red numbers");
129813
129798
  this.red._verify1(this);
129814
129799
  return this.red.invm(this);
129815
129800
  };
129816
129801
  BN.prototype.redNeg = function redNeg() {
129817
- assert2(this.red, "redNeg works only with red numbers");
129802
+ assert(this.red, "redNeg works only with red numbers");
129818
129803
  this.red._verify1(this);
129819
129804
  return this.red.neg(this);
129820
129805
  };
129821
129806
  BN.prototype.redPow = function redPow(num) {
129822
- assert2(this.red && !num.red, "redPow(normalNum)");
129807
+ assert(this.red && !num.red, "redPow(normalNum)");
129823
129808
  this.red._verify1(this);
129824
129809
  return this.red.pow(this, num);
129825
129810
  };
@@ -129983,18 +129968,18 @@ var require_bn4 = __commonJS({
129983
129968
  this.m = prime.p;
129984
129969
  this.prime = prime;
129985
129970
  } else {
129986
- assert2(m.gtn(1), "modulus must be greater than 1");
129971
+ assert(m.gtn(1), "modulus must be greater than 1");
129987
129972
  this.m = m;
129988
129973
  this.prime = null;
129989
129974
  }
129990
129975
  }
129991
129976
  Red.prototype._verify1 = function _verify1(a) {
129992
- assert2(a.negative === 0, "red works only with positives");
129993
- assert2(a.red, "red works only with red numbers");
129977
+ assert(a.negative === 0, "red works only with positives");
129978
+ assert(a.red, "red works only with red numbers");
129994
129979
  };
129995
129980
  Red.prototype._verify2 = function _verify2(a, b) {
129996
- assert2((a.negative | b.negative) === 0, "red works only with positives");
129997
- assert2(
129981
+ assert((a.negative | b.negative) === 0, "red works only with positives");
129982
+ assert(
129998
129983
  a.red && a.red === b.red,
129999
129984
  "red works only with red numbers"
130000
129985
  );
@@ -130064,7 +130049,7 @@ var require_bn4 = __commonJS({
130064
130049
  if (a.isZero())
130065
130050
  return a.clone();
130066
130051
  var mod3 = this.m.andln(3);
130067
- assert2(mod3 % 2 === 1);
130052
+ assert(mod3 % 2 === 1);
130068
130053
  if (mod3 === 3) {
130069
130054
  var pow = this.m.add(new BN(1)).iushrn(2);
130070
130055
  return this.pow(a, pow);
@@ -130075,7 +130060,7 @@ var require_bn4 = __commonJS({
130075
130060
  s++;
130076
130061
  q.iushrn(1);
130077
130062
  }
130078
- assert2(!q.isZero());
130063
+ assert(!q.isZero());
130079
130064
  var one = new BN(1).toRed(this);
130080
130065
  var nOne = one.redNeg();
130081
130066
  var lpow = this.m.subn(1).iushrn(1);
@@ -130093,7 +130078,7 @@ var require_bn4 = __commonJS({
130093
130078
  for (var i = 0; tmp.cmp(one) !== 0; i++) {
130094
130079
  tmp = tmp.redSqr();
130095
130080
  }
130096
- assert2(i < m);
130081
+ assert(i < m);
130097
130082
  var b = this.pow(c, new BN(1).iushln(m - i - 1));
130098
130083
  r = r.redMul(b);
130099
130084
  c = b.redSqr();
@@ -130653,7 +130638,7 @@ var require_assert2 = __commonJS({
130653
130638
  }
130654
130639
  }
130655
130640
  exports2.output = output;
130656
- var assert2 = {
130641
+ var assert = {
130657
130642
  number,
130658
130643
  bool,
130659
130644
  bytes,
@@ -130661,7 +130646,7 @@ var require_assert2 = __commonJS({
130661
130646
  exists,
130662
130647
  output
130663
130648
  };
130664
- exports2.default = assert2;
130649
+ exports2.default = assert;
130665
130650
  }
130666
130651
  });
130667
130652
 
@@ -148868,7 +148853,7 @@ var require_tunnel = __commonJS({
148868
148853
  var http = require("http");
148869
148854
  var https = require("https");
148870
148855
  var events = require("events");
148871
- var assert2 = require("assert");
148856
+ var assert = require("assert");
148872
148857
  var util = require("util");
148873
148858
  exports2.httpOverHttp = httpOverHttp;
148874
148859
  exports2.httpsOverHttp = httpsOverHttp;
@@ -150489,7 +150474,7 @@ var require_package2 = __commonJS({
150489
150474
  license: "BUSL-1.1",
150490
150475
  scripts: {
150491
150476
  build: "node esbuild.config.mjs",
150492
- start: "ts-node -r dotenv/config ./src/index.ts",
150477
+ start: "tsx -r dotenv/config ./src/index.ts",
150493
150478
  prepare: "husky install",
150494
150479
  prettier: "prettier --write .",
150495
150480
  "prettier:ci": "npx prettier --check .",
@@ -150500,32 +150485,32 @@ var require_package2 = __commonJS({
150500
150485
  dependencies: {},
150501
150486
  devDependencies: {
150502
150487
  "@actions/core": "^1.10.1",
150503
- "@commitlint/cli": "^17.7.2",
150504
- "@commitlint/config-conventional": "^17.7.0",
150488
+ "@commitlint/cli": "^17.8.0",
150489
+ "@commitlint/config-conventional": "^17.8.0",
150505
150490
  "@ethereum-sourcify/bytecode-utils": "^1.2.0",
150506
150491
  "@ethereum-sourcify/lib-sourcify": "^1.3.2",
150507
150492
  "@gearbox-protocol/eslint-config": "2.0.0-next.0",
150508
150493
  "@gearbox-protocol/prettier-config": "2.0.0-next.0",
150509
- "@gearbox-protocol/sdk": "^3.0.0-next.14",
150494
+ "@gearbox-protocol/sdk": "^3.0.0-next.36",
150510
150495
  "@safe-global/api-kit": "^1.3.1",
150511
150496
  "@safe-global/protocol-kit": "^1.3.0",
150512
150497
  "@safe-global/safe-core-sdk-types": "^2.3.0",
150513
150498
  "@types/lodash": "^4.14.199",
150514
- "@types/node": "^20.8.2",
150515
- abitype: "^0.9.9",
150499
+ "@types/node": "^20.8.6",
150500
+ abitype: "^0.10.1",
150516
150501
  chalk: "^4.1.2",
150517
- commander: "^11.0.0",
150502
+ commander: "^11.1.0",
150518
150503
  "date-fns": "^2.30.0",
150519
150504
  dotenv: "^16.3.1",
150520
150505
  esbuild: "^0.19.4",
150521
- eslint: "^8.50.0",
150506
+ eslint: "^8.51.0",
150522
150507
  ethers: "5.7.2",
150523
150508
  husky: "^8.0.3",
150524
- "lint-staged": "^14.0.1",
150509
+ "lint-staged": "^15.0.1",
150525
150510
  lodash: "^4.17.21",
150526
150511
  "p-retry": "^4.6.2",
150527
150512
  prettier: "^3.0.3",
150528
- "ts-node": "^10.9.1",
150513
+ tsx: "^3.13.0",
150529
150514
  tslog: "^4.9.2",
150530
150515
  typescript: "^5.2.2"
150531
150516
  },
@@ -151139,8 +151124,10 @@ var levels = {
151139
151124
  fatal: 6
151140
151125
  };
151141
151126
  var _a;
151127
+ var minLevel = levels[((_a = process.env.LOG_LEVEL) == null ? void 0 : _a.toLowerCase()) ?? "info"] ?? 3;
151142
151128
  var logger = new Logger({
151143
- minLevel: levels[((_a = process.env.LOG_LEVEL) == null ? void 0 : _a.toLowerCase()) ?? "info"] ?? 3
151129
+ prettyLogTemplate: minLevel < 3 ? "{{logLevelName}} {{filePathWithLine}} {{name}} " : "{{logLevelName}} {{name}} ",
151130
+ minLevel
151144
151131
  });
151145
151132
  var log_default = logger;
151146
151133
 
@@ -151466,7 +151453,7 @@ var AuditChecker = class {
151466
151453
  async setup() {
151467
151454
  (0, import_node_fs.mkdirSync)(__privateGet(this, _sandboxDir), { recursive: true });
151468
151455
  await clearDir(__privateGet(this, _sandboxDir));
151469
- __privateGet(this, _logger).debug(`Cleared sandbox dir ${__privateGet(this, _sandboxDir)}`);
151456
+ __privateGet(this, _logger).info("Setting up audit repositories");
151470
151457
  for (const [repo, repoAudits] of Object.entries(audits)) {
151471
151458
  for (const audit of repoAudits) {
151472
151459
  await __privateMethod(this, _checkoutAudit, checkoutAudit_fn).call(this, repo, audit);
@@ -151504,15 +151491,7 @@ auditFile_fn = async function(file) {
151504
151491
  return file;
151505
151492
  }
151506
151493
  __privateGet(this, _logger).debug(`Checking audits for ${path4} in ${repo}`);
151507
- const matches = await __privateMethod(this, _findMatches, findMatches_fn).call(this, file);
151508
- if (!matches) {
151509
- __privateGet(this, _logger).warn(`no matches for ${path4} in ${repo}`);
151510
- } else {
151511
- __privateGet(this, _logger).debug(
151512
- `Found ${matches.length} matches for ${path4} in ${repo}`
151513
- );
151514
- file.audits = matches;
151515
- }
151494
+ file.audits = await __privateMethod(this, _findMatches, findMatches_fn).call(this, file);
151516
151495
  return file;
151517
151496
  };
151518
151497
  _findMatches = new WeakSet();
@@ -151596,7 +151575,7 @@ var SafeBase = class {
151596
151575
  _safe = new WeakMap();
151597
151576
 
151598
151577
  // src/Create2Verifier.ts
151599
- var _sandboxDir2, _auditor, _setupMetaRepos, setupMetaRepos_fn, _verifyBatchAndMeta, verifyBatchAndMeta_fn, _verifySafeTx, verifySafeTx_fn, _verify, verify_fn, _verifyCreate2Tx, verifyCreate2Tx_fn;
151578
+ var _logger2, _sandboxDir2, _auditor, _output, _setupMetaRepos, setupMetaRepos_fn, _verifyBatchAndMeta, verifyBatchAndMeta_fn, _verifySafeTx, verifySafeTx_fn, _verify, verify_fn, _verifyCreate2Tx, verifyCreate2Tx_fn;
151600
151579
  var _Create2Verifier = class _Create2Verifier extends SafeBase {
151601
151580
  constructor(options) {
151602
151581
  const provider = new import_ethers3.ethers.providers.StaticJsonRpcProvider(
@@ -151617,10 +151596,16 @@ var _Create2Verifier = class _Create2Verifier extends SafeBase {
151617
151596
  __privateAdd(this, _verifySafeTx);
151618
151597
  __privateAdd(this, _verify);
151619
151598
  __privateAdd(this, _verifyCreate2Tx);
151599
+ __privateAdd(this, _logger2, log_default.getSubLogger({ name: "verifier" }));
151620
151600
  __privateAdd(this, _sandboxDir2, void 0);
151621
151601
  __privateAdd(this, _auditor, void 0);
151602
+ __privateAdd(this, _output, []);
151622
151603
  if (options.sandboxDir) {
151623
151604
  __privateSet(this, _sandboxDir2, import_node_path3.default.resolve(options.sandboxDir));
151605
+ try {
151606
+ (0, import_node_fs2.mkdirSync)(__privateGet(this, _sandboxDir2));
151607
+ } catch {
151608
+ }
151624
151609
  } else {
151625
151610
  __privateSet(this, _sandboxDir2, (0, import_node_fs2.mkdtempSync)("cr2ver", { encoding: "utf8" }));
151626
151611
  }
@@ -151636,6 +151621,8 @@ if no options are provided, will verify all pending transactions from safe multi
151636
151621
  "--sandbox-dir [dir]",
151637
151622
  "directory for temporary files, defaults to tmp dir"
151638
151623
  )
151624
+ ).addOption(
151625
+ new Option("--out-file [json]", "save output result into json file")
151639
151626
  ).addOption(
151640
151627
  new Option(
151641
151628
  "--mainnet-rpc <url>",
@@ -151665,35 +151652,51 @@ if no options are provided, will verify all pending transactions from safe multi
151665
151652
  }
151666
151653
  async verify(opts) {
151667
151654
  const { batchFile, metaFile, safeTxHashes, skipCleanup } = opts;
151668
- if (!skipCleanup) {
151669
- await __privateMethod(this, _setupMetaRepos, setupMetaRepos_fn).call(this);
151670
- await __privateGet(this, _auditor).setup();
151671
- }
151672
- if (batchFile && metaFile) {
151673
- await __privateMethod(this, _verifyBatchAndMeta, verifyBatchAndMeta_fn).call(this, batchFile, metaFile);
151674
- } else if (safeTxHashes == null ? void 0 : safeTxHashes.length) {
151675
- for (const safeTxHash of safeTxHashes) {
151676
- const tx = await this.service.getTransaction(safeTxHash);
151677
- if (!tx) {
151678
- throw new Error(`safe tx ${safeTxHash} not found`);
151655
+ try {
151656
+ if (!skipCleanup) {
151657
+ await __privateMethod(this, _setupMetaRepos, setupMetaRepos_fn).call(this);
151658
+ await __privateGet(this, _auditor).setup();
151659
+ }
151660
+ if (batchFile && metaFile) {
151661
+ await __privateMethod(this, _verifyBatchAndMeta, verifyBatchAndMeta_fn).call(this, batchFile, metaFile);
151662
+ } else if (safeTxHashes == null ? void 0 : safeTxHashes.length) {
151663
+ for (const safeTxHash of safeTxHashes) {
151664
+ const tx = await this.service.getTransaction(safeTxHash);
151665
+ if (!tx) {
151666
+ throw new Error(`safe tx ${safeTxHash} not found`);
151667
+ }
151668
+ await __privateMethod(this, _verifySafeTx, verifySafeTx_fn).call(this, tx);
151669
+ }
151670
+ } else {
151671
+ const pendingTransactions = await this.service.getPendingTransactions(
151672
+ this.safeAddress
151673
+ );
151674
+ const pending = getTransactionsToExecute(pendingTransactions);
151675
+ for (const tx of pending) {
151676
+ await __privateMethod(this, _verifySafeTx, verifySafeTx_fn).call(this, tx);
151679
151677
  }
151680
- await __privateMethod(this, _verifySafeTx, verifySafeTx_fn).call(this, tx);
151681
151678
  }
151682
- } else {
151683
- const pendingTransactions = await this.service.getPendingTransactions(
151684
- this.safeAddress
151685
- );
151686
- const pending = getTransactionsToExecute(pendingTransactions);
151687
- for (const tx of pending) {
151688
- await __privateMethod(this, _verifySafeTx, verifySafeTx_fn).call(this, tx);
151679
+ if (opts.outFile) {
151680
+ await import_promises3.default.writeFile(
151681
+ opts.outFile,
151682
+ JSON.stringify(__privateGet(this, _output), null, 2),
151683
+ "utf-8"
151684
+ );
151685
+ }
151686
+ } finally {
151687
+ if (!skipCleanup) {
151688
+ await import_promises3.default.rm(__privateGet(this, _sandboxDir2), { force: true, recursive: true });
151689
151689
  }
151690
151690
  }
151691
151691
  }
151692
151692
  };
151693
+ _logger2 = new WeakMap();
151693
151694
  _sandboxDir2 = new WeakMap();
151694
151695
  _auditor = new WeakMap();
151696
+ _output = new WeakMap();
151695
151697
  _setupMetaRepos = new WeakSet();
151696
151698
  setupMetaRepos_fn = async function() {
151699
+ __privateGet(this, _logger2).info("setting up meta repositories");
151697
151700
  await clearDir(__privateGet(this, _sandboxDir2));
151698
151701
  await Promise.all(
151699
151702
  DEPLOY_REPOS.map(
@@ -151703,6 +151706,7 @@ setupMetaRepos_fn = async function() {
151703
151706
  })
151704
151707
  )
151705
151708
  );
151709
+ __privateGet(this, _logger2).debug("meta repositories setup complete");
151706
151710
  };
151707
151711
  _verifyBatchAndMeta = new WeakSet();
151708
151712
  verifyBatchAndMeta_fn = async function(batchFile, metaFile) {
@@ -151711,24 +151715,28 @@ verifyBatchAndMeta_fn = async function(batchFile, metaFile) {
151711
151715
  const batch = JSON.parse(batchContent);
151712
151716
  const meta2 = JSON.parse(metaContent);
151713
151717
  const create2txs = getCreate2transactions(batch);
151714
- await __privateMethod(this, _verify, verify_fn).call(this, create2txs, meta2);
151718
+ const results = await __privateMethod(this, _verify, verify_fn).call(this, create2txs, meta2);
151719
+ __privateGet(this, _output).push({ results });
151715
151720
  };
151716
151721
  _verifySafeTx = new WeakSet();
151717
151722
  verifySafeTx_fn = async function(tx) {
151718
- console.info(`Verifying tx ${import_chalk.default.green(tx.safeTxHash)}...`);
151723
+ __privateGet(this, _logger2).info(`Verifying tx ${import_chalk.default.green(tx.safeTxHash)}...`);
151719
151724
  await import_promises3.default.writeFile(
151720
151725
  import_node_path3.default.resolve(__privateGet(this, _sandboxDir2), `${tx.safeTxHash}.tx.json`),
151721
151726
  JSON.stringify(tx, null, 2)
151722
151727
  );
151723
151728
  const meta2 = await getDeployMeta(tx.safeTxHash, __privateGet(this, _sandboxDir2));
151724
151729
  const create2txs = getCreate2transactions(tx);
151725
- await __privateMethod(this, _verify, verify_fn).call(this, create2txs, meta2);
151730
+ const results = await __privateMethod(this, _verify, verify_fn).call(this, create2txs, meta2);
151731
+ __privateGet(this, _output).push({ results, safeTxHash: tx.safeTxHash });
151726
151732
  };
151727
151733
  _verify = new WeakSet();
151728
151734
  verify_fn = async function(create2txs, meta2) {
151735
+ var _a2;
151729
151736
  const addressToMeta = new Map(
151730
151737
  Object.values(meta2).map((c) => [c.contractAddress, c])
151731
151738
  );
151739
+ const results = [];
151732
151740
  for (const tx2 of create2txs) {
151733
151741
  const address = create2Address(tx2);
151734
151742
  const metaContract = addressToMeta.get(address);
@@ -151738,8 +151746,34 @@ verify_fn = async function(create2txs, meta2) {
151738
151746
  );
151739
151747
  }
151740
151748
  const match = await __privateMethod(this, _verifyCreate2Tx, verifyCreate2Tx_fn).call(this, tx2, metaContract);
151741
- console.log(JSON.stringify(match, null, 2));
151749
+ results.push(match);
151750
+ if ("error" in match) {
151751
+ __privateGet(this, _logger2).error(
151752
+ `${import_chalk.default.red(match.contract)} is not verified: ${match.error}`
151753
+ );
151754
+ process.exitCode = 1;
151755
+ } else {
151756
+ if (match.match === "partial") {
151757
+ __privateGet(this, _logger2).warn(
151758
+ `${import_chalk.default.yellow(match.contract)} is a partial match`
151759
+ );
151760
+ } else {
151761
+ __privateGet(this, _logger2).debug(
151762
+ `${import_chalk.default.green(match.contract)} is a perfect match`
151763
+ );
151764
+ }
151765
+ for (const file of match.files) {
151766
+ if (file.gearbox && !((_a2 = file.audits) == null ? void 0 : _a2.length)) {
151767
+ __privateGet(this, _logger2).warn(
151768
+ `No audits for file ${import_chalk.default.yellow(file.path)} in ${import_chalk.default.yellow(
151769
+ file.repo
151770
+ )} for contract ${import_chalk.default.yellow(match.contract)}`
151771
+ );
151772
+ }
151773
+ }
151774
+ }
151742
151775
  }
151776
+ return results;
151743
151777
  };
151744
151778
  _verifyCreate2Tx = new WeakSet();
151745
151779
  verifyCreate2Tx_fn = async function(tx, meta2) {
@@ -151849,7 +151883,6 @@ verifyCreate2Tx_fn = async function(tx, meta2) {
151849
151883
  var Create2Verifier = _Create2Verifier;
151850
151884
 
151851
151885
  // src/SafeHelper.ts
151852
- var import_strict = __toESM(require("assert/strict"));
151853
151886
  var import_core = __toESM(require_core2());
151854
151887
  var import_chalk2 = __toESM(require_source());
151855
151888
  var import_ethers4 = __toESM(require_lib40());
@@ -151985,9 +152018,13 @@ impersonateSafe_fn = async function() {
151985
152018
  data: addOwnerTx.data.data
151986
152019
  });
151987
152020
  const receipt = await this.provider.getTransactionReceipt(hash);
151988
- import_strict.default.ok(receipt.status, "failed to add owner to safe");
152021
+ if (!receipt.status) {
152022
+ throw new Error("failed to add owner to safe");
152023
+ }
151989
152024
  const owners = await this.safe.getOwners();
151990
- import_strict.default.ok(owners.includes(ownerAddress), "owner was not added");
152025
+ if (!owners.includes(ownerAddress)) {
152026
+ throw new Error("owner was not added");
152027
+ }
151991
152028
  console.log("added fake owner to safe and set threshold to 1");
151992
152029
  if (!__privateGet(this, _tenderly)) {
151993
152030
  await stopImpersonate(this.provider, this.safeAddress);
@@ -151996,10 +152033,11 @@ impersonateSafe_fn = async function() {
151996
152033
  _validateTransaction = new WeakSet();
151997
152034
  validateTransaction_fn = function(timestamp, data) {
151998
152035
  var _a2;
151999
- import_strict.default.ok(
152000
- !data.isExecuted,
152001
- `safe tx already executed in tx ${data.safeTxHash} with nonce ${data.nonce}`
152002
- );
152036
+ if (data.isExecuted) {
152037
+ throw new Error(
152038
+ `safe tx already executed in tx ${data.safeTxHash} with nonce ${data.nonce}`
152039
+ );
152040
+ }
152003
152041
  if (!data.dataDecoded) {
152004
152042
  console.warn("data decoded is missing");
152005
152043
  }
@@ -152015,32 +152053,34 @@ validateTransaction_fn = function(timestamp, data) {
152015
152053
  _validateMultisend = new WeakSet();
152016
152054
  validateMultisend_fn = function(timestamp, data) {
152017
152055
  var _a2;
152018
- import_strict.default.equal(
152019
- data.dataDecoded.parameters.length,
152020
- 1,
152021
- "expected multiSend transaction with 1 parameter"
152022
- );
152023
- import_strict.default.equal(
152024
- data.dataDecoded.parameters[0].name,
152025
- "transactions",
152026
- "expected multiSend transactions"
152027
- );
152056
+ if (data.dataDecoded.parameters.length !== 1) {
152057
+ throw new Error("expected multiSend transaction with 1 parameter");
152058
+ }
152059
+ if (data.dataDecoded.parameters[0].name !== "transactions") {
152060
+ throw new Error("expected multiSend transactions");
152061
+ }
152028
152062
  const txs = data.dataDecoded.parameters[0].valueDecoded;
152029
- import_strict.default.notEqual(txs.length, 0, "expected some transactions");
152063
+ if (txs.length === 0) {
152064
+ throw new Error("expected some transactions");
152065
+ }
152030
152066
  let eta = 0;
152031
152067
  let isQueue = false;
152032
152068
  let isExecute = false;
152033
152069
  for (const tx of txs) {
152034
152070
  const method = (_a2 = tx.dataDecoded) == null ? void 0 : _a2.method;
152035
152071
  if (method === "queueTransaction" || method === "executeTransaction") {
152036
- import_strict.default.equal(tx.dataDecoded.parameters.length, 5);
152072
+ if (tx.dataDecoded.parameters.length !== 5) {
152073
+ throw new Error(`${method} expects 5 arguments`);
152074
+ }
152037
152075
  eta = Math.max(parseInt(tx.dataDecoded.parameters[4].value, 10), eta);
152038
152076
  isQueue || (isQueue = method === "queueTransaction");
152039
152077
  isExecute || (isExecute = method === "executeTransaction");
152040
152078
  }
152041
152079
  }
152042
152080
  if (eta && isQueue) {
152043
- import_strict.default.ok(eta > timestamp, `ETA is outdated: ${eta} <= ${timestamp}`);
152081
+ if (eta <= timestamp) {
152082
+ throw new Error(`ETA is outdated: ${eta} <= ${timestamp}`);
152083
+ }
152044
152084
  }
152045
152085
  return {
152046
152086
  multisend: true,
@@ -152055,11 +152095,17 @@ validateSingle_fn = function(timestamp, data) {
152055
152095
  const method = (_a2 = data.dataDecoded) == null ? void 0 : _a2.method;
152056
152096
  if (method === "queueTransaction" || method === "executeTransaction") {
152057
152097
  const isQueue = method === "queueTransaction";
152058
- import_strict.default.equal(data.dataDecoded.parameters.length, 5);
152098
+ if (data.dataDecoded.parameters.length !== 5) {
152099
+ throw new Error(`${method} expects 5 args`);
152100
+ }
152059
152101
  const etaP = data.dataDecoded.parameters.find((p) => p.name === "eta");
152060
- import_strict.default.ok(etaP, "eta parameter not found");
152102
+ if (!etaP) {
152103
+ throw new Error("eta parameter not found");
152104
+ }
152061
152105
  const eta = parseInt(data.dataDecoded.parameters[4].value, 10);
152062
- import_strict.default.ok(eta > timestamp, "ETA is outdated");
152106
+ if (eta <= timestamp) {
152107
+ throw new Error("ETA is outdated");
152108
+ }
152063
152109
  return {
152064
152110
  isQueue,
152065
152111
  isExecute: !isQueue,
@@ -152083,7 +152129,9 @@ execute_fn = async function(tx) {
152083
152129
  const receipt = await Promise.resolve(
152084
152130
  (_a2 = executeTxResponse.transactionResponse) == null ? void 0 : _a2.wait()
152085
152131
  );
152086
- import_strict.default.ok(receipt == null ? void 0 : receipt.status, "failed to execute transaction");
152132
+ if (!(receipt == null ? void 0 : receipt.status)) {
152133
+ throw new Error("failed to execute transaction");
152134
+ }
152087
152135
  if ("safeTxHash" in tx) {
152088
152136
  console.log(`executed safe tx ${tx.safeTxHash} with nonce ${tx.nonce}`);
152089
152137
  } else {