@settlemint/sdk-cli 2.4.0-pr88ac0d7d → 2.4.0-pra6821f69

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/dist/cli.js +634 -1409
  2. package/dist/cli.js.map +60 -94
  3. package/package.json +8 -10
package/dist/cli.js CHANGED
@@ -5149,7 +5149,7 @@ var require_sha2 = __commonJS((exports) => {
5149
5149
  exports.sha512_224 = (0, utils_ts_1.createHasher)(() => new SHA512_224);
5150
5150
  });
5151
5151
 
5152
- // ../../node_modules/eciesjs/node_modules/@noble/curves/abstract/utils.js
5152
+ // ../../node_modules/@noble/curves/abstract/utils.js
5153
5153
  var require_utils5 = __commonJS((exports) => {
5154
5154
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
5155
5155
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -5423,7 +5423,7 @@ var require_utils5 = __commonJS((exports) => {
5423
5423
  }
5424
5424
  });
5425
5425
 
5426
- // ../../node_modules/eciesjs/node_modules/@noble/curves/abstract/modular.js
5426
+ // ../../node_modules/@noble/curves/abstract/modular.js
5427
5427
  var require_modular = __commonJS((exports) => {
5428
5428
  Object.defineProperty(exports, "__esModule", { value: true });
5429
5429
  exports.isNegativeLE = undefined;
@@ -5753,7 +5753,7 @@ var require_modular = __commonJS((exports) => {
5753
5753
  }
5754
5754
  });
5755
5755
 
5756
- // ../../node_modules/eciesjs/node_modules/@noble/curves/abstract/curve.js
5756
+ // ../../node_modules/@noble/curves/abstract/curve.js
5757
5757
  var require_curve = __commonJS((exports) => {
5758
5758
  Object.defineProperty(exports, "__esModule", { value: true });
5759
5759
  exports.wNAF = wNAF;
@@ -6002,7 +6002,7 @@ var require_curve = __commonJS((exports) => {
6002
6002
  }
6003
6003
  });
6004
6004
 
6005
- // ../../node_modules/eciesjs/node_modules/@noble/curves/abstract/edwards.js
6005
+ // ../../node_modules/@noble/curves/abstract/edwards.js
6006
6006
  var require_edwards = __commonJS((exports) => {
6007
6007
  Object.defineProperty(exports, "__esModule", { value: true });
6008
6008
  exports.twistedEdwards = twistedEdwards;
@@ -6361,7 +6361,7 @@ var require_edwards = __commonJS((exports) => {
6361
6361
  }
6362
6362
  });
6363
6363
 
6364
- // ../../node_modules/eciesjs/node_modules/@noble/curves/abstract/hash-to-curve.js
6364
+ // ../../node_modules/@noble/curves/abstract/hash-to-curve.js
6365
6365
  var require_hash_to_curve = __commonJS((exports) => {
6366
6366
  Object.defineProperty(exports, "__esModule", { value: true });
6367
6367
  exports.expand_message_xmd = expand_message_xmd;
@@ -6514,7 +6514,7 @@ var require_hash_to_curve = __commonJS((exports) => {
6514
6514
  }
6515
6515
  });
6516
6516
 
6517
- // ../../node_modules/eciesjs/node_modules/@noble/curves/abstract/montgomery.js
6517
+ // ../../node_modules/@noble/curves/abstract/montgomery.js
6518
6518
  var require_montgomery = __commonJS((exports) => {
6519
6519
  Object.defineProperty(exports, "__esModule", { value: true });
6520
6520
  exports.montgomery = montgomery;
@@ -6621,7 +6621,7 @@ var require_montgomery = __commonJS((exports) => {
6621
6621
  }
6622
6622
  });
6623
6623
 
6624
- // ../../node_modules/eciesjs/node_modules/@noble/curves/ed25519.js
6624
+ // ../../node_modules/@noble/curves/ed25519.js
6625
6625
  var require_ed25519 = __commonJS((exports) => {
6626
6626
  Object.defineProperty(exports, "__esModule", { value: true });
6627
6627
  exports.hash_to_ristretto255 = exports.hashToRistretto255 = exports.RistrettoPoint = exports.encodeToCurve = exports.hashToCurve = exports.ed25519_hasher = exports.edwardsToMontgomery = exports.x25519 = exports.ed25519ph = exports.ed25519ctx = exports.ed25519 = exports.ED25519_TORSION_SUBGROUP = undefined;
@@ -7061,7 +7061,7 @@ var require_hmac = __commonJS((exports) => {
7061
7061
  exports.hmac.create = (hash, key) => new HMAC(hash, key);
7062
7062
  });
7063
7063
 
7064
- // ../../node_modules/eciesjs/node_modules/@noble/curves/abstract/weierstrass.js
7064
+ // ../../node_modules/@noble/curves/abstract/weierstrass.js
7065
7065
  var require_weierstrass = __commonJS((exports) => {
7066
7066
  Object.defineProperty(exports, "__esModule", { value: true });
7067
7067
  exports.DER = exports.DERErr = undefined;
@@ -7980,7 +7980,7 @@ var require_weierstrass = __commonJS((exports) => {
7980
7980
  }
7981
7981
  });
7982
7982
 
7983
- // ../../node_modules/eciesjs/node_modules/@noble/curves/_shortw_utils.js
7983
+ // ../../node_modules/@noble/curves/_shortw_utils.js
7984
7984
  var require__shortw_utils = __commonJS((exports) => {
7985
7985
  Object.defineProperty(exports, "__esModule", { value: true });
7986
7986
  exports.getHash = getHash;
@@ -8002,7 +8002,7 @@ var require__shortw_utils = __commonJS((exports) => {
8002
8002
  }
8003
8003
  });
8004
8004
 
8005
- // ../../node_modules/eciesjs/node_modules/@noble/curves/secp256k1.js
8005
+ // ../../node_modules/@noble/curves/secp256k1.js
8006
8006
  var require_secp256k1 = __commonJS((exports) => {
8007
8007
  Object.defineProperty(exports, "__esModule", { value: true });
8008
8008
  exports.encodeToCurve = exports.hashToCurve = exports.secp256k1_hasher = exports.schnorr = exports.secp256k1 = undefined;
@@ -231623,7 +231623,7 @@ function size(value4) {
231623
231623
  var init_size = () => {};
231624
231624
 
231625
231625
  // ../../node_modules/viem/_esm/errors/version.js
231626
- var version5 = "2.31.6";
231626
+ var version5 = "2.31.1";
231627
231627
 
231628
231628
  // ../../node_modules/viem/_esm/errors/base.js
231629
231629
  function walk(err, fn) {
@@ -232421,46 +232421,6 @@ function byteSwap32(arr) {
232421
232421
  }
232422
232422
  return arr;
232423
232423
  }
232424
- function bytesToHex2(bytes) {
232425
- abytes(bytes);
232426
- if (hasHexBuiltin)
232427
- return bytes.toHex();
232428
- let hex = "";
232429
- for (let i6 = 0;i6 < bytes.length; i6++) {
232430
- hex += hexes2[bytes[i6]];
232431
- }
232432
- return hex;
232433
- }
232434
- function asciiToBase16(ch) {
232435
- if (ch >= asciis._0 && ch <= asciis._9)
232436
- return ch - asciis._0;
232437
- if (ch >= asciis.A && ch <= asciis.F)
232438
- return ch - (asciis.A - 10);
232439
- if (ch >= asciis.a && ch <= asciis.f)
232440
- return ch - (asciis.a - 10);
232441
- return;
232442
- }
232443
- function hexToBytes2(hex) {
232444
- if (typeof hex !== "string")
232445
- throw new Error("hex string expected, got " + typeof hex);
232446
- if (hasHexBuiltin)
232447
- return Uint8Array.fromHex(hex);
232448
- const hl = hex.length;
232449
- const al = hl / 2;
232450
- if (hl % 2)
232451
- throw new Error("hex string expected, got unpadded hex of length " + hl);
232452
- const array4 = new Uint8Array(al);
232453
- for (let ai = 0, hi = 0;ai < al; ai++, hi += 2) {
232454
- const n1 = asciiToBase16(hex.charCodeAt(hi));
232455
- const n22 = asciiToBase16(hex.charCodeAt(hi + 1));
232456
- if (n1 === undefined || n22 === undefined) {
232457
- const char = hex[hi] + hex[hi + 1];
232458
- throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
232459
- }
232460
- array4[ai] = n1 * 16 + n22;
232461
- }
232462
- return array4;
232463
- }
232464
232424
  function utf8ToBytes(str) {
232465
232425
  if (typeof str !== "string")
232466
232426
  throw new Error("string expected");
@@ -232507,15 +232467,12 @@ function randomBytes(bytesLength = 32) {
232507
232467
  }
232508
232468
  throw new Error("crypto.getRandomValues must be defined");
232509
232469
  }
232510
- var isLE, swap32IfBE, hasHexBuiltin, hexes2, asciis;
232470
+ var isLE, swap32IfBE;
232511
232471
  var init_utils2 = __esm(() => {
232512
232472
  init_cryptoNode();
232513
232473
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
232514
232474
  isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
232515
232475
  swap32IfBE = isLE ? (u6) => u6 : byteSwap32;
232516
- hasHexBuiltin = /* @__PURE__ */ (() => typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function")();
232517
- hexes2 = /* @__PURE__ */ Array.from({ length: 256 }, (_5, i6) => i6.toString(16).padStart(2, "0"));
232518
- asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
232519
232476
  });
232520
232477
 
232521
232478
  // ../../node_modules/@noble/hashes/esm/sha3.js
@@ -235181,7 +235138,14 @@ var init_hmac = __esm(() => {
235181
235138
  hmac.create = (hash2, key2) => new HMAC(hash2, key2);
235182
235139
  });
235183
235140
 
235184
- // ../../node_modules/@noble/curves/esm/utils.js
235141
+ // ../../node_modules/@noble/curves/esm/abstract/utils.js
235142
+ function isBytes2(a7) {
235143
+ return a7 instanceof Uint8Array || ArrayBuffer.isView(a7) && a7.constructor.name === "Uint8Array";
235144
+ }
235145
+ function abytes2(item) {
235146
+ if (!isBytes2(item))
235147
+ throw new Error("Uint8Array expected");
235148
+ }
235185
235149
  function abool(title, value4) {
235186
235150
  if (typeof value4 !== "boolean")
235187
235151
  throw new Error(title + " boolean expected, got " + value4);
@@ -235195,11 +235159,51 @@ function hexToNumber2(hex) {
235195
235159
  throw new Error("hex string expected, got " + typeof hex);
235196
235160
  return hex === "" ? _0n2 : BigInt("0x" + hex);
235197
235161
  }
235162
+ function bytesToHex2(bytes) {
235163
+ abytes2(bytes);
235164
+ if (hasHexBuiltin)
235165
+ return bytes.toHex();
235166
+ let hex = "";
235167
+ for (let i6 = 0;i6 < bytes.length; i6++) {
235168
+ hex += hexes2[bytes[i6]];
235169
+ }
235170
+ return hex;
235171
+ }
235172
+ function asciiToBase16(ch) {
235173
+ if (ch >= asciis._0 && ch <= asciis._9)
235174
+ return ch - asciis._0;
235175
+ if (ch >= asciis.A && ch <= asciis.F)
235176
+ return ch - (asciis.A - 10);
235177
+ if (ch >= asciis.a && ch <= asciis.f)
235178
+ return ch - (asciis.a - 10);
235179
+ return;
235180
+ }
235181
+ function hexToBytes2(hex) {
235182
+ if (typeof hex !== "string")
235183
+ throw new Error("hex string expected, got " + typeof hex);
235184
+ if (hasHexBuiltin)
235185
+ return Uint8Array.fromHex(hex);
235186
+ const hl = hex.length;
235187
+ const al = hl / 2;
235188
+ if (hl % 2)
235189
+ throw new Error("hex string expected, got unpadded hex of length " + hl);
235190
+ const array4 = new Uint8Array(al);
235191
+ for (let ai = 0, hi = 0;ai < al; ai++, hi += 2) {
235192
+ const n1 = asciiToBase16(hex.charCodeAt(hi));
235193
+ const n22 = asciiToBase16(hex.charCodeAt(hi + 1));
235194
+ if (n1 === undefined || n22 === undefined) {
235195
+ const char = hex[hi] + hex[hi + 1];
235196
+ throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
235197
+ }
235198
+ array4[ai] = n1 * 16 + n22;
235199
+ }
235200
+ return array4;
235201
+ }
235198
235202
  function bytesToNumberBE(bytes) {
235199
235203
  return hexToNumber2(bytesToHex2(bytes));
235200
235204
  }
235201
235205
  function bytesToNumberLE(bytes) {
235202
- abytes(bytes);
235206
+ abytes2(bytes);
235203
235207
  return hexToNumber2(bytesToHex2(Uint8Array.from(bytes).reverse()));
235204
235208
  }
235205
235209
  function numberToBytesBE(n6, len) {
@@ -235216,7 +235220,7 @@ function ensureBytes(title, hex, expectedLength) {
235216
235220
  } catch (e10) {
235217
235221
  throw new Error(title + " must be hex string or Uint8Array, cause: " + e10);
235218
235222
  }
235219
- } else if (isBytes(hex)) {
235223
+ } else if (isBytes2(hex)) {
235220
235224
  res = Uint8Array.from(hex);
235221
235225
  } else {
235222
235226
  throw new Error(title + " must be hex string or Uint8Array");
@@ -235226,6 +235230,26 @@ function ensureBytes(title, hex, expectedLength) {
235226
235230
  throw new Error(title + " of length " + expectedLength + " expected, got " + len);
235227
235231
  return res;
235228
235232
  }
235233
+ function concatBytes3(...arrays) {
235234
+ let sum = 0;
235235
+ for (let i6 = 0;i6 < arrays.length; i6++) {
235236
+ const a7 = arrays[i6];
235237
+ abytes2(a7);
235238
+ sum += a7.length;
235239
+ }
235240
+ const res = new Uint8Array(sum);
235241
+ for (let i6 = 0, pad2 = 0;i6 < arrays.length; i6++) {
235242
+ const a7 = arrays[i6];
235243
+ res.set(a7, pad2);
235244
+ pad2 += a7.length;
235245
+ }
235246
+ return res;
235247
+ }
235248
+ function utf8ToBytes2(str) {
235249
+ if (typeof str !== "string")
235250
+ throw new Error("string expected");
235251
+ return new Uint8Array(new TextEncoder().encode(str));
235252
+ }
235229
235253
  function inRange(n6, min, max) {
235230
235254
  return isPosBig(n6) && isPosBig(min) && isPosBig(max) && min <= n6 && n6 < max;
235231
235255
  }
@@ -235246,8 +235270,6 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
235246
235270
  throw new Error("qByteLen must be a number");
235247
235271
  if (typeof hmacFn !== "function")
235248
235272
  throw new Error("hmacFn must be a function");
235249
- const u8n = (len) => new Uint8Array(len);
235250
- const u8of = (byte) => Uint8Array.of(byte);
235251
235273
  let v6 = u8n(hashLen);
235252
235274
  let k5 = u8n(hashLen);
235253
235275
  let i6 = 0;
@@ -235258,11 +235280,11 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
235258
235280
  };
235259
235281
  const h8 = (...b4) => hmacFn(k5, v6, ...b4);
235260
235282
  const reseed = (seed = u8n(0)) => {
235261
- k5 = h8(u8of(0), seed);
235283
+ k5 = h8(u8fr([0]), seed);
235262
235284
  v6 = h8();
235263
235285
  if (seed.length === 0)
235264
235286
  return;
235265
- k5 = h8(u8of(1), seed);
235287
+ k5 = h8(u8fr([1]), seed);
235266
235288
  v6 = h8();
235267
235289
  };
235268
235290
  const gen2 = () => {
@@ -235276,7 +235298,7 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
235276
235298
  out.push(sl);
235277
235299
  len += v6.length;
235278
235300
  }
235279
- return concatBytes(...out);
235301
+ return concatBytes3(...out);
235280
235302
  };
235281
235303
  const genUntil = (seed, pred) => {
235282
235304
  reset2();
@@ -235289,22 +235311,23 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
235289
235311
  };
235290
235312
  return genUntil;
235291
235313
  }
235292
- function isHash(val) {
235293
- return typeof val === "function" && Number.isSafeInteger(val.outputLen);
235294
- }
235295
- function _validateObject(object4, fields, optFields = {}) {
235296
- if (!object4 || typeof object4 !== "object")
235297
- throw new Error("expected valid options object");
235298
- function checkField(fieldName, expectedType, isOpt) {
235314
+ function validateObject(object4, validators, optValidators = {}) {
235315
+ const checkField = (fieldName, type4, isOptional) => {
235316
+ const checkVal = validatorFns[type4];
235317
+ if (typeof checkVal !== "function")
235318
+ throw new Error("invalid validator function");
235299
235319
  const val = object4[fieldName];
235300
- if (isOpt && val === undefined)
235320
+ if (isOptional && val === undefined)
235301
235321
  return;
235302
- const current = typeof val;
235303
- if (current !== expectedType || val === null)
235304
- throw new Error(`param "${fieldName}" is invalid: expected ${expectedType}, got ${current}`);
235305
- }
235306
- Object.entries(fields).forEach(([k5, v6]) => checkField(k5, v6, false));
235307
- Object.entries(optFields).forEach(([k5, v6]) => checkField(k5, v6, true));
235322
+ if (!checkVal(val, object4)) {
235323
+ throw new Error("param " + String(fieldName) + " is invalid. Expected " + type4 + ", got " + val);
235324
+ }
235325
+ };
235326
+ for (const [fieldName, type4] of Object.entries(validators))
235327
+ checkField(fieldName, type4, false);
235328
+ for (const [fieldName, type4] of Object.entries(optValidators))
235329
+ checkField(fieldName, type4, true);
235330
+ return object4;
235308
235331
  }
235309
235332
  function memoized(fn) {
235310
235333
  const map6 = new WeakMap;
@@ -235317,13 +235340,25 @@ function memoized(fn) {
235317
235340
  return computed;
235318
235341
  };
235319
235342
  }
235320
- var _0n2, _1n2, isPosBig = (n6) => typeof n6 === "bigint" && _0n2 <= n6, bitMask = (n6) => (_1n2 << BigInt(n6)) - _1n2;
235343
+ var _0n2, _1n2, hasHexBuiltin, hexes2, asciis, isPosBig = (n6) => typeof n6 === "bigint" && _0n2 <= n6, bitMask = (n6) => (_1n2 << BigInt(n6)) - _1n2, u8n = (len) => new Uint8Array(len), u8fr = (arr) => Uint8Array.from(arr), validatorFns;
235321
235344
  var init_utils3 = __esm(() => {
235322
- init_utils2();
235323
- init_utils2();
235324
235345
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
235325
235346
  _0n2 = /* @__PURE__ */ BigInt(0);
235326
235347
  _1n2 = /* @__PURE__ */ BigInt(1);
235348
+ hasHexBuiltin = typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function";
235349
+ hexes2 = /* @__PURE__ */ Array.from({ length: 256 }, (_5, i6) => i6.toString(16).padStart(2, "0"));
235350
+ asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
235351
+ validatorFns = {
235352
+ bigint: (val) => typeof val === "bigint",
235353
+ function: (val) => typeof val === "function",
235354
+ boolean: (val) => typeof val === "boolean",
235355
+ string: (val) => typeof val === "string",
235356
+ stringOrUint8Array: (val) => typeof val === "string" || isBytes2(val),
235357
+ isSafeInteger: (val) => Number.isSafeInteger(val),
235358
+ array: (val) => Array.isArray(val),
235359
+ field: (val, object4) => object4.Fp.isValid(val),
235360
+ hash: (val) => typeof val === "function" && Number.isSafeInteger(val.outputLen)
235361
+ };
235327
235362
  });
235328
235363
 
235329
235364
  // ../../node_modules/@noble/curves/esm/abstract/modular.js
@@ -235437,15 +235472,14 @@ function validateField(field2) {
235437
235472
  const initial = {
235438
235473
  ORDER: "bigint",
235439
235474
  MASK: "bigint",
235440
- BYTES: "number",
235441
- BITS: "number"
235475
+ BYTES: "isSafeInteger",
235476
+ BITS: "isSafeInteger"
235442
235477
  };
235443
235478
  const opts = FIELD_FIELDS.reduce((map6, val) => {
235444
235479
  map6[val] = "function";
235445
235480
  return map6;
235446
235481
  }, initial);
235447
- _validateObject(field2, opts);
235448
- return field2;
235482
+ return validateObject(field2, opts);
235449
235483
  }
235450
235484
  function FpPow(Fp, num, power) {
235451
235485
  if (power < _0n3)
@@ -235498,28 +235532,10 @@ function nLength(n6, nBitLength) {
235498
235532
  const nByteLength = Math.ceil(_nBitLength / 8);
235499
235533
  return { nBitLength: _nBitLength, nByteLength };
235500
235534
  }
235501
- function Field(ORDER, bitLenOrOpts, isLE2 = false, opts = {}) {
235535
+ function Field(ORDER, bitLen2, isLE2 = false, redef = {}) {
235502
235536
  if (ORDER <= _0n3)
235503
235537
  throw new Error("invalid field: expected ORDER > 0, got " + ORDER);
235504
- let _nbitLength = undefined;
235505
- let _sqrt = undefined;
235506
- if (typeof bitLenOrOpts === "object" && bitLenOrOpts != null) {
235507
- if (opts.sqrt || isLE2)
235508
- throw new Error("cannot specify opts in two arguments");
235509
- const _opts = bitLenOrOpts;
235510
- if (_opts.BITS)
235511
- _nbitLength = _opts.BITS;
235512
- if (_opts.sqrt)
235513
- _sqrt = _opts.sqrt;
235514
- if (typeof _opts.isLE === "boolean")
235515
- isLE2 = _opts.isLE;
235516
- } else {
235517
- if (typeof bitLenOrOpts === "number")
235518
- _nbitLength = bitLenOrOpts;
235519
- if (opts.sqrt)
235520
- _sqrt = opts.sqrt;
235521
- }
235522
- const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, _nbitLength);
235538
+ const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2);
235523
235539
  if (BYTES > 2048)
235524
235540
  throw new Error("invalid field: expected ORDER of <= 2048 bytes");
235525
235541
  let sqrtP;
@@ -235538,7 +235554,6 @@ function Field(ORDER, bitLenOrOpts, isLE2 = false, opts = {}) {
235538
235554
  return _0n3 <= num && num < ORDER;
235539
235555
  },
235540
235556
  is0: (num) => num === _0n3,
235541
- isValidNot0: (num) => !f5.is0(num) && f5.isValid(num),
235542
235557
  isOdd: (num) => (num & _1n3) === _1n3,
235543
235558
  neg: (num) => mod(-num, ORDER),
235544
235559
  eql: (lhs, rhs) => lhs === rhs,
@@ -235553,7 +235568,7 @@ function Field(ORDER, bitLenOrOpts, isLE2 = false, opts = {}) {
235553
235568
  subN: (lhs, rhs) => lhs - rhs,
235554
235569
  mulN: (lhs, rhs) => lhs * rhs,
235555
235570
  inv: (num) => invert(num, ORDER),
235556
- sqrt: _sqrt || ((n6) => {
235571
+ sqrt: redef.sqrt || ((n6) => {
235557
235572
  if (!sqrtP)
235558
235573
  sqrtP = FpSqrt(ORDER);
235559
235574
  return sqrtP(f5, n6);
@@ -235591,6 +235606,7 @@ function mapHashToField(key2, fieldOrder, isLE2 = false) {
235591
235606
  }
235592
235607
  var _0n3, _1n3, _2n2, _3n, _4n, _5n, _8n, FIELD_FIELDS;
235593
235608
  var init_modular = __esm(() => {
235609
+ init_utils2();
235594
235610
  init_utils3();
235595
235611
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
235596
235612
  _0n3 = BigInt(0);
@@ -235622,16 +235638,10 @@ var init_modular = __esm(() => {
235622
235638
  });
235623
235639
 
235624
235640
  // ../../node_modules/@noble/curves/esm/abstract/curve.js
235625
- function negateCt(condition, item) {
235641
+ function constTimeNegate(condition, item) {
235626
235642
  const neg = item.negate();
235627
235643
  return condition ? neg : item;
235628
235644
  }
235629
- function normalizeZ(c3, property, points) {
235630
- const getz = property === "pz" ? (p5) => p5.pz : (p5) => p5.ez;
235631
- const toInv = FpInvertBatch(c3.Fp, points.map(getz));
235632
- const affined = points.map((p5, i6) => p5.toAffine(toInv[i6]));
235633
- return affined.map(c3.fromAffine);
235634
- }
235635
235645
  function validateW(W5, bits) {
235636
235646
  if (!Number.isSafeInteger(W5) || W5 <= 0 || W5 > bits)
235637
235647
  throw new Error("invalid window size, expected [1.." + bits + "], got W=" + W5);
@@ -235680,13 +235690,9 @@ function validateMSMScalars(scalars, field2) {
235680
235690
  function getW(P5) {
235681
235691
  return pointWindowSizes.get(P5) || 1;
235682
235692
  }
235683
- function assert0(n6) {
235684
- if (n6 !== _0n4)
235685
- throw new Error("invalid wNAF");
235686
- }
235687
235693
  function wNAF(c3, bits) {
235688
235694
  return {
235689
- constTimeNegate: negateCt,
235695
+ constTimeNegate,
235690
235696
  hasPrecomputes(elm) {
235691
235697
  return getW(elm) !== 1;
235692
235698
  },
@@ -235724,12 +235730,11 @@ function wNAF(c3, bits) {
235724
235730
  const { nextN, offset, isZero, isNeg, isNegF, offsetF } = calcOffsets(n6, window2, wo);
235725
235731
  n6 = nextN;
235726
235732
  if (isZero) {
235727
- f5 = f5.add(negateCt(isNegF, precomputes[offsetF]));
235733
+ f5 = f5.add(constTimeNegate(isNegF, precomputes[offsetF]));
235728
235734
  } else {
235729
- p5 = p5.add(negateCt(isNeg, precomputes[offset]));
235735
+ p5 = p5.add(constTimeNegate(isNeg, precomputes[offset]));
235730
235736
  }
235731
235737
  }
235732
- assert0(n6);
235733
235738
  return { p: p5, f: f5 };
235734
235739
  },
235735
235740
  wNAFUnsafe(W5, precomputes, n6, acc = c3.ZERO) {
@@ -235746,18 +235751,14 @@ function wNAF(c3, bits) {
235746
235751
  acc = acc.add(isNeg ? item.negate() : item);
235747
235752
  }
235748
235753
  }
235749
- assert0(n6);
235750
235754
  return acc;
235751
235755
  },
235752
235756
  getPrecomputes(W5, P5, transform5) {
235753
235757
  let comp = pointPrecomputes.get(P5);
235754
235758
  if (!comp) {
235755
235759
  comp = this.precomputeWindow(P5, W5);
235756
- if (W5 !== 1) {
235757
- if (typeof transform5 === "function")
235758
- comp = transform5(comp);
235759
- pointPrecomputes.set(P5, comp);
235760
- }
235760
+ if (W5 !== 1)
235761
+ pointPrecomputes.set(P5, transform5(comp));
235761
235762
  }
235762
235763
  return comp;
235763
235764
  },
@@ -235778,21 +235779,6 @@ function wNAF(c3, bits) {
235778
235779
  }
235779
235780
  };
235780
235781
  }
235781
- function mulEndoUnsafe(c3, point, k1, k22) {
235782
- let acc = point;
235783
- let p1 = c3.ZERO;
235784
- let p22 = c3.ZERO;
235785
- while (k1 > _0n4 || k22 > _0n4) {
235786
- if (k1 & _1n4)
235787
- p1 = p1.add(acc);
235788
- if (k22 & _1n4)
235789
- p22 = p22.add(acc);
235790
- acc = acc.double();
235791
- k1 >>= _1n4;
235792
- k22 >>= _1n4;
235793
- }
235794
- return { p1, p2: p22 };
235795
- }
235796
235782
  function pippenger(c3, fieldN, points, scalars) {
235797
235783
  validateMSMPoints(points, c3);
235798
235784
  validateMSMScalars(scalars, fieldN);
@@ -235832,38 +235818,27 @@ function pippenger(c3, fieldN, points, scalars) {
235832
235818
  }
235833
235819
  return sum;
235834
235820
  }
235835
- function createField(order, field2) {
235836
- if (field2) {
235837
- if (field2.ORDER !== order)
235838
- throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
235839
- validateField(field2);
235840
- return field2;
235841
- } else {
235842
- return Field(order);
235843
- }
235844
- }
235845
- function _createCurveFields(type4, CURVE, curveOpts = {}) {
235846
- if (!CURVE || typeof CURVE !== "object")
235847
- throw new Error(`expected valid ${type4} CURVE object`);
235848
- for (const p5 of ["p", "n", "h"]) {
235849
- const val = CURVE[p5];
235850
- if (!(typeof val === "bigint" && val > _0n4))
235851
- throw new Error(`CURVE.${p5} must be positive bigint`);
235852
- }
235853
- const Fp = createField(CURVE.p, curveOpts.Fp);
235854
- const Fn = createField(CURVE.n, curveOpts.Fn);
235855
- const _b = type4 === "weierstrass" ? "b" : "d";
235856
- const params = ["Gx", "Gy", "a", _b];
235857
- for (const p5 of params) {
235858
- if (!Fp.isValid(CURVE[p5]))
235859
- throw new Error(`CURVE.${p5} must be valid field element of CURVE.Fp`);
235860
- }
235861
- return { Fp, Fn };
235821
+ function validateBasic(curve) {
235822
+ validateField(curve.Fp);
235823
+ validateObject(curve, {
235824
+ n: "bigint",
235825
+ h: "bigint",
235826
+ Gx: "field",
235827
+ Gy: "field"
235828
+ }, {
235829
+ nBitLength: "isSafeInteger",
235830
+ nByteLength: "isSafeInteger"
235831
+ });
235832
+ return Object.freeze({
235833
+ ...nLength(curve.n, curve.nBitLength),
235834
+ ...curve,
235835
+ ...{ p: curve.Fp.ORDER }
235836
+ });
235862
235837
  }
235863
235838
  var _0n4, _1n4, pointPrecomputes, pointWindowSizes;
235864
235839
  var init_curve = __esm(() => {
235865
- init_utils3();
235866
235840
  init_modular();
235841
+ init_utils3();
235867
235842
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
235868
235843
  _0n4 = BigInt(0);
235869
235844
  _1n4 = BigInt(1);
@@ -235878,116 +235853,54 @@ function validateSigVerOpts(opts) {
235878
235853
  if (opts.prehash !== undefined)
235879
235854
  abool("prehash", opts.prehash);
235880
235855
  }
235881
- function _legacyHelperEquat(Fp, a7, b4) {
235882
- function weierstrassEquation(x6) {
235883
- const x22 = Fp.sqr(x6);
235884
- const x32 = Fp.mul(x22, x6);
235885
- return Fp.add(Fp.add(x32, Fp.mul(x6, a7)), b4);
235886
- }
235887
- return weierstrassEquation;
235888
- }
235889
- function _legacyHelperNormPriv(Fn, allowedPrivateKeyLengths, wrapPrivateKey) {
235890
- const { BYTES: expected } = Fn;
235891
- function normPrivateKeyToScalar(key2) {
235892
- let num;
235893
- if (typeof key2 === "bigint") {
235894
- num = key2;
235895
- } else {
235896
- let bytes = ensureBytes("private key", key2);
235897
- if (allowedPrivateKeyLengths) {
235898
- if (!allowedPrivateKeyLengths.includes(bytes.length * 2))
235899
- throw new Error("invalid private key");
235900
- const padded = new Uint8Array(expected);
235901
- padded.set(bytes, padded.length - bytes.length);
235902
- bytes = padded;
235903
- }
235904
- try {
235905
- num = Fn.fromBytes(bytes);
235906
- } catch (error44) {
235907
- throw new Error(`invalid private key: expected ui8a of size ${expected}, got ${typeof key2}`);
235908
- }
235909
- }
235910
- if (wrapPrivateKey)
235911
- num = Fn.create(num);
235912
- if (!Fn.isValidNot0(num))
235913
- throw new Error("invalid private key: out of range [1..N-1]");
235914
- return num;
235915
- }
235916
- return normPrivateKeyToScalar;
235917
- }
235918
- function weierstrassN(CURVE, curveOpts = {}) {
235919
- const { Fp, Fn } = _createCurveFields("weierstrass", CURVE, curveOpts);
235920
- const { h: cofactor, n: CURVE_ORDER } = CURVE;
235921
- _validateObject(curveOpts, {}, {
235856
+ function validatePointOpts(curve) {
235857
+ const opts = validateBasic(curve);
235858
+ validateObject(opts, {
235859
+ a: "field",
235860
+ b: "field"
235861
+ }, {
235922
235862
  allowInfinityPoint: "boolean",
235863
+ allowedPrivateKeyLengths: "array",
235923
235864
  clearCofactor: "function",
235924
- isTorsionFree: "function",
235925
235865
  fromBytes: "function",
235866
+ isTorsionFree: "function",
235926
235867
  toBytes: "function",
235927
- endo: "object",
235928
235868
  wrapPrivateKey: "boolean"
235929
235869
  });
235930
- const { endo } = curveOpts;
235870
+ const { endo, Fp, a: a7 } = opts;
235931
235871
  if (endo) {
235932
- if (!Fp.is0(CURVE.a) || typeof endo.beta !== "bigint" || typeof endo.splitScalar !== "function") {
235933
- throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function');
235872
+ if (!Fp.eql(a7, Fp.ZERO)) {
235873
+ throw new Error("invalid endo: CURVE.a must be 0");
235934
235874
  }
235935
- }
235936
- function assertCompressionIsSupported() {
235937
- if (!Fp.isOdd)
235938
- throw new Error("compression is not supported: Field does not have .isOdd()");
235939
- }
235940
- function pointToBytes(_c, point, isCompressed) {
235941
- const { x: x6, y: y4 } = point.toAffine();
235942
- const bx = Fp.toBytes(x6);
235943
- abool("isCompressed", isCompressed);
235944
- if (isCompressed) {
235945
- assertCompressionIsSupported();
235946
- const hasEvenY = !Fp.isOdd(y4);
235947
- return concatBytes(pprefix(hasEvenY), bx);
235948
- } else {
235949
- return concatBytes(Uint8Array.of(4), bx, Fp.toBytes(y4));
235875
+ if (typeof endo !== "object" || typeof endo.beta !== "bigint" || typeof endo.splitScalar !== "function") {
235876
+ throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function');
235950
235877
  }
235951
235878
  }
235952
- function pointFromBytes(bytes) {
235953
- abytes(bytes);
235954
- const L5 = Fp.BYTES;
235955
- const LC = L5 + 1;
235956
- const LU = 2 * L5 + 1;
235957
- const length = bytes.length;
235958
- const head = bytes[0];
235879
+ return Object.freeze({ ...opts });
235880
+ }
235881
+ function numToSizedHex(num, size2) {
235882
+ return bytesToHex2(numberToBytesBE(num, size2));
235883
+ }
235884
+ function weierstrassPoints(opts) {
235885
+ const CURVE = validatePointOpts(opts);
235886
+ const { Fp } = CURVE;
235887
+ const Fn = Field(CURVE.n, CURVE.nBitLength);
235888
+ const toBytes3 = CURVE.toBytes || ((_c, point, _isCompressed) => {
235889
+ const a7 = point.toAffine();
235890
+ return concatBytes3(Uint8Array.from([4]), Fp.toBytes(a7.x), Fp.toBytes(a7.y));
235891
+ });
235892
+ const fromBytes = CURVE.fromBytes || ((bytes) => {
235959
235893
  const tail = bytes.subarray(1);
235960
- if (length === LC && (head === 2 || head === 3)) {
235961
- const x6 = Fp.fromBytes(tail);
235962
- if (!Fp.isValid(x6))
235963
- throw new Error("bad point: is not on curve, wrong x");
235964
- const y22 = weierstrassEquation(x6);
235965
- let y4;
235966
- try {
235967
- y4 = Fp.sqrt(y22);
235968
- } catch (sqrtError) {
235969
- const err = sqrtError instanceof Error ? ": " + sqrtError.message : "";
235970
- throw new Error("bad point: is not on curve, sqrt error" + err);
235971
- }
235972
- assertCompressionIsSupported();
235973
- const isYOdd = Fp.isOdd(y4);
235974
- const isHeadOdd = (head & 1) === 1;
235975
- if (isHeadOdd !== isYOdd)
235976
- y4 = Fp.neg(y4);
235977
- return { x: x6, y: y4 };
235978
- } else if (length === LU && head === 4) {
235979
- const x6 = Fp.fromBytes(tail.subarray(L5 * 0, L5 * 1));
235980
- const y4 = Fp.fromBytes(tail.subarray(L5 * 1, L5 * 2));
235981
- if (!isValidXY(x6, y4))
235982
- throw new Error("bad point: is not on curve");
235983
- return { x: x6, y: y4 };
235984
- } else {
235985
- throw new Error(`bad point: got length ${length}, expected compressed=${LC} or uncompressed=${LU}`);
235986
- }
235894
+ const x6 = Fp.fromBytes(tail.subarray(0, Fp.BYTES));
235895
+ const y4 = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES));
235896
+ return { x: x6, y: y4 };
235897
+ });
235898
+ function weierstrassEquation(x6) {
235899
+ const { a: a7, b: b4 } = CURVE;
235900
+ const x22 = Fp.sqr(x6);
235901
+ const x32 = Fp.mul(x22, x6);
235902
+ return Fp.add(Fp.add(x32, Fp.mul(x6, a7)), b4);
235987
235903
  }
235988
- const toBytes3 = curveOpts.toBytes || pointToBytes;
235989
- const fromBytes = curveOpts.fromBytes || pointFromBytes;
235990
- const weierstrassEquation = _legacyHelperEquat(Fp, CURVE.a, CURVE.b);
235991
235904
  function isValidXY(x6, y4) {
235992
235905
  const left = Fp.sqr(y4);
235993
235906
  const right = weierstrassEquation(x6);
@@ -235999,10 +235912,28 @@ function weierstrassN(CURVE, curveOpts = {}) {
235999
235912
  const _27b2 = Fp.mul(Fp.sqr(CURVE.b), BigInt(27));
236000
235913
  if (Fp.is0(Fp.add(_4a3, _27b2)))
236001
235914
  throw new Error("bad curve params: a or b");
236002
- function acoord(title, n6, banZero = false) {
236003
- if (!Fp.isValid(n6) || banZero && Fp.is0(n6))
236004
- throw new Error(`bad point coordinate ${title}`);
236005
- return n6;
235915
+ function isWithinCurveOrder(num) {
235916
+ return inRange(num, _1n5, CURVE.n);
235917
+ }
235918
+ function normPrivateKeyToScalar(key2) {
235919
+ const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n: N6 } = CURVE;
235920
+ if (lengths && typeof key2 !== "bigint") {
235921
+ if (isBytes2(key2))
235922
+ key2 = bytesToHex2(key2);
235923
+ if (typeof key2 !== "string" || !lengths.includes(key2.length))
235924
+ throw new Error("invalid private key");
235925
+ key2 = key2.padStart(nByteLength * 2, "0");
235926
+ }
235927
+ let num;
235928
+ try {
235929
+ num = typeof key2 === "bigint" ? key2 : bytesToNumberBE(ensureBytes("private key", key2, nByteLength));
235930
+ } catch (error44) {
235931
+ throw new Error("invalid private key, expected hex or " + nByteLength + " bytes, got " + typeof key2);
235932
+ }
235933
+ if (wrapPrivateKey)
235934
+ num = mod(num, N6);
235935
+ aInRange("private key", num, _1n5, N6);
235936
+ return num;
236006
235937
  }
236007
235938
  function aprjpoint(other) {
236008
235939
  if (!(other instanceof Point))
@@ -236026,31 +235957,31 @@ function weierstrassN(CURVE, curveOpts = {}) {
236026
235957
  });
236027
235958
  const assertValidMemo = memoized((p5) => {
236028
235959
  if (p5.is0()) {
236029
- if (curveOpts.allowInfinityPoint && !Fp.is0(p5.py))
235960
+ if (CURVE.allowInfinityPoint && !Fp.is0(p5.py))
236030
235961
  return;
236031
235962
  throw new Error("bad point: ZERO");
236032
235963
  }
236033
235964
  const { x: x6, y: y4 } = p5.toAffine();
236034
235965
  if (!Fp.isValid(x6) || !Fp.isValid(y4))
236035
- throw new Error("bad point: x or y not field elements");
235966
+ throw new Error("bad point: x or y not FE");
236036
235967
  if (!isValidXY(x6, y4))
236037
235968
  throw new Error("bad point: equation left != right");
236038
235969
  if (!p5.isTorsionFree())
236039
235970
  throw new Error("bad point: not in prime-order subgroup");
236040
235971
  return true;
236041
235972
  });
236042
- function finishEndo(endoBeta, k1p, k2p, k1neg, k2neg) {
236043
- k2p = new Point(Fp.mul(k2p.px, endoBeta), k2p.py, k2p.pz);
236044
- k1p = negateCt(k1neg, k1p);
236045
- k2p = negateCt(k2neg, k2p);
236046
- return k1p.add(k2p);
236047
- }
236048
235973
 
236049
235974
  class Point {
236050
235975
  constructor(px, py, pz) {
236051
- this.px = acoord("x", px);
236052
- this.py = acoord("y", py, true);
236053
- this.pz = acoord("z", pz);
235976
+ if (px == null || !Fp.isValid(px))
235977
+ throw new Error("x required");
235978
+ if (py == null || !Fp.isValid(py) || Fp.is0(py))
235979
+ throw new Error("y required");
235980
+ if (pz == null || !Fp.isValid(pz))
235981
+ throw new Error("z required");
235982
+ this.px = px;
235983
+ this.py = py;
235984
+ this.pz = pz;
236054
235985
  Object.freeze(this);
236055
235986
  }
236056
235987
  static fromAffine(p5) {
@@ -236059,7 +235990,8 @@ function weierstrassN(CURVE, curveOpts = {}) {
236059
235990
  throw new Error("invalid affine point");
236060
235991
  if (p5 instanceof Point)
236061
235992
  throw new Error("projective point not allowed");
236062
- if (Fp.is0(x6) && Fp.is0(y4))
235993
+ const is0 = (i6) => Fp.eql(i6, Fp.ZERO);
235994
+ if (is0(x6) && is0(y4))
236063
235995
  return Point.ZERO;
236064
235996
  return new Point(x6, y4, Fp.ONE);
236065
235997
  }
@@ -236070,11 +236002,8 @@ function weierstrassN(CURVE, curveOpts = {}) {
236070
236002
  return this.toAffine().y;
236071
236003
  }
236072
236004
  static normalizeZ(points) {
236073
- return normalizeZ(Point, "pz", points);
236074
- }
236075
- static fromBytes(bytes) {
236076
- abytes(bytes);
236077
- return Point.fromHex(bytes);
236005
+ const toInv = FpInvertBatch(Fp, points.map((p5) => p5.pz));
236006
+ return points.map((p5, i6) => p5.toAffine(toInv[i6])).map(Point.fromAffine);
236078
236007
  }
236079
236008
  static fromHex(hex) {
236080
236009
  const P5 = Point.fromAffine(fromBytes(ensureBytes("pointHex", hex)));
@@ -236082,29 +236011,22 @@ function weierstrassN(CURVE, curveOpts = {}) {
236082
236011
  return P5;
236083
236012
  }
236084
236013
  static fromPrivateKey(privateKey) {
236085
- const normPrivateKeyToScalar = _legacyHelperNormPriv(Fn, curveOpts.allowedPrivateKeyLengths, curveOpts.wrapPrivateKey);
236086
236014
  return Point.BASE.multiply(normPrivateKeyToScalar(privateKey));
236087
236015
  }
236088
236016
  static msm(points, scalars) {
236089
236017
  return pippenger(Point, Fn, points, scalars);
236090
236018
  }
236091
- precompute(windowSize = 8, isLazy = true) {
236092
- wnaf.setWindowSize(this, windowSize);
236093
- if (!isLazy)
236094
- this.multiply(_3n2);
236095
- return this;
236096
- }
236097
236019
  _setWindowSize(windowSize) {
236098
- this.precompute(windowSize);
236020
+ wnaf.setWindowSize(this, windowSize);
236099
236021
  }
236100
236022
  assertValidity() {
236101
236023
  assertValidMemo(this);
236102
236024
  }
236103
236025
  hasEvenY() {
236104
236026
  const { y: y4 } = this.toAffine();
236105
- if (!Fp.isOdd)
236106
- throw new Error("Field doesn't support isOdd");
236107
- return !Fp.isOdd(y4);
236027
+ if (Fp.isOdd)
236028
+ return !Fp.isOdd(y4);
236029
+ throw new Error("Field doesn't support isOdd");
236108
236030
  }
236109
236031
  equals(other) {
236110
236032
  aprjpoint(other);
@@ -236210,121 +236132,188 @@ function weierstrassN(CURVE, curveOpts = {}) {
236210
236132
  is0() {
236211
236133
  return this.equals(Point.ZERO);
236212
236134
  }
236135
+ wNAF(n6) {
236136
+ return wnaf.wNAFCached(this, n6, Point.normalizeZ);
236137
+ }
236138
+ multiplyUnsafe(sc) {
236139
+ const { endo: endo2, n: N6 } = CURVE;
236140
+ aInRange("scalar", sc, _0n5, N6);
236141
+ const I6 = Point.ZERO;
236142
+ if (sc === _0n5)
236143
+ return I6;
236144
+ if (this.is0() || sc === _1n5)
236145
+ return this;
236146
+ if (!endo2 || wnaf.hasPrecomputes(this))
236147
+ return wnaf.wNAFCachedUnsafe(this, sc, Point.normalizeZ);
236148
+ let { k1neg, k1, k2neg, k2: k22 } = endo2.splitScalar(sc);
236149
+ let k1p = I6;
236150
+ let k2p = I6;
236151
+ let d6 = this;
236152
+ while (k1 > _0n5 || k22 > _0n5) {
236153
+ if (k1 & _1n5)
236154
+ k1p = k1p.add(d6);
236155
+ if (k22 & _1n5)
236156
+ k2p = k2p.add(d6);
236157
+ d6 = d6.double();
236158
+ k1 >>= _1n5;
236159
+ k22 >>= _1n5;
236160
+ }
236161
+ if (k1neg)
236162
+ k1p = k1p.negate();
236163
+ if (k2neg)
236164
+ k2p = k2p.negate();
236165
+ k2p = new Point(Fp.mul(k2p.px, endo2.beta), k2p.py, k2p.pz);
236166
+ return k1p.add(k2p);
236167
+ }
236213
236168
  multiply(scalar) {
236214
- const { endo: endo2 } = curveOpts;
236215
- if (!Fn.isValidNot0(scalar))
236216
- throw new Error("invalid scalar: out of range");
236169
+ const { endo: endo2, n: N6 } = CURVE;
236170
+ aInRange("scalar", scalar, _1n5, N6);
236217
236171
  let point, fake;
236218
- const mul = (n6) => wnaf.wNAFCached(this, n6, Point.normalizeZ);
236219
236172
  if (endo2) {
236220
236173
  const { k1neg, k1, k2neg, k2: k22 } = endo2.splitScalar(scalar);
236221
- const { p: k1p, f: k1f } = mul(k1);
236222
- const { p: k2p, f: k2f } = mul(k22);
236223
- fake = k1f.add(k2f);
236224
- point = finishEndo(endo2.beta, k1p, k2p, k1neg, k2neg);
236174
+ let { p: k1p, f: f1p } = this.wNAF(k1);
236175
+ let { p: k2p, f: f2p } = this.wNAF(k22);
236176
+ k1p = wnaf.constTimeNegate(k1neg, k1p);
236177
+ k2p = wnaf.constTimeNegate(k2neg, k2p);
236178
+ k2p = new Point(Fp.mul(k2p.px, endo2.beta), k2p.py, k2p.pz);
236179
+ point = k1p.add(k2p);
236180
+ fake = f1p.add(f2p);
236225
236181
  } else {
236226
- const { p: p5, f: f5 } = mul(scalar);
236182
+ const { p: p5, f: f5 } = this.wNAF(scalar);
236227
236183
  point = p5;
236228
236184
  fake = f5;
236229
236185
  }
236230
236186
  return Point.normalizeZ([point, fake])[0];
236231
236187
  }
236232
- multiplyUnsafe(sc) {
236233
- const { endo: endo2 } = curveOpts;
236234
- const p5 = this;
236235
- if (!Fn.isValid(sc))
236236
- throw new Error("invalid scalar: out of range");
236237
- if (sc === _0n5 || p5.is0())
236238
- return Point.ZERO;
236239
- if (sc === _1n5)
236240
- return p5;
236241
- if (wnaf.hasPrecomputes(this))
236242
- return this.multiply(sc);
236243
- if (endo2) {
236244
- const { k1neg, k1, k2neg, k2: k22 } = endo2.splitScalar(sc);
236245
- const { p1, p2: p22 } = mulEndoUnsafe(Point, p5, k1, k22);
236246
- return finishEndo(endo2.beta, p1, p22, k1neg, k2neg);
236247
- } else {
236248
- return wnaf.wNAFCachedUnsafe(p5, sc);
236249
- }
236250
- }
236251
236188
  multiplyAndAddUnsafe(Q4, a7, b4) {
236252
- const sum = this.multiplyUnsafe(a7).add(Q4.multiplyUnsafe(b4));
236189
+ const G4 = Point.BASE;
236190
+ const mul = (P5, a8) => a8 === _0n5 || a8 === _1n5 || !P5.equals(G4) ? P5.multiplyUnsafe(a8) : P5.multiply(a8);
236191
+ const sum = mul(this, a7).add(mul(Q4, b4));
236253
236192
  return sum.is0() ? undefined : sum;
236254
236193
  }
236255
- toAffine(invertedZ) {
236256
- return toAffineMemo(this, invertedZ);
236194
+ toAffine(iz) {
236195
+ return toAffineMemo(this, iz);
236257
236196
  }
236258
236197
  isTorsionFree() {
236259
- const { isTorsionFree } = curveOpts;
236198
+ const { h: cofactor, isTorsionFree } = CURVE;
236260
236199
  if (cofactor === _1n5)
236261
236200
  return true;
236262
236201
  if (isTorsionFree)
236263
236202
  return isTorsionFree(Point, this);
236264
- return wnaf.wNAFCachedUnsafe(this, CURVE_ORDER).is0();
236203
+ throw new Error("isTorsionFree() has not been declared for the elliptic curve");
236265
236204
  }
236266
236205
  clearCofactor() {
236267
- const { clearCofactor } = curveOpts;
236206
+ const { h: cofactor, clearCofactor } = CURVE;
236268
236207
  if (cofactor === _1n5)
236269
236208
  return this;
236270
236209
  if (clearCofactor)
236271
236210
  return clearCofactor(Point, this);
236272
- return this.multiplyUnsafe(cofactor);
236211
+ return this.multiplyUnsafe(CURVE.h);
236273
236212
  }
236274
- toBytes(isCompressed = true) {
236213
+ toRawBytes(isCompressed = true) {
236275
236214
  abool("isCompressed", isCompressed);
236276
236215
  this.assertValidity();
236277
236216
  return toBytes3(Point, this, isCompressed);
236278
236217
  }
236279
- toRawBytes(isCompressed = true) {
236280
- return this.toBytes(isCompressed);
236281
- }
236282
236218
  toHex(isCompressed = true) {
236283
- return bytesToHex2(this.toBytes(isCompressed));
236284
- }
236285
- toString() {
236286
- return `<Point ${this.is0() ? "ZERO" : this.toHex()}>`;
236219
+ abool("isCompressed", isCompressed);
236220
+ return bytesToHex2(this.toRawBytes(isCompressed));
236287
236221
  }
236288
236222
  }
236289
236223
  Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);
236290
236224
  Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO);
236291
- Point.Fp = Fp;
236292
- Point.Fn = Fn;
236293
- const bits = Fn.BITS;
236294
- const wnaf = wNAF(Point, curveOpts.endo ? Math.ceil(bits / 2) : bits);
236295
- return Point;
236296
- }
236297
- function pprefix(hasEvenY) {
236298
- return Uint8Array.of(hasEvenY ? 2 : 3);
236225
+ const { endo, nBitLength } = CURVE;
236226
+ const wnaf = wNAF(Point, endo ? Math.ceil(nBitLength / 2) : nBitLength);
236227
+ return {
236228
+ CURVE,
236229
+ ProjectivePoint: Point,
236230
+ normPrivateKeyToScalar,
236231
+ weierstrassEquation,
236232
+ isWithinCurveOrder
236233
+ };
236299
236234
  }
236300
- function ecdsa(Point, ecdsaOpts, curveOpts = {}) {
236301
- _validateObject(ecdsaOpts, { hash: "function" }, {
236235
+ function validateOpts(curve) {
236236
+ const opts = validateBasic(curve);
236237
+ validateObject(opts, {
236238
+ hash: "hash",
236302
236239
  hmac: "function",
236303
- lowS: "boolean",
236304
- randomBytes: "function",
236240
+ randomBytes: "function"
236241
+ }, {
236305
236242
  bits2int: "function",
236306
- bits2int_modN: "function"
236243
+ bits2int_modN: "function",
236244
+ lowS: "boolean"
236245
+ });
236246
+ return Object.freeze({ lowS: true, ...opts });
236247
+ }
236248
+ function weierstrass(curveDef) {
236249
+ const CURVE = validateOpts(curveDef);
236250
+ const { Fp, n: CURVE_ORDER, nByteLength, nBitLength } = CURVE;
236251
+ const compressedLen = Fp.BYTES + 1;
236252
+ const uncompressedLen = 2 * Fp.BYTES + 1;
236253
+ function modN(a7) {
236254
+ return mod(a7, CURVE_ORDER);
236255
+ }
236256
+ function invN(a7) {
236257
+ return invert(a7, CURVE_ORDER);
236258
+ }
236259
+ const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder } = weierstrassPoints({
236260
+ ...CURVE,
236261
+ toBytes(_c, point, isCompressed) {
236262
+ const a7 = point.toAffine();
236263
+ const x6 = Fp.toBytes(a7.x);
236264
+ const cat = concatBytes3;
236265
+ abool("isCompressed", isCompressed);
236266
+ if (isCompressed) {
236267
+ return cat(Uint8Array.from([point.hasEvenY() ? 2 : 3]), x6);
236268
+ } else {
236269
+ return cat(Uint8Array.from([4]), x6, Fp.toBytes(a7.y));
236270
+ }
236271
+ },
236272
+ fromBytes(bytes) {
236273
+ const len = bytes.length;
236274
+ const head = bytes[0];
236275
+ const tail = bytes.subarray(1);
236276
+ if (len === compressedLen && (head === 2 || head === 3)) {
236277
+ const x6 = bytesToNumberBE(tail);
236278
+ if (!inRange(x6, _1n5, Fp.ORDER))
236279
+ throw new Error("Point is not on curve");
236280
+ const y22 = weierstrassEquation(x6);
236281
+ let y4;
236282
+ try {
236283
+ y4 = Fp.sqrt(y22);
236284
+ } catch (sqrtError) {
236285
+ const suffix = sqrtError instanceof Error ? ": " + sqrtError.message : "";
236286
+ throw new Error("Point is not on curve" + suffix);
236287
+ }
236288
+ const isYOdd = (y4 & _1n5) === _1n5;
236289
+ const isHeadOdd = (head & 1) === 1;
236290
+ if (isHeadOdd !== isYOdd)
236291
+ y4 = Fp.neg(y4);
236292
+ return { x: x6, y: y4 };
236293
+ } else if (len === uncompressedLen && head === 4) {
236294
+ const x6 = Fp.fromBytes(tail.subarray(0, Fp.BYTES));
236295
+ const y4 = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES));
236296
+ return { x: x6, y: y4 };
236297
+ } else {
236298
+ const cl = compressedLen;
236299
+ const ul = uncompressedLen;
236300
+ throw new Error("invalid Point, expected length of " + cl + ", or uncompressed " + ul + ", got " + len);
236301
+ }
236302
+ }
236307
236303
  });
236308
- const randomBytes_ = ecdsaOpts.randomBytes || randomBytes;
236309
- const hmac_ = ecdsaOpts.hmac || ((key2, ...msgs) => hmac(ecdsaOpts.hash, key2, concatBytes(...msgs)));
236310
- const { Fp, Fn } = Point;
236311
- const { ORDER: CURVE_ORDER, BITS: fnBits } = Fn;
236312
236304
  function isBiggerThanHalfOrder(number6) {
236313
236305
  const HALF = CURVE_ORDER >> _1n5;
236314
236306
  return number6 > HALF;
236315
236307
  }
236316
236308
  function normalizeS(s7) {
236317
- return isBiggerThanHalfOrder(s7) ? Fn.neg(s7) : s7;
236318
- }
236319
- function aValidRS(title, num) {
236320
- if (!Fn.isValidNot0(num))
236321
- throw new Error(`invalid signature ${title}: out of range 1..CURVE.n`);
236309
+ return isBiggerThanHalfOrder(s7) ? modN(-s7) : s7;
236322
236310
  }
236311
+ const slcNum = (b4, from, to) => bytesToNumberBE(b4.slice(from, to));
236323
236312
 
236324
236313
  class Signature {
236325
236314
  constructor(r6, s7, recovery) {
236326
- aValidRS("r", r6);
236327
- aValidRS("s", s7);
236315
+ aInRange("r", r6, _1n5, CURVE_ORDER);
236316
+ aInRange("s", s7, _1n5, CURVE_ORDER);
236328
236317
  this.r = r6;
236329
236318
  this.s = s7;
236330
236319
  if (recovery != null)
@@ -236332,9 +236321,9 @@ function ecdsa(Point, ecdsaOpts, curveOpts = {}) {
236332
236321
  Object.freeze(this);
236333
236322
  }
236334
236323
  static fromCompact(hex) {
236335
- const L5 = Fn.BYTES;
236336
- const b4 = ensureBytes("compactSignature", hex, L5 * 2);
236337
- return new Signature(Fn.fromBytes(b4.subarray(0, L5)), Fn.fromBytes(b4.subarray(L5, L5 * 2)));
236324
+ const l3 = nByteLength;
236325
+ hex = ensureBytes("compactSignature", hex, l3 * 2);
236326
+ return new Signature(slcNum(hex, 0, l3), slcNum(hex, l3, 2 * l3));
236338
236327
  }
236339
236328
  static fromDER(hex) {
236340
236329
  const { r: r6, s: s7 } = DER.toSig(ensureBytes("DER", hex));
@@ -236345,24 +236334,20 @@ function ecdsa(Point, ecdsaOpts, curveOpts = {}) {
236345
236334
  return new Signature(this.r, this.s, recovery);
236346
236335
  }
236347
236336
  recoverPublicKey(msgHash) {
236348
- const FIELD_ORDER = Fp.ORDER;
236349
236337
  const { r: r6, s: s7, recovery: rec } = this;
236338
+ const h8 = bits2int_modN(ensureBytes("msgHash", msgHash));
236350
236339
  if (rec == null || ![0, 1, 2, 3].includes(rec))
236351
236340
  throw new Error("recovery id invalid");
236352
- const hasCofactor = CURVE_ORDER * _2n3 < FIELD_ORDER;
236353
- if (hasCofactor && rec > 1)
236354
- throw new Error("recovery id is ambiguous for h>1 curve");
236355
- const radj = rec === 2 || rec === 3 ? r6 + CURVE_ORDER : r6;
236356
- if (!Fp.isValid(radj))
236341
+ const radj = rec === 2 || rec === 3 ? r6 + CURVE.n : r6;
236342
+ if (radj >= Fp.ORDER)
236357
236343
  throw new Error("recovery id 2 or 3 invalid");
236358
- const x6 = Fp.toBytes(radj);
236359
- const R7 = Point.fromHex(concatBytes(pprefix((rec & 1) === 0), x6));
236360
- const ir2 = Fn.inv(radj);
236361
- const h8 = bits2int_modN(ensureBytes("msgHash", msgHash));
236362
- const u1 = Fn.create(-h8 * ir2);
236363
- const u22 = Fn.create(s7 * ir2);
236364
- const Q4 = Point.BASE.multiplyUnsafe(u1).add(R7.multiplyUnsafe(u22));
236365
- if (Q4.is0())
236344
+ const prefix = (rec & 1) === 0 ? "02" : "03";
236345
+ const R7 = Point.fromHex(prefix + numToSizedHex(radj, Fp.BYTES));
236346
+ const ir2 = invN(radj);
236347
+ const u1 = modN(-h8 * ir2);
236348
+ const u22 = modN(s7 * ir2);
236349
+ const Q4 = Point.BASE.multiplyAndAddUnsafe(R7, u1, u22);
236350
+ if (!Q4)
236366
236351
  throw new Error("point at infinify");
236367
236352
  Q4.assertValidity();
236368
236353
  return Q4;
@@ -236371,29 +236356,22 @@ function ecdsa(Point, ecdsaOpts, curveOpts = {}) {
236371
236356
  return isBiggerThanHalfOrder(this.s);
236372
236357
  }
236373
236358
  normalizeS() {
236374
- return this.hasHighS() ? new Signature(this.r, Fn.neg(this.s), this.recovery) : this;
236375
- }
236376
- toBytes(format2) {
236377
- if (format2 === "compact")
236378
- return concatBytes(Fn.toBytes(this.r), Fn.toBytes(this.s));
236379
- if (format2 === "der")
236380
- return hexToBytes2(DER.hexFromSig(this));
236381
- throw new Error("invalid format");
236359
+ return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this;
236382
236360
  }
236383
236361
  toDERRawBytes() {
236384
- return this.toBytes("der");
236362
+ return hexToBytes2(this.toDERHex());
236385
236363
  }
236386
236364
  toDERHex() {
236387
- return bytesToHex2(this.toBytes("der"));
236365
+ return DER.hexFromSig(this);
236388
236366
  }
236389
236367
  toCompactRawBytes() {
236390
- return this.toBytes("compact");
236368
+ return hexToBytes2(this.toCompactHex());
236391
236369
  }
236392
236370
  toCompactHex() {
236393
- return bytesToHex2(this.toBytes("compact"));
236371
+ const l3 = nByteLength;
236372
+ return numToSizedHex(this.r, l3) + numToSizedHex(this.s, l3);
236394
236373
  }
236395
236374
  }
236396
- const normPrivateKeyToScalar = _legacyHelperNormPriv(Fn, curveOpts.allowedPrivateKeyLengths, curveOpts.wrapPrivateKey);
236397
236375
  const utils = {
236398
236376
  isValidPrivateKey(privateKey) {
236399
236377
  try {
@@ -236405,15 +236383,17 @@ function ecdsa(Point, ecdsaOpts, curveOpts = {}) {
236405
236383
  },
236406
236384
  normPrivateKeyToScalar,
236407
236385
  randomPrivateKey: () => {
236408
- const n6 = CURVE_ORDER;
236409
- return mapHashToField(randomBytes_(getMinHashLength(n6)), n6);
236386
+ const length = getMinHashLength(CURVE.n);
236387
+ return mapHashToField(CURVE.randomBytes(length), CURVE.n);
236410
236388
  },
236411
236389
  precompute(windowSize = 8, point = Point.BASE) {
236412
- return point.precompute(windowSize, false);
236390
+ point._setWindowSize(windowSize);
236391
+ point.multiply(BigInt(3));
236392
+ return point;
236413
236393
  }
236414
236394
  };
236415
236395
  function getPublicKey(privateKey, isCompressed = true) {
236416
- return Point.fromPrivateKey(privateKey).toBytes(isCompressed);
236396
+ return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed);
236417
236397
  }
236418
236398
  function isProbPub(item) {
236419
236399
  if (typeof item === "bigint")
@@ -236421,14 +236401,14 @@ function ecdsa(Point, ecdsaOpts, curveOpts = {}) {
236421
236401
  if (item instanceof Point)
236422
236402
  return true;
236423
236403
  const arr = ensureBytes("key", item);
236424
- const length = arr.length;
236425
- const L5 = Fp.BYTES;
236426
- const LC = L5 + 1;
236427
- const LU = 2 * L5 + 1;
236428
- if (curveOpts.allowedPrivateKeyLengths || Fn.BYTES === LC) {
236404
+ const len = arr.length;
236405
+ const fpl = Fp.BYTES;
236406
+ const compLen = fpl + 1;
236407
+ const uncompLen = 2 * fpl + 1;
236408
+ if (CURVE.allowedPrivateKeyLengths || nByteLength === compLen) {
236429
236409
  return;
236430
236410
  } else {
236431
- return length === LC || length === LU;
236411
+ return len === compLen || len === uncompLen;
236432
236412
  }
236433
236413
  }
236434
236414
  function getSharedSecret(privateA, publicB, isCompressed = true) {
@@ -236437,27 +236417,27 @@ function ecdsa(Point, ecdsaOpts, curveOpts = {}) {
236437
236417
  if (isProbPub(publicB) === false)
236438
236418
  throw new Error("second arg must be public key");
236439
236419
  const b4 = Point.fromHex(publicB);
236440
- return b4.multiply(normPrivateKeyToScalar(privateA)).toBytes(isCompressed);
236420
+ return b4.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);
236441
236421
  }
236442
- const bits2int = ecdsaOpts.bits2int || function(bytes) {
236422
+ const bits2int = CURVE.bits2int || function(bytes) {
236443
236423
  if (bytes.length > 8192)
236444
236424
  throw new Error("input is too large");
236445
236425
  const num = bytesToNumberBE(bytes);
236446
- const delta = bytes.length * 8 - fnBits;
236426
+ const delta = bytes.length * 8 - nBitLength;
236447
236427
  return delta > 0 ? num >> BigInt(delta) : num;
236448
236428
  };
236449
- const bits2int_modN = ecdsaOpts.bits2int_modN || function(bytes) {
236450
- return Fn.create(bits2int(bytes));
236429
+ const bits2int_modN = CURVE.bits2int_modN || function(bytes) {
236430
+ return modN(bits2int(bytes));
236451
236431
  };
236452
- const ORDER_MASK = bitMask(fnBits);
236432
+ const ORDER_MASK = bitMask(nBitLength);
236453
236433
  function int2octets(num) {
236454
- aInRange("num < 2^" + fnBits, num, _0n5, ORDER_MASK);
236455
- return Fn.toBytes(num);
236434
+ aInRange("num < 2^" + nBitLength, num, _0n5, ORDER_MASK);
236435
+ return numberToBytesBE(num, nByteLength);
236456
236436
  }
236457
236437
  function prepSig(msgHash, privateKey, opts = defaultSigOpts) {
236458
236438
  if (["recovered", "canonical"].some((k5) => (k5 in opts)))
236459
236439
  throw new Error("sign() legacy options not supported");
236460
- const { hash: hash2 } = ecdsaOpts;
236440
+ const { hash: hash2, randomBytes: randomBytes2 } = CURVE;
236461
236441
  let { lowS, prehash, extraEntropy: ent } = opts;
236462
236442
  if (lowS == null)
236463
236443
  lowS = true;
@@ -236469,21 +236449,21 @@ function ecdsa(Point, ecdsaOpts, curveOpts = {}) {
236469
236449
  const d6 = normPrivateKeyToScalar(privateKey);
236470
236450
  const seedArgs = [int2octets(d6), int2octets(h1int)];
236471
236451
  if (ent != null && ent !== false) {
236472
- const e10 = ent === true ? randomBytes_(Fp.BYTES) : ent;
236452
+ const e10 = ent === true ? randomBytes2(Fp.BYTES) : ent;
236473
236453
  seedArgs.push(ensureBytes("extraEntropy", e10));
236474
236454
  }
236475
- const seed = concatBytes(...seedArgs);
236455
+ const seed = concatBytes3(...seedArgs);
236476
236456
  const m7 = h1int;
236477
236457
  function k2sig(kBytes) {
236478
236458
  const k5 = bits2int(kBytes);
236479
- if (!Fn.isValidNot0(k5))
236459
+ if (!isWithinCurveOrder(k5))
236480
236460
  return;
236481
- const ik = Fn.inv(k5);
236461
+ const ik = invN(k5);
236482
236462
  const q6 = Point.BASE.multiply(k5).toAffine();
236483
- const r6 = Fn.create(q6.x);
236463
+ const r6 = modN(q6.x);
236484
236464
  if (r6 === _0n5)
236485
236465
  return;
236486
- const s7 = Fn.create(ik * Fn.create(m7 + r6 * d6));
236466
+ const s7 = modN(ik * modN(m7 + r6 * d6));
236487
236467
  if (s7 === _0n5)
236488
236468
  return;
236489
236469
  let recovery = (q6.x === r6 ? 0 : 2) | Number(q6.y & _1n5);
@@ -236496,38 +236476,34 @@ function ecdsa(Point, ecdsaOpts, curveOpts = {}) {
236496
236476
  }
236497
236477
  return { seed, k2sig };
236498
236478
  }
236499
- const defaultSigOpts = { lowS: ecdsaOpts.lowS, prehash: false };
236500
- const defaultVerOpts = { lowS: ecdsaOpts.lowS, prehash: false };
236479
+ const defaultSigOpts = { lowS: CURVE.lowS, prehash: false };
236480
+ const defaultVerOpts = { lowS: CURVE.lowS, prehash: false };
236501
236481
  function sign(msgHash, privKey, opts = defaultSigOpts) {
236502
236482
  const { seed, k2sig } = prepSig(msgHash, privKey, opts);
236503
- const drbg = createHmacDrbg(ecdsaOpts.hash.outputLen, Fn.BYTES, hmac_);
236483
+ const C4 = CURVE;
236484
+ const drbg = createHmacDrbg(C4.hash.outputLen, C4.nByteLength, C4.hmac);
236504
236485
  return drbg(seed, k2sig);
236505
236486
  }
236506
- Point.BASE.precompute(8);
236487
+ Point.BASE._setWindowSize(8);
236507
236488
  function verify(signature, msgHash, publicKey, opts = defaultVerOpts) {
236508
236489
  const sg = signature;
236509
236490
  msgHash = ensureBytes("msgHash", msgHash);
236510
236491
  publicKey = ensureBytes("publicKey", publicKey);
236511
- validateSigVerOpts(opts);
236512
236492
  const { lowS, prehash, format: format2 } = opts;
236493
+ validateSigVerOpts(opts);
236513
236494
  if ("strict" in opts)
236514
236495
  throw new Error("options.strict was renamed to lowS");
236515
- if (format2 !== undefined && !["compact", "der", "js"].includes(format2))
236516
- throw new Error('format must be "compact", "der" or "js"');
236517
- const isHex2 = typeof sg === "string" || isBytes(sg);
236496
+ if (format2 !== undefined && format2 !== "compact" && format2 !== "der")
236497
+ throw new Error("format must be compact or der");
236498
+ const isHex2 = typeof sg === "string" || isBytes2(sg);
236518
236499
  const isObj = !isHex2 && !format2 && typeof sg === "object" && sg !== null && typeof sg.r === "bigint" && typeof sg.s === "bigint";
236519
236500
  if (!isHex2 && !isObj)
236520
236501
  throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");
236521
236502
  let _sig = undefined;
236522
236503
  let P5;
236523
236504
  try {
236524
- if (isObj) {
236525
- if (format2 === undefined || format2 === "js") {
236526
- _sig = new Signature(sg.r, sg.s);
236527
- } else {
236528
- throw new Error("invalid format");
236529
- }
236530
- }
236505
+ if (isObj)
236506
+ _sig = new Signature(sg.r, sg.s);
236531
236507
  if (isHex2) {
236532
236508
  try {
236533
236509
  if (format2 !== "compact")
@@ -236548,77 +236524,28 @@ function ecdsa(Point, ecdsaOpts, curveOpts = {}) {
236548
236524
  if (lowS && _sig.hasHighS())
236549
236525
  return false;
236550
236526
  if (prehash)
236551
- msgHash = ecdsaOpts.hash(msgHash);
236527
+ msgHash = CURVE.hash(msgHash);
236552
236528
  const { r: r6, s: s7 } = _sig;
236553
236529
  const h8 = bits2int_modN(msgHash);
236554
- const is = Fn.inv(s7);
236555
- const u1 = Fn.create(h8 * is);
236556
- const u22 = Fn.create(r6 * is);
236557
- const R7 = Point.BASE.multiplyUnsafe(u1).add(P5.multiplyUnsafe(u22));
236558
- if (R7.is0())
236530
+ const is = invN(s7);
236531
+ const u1 = modN(h8 * is);
236532
+ const u22 = modN(r6 * is);
236533
+ const R7 = Point.BASE.multiplyAndAddUnsafe(P5, u1, u22)?.toAffine();
236534
+ if (!R7)
236559
236535
  return false;
236560
- const v6 = Fn.create(R7.x);
236536
+ const v6 = modN(R7.x);
236561
236537
  return v6 === r6;
236562
236538
  }
236563
- return Object.freeze({
236539
+ return {
236540
+ CURVE,
236564
236541
  getPublicKey,
236565
236542
  getSharedSecret,
236566
236543
  sign,
236567
236544
  verify,
236568
- utils,
236569
- Point,
236570
- Signature
236571
- });
236572
- }
236573
- function _weierstrass_legacy_opts_to_new(c3) {
236574
- const CURVE = {
236575
- a: c3.a,
236576
- b: c3.b,
236577
- p: c3.Fp.ORDER,
236578
- n: c3.n,
236579
- h: c3.h,
236580
- Gx: c3.Gx,
236581
- Gy: c3.Gy
236582
- };
236583
- const Fp = c3.Fp;
236584
- const Fn = Field(CURVE.n, c3.nBitLength);
236585
- const curveOpts = {
236586
- Fp,
236587
- Fn,
236588
- allowedPrivateKeyLengths: c3.allowedPrivateKeyLengths,
236589
- allowInfinityPoint: c3.allowInfinityPoint,
236590
- endo: c3.endo,
236591
- wrapPrivateKey: c3.wrapPrivateKey,
236592
- isTorsionFree: c3.isTorsionFree,
236593
- clearCofactor: c3.clearCofactor,
236594
- fromBytes: c3.fromBytes,
236595
- toBytes: c3.toBytes
236596
- };
236597
- return { CURVE, curveOpts };
236598
- }
236599
- function _ecdsa_legacy_opts_to_new(c3) {
236600
- const { CURVE, curveOpts } = _weierstrass_legacy_opts_to_new(c3);
236601
- const ecdsaOpts = {
236602
- hash: c3.hash,
236603
- hmac: c3.hmac,
236604
- randomBytes: c3.randomBytes,
236605
- lowS: c3.lowS,
236606
- bits2int: c3.bits2int,
236607
- bits2int_modN: c3.bits2int_modN
236608
- };
236609
- return { CURVE, curveOpts, ecdsaOpts };
236610
- }
236611
- function _ecdsa_new_output_to_legacy(c3, ecdsa2) {
236612
- return Object.assign({}, ecdsa2, {
236613
- ProjectivePoint: ecdsa2.Point,
236614
- CURVE: c3
236615
- });
236616
- }
236617
- function weierstrass(c3) {
236618
- const { CURVE, curveOpts, ecdsaOpts } = _ecdsa_legacy_opts_to_new(c3);
236619
- const Point = weierstrassN(CURVE, curveOpts);
236620
- const signs = ecdsa(Point, ecdsaOpts, curveOpts);
236621
- return _ecdsa_new_output_to_legacy(c3, signs);
236545
+ ProjectivePoint: Point,
236546
+ Signature,
236547
+ utils
236548
+ };
236622
236549
  }
236623
236550
  function SWUFpSqrtRatio(Fp, Z4) {
236624
236551
  const q6 = Fp.ORDER;
@@ -236684,29 +236611,28 @@ function SWUFpSqrtRatio(Fp, Z4) {
236684
236611
  }
236685
236612
  function mapToCurveSimpleSWU(Fp, opts) {
236686
236613
  validateField(Fp);
236687
- const { A: A5, B: B4, Z: Z4 } = opts;
236688
- if (!Fp.isValid(A5) || !Fp.isValid(B4) || !Fp.isValid(Z4))
236614
+ if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z))
236689
236615
  throw new Error("mapToCurveSimpleSWU: invalid opts");
236690
- const sqrtRatio = SWUFpSqrtRatio(Fp, Z4);
236616
+ const sqrtRatio = SWUFpSqrtRatio(Fp, opts.Z);
236691
236617
  if (!Fp.isOdd)
236692
- throw new Error("Field does not have .isOdd()");
236618
+ throw new Error("Fp.isOdd is not implemented!");
236693
236619
  return (u6) => {
236694
236620
  let tv1, tv2, tv3, tv4, tv5, tv6, x6, y4;
236695
236621
  tv1 = Fp.sqr(u6);
236696
- tv1 = Fp.mul(tv1, Z4);
236622
+ tv1 = Fp.mul(tv1, opts.Z);
236697
236623
  tv2 = Fp.sqr(tv1);
236698
236624
  tv2 = Fp.add(tv2, tv1);
236699
236625
  tv3 = Fp.add(tv2, Fp.ONE);
236700
- tv3 = Fp.mul(tv3, B4);
236701
- tv4 = Fp.cmov(Z4, Fp.neg(tv2), !Fp.eql(tv2, Fp.ZERO));
236702
- tv4 = Fp.mul(tv4, A5);
236626
+ tv3 = Fp.mul(tv3, opts.B);
236627
+ tv4 = Fp.cmov(opts.Z, Fp.neg(tv2), !Fp.eql(tv2, Fp.ZERO));
236628
+ tv4 = Fp.mul(tv4, opts.A);
236703
236629
  tv2 = Fp.sqr(tv3);
236704
236630
  tv6 = Fp.sqr(tv4);
236705
- tv5 = Fp.mul(tv6, A5);
236631
+ tv5 = Fp.mul(tv6, opts.A);
236706
236632
  tv2 = Fp.add(tv2, tv5);
236707
236633
  tv2 = Fp.mul(tv2, tv3);
236708
236634
  tv6 = Fp.mul(tv6, tv4);
236709
- tv5 = Fp.mul(tv6, B4);
236635
+ tv5 = Fp.mul(tv6, opts.B);
236710
236636
  tv2 = Fp.add(tv2, tv5);
236711
236637
  x6 = Fp.mul(tv1, tv3);
236712
236638
  const { isValid, value: value4 } = sqrtRatio(tv2, tv6);
@@ -236723,10 +236649,9 @@ function mapToCurveSimpleSWU(Fp, opts) {
236723
236649
  }
236724
236650
  var DERErr, DER, _0n5, _1n5, _2n3, _3n2, _4n2;
236725
236651
  var init_weierstrass = __esm(() => {
236726
- init_hmac();
236727
- init_utils3();
236728
236652
  init_curve();
236729
236653
  init_modular();
236654
+ init_utils3();
236730
236655
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
236731
236656
  DERErr = class DERErr extends Error {
236732
236657
  constructor(m7 = "") {
@@ -236834,11 +236759,20 @@ var init_weierstrass = __esm(() => {
236834
236759
  });
236835
236760
 
236836
236761
  // ../../node_modules/@noble/curves/esm/_shortw_utils.js
236762
+ function getHash(hash2) {
236763
+ return {
236764
+ hash: hash2,
236765
+ hmac: (key2, ...msgs) => hmac(hash2, key2, concatBytes(...msgs)),
236766
+ randomBytes
236767
+ };
236768
+ }
236837
236769
  function createCurve(curveDef, defHash) {
236838
- const create2 = (hash2) => weierstrass({ ...curveDef, hash: hash2 });
236770
+ const create2 = (hash2) => weierstrass({ ...curveDef, ...getHash(hash2) });
236839
236771
  return { ...create2(defHash), create: create2 };
236840
236772
  }
236841
236773
  var init__shortw_utils = __esm(() => {
236774
+ init_hmac();
236775
+ init_utils2();
236842
236776
  init_weierstrass();
236843
236777
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
236844
236778
  });
@@ -236868,55 +236802,52 @@ function anum(item) {
236868
236802
  throw new Error("number expected");
236869
236803
  }
236870
236804
  function expand_message_xmd(msg, DST, lenInBytes, H4) {
236871
- abytes(msg);
236872
- abytes(DST);
236805
+ abytes2(msg);
236806
+ abytes2(DST);
236873
236807
  anum(lenInBytes);
236874
236808
  if (DST.length > 255)
236875
- DST = H4(concatBytes(utf8ToBytes("H2C-OVERSIZE-DST-"), DST));
236809
+ DST = H4(concatBytes3(utf8ToBytes2("H2C-OVERSIZE-DST-"), DST));
236876
236810
  const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H4;
236877
236811
  const ell = Math.ceil(lenInBytes / b_in_bytes);
236878
236812
  if (lenInBytes > 65535 || ell > 255)
236879
236813
  throw new Error("expand_message_xmd: invalid lenInBytes");
236880
- const DST_prime = concatBytes(DST, i2osp(DST.length, 1));
236814
+ const DST_prime = concatBytes3(DST, i2osp(DST.length, 1));
236881
236815
  const Z_pad = i2osp(0, r_in_bytes);
236882
236816
  const l_i_b_str = i2osp(lenInBytes, 2);
236883
236817
  const b4 = new Array(ell);
236884
- const b_0 = H4(concatBytes(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime));
236885
- b4[0] = H4(concatBytes(b_0, i2osp(1, 1), DST_prime));
236818
+ const b_0 = H4(concatBytes3(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime));
236819
+ b4[0] = H4(concatBytes3(b_0, i2osp(1, 1), DST_prime));
236886
236820
  for (let i6 = 1;i6 <= ell; i6++) {
236887
236821
  const args = [strxor(b_0, b4[i6 - 1]), i2osp(i6 + 1, 1), DST_prime];
236888
- b4[i6] = H4(concatBytes(...args));
236822
+ b4[i6] = H4(concatBytes3(...args));
236889
236823
  }
236890
- const pseudo_random_bytes = concatBytes(...b4);
236824
+ const pseudo_random_bytes = concatBytes3(...b4);
236891
236825
  return pseudo_random_bytes.slice(0, lenInBytes);
236892
236826
  }
236893
236827
  function expand_message_xof(msg, DST, lenInBytes, k5, H4) {
236894
- abytes(msg);
236895
- abytes(DST);
236828
+ abytes2(msg);
236829
+ abytes2(DST);
236896
236830
  anum(lenInBytes);
236897
236831
  if (DST.length > 255) {
236898
236832
  const dkLen = Math.ceil(2 * k5 / 8);
236899
- DST = H4.create({ dkLen }).update(utf8ToBytes("H2C-OVERSIZE-DST-")).update(DST).digest();
236833
+ DST = H4.create({ dkLen }).update(utf8ToBytes2("H2C-OVERSIZE-DST-")).update(DST).digest();
236900
236834
  }
236901
236835
  if (lenInBytes > 65535 || DST.length > 255)
236902
236836
  throw new Error("expand_message_xof: invalid lenInBytes");
236903
236837
  return H4.create({ dkLen: lenInBytes }).update(msg).update(i2osp(lenInBytes, 2)).update(DST).update(i2osp(DST.length, 1)).digest();
236904
236838
  }
236905
236839
  function hash_to_field(msg, count, options) {
236906
- _validateObject(options, {
236840
+ validateObject(options, {
236841
+ DST: "stringOrUint8Array",
236907
236842
  p: "bigint",
236908
- m: "number",
236909
- k: "number",
236910
- hash: "function"
236843
+ m: "isSafeInteger",
236844
+ k: "isSafeInteger",
236845
+ hash: "hash"
236911
236846
  });
236912
236847
  const { p: p5, k: k5, m: m7, hash: hash2, expand, DST: _DST } = options;
236913
- if (!isBytes(_DST) && typeof _DST !== "string")
236914
- throw new Error("DST must be string or uint8array");
236915
- if (!isHash(options.hash))
236916
- throw new Error("expected valid hash");
236917
- abytes(msg);
236848
+ abytes2(msg);
236918
236849
  anum(count);
236919
- const DST = typeof _DST === "string" ? utf8ToBytes(_DST) : _DST;
236850
+ const DST = typeof _DST === "string" ? utf8ToBytes2(_DST) : _DST;
236920
236851
  const log2p = p5.toString(2).length;
236921
236852
  const L5 = Math.ceil((log2p + k5) / 8);
236922
236853
  const len_in_bytes = count * m7 * L5;
@@ -236968,17 +236899,13 @@ function createHasher2(Point, mapToCurve, defaults4) {
236968
236899
  return {
236969
236900
  defaults: defaults4,
236970
236901
  hashToCurve(msg, options) {
236971
- const dst = defaults4.DST ? defaults4.DST : {};
236972
- const opts = Object.assign({}, defaults4, dst, options);
236973
- const u6 = hash_to_field(msg, 2, opts);
236902
+ const u6 = hash_to_field(msg, 2, { ...defaults4, DST: defaults4.DST, ...options });
236974
236903
  const u0 = map6(u6[0]);
236975
236904
  const u1 = map6(u6[1]);
236976
236905
  return clear(u0.add(u1));
236977
236906
  },
236978
236907
  encodeToCurve(msg, options) {
236979
- const dst = defaults4.encodeDST ? defaults4.encodeDST : {};
236980
- const opts = Object.assign({}, defaults4, dst, options);
236981
- const u6 = hash_to_field(msg, 1, opts);
236908
+ const u6 = hash_to_field(msg, 1, { ...defaults4, DST: defaults4.encodeDST, ...options });
236982
236909
  return clear(map6(u6[0]));
236983
236910
  },
236984
236911
  mapToCurve(scalars) {
@@ -236993,8 +236920,8 @@ function createHasher2(Point, mapToCurve, defaults4) {
236993
236920
  }
236994
236921
  var os2ip;
236995
236922
  var init_hash_to_curve = __esm(() => {
236996
- init_utils3();
236997
236923
  init_modular();
236924
+ init_utils3();
236998
236925
  os2ip = bytesToNumberBE;
236999
236926
  });
237000
236927
 
@@ -237008,7 +236935,7 @@ __export(exports_secp256k1, {
237008
236935
  encodeToCurve: () => encodeToCurve
237009
236936
  });
237010
236937
  function sqrtMod(y4) {
237011
- const P5 = secp256k1_CURVE.p;
236938
+ const P5 = secp256k1P;
237012
236939
  const _3n3 = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);
237013
236940
  const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88);
237014
236941
  const b22 = y4 * y4 * y4 % P5;
@@ -237033,25 +236960,25 @@ function taggedHash(tag, ...messages) {
237033
236960
  let tagP = TAGGED_HASH_PREFIXES[tag];
237034
236961
  if (tagP === undefined) {
237035
236962
  const tagH = sha256(Uint8Array.from(tag, (c3) => c3.charCodeAt(0)));
237036
- tagP = concatBytes(tagH, tagH);
236963
+ tagP = concatBytes3(tagH, tagH);
237037
236964
  TAGGED_HASH_PREFIXES[tag] = tagP;
237038
236965
  }
237039
- return sha256(concatBytes(tagP, ...messages));
236966
+ return sha256(concatBytes3(tagP, ...messages));
237040
236967
  }
237041
236968
  function schnorrGetExtPubKey(priv) {
237042
236969
  let d_ = secp256k1.utils.normPrivateKeyToScalar(priv);
237043
236970
  let p5 = Point.fromPrivateKey(d_);
237044
- const scalar = hasEven(p5.y) ? d_ : modN(-d_);
236971
+ const scalar = p5.hasEvenY() ? d_ : modN(-d_);
237045
236972
  return { scalar, bytes: pointToBytes(p5) };
237046
236973
  }
237047
236974
  function lift_x(x6) {
237048
- aInRange("x", x6, _1n6, secp256k1_CURVE.p);
236975
+ aInRange("x", x6, _1n6, secp256k1P);
237049
236976
  const xx = modP(x6 * x6);
237050
236977
  const c3 = modP(xx * x6 + BigInt(7));
237051
236978
  let y4 = sqrtMod(c3);
237052
- if (!hasEven(y4))
236979
+ if (y4 % _2n4 !== _0n6)
237053
236980
  y4 = modP(-y4);
237054
- const p5 = Point.fromAffine({ x: x6, y: y4 });
236981
+ const p5 = new Point(x6, y4, _1n6);
237055
236982
  p5.assertValidity();
237056
236983
  return p5;
237057
236984
  }
@@ -237086,52 +237013,49 @@ function schnorrVerify(signature, message, publicKey) {
237086
237013
  try {
237087
237014
  const P5 = lift_x(num(pub));
237088
237015
  const r6 = num(sig.subarray(0, 32));
237089
- if (!inRange(r6, _1n6, secp256k1_CURVE.p))
237016
+ if (!inRange(r6, _1n6, secp256k1P))
237090
237017
  return false;
237091
237018
  const s7 = num(sig.subarray(32, 64));
237092
- if (!inRange(s7, _1n6, secp256k1_CURVE.n))
237019
+ if (!inRange(s7, _1n6, secp256k1N))
237093
237020
  return false;
237094
237021
  const e10 = challenge(numTo32b(r6), pointToBytes(P5), m7);
237095
- const R7 = Point.BASE.multiplyUnsafe(s7).add(P5.multiplyUnsafe(modN(-e10)));
237096
- const { x: x6, y: y4 } = R7.toAffine();
237097
- if (R7.is0() || !hasEven(y4) || x6 !== r6)
237022
+ const R7 = GmulAdd(P5, s7, modN(-e10));
237023
+ if (!R7 || !R7.hasEvenY() || R7.toAffine().x !== r6)
237098
237024
  return false;
237099
237025
  return true;
237100
237026
  } catch (error44) {
237101
237027
  return false;
237102
237028
  }
237103
237029
  }
237104
- var secp256k1_CURVE, _0n6, _1n6, _2n4, divNearest = (a7, b4) => (a7 + b4 / _2n4) / b4, Fpk1, secp256k1, TAGGED_HASH_PREFIXES, pointToBytes = (point) => point.toBytes(true).slice(1), numTo32b = (n6) => numberToBytesBE(n6, 32), modP = (x6) => mod(x6, secp256k1_CURVE.p), modN = (x6) => mod(x6, secp256k1_CURVE.n), Point, hasEven = (y4) => y4 % _2n4 === _0n6, num, schnorr, isoMap, mapSWU, secp256k1_hasher, hashToCurve, encodeToCurve;
237030
+ var secp256k1P, secp256k1N, _0n6, _1n6, _2n4, divNearest = (a7, b4) => (a7 + b4 / _2n4) / b4, Fpk1, secp256k1, TAGGED_HASH_PREFIXES, pointToBytes = (point) => point.toRawBytes(true).slice(1), numTo32b = (n6) => numberToBytesBE(n6, 32), modP = (x6) => mod(x6, secp256k1P), modN = (x6) => mod(x6, secp256k1N), Point, GmulAdd = (Q4, a7, b4) => Point.BASE.multiplyAndAddUnsafe(Q4, a7, b4), num, schnorr, isoMap, mapSWU, secp256k1_hasher, hashToCurve, encodeToCurve;
237105
237031
  var init_secp256k1 = __esm(() => {
237106
237032
  init_sha2();
237107
237033
  init_utils2();
237108
237034
  init__shortw_utils();
237109
237035
  init_hash_to_curve();
237110
237036
  init_modular();
237111
- init_weierstrass();
237112
237037
  init_utils3();
237038
+ init_weierstrass();
237113
237039
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
237114
- secp256k1_CURVE = {
237115
- p: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),
237116
- n: BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),
237117
- h: BigInt(1),
237118
- a: BigInt(0),
237119
- b: BigInt(7),
237120
- Gx: BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
237121
- Gy: BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")
237122
- };
237040
+ secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
237041
+ secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
237123
237042
  _0n6 = BigInt(0);
237124
237043
  _1n6 = BigInt(1);
237125
237044
  _2n4 = BigInt(2);
237126
- Fpk1 = Field(secp256k1_CURVE.p, undefined, undefined, { sqrt: sqrtMod });
237045
+ Fpk1 = Field(secp256k1P, undefined, undefined, { sqrt: sqrtMod });
237127
237046
  secp256k1 = createCurve({
237128
- ...secp256k1_CURVE,
237047
+ a: _0n6,
237048
+ b: BigInt(7),
237129
237049
  Fp: Fpk1,
237050
+ n: secp256k1N,
237051
+ Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),
237052
+ Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),
237053
+ h: BigInt(1),
237130
237054
  lowS: true,
237131
237055
  endo: {
237132
237056
  beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
237133
237057
  splitScalar: (k5) => {
237134
- const n6 = secp256k1_CURVE.n;
237058
+ const n6 = secp256k1N;
237135
237059
  const a1 = BigInt("0x3086d221a7d46bcde86c90e49284eb15");
237136
237060
  const b1 = -_1n6 * BigInt("0xe4437ed6010e88286f547fa90abfe4c3");
237137
237061
  const a22 = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8");
@@ -237155,7 +237079,7 @@ var init_secp256k1 = __esm(() => {
237155
237079
  }
237156
237080
  }, sha256);
237157
237081
  TAGGED_HASH_PREFIXES = {};
237158
- Point = /* @__PURE__ */ (() => secp256k1.Point)();
237082
+ Point = /* @__PURE__ */ (() => secp256k1.ProjectivePoint)();
237159
237083
  num = bytesToNumberBE;
237160
237084
  schnorr = /* @__PURE__ */ (() => ({
237161
237085
  getPublicKey: schnorrGetPublicKey,
@@ -237201,7 +237125,7 @@ var init_secp256k1 = __esm(() => {
237201
237125
  B: BigInt("1771"),
237202
237126
  Z: Fpk1.create(BigInt("-11"))
237203
237127
  }))();
237204
- secp256k1_hasher = /* @__PURE__ */ (() => createHasher2(secp256k1.Point, (scalars) => {
237128
+ secp256k1_hasher = /* @__PURE__ */ (() => createHasher2(secp256k1.ProjectivePoint, (scalars) => {
237205
237129
  const { x: x6, y: y4 } = mapSWU(Fpk1.create(scalars[0]));
237206
237130
  return isoMap(x6, y4);
237207
237131
  }, {
@@ -238855,7 +238779,7 @@ async function localBatchGatewayRequest(parameters) {
238855
238779
  const responses = [];
238856
238780
  await Promise.all(queries.map(async (query, i6) => {
238857
238781
  try {
238858
- responses[i6] = query.urls.includes(localBatchGatewayUrl) ? await localBatchGatewayRequest({ data: query.data, ccipRequest }) : await ccipRequest(query);
238782
+ responses[i6] = await ccipRequest(query);
238859
238783
  failures[i6] = false;
238860
238784
  } catch (err) {
238861
238785
  failures[i6] = true;
@@ -258129,9 +258053,9 @@ ${formattedErrors}`);
258129
258053
  throw error$37;
258130
258054
  }
258131
258055
  }
258132
- var ApplicationAccessTokenSchema = string$1().regex(/^sm_aat_.+$/);
258133
- var PersonalAccessTokenSchema = string$1().regex(/^sm_pat_.+$/);
258134
- var AccessTokenSchema = string$1().regex(/^(sm_pat_.+|sm_aat_.+)$/);
258056
+ var ApplicationAccessTokenSchema = string$1().regex(/^sm_aat_.*$/);
258057
+ var PersonalAccessTokenSchema = string$1().regex(/^sm_pat_.*$/);
258058
+ var AccessTokenSchema = string$1().regex(/^sm_pat_.*|sm_aat_.*$/);
258135
258059
  function tryParseJson(value, defaultValue = null) {
258136
258060
  try {
258137
258061
  const parsed = JSON.parse(value);
@@ -258139,7 +258063,7 @@ function tryParseJson(value, defaultValue = null) {
258139
258063
  return defaultValue;
258140
258064
  }
258141
258065
  return parsed;
258142
- } catch (_err) {
258066
+ } catch (err) {
258143
258067
  return defaultValue;
258144
258068
  }
258145
258069
  }
@@ -263769,7 +263693,7 @@ async function findMonoRepoPackages(projectDir) {
263769
263693
  }));
263770
263694
  const allPaths = packagePaths.flat();
263771
263695
  return allPaths.length === 0 ? [projectDir] : [monoRepoRoot, ...allPaths];
263772
- } catch (_error) {
263696
+ } catch (error$37) {
263773
263697
  return [projectDir];
263774
263698
  }
263775
263699
  }
@@ -263840,7 +263764,7 @@ function pruneCurrentEnv(currentEnv, env2) {
263840
263764
  var package_default = {
263841
263765
  name: "@settlemint/sdk-cli",
263842
263766
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
263843
- version: "2.4.0-pr88ac0d7d",
263767
+ version: "2.4.0-pra6821f69",
263844
263768
  type: "module",
263845
263769
  private: false,
263846
263770
  license: "FSL-1.1-MIT",
@@ -263859,9 +263783,7 @@ var package_default = {
263859
263783
  url: "https://github.com/settlemint/sdk/issues",
263860
263784
  email: "support@settlemint.com"
263861
263785
  },
263862
- files: [
263863
- "dist"
263864
- ],
263786
+ files: ["dist"],
263865
263787
  exports: {
263866
263788
  "./*": {
263867
263789
  types: "./dist/*.d.ts",
@@ -263891,10 +263813,10 @@ var package_default = {
263891
263813
  "@inquirer/input": "4.1.12",
263892
263814
  "@inquirer/password": "4.0.15",
263893
263815
  "@inquirer/select": "4.2.3",
263894
- "@settlemint/sdk-js": "2.4.0-pr88ac0d7d",
263895
- "@settlemint/sdk-utils": "2.4.0-pr88ac0d7d",
263896
- "@settlemint/sdk-viem": "2.4.0-pr88ac0d7d",
263897
- "@types/node": "24.0.10",
263816
+ "@settlemint/sdk-js": "2.4.0-pra6821f69",
263817
+ "@settlemint/sdk-utils": "2.4.0-pra6821f69",
263818
+ "@settlemint/sdk-viem": "2.4.0-pra6821f69",
263819
+ "@types/node": "24.0.1",
263898
263820
  "@types/semver": "7.7.0",
263899
263821
  "@types/which": "3.0.4",
263900
263822
  "get-tsconfig": "4.10.1",
@@ -263902,13 +263824,13 @@ var package_default = {
263902
263824
  "is-in-ci": "1.0.0",
263903
263825
  semver: "7.7.2",
263904
263826
  slugify: "1.6.6",
263905
- viem: "2.31.6",
263827
+ viem: "2.31.1",
263906
263828
  which: "5.0.0",
263907
263829
  yaml: "2.8.0",
263908
263830
  yoctocolors: "2.1.1"
263909
263831
  },
263910
263832
  peerDependencies: {
263911
- hardhat: "2.25.0"
263833
+ hardhat: "2.24.3"
263912
263834
  },
263913
263835
  peerDependenciesMeta: {
263914
263836
  hardhat: {
@@ -263963,7 +263885,7 @@ async function telemetry(data) {
263963
263885
  signal: controller.signal
263964
263886
  });
263965
263887
  clearTimeout(timeout);
263966
- } catch (_error) {}
263888
+ } catch (error2) {}
263967
263889
  }
263968
263890
 
263969
263891
  // ../../node_modules/@commander-js/extra-typings/esm.mjs
@@ -276515,9 +276437,9 @@ ${formattedErrors}`);
276515
276437
  throw error$372;
276516
276438
  }
276517
276439
  }
276518
- var ApplicationAccessTokenSchema2 = string$12().regex(/^sm_aat_.+$/);
276519
- var PersonalAccessTokenSchema2 = string$12().regex(/^sm_pat_.+$/);
276520
- var AccessTokenSchema2 = string$12().regex(/^(sm_pat_.+|sm_aat_.+)$/);
276440
+ var ApplicationAccessTokenSchema2 = string$12().regex(/^sm_aat_.*$/);
276441
+ var PersonalAccessTokenSchema2 = string$12().regex(/^sm_pat_.*$/);
276442
+ var AccessTokenSchema2 = string$12().regex(/^sm_pat_.*|sm_aat_.*$/);
276521
276443
  function tryParseJson2(value, defaultValue = null) {
276522
276444
  try {
276523
276445
  const parsed = JSON.parse(value);
@@ -276525,7 +276447,7 @@ function tryParseJson2(value, defaultValue = null) {
276525
276447
  return defaultValue;
276526
276448
  }
276527
276449
  return parsed;
276528
- } catch (_err) {
276450
+ } catch (err) {
276529
276451
  return defaultValue;
276530
276452
  }
276531
276453
  }
@@ -288291,20 +288213,6 @@ var restartBlockchainNetwork = graphql(`
288291
288213
  }
288292
288214
  }
288293
288215
  `, [BlockchainNetworkFragment]);
288294
- var pauseBlockchainNetwork = graphql(`
288295
- mutation PauseBlockchainNetwork($uniqueName: String!) {
288296
- pauseBlockchainNetworkByUniqueName(uniqueName: $uniqueName) {
288297
- ...BlockchainNetwork
288298
- }
288299
- }
288300
- `, [BlockchainNetworkFragment]);
288301
- var resumeBlockchainNetwork = graphql(`
288302
- mutation ResumeBlockchainNetwork($uniqueName: String!) {
288303
- resumeBlockchainNetworkByUniqueName(uniqueName: $uniqueName) {
288304
- ...BlockchainNetwork
288305
- }
288306
- }
288307
- `, [BlockchainNetworkFragment]);
288308
288216
  var blockchainNetworkList = (gqlClient) => {
288309
288217
  return async (applicationUniqueName) => {
288310
288218
  const { blockchainNetworksByUniqueName: { items } } = await gqlClient.request(getBlockchainNetworks, { applicationUniqueName });
@@ -288339,14 +288247,6 @@ var blockchainNetworkRestart = (gqlClient) => async (blockchainNetworkUniqueName
288339
288247
  const { restartBlockchainNetworkByUniqueName: blockchainNetwork } = await gqlClient.request(restartBlockchainNetwork, { uniqueName: blockchainNetworkUniqueName });
288340
288248
  return blockchainNetwork;
288341
288249
  };
288342
- var blockchainNetworkPause = (gqlClient) => async (blockchainNetworkUniqueName) => {
288343
- const { pauseBlockchainNetworkByUniqueName: blockchainNetwork } = await gqlClient.request(pauseBlockchainNetwork, { uniqueName: blockchainNetworkUniqueName });
288344
- return blockchainNetwork;
288345
- };
288346
- var blockchainNetworkResume = (gqlClient) => async (blockchainNetworkUniqueName) => {
288347
- const { resumeBlockchainNetworkByUniqueName: blockchainNetwork } = await gqlClient.request(resumeBlockchainNetwork, { uniqueName: blockchainNetworkUniqueName });
288348
- return blockchainNetwork;
288349
- };
288350
288250
  var BlockchainNodeFragment = graphql(`
288351
288251
  fragment BlockchainNode on BlockchainNode {
288352
288252
  __typename
@@ -288480,20 +288380,6 @@ var restartBlockchainNode = graphql(`
288480
288380
  }
288481
288381
  }
288482
288382
  `, [BlockchainNodeFragment]);
288483
- var pauseBlockchainNode = graphql(`
288484
- mutation PauseBlockchainNode($uniqueName: String!) {
288485
- pauseBlockchainNodeByUniqueName(uniqueName: $uniqueName) {
288486
- ...BlockchainNode
288487
- }
288488
- }
288489
- `, [BlockchainNodeFragment]);
288490
- var resumeBlockchainNode = graphql(`
288491
- mutation ResumeBlockchainNode($uniqueName: String!) {
288492
- resumeBlockchainNodeByUniqueName(uniqueName: $uniqueName) {
288493
- ...BlockchainNode
288494
- }
288495
- }
288496
- `, [BlockchainNodeFragment]);
288497
288383
  var blockchainNodeList = (gqlClient) => {
288498
288384
  return async (applicationUniqueName) => {
288499
288385
  const { blockchainNodesByUniqueName: { items } } = await gqlClient.request(getBlockchainNodes, { applicationUniqueName });
@@ -288522,14 +288408,6 @@ var blockchainNodeRestart = (gqlClient) => async (blockchainNodeUniqueName) => {
288522
288408
  const { restartBlockchainNodeByUniqueName: blockchainNode } = await gqlClient.request(restartBlockchainNode, { uniqueName: blockchainNodeUniqueName });
288523
288409
  return blockchainNode;
288524
288410
  };
288525
- var blockchainNodePause = (gqlClient) => async (blockchainNodeUniqueName) => {
288526
- const { pauseBlockchainNodeByUniqueName: blockchainNode } = await gqlClient.request(pauseBlockchainNode, { uniqueName: blockchainNodeUniqueName });
288527
- return blockchainNode;
288528
- };
288529
- var blockchainNodeResume = (gqlClient) => async (blockchainNodeUniqueName) => {
288530
- const { resumeBlockchainNodeByUniqueName: blockchainNode } = await gqlClient.request(resumeBlockchainNode, { uniqueName: blockchainNodeUniqueName });
288531
- return blockchainNode;
288532
- };
288533
288411
  var CustomDeploymentFragment = graphql(`
288534
288412
  fragment CustomDeployment on CustomDeployment {
288535
288413
  id
@@ -288612,20 +288490,6 @@ var restartCustomDeployment = graphql(`
288612
288490
  }
288613
288491
  }
288614
288492
  `, [CustomDeploymentFragment]);
288615
- var pauseCustomDeployment = graphql(`
288616
- mutation PauseCustomDeployment($uniqueName: String!) {
288617
- pauseCustomDeploymentByUniqueName(uniqueName: $uniqueName) {
288618
- ...CustomDeployment
288619
- }
288620
- }
288621
- `, [CustomDeploymentFragment]);
288622
- var resumeCustomDeployment = graphql(`
288623
- mutation ResumeCustomDeployment($uniqueName: String!) {
288624
- resumeCustomDeploymentByUniqueName(uniqueName: $uniqueName) {
288625
- ...CustomDeployment
288626
- }
288627
- }
288628
- `, [CustomDeploymentFragment]);
288629
288493
  var customdeploymentList = (gqlClient) => {
288630
288494
  return async (applicationUniqueName) => {
288631
288495
  const { customDeploymentsByUniqueName: { items } } = await gqlClient.request(getCustomDeployments, { applicationUniqueName });
@@ -288662,14 +288526,6 @@ var customDeploymentRestart = (gqlClient) => async (customDeploymentUniqueName)
288662
288526
  const { restartCustomDeploymentByUniqueName: customDeployment } = await gqlClient.request(restartCustomDeployment, { uniqueName: customDeploymentUniqueName });
288663
288527
  return customDeployment;
288664
288528
  };
288665
- var customDeploymentPause = (gqlClient) => async (customDeploymentUniqueName) => {
288666
- const { pauseCustomDeploymentByUniqueName: customDeployment } = await gqlClient.request(pauseCustomDeployment, { uniqueName: customDeploymentUniqueName });
288667
- return customDeployment;
288668
- };
288669
- var customDeploymentResume = (gqlClient) => async (customDeploymentUniqueName) => {
288670
- const { resumeCustomDeploymentByUniqueName: customDeployment } = await gqlClient.request(resumeCustomDeployment, { uniqueName: customDeploymentUniqueName });
288671
- return customDeployment;
288672
- };
288673
288529
  var getFoundryEnvConfig = graphql(`
288674
288530
  query GetFoundryEnvConfig($blockchainNodeUniqueName: String!) {
288675
288531
  foundryEnvConfigByUniqueName(blockchainNodeUniqueName: $blockchainNodeUniqueName)
@@ -288746,20 +288602,6 @@ var restartLoadBalancer = graphql(`
288746
288602
  }
288747
288603
  }
288748
288604
  `, [LoadBalancerFragment]);
288749
- var pauseLoadBalancer = graphql(`
288750
- mutation PauseLoadBalancer($uniqueName: String!) {
288751
- pauseLoadBalancerByUniqueName(uniqueName: $uniqueName) {
288752
- ...LoadBalancer
288753
- }
288754
- }
288755
- `, [LoadBalancerFragment]);
288756
- var resumeLoadBalancer = graphql(`
288757
- mutation ResumeLoadBalancer($uniqueName: String!) {
288758
- resumeLoadBalancerByUniqueName(uniqueName: $uniqueName) {
288759
- ...LoadBalancer
288760
- }
288761
- }
288762
- `, [LoadBalancerFragment]);
288763
288605
  var loadBalancerRead = (gqlClient) => {
288764
288606
  return async (loadBalancerUniqueName) => {
288765
288607
  const { loadBalancerByUniqueName: loadBalancer } = await gqlClient.request(getLoadBalancer, { uniqueName: loadBalancerUniqueName });
@@ -288793,14 +288635,6 @@ var loadBalancerRestart = (gqlClient) => async (loadBalancerUniqueName) => {
288793
288635
  const { restartLoadBalancerByUniqueName: loadBalancer } = await gqlClient.request(restartLoadBalancer, { uniqueName: loadBalancerUniqueName });
288794
288636
  return loadBalancer;
288795
288637
  };
288796
- var loadBalancerPause = (gqlClient) => async (loadBalancerUniqueName) => {
288797
- const { pauseLoadBalancerByUniqueName: loadBalancer } = await gqlClient.request(pauseLoadBalancer, { uniqueName: loadBalancerUniqueName });
288798
- return loadBalancer;
288799
- };
288800
- var loadBalancerResume = (gqlClient) => async (loadBalancerUniqueName) => {
288801
- const { resumeLoadBalancerByUniqueName: loadBalancer } = await gqlClient.request(resumeLoadBalancer, { uniqueName: loadBalancerUniqueName });
288802
- return loadBalancer;
288803
- };
288804
288638
  var InsightsFragment = graphql(`
288805
288639
  fragment Insights on Insights {
288806
288640
  __typename
@@ -288874,20 +288708,6 @@ var restartInsights = graphql(`
288874
288708
  }
288875
288709
  }
288876
288710
  `, [InsightsFragment]);
288877
- var pauseInsights = graphql(`
288878
- mutation PauseInsights($uniqueName: String!) {
288879
- pauseInsightsByUniqueName(uniqueName: $uniqueName) {
288880
- ...Insights
288881
- }
288882
- }
288883
- `, [InsightsFragment]);
288884
- var resumeInsights = graphql(`
288885
- mutation ResumeInsights($uniqueName: String!) {
288886
- resumeInsightsByUniqueName(uniqueName: $uniqueName) {
288887
- ...Insights
288888
- }
288889
- }
288890
- `, [InsightsFragment]);
288891
288711
  var insightsList = (gqlClient) => {
288892
288712
  return async (applicationUniqueName) => {
288893
288713
  const { insightsListByUniqueName: { items } } = await gqlClient.request(getInsights, { applicationUniqueName });
@@ -288921,14 +288741,6 @@ var insightsRestart = (gqlClient) => async (insightsUniqueName) => {
288921
288741
  const { restartInsightsByUniqueName: insights } = await gqlClient.request(restartInsights, { uniqueName: insightsUniqueName });
288922
288742
  return insights;
288923
288743
  };
288924
- var insightsPause = (gqlClient) => async (insightsUniqueName) => {
288925
- const { pauseInsightsByUniqueName: insights } = await gqlClient.request(pauseInsights, { uniqueName: insightsUniqueName });
288926
- return insights;
288927
- };
288928
- var insightsResume = (gqlClient) => async (insightsUniqueName) => {
288929
- const { resumeInsightsByUniqueName: insights } = await gqlClient.request(resumeInsights, { uniqueName: insightsUniqueName });
288930
- return insights;
288931
- };
288932
288744
  var IntegrationFragment = graphql(`
288933
288745
  fragment Integration on Integration {
288934
288746
  __typename
@@ -288998,20 +288810,6 @@ var restartIntegrationTool = graphql(`
288998
288810
  }
288999
288811
  }
289000
288812
  `, [IntegrationFragment]);
289001
- var pauseIntegrationTool = graphql(`
289002
- mutation PauseIntegrationTool($uniqueName: String!) {
289003
- pauseIntegrationByUniqueName(uniqueName: $uniqueName) {
289004
- ...Integration
289005
- }
289006
- }
289007
- `, [IntegrationFragment]);
289008
- var resumeIntegrationTool = graphql(`
289009
- mutation ResumeIntegrationTool($uniqueName: String!) {
289010
- resumeIntegrationByUniqueName(uniqueName: $uniqueName) {
289011
- ...Integration
289012
- }
289013
- }
289014
- `, [IntegrationFragment]);
289015
288813
  var integrationToolList = (gqlClient) => {
289016
288814
  return async (applicationUniqueName) => {
289017
288815
  const { integrationsByUniqueName: { items } } = await gqlClient.request(getIntegrations, { applicationUniqueName });
@@ -289039,14 +288837,6 @@ var integrationToolRestart = (gqlClient) => async (integrationUniqueName) => {
289039
288837
  const { restartIntegrationByUniqueName: integration } = await gqlClient.request(restartIntegrationTool, { uniqueName: integrationUniqueName });
289040
288838
  return integration;
289041
288839
  };
289042
- var integrationToolPause = (gqlClient) => async (integrationUniqueName) => {
289043
- const { pauseIntegrationByUniqueName: integration } = await gqlClient.request(pauseIntegrationTool, { uniqueName: integrationUniqueName });
289044
- return integration;
289045
- };
289046
- var integrationToolResume = (gqlClient) => async (integrationUniqueName) => {
289047
- const { resumeIntegrationByUniqueName: integration } = await gqlClient.request(resumeIntegrationTool, { uniqueName: integrationUniqueName });
289048
- return integration;
289049
- };
289050
288840
  var StorageFragment = graphql(`
289051
288841
  fragment Storage on Storage {
289052
288842
  __typename
@@ -289116,20 +288906,6 @@ var restartStorage = graphql(`
289116
288906
  }
289117
288907
  }
289118
288908
  `, [StorageFragment]);
289119
- var pauseStorage = graphql(`
289120
- mutation PauseStorage($uniqueName: String!) {
289121
- pauseStorageByUniqueName(uniqueName: $uniqueName) {
289122
- ...Storage
289123
- }
289124
- }
289125
- `, [StorageFragment]);
289126
- var resumeStorage = graphql(`
289127
- mutation ResumeStorage($uniqueName: String!) {
289128
- resumeStorageByUniqueName(uniqueName: $uniqueName) {
289129
- ...Storage
289130
- }
289131
- }
289132
- `, [StorageFragment]);
289133
288909
  var storageList = (gqlClient) => {
289134
288910
  return async (applicationUniqueName) => {
289135
288911
  const { storagesByUniqueName: { items } } = await gqlClient.request(getStorages, { applicationUniqueName });
@@ -289157,14 +288933,6 @@ var storageRestart = (gqlClient) => async (storageUniqueName) => {
289157
288933
  const { restartStorageByUniqueName: storage } = await gqlClient.request(restartStorage, { uniqueName: storageUniqueName });
289158
288934
  return storage;
289159
288935
  };
289160
- var storagePause = (gqlClient) => async (storageUniqueName) => {
289161
- const { pauseStorageByUniqueName: storage } = await gqlClient.request(pauseStorage, { uniqueName: storageUniqueName });
289162
- return storage;
289163
- };
289164
- var storageResume = (gqlClient) => async (storageUniqueName) => {
289165
- const { resumeStorageByUniqueName: storage } = await gqlClient.request(resumeStorage, { uniqueName: storageUniqueName });
289166
- return storage;
289167
- };
289168
288936
  var MiddlewareFragment = graphql(`
289169
288937
  fragment Middleware on Middleware {
289170
288938
  __typename
@@ -289265,20 +289033,6 @@ var restartMiddleware = graphql(`
289265
289033
  }
289266
289034
  }
289267
289035
  `, [MiddlewareFragment]);
289268
- var pauseMiddleware = graphql(`
289269
- mutation PauseMiddleware($uniqueName: String!) {
289270
- pauseMiddlewareByUniqueName(uniqueName: $uniqueName) {
289271
- ...Middleware
289272
- }
289273
- }
289274
- `, [MiddlewareFragment]);
289275
- var resumeMiddleware = graphql(`
289276
- mutation ResumeMiddleware($uniqueName: String!) {
289277
- resumeMiddlewareByUniqueName(uniqueName: $uniqueName) {
289278
- ...Middleware
289279
- }
289280
- }
289281
- `, [MiddlewareFragment]);
289282
289036
  var middlewareList = (gqlClient) => {
289283
289037
  return async (applicationUniqueName) => {
289284
289038
  const { middlewaresByUniqueName: { items } } = await gqlClient.request(getMiddlewares, { applicationUniqueName });
@@ -289323,14 +289077,6 @@ var middlewareRestart = (gqlClient) => async (middlewareUniqueName) => {
289323
289077
  const { restartMiddlewareByUniqueName: middleware } = await gqlClient.request(restartMiddleware, { uniqueName: middlewareUniqueName });
289324
289078
  return middleware;
289325
289079
  };
289326
- var middlewarePause = (gqlClient) => async (middlewareUniqueName) => {
289327
- const { pauseMiddlewareByUniqueName: middleware } = await gqlClient.request(pauseMiddleware, { uniqueName: middlewareUniqueName });
289328
- return middleware;
289329
- };
289330
- var middlewareResume = (gqlClient) => async (middlewareUniqueName) => {
289331
- const { resumeMiddlewareByUniqueName: middleware } = await gqlClient.request(resumeMiddleware, { uniqueName: middlewareUniqueName });
289332
- return middleware;
289333
- };
289334
289080
  var getPlatformConfigQuery = graphql(`
289335
289081
  query platformConfig {
289336
289082
  config {
@@ -289463,20 +289209,6 @@ var restartPrivateKey = graphql(`
289463
289209
  }
289464
289210
  }
289465
289211
  `, [PrivateKeyFragment]);
289466
- var pausePrivateKey = graphql(`
289467
- mutation PausePrivateKey($uniqueName: String!) {
289468
- pausePrivateKeyByUniqueName(uniqueName: $uniqueName) {
289469
- ...PrivateKey
289470
- }
289471
- }
289472
- `, [PrivateKeyFragment]);
289473
- var resumePrivateKey = graphql(`
289474
- mutation ResumePrivateKey($uniqueName: String!) {
289475
- resumePrivateKeyByUniqueName(uniqueName: $uniqueName) {
289476
- ...PrivateKey
289477
- }
289478
- }
289479
- `, [PrivateKeyFragment]);
289480
289212
  var privateKeyList = (gqlClient) => {
289481
289213
  return async (applicationUniqueName) => {
289482
289214
  const { privateKeysByUniqueName: { items } } = await gqlClient.request(getPrivateKeys, { applicationUniqueName });
@@ -289515,14 +289247,6 @@ var privateKeyRestart = (gqlClient) => async (privateKeyUniqueName) => {
289515
289247
  const { restartPrivateKeyByUniqueName: privateKey } = await gqlClient.request(restartPrivateKey, { uniqueName: privateKeyUniqueName });
289516
289248
  return privateKey;
289517
289249
  };
289518
- var privateKeyPause = (gqlClient) => async (privateKeyUniqueName) => {
289519
- const { pausePrivateKeyByUniqueName: privateKey } = await gqlClient.request(pausePrivateKey, { uniqueName: privateKeyUniqueName });
289520
- return privateKey;
289521
- };
289522
- var privateKeyResume = (gqlClient) => async (privateKeyUniqueName) => {
289523
- const { resumePrivateKeyByUniqueName: privateKey } = await gqlClient.request(resumePrivateKey, { uniqueName: privateKeyUniqueName });
289524
- return privateKey;
289525
- };
289526
289250
  var ClientOptionsSchema = exports_external.object({
289527
289251
  accessToken: AccessTokenSchema2,
289528
289252
  instance: UrlSchema2
@@ -289602,75 +289326,57 @@ function createSettleMintClient(options) {
289602
289326
  read: blockchainNetworkRead(gqlClient),
289603
289327
  create: blockchainNetworkCreate(gqlClient),
289604
289328
  delete: blockchainNetworkDelete(gqlClient),
289605
- restart: blockchainNetworkRestart(gqlClient),
289606
- pause: blockchainNetworkPause(gqlClient),
289607
- resume: blockchainNetworkResume(gqlClient)
289329
+ restart: blockchainNetworkRestart(gqlClient)
289608
289330
  },
289609
289331
  blockchainNode: {
289610
289332
  list: blockchainNodeList(gqlClient),
289611
289333
  read: blockchainNodeRead(gqlClient),
289612
289334
  create: blockchainNodeCreate(gqlClient),
289613
- restart: blockchainNodeRestart(gqlClient),
289614
- pause: blockchainNodePause(gqlClient),
289615
- resume: blockchainNodeResume(gqlClient)
289335
+ restart: blockchainNodeRestart(gqlClient)
289616
289336
  },
289617
289337
  loadBalancer: {
289618
289338
  list: loadBalancerList(gqlClient),
289619
289339
  read: loadBalancerRead(gqlClient),
289620
289340
  create: loadBalancerCreate(gqlClient),
289621
- restart: loadBalancerRestart(gqlClient),
289622
- pause: loadBalancerPause(gqlClient),
289623
- resume: loadBalancerResume(gqlClient)
289341
+ restart: loadBalancerRestart(gqlClient)
289624
289342
  },
289625
289343
  middleware: {
289626
289344
  list: middlewareList(gqlClient),
289627
289345
  read: middlewareRead(gqlClient),
289628
289346
  graphSubgraphs: graphMiddlewareSubgraphs(gqlClient),
289629
289347
  create: middlewareCreate(gqlClient),
289630
- restart: middlewareRestart(gqlClient),
289631
- pause: middlewarePause(gqlClient),
289632
- resume: middlewareResume(gqlClient)
289348
+ restart: middlewareRestart(gqlClient)
289633
289349
  },
289634
289350
  integrationTool: {
289635
289351
  list: integrationToolList(gqlClient),
289636
289352
  read: integrationToolRead(gqlClient),
289637
289353
  create: integrationToolCreate(gqlClient),
289638
- restart: integrationToolRestart(gqlClient),
289639
- pause: integrationToolPause(gqlClient),
289640
- resume: integrationToolResume(gqlClient)
289354
+ restart: integrationToolRestart(gqlClient)
289641
289355
  },
289642
289356
  storage: {
289643
289357
  list: storageList(gqlClient),
289644
289358
  read: storageRead(gqlClient),
289645
289359
  create: storageCreate(gqlClient),
289646
- restart: storageRestart(gqlClient),
289647
- pause: storagePause(gqlClient),
289648
- resume: storageResume(gqlClient)
289360
+ restart: storageRestart(gqlClient)
289649
289361
  },
289650
289362
  privateKey: {
289651
289363
  list: privateKeyList(gqlClient),
289652
289364
  read: privatekeyRead(gqlClient),
289653
289365
  create: privateKeyCreate(gqlClient),
289654
- restart: privateKeyRestart(gqlClient),
289655
- pause: privateKeyPause(gqlClient),
289656
- resume: privateKeyResume(gqlClient)
289366
+ restart: privateKeyRestart(gqlClient)
289657
289367
  },
289658
289368
  insights: {
289659
289369
  list: insightsList(gqlClient),
289660
289370
  read: insightsRead(gqlClient),
289661
289371
  create: insightsCreate(gqlClient),
289662
- restart: insightsRestart(gqlClient),
289663
- pause: insightsPause(gqlClient),
289664
- resume: insightsResume(gqlClient)
289372
+ restart: insightsRestart(gqlClient)
289665
289373
  },
289666
289374
  customDeployment: {
289667
289375
  list: customdeploymentList(gqlClient),
289668
289376
  read: customdeploymentRead(gqlClient),
289669
289377
  create: customdeploymentCreate(gqlClient),
289670
289378
  update: customdeploymentUpdate(gqlClient),
289671
- restart: customDeploymentRestart(gqlClient),
289672
- pause: customDeploymentPause(gqlClient),
289673
- resume: customDeploymentResume(gqlClient)
289379
+ restart: customDeploymentRestart(gqlClient)
289674
289380
  },
289675
289381
  foundry: { env: getEnv(gqlClient) },
289676
289382
  applicationAccessToken: { create: applicationAccessTokenCreate(gqlClient) },
@@ -296087,6 +295793,17 @@ async function exists3(path$1) {
296087
295793
  return false;
296088
295794
  }
296089
295795
  }
295796
+ function tryParseJson3(value2, defaultValue = null) {
295797
+ try {
295798
+ const parsed = JSON.parse(value2);
295799
+ if (parsed === undefined || parsed === null) {
295800
+ return defaultValue;
295801
+ }
295802
+ return parsed;
295803
+ } catch (err) {
295804
+ return defaultValue;
295805
+ }
295806
+ }
296090
295807
  var require_balanced_match4 = __commonJS4({ "../../node_modules/balanced-match/index.js"(exports, module) {
296091
295808
  module.exports = balanced$1;
296092
295809
  function balanced$1(a3, b, str) {
@@ -301565,17 +301282,6 @@ var glob3 = Object.assign(glob_3, {
301565
301282
  unescape: unescape4
301566
301283
  });
301567
301284
  glob3.glob = glob3;
301568
- function tryParseJson3(value2, defaultValue = null) {
301569
- try {
301570
- const parsed = JSON.parse(value2);
301571
- if (parsed === undefined || parsed === null) {
301572
- return defaultValue;
301573
- }
301574
- return parsed;
301575
- } catch (_err) {
301576
- return defaultValue;
301577
- }
301578
- }
301579
301285
  async function findMonoRepoRoot2(startDir) {
301580
301286
  const lockFilePath = await findUp([
301581
301287
  "package-lock.json",
@@ -301621,7 +301327,7 @@ function tryParseJson4(value2, defaultValue = null) {
301621
301327
  return defaultValue;
301622
301328
  }
301623
301329
  return parsed;
301624
- } catch (_err) {
301330
+ } catch (err) {
301625
301331
  return defaultValue;
301626
301332
  }
301627
301333
  }
@@ -301649,7 +301355,7 @@ async function readConfig() {
301649
301355
  try {
301650
301356
  const content = await readFile4(CONFIG_FILE, "utf-8");
301651
301357
  return tryParseJson4(content, { instances: {} });
301652
- } catch (_error) {
301358
+ } catch (error41) {
301653
301359
  return { instances: {} };
301654
301360
  }
301655
301361
  }
@@ -305229,11 +304935,8 @@ function observe(observerId, callbacks, fn) {
305229
304935
  if (!listeners2.some((cb) => cb.id === callbackId))
305230
304936
  return;
305231
304937
  const cleanup2 = cleanupCache.get(observerId);
305232
- if (listeners2.length === 1 && cleanup2) {
305233
- const p5 = cleanup2();
305234
- if (p5 instanceof Promise)
305235
- p5.catch(() => {});
305236
- }
304938
+ if (listeners2.length === 1 && cleanup2)
304939
+ cleanup2();
305237
304940
  unsubscribe();
305238
304941
  };
305239
304942
  const listeners = getListeners();
@@ -305372,9 +305075,9 @@ function watchContractEvent(client, parameters) {
305372
305075
  return poll_;
305373
305076
  if (typeof fromBlock === "bigint")
305374
305077
  return true;
305375
- if (client.transport.type === "webSocket" || client.transport.type === "ipc")
305078
+ if (client.transport.type === "webSocket")
305376
305079
  return false;
305377
- if (client.transport.type === "fallback" && (client.transport.transports[0].config.type === "webSocket" || client.transport.transports[0].config.type === "ipc"))
305080
+ if (client.transport.type === "fallback" && client.transport.transports[0].config.type === "webSocket")
305378
305081
  return false;
305379
305082
  return true;
305380
305083
  })();
@@ -305475,7 +305178,7 @@ function watchContractEvent(client, parameters) {
305475
305178
  try {
305476
305179
  const transport = (() => {
305477
305180
  if (client.transport.type === "fallback") {
305478
- const transport2 = client.transport.transports.find((transport3) => transport3.config.type === "webSocket" || transport3.config.type === "ipc");
305181
+ const transport2 = client.transport.transports.find((transport3) => transport3.config.type === "webSocket");
305479
305182
  if (!transport2)
305480
305183
  return client.transport;
305481
305184
  return transport2.value;
@@ -307363,10 +307066,9 @@ async function simulateBlocks(client, parameters) {
307363
307066
  const calls = block2.calls.map((call_) => {
307364
307067
  const call2 = call_;
307365
307068
  const account = call2.account ? parseAccount(call2.account) : undefined;
307366
- const data = call2.abi ? encodeFunctionData(call2) : call2.data;
307367
307069
  const request2 = {
307368
307070
  ...call2,
307369
- data: call2.dataSuffix ? concat2([data || "0x", call2.dataSuffix]) : data,
307071
+ data: call2.abi ? encodeFunctionData(call2) : call2.data,
307370
307072
  from: call2.from ?? account?.address
307371
307073
  };
307372
307074
  assertRequest(request2);
@@ -307413,7 +307115,7 @@ async function simulateBlocks(client, parameters) {
307413
307115
  return;
307414
307116
  return getContractError(error45, {
307415
307117
  abi: abi2 ?? [],
307416
- address: to ?? "0x",
307118
+ address: to,
307417
307119
  args,
307418
307120
  functionName: functionName ?? "<unknown>"
307419
307121
  });
@@ -308355,6 +308057,14 @@ async function simulateCalls(client, parameters) {
308355
308057
  });
308356
308058
  return accessList.map(({ address, storageKeys }) => storageKeys.length > 0 ? address : null);
308357
308059
  })).then((x6) => x6.flat().filter(Boolean)) : [];
308060
+ const resultsStateOverrides = stateOverrides?.map((override) => {
308061
+ if (override.address === account?.address)
308062
+ return {
308063
+ ...override,
308064
+ nonce: 0
308065
+ };
308066
+ return override;
308067
+ });
308358
308068
  const blocks = await simulateBlocks(client, {
308359
308069
  blockNumber,
308360
308070
  blockTag,
@@ -308384,11 +308094,12 @@ async function simulateCalls(client, parameters) {
308384
308094
  }
308385
308095
  ] : [],
308386
308096
  {
308387
- calls: [...calls, {}].map((call2) => ({
308097
+ calls: [...calls, {}].map((call2, index2) => ({
308388
308098
  ...call2,
308389
- from: account?.address
308099
+ from: account?.address,
308100
+ nonce: index2
308390
308101
  })),
308391
- stateOverrides
308102
+ stateOverrides: resultsStateOverrides
308392
308103
  },
308393
308104
  ...traceAssetChanges ? [
308394
308105
  {
@@ -308636,9 +308347,9 @@ function watchBlockNumber(client, { emitOnBegin = false, emitMissed = false, onB
308636
308347
  const enablePolling = (() => {
308637
308348
  if (typeof poll_ !== "undefined")
308638
308349
  return poll_;
308639
- if (client.transport.type === "webSocket" || client.transport.type === "ipc")
308350
+ if (client.transport.type === "webSocket")
308640
308351
  return false;
308641
- if (client.transport.type === "fallback" && (client.transport.transports[0].config.type === "webSocket" || client.transport.transports[0].config.type === "ipc"))
308352
+ if (client.transport.type === "fallback" && client.transport.transports[0].config.type === "webSocket")
308642
308353
  return false;
308643
308354
  return true;
308644
308355
  })();
@@ -308690,7 +308401,7 @@ function watchBlockNumber(client, { emitOnBegin = false, emitMissed = false, onB
308690
308401
  try {
308691
308402
  const transport = (() => {
308692
308403
  if (client.transport.type === "fallback") {
308693
- const transport2 = client.transport.transports.find((transport3) => transport3.config.type === "webSocket" || transport3.config.type === "ipc");
308404
+ const transport2 = client.transport.transports.find((transport3) => transport3.config.type === "webSocket");
308694
308405
  if (!transport2)
308695
308406
  return client.transport;
308696
308407
  return transport2.value;
@@ -308843,9 +308554,9 @@ function watchBlocks(client, { blockTag = "latest", emitMissed = false, emitOnBe
308843
308554
  const enablePolling = (() => {
308844
308555
  if (typeof poll_ !== "undefined")
308845
308556
  return poll_;
308846
- if (client.transport.type === "webSocket" || client.transport.type === "ipc")
308557
+ if (client.transport.type === "webSocket")
308847
308558
  return false;
308848
- if (client.transport.type === "fallback" && (client.transport.transports[0].config.type === "webSocket" || client.transport.transports[0].config.type === "ipc"))
308559
+ if (client.transport.type === "fallback" && client.transport.transports[0].config.type === "webSocket")
308849
308560
  return false;
308850
308561
  return true;
308851
308562
  })();
@@ -308914,7 +308625,7 @@ function watchBlocks(client, { blockTag = "latest", emitMissed = false, emitOnBe
308914
308625
  }
308915
308626
  const transport = (() => {
308916
308627
  if (client.transport.type === "fallback") {
308917
- const transport2 = client.transport.transports.find((transport3) => transport3.config.type === "webSocket" || transport3.config.type === "ipc");
308628
+ const transport2 = client.transport.transports.find((transport3) => transport3.config.type === "webSocket");
308918
308629
  if (!transport2)
308919
308630
  return client.transport;
308920
308631
  return transport2.value;
@@ -308927,7 +308638,7 @@ function watchBlocks(client, { blockTag = "latest", emitMissed = false, emitOnBe
308927
308638
  if (!active)
308928
308639
  return;
308929
308640
  const block = await getAction(client, getBlock, "getBlock")({
308930
- blockNumber: data.result?.number,
308641
+ blockNumber: data.blockNumber,
308931
308642
  includeTransactions
308932
308643
  }).catch(() => {});
308933
308644
  if (!active)
@@ -308961,9 +308672,9 @@ function watchEvent(client, { address, args, batch = true, event, events, fromBl
308961
308672
  return poll_;
308962
308673
  if (typeof fromBlock === "bigint")
308963
308674
  return true;
308964
- if (client.transport.type === "webSocket" || client.transport.type === "ipc")
308675
+ if (client.transport.type === "webSocket")
308965
308676
  return false;
308966
- if (client.transport.type === "fallback" && (client.transport.transports[0].config.type === "webSocket" || client.transport.transports[0].config.type === "ipc"))
308677
+ if (client.transport.type === "fallback" && client.transport.transports[0].config.type === "webSocket")
308967
308678
  return false;
308968
308679
  return true;
308969
308680
  })();
@@ -309050,7 +308761,7 @@ function watchEvent(client, { address, args, batch = true, event, events, fromBl
309050
308761
  try {
309051
308762
  const transport = (() => {
309052
308763
  if (client.transport.type === "fallback") {
309053
- const transport2 = client.transport.transports.find((transport3) => transport3.config.type === "webSocket" || transport3.config.type === "ipc");
308764
+ const transport2 = client.transport.transports.find((transport3) => transport3.config.type === "webSocket");
309054
308765
  if (!transport2)
309055
308766
  return client.transport;
309056
308767
  return transport2.value;
@@ -309117,7 +308828,7 @@ function watchEvent(client, { address, args, batch = true, event, events, fromBl
309117
308828
  }
309118
308829
  // ../../node_modules/viem/_esm/actions/public/watchPendingTransactions.js
309119
308830
  function watchPendingTransactions(client, { batch = true, onError, onTransactions, poll: poll_, pollingInterval = client.pollingInterval }) {
309120
- const enablePolling = typeof poll_ !== "undefined" ? poll_ : client.transport.type !== "webSocket" && client.transport.type !== "ipc";
308831
+ const enablePolling = typeof poll_ !== "undefined" ? poll_ : client.transport.type !== "webSocket";
309121
308832
  const pollPendingTransactions = () => {
309122
308833
  const observerId = stringify3([
309123
308834
  "watchPendingTransactions",
@@ -320775,7 +320486,7 @@ async function applicationAccessTokenPrompt(env2, application, settlemint, accep
320775
320486
  try {
320776
320487
  validate2(exports_external.string(), value4);
320777
320488
  return true;
320778
- } catch (_error) {
320489
+ } catch (error45) {
320779
320490
  return "Invalid token name";
320780
320491
  }
320781
320492
  }
@@ -320828,7 +320539,7 @@ async function applicationAccessTokenPrompt(env2, application, settlemint, accep
320828
320539
  try {
320829
320540
  validate2(ApplicationAccessTokenSchema2, aat);
320830
320541
  return aat;
320831
- } catch (_error) {}
320542
+ } catch (error45) {}
320832
320543
  }
320833
320544
  return esm_default5({
320834
320545
  message: "What is the application access token for your application in SettleMint? (format: sm_aat_...)",
@@ -320836,7 +320547,7 @@ async function applicationAccessTokenPrompt(env2, application, settlemint, accep
320836
320547
  try {
320837
320548
  validate2(ApplicationAccessTokenSchema2, value4);
320838
320549
  return true;
320839
- } catch (_error) {
320550
+ } catch (error45) {
320840
320551
  return "Invalid application access token, it should start with sm_aat_...";
320841
320552
  }
320842
320553
  }
@@ -321241,7 +320952,7 @@ async function instancePrompt({
321241
320952
  try {
321242
320953
  validate2(UrlSchema2, value4);
321243
320954
  return true;
321244
- } catch (_error) {
320955
+ } catch (error45) {
321245
320956
  return "Invalid URL";
321246
320957
  }
321247
320958
  },
@@ -321325,7 +321036,7 @@ async function serviceUrlPrompt({
321325
321036
  try {
321326
321037
  validate2(UrlSchema2, value4);
321327
321038
  return true;
321328
- } catch (_error) {
321039
+ } catch (error45) {
321329
321040
  return "Invalid URL";
321330
321041
  }
321331
321042
  },
@@ -322269,7 +321980,7 @@ async function projectNamePrompt(env2, argument) {
322269
321980
  try {
322270
321981
  validate2(exports_external.string(), value4);
322271
321982
  return true;
322272
- } catch (_error) {
321983
+ } catch (error45) {
322273
321984
  return "Invalid projectname";
322274
321985
  }
322275
321986
  }
@@ -326257,7 +325968,7 @@ async function personalAccessTokenPrompt(env2, instance, accept) {
326257
325968
  try {
326258
325969
  validate2(PersonalAccessTokenSchema2, value4);
326259
325970
  return true;
326260
- } catch (_error) {
325971
+ } catch (error45) {
326261
325972
  return "Invalid personal access token, it should start with sm_pat_...";
326262
325973
  }
326263
325974
  }
@@ -326338,7 +326049,7 @@ function loginCommand() {
326338
326049
  });
326339
326050
  try {
326340
326051
  await loginSpinner(client);
326341
- } catch (_error) {
326052
+ } catch (error45) {
326342
326053
  cancel2(`Invalid personal access token for instance ${selectedInstance}`);
326343
326054
  }
326344
326055
  await storeCredentials(personalAccessToken, selectedInstance);
@@ -326488,17 +326199,13 @@ function addClusterServiceArgs(cmd2) {
326488
326199
  // src/commands/platform/utils/wait-for-completion.ts
326489
326200
  class TimeoutError2 extends Error {
326490
326201
  }
326491
-
326492
- class DeploymentFailedError extends Error {
326493
- }
326494
326202
  async function waitForCompletion({
326495
326203
  settlemint,
326496
326204
  type: type4,
326497
326205
  uniqueName,
326498
326206
  action,
326499
326207
  maxTimeout = 10 * 60 * 1000,
326500
- restartIfTimeout = false,
326501
- restartOnError = false
326208
+ restartIfTimeout = false
326502
326209
  }) {
326503
326210
  const serviceType = SETTLEMINT_CLIENT_MAP[type4];
326504
326211
  if (serviceType === "workspace" || serviceType === "application" || serviceType === "foundry" || serviceType === "applicationAccessToken" || serviceType === "platform" || serviceType === "wallet") {
@@ -326508,7 +326215,6 @@ async function waitForCompletion({
326508
326215
  if (!service || !("read" in service)) {
326509
326216
  throw new Error(`Service ${serviceType} does not support status checking`);
326510
326217
  }
326511
- let hasRestarted = false;
326512
326218
  function showSpinner() {
326513
326219
  return spinner({
326514
326220
  startMessage: `Waiting for ${type4} to be ${getActionLabel(action)}`,
@@ -326518,20 +326224,33 @@ async function waitForCompletion({
326518
326224
  while (true) {
326519
326225
  try {
326520
326226
  const resource = await service.read(uniqueName);
326227
+ if (resource.status === "COMPLETED") {
326228
+ if (spinner2) {
326229
+ spinner2.text = `${capitalizeFirstLetter2(type4)} is ${getActionLabel(action)}`;
326230
+ } else {
326231
+ note(`${capitalizeFirstLetter2(type4)} is ${getActionLabel(action)}`);
326232
+ }
326233
+ return true;
326234
+ }
326521
326235
  if (resource.status === "FAILED") {
326522
- updateStatus(spinner2, `${capitalizeFirstLetter2(type4)} failed to ${getActionLabel(action)}`);
326523
- if (restartOnError) {
326524
- throw new DeploymentFailedError;
326236
+ if (spinner2) {
326237
+ spinner2.text = `${capitalizeFirstLetter2(type4)} failed to ${getActionLabel(action)}`;
326238
+ } else {
326239
+ note(`${capitalizeFirstLetter2(type4)} failed to ${getActionLabel(action)}`);
326525
326240
  }
326526
326241
  return false;
326527
326242
  }
326528
- if (isActionComplete(action, resource.status)) {
326529
- updateStatus(spinner2, `${capitalizeFirstLetter2(type4)} is ${getActionLabel(action)}`);
326530
- return true;
326243
+ if (spinner2) {
326244
+ spinner2.text = `${capitalizeFirstLetter2(type4)} is not ready yet (status: ${resource.status})`;
326245
+ } else {
326246
+ note(`${capitalizeFirstLetter2(type4)} is not ready yet (status: ${resource.status})`);
326247
+ }
326248
+ } catch (error45) {
326249
+ if (spinner2) {
326250
+ spinner2.text = `${capitalizeFirstLetter2(type4)} is not ready yet (status: UNKNOWN)`;
326251
+ } else {
326252
+ note(`${capitalizeFirstLetter2(type4)} is not ready yet (status: UNKNOWN)`);
326531
326253
  }
326532
- updateStatus(spinner2, `${capitalizeFirstLetter2(type4)} is not ready yet (status: ${resource.status})`);
326533
- } catch (_error) {
326534
- updateStatus(spinner2, `${capitalizeFirstLetter2(type4)} is not ready yet (status: UNKNOWN)`);
326535
326254
  }
326536
326255
  if (Date.now() - startTime > maxTimeout) {
326537
326256
  throw new TimeoutError2(`Operation timed out after ${maxTimeout / 60000} minutes for ${type4} with unique name ${uniqueName}`);
@@ -326544,59 +326263,23 @@ async function waitForCompletion({
326544
326263
  try {
326545
326264
  return await showSpinner();
326546
326265
  } catch (error45) {
326547
- if (!hasRestarted && shouldRestart(error45, restartIfTimeout)) {
326266
+ const isTimeoutError = error45 instanceof SpinnerError && error45.originalError instanceof TimeoutError2;
326267
+ if (restartIfTimeout && isTimeoutError) {
326548
326268
  note(`Restarting ${capitalizeFirstLetter2(type4)}`);
326549
- hasRestarted = true;
326550
326269
  await service.restart(uniqueName);
326551
326270
  return showSpinner();
326552
326271
  }
326553
326272
  throw error45;
326554
326273
  }
326555
326274
  }
326556
- function shouldRestart(error45, restartIfTimeout) {
326557
- const isSpinnerError = error45 instanceof SpinnerError;
326558
- const isDeploymentFailedError = error45 instanceof DeploymentFailedError || isSpinnerError && error45.originalError instanceof DeploymentFailedError;
326559
- if (isDeploymentFailedError) {
326560
- return true;
326561
- }
326562
- const isTimeoutError = error45 instanceof TimeoutError2 || isSpinnerError && error45.originalError instanceof TimeoutError2;
326563
- return restartIfTimeout && isTimeoutError;
326564
- }
326565
- function updateStatus(spinner2, message) {
326566
- if (spinner2) {
326567
- spinner2.text = message;
326568
- } else {
326569
- note(message);
326570
- }
326571
- }
326572
- function isActionComplete(action, status) {
326573
- switch (action) {
326574
- case "pause":
326575
- return status === "PAUSED" || status === "AUTO_PAUSED";
326576
- case "resume":
326577
- case "deploy":
326578
- case "destroy":
326579
- case "restart":
326580
- return status === "COMPLETED";
326581
- default:
326582
- return false;
326583
- }
326584
- }
326585
326275
  function getActionLabel(action) {
326586
- switch (action) {
326587
- case "restart":
326588
- return "restarted";
326589
- case "destroy":
326590
- return "destroyed";
326591
- case "pause":
326592
- return "paused";
326593
- case "resume":
326594
- return "resumed";
326595
- case "deploy":
326596
- return "deployed";
326597
- default:
326598
- return "deployed";
326276
+ if (action === "restart") {
326277
+ return "restarted";
326278
+ }
326279
+ if (action === "destroy") {
326280
+ return "destroyed";
326599
326281
  }
326282
+ return "deployed";
326600
326283
  }
326601
326284
 
326602
326285
  // src/prompts/provider.prompt.ts
@@ -326677,9 +326360,9 @@ function getCreateCommand({
326677
326360
  cmd2.alias(alias);
326678
326361
  }
326679
326362
  if (requiresDeployment) {
326680
- cmd2.option("-w, --wait", "Wait until deployed").option("--restart-if-timeout", "Restart if wait time is exceeded").option("--restart-on-error", "Restart if deployment fails");
326363
+ cmd2.option("-w, --wait", "Wait until deployed").option("-r, --restart-if-timeout", "Restart if wait time is exceeded");
326681
326364
  }
326682
- execute2(cmd2, async ({ acceptDefaults, prod, default: isDefault, wait: wait2, restartIfTimeout, restartOnError, provider, region }, createFunction) => {
326365
+ execute2(cmd2, async ({ acceptDefaults, prod, default: isDefault, wait: wait2, restartIfTimeout, provider, region }, createFunction) => {
326683
326366
  intro(`Creating ${type4} in the SettleMint platform`);
326684
326367
  const env2 = await loadEnv(false, !!prod);
326685
326368
  const instance = await instancePrompt({ env: env2, accept: acceptDefaults });
@@ -326693,8 +326376,8 @@ function getCreateCommand({
326693
326376
  instance
326694
326377
  });
326695
326378
  const platformConfig = await settlemint.platform.config();
326696
- let selectedProvider;
326697
- let selectedRegion;
326379
+ let selectedProvider = undefined;
326380
+ let selectedRegion = undefined;
326698
326381
  if (cmd2.options.some((option) => option.long === "--provider")) {
326699
326382
  selectedProvider = await providerPrompt(platformConfig, provider);
326700
326383
  if (!selectedProvider) {
@@ -326723,8 +326406,7 @@ function getCreateCommand({
326723
326406
  type: waitFor?.resourceType ?? type4,
326724
326407
  uniqueName: waitFor?.uniqueName ?? result.uniqueName,
326725
326408
  action: "deploy",
326726
- restartIfTimeout,
326727
- restartOnError
326409
+ restartIfTimeout
326728
326410
  });
326729
326411
  if (!isDeployed) {
326730
326412
  throw new Error(`Failed to deploy ${waitFor?.resourceType ?? type4} ${waitFor?.uniqueName ?? result.uniqueName}`);
@@ -327906,7 +327588,7 @@ function privateKeyHsmCreateCommand() {
327906
327588
  return baseAction({
327907
327589
  ...defaultArgs,
327908
327590
  acceptDefaults
327909
- }, async ({ settlemint, env: env2, showSpinner, provider: _provider, region: _region }) => {
327591
+ }, async ({ settlemint, env: env2, showSpinner, provider, region }) => {
327910
327592
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
327911
327593
  if (!applicationUniqueName) {
327912
327594
  return missingApplication();
@@ -328195,256 +327877,25 @@ function deleteCommand() {
328195
327877
  return new Command("delete").alias("d").description("Delete a resource in the SettleMint platform").addCommand(applicationDeleteCommand()).addCommand(workspaceDeleteCommand());
328196
327878
  }
328197
327879
 
328198
- // src/commands/platform/common/pause-command.ts
328199
- function getPauseCommand({
328200
- name: name3,
328201
- type: type4,
328202
- alias,
328203
- envKey,
328204
- pauseFunction,
328205
- usePersonalAccessToken = true
328206
- }) {
328207
- const commandName = sanitizeCommandName(name3);
328208
- const typeCommandName = sanitizeCommandName(type4);
328209
- const exampleCommandPrefix = `platform pause ${typeCommandName !== commandName ? `${typeCommandName} ` : ""}${commandName}`;
328210
- return new Command(commandName).alias(alias).description(`Pause a ${type4} in the SettleMint platform. Provide the ${type4} unique name or use 'default' to pause the default ${type4} from your .env file.`).usage(createExamples([
328211
- {
328212
- description: `Pauses the specified ${type4} by unique name`,
328213
- command: `${exampleCommandPrefix} <unique-name>`
328214
- },
328215
- {
328216
- description: `Pauses the default ${type4} in the production environment`,
328217
- command: `${exampleCommandPrefix} default --prod`
328218
- }
328219
- ])).argument("<unique-name>", `The unique name of the ${type4}, use 'default' to pause the default one from your .env file`).option("-a, --accept-defaults", "Accept the default and previously set values").option("--prod", "Connect to your production environment").option("-w, --wait", "Wait until paused").action(async (uniqueName, { acceptDefaults, prod, wait: wait2 }) => {
328220
- intro(`Pausing ${type4} in the SettleMint platform`);
328221
- const env2 = await loadEnv(false, !!prod);
328222
- const instance = await instancePrompt({ env: env2, accept: acceptDefaults });
328223
- const accessToken = await getApplicationOrPersonalAccessToken({
328224
- env: env2,
328225
- instance,
328226
- prefer: usePersonalAccessToken ? "personal" : "application"
328227
- });
328228
- const settlemint = createSettleMintClient({
328229
- accessToken,
328230
- instance
328231
- });
328232
- const isDefaultUniqueName = uniqueName === "default";
328233
- const serviceUniqueName = isDefaultUniqueName ? typeof env2[envKey] === "string" ? env2[envKey] : null : uniqueName;
328234
- if (!serviceUniqueName) {
328235
- cancel2(`No default ${type4} found in your .env file. Please provide a valid ${type4} unique name or set a default ${type4} first.`);
328236
- }
328237
- const result = await spinner({
328238
- startMessage: `Pausing ${type4}`,
328239
- task: async () => {
328240
- return pauseFunction(settlemint, serviceUniqueName);
328241
- },
328242
- stopMessage: `${capitalizeFirstLetter2(type4)} pause initiated`
328243
- });
328244
- if (wait2) {
328245
- const isPaused = await waitForCompletion({
328246
- settlemint,
328247
- type: type4,
328248
- uniqueName: serviceUniqueName,
328249
- action: "pause"
328250
- });
328251
- if (!isPaused) {
328252
- throw new Error(`Failed to pause ${type4} ${serviceUniqueName}`);
328253
- }
328254
- }
328255
- outro(`${capitalizeFirstLetter2(type4)} ${result.name} pause initiated successfully`);
328256
- });
328257
- }
328258
-
328259
- // src/commands/platform/blockchain-network/pause.ts
328260
- function blockchainNetworkPauseCommand() {
328261
- return getPauseCommand({
328262
- name: "blockchain-network",
328263
- type: "blockchain network",
328264
- alias: "bnw",
328265
- envKey: "SETTLEMINT_BLOCKCHAIN_NETWORK",
328266
- pauseFunction: async (settlemint, id) => {
328267
- return settlemint.blockchainNetwork.pause(id);
328268
- }
328269
- });
328270
- }
328271
-
328272
- // src/commands/platform/blockchain-node/pause.ts
328273
- function blockchainNodePauseCommand() {
328274
- return getPauseCommand({
328275
- name: "blockchain-node",
328276
- type: "blockchain node",
328277
- alias: "bn",
328278
- envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
328279
- pauseFunction: async (settlemint, id) => {
328280
- return settlemint.blockchainNode.pause(id);
328281
- }
328282
- });
328283
- }
328284
-
328285
- // src/commands/platform/custom-deployments/pause.ts
328286
- function customDeploymentPauseCommand() {
328287
- return getPauseCommand({
328288
- name: "custom-deployment",
328289
- type: "custom deployment",
328290
- alias: "cd",
328291
- envKey: "SETTLEMINT_CUSTOM_DEPLOYMENT",
328292
- pauseFunction: async (settlemint, id) => {
328293
- return settlemint.customDeployment.pause(id);
328294
- }
328295
- });
328296
- }
328297
-
328298
- // src/commands/platform/insights/blockscout/pause.ts
328299
- function blockscoutPauseCommand() {
328300
- return getPauseCommand({
328301
- name: "blockscout",
328302
- type: "insights",
328303
- alias: "bs",
328304
- envKey: "SETTLEMINT_BLOCKSCOUT",
328305
- pauseFunction: async (settlemint, id) => {
328306
- return settlemint.insights.pause(id);
328307
- }
328308
- });
328309
- }
328310
-
328311
- // src/commands/platform/insights/pause.ts
328312
- function insightsPauseCommand() {
328313
- return new Command("insights").alias("in").description("Pause an insights service in the SettleMint platform").addCommand(blockscoutPauseCommand());
328314
- }
328315
-
328316
- // src/commands/platform/integration-tools/hasura/pause.ts
328317
- function hasuraPauseCommand() {
328318
- return getPauseCommand({
328319
- name: "hasura",
328320
- type: "integration tool",
328321
- alias: "ha",
328322
- envKey: "SETTLEMINT_HASURA",
328323
- pauseFunction: async (settlemint, id) => {
328324
- return settlemint.integrationTool.pause(id);
328325
- }
328326
- });
328327
- }
328328
-
328329
- // src/commands/platform/integration-tools/pause.ts
328330
- function integrationToolPauseCommand() {
328331
- return new Command("integration-tool").alias("it").description("Pause an integration tool service in the SettleMint platform").addCommand(hasuraPauseCommand());
328332
- }
328333
-
328334
- // src/commands/platform/load-balancer/pause.ts
328335
- function loadBalancerPauseCommand() {
328336
- return getPauseCommand({
328337
- name: "evm",
328338
- type: "load balancer",
328339
- alias: "lb",
328340
- envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
328341
- pauseFunction: async (settlemint, id) => {
328342
- return settlemint.loadBalancer.pause(id);
328343
- }
328344
- });
328345
- }
328346
-
328347
- // src/commands/platform/middleware/graph/pause.ts
328348
- function graphMiddlewarePauseCommand() {
328349
- return getPauseCommand({
328350
- name: "graph",
328351
- type: "middleware",
328352
- alias: "gr",
328353
- envKey: "SETTLEMINT_THEGRAPH",
328354
- pauseFunction: async (settlemint, id) => {
328355
- return settlemint.middleware.pause(id);
328356
- }
328357
- });
328358
- }
328359
-
328360
- // src/commands/platform/middleware/smart-contract-portal/pause.ts
328361
- function smartContractPortalMiddlewarePauseCommand() {
328362
- return getPauseCommand({
328363
- name: "smart-contract-portal",
328364
- type: "middleware",
328365
- alias: "scp",
328366
- envKey: "SETTLEMINT_PORTAL",
328367
- pauseFunction: async (settlemint, id) => {
328368
- return settlemint.middleware.pause(id);
328369
- }
328370
- });
328371
- }
328372
-
328373
- // src/commands/platform/middleware/pause.ts
328374
- function middlewarePauseCommand() {
328375
- return new Command("middleware").alias("mw").description("Pause a middleware service in the SettleMint platform").addCommand(graphMiddlewarePauseCommand()).addCommand(smartContractPortalMiddlewarePauseCommand());
328376
- }
328377
-
328378
- // src/commands/platform/private-key/pause.ts
328379
- function privateKeyPauseCommand() {
328380
- return getPauseCommand({
328381
- name: "private-key",
328382
- type: "private key",
328383
- alias: "pk",
328384
- envKey: "SETTLEMINT_ACCESSIBLE_PRIVATE_KEY",
328385
- pauseFunction: async (settlemint, id) => {
328386
- return settlemint.privateKey.pause(id);
328387
- }
328388
- });
328389
- }
328390
-
328391
- // src/commands/platform/storage/ipfs/pause.ts
328392
- function ipfsStoragePauseCommand() {
328393
- return getPauseCommand({
328394
- name: "ipfs",
328395
- type: "storage",
328396
- alias: "ip",
328397
- envKey: "SETTLEMINT_IPFS",
328398
- pauseFunction: async (settlemint, id) => {
328399
- return settlemint.storage.pause(id);
328400
- }
328401
- });
328402
- }
328403
-
328404
- // src/commands/platform/storage/minio/pause.ts
328405
- function minioStoragePauseCommand() {
328406
- return getPauseCommand({
328407
- name: "minio",
328408
- type: "storage",
328409
- alias: "m",
328410
- envKey: "SETTLEMINT_MINIO",
328411
- pauseFunction: async (settlemint, id) => {
328412
- return settlemint.storage.pause(id);
328413
- }
328414
- });
328415
- }
328416
-
328417
- // src/commands/platform/storage/pause.ts
328418
- function storagePauseCommand() {
328419
- return new Command("storage").alias("st").description("Pause a storage service in the SettleMint platform").addCommand(ipfsStoragePauseCommand()).addCommand(minioStoragePauseCommand());
328420
- }
328421
-
328422
- // src/commands/platform/pause.ts
328423
- function pauseCommand() {
328424
- const cmd2 = new Command("pause").description("Pause a resource in the SettleMint platform").addCommand(blockchainNodePauseCommand()).addCommand(blockchainNetworkPauseCommand()).addCommand(customDeploymentPauseCommand()).addCommand(insightsPauseCommand()).addCommand(integrationToolPauseCommand()).addCommand(loadBalancerPauseCommand()).addCommand(middlewarePauseCommand()).addCommand(privateKeyPauseCommand()).addCommand(storagePauseCommand());
328425
- return cmd2;
328426
- }
328427
-
328428
327880
  // src/commands/platform/common/restart-command.ts
328429
327881
  function getRestartCommand({
328430
327882
  name: name3,
328431
327883
  type: type4,
327884
+ subType,
328432
327885
  alias,
328433
327886
  envKey,
328434
327887
  restartFunction,
328435
327888
  usePersonalAccessToken = true
328436
327889
  }) {
328437
327890
  const commandName = sanitizeCommandName(name3);
328438
- const typeCommandName = sanitizeCommandName(type4);
328439
- const exampleCommandPrefix = `platform restart ${typeCommandName !== commandName ? `${typeCommandName} ` : ""}${commandName}`;
328440
327891
  return new Command(commandName).alias(alias).description(`Restart a ${type4} in the SettleMint platform. Provide the ${type4} unique name or use 'default' to restart the default ${type4} from your .env file.`).usage(createExamples([
328441
327892
  {
328442
- description: `Restarts the specified ${type4} by unique name`,
328443
- command: `${exampleCommandPrefix} <unique-name>`
327893
+ description: `Restarts the specified ${type4} by id`,
327894
+ command: `platform restart ${commandName}${subType ? ` ${subType}` : ""} <${type4}-id>`
328444
327895
  },
328445
327896
  {
328446
327897
  description: `Restarts the default ${type4} in the production environment`,
328447
- command: `${exampleCommandPrefix} default --prod`
327898
+ command: `platform restart ${commandName}${subType ? ` ${subType}` : ""} default --prod`
328448
327899
  }
328449
327900
  ])).argument("<unique-name>", `The unique name of the ${type4}, use 'default' to restart the default one from your .env file`).option("-a, --accept-defaults", "Accept the default and previously set values").option("--prod", "Connect to your production environment").option("-w, --wait", "Wait until restarted").action(async (uniqueName, { acceptDefaults, prod, wait: wait2 }) => {
328450
327901
  intro(`Restarting ${type4} in the SettleMint platform`);
@@ -328531,6 +327982,7 @@ function blockscoutRestartCommand() {
328531
327982
  return getRestartCommand({
328532
327983
  name: "blockscout",
328533
327984
  type: "insights",
327985
+ subType: "blockscout",
328534
327986
  alias: "bs",
328535
327987
  envKey: "SETTLEMINT_BLOCKSCOUT",
328536
327988
  restartFunction: async (settlemint, uniqueName) => {
@@ -328549,6 +328001,7 @@ function hasuraRestartCommand() {
328549
328001
  return getRestartCommand({
328550
328002
  name: "hasura",
328551
328003
  type: "integration tool",
328004
+ subType: "hasura",
328552
328005
  alias: "ha",
328553
328006
  envKey: "SETTLEMINT_HASURA",
328554
328007
  restartFunction: async (settlemint, uniqueName) => {
@@ -328580,6 +328033,7 @@ function graphRestartCommand() {
328580
328033
  return getRestartCommand({
328581
328034
  name: "graph",
328582
328035
  type: "middleware",
328036
+ subType: "graph",
328583
328037
  alias: "gr",
328584
328038
  envKey: "SETTLEMINT_THEGRAPH",
328585
328039
  restartFunction: async (settlemint, id) => {
@@ -328593,6 +328047,7 @@ function smartContractPortalRestartCommand() {
328593
328047
  return getRestartCommand({
328594
328048
  name: "smart-contract-portal",
328595
328049
  type: "middleware",
328050
+ subType: "smart-contract-portal",
328596
328051
  alias: "scp",
328597
328052
  envKey: "SETTLEMINT_PORTAL",
328598
328053
  restartFunction: async (settlemint, uniqueName) => {
@@ -328643,236 +328098,6 @@ function restartCommand() {
328643
328098
  return cmd2;
328644
328099
  }
328645
328100
 
328646
- // src/commands/platform/common/resume-command.ts
328647
- function getResumeCommand({
328648
- name: name3,
328649
- type: type4,
328650
- alias,
328651
- envKey,
328652
- resumeFunction,
328653
- usePersonalAccessToken = true
328654
- }) {
328655
- const commandName = sanitizeCommandName(name3);
328656
- const typeCommandName = sanitizeCommandName(type4);
328657
- const exampleCommandPrefix = `platform resume ${typeCommandName !== commandName ? `${typeCommandName} ` : ""}${commandName}`;
328658
- return new Command(commandName).alias(alias).description(`Resume a ${type4} in the SettleMint platform. Provide the ${type4} unique name or use 'default' to resume the default ${type4} from your .env file.`).usage(createExamples([
328659
- {
328660
- description: `Resumes the specified ${type4} by unique name`,
328661
- command: `${exampleCommandPrefix} <unique-name>`
328662
- },
328663
- {
328664
- description: `Resumes the default ${type4} in the production environment`,
328665
- command: `${exampleCommandPrefix} default --prod`
328666
- }
328667
- ])).argument("<unique-name>", `The unique name of the ${type4}, use 'default' to resume the default one from your .env file`).option("-a, --accept-defaults", "Accept the default and previously set values").option("--prod", "Connect to your production environment").option("-w, --wait", "Wait until resumed").action(async (uniqueName, { acceptDefaults, prod, wait: wait2 }) => {
328668
- intro(`Resuming ${type4} in the SettleMint platform`);
328669
- const env2 = await loadEnv(false, !!prod);
328670
- const instance = await instancePrompt({ env: env2, accept: acceptDefaults });
328671
- const accessToken = await getApplicationOrPersonalAccessToken({
328672
- env: env2,
328673
- instance,
328674
- prefer: usePersonalAccessToken ? "personal" : "application"
328675
- });
328676
- const settlemint = createSettleMintClient({
328677
- accessToken,
328678
- instance
328679
- });
328680
- const isDefaultUniqueName = uniqueName === "default";
328681
- const serviceUniqueName = isDefaultUniqueName ? typeof env2[envKey] === "string" ? env2[envKey] : null : uniqueName;
328682
- if (!serviceUniqueName) {
328683
- cancel2(`No default ${type4} found in your .env file. Please provide a valid ${type4} unique name or set a default ${type4} first.`);
328684
- }
328685
- const result = await spinner({
328686
- startMessage: `Resuming ${type4}`,
328687
- task: async () => {
328688
- return resumeFunction(settlemint, serviceUniqueName);
328689
- },
328690
- stopMessage: `${capitalizeFirstLetter2(type4)} resume initiated`
328691
- });
328692
- if (wait2) {
328693
- const isResumed = await waitForCompletion({
328694
- settlemint,
328695
- type: type4,
328696
- uniqueName: serviceUniqueName,
328697
- action: "resume"
328698
- });
328699
- if (!isResumed) {
328700
- throw new Error(`Failed to resume ${type4} ${serviceUniqueName}`);
328701
- }
328702
- }
328703
- outro(`${capitalizeFirstLetter2(type4)} ${result.name} resume initiated successfully`);
328704
- });
328705
- }
328706
-
328707
- // src/commands/platform/blockchain-network/resume.ts
328708
- function blockchainNetworkResumeCommand() {
328709
- return getResumeCommand({
328710
- name: "blockchain-network",
328711
- type: "blockchain network",
328712
- alias: "bnw",
328713
- envKey: "SETTLEMINT_BLOCKCHAIN_NETWORK",
328714
- resumeFunction: async (settlemint, id) => {
328715
- return settlemint.blockchainNetwork.resume(id);
328716
- }
328717
- });
328718
- }
328719
-
328720
- // src/commands/platform/blockchain-node/resume.ts
328721
- function blockchainNodeResumeCommand() {
328722
- return getResumeCommand({
328723
- name: "blockchain-node",
328724
- type: "blockchain node",
328725
- alias: "bn",
328726
- envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
328727
- resumeFunction: async (settlemint, id) => {
328728
- return settlemint.blockchainNode.resume(id);
328729
- }
328730
- });
328731
- }
328732
-
328733
- // src/commands/platform/custom-deployments/resume.ts
328734
- function customDeploymentResumeCommand() {
328735
- return getResumeCommand({
328736
- name: "custom-deployment",
328737
- type: "custom deployment",
328738
- alias: "cd",
328739
- envKey: "SETTLEMINT_CUSTOM_DEPLOYMENT",
328740
- resumeFunction: async (settlemint, id) => {
328741
- return settlemint.customDeployment.resume(id);
328742
- }
328743
- });
328744
- }
328745
-
328746
- // src/commands/platform/insights/blockscout/resume.ts
328747
- function blockscoutResumeCommand() {
328748
- return getResumeCommand({
328749
- name: "blockscout",
328750
- type: "insights",
328751
- alias: "bs",
328752
- envKey: "SETTLEMINT_BLOCKSCOUT",
328753
- resumeFunction: async (settlemint, id) => {
328754
- return settlemint.insights.resume(id);
328755
- }
328756
- });
328757
- }
328758
-
328759
- // src/commands/platform/insights/resume.ts
328760
- function insightsResumeCommand() {
328761
- return new Command("insights").alias("in").description("Resume an insights service in the SettleMint platform").addCommand(blockscoutResumeCommand());
328762
- }
328763
-
328764
- // src/commands/platform/integration-tools/hasura/resume.ts
328765
- function hasuraResumeCommand() {
328766
- return getResumeCommand({
328767
- name: "hasura",
328768
- type: "integration tool",
328769
- alias: "ha",
328770
- envKey: "SETTLEMINT_HASURA",
328771
- resumeFunction: async (settlemint, id) => {
328772
- return settlemint.integrationTool.resume(id);
328773
- }
328774
- });
328775
- }
328776
-
328777
- // src/commands/platform/integration-tools/resume.ts
328778
- function integrationToolResumeCommand() {
328779
- return new Command("integration-tool").alias("it").description("Resume an integration tool service in the SettleMint platform").addCommand(hasuraResumeCommand());
328780
- }
328781
-
328782
- // src/commands/platform/load-balancer/resume.ts
328783
- function loadBalancerResumeCommand() {
328784
- return getResumeCommand({
328785
- name: "load-balancer",
328786
- type: "load balancer",
328787
- alias: "lb",
328788
- envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
328789
- resumeFunction: async (settlemint, id) => {
328790
- return settlemint.loadBalancer.resume(id);
328791
- }
328792
- });
328793
- }
328794
-
328795
- // src/commands/platform/middleware/graph/resume.ts
328796
- function graphMiddlewareResumeCommand() {
328797
- return getResumeCommand({
328798
- name: "graph",
328799
- type: "middleware",
328800
- alias: "gr",
328801
- envKey: "SETTLEMINT_THEGRAPH",
328802
- resumeFunction: async (settlemint, id) => {
328803
- return settlemint.middleware.resume(id);
328804
- }
328805
- });
328806
- }
328807
-
328808
- // src/commands/platform/middleware/smart-contract-portal/resume.ts
328809
- function smartContractPortalMiddlewareResumeCommand() {
328810
- return getResumeCommand({
328811
- name: "smart-contract-portal",
328812
- type: "middleware",
328813
- alias: "scp",
328814
- envKey: "SETTLEMINT_PORTAL",
328815
- resumeFunction: async (settlemint, id) => {
328816
- return settlemint.middleware.resume(id);
328817
- }
328818
- });
328819
- }
328820
-
328821
- // src/commands/platform/middleware/resume.ts
328822
- function middlewareResumeCommand() {
328823
- return new Command("middleware").alias("mw").description("Resume a middleware service in the SettleMint platform").addCommand(graphMiddlewareResumeCommand()).addCommand(smartContractPortalMiddlewareResumeCommand());
328824
- }
328825
-
328826
- // src/commands/platform/private-key/resume.ts
328827
- function privateKeyResumeCommand() {
328828
- return getResumeCommand({
328829
- name: "private-key",
328830
- type: "private key",
328831
- alias: "pk",
328832
- envKey: "SETTLEMINT_ACCESSIBLE_PRIVATE_KEY",
328833
- resumeFunction: async (settlemint, id) => {
328834
- return settlemint.privateKey.resume(id);
328835
- }
328836
- });
328837
- }
328838
-
328839
- // src/commands/platform/storage/ipfs/resume.ts
328840
- function ipfsStorageResumeCommand() {
328841
- return getResumeCommand({
328842
- name: "ipfs",
328843
- type: "storage",
328844
- alias: "ip",
328845
- envKey: "SETTLEMINT_IPFS",
328846
- resumeFunction: async (settlemint, id) => {
328847
- return settlemint.storage.resume(id);
328848
- }
328849
- });
328850
- }
328851
-
328852
- // src/commands/platform/storage/minio/resume.ts
328853
- function minioStorageResumeCommand() {
328854
- return getResumeCommand({
328855
- name: "minio",
328856
- type: "storage",
328857
- alias: "m",
328858
- envKey: "SETTLEMINT_MINIO",
328859
- resumeFunction: async (settlemint, id) => {
328860
- return settlemint.storage.resume(id);
328861
- }
328862
- });
328863
- }
328864
-
328865
- // src/commands/platform/storage/resume.ts
328866
- function storageResumeCommand() {
328867
- return new Command("storage").alias("st").description("Resume a storage service in the SettleMint platform").addCommand(ipfsStorageResumeCommand()).addCommand(minioStorageResumeCommand());
328868
- }
328869
-
328870
- // src/commands/platform/resume.ts
328871
- function resumeCommand() {
328872
- const cmd2 = new Command("resume").description("Resume a resource in the SettleMint platform").addCommand(blockchainNodeResumeCommand()).addCommand(blockchainNetworkResumeCommand()).addCommand(customDeploymentResumeCommand()).addCommand(insightsResumeCommand()).addCommand(integrationToolResumeCommand()).addCommand(loadBalancerResumeCommand()).addCommand(middlewareResumeCommand()).addCommand(privateKeyResumeCommand()).addCommand(storageResumeCommand());
328873
- return cmd2;
328874
- }
328875
-
328876
328101
  // src/commands/platform/custom-deployments/update.ts
328877
328102
  function customDeploymentsUpdateCommand() {
328878
328103
  return new Command("custom-deployment").alias("cd").argument("<tag>", "The tag to update the custom deployment to").option("--unique-name <uniqueName>", "The unique name of the custom deployment to update. If not provided, will use SETTLEMINT_CUSTOM_DEPLOYMENT from env").option("--prod", "Connect to your production environment").option("--wait", "Wait for the custom deployment to be redeployed").description("Update a custom deployment in the SettleMint platform").usage(createExamples([
@@ -329263,7 +328488,7 @@ function servicesCommand() {
329263
328488
  if (!applicationUniqueName) {
329264
328489
  return nothingSelectedError("application");
329265
328490
  }
329266
- let effectiveTypes;
328491
+ let effectiveTypes = undefined;
329267
328492
  if (options.type && options.type.length > 0) {
329268
328493
  effectiveTypes = options.type;
329269
328494
  } else if (typeOperands && typeOperands.length > 0) {
@@ -329321,7 +328546,7 @@ async function getServicesAndMapResults({
329321
328546
  const application = await settlemint.application.read(applicationUniqueName);
329322
328547
  const services = await servicesSpinner(settlemint, applicationUniqueName, types4);
329323
328548
  const results = (types4 ?? SERVICE_TYPES).filter((serviceType) => !types4 || types4.includes(serviceType)).map((serviceType) => {
329324
- const [_6, labels] = Object.entries(LABELS_MAP).find(([_key, value4]) => value4.command === serviceType) ?? [
328549
+ const [_6, labels] = Object.entries(LABELS_MAP).find(([key2, value4]) => value4.command === serviceType) ?? [
329325
328550
  null,
329326
328551
  { plural: serviceType }
329327
328552
  ];
@@ -329448,7 +328673,7 @@ function listCommand() {
329448
328673
 
329449
328674
  // src/commands/platform.ts
329450
328675
  function platformCommand() {
329451
- return new Command("platform").description("Manage SettleMint platform resources").addCommand(configCommand()).addCommand(createCommand3()).addCommand(deleteCommand()).addCommand(listCommand()).addCommand(pauseCommand()).addCommand(resumeCommand()).addCommand(restartCommand()).addCommand(updateCommand());
328676
+ return new Command("platform").description("Manage SettleMint platform resources").addCommand(configCommand()).addCommand(createCommand3()).addCommand(deleteCommand()).addCommand(listCommand()).addCommand(restartCommand()).addCommand(updateCommand());
329452
328677
  }
329453
328678
 
329454
328679
  // src/commands/smart-contract-set/create.ts
@@ -329498,7 +328723,7 @@ var import_which = __toESM(require_lib5(), 1);
329498
328723
  async function executeFoundryCommand(command, args) {
329499
328724
  try {
329500
328725
  await import_which.default(command);
329501
- } catch (_error) {
328726
+ } catch (error45) {
329502
328727
  cancel2("Foundry is not installed. Instructions to install Foundry can be found here: https://book.getfoundry.sh/getting-started/installation");
329503
328728
  }
329504
328729
  return executeCommand(command, args);
@@ -329586,7 +328811,7 @@ function foundryBuildCommand() {
329586
328811
  description: "Build the smart contracts with additional Forge options",
329587
328812
  command: "scs foundry build --optimize --force"
329588
328813
  }
329589
- ])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).arguments("[operands...]").action(async (operands, options, _cmd) => {
328814
+ ])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).arguments("[operands...]").action(async (operands, options, cmd2) => {
329590
328815
  intro("Building smart contracts using Foundry");
329591
328816
  const forgeOptions = mapPassthroughOptions(options, { args: operands });
329592
328817
  await executeFoundryCommand("forge", ["build", ...forgeOptions]);
@@ -329609,7 +328834,7 @@ function foundryFormatCommand() {
329609
328834
  description: "Format the smart contracts with additional Forge options",
329610
328835
  command: "scs foundry format --check"
329611
328836
  }
329612
- ])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).arguments("[operands...]").action(async (operands, options, _cmd) => {
328837
+ ])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).arguments("[operands...]").action(async (operands, options, cmd2) => {
329613
328838
  intro("Formatting smart contracts using Foundry");
329614
328839
  const forgeOptions = mapPassthroughOptions(options, { args: operands });
329615
328840
  await executeFoundryCommand("forge", ["fmt", ...forgeOptions]);
@@ -329632,7 +328857,7 @@ function foundryNetworkCommand() {
329632
328857
  description: "Start a development network using Foundry with a specific port",
329633
328858
  command: "scs foundry network --port 3000"
329634
328859
  }
329635
- ])).helpOption(false).option("-h, --help", "Get list of possible anvil options").passThroughOptions().allowUnknownOption(true).arguments("[operands...]").action(async (operands, options, _cmd) => {
328860
+ ])).helpOption(false).option("-h, --help", "Get list of possible anvil options").passThroughOptions().allowUnknownOption(true).arguments("[operands...]").action(async (operands, options, cmd2) => {
329636
328861
  const anvilOptions = mapPassthroughOptions(options, { args: operands });
329637
328862
  await executeFoundryCommand("anvil", anvilOptions);
329638
328863
  });
@@ -329653,7 +328878,7 @@ function foundryTestCommand() {
329653
328878
  description: "Run a specific test function",
329654
328879
  command: "scs foundry test --match-test testToken"
329655
328880
  }
329656
- ])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).arguments("[operands...]").action(async (operands, options, _cmd) => {
328881
+ ])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).arguments("[operands...]").action(async (operands, options, cmd2) => {
329657
328882
  intro("Running smart contract tests using Foundry");
329658
328883
  const forgeOptions = mapPassthroughOptions(options, { args: operands });
329659
328884
  await executeFoundryCommand("forge", ["test", ...forgeOptions]);
@@ -329667,7 +328892,7 @@ var validateIfRequiredPackagesAreInstalled = async (packages, cwd2) => {
329667
328892
  try {
329668
328893
  const isInstalled = await isPackageInstalled(pkg, cwd2);
329669
328894
  return { packageName: pkg, isInstalled };
329670
- } catch (_err) {
328895
+ } catch (err) {
329671
328896
  return { packageName: pkg, isInstalled: false };
329672
328897
  }
329673
328898
  }));
@@ -329692,7 +328917,7 @@ function hardhatBuildCommand() {
329692
328917
  description: "Build the smart contracts using additional options to the Hardhat compile command",
329693
328918
  command: "scs hardhat build --concurrency 2"
329694
328919
  }
329695
- ])).helpOption(false).option("-h, --help", "Get list of possible hardhat compile options").passThroughOptions().allowUnknownOption(true).arguments("[operands...]").action(async (operands, options, _cmd) => {
328920
+ ])).helpOption(false).option("-h, --help", "Get list of possible hardhat compile options").passThroughOptions().allowUnknownOption(true).arguments("[operands...]").action(async (operands, options, cmd2) => {
329696
328921
  intro("Building smart contracts using Hardhat");
329697
328922
  await validateIfRequiredPackagesAreInstalled(["hardhat"]);
329698
328923
  const hardhatOptions = mapPassthroughOptions(options, { args: operands });
@@ -329763,7 +328988,7 @@ async function selectTargetNode({
329763
328988
  settlemint
329764
328989
  }) {
329765
328990
  const nodeUniqueName = blockchainNodeUniqueName ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NODE : undefined);
329766
- let node;
328991
+ let node = undefined;
329767
328992
  if (!nodeUniqueName) {
329768
328993
  if (!env2.SETTLEMINT_APPLICATION) {
329769
328994
  return missingApplication();
@@ -329987,7 +329212,7 @@ function hardhatDeployRemoteCommand() {
329987
329212
  } else {
329988
329213
  note("Smart contract deployment was cancelled");
329989
329214
  }
329990
- } catch (_error) {
329215
+ } catch (error45) {
329991
329216
  cancel2("The smart contract deployment was unsuccessful. Please check the error details above and try again. You may need to review your contract code or deployment configuration.");
329992
329217
  }
329993
329218
  });
@@ -330017,7 +329242,7 @@ function hardhatNetworkCommand() {
330017
329242
  description: "Start a development network using Hardhat with a specific port",
330018
329243
  command: "scs hardhat network --port 3000"
330019
329244
  }
330020
- ])).helpOption(false).option("-h, --help", "Get list of possible hardhat node options").passThroughOptions().allowUnknownOption(true).arguments("[operands...]").action(async (operands, options, _cmd) => {
329245
+ ])).helpOption(false).option("-h, --help", "Get list of possible hardhat node options").passThroughOptions().allowUnknownOption(true).arguments("[operands...]").action(async (operands, options, cmd2) => {
330021
329246
  intro("Starting development network using Hardhat");
330022
329247
  await validateIfRequiredPackagesAreInstalled(["hardhat"]);
330023
329248
  const hardhatOptions = mapPassthroughOptions(options, { args: operands });
@@ -330126,7 +329351,7 @@ function hardhatTestCommand() {
330126
329351
  description: "Run a specific test file",
330127
329352
  command: "scs hardhat test test/token.test.ts"
330128
329353
  }
330129
- ])).helpOption(false).option("-h, --help", "Get list of possible hardhat test options").passThroughOptions().allowUnknownOption(true).arguments("[operands...]").action(async (operands, options, _cmd) => {
329354
+ ])).helpOption(false).option("-h, --help", "Get list of possible hardhat test options").passThroughOptions().allowUnknownOption(true).arguments("[operands...]").action(async (operands, options, cmd2) => {
330130
329355
  intro("Running smart contract tests using Hardhat");
330131
329356
  await validateIfRequiredPackagesAreInstalled(["hardhat"]);
330132
329357
  const hardhatOptions = mapPassthroughOptions(options, { args: operands });
@@ -330384,12 +329609,12 @@ async function getNodeName({
330384
329609
 
330385
329610
  // src/commands/smart-contract-set/subgraph/build.ts
330386
329611
  function subgraphBuildCommand() {
330387
- return new Command("build").description("Build the subgraph").option("--ipfs <ipfs-url>", "The IPFS URL to use for the subgraph deployment").usage(createExamples([
329612
+ return new Command("build").description("Build the subgraph").usage(createExamples([
330388
329613
  {
330389
329614
  description: "Build the subgraph",
330390
329615
  command: "scs subgraph build"
330391
329616
  }
330392
- ])).action(async ({ ipfs }) => {
329617
+ ])).action(async () => {
330393
329618
  intro("Building subgraph");
330394
329619
  await validateIfRequiredPackagesAreInstalled(["@graphprotocol/graph-cli"]);
330395
329620
  await subgraphSetup({
@@ -330398,7 +329623,7 @@ function subgraphBuildCommand() {
330398
329623
  const { command, args } = await getPackageManagerExecutable();
330399
329624
  const subgraphYamlFile = await getSubgraphYamlFile();
330400
329625
  await executeCommand(command, [...args, "graph", "codegen", subgraphYamlFile]);
330401
- await executeCommand(command, [...args, "graph", "build", ...ipfs ? ["--ipfs", ipfs] : [], subgraphYamlFile]);
329626
+ await executeCommand(command, [...args, "graph", "build", subgraphYamlFile]);
330402
329627
  outro("Subgraph built successfully");
330403
329628
  });
330404
329629
  }
@@ -330794,4 +330019,4 @@ async function sdkCliCommand(argv = process.argv) {
330794
330019
  // src/cli.ts
330795
330020
  sdkCliCommand();
330796
330021
 
330797
- //# debugId=93BE7E1BD62375F564756E2164756E21
330022
+ //# debugId=752E0471C745FE3A64756E2164756E21