@settlemint/sdk-cli 2.1.4-pre91fc413 → 2.1.4-prf0b81bca

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 +1289 -722
  2. package/dist/cli.js.map +73 -65
  3. package/package.json +3 -3
package/dist/cli.js CHANGED
@@ -837,7 +837,7 @@ var require_dist2 = __commonJS((exports) => {
837
837
  // ../../node_modules/@dotenvx/dotenvx/package.json
838
838
  var require_package = __commonJS((exports, module) => {
839
839
  module.exports = {
840
- version: "1.39.1",
840
+ version: "1.41.0",
841
841
  name: "@dotenvx/dotenvx",
842
842
  description: "a better dotenv–from the creator of `dotenv`",
843
843
  author: "@motdotla",
@@ -1086,7 +1086,7 @@ var require_logger = __commonJS((exports, module) => {
1086
1086
  // ../../node_modules/fdir/dist/utils.js
1087
1087
  var require_utils = __commonJS((exports) => {
1088
1088
  Object.defineProperty(exports, "__esModule", { value: true });
1089
- exports.normalizePath = exports.convertSlashes = exports.cleanPath = undefined;
1089
+ exports.normalizePath = exports.isRootDirectory = exports.convertSlashes = exports.cleanPath = undefined;
1090
1090
  var path_1 = __require("path");
1091
1091
  function cleanPath(path) {
1092
1092
  let normalized = (0, path_1.normalize)(path);
@@ -1100,6 +1100,10 @@ var require_utils = __commonJS((exports) => {
1100
1100
  return path.replace(SLASHES_REGEX, separator);
1101
1101
  }
1102
1102
  exports.convertSlashes = convertSlashes;
1103
+ function isRootDirectory(path) {
1104
+ return path === "/" || /^[a-z]:\\$/i.test(path);
1105
+ }
1106
+ exports.isRootDirectory = isRootDirectory;
1103
1107
  function normalizePath(path, options) {
1104
1108
  const { resolvePaths, normalizePath: normalizePath2, pathSeparator } = options;
1105
1109
  const pathNeedsCleaning = process.platform === "win32" && path.includes("/") || path.startsWith(".");
@@ -1523,7 +1527,7 @@ var require_walker = __commonJS((exports) => {
1523
1527
  this.callbackInvoker = invokeCallback.build(options, this.isSynchronous);
1524
1528
  this.root = (0, utils_1.normalizePath)(root, options);
1525
1529
  this.state = {
1526
- root: this.root.slice(0, -1),
1530
+ root: (0, utils_1.isRootDirectory)(this.root) ? this.root : this.root.slice(0, -1),
1527
1531
  paths: [""].slice(0, 0),
1528
1532
  groups: [],
1529
1533
  counts: new counter_1.Counter,
@@ -4232,7 +4236,7 @@ var require_utils4 = __commonJS((exports) => {
4232
4236
  exports.wrapXOFConstructorWithOpts = wrapXOFConstructorWithOpts;
4233
4237
  exports.randomBytes = randomBytes;
4234
4238
  var crypto_1 = require_cryptoNode2();
4235
- var _assert_js_1 = require__assert2();
4239
+ var _assert_ts_1 = require__assert2();
4236
4240
  function isBytes(a) {
4237
4241
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
4238
4242
  }
@@ -4261,9 +4265,12 @@ var require_utils4 = __commonJS((exports) => {
4261
4265
  arr[i] = byteSwap(arr[i]);
4262
4266
  }
4263
4267
  }
4268
+ var hasHexBuiltin = typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function";
4264
4269
  var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
4265
4270
  function bytesToHex(bytes) {
4266
- (0, _assert_js_1.abytes)(bytes);
4271
+ (0, _assert_ts_1.abytes)(bytes);
4272
+ if (hasHexBuiltin)
4273
+ return bytes.toHex();
4267
4274
  let hex = "";
4268
4275
  for (let i = 0;i < bytes.length; i++) {
4269
4276
  hex += hexes[bytes[i]];
@@ -4283,6 +4290,8 @@ var require_utils4 = __commonJS((exports) => {
4283
4290
  function hexToBytes(hex) {
4284
4291
  if (typeof hex !== "string")
4285
4292
  throw new Error("hex string expected, got " + typeof hex);
4293
+ if (hasHexBuiltin)
4294
+ return Uint8Array.fromHex(hex);
4286
4295
  const hl = hex.length;
4287
4296
  const al = hl / 2;
4288
4297
  if (hl % 2)
@@ -4320,14 +4329,14 @@ var require_utils4 = __commonJS((exports) => {
4320
4329
  function toBytes(data) {
4321
4330
  if (typeof data === "string")
4322
4331
  data = utf8ToBytes(data);
4323
- (0, _assert_js_1.abytes)(data);
4332
+ (0, _assert_ts_1.abytes)(data);
4324
4333
  return data;
4325
4334
  }
4326
4335
  function concatBytes(...arrays) {
4327
4336
  let sum = 0;
4328
4337
  for (let i = 0;i < arrays.length; i++) {
4329
4338
  const a = arrays[i];
4330
- (0, _assert_js_1.abytes)(a);
4339
+ (0, _assert_ts_1.abytes)(a);
4331
4340
  sum += a.length;
4332
4341
  }
4333
4342
  const res = new Uint8Array(sum);
@@ -4380,7 +4389,7 @@ var require_utils4 = __commonJS((exports) => {
4380
4389
  return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
4381
4390
  }
4382
4391
  if (crypto_1.crypto && typeof crypto_1.crypto.randomBytes === "function") {
4383
- return crypto_1.crypto.randomBytes(bytesLength);
4392
+ return Uint8Array.from(crypto_1.crypto.randomBytes(bytesLength));
4384
4393
  }
4385
4394
  throw new Error("crypto.getRandomValues must be defined");
4386
4395
  }
@@ -4393,8 +4402,8 @@ var require__md = __commonJS((exports) => {
4393
4402
  exports.setBigUint64 = setBigUint64;
4394
4403
  exports.Chi = Chi;
4395
4404
  exports.Maj = Maj;
4396
- var _assert_js_1 = require__assert2();
4397
- var utils_js_1 = require_utils4();
4405
+ var _assert_ts_1 = require__assert2();
4406
+ var utils_ts_1 = require_utils4();
4398
4407
  function setBigUint64(view, byteOffset, value, isLE) {
4399
4408
  if (typeof view.setBigUint64 === "function")
4400
4409
  return view.setBigUint64(byteOffset, value, isLE);
@@ -4414,29 +4423,29 @@ var require__md = __commonJS((exports) => {
4414
4423
  return a & b ^ a & c ^ b & c;
4415
4424
  }
4416
4425
 
4417
- class HashMD extends utils_js_1.Hash {
4426
+ class HashMD extends utils_ts_1.Hash {
4418
4427
  constructor(blockLen, outputLen, padOffset, isLE) {
4419
4428
  super();
4420
- this.blockLen = blockLen;
4421
- this.outputLen = outputLen;
4422
- this.padOffset = padOffset;
4423
- this.isLE = isLE;
4424
4429
  this.finished = false;
4425
4430
  this.length = 0;
4426
4431
  this.pos = 0;
4427
4432
  this.destroyed = false;
4433
+ this.blockLen = blockLen;
4434
+ this.outputLen = outputLen;
4435
+ this.padOffset = padOffset;
4436
+ this.isLE = isLE;
4428
4437
  this.buffer = new Uint8Array(blockLen);
4429
- this.view = (0, utils_js_1.createView)(this.buffer);
4438
+ this.view = (0, utils_ts_1.createView)(this.buffer);
4430
4439
  }
4431
4440
  update(data) {
4432
- (0, _assert_js_1.aexists)(this);
4441
+ (0, _assert_ts_1.aexists)(this);
4433
4442
  const { view, buffer, blockLen } = this;
4434
- data = (0, utils_js_1.toBytes)(data);
4443
+ data = (0, utils_ts_1.toBytes)(data);
4435
4444
  const len = data.length;
4436
4445
  for (let pos = 0;pos < len; ) {
4437
4446
  const take = Math.min(blockLen - this.pos, len - pos);
4438
4447
  if (take === blockLen) {
4439
- const dataView = (0, utils_js_1.createView)(data);
4448
+ const dataView = (0, utils_ts_1.createView)(data);
4440
4449
  for (;blockLen <= len - pos; pos += blockLen)
4441
4450
  this.process(dataView, pos);
4442
4451
  continue;
@@ -4454,8 +4463,8 @@ var require__md = __commonJS((exports) => {
4454
4463
  return this;
4455
4464
  }
4456
4465
  digestInto(out) {
4457
- (0, _assert_js_1.aexists)(this);
4458
- (0, _assert_js_1.aoutput)(out, this);
4466
+ (0, _assert_ts_1.aexists)(this);
4467
+ (0, _assert_ts_1.aoutput)(out, this);
4459
4468
  this.finished = true;
4460
4469
  const { buffer, view, blockLen, isLE } = this;
4461
4470
  let { pos } = this;
@@ -4469,7 +4478,7 @@ var require__md = __commonJS((exports) => {
4469
4478
  buffer[i] = 0;
4470
4479
  setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
4471
4480
  this.process(view, 0);
4472
- const oview = (0, utils_js_1.createView)(out);
4481
+ const oview = (0, utils_ts_1.createView)(out);
4473
4482
  const len = this.outputLen;
4474
4483
  if (len % 4)
4475
4484
  throw new Error("_sha2: outputLen should be aligned to 32bit");
@@ -4503,6 +4512,178 @@ var require__md = __commonJS((exports) => {
4503
4512
  exports.HashMD = HashMD;
4504
4513
  });
4505
4514
 
4515
+ // ../../node_modules/@noble/hashes/sha256.js
4516
+ var require_sha256 = __commonJS((exports) => {
4517
+ Object.defineProperty(exports, "__esModule", { value: true });
4518
+ exports.sha224 = exports.sha256 = exports.SHA256 = undefined;
4519
+ var _md_ts_1 = require__md();
4520
+ var utils_ts_1 = require_utils4();
4521
+ var SHA256_K = /* @__PURE__ */ new Uint32Array([
4522
+ 1116352408,
4523
+ 1899447441,
4524
+ 3049323471,
4525
+ 3921009573,
4526
+ 961987163,
4527
+ 1508970993,
4528
+ 2453635748,
4529
+ 2870763221,
4530
+ 3624381080,
4531
+ 310598401,
4532
+ 607225278,
4533
+ 1426881987,
4534
+ 1925078388,
4535
+ 2162078206,
4536
+ 2614888103,
4537
+ 3248222580,
4538
+ 3835390401,
4539
+ 4022224774,
4540
+ 264347078,
4541
+ 604807628,
4542
+ 770255983,
4543
+ 1249150122,
4544
+ 1555081692,
4545
+ 1996064986,
4546
+ 2554220882,
4547
+ 2821834349,
4548
+ 2952996808,
4549
+ 3210313671,
4550
+ 3336571891,
4551
+ 3584528711,
4552
+ 113926993,
4553
+ 338241895,
4554
+ 666307205,
4555
+ 773529912,
4556
+ 1294757372,
4557
+ 1396182291,
4558
+ 1695183700,
4559
+ 1986661051,
4560
+ 2177026350,
4561
+ 2456956037,
4562
+ 2730485921,
4563
+ 2820302411,
4564
+ 3259730800,
4565
+ 3345764771,
4566
+ 3516065817,
4567
+ 3600352804,
4568
+ 4094571909,
4569
+ 275423344,
4570
+ 430227734,
4571
+ 506948616,
4572
+ 659060556,
4573
+ 883997877,
4574
+ 958139571,
4575
+ 1322822218,
4576
+ 1537002063,
4577
+ 1747873779,
4578
+ 1955562222,
4579
+ 2024104815,
4580
+ 2227730452,
4581
+ 2361852424,
4582
+ 2428436474,
4583
+ 2756734187,
4584
+ 3204031479,
4585
+ 3329325298
4586
+ ]);
4587
+ var SHA256_IV = /* @__PURE__ */ new Uint32Array([
4588
+ 1779033703,
4589
+ 3144134277,
4590
+ 1013904242,
4591
+ 2773480762,
4592
+ 1359893119,
4593
+ 2600822924,
4594
+ 528734635,
4595
+ 1541459225
4596
+ ]);
4597
+ var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
4598
+
4599
+ class SHA256 extends _md_ts_1.HashMD {
4600
+ constructor(outputLen = 32) {
4601
+ super(64, outputLen, 8, false);
4602
+ this.A = SHA256_IV[0] | 0;
4603
+ this.B = SHA256_IV[1] | 0;
4604
+ this.C = SHA256_IV[2] | 0;
4605
+ this.D = SHA256_IV[3] | 0;
4606
+ this.E = SHA256_IV[4] | 0;
4607
+ this.F = SHA256_IV[5] | 0;
4608
+ this.G = SHA256_IV[6] | 0;
4609
+ this.H = SHA256_IV[7] | 0;
4610
+ }
4611
+ get() {
4612
+ const { A, B, C, D, E, F, G, H } = this;
4613
+ return [A, B, C, D, E, F, G, H];
4614
+ }
4615
+ set(A, B, C, D, E, F, G, H) {
4616
+ this.A = A | 0;
4617
+ this.B = B | 0;
4618
+ this.C = C | 0;
4619
+ this.D = D | 0;
4620
+ this.E = E | 0;
4621
+ this.F = F | 0;
4622
+ this.G = G | 0;
4623
+ this.H = H | 0;
4624
+ }
4625
+ process(view, offset) {
4626
+ for (let i = 0;i < 16; i++, offset += 4)
4627
+ SHA256_W[i] = view.getUint32(offset, false);
4628
+ for (let i = 16;i < 64; i++) {
4629
+ const W15 = SHA256_W[i - 15];
4630
+ const W2 = SHA256_W[i - 2];
4631
+ const s0 = (0, utils_ts_1.rotr)(W15, 7) ^ (0, utils_ts_1.rotr)(W15, 18) ^ W15 >>> 3;
4632
+ const s1 = (0, utils_ts_1.rotr)(W2, 17) ^ (0, utils_ts_1.rotr)(W2, 19) ^ W2 >>> 10;
4633
+ SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
4634
+ }
4635
+ let { A, B, C, D, E, F, G, H } = this;
4636
+ for (let i = 0;i < 64; i++) {
4637
+ const sigma1 = (0, utils_ts_1.rotr)(E, 6) ^ (0, utils_ts_1.rotr)(E, 11) ^ (0, utils_ts_1.rotr)(E, 25);
4638
+ const T1 = H + sigma1 + (0, _md_ts_1.Chi)(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
4639
+ const sigma0 = (0, utils_ts_1.rotr)(A, 2) ^ (0, utils_ts_1.rotr)(A, 13) ^ (0, utils_ts_1.rotr)(A, 22);
4640
+ const T2 = sigma0 + (0, _md_ts_1.Maj)(A, B, C) | 0;
4641
+ H = G;
4642
+ G = F;
4643
+ F = E;
4644
+ E = D + T1 | 0;
4645
+ D = C;
4646
+ C = B;
4647
+ B = A;
4648
+ A = T1 + T2 | 0;
4649
+ }
4650
+ A = A + this.A | 0;
4651
+ B = B + this.B | 0;
4652
+ C = C + this.C | 0;
4653
+ D = D + this.D | 0;
4654
+ E = E + this.E | 0;
4655
+ F = F + this.F | 0;
4656
+ G = G + this.G | 0;
4657
+ H = H + this.H | 0;
4658
+ this.set(A, B, C, D, E, F, G, H);
4659
+ }
4660
+ roundClean() {
4661
+ SHA256_W.fill(0);
4662
+ }
4663
+ destroy() {
4664
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
4665
+ this.buffer.fill(0);
4666
+ }
4667
+ }
4668
+ exports.SHA256 = SHA256;
4669
+
4670
+ class SHA224 extends SHA256 {
4671
+ constructor() {
4672
+ super(28);
4673
+ this.A = 3238371032 | 0;
4674
+ this.B = 914150663 | 0;
4675
+ this.C = 812702999 | 0;
4676
+ this.D = 4144912697 | 0;
4677
+ this.E = 4290775857 | 0;
4678
+ this.F = 1750603025 | 0;
4679
+ this.G = 1694076839 | 0;
4680
+ this.H = 3204075428 | 0;
4681
+ }
4682
+ }
4683
+ exports.sha256 = (0, utils_ts_1.wrapConstructor)(() => new SHA256);
4684
+ exports.sha224 = (0, utils_ts_1.wrapConstructor)(() => new SHA224);
4685
+ });
4686
+
4506
4687
  // ../../node_modules/@noble/hashes/_u64.js
4507
4688
  var require__u64 = __commonJS((exports) => {
4508
4689
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -4599,10 +4780,10 @@ var require__u64 = __commonJS((exports) => {
4599
4780
  var require_sha512 = __commonJS((exports) => {
4600
4781
  Object.defineProperty(exports, "__esModule", { value: true });
4601
4782
  exports.sha384 = exports.sha512_256 = exports.sha512_224 = exports.sha512 = exports.SHA384 = exports.SHA512_256 = exports.SHA512_224 = exports.SHA512 = undefined;
4602
- var _md_js_1 = require__md();
4603
- var _u64_js_1 = require__u64();
4604
- var utils_js_1 = require_utils4();
4605
- var [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => _u64_js_1.default.split([
4783
+ var _md_ts_1 = require__md();
4784
+ var _u64_ts_1 = require__u64();
4785
+ var utils_ts_1 = require_utils4();
4786
+ var [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => _u64_ts_1.default.split([
4606
4787
  "0x428a2f98d728ae22",
4607
4788
  "0x7137449123ef65cd",
4608
4789
  "0xb5c0fbcfec4d3b2f",
@@ -4687,9 +4868,9 @@ var require_sha512 = __commonJS((exports) => {
4687
4868
  var SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
4688
4869
  var SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
4689
4870
 
4690
- class SHA512 extends _md_js_1.HashMD {
4691
- constructor() {
4692
- super(128, 64, 16, false);
4871
+ class SHA512 extends _md_ts_1.HashMD {
4872
+ constructor(outputLen = 64) {
4873
+ super(128, outputLen, 16, false);
4693
4874
  this.Ah = 1779033703 | 0;
4694
4875
  this.Al = 4089235720 | 0;
4695
4876
  this.Bh = 3144134277 | 0;
@@ -4737,28 +4918,28 @@ var require_sha512 = __commonJS((exports) => {
4737
4918
  for (let i = 16;i < 80; i++) {
4738
4919
  const W15h = SHA512_W_H[i - 15] | 0;
4739
4920
  const W15l = SHA512_W_L[i - 15] | 0;
4740
- const s0h = _u64_js_1.default.rotrSH(W15h, W15l, 1) ^ _u64_js_1.default.rotrSH(W15h, W15l, 8) ^ _u64_js_1.default.shrSH(W15h, W15l, 7);
4741
- const s0l = _u64_js_1.default.rotrSL(W15h, W15l, 1) ^ _u64_js_1.default.rotrSL(W15h, W15l, 8) ^ _u64_js_1.default.shrSL(W15h, W15l, 7);
4921
+ const s0h = _u64_ts_1.default.rotrSH(W15h, W15l, 1) ^ _u64_ts_1.default.rotrSH(W15h, W15l, 8) ^ _u64_ts_1.default.shrSH(W15h, W15l, 7);
4922
+ const s0l = _u64_ts_1.default.rotrSL(W15h, W15l, 1) ^ _u64_ts_1.default.rotrSL(W15h, W15l, 8) ^ _u64_ts_1.default.shrSL(W15h, W15l, 7);
4742
4923
  const W2h = SHA512_W_H[i - 2] | 0;
4743
4924
  const W2l = SHA512_W_L[i - 2] | 0;
4744
- const s1h = _u64_js_1.default.rotrSH(W2h, W2l, 19) ^ _u64_js_1.default.rotrBH(W2h, W2l, 61) ^ _u64_js_1.default.shrSH(W2h, W2l, 6);
4745
- const s1l = _u64_js_1.default.rotrSL(W2h, W2l, 19) ^ _u64_js_1.default.rotrBL(W2h, W2l, 61) ^ _u64_js_1.default.shrSL(W2h, W2l, 6);
4746
- const SUMl = _u64_js_1.default.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
4747
- const SUMh = _u64_js_1.default.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
4925
+ const s1h = _u64_ts_1.default.rotrSH(W2h, W2l, 19) ^ _u64_ts_1.default.rotrBH(W2h, W2l, 61) ^ _u64_ts_1.default.shrSH(W2h, W2l, 6);
4926
+ const s1l = _u64_ts_1.default.rotrSL(W2h, W2l, 19) ^ _u64_ts_1.default.rotrBL(W2h, W2l, 61) ^ _u64_ts_1.default.shrSL(W2h, W2l, 6);
4927
+ const SUMl = _u64_ts_1.default.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
4928
+ const SUMh = _u64_ts_1.default.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
4748
4929
  SHA512_W_H[i] = SUMh | 0;
4749
4930
  SHA512_W_L[i] = SUMl | 0;
4750
4931
  }
4751
4932
  let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
4752
4933
  for (let i = 0;i < 80; i++) {
4753
- const sigma1h = _u64_js_1.default.rotrSH(Eh, El, 14) ^ _u64_js_1.default.rotrSH(Eh, El, 18) ^ _u64_js_1.default.rotrBH(Eh, El, 41);
4754
- const sigma1l = _u64_js_1.default.rotrSL(Eh, El, 14) ^ _u64_js_1.default.rotrSL(Eh, El, 18) ^ _u64_js_1.default.rotrBL(Eh, El, 41);
4934
+ const sigma1h = _u64_ts_1.default.rotrSH(Eh, El, 14) ^ _u64_ts_1.default.rotrSH(Eh, El, 18) ^ _u64_ts_1.default.rotrBH(Eh, El, 41);
4935
+ const sigma1l = _u64_ts_1.default.rotrSL(Eh, El, 14) ^ _u64_ts_1.default.rotrSL(Eh, El, 18) ^ _u64_ts_1.default.rotrBL(Eh, El, 41);
4755
4936
  const CHIh = Eh & Fh ^ ~Eh & Gh;
4756
4937
  const CHIl = El & Fl ^ ~El & Gl;
4757
- const T1ll = _u64_js_1.default.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
4758
- const T1h = _u64_js_1.default.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
4938
+ const T1ll = _u64_ts_1.default.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
4939
+ const T1h = _u64_ts_1.default.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
4759
4940
  const T1l = T1ll | 0;
4760
- const sigma0h = _u64_js_1.default.rotrSH(Ah, Al, 28) ^ _u64_js_1.default.rotrBH(Ah, Al, 34) ^ _u64_js_1.default.rotrBH(Ah, Al, 39);
4761
- const sigma0l = _u64_js_1.default.rotrSL(Ah, Al, 28) ^ _u64_js_1.default.rotrBL(Ah, Al, 34) ^ _u64_js_1.default.rotrBL(Ah, Al, 39);
4941
+ const sigma0h = _u64_ts_1.default.rotrSH(Ah, Al, 28) ^ _u64_ts_1.default.rotrBH(Ah, Al, 34) ^ _u64_ts_1.default.rotrBH(Ah, Al, 39);
4942
+ const sigma0l = _u64_ts_1.default.rotrSL(Ah, Al, 28) ^ _u64_ts_1.default.rotrBL(Ah, Al, 34) ^ _u64_ts_1.default.rotrBL(Ah, Al, 39);
4762
4943
  const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch;
4763
4944
  const MAJl = Al & Bl ^ Al & Cl ^ Bl & Cl;
4764
4945
  Hh = Gh | 0;
@@ -4767,25 +4948,25 @@ var require_sha512 = __commonJS((exports) => {
4767
4948
  Gl = Fl | 0;
4768
4949
  Fh = Eh | 0;
4769
4950
  Fl = El | 0;
4770
- ({ h: Eh, l: El } = _u64_js_1.default.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
4951
+ ({ h: Eh, l: El } = _u64_ts_1.default.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
4771
4952
  Dh = Ch | 0;
4772
4953
  Dl = Cl | 0;
4773
4954
  Ch = Bh | 0;
4774
4955
  Cl = Bl | 0;
4775
4956
  Bh = Ah | 0;
4776
4957
  Bl = Al | 0;
4777
- const All = _u64_js_1.default.add3L(T1l, sigma0l, MAJl);
4778
- Ah = _u64_js_1.default.add3H(All, T1h, sigma0h, MAJh);
4958
+ const All = _u64_ts_1.default.add3L(T1l, sigma0l, MAJl);
4959
+ Ah = _u64_ts_1.default.add3H(All, T1h, sigma0h, MAJh);
4779
4960
  Al = All | 0;
4780
4961
  }
4781
- ({ h: Ah, l: Al } = _u64_js_1.default.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
4782
- ({ h: Bh, l: Bl } = _u64_js_1.default.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
4783
- ({ h: Ch, l: Cl } = _u64_js_1.default.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
4784
- ({ h: Dh, l: Dl } = _u64_js_1.default.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
4785
- ({ h: Eh, l: El } = _u64_js_1.default.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
4786
- ({ h: Fh, l: Fl } = _u64_js_1.default.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
4787
- ({ h: Gh, l: Gl } = _u64_js_1.default.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
4788
- ({ h: Hh, l: Hl } = _u64_js_1.default.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
4962
+ ({ h: Ah, l: Al } = _u64_ts_1.default.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
4963
+ ({ h: Bh, l: Bl } = _u64_ts_1.default.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
4964
+ ({ h: Ch, l: Cl } = _u64_ts_1.default.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
4965
+ ({ h: Dh, l: Dl } = _u64_ts_1.default.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
4966
+ ({ h: Eh, l: El } = _u64_ts_1.default.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
4967
+ ({ h: Fh, l: Fl } = _u64_ts_1.default.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
4968
+ ({ h: Gh, l: Gl } = _u64_ts_1.default.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
4969
+ ({ h: Hh, l: Hl } = _u64_ts_1.default.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
4789
4970
  this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
4790
4971
  }
4791
4972
  roundClean() {
@@ -4801,7 +4982,7 @@ var require_sha512 = __commonJS((exports) => {
4801
4982
 
4802
4983
  class SHA512_224 extends SHA512 {
4803
4984
  constructor() {
4804
- super();
4985
+ super(28);
4805
4986
  this.Ah = 2352822216 | 0;
4806
4987
  this.Al = 424955298 | 0;
4807
4988
  this.Bh = 1944164710 | 0;
@@ -4818,14 +4999,13 @@ var require_sha512 = __commonJS((exports) => {
4818
4999
  this.Gl = 1780299464 | 0;
4819
5000
  this.Hh = 286451373 | 0;
4820
5001
  this.Hl = 2446758561 | 0;
4821
- this.outputLen = 28;
4822
5002
  }
4823
5003
  }
4824
5004
  exports.SHA512_224 = SHA512_224;
4825
5005
 
4826
5006
  class SHA512_256 extends SHA512 {
4827
5007
  constructor() {
4828
- super();
5008
+ super(32);
4829
5009
  this.Ah = 573645204 | 0;
4830
5010
  this.Al = 4230739756 | 0;
4831
5011
  this.Bh = 2673172387 | 0;
@@ -4842,14 +5022,13 @@ var require_sha512 = __commonJS((exports) => {
4842
5022
  this.Gl = 746961066 | 0;
4843
5023
  this.Hh = 246885852 | 0;
4844
5024
  this.Hl = 2177182882 | 0;
4845
- this.outputLen = 32;
4846
5025
  }
4847
5026
  }
4848
5027
  exports.SHA512_256 = SHA512_256;
4849
5028
 
4850
5029
  class SHA384 extends SHA512 {
4851
5030
  constructor() {
4852
- super();
5031
+ super(48);
4853
5032
  this.Ah = 3418070365 | 0;
4854
5033
  this.Al = 3238371032 | 0;
4855
5034
  this.Bh = 1654270250 | 0;
@@ -4866,14 +5045,39 @@ var require_sha512 = __commonJS((exports) => {
4866
5045
  this.Gl = 1694076839 | 0;
4867
5046
  this.Hh = 1203062813 | 0;
4868
5047
  this.Hl = 3204075428 | 0;
4869
- this.outputLen = 48;
4870
5048
  }
4871
5049
  }
4872
5050
  exports.SHA384 = SHA384;
4873
- exports.sha512 = (0, utils_js_1.wrapConstructor)(() => new SHA512);
4874
- exports.sha512_224 = (0, utils_js_1.wrapConstructor)(() => new SHA512_224);
4875
- exports.sha512_256 = (0, utils_js_1.wrapConstructor)(() => new SHA512_256);
4876
- exports.sha384 = (0, utils_js_1.wrapConstructor)(() => new SHA384);
5051
+ exports.sha512 = (0, utils_ts_1.wrapConstructor)(() => new SHA512);
5052
+ exports.sha512_224 = (0, utils_ts_1.wrapConstructor)(() => new SHA512_224);
5053
+ exports.sha512_256 = (0, utils_ts_1.wrapConstructor)(() => new SHA512_256);
5054
+ exports.sha384 = (0, utils_ts_1.wrapConstructor)(() => new SHA384);
5055
+ });
5056
+
5057
+ // ../../node_modules/@noble/hashes/sha2.js
5058
+ var require_sha2 = __commonJS((exports) => {
5059
+ Object.defineProperty(exports, "__esModule", { value: true });
5060
+ exports.sha512_256 = exports.sha512_224 = exports.sha512 = exports.sha384 = exports.sha256 = exports.sha224 = undefined;
5061
+ var sha256_ts_1 = require_sha256();
5062
+ Object.defineProperty(exports, "sha224", { enumerable: true, get: function() {
5063
+ return sha256_ts_1.sha224;
5064
+ } });
5065
+ Object.defineProperty(exports, "sha256", { enumerable: true, get: function() {
5066
+ return sha256_ts_1.sha256;
5067
+ } });
5068
+ var sha512_ts_1 = require_sha512();
5069
+ Object.defineProperty(exports, "sha384", { enumerable: true, get: function() {
5070
+ return sha512_ts_1.sha384;
5071
+ } });
5072
+ Object.defineProperty(exports, "sha512", { enumerable: true, get: function() {
5073
+ return sha512_ts_1.sha512;
5074
+ } });
5075
+ Object.defineProperty(exports, "sha512_224", { enumerable: true, get: function() {
5076
+ return sha512_ts_1.sha512_224;
5077
+ } });
5078
+ Object.defineProperty(exports, "sha512_256", { enumerable: true, get: function() {
5079
+ return sha512_ts_1.sha512_256;
5080
+ } });
4877
5081
  });
4878
5082
 
4879
5083
  // ../../node_modules/@noble/curves/abstract/utils.js
@@ -4884,9 +5088,9 @@ var require_utils5 = __commonJS((exports) => {
4884
5088
  exports.isBytes = isBytes;
4885
5089
  exports.abytes = abytes;
4886
5090
  exports.abool = abool;
4887
- exports.bytesToHex = bytesToHex;
4888
5091
  exports.numberToHexUnpadded = numberToHexUnpadded;
4889
5092
  exports.hexToNumber = hexToNumber;
5093
+ exports.bytesToHex = bytesToHex;
4890
5094
  exports.hexToBytes = hexToBytes;
4891
5095
  exports.bytesToNumberBE = bytesToNumberBE;
4892
5096
  exports.bytesToNumberLE = bytesToNumberLE;
@@ -4907,7 +5111,6 @@ var require_utils5 = __commonJS((exports) => {
4907
5111
  exports.memoized = memoized;
4908
5112
  var _0n = /* @__PURE__ */ BigInt(0);
4909
5113
  var _1n = /* @__PURE__ */ BigInt(1);
4910
- var _2n = /* @__PURE__ */ BigInt(2);
4911
5114
  function isBytes(a) {
4912
5115
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
4913
5116
  }
@@ -4919,15 +5122,6 @@ var require_utils5 = __commonJS((exports) => {
4919
5122
  if (typeof value !== "boolean")
4920
5123
  throw new Error(title + " boolean expected, got " + value);
4921
5124
  }
4922
- var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
4923
- function bytesToHex(bytes) {
4924
- abytes(bytes);
4925
- let hex = "";
4926
- for (let i = 0;i < bytes.length; i++) {
4927
- hex += hexes[bytes[i]];
4928
- }
4929
- return hex;
4930
- }
4931
5125
  function numberToHexUnpadded(num) {
4932
5126
  const hex = num.toString(16);
4933
5127
  return hex.length & 1 ? "0" + hex : hex;
@@ -4937,6 +5131,18 @@ var require_utils5 = __commonJS((exports) => {
4937
5131
  throw new Error("hex string expected, got " + typeof hex);
4938
5132
  return hex === "" ? _0n : BigInt("0x" + hex);
4939
5133
  }
5134
+ var hasHexBuiltin = typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function";
5135
+ var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
5136
+ function bytesToHex(bytes) {
5137
+ abytes(bytes);
5138
+ if (hasHexBuiltin)
5139
+ return bytes.toHex();
5140
+ let hex = "";
5141
+ for (let i = 0;i < bytes.length; i++) {
5142
+ hex += hexes[bytes[i]];
5143
+ }
5144
+ return hex;
5145
+ }
4940
5146
  var asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
4941
5147
  function asciiToBase16(ch) {
4942
5148
  if (ch >= asciis._0 && ch <= asciis._9)
@@ -4950,6 +5156,8 @@ var require_utils5 = __commonJS((exports) => {
4950
5156
  function hexToBytes(hex) {
4951
5157
  if (typeof hex !== "string")
4952
5158
  throw new Error("hex string expected, got " + typeof hex);
5159
+ if (hasHexBuiltin)
5160
+ return Uint8Array.fromHex(hex);
4953
5161
  const hl = hex.length;
4954
5162
  const al = hl / 2;
4955
5163
  if (hl % 2)
@@ -5048,9 +5256,9 @@ var require_utils5 = __commonJS((exports) => {
5048
5256
  function bitSet(n, pos, value) {
5049
5257
  return n | (value ? _1n : _0n) << BigInt(pos);
5050
5258
  }
5051
- var bitMask = (n) => (_2n << BigInt(n - 1)) - _1n;
5259
+ var bitMask = (n) => (_1n << BigInt(n)) - _1n;
5052
5260
  exports.bitMask = bitMask;
5053
- var u8n = (data) => new Uint8Array(data);
5261
+ var u8n = (len) => new Uint8Array(len);
5054
5262
  var u8fr = (arr) => Uint8Array.from(arr);
5055
5263
  function createHmacDrbg(hashLen, qByteLen, hmacFn) {
5056
5264
  if (typeof hashLen !== "number" || hashLen < 2)
@@ -5068,7 +5276,7 @@ var require_utils5 = __commonJS((exports) => {
5068
5276
  i = 0;
5069
5277
  };
5070
5278
  const h = (...b) => hmacFn(k, v, ...b);
5071
- const reseed = (seed = u8n()) => {
5279
+ const reseed = (seed = u8n(0)) => {
5072
5280
  k = h(u8fr([0]), seed);
5073
5281
  v = h();
5074
5282
  if (seed.length === 0)
@@ -5171,7 +5379,7 @@ var require_modular = __commonJS((exports) => {
5171
5379
  exports.getMinHashLength = getMinHashLength;
5172
5380
  exports.mapHashToField = mapHashToField;
5173
5381
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
5174
- var utils_js_1 = require_utils5();
5382
+ var utils_ts_1 = require_utils5();
5175
5383
  var _0n = BigInt(0);
5176
5384
  var _1n = BigInt(1);
5177
5385
  var _2n = /* @__PURE__ */ BigInt(2);
@@ -5331,7 +5539,7 @@ var require_modular = __commonJS((exports) => {
5331
5539
  map[val] = "function";
5332
5540
  return map;
5333
5541
  }, initial);
5334
- return (0, utils_js_1.validateObject)(field, opts);
5542
+ return (0, utils_ts_1.validateObject)(field, opts);
5335
5543
  }
5336
5544
  function FpPow(f, num, power) {
5337
5545
  if (power < _0n)
@@ -5398,7 +5606,7 @@ var require_modular = __commonJS((exports) => {
5398
5606
  isLE,
5399
5607
  BITS,
5400
5608
  BYTES,
5401
- MASK: (0, utils_js_1.bitMask)(BITS),
5609
+ MASK: (0, utils_ts_1.bitMask)(BITS),
5402
5610
  ZERO: _0n,
5403
5611
  ONE: _1n,
5404
5612
  create: (num) => mod(num, ORDER),
@@ -5429,11 +5637,11 @@ var require_modular = __commonJS((exports) => {
5429
5637
  }),
5430
5638
  invertBatch: (lst) => FpInvertBatch(f, lst),
5431
5639
  cmov: (a, b, c) => c ? b : a,
5432
- toBytes: (num) => isLE ? (0, utils_js_1.numberToBytesLE)(num, BYTES) : (0, utils_js_1.numberToBytesBE)(num, BYTES),
5640
+ toBytes: (num) => isLE ? (0, utils_ts_1.numberToBytesLE)(num, BYTES) : (0, utils_ts_1.numberToBytesBE)(num, BYTES),
5433
5641
  fromBytes: (bytes) => {
5434
5642
  if (bytes.length !== BYTES)
5435
5643
  throw new Error("Field.fromBytes: expected " + BYTES + " bytes, got " + bytes.length);
5436
- return isLE ? (0, utils_js_1.bytesToNumberLE)(bytes) : (0, utils_js_1.bytesToNumberBE)(bytes);
5644
+ return isLE ? (0, utils_ts_1.bytesToNumberLE)(bytes) : (0, utils_ts_1.bytesToNumberBE)(bytes);
5437
5645
  }
5438
5646
  });
5439
5647
  return Object.freeze(f);
@@ -5451,12 +5659,12 @@ var require_modular = __commonJS((exports) => {
5451
5659
  return Fp.isOdd(root) ? Fp.neg(root) : root;
5452
5660
  }
5453
5661
  function hashToPrivateScalar(hash, groupOrder, isLE = false) {
5454
- hash = (0, utils_js_1.ensureBytes)("privateHash", hash);
5662
+ hash = (0, utils_ts_1.ensureBytes)("privateHash", hash);
5455
5663
  const hashLen = hash.length;
5456
5664
  const minLen = nLength(groupOrder).nByteLength + 8;
5457
5665
  if (minLen < 24 || hashLen < minLen || hashLen > 1024)
5458
5666
  throw new Error("hashToPrivateScalar: expected " + minLen + "-1024 bytes of input, got " + hashLen);
5459
- const num = isLE ? (0, utils_js_1.bytesToNumberLE)(hash) : (0, utils_js_1.bytesToNumberBE)(hash);
5667
+ const num = isLE ? (0, utils_ts_1.bytesToNumberLE)(hash) : (0, utils_ts_1.bytesToNumberBE)(hash);
5460
5668
  return mod(num, groupOrder - _1n) + _1n;
5461
5669
  }
5462
5670
  function getFieldBytesLength(fieldOrder) {
@@ -5475,9 +5683,9 @@ var require_modular = __commonJS((exports) => {
5475
5683
  const minLen = getMinHashLength(fieldOrder);
5476
5684
  if (len < 16 || len < minLen || len > 1024)
5477
5685
  throw new Error("expected " + minLen + "-1024 bytes of input, got " + len);
5478
- const num = isLE ? (0, utils_js_1.bytesToNumberLE)(key) : (0, utils_js_1.bytesToNumberBE)(key);
5686
+ const num = isLE ? (0, utils_ts_1.bytesToNumberLE)(key) : (0, utils_ts_1.bytesToNumberBE)(key);
5479
5687
  const reduced = mod(num, fieldOrder - _1n) + _1n;
5480
- return isLE ? (0, utils_js_1.numberToBytesLE)(reduced, fieldLen) : (0, utils_js_1.numberToBytesBE)(reduced, fieldLen);
5688
+ return isLE ? (0, utils_ts_1.numberToBytesLE)(reduced, fieldLen) : (0, utils_ts_1.numberToBytesBE)(reduced, fieldLen);
5481
5689
  }
5482
5690
  });
5483
5691
 
@@ -5489,8 +5697,8 @@ var require_curve = __commonJS((exports) => {
5489
5697
  exports.precomputeMSMUnsafe = precomputeMSMUnsafe;
5490
5698
  exports.validateBasic = validateBasic;
5491
5699
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
5492
- var modular_js_1 = require_modular();
5493
- var utils_js_1 = require_utils5();
5700
+ var modular_ts_1 = require_modular();
5701
+ var utils_ts_1 = require_utils5();
5494
5702
  var _0n = BigInt(0);
5495
5703
  var _1n = BigInt(1);
5496
5704
  function constTimeNegate(condition, item) {
@@ -5501,11 +5709,30 @@ var require_curve = __commonJS((exports) => {
5501
5709
  if (!Number.isSafeInteger(W) || W <= 0 || W > bits)
5502
5710
  throw new Error("invalid window size, expected [1.." + bits + "], got W=" + W);
5503
5711
  }
5504
- function calcWOpts(W, bits) {
5505
- validateW(W, bits);
5506
- const windows = Math.ceil(bits / W) + 1;
5712
+ function calcWOpts(W, scalarBits) {
5713
+ validateW(W, scalarBits);
5714
+ const windows = Math.ceil(scalarBits / W) + 1;
5507
5715
  const windowSize = 2 ** (W - 1);
5508
- return { windows, windowSize };
5716
+ const maxNumber = 2 ** W;
5717
+ const mask = (0, utils_ts_1.bitMask)(W);
5718
+ const shiftBy = BigInt(W);
5719
+ return { windows, windowSize, mask, maxNumber, shiftBy };
5720
+ }
5721
+ function calcOffsets(n, window2, wOpts) {
5722
+ const { windowSize, mask, maxNumber, shiftBy } = wOpts;
5723
+ let wbits = Number(n & mask);
5724
+ let nextN = n >> shiftBy;
5725
+ if (wbits > windowSize) {
5726
+ wbits -= maxNumber;
5727
+ nextN += _1n;
5728
+ }
5729
+ const offsetStart = window2 * windowSize;
5730
+ const offset = offsetStart + Math.abs(wbits) - 1;
5731
+ const isZero = wbits === 0;
5732
+ const isNeg = wbits < 0;
5733
+ const isNegF = window2 % 2 !== 0;
5734
+ const offsetF = offsetStart;
5735
+ return { nextN, offset, isZero, isNeg, isNegF, offsetF };
5509
5736
  }
5510
5737
  function validateMSMPoints(points, c) {
5511
5738
  if (!Array.isArray(points))
@@ -5561,53 +5788,33 @@ var require_curve = __commonJS((exports) => {
5561
5788
  return points;
5562
5789
  },
5563
5790
  wNAF(W, precomputes, n) {
5564
- const { windows, windowSize } = calcWOpts(W, bits);
5565
5791
  let p = c.ZERO;
5566
5792
  let f = c.BASE;
5567
- const mask = BigInt(2 ** W - 1);
5568
- const maxNumber = 2 ** W;
5569
- const shiftBy = BigInt(W);
5570
- for (let window2 = 0;window2 < windows; window2++) {
5571
- const offset = window2 * windowSize;
5572
- let wbits = Number(n & mask);
5573
- n >>= shiftBy;
5574
- if (wbits > windowSize) {
5575
- wbits -= maxNumber;
5576
- n += _1n;
5577
- }
5578
- const offset1 = offset;
5579
- const offset2 = offset + Math.abs(wbits) - 1;
5580
- const cond1 = window2 % 2 !== 0;
5581
- const cond2 = wbits < 0;
5582
- if (wbits === 0) {
5583
- f = f.add(constTimeNegate(cond1, precomputes[offset1]));
5793
+ const wo = calcWOpts(W, bits);
5794
+ for (let window2 = 0;window2 < wo.windows; window2++) {
5795
+ const { nextN, offset, isZero, isNeg, isNegF, offsetF } = calcOffsets(n, window2, wo);
5796
+ n = nextN;
5797
+ if (isZero) {
5798
+ f = f.add(constTimeNegate(isNegF, precomputes[offsetF]));
5584
5799
  } else {
5585
- p = p.add(constTimeNegate(cond2, precomputes[offset2]));
5800
+ p = p.add(constTimeNegate(isNeg, precomputes[offset]));
5586
5801
  }
5587
5802
  }
5588
5803
  return { p, f };
5589
5804
  },
5590
5805
  wNAFUnsafe(W, precomputes, n, acc = c.ZERO) {
5591
- const { windows, windowSize } = calcWOpts(W, bits);
5592
- const mask = BigInt(2 ** W - 1);
5593
- const maxNumber = 2 ** W;
5594
- const shiftBy = BigInt(W);
5595
- for (let window2 = 0;window2 < windows; window2++) {
5596
- const offset = window2 * windowSize;
5806
+ const wo = calcWOpts(W, bits);
5807
+ for (let window2 = 0;window2 < wo.windows; window2++) {
5597
5808
  if (n === _0n)
5598
5809
  break;
5599
- let wbits = Number(n & mask);
5600
- n >>= shiftBy;
5601
- if (wbits > windowSize) {
5602
- wbits -= maxNumber;
5603
- n += _1n;
5604
- }
5605
- if (wbits === 0)
5810
+ const { nextN, offset, isZero, isNeg } = calcOffsets(n, window2, wo);
5811
+ n = nextN;
5812
+ if (isZero) {
5606
5813
  continue;
5607
- let curr = precomputes[offset + Math.abs(wbits) - 1];
5608
- if (wbits < 0)
5609
- curr = curr.negate();
5610
- acc = acc.add(curr);
5814
+ } else {
5815
+ const item = precomputes[offset];
5816
+ acc = acc.add(isNeg ? item.negate() : item);
5817
+ }
5611
5818
  }
5612
5819
  return acc;
5613
5820
  },
@@ -5643,17 +5850,17 @@ var require_curve = __commonJS((exports) => {
5643
5850
  if (points.length !== scalars.length)
5644
5851
  throw new Error("arrays of points and scalars must have equal length");
5645
5852
  const zero = c.ZERO;
5646
- const wbits = (0, utils_js_1.bitLen)(BigInt(points.length));
5853
+ const wbits = (0, utils_ts_1.bitLen)(BigInt(points.length));
5647
5854
  const windowSize = wbits > 12 ? wbits - 3 : wbits > 4 ? wbits - 2 : wbits ? 2 : 1;
5648
- const MASK = (1 << windowSize) - 1;
5649
- const buckets = new Array(MASK + 1).fill(zero);
5855
+ const MASK = (0, utils_ts_1.bitMask)(windowSize);
5856
+ const buckets = new Array(Number(MASK) + 1).fill(zero);
5650
5857
  const lastBits = Math.floor((fieldN.BITS - 1) / windowSize) * windowSize;
5651
5858
  let sum = zero;
5652
5859
  for (let i = lastBits;i >= 0; i -= windowSize) {
5653
5860
  buckets.fill(zero);
5654
5861
  for (let j = 0;j < scalars.length; j++) {
5655
5862
  const scalar = scalars[j];
5656
- const wbits2 = Number(scalar >> BigInt(i) & BigInt(MASK));
5863
+ const wbits2 = Number(scalar >> BigInt(i) & MASK);
5657
5864
  buckets[wbits2] = buckets[wbits2].add(points[j]);
5658
5865
  }
5659
5866
  let resI = zero;
@@ -5674,7 +5881,7 @@ var require_curve = __commonJS((exports) => {
5674
5881
  const zero = c.ZERO;
5675
5882
  const tableSize = 2 ** windowSize - 1;
5676
5883
  const chunks = Math.ceil(fieldN.BITS / windowSize);
5677
- const MASK = BigInt((1 << windowSize) - 1);
5884
+ const MASK = (0, utils_ts_1.bitMask)(windowSize);
5678
5885
  const tables = points.map((p) => {
5679
5886
  const res = [];
5680
5887
  for (let i = 0, acc = p;i < tableSize; i++) {
@@ -5705,8 +5912,8 @@ var require_curve = __commonJS((exports) => {
5705
5912
  };
5706
5913
  }
5707
5914
  function validateBasic(curve) {
5708
- (0, modular_js_1.validateField)(curve.Fp);
5709
- (0, utils_js_1.validateObject)(curve, {
5915
+ (0, modular_ts_1.validateField)(curve.Fp);
5916
+ (0, utils_ts_1.validateObject)(curve, {
5710
5917
  n: "bigint",
5711
5918
  h: "bigint",
5712
5919
  Gx: "field",
@@ -5716,7 +5923,7 @@ var require_curve = __commonJS((exports) => {
5716
5923
  nByteLength: "isSafeInteger"
5717
5924
  });
5718
5925
  return Object.freeze({
5719
- ...(0, modular_js_1.nLength)(curve.n, curve.nBitLength),
5926
+ ...(0, modular_ts_1.nLength)(curve.n, curve.nBitLength),
5720
5927
  ...curve,
5721
5928
  ...{ p: curve.Fp.ORDER }
5722
5929
  });
@@ -5728,18 +5935,17 @@ var require_edwards = __commonJS((exports) => {
5728
5935
  Object.defineProperty(exports, "__esModule", { value: true });
5729
5936
  exports.twistedEdwards = twistedEdwards;
5730
5937
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
5731
- var curve_js_1 = require_curve();
5732
- var modular_js_1 = require_modular();
5733
- var ut = require_utils5();
5734
- var utils_js_1 = require_utils5();
5938
+ var curve_ts_1 = require_curve();
5939
+ var modular_ts_1 = require_modular();
5940
+ var utils_ts_1 = require_utils5();
5735
5941
  var _0n = BigInt(0);
5736
5942
  var _1n = BigInt(1);
5737
5943
  var _2n = BigInt(2);
5738
5944
  var _8n = BigInt(8);
5739
5945
  var VERIFY_DEFAULT = { zip215: true };
5740
5946
  function validateOpts(curve) {
5741
- const opts = (0, curve_js_1.validateBasic)(curve);
5742
- ut.validateObject(curve, {
5947
+ const opts = (0, curve_ts_1.validateBasic)(curve);
5948
+ (0, utils_ts_1.validateObject)(curve, {
5743
5949
  hash: "function",
5744
5950
  a: "bigint",
5745
5951
  d: "bigint",
@@ -5757,7 +5963,7 @@ var require_edwards = __commonJS((exports) => {
5757
5963
  const { Fp, n: CURVE_ORDER, prehash, hash: cHash, randomBytes, nByteLength, h: cofactor } = CURVE;
5758
5964
  const MASK = _2n << BigInt(nByteLength * 8) - _1n;
5759
5965
  const modP = Fp.create;
5760
- const Fn = (0, modular_js_1.Field)(CURVE.n, CURVE.nBitLength);
5966
+ const Fn = (0, modular_ts_1.Field)(CURVE.n, CURVE.nBitLength);
5761
5967
  const uvRatio = CURVE.uvRatio || ((u, v) => {
5762
5968
  try {
5763
5969
  return { isValid: true, value: Fp.sqrt(u * Fp.inv(v)) };
@@ -5767,19 +5973,20 @@ var require_edwards = __commonJS((exports) => {
5767
5973
  });
5768
5974
  const adjustScalarBytes = CURVE.adjustScalarBytes || ((bytes) => bytes);
5769
5975
  const domain = CURVE.domain || ((data, ctx, phflag) => {
5770
- (0, utils_js_1.abool)("phflag", phflag);
5976
+ (0, utils_ts_1.abool)("phflag", phflag);
5771
5977
  if (ctx.length || phflag)
5772
5978
  throw new Error("Contexts/pre-hash are not supported");
5773
5979
  return data;
5774
5980
  });
5775
- function aCoordinate(title, n) {
5776
- ut.aInRange("coordinate " + title, n, _0n, MASK);
5981
+ function aCoordinate(title, n, banZero = false) {
5982
+ const min = banZero ? _1n : _0n;
5983
+ (0, utils_ts_1.aInRange)("coordinate " + title, n, min, MASK);
5777
5984
  }
5778
- function assertPoint(other) {
5985
+ function aextpoint(other) {
5779
5986
  if (!(other instanceof Point))
5780
5987
  throw new Error("ExtendedPoint expected");
5781
5988
  }
5782
- const toAffineMemo = (0, utils_js_1.memoized)((p, iz) => {
5989
+ const toAffineMemo = (0, utils_ts_1.memoized)((p, iz) => {
5783
5990
  const { ex: x, ey: y, ez: z2 } = p;
5784
5991
  const is0 = p.is0();
5785
5992
  if (iz == null)
@@ -5793,7 +6000,7 @@ var require_edwards = __commonJS((exports) => {
5793
6000
  throw new Error("invZ was invalid");
5794
6001
  return { x: ax, y: ay };
5795
6002
  });
5796
- const assertValidMemo = (0, utils_js_1.memoized)((p) => {
6003
+ const assertValidMemo = (0, utils_ts_1.memoized)((p) => {
5797
6004
  const { a, d } = CURVE;
5798
6005
  if (p.is0())
5799
6006
  throw new Error("bad point: ZERO");
@@ -5816,14 +6023,14 @@ var require_edwards = __commonJS((exports) => {
5816
6023
 
5817
6024
  class Point {
5818
6025
  constructor(ex, ey, ez, et) {
6026
+ aCoordinate("x", ex);
6027
+ aCoordinate("y", ey);
6028
+ aCoordinate("z", ez, true);
6029
+ aCoordinate("t", et);
5819
6030
  this.ex = ex;
5820
6031
  this.ey = ey;
5821
6032
  this.ez = ez;
5822
6033
  this.et = et;
5823
- aCoordinate("x", ex);
5824
- aCoordinate("y", ey);
5825
- aCoordinate("z", ez);
5826
- aCoordinate("t", et);
5827
6034
  Object.freeze(this);
5828
6035
  }
5829
6036
  get x() {
@@ -5845,7 +6052,7 @@ var require_edwards = __commonJS((exports) => {
5845
6052
  return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);
5846
6053
  }
5847
6054
  static msm(points, scalars) {
5848
- return (0, curve_js_1.pippenger)(Point, Fn, points, scalars);
6055
+ return (0, curve_ts_1.pippenger)(Point, Fn, points, scalars);
5849
6056
  }
5850
6057
  _setWindowSize(windowSize) {
5851
6058
  wnaf.setWindowSize(this, windowSize);
@@ -5854,7 +6061,7 @@ var require_edwards = __commonJS((exports) => {
5854
6061
  assertValidMemo(this);
5855
6062
  }
5856
6063
  equals(other) {
5857
- assertPoint(other);
6064
+ aextpoint(other);
5858
6065
  const { ex: X1, ey: Y1, ez: Z1 } = this;
5859
6066
  const { ex: X2, ey: Y2, ez: Z2 } = other;
5860
6067
  const X1Z2 = modP(X1 * Z2);
@@ -5888,27 +6095,10 @@ var require_edwards = __commonJS((exports) => {
5888
6095
  return new Point(X3, Y3, Z3, T3);
5889
6096
  }
5890
6097
  add(other) {
5891
- assertPoint(other);
6098
+ aextpoint(other);
5892
6099
  const { a, d } = CURVE;
5893
6100
  const { ex: X1, ey: Y1, ez: Z1, et: T1 } = this;
5894
6101
  const { ex: X2, ey: Y2, ez: Z2, et: T2 } = other;
5895
- if (a === BigInt(-1)) {
5896
- const A2 = modP((Y1 - X1) * (Y2 + X2));
5897
- const B2 = modP((Y1 + X1) * (Y2 - X2));
5898
- const F2 = modP(B2 - A2);
5899
- if (F2 === _0n)
5900
- return this.double();
5901
- const C2 = modP(Z1 * _2n * T2);
5902
- const D2 = modP(T1 * _2n * Z2);
5903
- const E2 = D2 + C2;
5904
- const G3 = B2 + A2;
5905
- const H2 = D2 - C2;
5906
- const X32 = modP(E2 * F2);
5907
- const Y32 = modP(G3 * H2);
5908
- const T32 = modP(E2 * H2);
5909
- const Z32 = modP(F2 * G3);
5910
- return new Point(X32, Y32, Z32, T32);
5911
- }
5912
6102
  const A = modP(X1 * X2);
5913
6103
  const B = modP(Y1 * Y2);
5914
6104
  const C = modP(T1 * d * T2);
@@ -5931,13 +6121,13 @@ var require_edwards = __commonJS((exports) => {
5931
6121
  }
5932
6122
  multiply(scalar) {
5933
6123
  const n = scalar;
5934
- ut.aInRange("scalar", n, _1n, CURVE_ORDER);
6124
+ (0, utils_ts_1.aInRange)("scalar", n, _1n, CURVE_ORDER);
5935
6125
  const { p, f } = this.wNAF(n);
5936
6126
  return Point.normalizeZ([p, f])[0];
5937
6127
  }
5938
6128
  multiplyUnsafe(scalar, acc = Point.ZERO) {
5939
6129
  const n = scalar;
5940
- ut.aInRange("scalar", n, _0n, CURVE_ORDER);
6130
+ (0, utils_ts_1.aInRange)("scalar", n, _0n, CURVE_ORDER);
5941
6131
  if (n === _0n)
5942
6132
  return I;
5943
6133
  if (this.is0() || n === _1n)
@@ -5962,14 +6152,14 @@ var require_edwards = __commonJS((exports) => {
5962
6152
  static fromHex(hex, zip215 = false) {
5963
6153
  const { d, a } = CURVE;
5964
6154
  const len = Fp.BYTES;
5965
- hex = (0, utils_js_1.ensureBytes)("pointHex", hex, len);
5966
- (0, utils_js_1.abool)("zip215", zip215);
6155
+ hex = (0, utils_ts_1.ensureBytes)("pointHex", hex, len);
6156
+ (0, utils_ts_1.abool)("zip215", zip215);
5967
6157
  const normed = hex.slice();
5968
6158
  const lastByte = hex[len - 1];
5969
6159
  normed[len - 1] = lastByte & ~128;
5970
- const y = ut.bytesToNumberLE(normed);
6160
+ const y = (0, utils_ts_1.bytesToNumberLE)(normed);
5971
6161
  const max = zip215 ? MASK : Fp.ORDER;
5972
- ut.aInRange("pointHex.y", y, _0n, max);
6162
+ (0, utils_ts_1.aInRange)("pointHex.y", y, _0n, max);
5973
6163
  const y2 = modP(y * y);
5974
6164
  const u = modP(y2 - _1n);
5975
6165
  const v = modP(d * y2 - a);
@@ -5985,35 +6175,40 @@ var require_edwards = __commonJS((exports) => {
5985
6175
  return Point.fromAffine({ x, y });
5986
6176
  }
5987
6177
  static fromPrivateKey(privKey) {
5988
- return getExtendedPublicKey(privKey).point;
6178
+ const { scalar } = getPrivateScalar(privKey);
6179
+ return G.multiply(scalar);
5989
6180
  }
5990
6181
  toRawBytes() {
5991
6182
  const { x, y } = this.toAffine();
5992
- const bytes = ut.numberToBytesLE(y, Fp.BYTES);
6183
+ const bytes = (0, utils_ts_1.numberToBytesLE)(y, Fp.BYTES);
5993
6184
  bytes[bytes.length - 1] |= x & _1n ? 128 : 0;
5994
6185
  return bytes;
5995
6186
  }
5996
6187
  toHex() {
5997
- return ut.bytesToHex(this.toRawBytes());
6188
+ return (0, utils_ts_1.bytesToHex)(this.toRawBytes());
5998
6189
  }
5999
6190
  }
6000
6191
  Point.BASE = new Point(CURVE.Gx, CURVE.Gy, _1n, modP(CURVE.Gx * CURVE.Gy));
6001
6192
  Point.ZERO = new Point(_0n, _1n, _1n, _0n);
6002
6193
  const { BASE: G, ZERO: I } = Point;
6003
- const wnaf = (0, curve_js_1.wNAF)(Point, nByteLength * 8);
6194
+ const wnaf = (0, curve_ts_1.wNAF)(Point, nByteLength * 8);
6004
6195
  function modN(a) {
6005
- return (0, modular_js_1.mod)(a, CURVE_ORDER);
6196
+ return (0, modular_ts_1.mod)(a, CURVE_ORDER);
6006
6197
  }
6007
6198
  function modN_LE(hash) {
6008
- return modN(ut.bytesToNumberLE(hash));
6199
+ return modN((0, utils_ts_1.bytesToNumberLE)(hash));
6009
6200
  }
6010
- function getExtendedPublicKey(key) {
6201
+ function getPrivateScalar(key) {
6011
6202
  const len = Fp.BYTES;
6012
- key = (0, utils_js_1.ensureBytes)("private key", key, len);
6013
- const hashed = (0, utils_js_1.ensureBytes)("hashed private key", cHash(key), 2 * len);
6203
+ key = (0, utils_ts_1.ensureBytes)("private key", key, len);
6204
+ const hashed = (0, utils_ts_1.ensureBytes)("hashed private key", cHash(key), 2 * len);
6014
6205
  const head = adjustScalarBytes(hashed.slice(0, len));
6015
6206
  const prefix = hashed.slice(len, 2 * len);
6016
6207
  const scalar = modN_LE(head);
6208
+ return { head, prefix, scalar };
6209
+ }
6210
+ function getExtendedPublicKey(key) {
6211
+ const { head, prefix, scalar } = getPrivateScalar(key);
6017
6212
  const point = G.multiply(scalar);
6018
6213
  const pointBytes = point.toRawBytes();
6019
6214
  return { head, prefix, scalar, point, pointBytes };
@@ -6022,11 +6217,11 @@ var require_edwards = __commonJS((exports) => {
6022
6217
  return getExtendedPublicKey(privKey).pointBytes;
6023
6218
  }
6024
6219
  function hashDomainToScalar(context = new Uint8Array, ...msgs) {
6025
- const msg = ut.concatBytes(...msgs);
6026
- return modN_LE(cHash(domain(msg, (0, utils_js_1.ensureBytes)("context", context), !!prehash)));
6220
+ const msg = (0, utils_ts_1.concatBytes)(...msgs);
6221
+ return modN_LE(cHash(domain(msg, (0, utils_ts_1.ensureBytes)("context", context), !!prehash)));
6027
6222
  }
6028
6223
  function sign(msg, privKey, options = {}) {
6029
- msg = (0, utils_js_1.ensureBytes)("message", msg);
6224
+ msg = (0, utils_ts_1.ensureBytes)("message", msg);
6030
6225
  if (prehash)
6031
6226
  msg = prehash(msg);
6032
6227
  const { prefix, scalar, pointBytes } = getExtendedPublicKey(privKey);
@@ -6034,22 +6229,22 @@ var require_edwards = __commonJS((exports) => {
6034
6229
  const R = G.multiply(r).toRawBytes();
6035
6230
  const k = hashDomainToScalar(options.context, R, pointBytes, msg);
6036
6231
  const s = modN(r + k * scalar);
6037
- ut.aInRange("signature.s", s, _0n, CURVE_ORDER);
6038
- const res = ut.concatBytes(R, ut.numberToBytesLE(s, Fp.BYTES));
6039
- return (0, utils_js_1.ensureBytes)("result", res, Fp.BYTES * 2);
6232
+ (0, utils_ts_1.aInRange)("signature.s", s, _0n, CURVE_ORDER);
6233
+ const res = (0, utils_ts_1.concatBytes)(R, (0, utils_ts_1.numberToBytesLE)(s, Fp.BYTES));
6234
+ return (0, utils_ts_1.ensureBytes)("result", res, Fp.BYTES * 2);
6040
6235
  }
6041
6236
  const verifyOpts = VERIFY_DEFAULT;
6042
6237
  function verify(sig, msg, publicKey, options = verifyOpts) {
6043
6238
  const { context, zip215 } = options;
6044
6239
  const len = Fp.BYTES;
6045
- sig = (0, utils_js_1.ensureBytes)("signature", sig, 2 * len);
6046
- msg = (0, utils_js_1.ensureBytes)("message", msg);
6047
- publicKey = (0, utils_js_1.ensureBytes)("publicKey", publicKey, len);
6240
+ sig = (0, utils_ts_1.ensureBytes)("signature", sig, 2 * len);
6241
+ msg = (0, utils_ts_1.ensureBytes)("message", msg);
6242
+ publicKey = (0, utils_ts_1.ensureBytes)("publicKey", publicKey, len);
6048
6243
  if (zip215 !== undefined)
6049
- (0, utils_js_1.abool)("zip215", zip215);
6244
+ (0, utils_ts_1.abool)("zip215", zip215);
6050
6245
  if (prehash)
6051
6246
  msg = prehash(msg);
6052
- const s = ut.bytesToNumberLE(sig.slice(len, 2 * len));
6247
+ const s = (0, utils_ts_1.bytesToNumberLE)(sig.slice(len, 2 * len));
6053
6248
  let A, R, SB;
6054
6249
  try {
6055
6250
  A = Point.fromHex(publicKey, zip215);
@@ -6093,9 +6288,9 @@ var require_hash_to_curve = __commonJS((exports) => {
6093
6288
  exports.hash_to_field = hash_to_field;
6094
6289
  exports.isogenyMap = isogenyMap;
6095
6290
  exports.createHasher = createHasher;
6096
- var modular_js_1 = require_modular();
6097
- var utils_js_1 = require_utils5();
6098
- var os2ip = utils_js_1.bytesToNumberBE;
6291
+ var modular_ts_1 = require_modular();
6292
+ var utils_ts_1 = require_utils5();
6293
+ var os2ip = utils_ts_1.bytesToNumberBE;
6099
6294
  function i2osp(value, length) {
6100
6295
  anum(value);
6101
6296
  anum(length);
@@ -6120,42 +6315,42 @@ var require_hash_to_curve = __commonJS((exports) => {
6120
6315
  throw new Error("number expected");
6121
6316
  }
6122
6317
  function expand_message_xmd(msg, DST, lenInBytes, H) {
6123
- (0, utils_js_1.abytes)(msg);
6124
- (0, utils_js_1.abytes)(DST);
6318
+ (0, utils_ts_1.abytes)(msg);
6319
+ (0, utils_ts_1.abytes)(DST);
6125
6320
  anum(lenInBytes);
6126
6321
  if (DST.length > 255)
6127
- DST = H((0, utils_js_1.concatBytes)((0, utils_js_1.utf8ToBytes)("H2C-OVERSIZE-DST-"), DST));
6322
+ DST = H((0, utils_ts_1.concatBytes)((0, utils_ts_1.utf8ToBytes)("H2C-OVERSIZE-DST-"), DST));
6128
6323
  const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H;
6129
6324
  const ell = Math.ceil(lenInBytes / b_in_bytes);
6130
6325
  if (lenInBytes > 65535 || ell > 255)
6131
6326
  throw new Error("expand_message_xmd: invalid lenInBytes");
6132
- const DST_prime = (0, utils_js_1.concatBytes)(DST, i2osp(DST.length, 1));
6327
+ const DST_prime = (0, utils_ts_1.concatBytes)(DST, i2osp(DST.length, 1));
6133
6328
  const Z_pad = i2osp(0, r_in_bytes);
6134
6329
  const l_i_b_str = i2osp(lenInBytes, 2);
6135
6330
  const b = new Array(ell);
6136
- const b_0 = H((0, utils_js_1.concatBytes)(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime));
6137
- b[0] = H((0, utils_js_1.concatBytes)(b_0, i2osp(1, 1), DST_prime));
6331
+ const b_0 = H((0, utils_ts_1.concatBytes)(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime));
6332
+ b[0] = H((0, utils_ts_1.concatBytes)(b_0, i2osp(1, 1), DST_prime));
6138
6333
  for (let i = 1;i <= ell; i++) {
6139
6334
  const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime];
6140
- b[i] = H((0, utils_js_1.concatBytes)(...args));
6335
+ b[i] = H((0, utils_ts_1.concatBytes)(...args));
6141
6336
  }
6142
- const pseudo_random_bytes = (0, utils_js_1.concatBytes)(...b);
6337
+ const pseudo_random_bytes = (0, utils_ts_1.concatBytes)(...b);
6143
6338
  return pseudo_random_bytes.slice(0, lenInBytes);
6144
6339
  }
6145
6340
  function expand_message_xof(msg, DST, lenInBytes, k, H) {
6146
- (0, utils_js_1.abytes)(msg);
6147
- (0, utils_js_1.abytes)(DST);
6341
+ (0, utils_ts_1.abytes)(msg);
6342
+ (0, utils_ts_1.abytes)(DST);
6148
6343
  anum(lenInBytes);
6149
6344
  if (DST.length > 255) {
6150
6345
  const dkLen = Math.ceil(2 * k / 8);
6151
- DST = H.create({ dkLen }).update((0, utils_js_1.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(DST).digest();
6346
+ DST = H.create({ dkLen }).update((0, utils_ts_1.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(DST).digest();
6152
6347
  }
6153
6348
  if (lenInBytes > 65535 || DST.length > 255)
6154
6349
  throw new Error("expand_message_xof: invalid lenInBytes");
6155
6350
  return H.create({ dkLen: lenInBytes }).update(msg).update(i2osp(lenInBytes, 2)).update(DST).update(i2osp(DST.length, 1)).digest();
6156
6351
  }
6157
6352
  function hash_to_field(msg, count, options) {
6158
- (0, utils_js_1.validateObject)(options, {
6353
+ (0, utils_ts_1.validateObject)(options, {
6159
6354
  DST: "stringOrUint8Array",
6160
6355
  p: "bigint",
6161
6356
  m: "isSafeInteger",
@@ -6163,9 +6358,9 @@ var require_hash_to_curve = __commonJS((exports) => {
6163
6358
  hash: "hash"
6164
6359
  });
6165
6360
  const { p, k, m, hash, expand, DST: _DST } = options;
6166
- (0, utils_js_1.abytes)(msg);
6361
+ (0, utils_ts_1.abytes)(msg);
6167
6362
  anum(count);
6168
- const DST = typeof _DST === "string" ? (0, utils_js_1.utf8ToBytes)(_DST) : _DST;
6363
+ const DST = typeof _DST === "string" ? (0, utils_ts_1.utf8ToBytes)(_DST) : _DST;
6169
6364
  const log2p = p.toString(2).length;
6170
6365
  const L = Math.ceil((log2p + k) / 8);
6171
6366
  const len_in_bytes = count * m * L;
@@ -6185,7 +6380,7 @@ var require_hash_to_curve = __commonJS((exports) => {
6185
6380
  for (let j = 0;j < m; j++) {
6186
6381
  const elm_offset = L * (j + i * m);
6187
6382
  const tv = prb.subarray(elm_offset, elm_offset + L);
6188
- e[j] = (0, modular_js_1.mod)(os2ip(tv), p);
6383
+ e[j] = (0, modular_ts_1.mod)(os2ip(tv), p);
6189
6384
  }
6190
6385
  u[i] = e;
6191
6386
  }
@@ -6195,6 +6390,8 @@ var require_hash_to_curve = __commonJS((exports) => {
6195
6390
  const COEFF = map.map((i) => Array.from(i).reverse());
6196
6391
  return (x, y) => {
6197
6392
  const [xNum, xDen, yNum, yDen] = COEFF.map((val) => val.reduce((acc, i) => field.add(field.mul(acc, x), i)));
6393
+ if (field.is0(xDen) || field.is0(yDen))
6394
+ throw new Error("bad point: ZERO");
6198
6395
  x = field.div(xNum, xDen);
6199
6396
  y = field.mul(y, field.div(yNum, yDen));
6200
6397
  return { x, y };
@@ -6237,12 +6434,12 @@ var require_montgomery = __commonJS((exports) => {
6237
6434
  Object.defineProperty(exports, "__esModule", { value: true });
6238
6435
  exports.montgomery = montgomery;
6239
6436
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
6240
- var modular_js_1 = require_modular();
6241
- var utils_js_1 = require_utils5();
6437
+ var modular_ts_1 = require_modular();
6438
+ var utils_ts_1 = require_utils5();
6242
6439
  var _0n = BigInt(0);
6243
6440
  var _1n = BigInt(1);
6244
6441
  function validateOpts(curve) {
6245
- (0, utils_js_1.validateObject)(curve, {
6442
+ (0, utils_ts_1.validateObject)(curve, {
6246
6443
  a: "bigint"
6247
6444
  }, {
6248
6445
  montgomeryBits: "isSafeInteger",
@@ -6257,12 +6454,12 @@ var require_montgomery = __commonJS((exports) => {
6257
6454
  function montgomery(curveDef) {
6258
6455
  const CURVE = validateOpts(curveDef);
6259
6456
  const { P } = CURVE;
6260
- const modP = (n) => (0, modular_js_1.mod)(n, P);
6457
+ const modP = (n) => (0, modular_ts_1.mod)(n, P);
6261
6458
  const montgomeryBits = CURVE.montgomeryBits;
6262
6459
  const montgomeryBytes = Math.ceil(montgomeryBits / 8);
6263
6460
  const fieldLen = CURVE.nByteLength;
6264
6461
  const adjustScalarBytes = CURVE.adjustScalarBytes || ((bytes) => bytes);
6265
- const powPminus2 = CURVE.powPminus2 || ((x) => (0, modular_js_1.pow)(x, P - BigInt(2), P));
6462
+ const powPminus2 = CURVE.powPminus2 || ((x) => (0, modular_ts_1.pow)(x, P - BigInt(2), P));
6266
6463
  function cswap(swap, x_2, x_3) {
6267
6464
  const dummy = modP(swap * (x_2 - x_3));
6268
6465
  x_2 = modP(x_2 - dummy);
@@ -6271,8 +6468,8 @@ var require_montgomery = __commonJS((exports) => {
6271
6468
  }
6272
6469
  const a24 = (CURVE.a - BigInt(2)) / BigInt(4);
6273
6470
  function montgomeryLadder(u, scalar) {
6274
- (0, utils_js_1.aInRange)("u", u, _0n, P);
6275
- (0, utils_js_1.aInRange)("scalar", scalar, _0n, P);
6471
+ (0, utils_ts_1.aInRange)("u", u, _0n, P);
6472
+ (0, utils_ts_1.aInRange)("scalar", scalar, _0n, P);
6276
6473
  const k = scalar;
6277
6474
  const x_1 = u;
6278
6475
  let x_2 = _1n;
@@ -6317,22 +6514,22 @@ var require_montgomery = __commonJS((exports) => {
6317
6514
  return modP(x_2 * z2);
6318
6515
  }
6319
6516
  function encodeUCoordinate(u) {
6320
- return (0, utils_js_1.numberToBytesLE)(modP(u), montgomeryBytes);
6517
+ return (0, utils_ts_1.numberToBytesLE)(modP(u), montgomeryBytes);
6321
6518
  }
6322
6519
  function decodeUCoordinate(uEnc) {
6323
- const u = (0, utils_js_1.ensureBytes)("u coordinate", uEnc, montgomeryBytes);
6520
+ const u = (0, utils_ts_1.ensureBytes)("u coordinate", uEnc, montgomeryBytes);
6324
6521
  if (fieldLen === 32)
6325
6522
  u[31] &= 127;
6326
- return (0, utils_js_1.bytesToNumberLE)(u);
6523
+ return (0, utils_ts_1.bytesToNumberLE)(u);
6327
6524
  }
6328
6525
  function decodeScalar(n) {
6329
- const bytes = (0, utils_js_1.ensureBytes)("scalar", n);
6526
+ const bytes = (0, utils_ts_1.ensureBytes)("scalar", n);
6330
6527
  const len = bytes.length;
6331
6528
  if (len !== montgomeryBytes && len !== fieldLen) {
6332
6529
  let valid = "" + montgomeryBytes + " or " + fieldLen;
6333
6530
  throw new Error("invalid scalar, expected " + valid + " bytes, got " + len);
6334
6531
  }
6335
- return (0, utils_js_1.bytesToNumberLE)(adjustScalarBytes(bytes));
6532
+ return (0, utils_ts_1.bytesToNumberLE)(adjustScalarBytes(bytes));
6336
6533
  }
6337
6534
  function scalarMult(scalar, u) {
6338
6535
  const pointU = decodeUCoordinate(u);
@@ -6364,14 +6561,14 @@ var require_ed25519 = __commonJS((exports) => {
6364
6561
  exports.edwardsToMontgomeryPub = edwardsToMontgomeryPub;
6365
6562
  exports.edwardsToMontgomeryPriv = edwardsToMontgomeryPriv;
6366
6563
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
6367
- var sha512_1 = require_sha512();
6564
+ var sha2_1 = require_sha2();
6368
6565
  var utils_1 = require_utils4();
6369
- var curve_js_1 = require_curve();
6370
- var edwards_js_1 = require_edwards();
6371
- var hash_to_curve_js_1 = require_hash_to_curve();
6372
- var modular_js_1 = require_modular();
6373
- var montgomery_js_1 = require_montgomery();
6374
- var utils_js_1 = require_utils5();
6566
+ var curve_ts_1 = require_curve();
6567
+ var edwards_ts_1 = require_edwards();
6568
+ var hash_to_curve_ts_1 = require_hash_to_curve();
6569
+ var modular_ts_1 = require_modular();
6570
+ var montgomery_ts_1 = require_montgomery();
6571
+ var utils_ts_1 = require_utils5();
6375
6572
  var ED25519_P = BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");
6376
6573
  var ED25519_SQRT_M1 = /* @__PURE__ */ BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");
6377
6574
  var _0n = BigInt(0);
@@ -6385,16 +6582,16 @@ var require_ed25519 = __commonJS((exports) => {
6385
6582
  const P = ED25519_P;
6386
6583
  const x2 = x * x % P;
6387
6584
  const b2 = x2 * x % P;
6388
- const b4 = (0, modular_js_1.pow2)(b2, _2n, P) * b2 % P;
6389
- const b5 = (0, modular_js_1.pow2)(b4, _1n, P) * x % P;
6390
- const b10 = (0, modular_js_1.pow2)(b5, _5n, P) * b5 % P;
6391
- const b20 = (0, modular_js_1.pow2)(b10, _10n, P) * b10 % P;
6392
- const b40 = (0, modular_js_1.pow2)(b20, _20n, P) * b20 % P;
6393
- const b80 = (0, modular_js_1.pow2)(b40, _40n, P) * b40 % P;
6394
- const b160 = (0, modular_js_1.pow2)(b80, _80n, P) * b80 % P;
6395
- const b240 = (0, modular_js_1.pow2)(b160, _80n, P) * b80 % P;
6396
- const b250 = (0, modular_js_1.pow2)(b240, _10n, P) * b10 % P;
6397
- const pow_p_5_8 = (0, modular_js_1.pow2)(b250, _2n, P) * x % P;
6585
+ const b4 = (0, modular_ts_1.pow2)(b2, _2n, P) * b2 % P;
6586
+ const b5 = (0, modular_ts_1.pow2)(b4, _1n, P) * x % P;
6587
+ const b10 = (0, modular_ts_1.pow2)(b5, _5n, P) * b5 % P;
6588
+ const b20 = (0, modular_ts_1.pow2)(b10, _10n, P) * b10 % P;
6589
+ const b40 = (0, modular_ts_1.pow2)(b20, _20n, P) * b20 % P;
6590
+ const b80 = (0, modular_ts_1.pow2)(b40, _40n, P) * b40 % P;
6591
+ const b160 = (0, modular_ts_1.pow2)(b80, _80n, P) * b80 % P;
6592
+ const b240 = (0, modular_ts_1.pow2)(b160, _80n, P) * b80 % P;
6593
+ const b250 = (0, modular_ts_1.pow2)(b240, _10n, P) * b10 % P;
6594
+ const pow_p_5_8 = (0, modular_ts_1.pow2)(b250, _2n, P) * x % P;
6398
6595
  return { pow_p_5_8, b2 };
6399
6596
  }
6400
6597
  function adjustScalarBytes(bytes) {
@@ -6405,22 +6602,22 @@ var require_ed25519 = __commonJS((exports) => {
6405
6602
  }
6406
6603
  function uvRatio(u, v) {
6407
6604
  const P = ED25519_P;
6408
- const v3 = (0, modular_js_1.mod)(v * v * v, P);
6409
- const v7 = (0, modular_js_1.mod)(v3 * v3 * v, P);
6605
+ const v3 = (0, modular_ts_1.mod)(v * v * v, P);
6606
+ const v7 = (0, modular_ts_1.mod)(v3 * v3 * v, P);
6410
6607
  const pow = ed25519_pow_2_252_3(u * v7).pow_p_5_8;
6411
- let x = (0, modular_js_1.mod)(u * v3 * pow, P);
6412
- const vx2 = (0, modular_js_1.mod)(v * x * x, P);
6608
+ let x = (0, modular_ts_1.mod)(u * v3 * pow, P);
6609
+ const vx2 = (0, modular_ts_1.mod)(v * x * x, P);
6413
6610
  const root1 = x;
6414
- const root2 = (0, modular_js_1.mod)(x * ED25519_SQRT_M1, P);
6611
+ const root2 = (0, modular_ts_1.mod)(x * ED25519_SQRT_M1, P);
6415
6612
  const useRoot1 = vx2 === u;
6416
- const useRoot2 = vx2 === (0, modular_js_1.mod)(-u, P);
6417
- const noRoot = vx2 === (0, modular_js_1.mod)(-u * ED25519_SQRT_M1, P);
6613
+ const useRoot2 = vx2 === (0, modular_ts_1.mod)(-u, P);
6614
+ const noRoot = vx2 === (0, modular_ts_1.mod)(-u * ED25519_SQRT_M1, P);
6418
6615
  if (useRoot1)
6419
6616
  x = root1;
6420
6617
  if (useRoot2 || noRoot)
6421
6618
  x = root2;
6422
- if ((0, modular_js_1.isNegativeLE)(x, P))
6423
- x = (0, modular_js_1.mod)(-x, P);
6619
+ if ((0, modular_ts_1.isNegativeLE)(x, P))
6620
+ x = (0, modular_ts_1.mod)(-x, P);
6424
6621
  return { isValid: useRoot1 || useRoot2, value: x };
6425
6622
  }
6426
6623
  exports.ED25519_TORSION_SUBGROUP = [
@@ -6433,35 +6630,35 @@ var require_ed25519 = __commonJS((exports) => {
6433
6630
  "0000000000000000000000000000000000000000000000000000000000000000",
6434
6631
  "c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"
6435
6632
  ];
6436
- var Fp = /* @__PURE__ */ (() => (0, modular_js_1.Field)(ED25519_P, undefined, true))();
6633
+ var Fp = /* @__PURE__ */ (() => (0, modular_ts_1.Field)(ED25519_P, undefined, true))();
6437
6634
  var ed25519Defaults = /* @__PURE__ */ (() => ({
6438
- a: BigInt(-1),
6635
+ a: Fp.create(BigInt(-1)),
6439
6636
  d: BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),
6440
6637
  Fp,
6441
6638
  n: BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),
6442
6639
  h: _8n,
6443
6640
  Gx: BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),
6444
6641
  Gy: BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),
6445
- hash: sha512_1.sha512,
6642
+ hash: sha2_1.sha512,
6446
6643
  randomBytes: utils_1.randomBytes,
6447
6644
  adjustScalarBytes,
6448
6645
  uvRatio
6449
6646
  }))();
6450
- exports.ed25519 = (() => (0, edwards_js_1.twistedEdwards)(ed25519Defaults))();
6647
+ exports.ed25519 = (() => (0, edwards_ts_1.twistedEdwards)(ed25519Defaults))();
6451
6648
  function ed25519_domain(data, ctx, phflag) {
6452
6649
  if (ctx.length > 255)
6453
6650
  throw new Error("Context is too big");
6454
6651
  return (0, utils_1.concatBytes)((0, utils_1.utf8ToBytes)("SigEd25519 no Ed25519 collisions"), new Uint8Array([phflag ? 1 : 0, ctx.length]), ctx, data);
6455
6652
  }
6456
- exports.ed25519ctx = (() => (0, edwards_js_1.twistedEdwards)({
6653
+ exports.ed25519ctx = (() => (0, edwards_ts_1.twistedEdwards)({
6457
6654
  ...ed25519Defaults,
6458
6655
  domain: ed25519_domain
6459
6656
  }))();
6460
- exports.ed25519ph = (() => (0, edwards_js_1.twistedEdwards)(Object.assign({}, ed25519Defaults, {
6657
+ exports.ed25519ph = (() => (0, edwards_ts_1.twistedEdwards)(Object.assign({}, ed25519Defaults, {
6461
6658
  domain: ed25519_domain,
6462
- prehash: sha512_1.sha512
6659
+ prehash: sha2_1.sha512
6463
6660
  })))();
6464
- exports.x25519 = (() => (0, montgomery_js_1.montgomery)({
6661
+ exports.x25519 = (() => (0, montgomery_ts_1.montgomery)({
6465
6662
  P: ED25519_P,
6466
6663
  a: BigInt(486662),
6467
6664
  montgomeryBits: 255,
@@ -6470,7 +6667,7 @@ var require_ed25519 = __commonJS((exports) => {
6470
6667
  powPminus2: (x) => {
6471
6668
  const P = ED25519_P;
6472
6669
  const { pow_p_5_8, b2 } = ed25519_pow_2_252_3(x);
6473
- return (0, modular_js_1.mod)((0, modular_js_1.pow2)(pow_p_5_8, _3n, P) * b2, P);
6670
+ return (0, modular_ts_1.mod)((0, modular_ts_1.pow2)(pow_p_5_8, _3n, P) * b2, P);
6474
6671
  },
6475
6672
  adjustScalarBytes,
6476
6673
  randomBytes: utils_1.randomBytes
@@ -6531,7 +6728,7 @@ var require_ed25519 = __commonJS((exports) => {
6531
6728
  y = Fp.cmov(y, Fp.neg(y), e3 !== e4);
6532
6729
  return { xMn: xn, xMd: xd, yMn: y, yMd: _1n };
6533
6730
  }
6534
- var ELL2_C1_EDWARDS = /* @__PURE__ */ (() => (0, modular_js_1.FpSqrtEven)(Fp, Fp.neg(BigInt(486664))))();
6731
+ var ELL2_C1_EDWARDS = /* @__PURE__ */ (() => (0, modular_ts_1.FpSqrtEven)(Fp, Fp.neg(BigInt(486664))))();
6535
6732
  function map_to_curve_elligator2_edwards25519(u) {
6536
6733
  const { xMn, xMd, yMn, yMd } = map_to_curve_elligator2_curve25519(u);
6537
6734
  let xn = Fp.mul(xMn, yMd);
@@ -6548,18 +6745,18 @@ var require_ed25519 = __commonJS((exports) => {
6548
6745
  const inv = Fp.invertBatch([xd, yd]);
6549
6746
  return { x: Fp.mul(xn, inv[0]), y: Fp.mul(yn, inv[1]) };
6550
6747
  }
6551
- var htf = /* @__PURE__ */ (() => (0, hash_to_curve_js_1.createHasher)(exports.ed25519.ExtendedPoint, (scalars) => map_to_curve_elligator2_edwards25519(scalars[0]), {
6748
+ var htf = /* @__PURE__ */ (() => (0, hash_to_curve_ts_1.createHasher)(exports.ed25519.ExtendedPoint, (scalars) => map_to_curve_elligator2_edwards25519(scalars[0]), {
6552
6749
  DST: "edwards25519_XMD:SHA-512_ELL2_RO_",
6553
6750
  encodeDST: "edwards25519_XMD:SHA-512_ELL2_NU_",
6554
6751
  p: Fp.ORDER,
6555
6752
  m: 1,
6556
6753
  k: 128,
6557
6754
  expand: "xmd",
6558
- hash: sha512_1.sha512
6755
+ hash: sha2_1.sha512
6559
6756
  }))();
6560
6757
  exports.hashToCurve = (() => htf.hashToCurve)();
6561
6758
  exports.encodeToCurve = (() => htf.encodeToCurve)();
6562
- function assertRstPoint(other) {
6759
+ function aristp(other) {
6563
6760
  if (!(other instanceof RistPoint))
6564
6761
  throw new Error("RistrettoPoint expected");
6565
6762
  }
@@ -6570,7 +6767,7 @@ var require_ed25519 = __commonJS((exports) => {
6570
6767
  var D_MINUS_ONE_SQ = /* @__PURE__ */ BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");
6571
6768
  var invertSqrt = (number) => uvRatio(_1n, number);
6572
6769
  var MAX_255B = /* @__PURE__ */ BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
6573
- var bytes255ToNumberLE = (bytes) => exports.ed25519.CURVE.Fp.create((0, utils_js_1.bytesToNumberLE)(bytes) & MAX_255B);
6770
+ var bytes255ToNumberLE = (bytes) => exports.ed25519.CURVE.Fp.create((0, utils_ts_1.bytesToNumberLE)(bytes) & MAX_255B);
6574
6771
  function calcElligatorRistrettoMap(r0) {
6575
6772
  const { d } = exports.ed25519.CURVE;
6576
6773
  const P = exports.ed25519.CURVE.Fp.ORDER;
@@ -6581,7 +6778,7 @@ var require_ed25519 = __commonJS((exports) => {
6581
6778
  const D = mod((c - d * r) * mod(r + d));
6582
6779
  let { isValid: Ns_D_is_sq, value: s } = uvRatio(Ns, D);
6583
6780
  let s_ = mod(s * r0);
6584
- if (!(0, modular_js_1.isNegativeLE)(s_, P))
6781
+ if (!(0, modular_ts_1.isNegativeLE)(s_, P))
6585
6782
  s_ = mod(-s_);
6586
6783
  if (!Ns_D_is_sq)
6587
6784
  s = s_;
@@ -6604,7 +6801,7 @@ var require_ed25519 = __commonJS((exports) => {
6604
6801
  return new RistPoint(exports.ed25519.ExtendedPoint.fromAffine(ap));
6605
6802
  }
6606
6803
  static hashToCurve(hex) {
6607
- hex = (0, utils_js_1.ensureBytes)("ristrettoHash", hex, 64);
6804
+ hex = (0, utils_ts_1.ensureBytes)("ristrettoHash", hex, 64);
6608
6805
  const r1 = bytes255ToNumberLE(hex.slice(0, 32));
6609
6806
  const R1 = calcElligatorRistrettoMap(r1);
6610
6807
  const r2 = bytes255ToNumberLE(hex.slice(32, 64));
@@ -6612,13 +6809,13 @@ var require_ed25519 = __commonJS((exports) => {
6612
6809
  return new RistPoint(R1.add(R2));
6613
6810
  }
6614
6811
  static fromHex(hex) {
6615
- hex = (0, utils_js_1.ensureBytes)("ristrettoHex", hex, 32);
6812
+ hex = (0, utils_ts_1.ensureBytes)("ristrettoHex", hex, 32);
6616
6813
  const { a, d } = exports.ed25519.CURVE;
6617
6814
  const P = exports.ed25519.CURVE.Fp.ORDER;
6618
6815
  const mod = exports.ed25519.CURVE.Fp.create;
6619
6816
  const emsg = "RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint";
6620
6817
  const s = bytes255ToNumberLE(hex);
6621
- if (!(0, utils_js_1.equalBytes)((0, utils_js_1.numberToBytesLE)(s, 32), hex) || (0, modular_js_1.isNegativeLE)(s, P))
6818
+ if (!(0, utils_ts_1.equalBytes)((0, utils_ts_1.numberToBytesLE)(s, 32), hex) || (0, modular_ts_1.isNegativeLE)(s, P))
6622
6819
  throw new Error(emsg);
6623
6820
  const s2 = mod(s * s);
6624
6821
  const u1 = mod(_1n + a * s2);
@@ -6630,17 +6827,17 @@ var require_ed25519 = __commonJS((exports) => {
6630
6827
  const Dx = mod(I * u2);
6631
6828
  const Dy = mod(I * Dx * v);
6632
6829
  let x = mod((s + s) * Dx);
6633
- if ((0, modular_js_1.isNegativeLE)(x, P))
6830
+ if ((0, modular_ts_1.isNegativeLE)(x, P))
6634
6831
  x = mod(-x);
6635
6832
  const y = mod(u1 * Dy);
6636
6833
  const t = mod(x * y);
6637
- if (!isValid2 || (0, modular_js_1.isNegativeLE)(t, P) || y === _0n)
6834
+ if (!isValid2 || (0, modular_ts_1.isNegativeLE)(t, P) || y === _0n)
6638
6835
  throw new Error(emsg);
6639
6836
  return new RistPoint(new exports.ed25519.ExtendedPoint(x, y, _1n, t));
6640
6837
  }
6641
6838
  static msm(points, scalars) {
6642
- const Fn = (0, modular_js_1.Field)(exports.ed25519.CURVE.n, exports.ed25519.CURVE.nBitLength);
6643
- return (0, curve_js_1.pippenger)(RistPoint, Fn, points, scalars);
6839
+ const Fn = (0, modular_ts_1.Field)(exports.ed25519.CURVE.n, exports.ed25519.CURVE.nBitLength);
6840
+ return (0, curve_ts_1.pippenger)(RistPoint, Fn, points, scalars);
6644
6841
  }
6645
6842
  toRawBytes() {
6646
6843
  let { ex: x, ey: y, ez: z2, et: t } = this.ep;
@@ -6654,7 +6851,7 @@ var require_ed25519 = __commonJS((exports) => {
6654
6851
  const D2 = mod(invsqrt * u2);
6655
6852
  const zInv = mod(D1 * D2 * t);
6656
6853
  let D;
6657
- if ((0, modular_js_1.isNegativeLE)(t * zInv, P)) {
6854
+ if ((0, modular_ts_1.isNegativeLE)(t * zInv, P)) {
6658
6855
  let _x = mod(y * SQRT_M1);
6659
6856
  let _y = mod(x * SQRT_M1);
6660
6857
  x = _x;
@@ -6663,21 +6860,21 @@ var require_ed25519 = __commonJS((exports) => {
6663
6860
  } else {
6664
6861
  D = D2;
6665
6862
  }
6666
- if ((0, modular_js_1.isNegativeLE)(x * zInv, P))
6863
+ if ((0, modular_ts_1.isNegativeLE)(x * zInv, P))
6667
6864
  y = mod(-y);
6668
6865
  let s = mod((z2 - y) * D);
6669
- if ((0, modular_js_1.isNegativeLE)(s, P))
6866
+ if ((0, modular_ts_1.isNegativeLE)(s, P))
6670
6867
  s = mod(-s);
6671
- return (0, utils_js_1.numberToBytesLE)(s, 32);
6868
+ return (0, utils_ts_1.numberToBytesLE)(s, 32);
6672
6869
  }
6673
6870
  toHex() {
6674
- return (0, utils_js_1.bytesToHex)(this.toRawBytes());
6871
+ return (0, utils_ts_1.bytesToHex)(this.toRawBytes());
6675
6872
  }
6676
6873
  toString() {
6677
6874
  return this.toHex();
6678
6875
  }
6679
6876
  equals(other) {
6680
- assertRstPoint(other);
6877
+ aristp(other);
6681
6878
  const { ex: X1, ey: Y1 } = this.ep;
6682
6879
  const { ex: X2, ey: Y2 } = other.ep;
6683
6880
  const mod = exports.ed25519.CURVE.Fp.create;
@@ -6686,11 +6883,11 @@ var require_ed25519 = __commonJS((exports) => {
6686
6883
  return one || two;
6687
6884
  }
6688
6885
  add(other) {
6689
- assertRstPoint(other);
6886
+ aristp(other);
6690
6887
  return new RistPoint(this.ep.add(other.ep));
6691
6888
  }
6692
6889
  subtract(other) {
6693
- assertRstPoint(other);
6890
+ aristp(other);
6694
6891
  return new RistPoint(this.ep.subtract(other.ep));
6695
6892
  }
6696
6893
  multiply(scalar) {
@@ -6716,7 +6913,7 @@ var require_ed25519 = __commonJS((exports) => {
6716
6913
  var hashToRistretto255 = (msg, options) => {
6717
6914
  const d = options.DST;
6718
6915
  const DST = typeof d === "string" ? (0, utils_1.utf8ToBytes)(d) : d;
6719
- const uniform_bytes = (0, hash_to_curve_js_1.expand_message_xmd)(msg, DST, 64, sha512_1.sha512);
6916
+ const uniform_bytes = (0, hash_to_curve_ts_1.expand_message_xmd)(msg, DST, 64, sha2_1.sha512);
6720
6917
  const P = RistPoint.hashToCurve(uniform_bytes);
6721
6918
  return P;
6722
6919
  };
@@ -6724,193 +6921,20 @@ var require_ed25519 = __commonJS((exports) => {
6724
6921
  exports.hash_to_ristretto255 = exports.hashToRistretto255;
6725
6922
  });
6726
6923
 
6727
- // ../../node_modules/@noble/hashes/sha256.js
6728
- var require_sha256 = __commonJS((exports) => {
6729
- Object.defineProperty(exports, "__esModule", { value: true });
6730
- exports.sha224 = exports.sha256 = exports.SHA256 = undefined;
6731
- var _md_js_1 = require__md();
6732
- var utils_js_1 = require_utils4();
6733
- var SHA256_K = /* @__PURE__ */ new Uint32Array([
6734
- 1116352408,
6735
- 1899447441,
6736
- 3049323471,
6737
- 3921009573,
6738
- 961987163,
6739
- 1508970993,
6740
- 2453635748,
6741
- 2870763221,
6742
- 3624381080,
6743
- 310598401,
6744
- 607225278,
6745
- 1426881987,
6746
- 1925078388,
6747
- 2162078206,
6748
- 2614888103,
6749
- 3248222580,
6750
- 3835390401,
6751
- 4022224774,
6752
- 264347078,
6753
- 604807628,
6754
- 770255983,
6755
- 1249150122,
6756
- 1555081692,
6757
- 1996064986,
6758
- 2554220882,
6759
- 2821834349,
6760
- 2952996808,
6761
- 3210313671,
6762
- 3336571891,
6763
- 3584528711,
6764
- 113926993,
6765
- 338241895,
6766
- 666307205,
6767
- 773529912,
6768
- 1294757372,
6769
- 1396182291,
6770
- 1695183700,
6771
- 1986661051,
6772
- 2177026350,
6773
- 2456956037,
6774
- 2730485921,
6775
- 2820302411,
6776
- 3259730800,
6777
- 3345764771,
6778
- 3516065817,
6779
- 3600352804,
6780
- 4094571909,
6781
- 275423344,
6782
- 430227734,
6783
- 506948616,
6784
- 659060556,
6785
- 883997877,
6786
- 958139571,
6787
- 1322822218,
6788
- 1537002063,
6789
- 1747873779,
6790
- 1955562222,
6791
- 2024104815,
6792
- 2227730452,
6793
- 2361852424,
6794
- 2428436474,
6795
- 2756734187,
6796
- 3204031479,
6797
- 3329325298
6798
- ]);
6799
- var SHA256_IV = /* @__PURE__ */ new Uint32Array([
6800
- 1779033703,
6801
- 3144134277,
6802
- 1013904242,
6803
- 2773480762,
6804
- 1359893119,
6805
- 2600822924,
6806
- 528734635,
6807
- 1541459225
6808
- ]);
6809
- var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
6810
-
6811
- class SHA256 extends _md_js_1.HashMD {
6812
- constructor() {
6813
- super(64, 32, 8, false);
6814
- this.A = SHA256_IV[0] | 0;
6815
- this.B = SHA256_IV[1] | 0;
6816
- this.C = SHA256_IV[2] | 0;
6817
- this.D = SHA256_IV[3] | 0;
6818
- this.E = SHA256_IV[4] | 0;
6819
- this.F = SHA256_IV[5] | 0;
6820
- this.G = SHA256_IV[6] | 0;
6821
- this.H = SHA256_IV[7] | 0;
6822
- }
6823
- get() {
6824
- const { A, B, C, D, E, F, G, H } = this;
6825
- return [A, B, C, D, E, F, G, H];
6826
- }
6827
- set(A, B, C, D, E, F, G, H) {
6828
- this.A = A | 0;
6829
- this.B = B | 0;
6830
- this.C = C | 0;
6831
- this.D = D | 0;
6832
- this.E = E | 0;
6833
- this.F = F | 0;
6834
- this.G = G | 0;
6835
- this.H = H | 0;
6836
- }
6837
- process(view, offset) {
6838
- for (let i = 0;i < 16; i++, offset += 4)
6839
- SHA256_W[i] = view.getUint32(offset, false);
6840
- for (let i = 16;i < 64; i++) {
6841
- const W15 = SHA256_W[i - 15];
6842
- const W2 = SHA256_W[i - 2];
6843
- const s0 = (0, utils_js_1.rotr)(W15, 7) ^ (0, utils_js_1.rotr)(W15, 18) ^ W15 >>> 3;
6844
- const s1 = (0, utils_js_1.rotr)(W2, 17) ^ (0, utils_js_1.rotr)(W2, 19) ^ W2 >>> 10;
6845
- SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
6846
- }
6847
- let { A, B, C, D, E, F, G, H } = this;
6848
- for (let i = 0;i < 64; i++) {
6849
- const sigma1 = (0, utils_js_1.rotr)(E, 6) ^ (0, utils_js_1.rotr)(E, 11) ^ (0, utils_js_1.rotr)(E, 25);
6850
- const T1 = H + sigma1 + (0, _md_js_1.Chi)(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
6851
- const sigma0 = (0, utils_js_1.rotr)(A, 2) ^ (0, utils_js_1.rotr)(A, 13) ^ (0, utils_js_1.rotr)(A, 22);
6852
- const T2 = sigma0 + (0, _md_js_1.Maj)(A, B, C) | 0;
6853
- H = G;
6854
- G = F;
6855
- F = E;
6856
- E = D + T1 | 0;
6857
- D = C;
6858
- C = B;
6859
- B = A;
6860
- A = T1 + T2 | 0;
6861
- }
6862
- A = A + this.A | 0;
6863
- B = B + this.B | 0;
6864
- C = C + this.C | 0;
6865
- D = D + this.D | 0;
6866
- E = E + this.E | 0;
6867
- F = F + this.F | 0;
6868
- G = G + this.G | 0;
6869
- H = H + this.H | 0;
6870
- this.set(A, B, C, D, E, F, G, H);
6871
- }
6872
- roundClean() {
6873
- SHA256_W.fill(0);
6874
- }
6875
- destroy() {
6876
- this.set(0, 0, 0, 0, 0, 0, 0, 0);
6877
- this.buffer.fill(0);
6878
- }
6879
- }
6880
- exports.SHA256 = SHA256;
6881
-
6882
- class SHA224 extends SHA256 {
6883
- constructor() {
6884
- super();
6885
- this.A = 3238371032 | 0;
6886
- this.B = 914150663 | 0;
6887
- this.C = 812702999 | 0;
6888
- this.D = 4144912697 | 0;
6889
- this.E = 4290775857 | 0;
6890
- this.F = 1750603025 | 0;
6891
- this.G = 1694076839 | 0;
6892
- this.H = 3204075428 | 0;
6893
- this.outputLen = 28;
6894
- }
6895
- }
6896
- exports.sha256 = (0, utils_js_1.wrapConstructor)(() => new SHA256);
6897
- exports.sha224 = (0, utils_js_1.wrapConstructor)(() => new SHA224);
6898
- });
6899
-
6900
6924
  // ../../node_modules/@noble/hashes/hmac.js
6901
6925
  var require_hmac = __commonJS((exports) => {
6902
6926
  Object.defineProperty(exports, "__esModule", { value: true });
6903
6927
  exports.hmac = exports.HMAC = undefined;
6904
- var _assert_js_1 = require__assert2();
6905
- var utils_js_1 = require_utils4();
6928
+ var _assert_ts_1 = require__assert2();
6929
+ var utils_ts_1 = require_utils4();
6906
6930
 
6907
- class HMAC extends utils_js_1.Hash {
6931
+ class HMAC extends utils_ts_1.Hash {
6908
6932
  constructor(hash, _key) {
6909
6933
  super();
6910
6934
  this.finished = false;
6911
6935
  this.destroyed = false;
6912
- (0, _assert_js_1.ahash)(hash);
6913
- const key = (0, utils_js_1.toBytes)(_key);
6936
+ (0, _assert_ts_1.ahash)(hash);
6937
+ const key = (0, utils_ts_1.toBytes)(_key);
6914
6938
  this.iHash = hash.create();
6915
6939
  if (typeof this.iHash.update !== "function")
6916
6940
  throw new Error("Expected instance of class which extends utils.Hash");
@@ -6929,13 +6953,13 @@ var require_hmac = __commonJS((exports) => {
6929
6953
  pad.fill(0);
6930
6954
  }
6931
6955
  update(buf) {
6932
- (0, _assert_js_1.aexists)(this);
6956
+ (0, _assert_ts_1.aexists)(this);
6933
6957
  this.iHash.update(buf);
6934
6958
  return this;
6935
6959
  }
6936
6960
  digestInto(out) {
6937
- (0, _assert_js_1.aexists)(this);
6938
- (0, _assert_js_1.abytes)(out, this.outputLen);
6961
+ (0, _assert_ts_1.aexists)(this);
6962
+ (0, _assert_ts_1.abytes)(out, this.outputLen);
6939
6963
  this.finished = true;
6940
6964
  this.iHash.digestInto(out);
6941
6965
  this.oHash.update(out);
@@ -6980,19 +7004,18 @@ var require_weierstrass = __commonJS((exports) => {
6980
7004
  exports.SWUFpSqrtRatio = SWUFpSqrtRatio;
6981
7005
  exports.mapToCurveSimpleSWU = mapToCurveSimpleSWU;
6982
7006
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
6983
- var curve_js_1 = require_curve();
6984
- var modular_js_1 = require_modular();
6985
- var ut = require_utils5();
6986
- var utils_js_1 = require_utils5();
7007
+ var curve_ts_1 = require_curve();
7008
+ var modular_ts_1 = require_modular();
7009
+ var utils_ts_1 = require_utils5();
6987
7010
  function validateSigVerOpts(opts) {
6988
7011
  if (opts.lowS !== undefined)
6989
- (0, utils_js_1.abool)("lowS", opts.lowS);
7012
+ (0, utils_ts_1.abool)("lowS", opts.lowS);
6990
7013
  if (opts.prehash !== undefined)
6991
- (0, utils_js_1.abool)("prehash", opts.prehash);
7014
+ (0, utils_ts_1.abool)("prehash", opts.prehash);
6992
7015
  }
6993
7016
  function validatePointOpts(curve) {
6994
- const opts = (0, curve_js_1.validateBasic)(curve);
6995
- ut.validateObject(opts, {
7017
+ const opts = (0, curve_ts_1.validateBasic)(curve);
7018
+ (0, utils_ts_1.validateObject)(opts, {
6996
7019
  a: "field",
6997
7020
  b: "field"
6998
7021
  }, {
@@ -7015,7 +7038,6 @@ var require_weierstrass = __commonJS((exports) => {
7015
7038
  }
7016
7039
  return Object.freeze({ ...opts });
7017
7040
  }
7018
- var { bytesToNumberBE: b2n, hexToBytes: h2b } = ut;
7019
7041
 
7020
7042
  class DERErr extends Error {
7021
7043
  constructor(m = "") {
@@ -7033,11 +7055,11 @@ var require_weierstrass = __commonJS((exports) => {
7033
7055
  if (data.length & 1)
7034
7056
  throw new E("tlv.encode: unpadded data");
7035
7057
  const dataLen = data.length / 2;
7036
- const len = ut.numberToHexUnpadded(dataLen);
7058
+ const len = (0, utils_ts_1.numberToHexUnpadded)(dataLen);
7037
7059
  if (len.length / 2 & 128)
7038
7060
  throw new E("tlv.encode: long form length too big");
7039
- const lenLen = dataLen > 127 ? ut.numberToHexUnpadded(len.length / 2 | 128) : "";
7040
- const t = ut.numberToHexUnpadded(tag);
7061
+ const lenLen = dataLen > 127 ? (0, utils_ts_1.numberToHexUnpadded)(len.length / 2 | 128) : "";
7062
+ const t = (0, utils_ts_1.numberToHexUnpadded)(tag);
7041
7063
  return t + lenLen + len + data;
7042
7064
  },
7043
7065
  decode(tag, data) {
@@ -7080,7 +7102,7 @@ var require_weierstrass = __commonJS((exports) => {
7080
7102
  const { Err: E } = exports.DER;
7081
7103
  if (num < _0n)
7082
7104
  throw new E("integer: negative integers are not allowed");
7083
- let hex = ut.numberToHexUnpadded(num);
7105
+ let hex = (0, utils_ts_1.numberToHexUnpadded)(num);
7084
7106
  if (Number.parseInt(hex[0], 16) & 8)
7085
7107
  hex = "00" + hex;
7086
7108
  if (hex.length & 1)
@@ -7093,13 +7115,12 @@ var require_weierstrass = __commonJS((exports) => {
7093
7115
  throw new E("invalid signature integer: negative");
7094
7116
  if (data[0] === 0 && !(data[1] & 128))
7095
7117
  throw new E("invalid signature integer: unnecessary leading zero");
7096
- return b2n(data);
7118
+ return (0, utils_ts_1.bytesToNumberBE)(data);
7097
7119
  }
7098
7120
  },
7099
7121
  toSig(hex) {
7100
7122
  const { Err: E, _int: int, _tlv: tlv } = exports.DER;
7101
- const data = typeof hex === "string" ? h2b(hex) : hex;
7102
- ut.abytes(data);
7123
+ const data = (0, utils_ts_1.ensureBytes)("signature", hex);
7103
7124
  const { v: seqBytes, l: seqLeftBytes } = tlv.decode(48, data);
7104
7125
  if (seqLeftBytes.length)
7105
7126
  throw new E("invalid signature: left bytes after parsing");
@@ -7125,10 +7146,10 @@ var require_weierstrass = __commonJS((exports) => {
7125
7146
  function weierstrassPoints(opts) {
7126
7147
  const CURVE = validatePointOpts(opts);
7127
7148
  const { Fp } = CURVE;
7128
- const Fn = (0, modular_js_1.Field)(CURVE.n, CURVE.nBitLength);
7149
+ const Fn = (0, modular_ts_1.Field)(CURVE.n, CURVE.nBitLength);
7129
7150
  const toBytes = CURVE.toBytes || ((_c, point, _isCompressed) => {
7130
7151
  const a = point.toAffine();
7131
- return ut.concatBytes(Uint8Array.from([4]), Fp.toBytes(a.x), Fp.toBytes(a.y));
7152
+ return (0, utils_ts_1.concatBytes)(Uint8Array.from([4]), Fp.toBytes(a.x), Fp.toBytes(a.y));
7132
7153
  });
7133
7154
  const fromBytes = CURVE.fromBytes || ((bytes) => {
7134
7155
  const tail = bytes.subarray(1);
@@ -7145,33 +7166,33 @@ var require_weierstrass = __commonJS((exports) => {
7145
7166
  if (!Fp.eql(Fp.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx)))
7146
7167
  throw new Error("bad generator point: equation left != right");
7147
7168
  function isWithinCurveOrder(num) {
7148
- return ut.inRange(num, _1n, CURVE.n);
7169
+ return (0, utils_ts_1.inRange)(num, _1n, CURVE.n);
7149
7170
  }
7150
7171
  function normPrivateKeyToScalar(key) {
7151
7172
  const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n: N } = CURVE;
7152
7173
  if (lengths && typeof key !== "bigint") {
7153
- if (ut.isBytes(key))
7154
- key = ut.bytesToHex(key);
7174
+ if ((0, utils_ts_1.isBytes)(key))
7175
+ key = (0, utils_ts_1.bytesToHex)(key);
7155
7176
  if (typeof key !== "string" || !lengths.includes(key.length))
7156
7177
  throw new Error("invalid private key");
7157
7178
  key = key.padStart(nByteLength * 2, "0");
7158
7179
  }
7159
7180
  let num;
7160
7181
  try {
7161
- num = typeof key === "bigint" ? key : ut.bytesToNumberBE((0, utils_js_1.ensureBytes)("private key", key, nByteLength));
7182
+ num = typeof key === "bigint" ? key : (0, utils_ts_1.bytesToNumberBE)((0, utils_ts_1.ensureBytes)("private key", key, nByteLength));
7162
7183
  } catch (error) {
7163
7184
  throw new Error("invalid private key, expected hex or " + nByteLength + " bytes, got " + typeof key);
7164
7185
  }
7165
7186
  if (wrapPrivateKey)
7166
- num = (0, modular_js_1.mod)(num, N);
7167
- ut.aInRange("private key", num, _1n, N);
7187
+ num = (0, modular_ts_1.mod)(num, N);
7188
+ (0, utils_ts_1.aInRange)("private key", num, _1n, N);
7168
7189
  return num;
7169
7190
  }
7170
- function assertPrjPoint(other) {
7191
+ function aprjpoint(other) {
7171
7192
  if (!(other instanceof Point))
7172
7193
  throw new Error("ProjectivePoint expected");
7173
7194
  }
7174
- const toAffineMemo = (0, utils_js_1.memoized)((p, iz) => {
7195
+ const toAffineMemo = (0, utils_ts_1.memoized)((p, iz) => {
7175
7196
  const { px: x, py: y, pz: z2 } = p;
7176
7197
  if (Fp.eql(z2, Fp.ONE))
7177
7198
  return { x, y };
@@ -7187,7 +7208,7 @@ var require_weierstrass = __commonJS((exports) => {
7187
7208
  throw new Error("invZ was invalid");
7188
7209
  return { x: ax, y: ay };
7189
7210
  });
7190
- const assertValidMemo = (0, utils_js_1.memoized)((p) => {
7211
+ const assertValidMemo = (0, utils_ts_1.memoized)((p) => {
7191
7212
  if (p.is0()) {
7192
7213
  if (CURVE.allowInfinityPoint && !Fp.is0(p.py))
7193
7214
  return;
@@ -7207,15 +7228,15 @@ var require_weierstrass = __commonJS((exports) => {
7207
7228
 
7208
7229
  class Point {
7209
7230
  constructor(px, py, pz) {
7210
- this.px = px;
7211
- this.py = py;
7212
- this.pz = pz;
7213
7231
  if (px == null || !Fp.isValid(px))
7214
7232
  throw new Error("x required");
7215
7233
  if (py == null || !Fp.isValid(py))
7216
7234
  throw new Error("y required");
7217
7235
  if (pz == null || !Fp.isValid(pz))
7218
7236
  throw new Error("z required");
7237
+ this.px = px;
7238
+ this.py = py;
7239
+ this.pz = pz;
7219
7240
  Object.freeze(this);
7220
7241
  }
7221
7242
  static fromAffine(p) {
@@ -7240,7 +7261,7 @@ var require_weierstrass = __commonJS((exports) => {
7240
7261
  return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);
7241
7262
  }
7242
7263
  static fromHex(hex) {
7243
- const P = Point.fromAffine(fromBytes((0, utils_js_1.ensureBytes)("pointHex", hex)));
7264
+ const P = Point.fromAffine(fromBytes((0, utils_ts_1.ensureBytes)("pointHex", hex)));
7244
7265
  P.assertValidity();
7245
7266
  return P;
7246
7267
  }
@@ -7248,7 +7269,7 @@ var require_weierstrass = __commonJS((exports) => {
7248
7269
  return Point.BASE.multiply(normPrivateKeyToScalar(privateKey));
7249
7270
  }
7250
7271
  static msm(points, scalars) {
7251
- return (0, curve_js_1.pippenger)(Point, Fn, points, scalars);
7272
+ return (0, curve_ts_1.pippenger)(Point, Fn, points, scalars);
7252
7273
  }
7253
7274
  _setWindowSize(windowSize) {
7254
7275
  wnaf.setWindowSize(this, windowSize);
@@ -7263,7 +7284,7 @@ var require_weierstrass = __commonJS((exports) => {
7263
7284
  throw new Error("Field doesn't support isOdd");
7264
7285
  }
7265
7286
  equals(other) {
7266
- assertPrjPoint(other);
7287
+ aprjpoint(other);
7267
7288
  const { px: X1, py: Y1, pz: Z1 } = this;
7268
7289
  const { px: X2, py: Y2, pz: Z2 } = other;
7269
7290
  const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1));
@@ -7312,7 +7333,7 @@ var require_weierstrass = __commonJS((exports) => {
7312
7333
  return new Point(X3, Y3, Z3);
7313
7334
  }
7314
7335
  add(other) {
7315
- assertPrjPoint(other);
7336
+ aprjpoint(other);
7316
7337
  const { px: X1, py: Y1, pz: Z1 } = this;
7317
7338
  const { px: X2, py: Y2, pz: Z2 } = other;
7318
7339
  let { ZERO: X3, ZERO: Y3, ZERO: Z3 } = Fp;
@@ -7371,7 +7392,7 @@ var require_weierstrass = __commonJS((exports) => {
7371
7392
  }
7372
7393
  multiplyUnsafe(sc) {
7373
7394
  const { endo, n: N } = CURVE;
7374
- ut.aInRange("scalar", sc, _0n, N);
7395
+ (0, utils_ts_1.aInRange)("scalar", sc, _0n, N);
7375
7396
  const I = Point.ZERO;
7376
7397
  if (sc === _0n)
7377
7398
  return I;
@@ -7401,7 +7422,7 @@ var require_weierstrass = __commonJS((exports) => {
7401
7422
  }
7402
7423
  multiply(scalar) {
7403
7424
  const { endo, n: N } = CURVE;
7404
- ut.aInRange("scalar", scalar, _1n, N);
7425
+ (0, utils_ts_1.aInRange)("scalar", scalar, _1n, N);
7405
7426
  let point, fake;
7406
7427
  if (endo) {
7407
7428
  const { k1neg, k1, k2neg, k2 } = endo.splitScalar(scalar);
@@ -7445,19 +7466,19 @@ var require_weierstrass = __commonJS((exports) => {
7445
7466
  return this.multiplyUnsafe(CURVE.h);
7446
7467
  }
7447
7468
  toRawBytes(isCompressed = true) {
7448
- (0, utils_js_1.abool)("isCompressed", isCompressed);
7469
+ (0, utils_ts_1.abool)("isCompressed", isCompressed);
7449
7470
  this.assertValidity();
7450
7471
  return toBytes(Point, this, isCompressed);
7451
7472
  }
7452
7473
  toHex(isCompressed = true) {
7453
- (0, utils_js_1.abool)("isCompressed", isCompressed);
7454
- return ut.bytesToHex(this.toRawBytes(isCompressed));
7474
+ (0, utils_ts_1.abool)("isCompressed", isCompressed);
7475
+ return (0, utils_ts_1.bytesToHex)(this.toRawBytes(isCompressed));
7455
7476
  }
7456
7477
  }
7457
7478
  Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);
7458
7479
  Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO);
7459
7480
  const _bits = CURVE.nBitLength;
7460
- const wnaf = (0, curve_js_1.wNAF)(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits);
7481
+ const wnaf = (0, curve_ts_1.wNAF)(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits);
7461
7482
  return {
7462
7483
  CURVE,
7463
7484
  ProjectivePoint: Point,
@@ -7467,8 +7488,8 @@ var require_weierstrass = __commonJS((exports) => {
7467
7488
  };
7468
7489
  }
7469
7490
  function validateOpts(curve) {
7470
- const opts = (0, curve_js_1.validateBasic)(curve);
7471
- ut.validateObject(opts, {
7491
+ const opts = (0, curve_ts_1.validateBasic)(curve);
7492
+ (0, utils_ts_1.validateObject)(opts, {
7472
7493
  hash: "hash",
7473
7494
  hmac: "function",
7474
7495
  randomBytes: "function"
@@ -7485,18 +7506,18 @@ var require_weierstrass = __commonJS((exports) => {
7485
7506
  const compressedLen = Fp.BYTES + 1;
7486
7507
  const uncompressedLen = 2 * Fp.BYTES + 1;
7487
7508
  function modN(a) {
7488
- return (0, modular_js_1.mod)(a, CURVE_ORDER);
7509
+ return (0, modular_ts_1.mod)(a, CURVE_ORDER);
7489
7510
  }
7490
7511
  function invN(a) {
7491
- return (0, modular_js_1.invert)(a, CURVE_ORDER);
7512
+ return (0, modular_ts_1.invert)(a, CURVE_ORDER);
7492
7513
  }
7493
7514
  const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder } = weierstrassPoints({
7494
7515
  ...CURVE,
7495
7516
  toBytes(_c, point, isCompressed) {
7496
7517
  const a = point.toAffine();
7497
7518
  const x = Fp.toBytes(a.x);
7498
- const cat = ut.concatBytes;
7499
- (0, utils_js_1.abool)("isCompressed", isCompressed);
7519
+ const cat = utils_ts_1.concatBytes;
7520
+ (0, utils_ts_1.abool)("isCompressed", isCompressed);
7500
7521
  if (isCompressed) {
7501
7522
  return cat(Uint8Array.from([point.hasEvenY() ? 2 : 3]), x);
7502
7523
  } else {
@@ -7508,8 +7529,8 @@ var require_weierstrass = __commonJS((exports) => {
7508
7529
  const head = bytes[0];
7509
7530
  const tail = bytes.subarray(1);
7510
7531
  if (len === compressedLen && (head === 2 || head === 3)) {
7511
- const x = ut.bytesToNumberBE(tail);
7512
- if (!ut.inRange(x, _1n, Fp.ORDER))
7532
+ const x = (0, utils_ts_1.bytesToNumberBE)(tail);
7533
+ if (!(0, utils_ts_1.inRange)(x, _1n, Fp.ORDER))
7513
7534
  throw new Error("Point is not on curve");
7514
7535
  const y2 = weierstrassEquation(x);
7515
7536
  let y;
@@ -7535,7 +7556,7 @@ var require_weierstrass = __commonJS((exports) => {
7535
7556
  }
7536
7557
  }
7537
7558
  });
7538
- const numToNByteStr = (num) => ut.bytesToHex(ut.numberToBytesBE(num, CURVE.nByteLength));
7559
+ const numToNByteHex = (num) => (0, utils_ts_1.bytesToHex)((0, utils_ts_1.numberToBytesBE)(num, CURVE.nByteLength));
7539
7560
  function isBiggerThanHalfOrder(number) {
7540
7561
  const HALF = CURVE_ORDER >> _1n;
7541
7562
  return number > HALF;
@@ -7543,41 +7564,41 @@ var require_weierstrass = __commonJS((exports) => {
7543
7564
  function normalizeS(s) {
7544
7565
  return isBiggerThanHalfOrder(s) ? modN(-s) : s;
7545
7566
  }
7546
- const slcNum = (b, from, to) => ut.bytesToNumberBE(b.slice(from, to));
7567
+ const slcNum = (b, from, to) => (0, utils_ts_1.bytesToNumberBE)(b.slice(from, to));
7547
7568
 
7548
7569
  class Signature {
7549
7570
  constructor(r, s, recovery) {
7571
+ (0, utils_ts_1.aInRange)("r", r, _1n, CURVE_ORDER);
7572
+ (0, utils_ts_1.aInRange)("s", s, _1n, CURVE_ORDER);
7550
7573
  this.r = r;
7551
7574
  this.s = s;
7552
- this.recovery = recovery;
7553
- this.assertValidity();
7575
+ if (recovery != null)
7576
+ this.recovery = recovery;
7577
+ Object.freeze(this);
7554
7578
  }
7555
7579
  static fromCompact(hex) {
7556
7580
  const l = CURVE.nByteLength;
7557
- hex = (0, utils_js_1.ensureBytes)("compactSignature", hex, l * 2);
7581
+ hex = (0, utils_ts_1.ensureBytes)("compactSignature", hex, l * 2);
7558
7582
  return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l));
7559
7583
  }
7560
7584
  static fromDER(hex) {
7561
- const { r, s } = exports.DER.toSig((0, utils_js_1.ensureBytes)("DER", hex));
7585
+ const { r, s } = exports.DER.toSig((0, utils_ts_1.ensureBytes)("DER", hex));
7562
7586
  return new Signature(r, s);
7563
7587
  }
7564
- assertValidity() {
7565
- ut.aInRange("r", this.r, _1n, CURVE_ORDER);
7566
- ut.aInRange("s", this.s, _1n, CURVE_ORDER);
7567
- }
7588
+ assertValidity() {}
7568
7589
  addRecoveryBit(recovery) {
7569
7590
  return new Signature(this.r, this.s, recovery);
7570
7591
  }
7571
7592
  recoverPublicKey(msgHash) {
7572
7593
  const { r, s, recovery: rec } = this;
7573
- const h = bits2int_modN((0, utils_js_1.ensureBytes)("msgHash", msgHash));
7594
+ const h = bits2int_modN((0, utils_ts_1.ensureBytes)("msgHash", msgHash));
7574
7595
  if (rec == null || ![0, 1, 2, 3].includes(rec))
7575
7596
  throw new Error("recovery id invalid");
7576
7597
  const radj = rec === 2 || rec === 3 ? r + CURVE.n : r;
7577
7598
  if (radj >= Fp.ORDER)
7578
7599
  throw new Error("recovery id 2 or 3 invalid");
7579
7600
  const prefix = (rec & 1) === 0 ? "02" : "03";
7580
- const R = Point.fromHex(prefix + numToNByteStr(radj));
7601
+ const R = Point.fromHex(prefix + numToNByteHex(radj));
7581
7602
  const ir = invN(radj);
7582
7603
  const u1 = modN(-h * ir);
7583
7604
  const u2 = modN(s * ir);
@@ -7594,16 +7615,16 @@ var require_weierstrass = __commonJS((exports) => {
7594
7615
  return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this;
7595
7616
  }
7596
7617
  toDERRawBytes() {
7597
- return ut.hexToBytes(this.toDERHex());
7618
+ return (0, utils_ts_1.hexToBytes)(this.toDERHex());
7598
7619
  }
7599
7620
  toDERHex() {
7600
7621
  return exports.DER.hexFromSig({ r: this.r, s: this.s });
7601
7622
  }
7602
7623
  toCompactRawBytes() {
7603
- return ut.hexToBytes(this.toCompactHex());
7624
+ return (0, utils_ts_1.hexToBytes)(this.toCompactHex());
7604
7625
  }
7605
7626
  toCompactHex() {
7606
- return numToNByteStr(this.r) + numToNByteStr(this.s);
7627
+ return numToNByteHex(this.r) + numToNByteHex(this.s);
7607
7628
  }
7608
7629
  }
7609
7630
  const utils = {
@@ -7617,8 +7638,8 @@ var require_weierstrass = __commonJS((exports) => {
7617
7638
  },
7618
7639
  normPrivateKeyToScalar,
7619
7640
  randomPrivateKey: () => {
7620
- const length = (0, modular_js_1.getMinHashLength)(CURVE.n);
7621
- return (0, modular_js_1.mapHashToField)(CURVE.randomBytes(length), CURVE.n);
7641
+ const length = (0, modular_ts_1.getMinHashLength)(CURVE.n);
7642
+ return (0, modular_ts_1.mapHashToField)(CURVE.randomBytes(length), CURVE.n);
7622
7643
  },
7623
7644
  precompute(windowSize = 8, point = Point.BASE) {
7624
7645
  point._setWindowSize(windowSize);
@@ -7630,7 +7651,7 @@ var require_weierstrass = __commonJS((exports) => {
7630
7651
  return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed);
7631
7652
  }
7632
7653
  function isProbPub(item) {
7633
- const arr = ut.isBytes(item);
7654
+ const arr = (0, utils_ts_1.isBytes)(item);
7634
7655
  const str = typeof item === "string";
7635
7656
  const len = (arr || str) && item.length;
7636
7657
  if (arr)
@@ -7652,17 +7673,17 @@ var require_weierstrass = __commonJS((exports) => {
7652
7673
  const bits2int = CURVE.bits2int || function(bytes) {
7653
7674
  if (bytes.length > 8192)
7654
7675
  throw new Error("input is too large");
7655
- const num = ut.bytesToNumberBE(bytes);
7676
+ const num = (0, utils_ts_1.bytesToNumberBE)(bytes);
7656
7677
  const delta = bytes.length * 8 - CURVE.nBitLength;
7657
7678
  return delta > 0 ? num >> BigInt(delta) : num;
7658
7679
  };
7659
7680
  const bits2int_modN = CURVE.bits2int_modN || function(bytes) {
7660
7681
  return modN(bits2int(bytes));
7661
7682
  };
7662
- const ORDER_MASK = ut.bitMask(CURVE.nBitLength);
7683
+ const ORDER_MASK = (0, utils_ts_1.bitMask)(CURVE.nBitLength);
7663
7684
  function int2octets(num) {
7664
- ut.aInRange("num < 2^" + CURVE.nBitLength, num, _0n, ORDER_MASK);
7665
- return ut.numberToBytesBE(num, CURVE.nByteLength);
7685
+ (0, utils_ts_1.aInRange)("num < 2^" + CURVE.nBitLength, num, _0n, ORDER_MASK);
7686
+ return (0, utils_ts_1.numberToBytesBE)(num, CURVE.nByteLength);
7666
7687
  }
7667
7688
  function prepSig(msgHash, privateKey, opts = defaultSigOpts) {
7668
7689
  if (["recovered", "canonical"].some((k) => (k in opts)))
@@ -7671,18 +7692,18 @@ var require_weierstrass = __commonJS((exports) => {
7671
7692
  let { lowS, prehash, extraEntropy: ent } = opts;
7672
7693
  if (lowS == null)
7673
7694
  lowS = true;
7674
- msgHash = (0, utils_js_1.ensureBytes)("msgHash", msgHash);
7695
+ msgHash = (0, utils_ts_1.ensureBytes)("msgHash", msgHash);
7675
7696
  validateSigVerOpts(opts);
7676
7697
  if (prehash)
7677
- msgHash = (0, utils_js_1.ensureBytes)("prehashed msgHash", hash(msgHash));
7698
+ msgHash = (0, utils_ts_1.ensureBytes)("prehashed msgHash", hash(msgHash));
7678
7699
  const h1int = bits2int_modN(msgHash);
7679
7700
  const d = normPrivateKeyToScalar(privateKey);
7680
7701
  const seedArgs = [int2octets(d), int2octets(h1int)];
7681
7702
  if (ent != null && ent !== false) {
7682
7703
  const e = ent === true ? randomBytes(Fp.BYTES) : ent;
7683
- seedArgs.push((0, utils_js_1.ensureBytes)("extraEntropy", e));
7704
+ seedArgs.push((0, utils_ts_1.ensureBytes)("extraEntropy", e));
7684
7705
  }
7685
- const seed = ut.concatBytes(...seedArgs);
7706
+ const seed = (0, utils_ts_1.concatBytes)(...seedArgs);
7686
7707
  const m = h1int;
7687
7708
  function k2sig(kBytes) {
7688
7709
  const k = bits2int(kBytes);
@@ -7711,21 +7732,21 @@ var require_weierstrass = __commonJS((exports) => {
7711
7732
  function sign(msgHash, privKey, opts = defaultSigOpts) {
7712
7733
  const { seed, k2sig } = prepSig(msgHash, privKey, opts);
7713
7734
  const C = CURVE;
7714
- const drbg = ut.createHmacDrbg(C.hash.outputLen, C.nByteLength, C.hmac);
7735
+ const drbg = (0, utils_ts_1.createHmacDrbg)(C.hash.outputLen, C.nByteLength, C.hmac);
7715
7736
  return drbg(seed, k2sig);
7716
7737
  }
7717
7738
  Point.BASE._setWindowSize(8);
7718
7739
  function verify(signature, msgHash, publicKey, opts = defaultVerOpts) {
7719
7740
  const sg = signature;
7720
- msgHash = (0, utils_js_1.ensureBytes)("msgHash", msgHash);
7721
- publicKey = (0, utils_js_1.ensureBytes)("publicKey", publicKey);
7741
+ msgHash = (0, utils_ts_1.ensureBytes)("msgHash", msgHash);
7742
+ publicKey = (0, utils_ts_1.ensureBytes)("publicKey", publicKey);
7722
7743
  const { lowS, prehash, format: format2 } = opts;
7723
7744
  validateSigVerOpts(opts);
7724
7745
  if ("strict" in opts)
7725
7746
  throw new Error("options.strict was renamed to lowS");
7726
7747
  if (format2 !== undefined && format2 !== "compact" && format2 !== "der")
7727
7748
  throw new Error("format must be compact or der");
7728
- const isHex = typeof sg === "string" || ut.isBytes(sg);
7749
+ const isHex = typeof sg === "string" || (0, utils_ts_1.isBytes)(sg);
7729
7750
  const isObj = !isHex && !format2 && typeof sg === "object" && sg !== null && typeof sg.r === "bigint" && typeof sg.s === "bigint";
7730
7751
  if (!isHex && !isObj)
7731
7752
  throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");
@@ -7840,7 +7861,7 @@ var require_weierstrass = __commonJS((exports) => {
7840
7861
  return sqrtRatio;
7841
7862
  }
7842
7863
  function mapToCurveSimpleSWU(Fp, opts) {
7843
- (0, modular_js_1.validateField)(Fp);
7864
+ (0, modular_ts_1.validateField)(Fp);
7844
7865
  if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z))
7845
7866
  throw new Error("mapToCurveSimpleSWU: invalid opts");
7846
7867
  const sqrtRatio = SWUFpSqrtRatio(Fp, opts.Z);
@@ -7886,7 +7907,7 @@ var require__shortw_utils = __commonJS((exports) => {
7886
7907
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
7887
7908
  var hmac_1 = require_hmac();
7888
7909
  var utils_1 = require_utils4();
7889
- var weierstrass_js_1 = require_weierstrass();
7910
+ var weierstrass_ts_1 = require_weierstrass();
7890
7911
  function getHash(hash) {
7891
7912
  return {
7892
7913
  hash,
@@ -7895,7 +7916,7 @@ var require__shortw_utils = __commonJS((exports) => {
7895
7916
  };
7896
7917
  }
7897
7918
  function createCurve(curveDef, defHash) {
7898
- const create = (hash) => (0, weierstrass_js_1.weierstrass)({ ...curveDef, ...getHash(hash) });
7919
+ const create = (hash) => (0, weierstrass_ts_1.weierstrass)({ ...curveDef, ...getHash(hash) });
7899
7920
  return { ...create(defHash), create };
7900
7921
  }
7901
7922
  });
@@ -7905,13 +7926,13 @@ var require_secp256k1 = __commonJS((exports) => {
7905
7926
  Object.defineProperty(exports, "__esModule", { value: true });
7906
7927
  exports.encodeToCurve = exports.hashToCurve = exports.schnorr = exports.secp256k1 = undefined;
7907
7928
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
7908
- var sha256_1 = require_sha256();
7929
+ var sha2_1 = require_sha2();
7909
7930
  var utils_1 = require_utils4();
7910
- var _shortw_utils_js_1 = require__shortw_utils();
7911
- var hash_to_curve_js_1 = require_hash_to_curve();
7912
- var modular_js_1 = require_modular();
7913
- var utils_js_1 = require_utils5();
7914
- var weierstrass_js_1 = require_weierstrass();
7931
+ var _shortw_utils_ts_1 = require__shortw_utils();
7932
+ var hash_to_curve_ts_1 = require_hash_to_curve();
7933
+ var modular_ts_1 = require_modular();
7934
+ var utils_ts_1 = require_utils5();
7935
+ var weierstrass_ts_1 = require_weierstrass();
7915
7936
  var secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
7916
7937
  var secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
7917
7938
  var _1n = BigInt(1);
@@ -7923,24 +7944,24 @@ var require_secp256k1 = __commonJS((exports) => {
7923
7944
  const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88);
7924
7945
  const b2 = y * y * y % P;
7925
7946
  const b3 = b2 * b2 * y % P;
7926
- const b6 = (0, modular_js_1.pow2)(b3, _3n, P) * b3 % P;
7927
- const b9 = (0, modular_js_1.pow2)(b6, _3n, P) * b3 % P;
7928
- const b11 = (0, modular_js_1.pow2)(b9, _2n, P) * b2 % P;
7929
- const b22 = (0, modular_js_1.pow2)(b11, _11n, P) * b11 % P;
7930
- const b44 = (0, modular_js_1.pow2)(b22, _22n, P) * b22 % P;
7931
- const b88 = (0, modular_js_1.pow2)(b44, _44n, P) * b44 % P;
7932
- const b176 = (0, modular_js_1.pow2)(b88, _88n, P) * b88 % P;
7933
- const b220 = (0, modular_js_1.pow2)(b176, _44n, P) * b44 % P;
7934
- const b223 = (0, modular_js_1.pow2)(b220, _3n, P) * b3 % P;
7935
- const t1 = (0, modular_js_1.pow2)(b223, _23n, P) * b22 % P;
7936
- const t2 = (0, modular_js_1.pow2)(t1, _6n, P) * b2 % P;
7937
- const root = (0, modular_js_1.pow2)(t2, _2n, P);
7947
+ const b6 = (0, modular_ts_1.pow2)(b3, _3n, P) * b3 % P;
7948
+ const b9 = (0, modular_ts_1.pow2)(b6, _3n, P) * b3 % P;
7949
+ const b11 = (0, modular_ts_1.pow2)(b9, _2n, P) * b2 % P;
7950
+ const b22 = (0, modular_ts_1.pow2)(b11, _11n, P) * b11 % P;
7951
+ const b44 = (0, modular_ts_1.pow2)(b22, _22n, P) * b22 % P;
7952
+ const b88 = (0, modular_ts_1.pow2)(b44, _44n, P) * b44 % P;
7953
+ const b176 = (0, modular_ts_1.pow2)(b88, _88n, P) * b88 % P;
7954
+ const b220 = (0, modular_ts_1.pow2)(b176, _44n, P) * b44 % P;
7955
+ const b223 = (0, modular_ts_1.pow2)(b220, _3n, P) * b3 % P;
7956
+ const t1 = (0, modular_ts_1.pow2)(b223, _23n, P) * b22 % P;
7957
+ const t2 = (0, modular_ts_1.pow2)(t1, _6n, P) * b2 % P;
7958
+ const root = (0, modular_ts_1.pow2)(t2, _2n, P);
7938
7959
  if (!Fpk1.eql(Fpk1.sqr(root), y))
7939
7960
  throw new Error("Cannot find square root");
7940
7961
  return root;
7941
7962
  }
7942
- var Fpk1 = (0, modular_js_1.Field)(secp256k1P, undefined, undefined, { sqrt: sqrtMod });
7943
- exports.secp256k1 = (0, _shortw_utils_js_1.createCurve)({
7963
+ var Fpk1 = (0, modular_ts_1.Field)(secp256k1P, undefined, undefined, { sqrt: sqrtMod });
7964
+ exports.secp256k1 = (0, _shortw_utils_ts_1.createCurve)({
7944
7965
  a: BigInt(0),
7945
7966
  b: BigInt(7),
7946
7967
  Fp: Fpk1,
@@ -7960,8 +7981,8 @@ var require_secp256k1 = __commonJS((exports) => {
7960
7981
  const POW_2_128 = BigInt("0x100000000000000000000000000000000");
7961
7982
  const c1 = divNearest(b2 * k, n);
7962
7983
  const c2 = divNearest(-b1 * k, n);
7963
- let k1 = (0, modular_js_1.mod)(k - c1 * a1 - c2 * a2, n);
7964
- let k2 = (0, modular_js_1.mod)(-c1 * b1 - c2 * b2, n);
7984
+ let k1 = (0, modular_ts_1.mod)(k - c1 * a1 - c2 * a2, n);
7985
+ let k2 = (0, modular_ts_1.mod)(-c1 * b1 - c2 * b2, n);
7965
7986
  const k1neg = k1 > POW_2_128;
7966
7987
  const k2neg = k2 > POW_2_128;
7967
7988
  if (k1neg)
@@ -7974,22 +7995,22 @@ var require_secp256k1 = __commonJS((exports) => {
7974
7995
  return { k1neg, k1, k2neg, k2 };
7975
7996
  }
7976
7997
  }
7977
- }, sha256_1.sha256);
7998
+ }, sha2_1.sha256);
7978
7999
  var _0n = BigInt(0);
7979
8000
  var TAGGED_HASH_PREFIXES = {};
7980
8001
  function taggedHash(tag, ...messages) {
7981
8002
  let tagP = TAGGED_HASH_PREFIXES[tag];
7982
8003
  if (tagP === undefined) {
7983
- const tagH = (0, sha256_1.sha256)(Uint8Array.from(tag, (c) => c.charCodeAt(0)));
7984
- tagP = (0, utils_js_1.concatBytes)(tagH, tagH);
8004
+ const tagH = (0, sha2_1.sha256)(Uint8Array.from(tag, (c) => c.charCodeAt(0)));
8005
+ tagP = (0, utils_ts_1.concatBytes)(tagH, tagH);
7985
8006
  TAGGED_HASH_PREFIXES[tag] = tagP;
7986
8007
  }
7987
- return (0, sha256_1.sha256)((0, utils_js_1.concatBytes)(tagP, ...messages));
8008
+ return (0, sha2_1.sha256)((0, utils_ts_1.concatBytes)(tagP, ...messages));
7988
8009
  }
7989
8010
  var pointToBytes = (point) => point.toRawBytes(true).slice(1);
7990
- var numTo32b = (n) => (0, utils_js_1.numberToBytesBE)(n, 32);
7991
- var modP = (x) => (0, modular_js_1.mod)(x, secp256k1P);
7992
- var modN = (x) => (0, modular_js_1.mod)(x, secp256k1N);
8011
+ var numTo32b = (n) => (0, utils_ts_1.numberToBytesBE)(n, 32);
8012
+ var modP = (x) => (0, modular_ts_1.mod)(x, secp256k1P);
8013
+ var modN = (x) => (0, modular_ts_1.mod)(x, secp256k1N);
7993
8014
  var Point = exports.secp256k1.ProjectivePoint;
7994
8015
  var GmulAdd = (Q, a, b) => Point.BASE.multiplyAndAddUnsafe(Q, a, b);
7995
8016
  function schnorrGetExtPubKey(priv) {
@@ -7999,7 +8020,7 @@ var require_secp256k1 = __commonJS((exports) => {
7999
8020
  return { scalar, bytes: pointToBytes(p) };
8000
8021
  }
8001
8022
  function lift_x(x) {
8002
- (0, utils_js_1.aInRange)("x", x, _1n, secp256k1P);
8023
+ (0, utils_ts_1.aInRange)("x", x, _1n, secp256k1P);
8003
8024
  const xx = modP(x * x);
8004
8025
  const c = modP(xx * x + BigInt(7));
8005
8026
  let y = sqrtMod(c);
@@ -8009,7 +8030,7 @@ var require_secp256k1 = __commonJS((exports) => {
8009
8030
  p.assertValidity();
8010
8031
  return p;
8011
8032
  }
8012
- var num = utils_js_1.bytesToNumberBE;
8033
+ var num = utils_ts_1.bytesToNumberBE;
8013
8034
  function challenge(...args) {
8014
8035
  return modN(num(taggedHash("BIP0340/challenge", ...args)));
8015
8036
  }
@@ -8017,9 +8038,9 @@ var require_secp256k1 = __commonJS((exports) => {
8017
8038
  return schnorrGetExtPubKey(privateKey).bytes;
8018
8039
  }
8019
8040
  function schnorrSign(message, privateKey, auxRand = (0, utils_1.randomBytes)(32)) {
8020
- const m = (0, utils_js_1.ensureBytes)("message", message);
8041
+ const m = (0, utils_ts_1.ensureBytes)("message", message);
8021
8042
  const { bytes: px, scalar: d } = schnorrGetExtPubKey(privateKey);
8022
- const a = (0, utils_js_1.ensureBytes)("auxRand", auxRand, 32);
8043
+ const a = (0, utils_ts_1.ensureBytes)("auxRand", auxRand, 32);
8023
8044
  const t = numTo32b(d ^ num(taggedHash("BIP0340/aux", a)));
8024
8045
  const rand = taggedHash("BIP0340/nonce", t, px, m);
8025
8046
  const k_ = modN(num(rand));
@@ -8035,16 +8056,16 @@ var require_secp256k1 = __commonJS((exports) => {
8035
8056
  return sig;
8036
8057
  }
8037
8058
  function schnorrVerify(signature, message, publicKey) {
8038
- const sig = (0, utils_js_1.ensureBytes)("signature", signature, 64);
8039
- const m = (0, utils_js_1.ensureBytes)("message", message);
8040
- const pub = (0, utils_js_1.ensureBytes)("publicKey", publicKey, 32);
8059
+ const sig = (0, utils_ts_1.ensureBytes)("signature", signature, 64);
8060
+ const m = (0, utils_ts_1.ensureBytes)("message", message);
8061
+ const pub = (0, utils_ts_1.ensureBytes)("publicKey", publicKey, 32);
8041
8062
  try {
8042
8063
  const P = lift_x(num(pub));
8043
8064
  const r = num(sig.subarray(0, 32));
8044
- if (!(0, utils_js_1.inRange)(r, _1n, secp256k1P))
8065
+ if (!(0, utils_ts_1.inRange)(r, _1n, secp256k1P))
8045
8066
  return false;
8046
8067
  const s = num(sig.subarray(32, 64));
8047
- if (!(0, utils_js_1.inRange)(s, _1n, secp256k1N))
8068
+ if (!(0, utils_ts_1.inRange)(s, _1n, secp256k1N))
8048
8069
  return false;
8049
8070
  const e = challenge(numTo32b(r), pointToBytes(P), m);
8050
8071
  const R = GmulAdd(P, s, modN(-e));
@@ -8063,13 +8084,13 @@ var require_secp256k1 = __commonJS((exports) => {
8063
8084
  randomPrivateKey: exports.secp256k1.utils.randomPrivateKey,
8064
8085
  lift_x,
8065
8086
  pointToBytes,
8066
- numberToBytesBE: utils_js_1.numberToBytesBE,
8067
- bytesToNumberBE: utils_js_1.bytesToNumberBE,
8087
+ numberToBytesBE: utils_ts_1.numberToBytesBE,
8088
+ bytesToNumberBE: utils_ts_1.bytesToNumberBE,
8068
8089
  taggedHash,
8069
- mod: modular_js_1.mod
8090
+ mod: modular_ts_1.mod
8070
8091
  }
8071
8092
  }))();
8072
- var isoMap = /* @__PURE__ */ (() => (0, hash_to_curve_js_1.isogenyMap)(Fpk1, [
8093
+ var isoMap = /* @__PURE__ */ (() => (0, hash_to_curve_ts_1.isogenyMap)(Fpk1, [
8073
8094
  [
8074
8095
  "0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7",
8075
8096
  "0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581",
@@ -8094,12 +8115,12 @@ var require_secp256k1 = __commonJS((exports) => {
8094
8115
  "0x0000000000000000000000000000000000000000000000000000000000000001"
8095
8116
  ]
8096
8117
  ].map((i) => i.map((j) => BigInt(j)))))();
8097
- var mapSWU = /* @__PURE__ */ (() => (0, weierstrass_js_1.mapToCurveSimpleSWU)(Fpk1, {
8118
+ var mapSWU = /* @__PURE__ */ (() => (0, weierstrass_ts_1.mapToCurveSimpleSWU)(Fpk1, {
8098
8119
  A: BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),
8099
8120
  B: BigInt("1771"),
8100
8121
  Z: Fpk1.create(BigInt("-11"))
8101
8122
  }))();
8102
- var htf = /* @__PURE__ */ (() => (0, hash_to_curve_js_1.createHasher)(exports.secp256k1.ProjectivePoint, (scalars) => {
8123
+ var htf = /* @__PURE__ */ (() => (0, hash_to_curve_ts_1.createHasher)(exports.secp256k1.ProjectivePoint, (scalars) => {
8103
8124
  const { x, y } = mapSWU(Fpk1.create(scalars[0]));
8104
8125
  return isoMap(x, y);
8105
8126
  }, {
@@ -8109,7 +8130,7 @@ var require_secp256k1 = __commonJS((exports) => {
8109
8130
  m: 1,
8110
8131
  k: 128,
8111
8132
  expand: "xmd",
8112
- hash: sha256_1.sha256
8133
+ hash: sha2_1.sha256
8113
8134
  }))();
8114
8135
  exports.hashToCurve = (() => htf.hashToCurve)();
8115
8136
  exports.encodeToCurve = (() => htf.encodeToCurve)();
@@ -8232,27 +8253,27 @@ var require_hkdf = __commonJS((exports) => {
8232
8253
  exports.hkdf = undefined;
8233
8254
  exports.extract = extract;
8234
8255
  exports.expand = expand;
8235
- var _assert_js_1 = require__assert2();
8236
- var hmac_js_1 = require_hmac();
8237
- var utils_js_1 = require_utils4();
8256
+ var _assert_ts_1 = require__assert2();
8257
+ var hmac_ts_1 = require_hmac();
8258
+ var utils_ts_1 = require_utils4();
8238
8259
  function extract(hash, ikm, salt) {
8239
- (0, _assert_js_1.ahash)(hash);
8260
+ (0, _assert_ts_1.ahash)(hash);
8240
8261
  if (salt === undefined)
8241
8262
  salt = new Uint8Array(hash.outputLen);
8242
- return (0, hmac_js_1.hmac)(hash, (0, utils_js_1.toBytes)(salt), (0, utils_js_1.toBytes)(ikm));
8263
+ return (0, hmac_ts_1.hmac)(hash, (0, utils_ts_1.toBytes)(salt), (0, utils_ts_1.toBytes)(ikm));
8243
8264
  }
8244
8265
  var HKDF_COUNTER = /* @__PURE__ */ new Uint8Array([0]);
8245
8266
  var EMPTY_BUFFER = /* @__PURE__ */ new Uint8Array;
8246
8267
  function expand(hash, prk, info, length = 32) {
8247
- (0, _assert_js_1.ahash)(hash);
8248
- (0, _assert_js_1.anumber)(length);
8268
+ (0, _assert_ts_1.ahash)(hash);
8269
+ (0, _assert_ts_1.anumber)(length);
8249
8270
  if (length > 255 * hash.outputLen)
8250
8271
  throw new Error("Length should be <= 255*HashLen");
8251
8272
  const blocks = Math.ceil(length / hash.outputLen);
8252
8273
  if (info === undefined)
8253
8274
  info = EMPTY_BUFFER;
8254
8275
  const okm = new Uint8Array(blocks * hash.outputLen);
8255
- const HMAC = hmac_js_1.hmac.create(hash, prk);
8276
+ const HMAC = hmac_ts_1.hmac.create(hash, prk);
8256
8277
  const HMACTmp = HMAC._cloneInto();
8257
8278
  const T = new Uint8Array(HMAC.outputLen);
8258
8279
  for (let counter = 0;counter < blocks; counter++) {
@@ -9088,7 +9109,7 @@ var require_parse2 = __commonJS((exports, module) => {
9088
9109
  // ../../node_modules/@dotenvx/dotenvx/src/lib/helpers/dotenvParse.js
9089
9110
  var require_dotenvParse = __commonJS((exports, module) => {
9090
9111
  var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
9091
- function dotenvParse(src, skipExpandForDoubleQuotes = false, skipConvertingWindowsNewlines = false) {
9112
+ function dotenvParse(src, skipExpandForDoubleQuotes = false, skipConvertingWindowsNewlines = false, collectAllValues = false) {
9092
9113
  const obj = {};
9093
9114
  let lines = src.toString();
9094
9115
  if (!skipConvertingWindowsNewlines) {
@@ -9108,7 +9129,12 @@ var require_dotenvParse = __commonJS((exports, module) => {
9108
9129
  value = value.replace(/\\r/g, "\r");
9109
9130
  value = value.replace(/\\t/g, "\t");
9110
9131
  }
9111
- obj[key] = value;
9132
+ if (collectAllValues) {
9133
+ obj[key] = obj[key] || [];
9134
+ obj[key].push(value);
9135
+ } else {
9136
+ obj[key] = value;
9137
+ }
9112
9138
  }
9113
9139
  return obj;
9114
9140
  }
@@ -31162,6 +31188,23 @@ var require_lib4 = __commonJS((exports, module) => {
31162
31188
  var fromUrl = require_from_url();
31163
31189
  var parseUrl = require_parse_url();
31164
31190
  var cache = new LRUCache2({ max: 1000 });
31191
+ function unknownHostedUrl(url) {
31192
+ try {
31193
+ const {
31194
+ protocol,
31195
+ hostname,
31196
+ pathname
31197
+ } = new URL(url);
31198
+ if (!hostname) {
31199
+ return null;
31200
+ }
31201
+ const proto = /(?:git\+)http:$/.test(protocol) ? "http:" : "https:";
31202
+ const path6 = pathname.replace(/\.git$/, "");
31203
+ return `${proto}//${hostname}${path6}`;
31204
+ } catch {
31205
+ return null;
31206
+ }
31207
+ }
31165
31208
 
31166
31209
  class GitHost {
31167
31210
  constructor(type2, user, auth, project, committish, defaultRepresentation, opts = {}) {
@@ -31205,6 +31248,22 @@ var require_lib4 = __commonJS((exports, module) => {
31205
31248
  }
31206
31249
  return cache.get(key2);
31207
31250
  }
31251
+ static fromManifest(manifest, opts = {}) {
31252
+ if (!manifest || typeof manifest !== "object") {
31253
+ return;
31254
+ }
31255
+ const r2 = manifest.repository;
31256
+ const rurl = r2 && (typeof r2 === "string" ? r2 : typeof r2 === "object" && typeof r2.url === "string" ? r2.url : null);
31257
+ if (!rurl) {
31258
+ throw new Error("no repository");
31259
+ }
31260
+ const info = rurl && GitHost.fromUrl(rurl.replace(/^git\+/, ""), opts) || null;
31261
+ if (info) {
31262
+ return info;
31263
+ }
31264
+ const unk = unknownHostedUrl(rurl);
31265
+ return GitHost.fromUrl(unk, opts) || unk;
31266
+ }
31208
31267
  static parseUrl(url) {
31209
31268
  return parseUrl(url);
31210
31269
  }
@@ -235068,7 +235127,7 @@ var is_in_ci_default = isInCi;
235068
235127
  // ../../node_modules/yocto-spinner/index.js
235069
235128
  import process2 from "node:process";
235070
235129
  import { stripVTControlCharacters } from "node:util";
235071
- var isUnicodeSupported = process2.platform !== "win32" || Boolean(process2.env.WT_SESSION);
235130
+ var isUnicodeSupported = process2.platform !== "win32" || Boolean(process2.env.WT_SESSION) || process2.env.TERM_PROGRAM === "vscode";
235072
235131
  var isInteractive = (stream) => Boolean(stream.isTTY && process2.env.TERM !== "dumb" && !("CI" in process2.env));
235073
235132
  var infoSymbol = exports_base.blue(isUnicodeSupported ? "ℹ" : "i");
235074
235133
  var successSymbol = exports_base.green(isUnicodeSupported ? "✔" : "√");
@@ -245084,8 +245143,11 @@ var DotEnvSchema = z.object({
245084
245143
  SETTLEMINT_WORKSPACE: UniqueNameSchema.optional(),
245085
245144
  SETTLEMINT_APPLICATION: UniqueNameSchema.optional(),
245086
245145
  SETTLEMINT_BLOCKCHAIN_NETWORK: UniqueNameSchema.optional(),
245146
+ SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID: z.string().optional(),
245087
245147
  SETTLEMINT_BLOCKCHAIN_NODE: UniqueNameSchema.optional(),
245088
- SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_PUBLIC: UniqueNameSchema.optional(),
245148
+ SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT: UrlSchema.optional(),
245149
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: UniqueNameSchema.optional(),
245150
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT: UrlSchema.optional(),
245089
245151
  SETTLEMINT_HASURA: UniqueNameSchema.optional(),
245090
245152
  SETTLEMINT_HASURA_ENDPOINT: UrlSchema.optional(),
245091
245153
  SETTLEMINT_HASURA_ADMIN_SECRET: z.string().optional(),
@@ -245278,7 +245340,7 @@ function pruneCurrentEnv(currentEnv, env2) {
245278
245340
  var package_default = {
245279
245341
  name: "@settlemint/sdk-cli",
245280
245342
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
245281
- version: "2.1.4-pre91fc413",
245343
+ version: "2.1.4-prf0b81bca",
245282
245344
  type: "module",
245283
245345
  private: false,
245284
245346
  license: "FSL-1.1-MIT",
@@ -245327,8 +245389,8 @@ var package_default = {
245327
245389
  "@inquirer/input": "4.1.9",
245328
245390
  "@inquirer/password": "4.0.12",
245329
245391
  "@inquirer/select": "4.1.1",
245330
- "@settlemint/sdk-js": "2.1.4-pre91fc413",
245331
- "@settlemint/sdk-utils": "2.1.4-pre91fc413",
245392
+ "@settlemint/sdk-js": "2.1.4-prf0b81bca",
245393
+ "@settlemint/sdk-utils": "2.1.4-prf0b81bca",
245332
245394
  "@types/node": "22.14.1",
245333
245395
  "@types/semver": "7.7.0",
245334
245396
  "@types/which": "3.0.4",
@@ -246486,13 +246548,21 @@ class Separator {
246486
246548
  // ../utils/dist/terminal.mjs
246487
246549
  import { spawn } from "node:child_process";
246488
246550
  var import_console_table_printer2 = __toESM(require_dist2(), 1);
246489
- var ascii = () => console.log(magentaBright(`
246551
+ function shouldPrint() {
246552
+ return process.env.SETTLEMINT_DISABLE_TERMINAL !== "true";
246553
+ }
246554
+ var ascii = () => {
246555
+ if (!shouldPrint()) {
246556
+ return;
246557
+ }
246558
+ console.log(magentaBright(`
246490
246559
  _________ __ __ .__ _____ .__ __
246491
246560
  / _____/ _____/ |__/ |_| | ____ / \\ |__| _____/ |_
246492
246561
  \\_____ \\_/ __ \\ __\\ __\\ | _/ __ \\ / \\ / \\| |/ \\ __\\
246493
246562
  / \\ ___/| | | | | |_\\ ___// Y \\ | | \\ |
246494
246563
  /_________/\\_____>__| |__| |____/\\_____>____|____/__|___|__/__|
246495
246564
  `));
246565
+ };
246496
246566
  var maskTokens2 = (output) => {
246497
246567
  return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
246498
246568
  };
@@ -246535,11 +246605,17 @@ async function executeCommand(command, args, options) {
246535
246605
  });
246536
246606
  }
246537
246607
  var intro = (msg) => {
246608
+ if (!shouldPrint()) {
246609
+ return;
246610
+ }
246538
246611
  console.log("");
246539
246612
  console.log(magentaBright(maskTokens2(msg)));
246540
246613
  console.log("");
246541
246614
  };
246542
246615
  var note = (message, level = "info") => {
246616
+ if (!shouldPrint()) {
246617
+ return;
246618
+ }
246543
246619
  const maskedMessage = maskTokens2(message);
246544
246620
  console.log("");
246545
246621
  if (level === "warn") {
@@ -246564,6 +246640,9 @@ function list(title, items) {
246564
246640
  ${formatItems(items)}`);
246565
246641
  }
246566
246642
  var outro = (msg) => {
246643
+ if (!shouldPrint()) {
246644
+ return;
246645
+ }
246567
246646
  console.log("");
246568
246647
  console.log(inverse(greenBright(maskTokens2(msg))));
246569
246648
  console.log("");
@@ -246583,7 +246662,7 @@ var spinner = async (options) => {
246583
246662
  ${error.stack}`));
246584
246663
  throw new SpinnerError(errorMessage, error);
246585
246664
  };
246586
- if (is_in_ci_default) {
246665
+ if (is_in_ci_default || !shouldPrint()) {
246587
246666
  try {
246588
246667
  return await options.task();
246589
246668
  } catch (err) {
@@ -246611,6 +246690,9 @@ function camelCaseToWords(s) {
246611
246690
  return capitalized.replace(/\s+/g, " ").trim();
246612
246691
  }
246613
246692
  function table(title, data) {
246693
+ if (!shouldPrint()) {
246694
+ return;
246695
+ }
246614
246696
  note(title);
246615
246697
  if (!data || data.length === 0) {
246616
246698
  note("No data to display");
@@ -246741,8 +246823,11 @@ var DotEnvSchema2 = z.object({
246741
246823
  SETTLEMINT_WORKSPACE: UniqueNameSchema2.optional(),
246742
246824
  SETTLEMINT_APPLICATION: UniqueNameSchema2.optional(),
246743
246825
  SETTLEMINT_BLOCKCHAIN_NETWORK: UniqueNameSchema2.optional(),
246826
+ SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID: z.string().optional(),
246744
246827
  SETTLEMINT_BLOCKCHAIN_NODE: UniqueNameSchema2.optional(),
246745
- SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_PUBLIC: UniqueNameSchema2.optional(),
246828
+ SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT: UrlSchema2.optional(),
246829
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: UniqueNameSchema2.optional(),
246830
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT: UrlSchema2.optional(),
246746
246831
  SETTLEMINT_HASURA: UniqueNameSchema2.optional(),
246747
246832
  SETTLEMINT_HASURA_ENDPOINT: UrlSchema2.optional(),
246748
246833
  SETTLEMINT_HASURA_ADMIN_SECRET: z.string().optional(),
@@ -247641,11 +247726,61 @@ var BlockchainNetworkFragment = graphql(`
247641
247726
  healthStatus
247642
247727
  provider
247643
247728
  region
247729
+ ... on BesuQBFTBlockchainNetwork {
247730
+ chainId
247731
+ }
247732
+ ... on BesuIbftv2BlockchainNetwork {
247733
+ chainId
247734
+ }
247735
+ ... on GethPoWBlockchainNetwork {
247736
+ chainId
247737
+ }
247738
+ ... on GethPoSRinkebyBlockchainNetwork {
247739
+ chainId
247740
+ }
247741
+ ... on GethVenidiumBlockchainNetwork {
247742
+ chainId
247743
+ }
247744
+ ... on GethGoerliBlockchainNetwork {
247745
+ chainId
247746
+ }
247747
+ ... on AvalancheBlockchainNetwork {
247748
+ chainId
247749
+ }
247750
+ ... on AvalancheFujiBlockchainNetwork {
247751
+ chainId
247752
+ }
247753
+ ... on BscPoWBlockchainNetwork {
247754
+ chainId
247755
+ }
247756
+ ... on BscPoWTestnetBlockchainNetwork {
247757
+ chainId
247758
+ }
247759
+ ... on PolygonBlockchainNetwork {
247760
+ chainId
247761
+ }
247762
+ ... on PolygonMumbaiBlockchainNetwork {
247763
+ chainId
247764
+ }
247765
+ ... on PolygonEdgePoABlockchainNetwork {
247766
+ chainId
247767
+ }
247768
+ ... on QuorumQBFTBlockchainNetwork {
247769
+ chainId
247770
+ }
247771
+ ... on GethCliqueBlockchainNetwork {
247772
+ chainId
247773
+ }
247644
247774
  blockchainNodes {
247645
247775
  ... on BlockchainNode {
247646
247776
  id
247647
247777
  name
247648
247778
  uniqueName
247779
+ endpoints {
247780
+ id
247781
+ label
247782
+ displayValue
247783
+ }
247649
247784
  }
247650
247785
  }
247651
247786
  }
@@ -247807,6 +247942,51 @@ var BlockchainNodeFragment = graphql(`
247807
247942
  id
247808
247943
  name
247809
247944
  uniqueName
247945
+ ... on BesuQBFTBlockchainNetwork {
247946
+ chainId
247947
+ }
247948
+ ... on BesuIbftv2BlockchainNetwork {
247949
+ chainId
247950
+ }
247951
+ ... on GethPoWBlockchainNetwork {
247952
+ chainId
247953
+ }
247954
+ ... on GethPoSRinkebyBlockchainNetwork {
247955
+ chainId
247956
+ }
247957
+ ... on GethVenidiumBlockchainNetwork {
247958
+ chainId
247959
+ }
247960
+ ... on GethGoerliBlockchainNetwork {
247961
+ chainId
247962
+ }
247963
+ ... on AvalancheBlockchainNetwork {
247964
+ chainId
247965
+ }
247966
+ ... on AvalancheFujiBlockchainNetwork {
247967
+ chainId
247968
+ }
247969
+ ... on BscPoWBlockchainNetwork {
247970
+ chainId
247971
+ }
247972
+ ... on BscPoWTestnetBlockchainNetwork {
247973
+ chainId
247974
+ }
247975
+ ... on PolygonBlockchainNetwork {
247976
+ chainId
247977
+ }
247978
+ ... on PolygonMumbaiBlockchainNetwork {
247979
+ chainId
247980
+ }
247981
+ ... on PolygonEdgePoABlockchainNetwork {
247982
+ chainId
247983
+ }
247984
+ ... on QuorumQBFTBlockchainNetwork {
247985
+ chainId
247986
+ }
247987
+ ... on GethCliqueBlockchainNetwork {
247988
+ chainId
247989
+ }
247810
247990
  }
247811
247991
  }
247812
247992
  privateKeys {
@@ -248050,6 +248230,11 @@ var LoadBalancerFragment = graphql(`
248050
248230
  healthStatus
248051
248231
  provider
248052
248232
  region
248233
+ endpoints {
248234
+ id
248235
+ label
248236
+ displayValue
248237
+ }
248053
248238
  }
248054
248239
  `);
248055
248240
  var getLoadBalancer = graphql(`
@@ -248068,6 +248253,38 @@ var getLoadBalancers = graphql(`
248068
248253
  }
248069
248254
  }
248070
248255
  `, [LoadBalancerFragment]);
248256
+ var createLoadBalancer = graphql(`
248257
+ mutation createLoadBalancer(
248258
+ $applicationId: ID!
248259
+ $blockchainNetworkId: ID!
248260
+ $name: String!
248261
+ $provider: String!
248262
+ $region: String!
248263
+ $size: ClusterServiceSize
248264
+ $type: ClusterServiceType
248265
+ $connectedNodes: [ID!]!
248266
+ ) {
248267
+ createLoadBalancer(
248268
+ applicationId: $applicationId
248269
+ blockchainNetworkId: $blockchainNetworkId
248270
+ name: $name
248271
+ provider: $provider
248272
+ region: $region
248273
+ size: $size
248274
+ type: $type
248275
+ connectedNodes: $connectedNodes
248276
+ ) {
248277
+ ...LoadBalancer
248278
+ }
248279
+ }
248280
+ `, [LoadBalancerFragment]);
248281
+ var restartLoadBalancer = graphql(`
248282
+ mutation RestartLoadBalancer($uniqueName: String!) {
248283
+ restartLoadBalancerByUniqueName(uniqueName: $uniqueName) {
248284
+ ...LoadBalancer
248285
+ }
248286
+ }
248287
+ `, [LoadBalancerFragment]);
248071
248288
  var loadBalancerRead = (gqlClient) => {
248072
248289
  return async (loadBalancerUniqueName) => {
248073
248290
  const { loadBalancerByUniqueName: loadBalancer } = await gqlClient.request(getLoadBalancer, {
@@ -248084,6 +248301,29 @@ var loadBalancerList = (gqlClient) => {
248084
248301
  return items;
248085
248302
  };
248086
248303
  };
248304
+ var loadBalancerCreate = (gqlClient) => {
248305
+ return async (args) => {
248306
+ const { applicationUniqueName, blockchainNetworkUniqueName, connectedNodesUniqueNames, ...otherArgs } = args;
248307
+ const [application, blockchainNetwork, connectedNodes] = await Promise.all([
248308
+ applicationRead(gqlClient)(applicationUniqueName),
248309
+ blockchainNetworkRead(gqlClient)(blockchainNetworkUniqueName),
248310
+ Promise.all(connectedNodesUniqueNames.map((uniqueName) => blockchainNodeRead(gqlClient)(uniqueName)))
248311
+ ]);
248312
+ const { createLoadBalancer: loadBalancer } = await gqlClient.request(createLoadBalancer, {
248313
+ ...otherArgs,
248314
+ applicationId: application.id,
248315
+ blockchainNetworkId: blockchainNetwork.id,
248316
+ connectedNodes: connectedNodes.map((node) => node.id)
248317
+ });
248318
+ return loadBalancer;
248319
+ };
248320
+ };
248321
+ var loadBalancerRestart = (gqlClient) => async (loadBalancerUniqueName) => {
248322
+ const { restartLoadBalancerByUniqueName: loadBalancer } = await gqlClient.request(restartLoadBalancer, {
248323
+ uniqueName: loadBalancerUniqueName
248324
+ });
248325
+ return loadBalancer;
248326
+ };
248087
248327
  var InsightsFragment = graphql(`
248088
248328
  fragment Insights on Insights {
248089
248329
  __typename
@@ -248786,7 +249026,9 @@ function createSettleMintClient(options) {
248786
249026
  },
248787
249027
  loadBalancer: {
248788
249028
  list: loadBalancerList(gqlClient),
248789
- read: loadBalancerRead(gqlClient)
249029
+ read: loadBalancerRead(gqlClient),
249030
+ create: loadBalancerCreate(gqlClient),
249031
+ restart: loadBalancerRestart(gqlClient)
248790
249032
  },
248791
249033
  middleware: {
248792
249034
  list: middlewareList(gqlClient),
@@ -248872,6 +249114,7 @@ var LOCKS = {
248872
249114
  "bun.lockb": "bun",
248873
249115
  "deno.lock": "deno",
248874
249116
  "pnpm-lock.yaml": "pnpm",
249117
+ "pnpm-workspace.yaml": "pnpm",
248875
249118
  "yarn.lock": "yarn",
248876
249119
  "package-lock.json": "npm",
248877
249120
  "npm-shrinkwrap.json": "npm"
@@ -249807,10 +250050,16 @@ async function getPackageManagerExecutable(targetDir) {
249807
250050
  }
249808
250051
  return { command: "npx", args: [] };
249809
250052
  }
250053
+ function shouldPrint2() {
250054
+ return process.env.SETTLEMINT_DISABLE_TERMINAL !== "true";
250055
+ }
249810
250056
  var maskTokens3 = (output) => {
249811
250057
  return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
249812
250058
  };
249813
250059
  var note2 = (message, level = "info") => {
250060
+ if (!shouldPrint2()) {
250061
+ return;
250062
+ }
249814
250063
  const maskedMessage = maskTokens3(message);
249815
250064
  console.log("");
249816
250065
  if (level === "warn") {
@@ -250162,7 +250411,7 @@ export const postgresPool = createPostgresPool(process.env.SETTLEMINT_HASURA_DAT
250162
250411
  await installDependencies(PACKAGE_NAME, projectDir);
250163
250412
  }
250164
250413
  if (!databaseUrl) {
250165
- console.warn("[Codegen] Missing database environment variables");
250414
+ note("[Codegen] Missing database environment variables", "warn");
250166
250415
  }
250167
250416
  }
250168
250417
 
@@ -251719,6 +251968,7 @@ async function codegenBlockscout(env2) {
251719
251968
  __schema {
251720
251969
  queryType { name }
251721
251970
  mutationType { name }
251971
+ subscriptionType { name }
251722
251972
  types {
251723
251973
  ...FullType
251724
251974
  }
@@ -251800,10 +252050,6 @@ async function codegenBlockscout(env2) {
251800
252050
  ofType {
251801
252051
  kind
251802
252052
  name
251803
- ofType {
251804
- kind
251805
- name
251806
- }
251807
252053
  }
251808
252054
  }
251809
252055
  }
@@ -251921,9 +252167,72 @@ export const { client } = createServerMinioClient({
251921
252167
  }
251922
252168
  }
251923
252169
 
252170
+ // src/commands/codegen/codegen-viem.ts
252171
+ var PACKAGE_NAME7 = "@settlemint/sdk-viem";
252172
+ async function codegenViem(env2) {
252173
+ const chainId = env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID;
252174
+ if (!chainId) {
252175
+ note("[Codegen] No chain ID found, skipping Viem resources generation", "warn");
252176
+ return;
252177
+ }
252178
+ const loadBalancerRpcEndpoint = env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT;
252179
+ const blockchainNodeRpcEndpoint = env2.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT;
252180
+ if (!loadBalancerRpcEndpoint && !blockchainNodeRpcEndpoint) {
252181
+ note("[Codegen] No RPC endpoints found, skipping Viem resources generation", "warn");
252182
+ return;
252183
+ }
252184
+ const projectDir = await projectRoot3();
252185
+ if (!await isPackageInstalled(PACKAGE_NAME7, projectDir)) {
252186
+ await installDependencies(PACKAGE_NAME7, projectDir);
252187
+ }
252188
+ const imports = [];
252189
+ if (loadBalancerRpcEndpoint) {
252190
+ imports.push("getPublicClient");
252191
+ }
252192
+ if (blockchainNodeRpcEndpoint) {
252193
+ imports.push("getWalletClient");
252194
+ }
252195
+ const viemTemplate = [`import { ${imports.join(", ")} } from "${PACKAGE_NAME7}";`];
252196
+ if (loadBalancerRpcEndpoint) {
252197
+ viemTemplate.push(`
252198
+ /**
252199
+ * The public client. Use this if you need to read from the blockchain.
252200
+ */
252201
+ export const publicClient = getPublicClient({
252202
+ chainId: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!,
252203
+ chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,
252204
+ rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT!,
252205
+ });`);
252206
+ }
252207
+ if (blockchainNodeRpcEndpoint) {
252208
+ viemTemplate.push(`
252209
+ /**
252210
+ * The wallet client. Use this if you need to write to the blockchain.
252211
+ */
252212
+ export const walletClient = getWalletClient({
252213
+ chainId: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!,
252214
+ chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,
252215
+ rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT!,
252216
+ })();
252217
+
252218
+ /**
252219
+ * The wallet client for HD wallets. Use this if you need to write to the blockchain.
252220
+ * HD wallets require a challenge response to be sent with the request.
252221
+ */
252222
+ export const hdWalletClient = getWalletClient({
252223
+ chainId: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!,
252224
+ chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,
252225
+ rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT!,
252226
+ });`);
252227
+ }
252228
+ await writeTemplate(viemTemplate.join(`
252229
+ `), "/lib/settlemint", "viem.ts");
252230
+ note("Viem resources generated successfully");
252231
+ }
252232
+
251924
252233
  // src/commands/codegen.ts
251925
252234
  function codegenCommand() {
251926
- return new Command("codegen").option("--prod", "Connect to your production environment").option("--thegraph-subgraph-names <subgraph-names...>", "The name(s) of the TheGraph subgraph(s) to generate (skip if you want to generate all)").description("Generate GraphQL and REST types and queries").usage(createExamples([
252235
+ return new Command("codegen").option("--prod", "Connect to your production environment").option("--thegraph-subgraph-names <subgraph-names...>", "The name(s) of the TheGraph subgraph(s) to generate (skip if you want to generate all)").option("--generate-viem", "Generate Viem resources").description("Generate GraphQL and REST types and queries").usage(createExamples([
251927
252236
  {
251928
252237
  description: "Generate GraphQL types and queries for your dApp",
251929
252238
  command: "codegen"
@@ -251931,8 +252240,12 @@ function codegenCommand() {
251931
252240
  {
251932
252241
  description: "Generate GraphQL types and queries for specific TheGraph subgraphs",
251933
252242
  command: "codegen --thegraph-subgraph-names subgraph1 subgraph2"
252243
+ },
252244
+ {
252245
+ description: "Generate Viem resources",
252246
+ command: "codegen --generate-viem"
251934
252247
  }
251935
- ])).action(async ({ prod, thegraphSubgraphNames }) => {
252248
+ ])).action(async ({ prod, thegraphSubgraphNames, generateViem }) => {
251936
252249
  intro("Generating GraphQL types and queries for your dApp");
251937
252250
  const env2 = await loadEnv(true, !!prod);
251938
252251
  if (!Array.isArray(thegraphSubgraphNames)) {
@@ -251950,6 +252263,10 @@ function codegenCommand() {
251950
252263
  },
251951
252264
  stopMessage: "Tested GraphQL schemas"
251952
252265
  });
252266
+ if (generateViem) {
252267
+ note("Generating Viem resources");
252268
+ await codegenViem(env2);
252269
+ }
251953
252270
  if (hasura) {
251954
252271
  note("Generating Hasura resources");
251955
252272
  await codegenHasura(env2);
@@ -252211,6 +252528,7 @@ async function applicationPrompt(env2, applications, accept) {
252211
252528
  }
252212
252529
 
252213
252530
  // src/prompts/cluster-service/service.prompt.ts
252531
+ var ALL2 = "All";
252214
252532
  async function servicePrompt({
252215
252533
  env: env2,
252216
252534
  services,
@@ -252219,13 +252537,17 @@ async function servicePrompt({
252219
252537
  defaultHandler,
252220
252538
  isRequired = false,
252221
252539
  isCi = is_in_ci_default,
252222
- singleOptionMessage
252540
+ singleOptionMessage,
252541
+ allowAll = false
252223
252542
  }) {
252224
252543
  if (services.length === 0) {
252225
252544
  return;
252226
252545
  }
252227
- const selectedService = services.find((service) => service.uniqueName === env2[envKey]);
252546
+ const selectedService = services.find((service) => Array.isArray(service) ? false : service.uniqueName === env2[envKey]);
252228
252547
  const autoAccept = isCi || accept;
252548
+ if (autoAccept && allowAll) {
252549
+ return services;
252550
+ }
252229
252551
  if (autoAccept && selectedService) {
252230
252552
  return selectedService;
252231
252553
  }
@@ -252233,7 +252555,7 @@ async function servicePrompt({
252233
252555
  return;
252234
252556
  }
252235
252557
  if (isRequired && services.length === 1) {
252236
- if (singleOptionMessage) {
252558
+ if (singleOptionMessage && !Array.isArray(services[0])) {
252237
252559
  note(singleOptionMessage(services[0].uniqueName));
252238
252560
  }
252239
252561
  return services[0];
@@ -252242,13 +252564,37 @@ async function servicePrompt({
252242
252564
  name: `${service.name} (${service.uniqueName})`,
252243
252565
  value: service
252244
252566
  }));
252567
+ if (allowAll) {
252568
+ choices.unshift({
252569
+ name: ALL2,
252570
+ value: services
252571
+ });
252572
+ }
252245
252573
  if (!isRequired) {
252246
252574
  choices.push({
252247
252575
  name: "None",
252248
252576
  value: undefined
252249
252577
  });
252250
252578
  }
252251
- return defaultHandler({ defaultService: selectedService, choices });
252579
+ return defaultHandler({
252580
+ defaultService: selectedService,
252581
+ choices
252582
+ });
252583
+ }
252584
+
252585
+ // src/utils/cluster-service.ts
252586
+ function isValidPrivateKey(privateKey) {
252587
+ return privateKey.privateKeyType !== "HD_ECDSA_P256";
252588
+ }
252589
+ function hasValidPrivateKey(service) {
252590
+ return (service.privateKeys ?? []).some(isValidPrivateKey);
252591
+ }
252592
+ function hasPrivateKey(service) {
252593
+ const keys = service.privateKeys ?? [];
252594
+ return keys.length > 0;
252595
+ }
252596
+ function isRunning(service) {
252597
+ return service === undefined || service?.status === "COMPLETED";
252252
252598
  }
252253
252599
 
252254
252600
  // src/prompts/cluster-service/blockchain-node.prompt.ts
@@ -252259,7 +252605,8 @@ async function blockchainNodePrompt({
252259
252605
  singleOptionMessage,
252260
252606
  promptMessage,
252261
252607
  filterRunningOnly = false,
252262
- isRequired = false
252608
+ isRequired = false,
252609
+ allowAll = false
252263
252610
  }) {
252264
252611
  return servicePrompt({
252265
252612
  env: env2,
@@ -252268,14 +252615,25 @@ async function blockchainNodePrompt({
252268
252615
  envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
252269
252616
  isRequired,
252270
252617
  defaultHandler: async ({ defaultService: defaultNode, choices }) => {
252271
- const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => node === undefined || node?.status === "COMPLETED") : choices;
252618
+ const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => {
252619
+ return Array.isArray(node) ? true : isRunning(node);
252620
+ }).map((item) => {
252621
+ if (Array.isArray(item.value)) {
252622
+ return {
252623
+ ...item,
252624
+ value: item.value.filter(isRunning)
252625
+ };
252626
+ }
252627
+ return item;
252628
+ }) : choices;
252272
252629
  return esm_default3({
252273
252630
  message: promptMessage ?? "Which blockchain node do you want to connect to?",
252274
252631
  choices: filteredChoices,
252275
252632
  default: defaultNode
252276
252633
  });
252277
252634
  },
252278
- singleOptionMessage
252635
+ singleOptionMessage,
252636
+ allowAll
252279
252637
  });
252280
252638
  }
252281
252639
 
@@ -252580,7 +252938,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
252580
252938
  storages,
252581
252939
  privateKeys,
252582
252940
  insights,
252583
- customDeployments
252941
+ customDeployments,
252942
+ loadBalancers
252584
252943
  ] = await Promise.all([
252585
252944
  shouldFetch("blockchain-network") ? settlemint.blockchainNetwork.list(applicationUniqueName) : Promise.resolve([]),
252586
252945
  shouldFetch("blockchain-node") ? settlemint.blockchainNode.list(applicationUniqueName) : Promise.resolve([]),
@@ -252589,7 +252948,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
252589
252948
  shouldFetch("storage") ? settlemint.storage.list(applicationUniqueName) : Promise.resolve([]),
252590
252949
  shouldFetch("private-key") ? settlemint.privateKey.list(applicationUniqueName) : Promise.resolve([]),
252591
252950
  shouldFetch("insights") ? settlemint.insights.list(applicationUniqueName) : Promise.resolve([]),
252592
- shouldFetch("custom-deployment") ? settlemint.customDeployment.list(applicationUniqueName) : Promise.resolve([])
252951
+ shouldFetch("custom-deployment") ? settlemint.customDeployment.list(applicationUniqueName) : Promise.resolve([]),
252952
+ shouldFetch("load-balancer") ? settlemint.loadBalancer.list(applicationUniqueName) : Promise.resolve([])
252593
252953
  ]);
252594
252954
  return {
252595
252955
  blockchainNetworks,
@@ -252599,7 +252959,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
252599
252959
  storages,
252600
252960
  privateKeys,
252601
252961
  insights,
252602
- customDeployments
252962
+ customDeployments,
252963
+ loadBalancers
252603
252964
  };
252604
252965
  }
252605
252966
  });
@@ -252638,8 +252999,11 @@ async function writeEnvSpinner(prod, env2) {
252638
252999
  SETTLEMINT_WORKSPACE: env2.SETTLEMINT_WORKSPACE,
252639
253000
  SETTLEMINT_APPLICATION: env2.SETTLEMINT_APPLICATION,
252640
253001
  SETTLEMINT_BLOCKCHAIN_NETWORK: env2.SETTLEMINT_BLOCKCHAIN_NETWORK,
253002
+ SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID: env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID,
252641
253003
  SETTLEMINT_BLOCKCHAIN_NODE: env2.SETTLEMINT_BLOCKCHAIN_NODE,
252642
- SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_PUBLIC: env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_PUBLIC,
253004
+ SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT: env2.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT,
253005
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER,
253006
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT: env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT,
252643
253007
  SETTLEMINT_HASURA: env2.SETTLEMINT_HASURA,
252644
253008
  SETTLEMINT_HASURA_ENDPOINT: env2.SETTLEMINT_HASURA_ENDPOINT,
252645
253009
  SETTLEMINT_THEGRAPH: env2.SETTLEMINT_THEGRAPH,
@@ -252674,6 +253038,14 @@ async function writeEnvSpinner(prod, env2) {
252674
253038
  });
252675
253039
  }
252676
253040
 
253041
+ // src/utils/blockchain-network.ts
253042
+ function getBlockchainNetworkChainId(blockchainNetwork) {
253043
+ if (!blockchainNetwork) {
253044
+ return;
253045
+ }
253046
+ return "chainId" in blockchainNetwork && typeof blockchainNetwork.chainId === "number" ? blockchainNetwork.chainId.toString() : undefined;
253047
+ }
253048
+
252677
253049
  // src/utils/get-cluster-service-endpoint.ts
252678
253050
  async function getGraphEndpoint(settlemint, service, graphName) {
252679
253051
  if (!service || service.__typename !== "HAGraphMiddleware") {
@@ -252747,6 +253119,51 @@ function getMinioEndpoints(service) {
252747
253119
  SETTLEMINT_MINIO_SECRET_KEY: service?.credentials.find((credential) => credential.id.includes("secret-key"))?.displayValue
252748
253120
  };
252749
253121
  }
253122
+ function getBlockchainNodeEndpoints(service) {
253123
+ if (!service) {
253124
+ return {};
253125
+ }
253126
+ return {
253127
+ SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT: service.endpoints.find((endpoint) => endpoint.id.includes("json-rpc"))?.displayValue
253128
+ };
253129
+ }
253130
+ function getBlockchainNodeOrLoadBalancerEndpoints(service) {
253131
+ if (!service) {
253132
+ return {};
253133
+ }
253134
+ return {
253135
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT: service.endpoints.find((endpoint) => endpoint.id.includes("json-rpc"))?.displayValue
253136
+ };
253137
+ }
253138
+
253139
+ // src/prompts/cluster-service/blockchain-node-or-load-balancer.prompt.ts
253140
+ async function blockchainNodeOrLoadBalancerPrompt({
253141
+ env: env2,
253142
+ nodes,
253143
+ loadBalancers,
253144
+ accept,
253145
+ singleOptionMessage,
253146
+ promptMessage,
253147
+ filterRunningOnly = false,
253148
+ isRequired = false
253149
+ }) {
253150
+ return servicePrompt({
253151
+ env: env2,
253152
+ services: [...loadBalancers, ...nodes],
253153
+ accept,
253154
+ envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
253155
+ isRequired,
253156
+ defaultHandler: async ({ defaultService: defaultNode, choices }) => {
253157
+ const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => node === undefined || node?.status === "COMPLETED") : choices;
253158
+ return esm_default3({
253159
+ message: promptMessage ?? "Which blockchain node or load balancer do you want to connect to?",
253160
+ choices: filteredChoices,
253161
+ default: defaultNode
253162
+ });
253163
+ },
253164
+ singleOptionMessage
253165
+ });
253166
+ }
252750
253167
 
252751
253168
  // src/commands/connect.ts
252752
253169
  function connectCommand() {
@@ -252767,11 +253184,30 @@ function connectCommand() {
252767
253184
  const workspace = await workspacePrompt(env2, workspaces, acceptDefaults);
252768
253185
  const application = await applicationPrompt(env2, workspace?.applications ?? [], acceptDefaults);
252769
253186
  const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, acceptDefaults);
252770
- const { middlewares, integrationTools, storages, privateKeys, insights, customDeployments, blockchainNodes } = await servicesSpinner(settlemint, application.uniqueName);
253187
+ const {
253188
+ middlewares,
253189
+ integrationTools,
253190
+ storages,
253191
+ privateKeys,
253192
+ insights,
253193
+ customDeployments,
253194
+ blockchainNodes,
253195
+ loadBalancers
253196
+ } = await servicesSpinner(settlemint, application.uniqueName);
253197
+ const nodesWithPrivateKey = blockchainNodes.filter(hasPrivateKey);
252771
253198
  const blockchainNode = await blockchainNodePrompt({
252772
253199
  env: env2,
252773
- nodes: blockchainNodes,
252774
- accept: acceptDefaults
253200
+ nodes: nodesWithPrivateKey,
253201
+ accept: acceptDefaults,
253202
+ promptMessage: "Which blockchain node do you want to use for sending transactions?"
253203
+ });
253204
+ const nodesWithoutPrivateKey = blockchainNodes.filter((node) => !hasPrivateKey(node));
253205
+ const loadBalancerOrBlockchainNode = await blockchainNodeOrLoadBalancerPrompt({
253206
+ env: env2,
253207
+ nodes: nodesWithoutPrivateKey,
253208
+ loadBalancers,
253209
+ accept: acceptDefaults,
253210
+ promptMessage: "Which load balancer or blockchain node do you want to use for read operations?"
252775
253211
  });
252776
253212
  const hasura = await hasuraPrompt({
252777
253213
  env: env2,
@@ -252837,10 +253273,15 @@ function connectCommand() {
252837
253273
  uniqueName: blockchainNode.blockchainNetwork?.uniqueName
252838
253274
  },
252839
253275
  blockchainNode && {
252840
- type: "Blockchain Node",
253276
+ type: "Blockchain Node (use for sending transactions)",
252841
253277
  name: blockchainNode.name,
252842
253278
  uniqueName: blockchainNode.uniqueName
252843
253279
  },
253280
+ loadBalancerOrBlockchainNode && {
253281
+ type: "Load Balancer or Blockchain Node (use for read operations)",
253282
+ name: loadBalancerOrBlockchainNode.name,
253283
+ uniqueName: loadBalancerOrBlockchainNode.uniqueName
253284
+ },
252844
253285
  hasura && {
252845
253286
  type: "Hasura",
252846
253287
  name: hasura.name,
@@ -252890,7 +253331,11 @@ function connectCommand() {
252890
253331
  SETTLEMINT_WORKSPACE: workspace.uniqueName,
252891
253332
  SETTLEMINT_APPLICATION: application.uniqueName,
252892
253333
  SETTLEMINT_BLOCKCHAIN_NETWORK: blockchainNode?.blockchainNetwork?.uniqueName,
253334
+ SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID: getBlockchainNetworkChainId(blockchainNode?.blockchainNetwork),
252893
253335
  SETTLEMINT_BLOCKCHAIN_NODE: blockchainNode?.uniqueName,
253336
+ ...getBlockchainNodeEndpoints(blockchainNode),
253337
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: loadBalancerOrBlockchainNode?.uniqueName,
253338
+ ...getBlockchainNodeOrLoadBalancerEndpoints(loadBalancerOrBlockchainNode),
252894
253339
  SETTLEMINT_HASURA: hasura?.uniqueName,
252895
253340
  ...getHasuraEndpoints(hasura),
252896
253341
  SETTLEMINT_THEGRAPH: thegraph?.uniqueName,
@@ -256232,7 +256677,8 @@ var SETTLEMINT_CLIENT_MAP = {
256232
256677
  "integration tool": "integrationTool",
256233
256678
  storage: "storage",
256234
256679
  insights: "insights",
256235
- "application access token": "applicationAccessToken"
256680
+ "application access token": "applicationAccessToken",
256681
+ "load balancer": "loadBalancer"
256236
256682
  };
256237
256683
  var LABELS_MAP = {
256238
256684
  application: { singular: "application", plural: "applications", command: "app" },
@@ -256253,7 +256699,8 @@ var LABELS_MAP = {
256253
256699
  singular: "application access token",
256254
256700
  plural: "application access tokens",
256255
256701
  command: "application-access-token"
256256
- }
256702
+ },
256703
+ "load balancer": { singular: "load balancer", plural: "load balancers", command: "load-balancer" }
256257
256704
  };
256258
256705
 
256259
256706
  // src/spinners/service.spinner.ts
@@ -256755,7 +257202,10 @@ function getCreateCommand({
256755
257202
  usePersonalAccessToken = true,
256756
257203
  requiresDeployment = true
256757
257204
  }) {
256758
- const cmd2 = new Command(sanitizeCommandName(name3)).alias(alias).description(`Create a new ${subType ? `${subType} ${type4}` : type4} in the SettleMint platform.`).usage(createExamples(examples)).argument("<name>", `The ${subType ? `${subType} ${type4}` : type4} name`).option("-a, --accept-defaults", "Accept the default values").option("-d, --default", `Save as default ${type4}`).option("--prod", "Connect to production environment");
257205
+ const cmd2 = new Command(sanitizeCommandName(name3)).description(`Create a new ${subType ? `${subType} ${type4}` : type4} in the SettleMint platform.`).usage(createExamples(examples)).argument("<name>", `The ${subType ? `${subType} ${type4}` : type4} name`).option("-a, --accept-defaults", "Accept the default values").option("-d, --default", `Save as default ${type4}`).option("--prod", "Connect to production environment");
257206
+ if (alias) {
257207
+ cmd2.alias(alias);
257208
+ }
256759
257209
  if (requiresDeployment) {
256760
257210
  cmd2.option("-w, --wait", "Wait until deployed").option("-r, --restart-if-timeout", "Restart if wait time is exceeded");
256761
257211
  }
@@ -256825,7 +257275,10 @@ function getCreateCommand({
256825
257275
  newEnv.SETTLEMINT_WORKSPACE = (await settlemint.application.read(updatedEnv.SETTLEMINT_APPLICATION)).workspace.uniqueName;
256826
257276
  }
256827
257277
  if (newEnv.SETTLEMINT_BLOCKCHAIN_NODE && newEnv.SETTLEMINT_BLOCKCHAIN_NODE !== env2.SETTLEMINT_BLOCKCHAIN_NODE) {
256828
- newEnv.SETTLEMINT_BLOCKCHAIN_NETWORK = (await settlemint.blockchainNode.read(newEnv.SETTLEMINT_BLOCKCHAIN_NODE)).blockchainNetwork.uniqueName;
257278
+ const newNode = await settlemint.blockchainNode.read(newEnv.SETTLEMINT_BLOCKCHAIN_NODE);
257279
+ newEnv.SETTLEMINT_BLOCKCHAIN_NETWORK = newNode.blockchainNetwork.uniqueName;
257280
+ newEnv.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID = getBlockchainNetworkChainId(newNode.blockchainNetwork);
257281
+ newEnv.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT = getBlockchainNodeEndpoints(newNode).SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT;
256829
257282
  }
256830
257283
  await writeEnvSpinner(!!prod, newEnv);
256831
257284
  note(`${capitalizeFirstLetter2(type4)} ${result.name} set as default`);
@@ -256897,7 +257350,11 @@ function blockchainNetworkBesuCreateCommand() {
256897
257350
  return {
256898
257351
  SETTLEMINT_APPLICATION: applicationUniqueName,
256899
257352
  SETTLEMINT_BLOCKCHAIN_NETWORK: result.uniqueName,
256900
- SETTLEMINT_BLOCKCHAIN_NODE: blockchainNode?.uniqueName
257353
+ SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID: getBlockchainNetworkChainId(result),
257354
+ SETTLEMINT_BLOCKCHAIN_NODE: blockchainNode?.uniqueName,
257355
+ ...getBlockchainNodeEndpoints(blockchainNode),
257356
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: undefined,
257357
+ ...getBlockchainNodeOrLoadBalancerEndpoints(undefined)
256901
257358
  };
256902
257359
  }
256903
257360
  };
@@ -257343,12 +257800,14 @@ function blockscoutInsightsCreateCommand() {
257343
257800
  return missingApplication();
257344
257801
  }
257345
257802
  let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
257346
- const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_PUBLIC;
257803
+ const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER;
257347
257804
  if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
257348
257805
  const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257349
- const node = await blockchainNodePrompt({
257806
+ const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
257807
+ const node = await blockchainNodeOrLoadBalancerPrompt({
257350
257808
  env: env2,
257351
257809
  nodes: blockchainNodes,
257810
+ loadBalancers,
257352
257811
  accept: acceptDefaults,
257353
257812
  isRequired: true
257354
257813
  });
@@ -257461,6 +257920,107 @@ function integrationToolCreateCommand() {
257461
257920
  return cmd2;
257462
257921
  }
257463
257922
 
257923
+ // src/commands/platform/load-balancer/evm/create.ts
257924
+ function loadBalancerEvmCreateCommand() {
257925
+ return getCreateCommand({
257926
+ name: "evm",
257927
+ type: "load balancer",
257928
+ subType: "EVM",
257929
+ execute: (cmd2, baseAction) => {
257930
+ addClusterServiceArgs(cmd2).option("--app, --application <application>", "The application unique name to create the load balancer in (defaults to application from env)").option("--blockchain-nodes <blockchainNodes...>", "Blockchain node unique names where the load balancer connects to (must be from the same network)").action(async (name3, { application, provider, region, size, type: type4, blockchainNodes, acceptDefaults, ...defaultArgs }) => {
257931
+ return baseAction({
257932
+ ...defaultArgs,
257933
+ acceptDefaults,
257934
+ provider,
257935
+ region
257936
+ }, async ({ settlemint, env: env2, showSpinner, provider: provider2, region: region2 }) => {
257937
+ const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
257938
+ if (!applicationUniqueName) {
257939
+ return missingApplication();
257940
+ }
257941
+ let networkUniqueName;
257942
+ let connectedNodesUniqueNames = blockchainNodes;
257943
+ if (!connectedNodesUniqueNames) {
257944
+ const networks = await serviceSpinner("blockchain network", () => settlemint.blockchainNetwork.list(applicationUniqueName));
257945
+ const network = await blockchainNetworkPrompt({
257946
+ env: env2,
257947
+ networks,
257948
+ accept: acceptDefaults,
257949
+ isRequired: true
257950
+ });
257951
+ if (!network) {
257952
+ return nothingSelectedError("blockchain network");
257953
+ }
257954
+ networkUniqueName = network.uniqueName;
257955
+ const blockchainNodes2 = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257956
+ const connectedNodes = await blockchainNodePrompt({
257957
+ env: env2,
257958
+ nodes: blockchainNodes2.filter((node) => node.blockchainNetwork?.uniqueName === network.uniqueName),
257959
+ accept: acceptDefaults,
257960
+ promptMessage: "Which blockchain node do you want to connect the load balancer to?",
257961
+ allowAll: true
257962
+ });
257963
+ connectedNodesUniqueNames = Array.isArray(connectedNodes) ? blockchainNodes2.map((node) => node.uniqueName) : connectedNodes ? [connectedNodes.uniqueName] : [];
257964
+ }
257965
+ if (connectedNodesUniqueNames.length === 0) {
257966
+ return cancel2("A load balancer must connect to at least one blockchain node");
257967
+ }
257968
+ if (!networkUniqueName) {
257969
+ const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257970
+ const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
257971
+ if (selectedBlockchainNodes.length === 0) {
257972
+ return cancel2(`Blockchain node(s) '${connectedNodesUniqueNames.join(", ")}' are not part of the application '${applicationUniqueName}'`);
257973
+ }
257974
+ const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === selectedBlockchainNodes[0].blockchainNetwork?.uniqueName);
257975
+ if (!onTheSameNetwork) {
257976
+ return cancel2("Blockchain nodes must be on the same network");
257977
+ }
257978
+ networkUniqueName = selectedBlockchainNodes[0].blockchainNetwork?.uniqueName;
257979
+ }
257980
+ const result = await showSpinner(() => settlemint.loadBalancer.create({
257981
+ applicationUniqueName,
257982
+ name: name3,
257983
+ blockchainNetworkUniqueName: networkUniqueName,
257984
+ provider: provider2,
257985
+ region: region2,
257986
+ size,
257987
+ type: type4,
257988
+ connectedNodesUniqueNames
257989
+ }));
257990
+ return {
257991
+ result,
257992
+ mapDefaultEnv: () => {
257993
+ return {
257994
+ SETTLEMINT_APPLICATION: applicationUniqueName,
257995
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: result.uniqueName
257996
+ };
257997
+ }
257998
+ };
257999
+ });
258000
+ });
258001
+ },
258002
+ examples: [
258003
+ {
258004
+ description: "Create an EVM load balancer and save as default",
258005
+ command: "platform create load-balancer evm my-lb --accept-defaults -d"
258006
+ },
258007
+ {
258008
+ description: "Create an EVM load balancer and connect to specific blockchain nodes",
258009
+ command: "platform create load-balancer evm my-lb --blockchain-network my-network --accept-defaults"
258010
+ },
258011
+ {
258012
+ description: "Create an EVM load balancer in a different application",
258013
+ command: "platform create load-balancer evm my-lb --application my-app --accept-defaults"
258014
+ }
258015
+ ]
258016
+ });
258017
+ }
258018
+
258019
+ // src/commands/platform/load-balancer/create.ts
258020
+ function loadBalancerCreateCommand() {
258021
+ return new Command("load-balancer").alias("lb").description("Create a load balancer in the SettleMint platform").addCommand(loadBalancerEvmCreateCommand());
258022
+ }
258023
+
257464
258024
  // src/commands/platform/middleware/graph/create.ts
257465
258025
  function graphMiddlewareCreateCommand() {
257466
258026
  return getCreateCommand({
@@ -257469,7 +258029,7 @@ function graphMiddlewareCreateCommand() {
257469
258029
  subType: "The Graph",
257470
258030
  alias: "gr",
257471
258031
  execute: (cmd2, baseAction) => {
257472
- addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name3, { application, blockchainNode, provider, region, size, type: type4, acceptDefaults, ...defaultArgs }) => {
258032
+ addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name (mutually exclusive with load-balancer)").option("--load-balancer <loadBalancer>", "Load Balancer unique name (mutually exclusive with blockchain-node)").action(async (name3, { application, blockchainNode, loadBalancer, provider, region, size, type: type4, acceptDefaults, ...defaultArgs }) => {
257473
258033
  return baseAction({
257474
258034
  ...defaultArgs,
257475
258035
  acceptDefaults,
@@ -257481,24 +258041,32 @@ function graphMiddlewareCreateCommand() {
257481
258041
  return missingApplication();
257482
258042
  }
257483
258043
  let blockchainNodeUniqueName = blockchainNode;
257484
- if (!blockchainNodeUniqueName) {
258044
+ let loadBalancerUniqueName = loadBalancer;
258045
+ if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
257485
258046
  const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257486
- const node = await blockchainNodePrompt({
258047
+ const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
258048
+ const nodeOrLoadbalancer = await blockchainNodeOrLoadBalancerPrompt({
257487
258049
  env: env2,
257488
258050
  nodes: blockchainNodes,
258051
+ loadBalancers,
257489
258052
  accept: acceptDefaults,
257490
258053
  isRequired: true
257491
258054
  });
257492
- if (!node) {
257493
- return nothingSelectedError("blockchain node");
258055
+ if (!nodeOrLoadbalancer) {
258056
+ return nothingSelectedError("blockchain node or load balancer");
258057
+ }
258058
+ if (nodeOrLoadbalancer.__typename?.endsWith("LoadBalancer")) {
258059
+ loadBalancerUniqueName = nodeOrLoadbalancer.uniqueName;
258060
+ } else {
258061
+ blockchainNodeUniqueName = nodeOrLoadbalancer.uniqueName;
257494
258062
  }
257495
- blockchainNodeUniqueName = node.uniqueName;
257496
258063
  }
257497
258064
  const result = await showSpinner(() => settlemint.middleware.create({
257498
258065
  name: name3,
257499
258066
  applicationUniqueName,
257500
258067
  interface: "HA_GRAPH",
257501
258068
  blockchainNodeUniqueName,
258069
+ loadBalancerUniqueName,
257502
258070
  provider: provider2,
257503
258071
  region: region2,
257504
258072
  size,
@@ -257564,12 +258132,12 @@ function smartContractPortalMiddlewareCreateCommand() {
257564
258132
  return missingApplication();
257565
258133
  }
257566
258134
  let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
257567
- const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_PUBLIC;
258135
+ const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER;
257568
258136
  if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
257569
258137
  const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257570
258138
  const node = await blockchainNodePrompt({
257571
258139
  env: env2,
257572
- nodes: blockchainNodes,
258140
+ nodes: blockchainNodes.filter(hasValidPrivateKey),
257573
258141
  accept: acceptDefaults,
257574
258142
  isRequired: true
257575
258143
  });
@@ -257947,7 +258515,7 @@ function storageCreateCommand() {
257947
258515
 
257948
258516
  // src/commands/platform/create.ts
257949
258517
  function createCommand3() {
257950
- return new Command("create").alias("c").description("Create a resource in the SettleMint platform").addCommand(workspaceCreateCommand()).addCommand(applicationCreateCommand()).addCommand(blockchainNetworkCreateCommand()).addCommand(blockchainNodeCreateCommand()).addCommand(privateKeyCreateCommand()).addCommand(middlewareCreateCommand()).addCommand(storageCreateCommand()).addCommand(integrationToolCreateCommand()).addCommand(insightsCreateCommand()).addCommand(applicationAccessTokenCreateCommand());
258518
+ return new Command("create").alias("c").description("Create a resource in the SettleMint platform").addCommand(workspaceCreateCommand()).addCommand(applicationCreateCommand()).addCommand(blockchainNetworkCreateCommand()).addCommand(blockchainNodeCreateCommand()).addCommand(privateKeyCreateCommand()).addCommand(middlewareCreateCommand()).addCommand(storageCreateCommand()).addCommand(integrationToolCreateCommand()).addCommand(insightsCreateCommand()).addCommand(applicationAccessTokenCreateCommand()).addCommand(loadBalancerCreateCommand());
257951
258519
  }
257952
258520
 
257953
258521
  // src/prompts/delete-confirmation.prompt.ts
@@ -258187,6 +258755,19 @@ function integrationToolRestartCommand() {
258187
258755
  return new Command("integration-tool").alias("it").description("Restart an integration tool service in the SettleMint platform").addCommand(hasuraRestartCommand());
258188
258756
  }
258189
258757
 
258758
+ // src/commands/platform/load-balancer/restart.ts
258759
+ function loadBalancerRestartCommand() {
258760
+ return getRestartCommand({
258761
+ name: "load-balancer",
258762
+ type: "load balancer",
258763
+ alias: "lb",
258764
+ envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
258765
+ restartFunction: async (settlemint, id) => {
258766
+ return settlemint.loadBalancer.restart(id);
258767
+ }
258768
+ });
258769
+ }
258770
+
258190
258771
  // src/commands/platform/middleware/graph/restart.ts
258191
258772
  function graphRestartCommand() {
258192
258773
  return getRestartCommand({
@@ -258253,7 +258834,7 @@ function storageRestartCommand() {
258253
258834
 
258254
258835
  // src/commands/platform/restart.ts
258255
258836
  function restartCommand() {
258256
- const cmd2 = new Command("restart").description("Restart a resource in the SettleMint platform").addCommand(blockchainNetworkRestartCommand()).addCommand(customDeploymentRestartCommand()).addCommand(insightsRestartCommand()).addCommand(integrationToolRestartCommand()).addCommand(middlewareRestartCommand()).addCommand(storageRestartCommand());
258837
+ const cmd2 = new Command("restart").description("Restart a resource in the SettleMint platform").addCommand(blockchainNetworkRestartCommand()).addCommand(customDeploymentRestartCommand()).addCommand(insightsRestartCommand()).addCommand(integrationToolRestartCommand()).addCommand(middlewareRestartCommand()).addCommand(storageRestartCommand()).addCommand(loadBalancerRestartCommand());
258257
258838
  return cmd2;
258258
258839
  }
258259
258840
 
@@ -258359,10 +258940,7 @@ function yamlOutput(data) {
258359
258940
  // src/commands/platform/config.ts
258360
258941
  function configCommand() {
258361
258942
  return new Command("config").alias("cfg").description("Get platform configuration").option("--prod", "Connect to your production environment").option("-i, --instance <instance>", "The instance to connect to (defaults to the instance in the .env file)").addOption(new Option("-o, --output <output>", "The output format").choices(["json", "yaml"])).action(async ({ prod, instance, output }) => {
258362
- const printToTerminal = !output;
258363
- if (printToTerminal) {
258364
- intro("Getting platform configuration");
258365
- }
258943
+ intro("Getting platform configuration");
258366
258944
  const env2 = await loadEnv(false, !!prod);
258367
258945
  const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, true);
258368
258946
  const settlemint = createSettleMintClient({
@@ -258392,19 +258970,17 @@ function configCommand() {
258392
258970
  }))).sort((a8, b4) => a8.providerId.localeCompare(b4.providerId) || a8.regionId.localeCompare(b4.regionId)),
258393
258971
  preDeployedContracts: platformConfig.preDeployedContracts.sort()
258394
258972
  };
258395
- if (printToTerminal) {
258973
+ if (output === "json") {
258974
+ jsonOutput(platformConfigData);
258975
+ } else if (output === "yaml") {
258976
+ yamlOutput(platformConfigData);
258977
+ } else {
258396
258978
  table("Templates (Kits)", platformConfigData.kits);
258397
258979
  table("Use cases (Smart Contract Sets)", platformConfigData.useCases);
258398
258980
  table("Providers and regions", platformConfigData.deploymentEngineTargets);
258399
258981
  list("Pre-deployed abis (Smart Contract Portal)", platformConfigData.preDeployedContracts);
258400
- } else if (output === "json") {
258401
- jsonOutput(platformConfigData);
258402
- } else if (output === "yaml") {
258403
- yamlOutput(platformConfigData);
258404
- }
258405
- if (printToTerminal) {
258406
- outro("Platform configuration retrieved");
258407
258982
  }
258983
+ outro("Platform configuration retrieved");
258408
258984
  });
258409
258985
  }
258410
258986
 
@@ -258480,10 +259056,7 @@ function applicationsListCommand() {
258480
259056
  command: "platform list applications -o yaml > applications.yaml"
258481
259057
  }
258482
259058
  ])).option("-w, --workspace <workspace>", "The workspace unique name to list applications for (defaults to workspace from env)").addOption(new Option("-o, --output <output>", "The output format").choices(["wide", "json", "yaml"])).action(async ({ workspace, output }) => {
258483
- const printToTerminal = !output || output === "wide";
258484
- if (printToTerminal) {
258485
- intro("Listing applications");
258486
- }
259059
+ intro("Listing applications");
258487
259060
  const env2 = await loadEnv(false, false);
258488
259061
  const selectedInstance = await instancePrompt(env2, true);
258489
259062
  const personalAccessToken = await getInstanceCredentials(selectedInstance);
@@ -258496,13 +259069,12 @@ function applicationsListCommand() {
258496
259069
  });
258497
259070
  const workspaceUniqueName = workspace ?? env2.SETTLEMINT_WORKSPACE ?? await selectWorkspace(settlemint, env2);
258498
259071
  const applications = await applicationsSpinner(settlemint, workspaceUniqueName);
258499
- const wide = output === "wide";
258500
259072
  const applicationsData = applications.map((application) => {
258501
259073
  const basicFields = {
258502
259074
  name: application.name,
258503
259075
  uniqueName: application.uniqueName
258504
259076
  };
258505
- if (wide || !printToTerminal) {
259077
+ if (output) {
258506
259078
  return {
258507
259079
  ...basicFields,
258508
259080
  url: getApplicationUrl(selectedInstance, application)
@@ -258510,17 +259082,15 @@ function applicationsListCommand() {
258510
259082
  }
258511
259083
  return basicFields;
258512
259084
  });
258513
- if (printToTerminal) {
258514
- const selectedWorkspace = await settlemint.workspace.read(workspaceUniqueName);
258515
- table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace.uniqueName}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
258516
- } else if (output === "json") {
259085
+ const selectedWorkspace = await settlemint.workspace.read(workspaceUniqueName);
259086
+ if (output === "json") {
258517
259087
  jsonOutput(applicationsData);
258518
259088
  } else if (output === "yaml") {
258519
259089
  yamlOutput(applicationsData);
259090
+ } else {
259091
+ table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace.uniqueName}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
258520
259092
  }
258521
- if (printToTerminal) {
258522
- outro("Applications listed");
258523
- }
259093
+ outro("Applications listed");
258524
259094
  });
258525
259095
  }
258526
259096
  async function selectWorkspace(settlemint, env2) {
@@ -258534,7 +259104,7 @@ function formatServiceSubType(service, printToTerminal = true) {
258534
259104
  if ("__typename" in service && typeof service.__typename === "string") {
258535
259105
  return printToTerminal ? camelCaseToWords2(service.__typename) : service.__typename;
258536
259106
  }
258537
- return printToTerminal ? "Unknown" : "Unknown";
259107
+ return "Unknown";
258538
259108
  }
258539
259109
 
258540
259110
  // src/commands/platform/utils/formatting/format-health-status.ts
@@ -258565,6 +259135,7 @@ function formatStatus(status, printToTerminal = true) {
258565
259135
  var SERVICE_TYPES = [
258566
259136
  "blockchain-network",
258567
259137
  "blockchain-node",
259138
+ "load-balancer",
258568
259139
  "custom-deployment",
258569
259140
  "insights",
258570
259141
  "integration-tool",
@@ -258603,10 +259174,7 @@ function servicesCommand() {
258603
259174
  command: "platform list services --type blockchain-network blockchain-node middleware"
258604
259175
  }
258605
259176
  ])).option("--app, --application <application>", "The application unique name to list the services in (defaults to application from env)").addOption(new Option("-t, --type <type...>", "The type(s) of service to list").choices(SERVICE_TYPES)).addOption(new Option("-o, --output <output>", "The output format").choices(["wide", "json", "yaml"])).action(async ({ application, type: type4, output }) => {
258606
- const printToTerminal = !output || output === "wide";
258607
- if (printToTerminal) {
258608
- intro("Listing application services");
258609
- }
259177
+ intro("Listing application services");
258610
259178
  const env2 = await loadEnv(false, false);
258611
259179
  const selectedInstance = await instancePrompt(env2, true);
258612
259180
  const personalAccessToken = await getInstanceCredentials(selectedInstance);
@@ -258618,6 +259186,7 @@ function servicesCommand() {
258618
259186
  accessToken,
258619
259187
  instance: selectedInstance
258620
259188
  });
259189
+ const printToTerminal = !output || output === "wide";
258621
259190
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION ?? (printToTerminal ? await selectApplication(settlemint, env2) : null);
258622
259191
  if (!applicationUniqueName) {
258623
259192
  return nothingSelectedError("application");
@@ -258645,16 +259214,14 @@ function servicesCommand() {
258645
259214
  },
258646
259215
  services: servicesToShow
258647
259216
  };
258648
- if (printToTerminal) {
258649
- table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
258650
- } else if (output === "json") {
259217
+ if (output === "json") {
258651
259218
  jsonOutput(data);
258652
259219
  } else if (output === "yaml") {
258653
259220
  yamlOutput(data);
259221
+ } else {
259222
+ table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
258654
259223
  }
258655
- if (printToTerminal) {
258656
- outro("Application services listed");
258657
- }
259224
+ outro("Application services listed");
258658
259225
  });
258659
259226
  }
258660
259227
  async function selectApplication(settlemint, env2) {
@@ -258723,6 +259290,8 @@ function getItemsForServiceType(services, serviceType) {
258723
259290
  return services.blockchainNetworks;
258724
259291
  case "blockchain-node":
258725
259292
  return services.blockchainNodes;
259293
+ case "load-balancer":
259294
+ return services.loadBalancers;
258726
259295
  default:
258727
259296
  return [];
258728
259297
  }
@@ -259096,38 +259665,6 @@ function getStatusAction(status) {
259096
259665
  return "Please try again later.";
259097
259666
  }
259098
259667
 
259099
- // src/prompts/smart-contract-set/address.prompt.ts
259100
- async function addressPrompt({
259101
- env: env2,
259102
- accept,
259103
- prod,
259104
- node,
259105
- hardhatConfig
259106
- }) {
259107
- const possiblePrivateKeys = node.privateKeys?.filter((privateKey) => validPrivateKey(privateKey)) ?? [];
259108
- const defaultAddress = hardhatConfig.networks?.btp?.from ?? possiblePrivateKeys[0]?.address;
259109
- const defaultPossible = accept && defaultAddress;
259110
- if (defaultPossible) {
259111
- if (possiblePrivateKeys.some((privateKey) => privateKey.address?.toLowerCase() === defaultAddress?.toLowerCase())) {
259112
- return defaultAddress;
259113
- }
259114
- note(`Private key with address '${defaultAddress}' is not activated on the node '${node.uniqueName}'.
259115
- Please select another key or activate this key on the node and try again.`, "warn");
259116
- }
259117
- const address = await esm_default3({
259118
- message: "Which private key do you want to deploy from?",
259119
- choices: possiblePrivateKeys.map(({ address: address2, name: name3 }) => ({
259120
- name: name3,
259121
- value: address2
259122
- })),
259123
- default: defaultAddress ?? possiblePrivateKeys[0]?.address
259124
- });
259125
- return address;
259126
- }
259127
- function validPrivateKey(privateKey) {
259128
- return privateKey.privateKeyType !== "HD_ECDSA_P256";
259129
- }
259130
-
259131
259668
  // src/commands/smart-contract-set/hardhat/utils/select-target-node.ts
259132
259669
  async function selectTargetNode({
259133
259670
  env: env2,
@@ -259173,7 +259710,7 @@ function validateNode(node, cancelOnError = true) {
259173
259710
  }
259174
259711
  return false;
259175
259712
  }
259176
- if (node.privateKeys?.filter((privateKey) => validPrivateKey(privateKey)).length === 0) {
259713
+ if (!hasValidPrivateKey(node)) {
259177
259714
  if (cancelOnError) {
259178
259715
  cancel2(`The specified blockchain node '${node.uniqueName}' does not have an ECDSA P256 or HSM ECDSA P256 private key activated. Please activate an ECDSA P256 or HSM ECDSA P256 private key on your node and try again.`);
259179
259716
  }
@@ -259188,6 +259725,33 @@ function validateNode(node, cancelOnError = true) {
259188
259725
  return true;
259189
259726
  }
259190
259727
 
259728
+ // src/prompts/smart-contract-set/address.prompt.ts
259729
+ async function addressPrompt({
259730
+ accept,
259731
+ node,
259732
+ hardhatConfig
259733
+ }) {
259734
+ const possiblePrivateKeys = node.privateKeys?.filter(isValidPrivateKey) ?? [];
259735
+ const defaultAddress = hardhatConfig.networks?.btp?.from ?? possiblePrivateKeys[0]?.address;
259736
+ const defaultPossible = accept && defaultAddress;
259737
+ if (defaultPossible) {
259738
+ if (possiblePrivateKeys.some((privateKey) => privateKey.address?.toLowerCase() === defaultAddress?.toLowerCase())) {
259739
+ return defaultAddress;
259740
+ }
259741
+ note(`Private key with address '${defaultAddress}' is not activated on the node '${node.uniqueName}'.
259742
+ Please select another key or activate this key on the node and try again.`, "warn");
259743
+ }
259744
+ const address = await esm_default3({
259745
+ message: "Which private key do you want to deploy from?",
259746
+ choices: possiblePrivateKeys.map(({ address: address2, name: name3 }) => ({
259747
+ name: name3,
259748
+ value: address2
259749
+ })),
259750
+ default: defaultAddress
259751
+ });
259752
+ return address;
259753
+ }
259754
+
259191
259755
  // src/utils/smart-contract-set/hardhat-config.ts
259192
259756
  async function getHardhatConfigData(envConfig) {
259193
259757
  try {
@@ -259277,7 +259841,7 @@ function hardhatDeployRemoteCommand() {
259277
259841
  }
259278
259842
  let address = defaultSender ?? null;
259279
259843
  if (!defaultSender) {
259280
- address = await addressPrompt({ env: env2, accept: autoAccept, prod, node, hardhatConfig });
259844
+ address = await addressPrompt({ accept: autoAccept, node, hardhatConfig });
259281
259845
  }
259282
259846
  if (!address) {
259283
259847
  return nothingSelectedError("private key");
@@ -259839,7 +260403,10 @@ function addHooksToCommand(cmd2, rootCmd, argv) {
259839
260403
  rootCmd._lastCommand = thisCommand;
259840
260404
  rootCmd._lastCommand._commandPath = commandPath;
259841
260405
  }
259842
- if (isLeafCommand(thisCommand) && !isJsonOrYamlOutput(thisCommand)) {
260406
+ if (isJsonOrYamlOutput(thisCommand)) {
260407
+ process.env.SETTLEMINT_DISABLE_TERMINAL = "true";
260408
+ }
260409
+ if (isLeafCommand(thisCommand)) {
259843
260410
  ascii();
259844
260411
  await validateSdkVersionFromCommand(thisCommand);
259845
260412
  }
@@ -259923,4 +260490,4 @@ async function sdkCliCommand(argv = process.argv) {
259923
260490
  // src/cli.ts
259924
260491
  sdkCliCommand();
259925
260492
 
259926
- //# debugId=579B1D5EE52893B764756E2164756E21
260493
+ //# debugId=3B85CBD648A9BF9064756E2164756E21