@settlemint/sdk-cli 2.1.4-pr75b87279 → 2.1.4-pr77f5143c

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 +1394 -770
  2. package/dist/cli.js.map +73 -66
  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,
@@ -3705,23 +3709,51 @@ var require_decrypt = __commonJS((exports, module) => {
3705
3709
  module.exports = decrypt;
3706
3710
  });
3707
3711
 
3708
- // ../../node_modules/@noble/ciphers/_assert.js
3709
- var require__assert = __commonJS((exports) => {
3712
+ // ../../node_modules/@noble/ciphers/utils.js
3713
+ var require_utils3 = __commonJS((exports) => {
3714
+ /*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
3710
3715
  Object.defineProperty(exports, "__esModule", { value: true });
3716
+ exports.wrapCipher = exports.Hash = exports.nextTick = exports.isLE = undefined;
3717
+ exports.isBytes = isBytes;
3711
3718
  exports.abool = abool;
3719
+ exports.anumber = anumber;
3712
3720
  exports.abytes = abytes;
3713
- exports.aexists = aexists;
3714
3721
  exports.ahash = ahash;
3715
- exports.anumber = anumber;
3722
+ exports.aexists = aexists;
3716
3723
  exports.aoutput = aoutput;
3717
- exports.isBytes = isBytes;
3724
+ exports.u8 = u8;
3725
+ exports.u32 = u32;
3726
+ exports.clean = clean;
3727
+ exports.createView = createView;
3728
+ exports.bytesToHex = bytesToHex;
3729
+ exports.hexToBytes = hexToBytes;
3730
+ exports.hexToNumber = hexToNumber;
3731
+ exports.bytesToNumberBE = bytesToNumberBE;
3732
+ exports.numberToBytesBE = numberToBytesBE;
3733
+ exports.utf8ToBytes = utf8ToBytes;
3734
+ exports.bytesToUtf8 = bytesToUtf8;
3735
+ exports.toBytes = toBytes;
3736
+ exports.overlapBytes = overlapBytes;
3737
+ exports.complexOverlapBytes = complexOverlapBytes;
3738
+ exports.concatBytes = concatBytes;
3739
+ exports.checkOpts = checkOpts;
3740
+ exports.equalBytes = equalBytes;
3741
+ exports.getOutput = getOutput;
3742
+ exports.setBigUint64 = setBigUint64;
3743
+ exports.u64Lengths = u64Lengths;
3744
+ exports.isAligned32 = isAligned32;
3745
+ exports.copyBytes = copyBytes;
3746
+ function isBytes(a) {
3747
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
3748
+ }
3749
+ function abool(b) {
3750
+ if (typeof b !== "boolean")
3751
+ throw new Error(`boolean expected, not ${b}`);
3752
+ }
3718
3753
  function anumber(n) {
3719
3754
  if (!Number.isSafeInteger(n) || n < 0)
3720
3755
  throw new Error("positive integer expected, got " + n);
3721
3756
  }
3722
- function isBytes(a) {
3723
- return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
3724
- }
3725
3757
  function abytes(b, ...lengths) {
3726
3758
  if (!isBytes(b))
3727
3759
  throw new Error("Uint8Array expected");
@@ -3730,7 +3762,7 @@ var require__assert = __commonJS((exports) => {
3730
3762
  }
3731
3763
  function ahash(h) {
3732
3764
  if (typeof h !== "function" || typeof h.create !== "function")
3733
- throw new Error("Hash should be wrapped by utils.wrapConstructor");
3765
+ throw new Error("Hash should be wrapped by utils.createHasher");
3734
3766
  anumber(h.outputLen);
3735
3767
  anumber(h.blockLen);
3736
3768
  }
@@ -3747,49 +3779,27 @@ var require__assert = __commonJS((exports) => {
3747
3779
  throw new Error("digestInto() expects output buffer of length at least " + min);
3748
3780
  }
3749
3781
  }
3750
- function abool(b) {
3751
- if (typeof b !== "boolean")
3752
- throw new Error(`boolean expected, not ${b}`);
3782
+ function u8(arr) {
3783
+ return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
3753
3784
  }
3754
- });
3755
-
3756
- // ../../node_modules/@noble/ciphers/utils.js
3757
- var require_utils3 = __commonJS((exports) => {
3758
- Object.defineProperty(exports, "__esModule", { value: true });
3759
- exports.wrapCipher = exports.Hash = exports.nextTick = exports.isLE = exports.createView = exports.u32 = exports.u8 = undefined;
3760
- exports.bytesToHex = bytesToHex;
3761
- exports.hexToBytes = hexToBytes;
3762
- exports.hexToNumber = hexToNumber;
3763
- exports.bytesToNumberBE = bytesToNumberBE;
3764
- exports.numberToBytesBE = numberToBytesBE;
3765
- exports.utf8ToBytes = utf8ToBytes;
3766
- exports.bytesToUtf8 = bytesToUtf8;
3767
- exports.toBytes = toBytes;
3768
- exports.overlapBytes = overlapBytes;
3769
- exports.complexOverlapBytes = complexOverlapBytes;
3770
- exports.concatBytes = concatBytes;
3771
- exports.checkOpts = checkOpts;
3772
- exports.equalBytes = equalBytes;
3773
- exports.getOutput = getOutput;
3774
- exports.setBigUint64 = setBigUint64;
3775
- exports.u64Lengths = u64Lengths;
3776
- exports.isAligned32 = isAligned32;
3777
- exports.copyBytes = copyBytes;
3778
- exports.clean = clean;
3779
- /*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
3780
- var _assert_js_1 = require__assert();
3781
- var u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
3782
- exports.u8 = u8;
3783
- var u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
3784
- exports.u32 = u32;
3785
- var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
3786
- exports.createView = createView;
3787
- exports.isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
3788
- if (!exports.isLE)
3789
- throw new Error("Non little-endian hardware is not supported");
3785
+ function u32(arr) {
3786
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
3787
+ }
3788
+ function clean(...arrays) {
3789
+ for (let i = 0;i < arrays.length; i++) {
3790
+ arrays[i].fill(0);
3791
+ }
3792
+ }
3793
+ function createView(arr) {
3794
+ return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
3795
+ }
3796
+ exports.isLE = (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
3797
+ var hasHexBuiltin = /* @__PURE__ */ (() => typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function")();
3790
3798
  var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
3791
3799
  function bytesToHex(bytes) {
3792
- (0, _assert_js_1.abytes)(bytes);
3800
+ abytes(bytes);
3801
+ if (hasHexBuiltin)
3802
+ return bytes.toHex();
3793
3803
  let hex = "";
3794
3804
  for (let i = 0;i < bytes.length; i++) {
3795
3805
  hex += hexes[bytes[i]];
@@ -3809,6 +3819,8 @@ var require_utils3 = __commonJS((exports) => {
3809
3819
  function hexToBytes(hex) {
3810
3820
  if (typeof hex !== "string")
3811
3821
  throw new Error("hex string expected, got " + typeof hex);
3822
+ if (hasHexBuiltin)
3823
+ return Uint8Array.fromHex(hex);
3812
3824
  const hl = hex.length;
3813
3825
  const al = hl / 2;
3814
3826
  if (hl % 2)
@@ -3849,7 +3861,7 @@ var require_utils3 = __commonJS((exports) => {
3849
3861
  function toBytes(data) {
3850
3862
  if (typeof data === "string")
3851
3863
  data = utf8ToBytes(data);
3852
- else if ((0, _assert_js_1.isBytes)(data))
3864
+ else if (isBytes(data))
3853
3865
  data = copyBytes(data);
3854
3866
  else
3855
3867
  throw new Error("Uint8Array expected, got " + typeof data);
@@ -3866,7 +3878,7 @@ var require_utils3 = __commonJS((exports) => {
3866
3878
  let sum = 0;
3867
3879
  for (let i = 0;i < arrays.length; i++) {
3868
3880
  const a = arrays[i];
3869
- (0, _assert_js_1.abytes)(a);
3881
+ abytes(a);
3870
3882
  sum += a.length;
3871
3883
  }
3872
3884
  const res = new Uint8Array(sum);
@@ -3897,26 +3909,28 @@ var require_utils3 = __commonJS((exports) => {
3897
3909
  exports.Hash = Hash;
3898
3910
  var wrapCipher = (params, constructor) => {
3899
3911
  function wrappedCipher(key, ...args) {
3900
- (0, _assert_js_1.abytes)(key);
3912
+ abytes(key);
3913
+ if (!exports.isLE)
3914
+ throw new Error("Non little-endian hardware is not yet supported");
3901
3915
  if (params.nonceLength !== undefined) {
3902
3916
  const nonce = args[0];
3903
3917
  if (!nonce)
3904
3918
  throw new Error("nonce / iv required");
3905
3919
  if (params.varSizeNonce)
3906
- (0, _assert_js_1.abytes)(nonce);
3920
+ abytes(nonce);
3907
3921
  else
3908
- (0, _assert_js_1.abytes)(nonce, params.nonceLength);
3922
+ abytes(nonce, params.nonceLength);
3909
3923
  }
3910
3924
  const tagl = params.tagLength;
3911
3925
  if (tagl && args[1] !== undefined) {
3912
- (0, _assert_js_1.abytes)(args[1]);
3926
+ abytes(args[1]);
3913
3927
  }
3914
3928
  const cipher = constructor(key, ...args);
3915
3929
  const checkOutput = (fnLength, output) => {
3916
3930
  if (output !== undefined) {
3917
3931
  if (fnLength !== 2)
3918
3932
  throw new Error("cipher output not supported");
3919
- (0, _assert_js_1.abytes)(output);
3933
+ abytes(output);
3920
3934
  }
3921
3935
  };
3922
3936
  let called = false;
@@ -3925,12 +3939,12 @@ var require_utils3 = __commonJS((exports) => {
3925
3939
  if (called)
3926
3940
  throw new Error("cannot encrypt() twice with same key + nonce");
3927
3941
  called = true;
3928
- (0, _assert_js_1.abytes)(data);
3942
+ abytes(data);
3929
3943
  checkOutput(cipher.encrypt.length, output);
3930
3944
  return cipher.encrypt(data, output);
3931
3945
  },
3932
3946
  decrypt(data, output) {
3933
- (0, _assert_js_1.abytes)(data);
3947
+ abytes(data);
3934
3948
  if (tagl && data.length < tagl)
3935
3949
  throw new Error("invalid ciphertext length: smaller than tagLength=" + tagl);
3936
3950
  checkOutput(cipher.decrypt.length, output);
@@ -3964,11 +3978,12 @@ var require_utils3 = __commonJS((exports) => {
3964
3978
  view.setUint32(byteOffset + h, wh, isLE);
3965
3979
  view.setUint32(byteOffset + l, wl, isLE);
3966
3980
  }
3967
- function u64Lengths(ciphertext, AAD) {
3981
+ function u64Lengths(dataLength, aadLength, isLE) {
3982
+ abool(isLE);
3968
3983
  const num = new Uint8Array(16);
3969
- const view = (0, exports.createView)(num);
3970
- setBigUint64(view, 0, BigInt(AAD ? AAD.length : 0), true);
3971
- setBigUint64(view, 8, BigInt(ciphertext.length), true);
3984
+ const view = createView(num);
3985
+ setBigUint64(view, 0, BigInt(aadLength), isLE);
3986
+ setBigUint64(view, 8, BigInt(dataLength), isLE);
3972
3987
  return num;
3973
3988
  }
3974
3989
  function isAligned32(bytes) {
@@ -3977,11 +3992,6 @@ var require_utils3 = __commonJS((exports) => {
3977
3992
  function copyBytes(bytes) {
3978
3993
  return Uint8Array.from(bytes);
3979
3994
  }
3980
- function clean(...arrays) {
3981
- for (let i = 0;i < arrays.length; i++) {
3982
- arrays[i].fill(0);
3983
- }
3984
- }
3985
3995
  });
3986
3996
 
3987
3997
  // ../../node_modules/eciesjs/dist/consts.js
@@ -4064,14 +4074,13 @@ var require_webcrypto = __commonJS((exports) => {
4064
4074
  exports.getWebcryptoSubtle = getWebcryptoSubtle;
4065
4075
  exports.managedNonce = managedNonce;
4066
4076
  var crypto_1 = require_cryptoNode();
4067
- var _assert_js_1 = require__assert();
4068
- var utils_js_1 = require_utils3();
4077
+ var utils_ts_1 = require_utils3();
4069
4078
  function randomBytes(bytesLength = 32) {
4070
4079
  if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === "function") {
4071
4080
  return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
4072
4081
  }
4073
4082
  if (crypto_1.crypto && typeof crypto_1.crypto.randomBytes === "function") {
4074
- return crypto_1.crypto.randomBytes(bytesLength);
4083
+ return Uint8Array.from(crypto_1.crypto.randomBytes(bytesLength));
4075
4084
  }
4076
4085
  throw new Error("crypto.getRandomValues must be defined");
4077
4086
  }
@@ -4082,12 +4091,12 @@ var require_webcrypto = __commonJS((exports) => {
4082
4091
  }
4083
4092
  function managedNonce(fn) {
4084
4093
  const { nonceLength } = fn;
4085
- (0, _assert_js_1.anumber)(nonceLength);
4094
+ (0, utils_ts_1.anumber)(nonceLength);
4086
4095
  return (key, ...args) => ({
4087
4096
  encrypt(plaintext, ...argsEnc) {
4088
4097
  const nonce = randomBytes(nonceLength);
4089
4098
  const ciphertext = fn(key, nonce, ...args).encrypt(plaintext, ...argsEnc);
4090
- const out = (0, utils_js_1.concatBytes)(nonce, ciphertext);
4099
+ const out = (0, utils_ts_1.concatBytes)(nonce, ciphertext);
4091
4100
  ciphertext.fill(0);
4092
4101
  return out;
4093
4102
  },
@@ -4132,21 +4141,21 @@ var require_webcrypto = __commonJS((exports) => {
4132
4141
  }
4133
4142
  function generate(algo) {
4134
4143
  return (key, nonce, AAD) => {
4135
- (0, _assert_js_1.abytes)(key);
4136
- (0, _assert_js_1.abytes)(nonce);
4144
+ (0, utils_ts_1.abytes)(key);
4145
+ (0, utils_ts_1.abytes)(nonce);
4137
4146
  const keyParams = { name: algo, length: key.length * 8 };
4138
4147
  const cryptParams = getCryptParams(algo, nonce, AAD);
4139
4148
  let consumed = false;
4140
4149
  return {
4141
4150
  encrypt(plaintext) {
4142
- (0, _assert_js_1.abytes)(plaintext);
4151
+ (0, utils_ts_1.abytes)(plaintext);
4143
4152
  if (consumed)
4144
4153
  throw new Error("Cannot encrypt() twice with same key / nonce");
4145
4154
  consumed = true;
4146
4155
  return exports.utils.encrypt(key, keyParams, cryptParams, plaintext);
4147
4156
  },
4148
4157
  decrypt(ciphertext) {
4149
- (0, _assert_js_1.abytes)(ciphertext);
4158
+ (0, utils_ts_1.abytes)(ciphertext);
4150
4159
  return exports.utils.decrypt(key, keyParams, cryptParams, ciphertext);
4151
4160
  }
4152
4161
  };
@@ -4158,7 +4167,7 @@ var require_webcrypto = __commonJS((exports) => {
4158
4167
  });
4159
4168
 
4160
4169
  // ../../node_modules/@noble/hashes/_assert.js
4161
- var require__assert2 = __commonJS((exports) => {
4170
+ var require__assert = __commonJS((exports) => {
4162
4171
  Object.defineProperty(exports, "__esModule", { value: true });
4163
4172
  exports.anumber = anumber;
4164
4173
  exports.abytes = abytes;
@@ -4232,7 +4241,7 @@ var require_utils4 = __commonJS((exports) => {
4232
4241
  exports.wrapXOFConstructorWithOpts = wrapXOFConstructorWithOpts;
4233
4242
  exports.randomBytes = randomBytes;
4234
4243
  var crypto_1 = require_cryptoNode2();
4235
- var _assert_js_1 = require__assert2();
4244
+ var _assert_ts_1 = require__assert();
4236
4245
  function isBytes(a) {
4237
4246
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
4238
4247
  }
@@ -4261,9 +4270,12 @@ var require_utils4 = __commonJS((exports) => {
4261
4270
  arr[i] = byteSwap(arr[i]);
4262
4271
  }
4263
4272
  }
4273
+ var hasHexBuiltin = typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function";
4264
4274
  var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
4265
4275
  function bytesToHex(bytes) {
4266
- (0, _assert_js_1.abytes)(bytes);
4276
+ (0, _assert_ts_1.abytes)(bytes);
4277
+ if (hasHexBuiltin)
4278
+ return bytes.toHex();
4267
4279
  let hex = "";
4268
4280
  for (let i = 0;i < bytes.length; i++) {
4269
4281
  hex += hexes[bytes[i]];
@@ -4283,6 +4295,8 @@ var require_utils4 = __commonJS((exports) => {
4283
4295
  function hexToBytes(hex) {
4284
4296
  if (typeof hex !== "string")
4285
4297
  throw new Error("hex string expected, got " + typeof hex);
4298
+ if (hasHexBuiltin)
4299
+ return Uint8Array.fromHex(hex);
4286
4300
  const hl = hex.length;
4287
4301
  const al = hl / 2;
4288
4302
  if (hl % 2)
@@ -4320,14 +4334,14 @@ var require_utils4 = __commonJS((exports) => {
4320
4334
  function toBytes(data) {
4321
4335
  if (typeof data === "string")
4322
4336
  data = utf8ToBytes(data);
4323
- (0, _assert_js_1.abytes)(data);
4337
+ (0, _assert_ts_1.abytes)(data);
4324
4338
  return data;
4325
4339
  }
4326
4340
  function concatBytes(...arrays) {
4327
4341
  let sum = 0;
4328
4342
  for (let i = 0;i < arrays.length; i++) {
4329
4343
  const a = arrays[i];
4330
- (0, _assert_js_1.abytes)(a);
4344
+ (0, _assert_ts_1.abytes)(a);
4331
4345
  sum += a.length;
4332
4346
  }
4333
4347
  const res = new Uint8Array(sum);
@@ -4380,7 +4394,7 @@ var require_utils4 = __commonJS((exports) => {
4380
4394
  return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
4381
4395
  }
4382
4396
  if (crypto_1.crypto && typeof crypto_1.crypto.randomBytes === "function") {
4383
- return crypto_1.crypto.randomBytes(bytesLength);
4397
+ return Uint8Array.from(crypto_1.crypto.randomBytes(bytesLength));
4384
4398
  }
4385
4399
  throw new Error("crypto.getRandomValues must be defined");
4386
4400
  }
@@ -4393,8 +4407,8 @@ var require__md = __commonJS((exports) => {
4393
4407
  exports.setBigUint64 = setBigUint64;
4394
4408
  exports.Chi = Chi;
4395
4409
  exports.Maj = Maj;
4396
- var _assert_js_1 = require__assert2();
4397
- var utils_js_1 = require_utils4();
4410
+ var _assert_ts_1 = require__assert();
4411
+ var utils_ts_1 = require_utils4();
4398
4412
  function setBigUint64(view, byteOffset, value, isLE) {
4399
4413
  if (typeof view.setBigUint64 === "function")
4400
4414
  return view.setBigUint64(byteOffset, value, isLE);
@@ -4414,29 +4428,29 @@ var require__md = __commonJS((exports) => {
4414
4428
  return a & b ^ a & c ^ b & c;
4415
4429
  }
4416
4430
 
4417
- class HashMD extends utils_js_1.Hash {
4431
+ class HashMD extends utils_ts_1.Hash {
4418
4432
  constructor(blockLen, outputLen, padOffset, isLE) {
4419
4433
  super();
4420
- this.blockLen = blockLen;
4421
- this.outputLen = outputLen;
4422
- this.padOffset = padOffset;
4423
- this.isLE = isLE;
4424
4434
  this.finished = false;
4425
4435
  this.length = 0;
4426
4436
  this.pos = 0;
4427
4437
  this.destroyed = false;
4438
+ this.blockLen = blockLen;
4439
+ this.outputLen = outputLen;
4440
+ this.padOffset = padOffset;
4441
+ this.isLE = isLE;
4428
4442
  this.buffer = new Uint8Array(blockLen);
4429
- this.view = (0, utils_js_1.createView)(this.buffer);
4443
+ this.view = (0, utils_ts_1.createView)(this.buffer);
4430
4444
  }
4431
4445
  update(data) {
4432
- (0, _assert_js_1.aexists)(this);
4446
+ (0, _assert_ts_1.aexists)(this);
4433
4447
  const { view, buffer, blockLen } = this;
4434
- data = (0, utils_js_1.toBytes)(data);
4448
+ data = (0, utils_ts_1.toBytes)(data);
4435
4449
  const len = data.length;
4436
4450
  for (let pos = 0;pos < len; ) {
4437
4451
  const take = Math.min(blockLen - this.pos, len - pos);
4438
4452
  if (take === blockLen) {
4439
- const dataView = (0, utils_js_1.createView)(data);
4453
+ const dataView = (0, utils_ts_1.createView)(data);
4440
4454
  for (;blockLen <= len - pos; pos += blockLen)
4441
4455
  this.process(dataView, pos);
4442
4456
  continue;
@@ -4454,8 +4468,8 @@ var require__md = __commonJS((exports) => {
4454
4468
  return this;
4455
4469
  }
4456
4470
  digestInto(out) {
4457
- (0, _assert_js_1.aexists)(this);
4458
- (0, _assert_js_1.aoutput)(out, this);
4471
+ (0, _assert_ts_1.aexists)(this);
4472
+ (0, _assert_ts_1.aoutput)(out, this);
4459
4473
  this.finished = true;
4460
4474
  const { buffer, view, blockLen, isLE } = this;
4461
4475
  let { pos } = this;
@@ -4469,7 +4483,7 @@ var require__md = __commonJS((exports) => {
4469
4483
  buffer[i] = 0;
4470
4484
  setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
4471
4485
  this.process(view, 0);
4472
- const oview = (0, utils_js_1.createView)(out);
4486
+ const oview = (0, utils_ts_1.createView)(out);
4473
4487
  const len = this.outputLen;
4474
4488
  if (len % 4)
4475
4489
  throw new Error("_sha2: outputLen should be aligned to 32bit");
@@ -4503,6 +4517,178 @@ var require__md = __commonJS((exports) => {
4503
4517
  exports.HashMD = HashMD;
4504
4518
  });
4505
4519
 
4520
+ // ../../node_modules/@noble/hashes/sha256.js
4521
+ var require_sha256 = __commonJS((exports) => {
4522
+ Object.defineProperty(exports, "__esModule", { value: true });
4523
+ exports.sha224 = exports.sha256 = exports.SHA256 = undefined;
4524
+ var _md_ts_1 = require__md();
4525
+ var utils_ts_1 = require_utils4();
4526
+ var SHA256_K = /* @__PURE__ */ new Uint32Array([
4527
+ 1116352408,
4528
+ 1899447441,
4529
+ 3049323471,
4530
+ 3921009573,
4531
+ 961987163,
4532
+ 1508970993,
4533
+ 2453635748,
4534
+ 2870763221,
4535
+ 3624381080,
4536
+ 310598401,
4537
+ 607225278,
4538
+ 1426881987,
4539
+ 1925078388,
4540
+ 2162078206,
4541
+ 2614888103,
4542
+ 3248222580,
4543
+ 3835390401,
4544
+ 4022224774,
4545
+ 264347078,
4546
+ 604807628,
4547
+ 770255983,
4548
+ 1249150122,
4549
+ 1555081692,
4550
+ 1996064986,
4551
+ 2554220882,
4552
+ 2821834349,
4553
+ 2952996808,
4554
+ 3210313671,
4555
+ 3336571891,
4556
+ 3584528711,
4557
+ 113926993,
4558
+ 338241895,
4559
+ 666307205,
4560
+ 773529912,
4561
+ 1294757372,
4562
+ 1396182291,
4563
+ 1695183700,
4564
+ 1986661051,
4565
+ 2177026350,
4566
+ 2456956037,
4567
+ 2730485921,
4568
+ 2820302411,
4569
+ 3259730800,
4570
+ 3345764771,
4571
+ 3516065817,
4572
+ 3600352804,
4573
+ 4094571909,
4574
+ 275423344,
4575
+ 430227734,
4576
+ 506948616,
4577
+ 659060556,
4578
+ 883997877,
4579
+ 958139571,
4580
+ 1322822218,
4581
+ 1537002063,
4582
+ 1747873779,
4583
+ 1955562222,
4584
+ 2024104815,
4585
+ 2227730452,
4586
+ 2361852424,
4587
+ 2428436474,
4588
+ 2756734187,
4589
+ 3204031479,
4590
+ 3329325298
4591
+ ]);
4592
+ var SHA256_IV = /* @__PURE__ */ new Uint32Array([
4593
+ 1779033703,
4594
+ 3144134277,
4595
+ 1013904242,
4596
+ 2773480762,
4597
+ 1359893119,
4598
+ 2600822924,
4599
+ 528734635,
4600
+ 1541459225
4601
+ ]);
4602
+ var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
4603
+
4604
+ class SHA256 extends _md_ts_1.HashMD {
4605
+ constructor(outputLen = 32) {
4606
+ super(64, outputLen, 8, false);
4607
+ this.A = SHA256_IV[0] | 0;
4608
+ this.B = SHA256_IV[1] | 0;
4609
+ this.C = SHA256_IV[2] | 0;
4610
+ this.D = SHA256_IV[3] | 0;
4611
+ this.E = SHA256_IV[4] | 0;
4612
+ this.F = SHA256_IV[5] | 0;
4613
+ this.G = SHA256_IV[6] | 0;
4614
+ this.H = SHA256_IV[7] | 0;
4615
+ }
4616
+ get() {
4617
+ const { A, B, C, D, E, F, G, H } = this;
4618
+ return [A, B, C, D, E, F, G, H];
4619
+ }
4620
+ set(A, B, C, D, E, F, G, H) {
4621
+ this.A = A | 0;
4622
+ this.B = B | 0;
4623
+ this.C = C | 0;
4624
+ this.D = D | 0;
4625
+ this.E = E | 0;
4626
+ this.F = F | 0;
4627
+ this.G = G | 0;
4628
+ this.H = H | 0;
4629
+ }
4630
+ process(view, offset) {
4631
+ for (let i = 0;i < 16; i++, offset += 4)
4632
+ SHA256_W[i] = view.getUint32(offset, false);
4633
+ for (let i = 16;i < 64; i++) {
4634
+ const W15 = SHA256_W[i - 15];
4635
+ const W2 = SHA256_W[i - 2];
4636
+ const s0 = (0, utils_ts_1.rotr)(W15, 7) ^ (0, utils_ts_1.rotr)(W15, 18) ^ W15 >>> 3;
4637
+ const s1 = (0, utils_ts_1.rotr)(W2, 17) ^ (0, utils_ts_1.rotr)(W2, 19) ^ W2 >>> 10;
4638
+ SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
4639
+ }
4640
+ let { A, B, C, D, E, F, G, H } = this;
4641
+ for (let i = 0;i < 64; i++) {
4642
+ const sigma1 = (0, utils_ts_1.rotr)(E, 6) ^ (0, utils_ts_1.rotr)(E, 11) ^ (0, utils_ts_1.rotr)(E, 25);
4643
+ const T1 = H + sigma1 + (0, _md_ts_1.Chi)(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
4644
+ const sigma0 = (0, utils_ts_1.rotr)(A, 2) ^ (0, utils_ts_1.rotr)(A, 13) ^ (0, utils_ts_1.rotr)(A, 22);
4645
+ const T2 = sigma0 + (0, _md_ts_1.Maj)(A, B, C) | 0;
4646
+ H = G;
4647
+ G = F;
4648
+ F = E;
4649
+ E = D + T1 | 0;
4650
+ D = C;
4651
+ C = B;
4652
+ B = A;
4653
+ A = T1 + T2 | 0;
4654
+ }
4655
+ A = A + this.A | 0;
4656
+ B = B + this.B | 0;
4657
+ C = C + this.C | 0;
4658
+ D = D + this.D | 0;
4659
+ E = E + this.E | 0;
4660
+ F = F + this.F | 0;
4661
+ G = G + this.G | 0;
4662
+ H = H + this.H | 0;
4663
+ this.set(A, B, C, D, E, F, G, H);
4664
+ }
4665
+ roundClean() {
4666
+ SHA256_W.fill(0);
4667
+ }
4668
+ destroy() {
4669
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
4670
+ this.buffer.fill(0);
4671
+ }
4672
+ }
4673
+ exports.SHA256 = SHA256;
4674
+
4675
+ class SHA224 extends SHA256 {
4676
+ constructor() {
4677
+ super(28);
4678
+ this.A = 3238371032 | 0;
4679
+ this.B = 914150663 | 0;
4680
+ this.C = 812702999 | 0;
4681
+ this.D = 4144912697 | 0;
4682
+ this.E = 4290775857 | 0;
4683
+ this.F = 1750603025 | 0;
4684
+ this.G = 1694076839 | 0;
4685
+ this.H = 3204075428 | 0;
4686
+ }
4687
+ }
4688
+ exports.sha256 = (0, utils_ts_1.wrapConstructor)(() => new SHA256);
4689
+ exports.sha224 = (0, utils_ts_1.wrapConstructor)(() => new SHA224);
4690
+ });
4691
+
4506
4692
  // ../../node_modules/@noble/hashes/_u64.js
4507
4693
  var require__u64 = __commonJS((exports) => {
4508
4694
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -4599,10 +4785,10 @@ var require__u64 = __commonJS((exports) => {
4599
4785
  var require_sha512 = __commonJS((exports) => {
4600
4786
  Object.defineProperty(exports, "__esModule", { value: true });
4601
4787
  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([
4788
+ var _md_ts_1 = require__md();
4789
+ var _u64_ts_1 = require__u64();
4790
+ var utils_ts_1 = require_utils4();
4791
+ var [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => _u64_ts_1.default.split([
4606
4792
  "0x428a2f98d728ae22",
4607
4793
  "0x7137449123ef65cd",
4608
4794
  "0xb5c0fbcfec4d3b2f",
@@ -4687,9 +4873,9 @@ var require_sha512 = __commonJS((exports) => {
4687
4873
  var SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
4688
4874
  var SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
4689
4875
 
4690
- class SHA512 extends _md_js_1.HashMD {
4691
- constructor() {
4692
- super(128, 64, 16, false);
4876
+ class SHA512 extends _md_ts_1.HashMD {
4877
+ constructor(outputLen = 64) {
4878
+ super(128, outputLen, 16, false);
4693
4879
  this.Ah = 1779033703 | 0;
4694
4880
  this.Al = 4089235720 | 0;
4695
4881
  this.Bh = 3144134277 | 0;
@@ -4737,28 +4923,28 @@ var require_sha512 = __commonJS((exports) => {
4737
4923
  for (let i = 16;i < 80; i++) {
4738
4924
  const W15h = SHA512_W_H[i - 15] | 0;
4739
4925
  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);
4926
+ 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);
4927
+ 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
4928
  const W2h = SHA512_W_H[i - 2] | 0;
4743
4929
  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]);
4930
+ 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);
4931
+ 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);
4932
+ const SUMl = _u64_ts_1.default.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
4933
+ const SUMh = _u64_ts_1.default.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
4748
4934
  SHA512_W_H[i] = SUMh | 0;
4749
4935
  SHA512_W_L[i] = SUMl | 0;
4750
4936
  }
4751
4937
  let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
4752
4938
  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);
4939
+ 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);
4940
+ 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
4941
  const CHIh = Eh & Fh ^ ~Eh & Gh;
4756
4942
  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]);
4943
+ const T1ll = _u64_ts_1.default.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
4944
+ const T1h = _u64_ts_1.default.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
4759
4945
  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);
4946
+ 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);
4947
+ 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
4948
  const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch;
4763
4949
  const MAJl = Al & Bl ^ Al & Cl ^ Bl & Cl;
4764
4950
  Hh = Gh | 0;
@@ -4767,25 +4953,25 @@ var require_sha512 = __commonJS((exports) => {
4767
4953
  Gl = Fl | 0;
4768
4954
  Fh = Eh | 0;
4769
4955
  Fl = El | 0;
4770
- ({ h: Eh, l: El } = _u64_js_1.default.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
4956
+ ({ h: Eh, l: El } = _u64_ts_1.default.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
4771
4957
  Dh = Ch | 0;
4772
4958
  Dl = Cl | 0;
4773
4959
  Ch = Bh | 0;
4774
4960
  Cl = Bl | 0;
4775
4961
  Bh = Ah | 0;
4776
4962
  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);
4963
+ const All = _u64_ts_1.default.add3L(T1l, sigma0l, MAJl);
4964
+ Ah = _u64_ts_1.default.add3H(All, T1h, sigma0h, MAJh);
4779
4965
  Al = All | 0;
4780
4966
  }
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));
4967
+ ({ h: Ah, l: Al } = _u64_ts_1.default.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
4968
+ ({ h: Bh, l: Bl } = _u64_ts_1.default.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
4969
+ ({ h: Ch, l: Cl } = _u64_ts_1.default.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
4970
+ ({ h: Dh, l: Dl } = _u64_ts_1.default.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
4971
+ ({ h: Eh, l: El } = _u64_ts_1.default.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
4972
+ ({ h: Fh, l: Fl } = _u64_ts_1.default.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
4973
+ ({ h: Gh, l: Gl } = _u64_ts_1.default.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
4974
+ ({ h: Hh, l: Hl } = _u64_ts_1.default.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
4789
4975
  this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
4790
4976
  }
4791
4977
  roundClean() {
@@ -4801,7 +4987,7 @@ var require_sha512 = __commonJS((exports) => {
4801
4987
 
4802
4988
  class SHA512_224 extends SHA512 {
4803
4989
  constructor() {
4804
- super();
4990
+ super(28);
4805
4991
  this.Ah = 2352822216 | 0;
4806
4992
  this.Al = 424955298 | 0;
4807
4993
  this.Bh = 1944164710 | 0;
@@ -4818,14 +5004,13 @@ var require_sha512 = __commonJS((exports) => {
4818
5004
  this.Gl = 1780299464 | 0;
4819
5005
  this.Hh = 286451373 | 0;
4820
5006
  this.Hl = 2446758561 | 0;
4821
- this.outputLen = 28;
4822
5007
  }
4823
5008
  }
4824
5009
  exports.SHA512_224 = SHA512_224;
4825
5010
 
4826
5011
  class SHA512_256 extends SHA512 {
4827
5012
  constructor() {
4828
- super();
5013
+ super(32);
4829
5014
  this.Ah = 573645204 | 0;
4830
5015
  this.Al = 4230739756 | 0;
4831
5016
  this.Bh = 2673172387 | 0;
@@ -4842,14 +5027,13 @@ var require_sha512 = __commonJS((exports) => {
4842
5027
  this.Gl = 746961066 | 0;
4843
5028
  this.Hh = 246885852 | 0;
4844
5029
  this.Hl = 2177182882 | 0;
4845
- this.outputLen = 32;
4846
5030
  }
4847
5031
  }
4848
5032
  exports.SHA512_256 = SHA512_256;
4849
5033
 
4850
5034
  class SHA384 extends SHA512 {
4851
5035
  constructor() {
4852
- super();
5036
+ super(48);
4853
5037
  this.Ah = 3418070365 | 0;
4854
5038
  this.Al = 3238371032 | 0;
4855
5039
  this.Bh = 1654270250 | 0;
@@ -4866,14 +5050,39 @@ var require_sha512 = __commonJS((exports) => {
4866
5050
  this.Gl = 1694076839 | 0;
4867
5051
  this.Hh = 1203062813 | 0;
4868
5052
  this.Hl = 3204075428 | 0;
4869
- this.outputLen = 48;
4870
5053
  }
4871
5054
  }
4872
5055
  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);
5056
+ exports.sha512 = (0, utils_ts_1.wrapConstructor)(() => new SHA512);
5057
+ exports.sha512_224 = (0, utils_ts_1.wrapConstructor)(() => new SHA512_224);
5058
+ exports.sha512_256 = (0, utils_ts_1.wrapConstructor)(() => new SHA512_256);
5059
+ exports.sha384 = (0, utils_ts_1.wrapConstructor)(() => new SHA384);
5060
+ });
5061
+
5062
+ // ../../node_modules/@noble/hashes/sha2.js
5063
+ var require_sha2 = __commonJS((exports) => {
5064
+ Object.defineProperty(exports, "__esModule", { value: true });
5065
+ exports.sha512_256 = exports.sha512_224 = exports.sha512 = exports.sha384 = exports.sha256 = exports.sha224 = undefined;
5066
+ var sha256_ts_1 = require_sha256();
5067
+ Object.defineProperty(exports, "sha224", { enumerable: true, get: function() {
5068
+ return sha256_ts_1.sha224;
5069
+ } });
5070
+ Object.defineProperty(exports, "sha256", { enumerable: true, get: function() {
5071
+ return sha256_ts_1.sha256;
5072
+ } });
5073
+ var sha512_ts_1 = require_sha512();
5074
+ Object.defineProperty(exports, "sha384", { enumerable: true, get: function() {
5075
+ return sha512_ts_1.sha384;
5076
+ } });
5077
+ Object.defineProperty(exports, "sha512", { enumerable: true, get: function() {
5078
+ return sha512_ts_1.sha512;
5079
+ } });
5080
+ Object.defineProperty(exports, "sha512_224", { enumerable: true, get: function() {
5081
+ return sha512_ts_1.sha512_224;
5082
+ } });
5083
+ Object.defineProperty(exports, "sha512_256", { enumerable: true, get: function() {
5084
+ return sha512_ts_1.sha512_256;
5085
+ } });
4877
5086
  });
4878
5087
 
4879
5088
  // ../../node_modules/@noble/curves/abstract/utils.js
@@ -4884,9 +5093,9 @@ var require_utils5 = __commonJS((exports) => {
4884
5093
  exports.isBytes = isBytes;
4885
5094
  exports.abytes = abytes;
4886
5095
  exports.abool = abool;
4887
- exports.bytesToHex = bytesToHex;
4888
5096
  exports.numberToHexUnpadded = numberToHexUnpadded;
4889
5097
  exports.hexToNumber = hexToNumber;
5098
+ exports.bytesToHex = bytesToHex;
4890
5099
  exports.hexToBytes = hexToBytes;
4891
5100
  exports.bytesToNumberBE = bytesToNumberBE;
4892
5101
  exports.bytesToNumberLE = bytesToNumberLE;
@@ -4907,7 +5116,6 @@ var require_utils5 = __commonJS((exports) => {
4907
5116
  exports.memoized = memoized;
4908
5117
  var _0n = /* @__PURE__ */ BigInt(0);
4909
5118
  var _1n = /* @__PURE__ */ BigInt(1);
4910
- var _2n = /* @__PURE__ */ BigInt(2);
4911
5119
  function isBytes(a) {
4912
5120
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
4913
5121
  }
@@ -4919,15 +5127,6 @@ var require_utils5 = __commonJS((exports) => {
4919
5127
  if (typeof value !== "boolean")
4920
5128
  throw new Error(title + " boolean expected, got " + value);
4921
5129
  }
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
5130
  function numberToHexUnpadded(num) {
4932
5131
  const hex = num.toString(16);
4933
5132
  return hex.length & 1 ? "0" + hex : hex;
@@ -4937,6 +5136,18 @@ var require_utils5 = __commonJS((exports) => {
4937
5136
  throw new Error("hex string expected, got " + typeof hex);
4938
5137
  return hex === "" ? _0n : BigInt("0x" + hex);
4939
5138
  }
5139
+ var hasHexBuiltin = typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function";
5140
+ var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
5141
+ function bytesToHex(bytes) {
5142
+ abytes(bytes);
5143
+ if (hasHexBuiltin)
5144
+ return bytes.toHex();
5145
+ let hex = "";
5146
+ for (let i = 0;i < bytes.length; i++) {
5147
+ hex += hexes[bytes[i]];
5148
+ }
5149
+ return hex;
5150
+ }
4940
5151
  var asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
4941
5152
  function asciiToBase16(ch) {
4942
5153
  if (ch >= asciis._0 && ch <= asciis._9)
@@ -4950,6 +5161,8 @@ var require_utils5 = __commonJS((exports) => {
4950
5161
  function hexToBytes(hex) {
4951
5162
  if (typeof hex !== "string")
4952
5163
  throw new Error("hex string expected, got " + typeof hex);
5164
+ if (hasHexBuiltin)
5165
+ return Uint8Array.fromHex(hex);
4953
5166
  const hl = hex.length;
4954
5167
  const al = hl / 2;
4955
5168
  if (hl % 2)
@@ -5048,9 +5261,9 @@ var require_utils5 = __commonJS((exports) => {
5048
5261
  function bitSet(n, pos, value) {
5049
5262
  return n | (value ? _1n : _0n) << BigInt(pos);
5050
5263
  }
5051
- var bitMask = (n) => (_2n << BigInt(n - 1)) - _1n;
5264
+ var bitMask = (n) => (_1n << BigInt(n)) - _1n;
5052
5265
  exports.bitMask = bitMask;
5053
- var u8n = (data) => new Uint8Array(data);
5266
+ var u8n = (len) => new Uint8Array(len);
5054
5267
  var u8fr = (arr) => Uint8Array.from(arr);
5055
5268
  function createHmacDrbg(hashLen, qByteLen, hmacFn) {
5056
5269
  if (typeof hashLen !== "number" || hashLen < 2)
@@ -5068,7 +5281,7 @@ var require_utils5 = __commonJS((exports) => {
5068
5281
  i = 0;
5069
5282
  };
5070
5283
  const h = (...b) => hmacFn(k, v, ...b);
5071
- const reseed = (seed = u8n()) => {
5284
+ const reseed = (seed = u8n(0)) => {
5072
5285
  k = h(u8fr([0]), seed);
5073
5286
  v = h();
5074
5287
  if (seed.length === 0)
@@ -5171,7 +5384,7 @@ var require_modular = __commonJS((exports) => {
5171
5384
  exports.getMinHashLength = getMinHashLength;
5172
5385
  exports.mapHashToField = mapHashToField;
5173
5386
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
5174
- var utils_js_1 = require_utils5();
5387
+ var utils_ts_1 = require_utils5();
5175
5388
  var _0n = BigInt(0);
5176
5389
  var _1n = BigInt(1);
5177
5390
  var _2n = /* @__PURE__ */ BigInt(2);
@@ -5331,7 +5544,7 @@ var require_modular = __commonJS((exports) => {
5331
5544
  map[val] = "function";
5332
5545
  return map;
5333
5546
  }, initial);
5334
- return (0, utils_js_1.validateObject)(field, opts);
5547
+ return (0, utils_ts_1.validateObject)(field, opts);
5335
5548
  }
5336
5549
  function FpPow(f, num, power) {
5337
5550
  if (power < _0n)
@@ -5398,7 +5611,7 @@ var require_modular = __commonJS((exports) => {
5398
5611
  isLE,
5399
5612
  BITS,
5400
5613
  BYTES,
5401
- MASK: (0, utils_js_1.bitMask)(BITS),
5614
+ MASK: (0, utils_ts_1.bitMask)(BITS),
5402
5615
  ZERO: _0n,
5403
5616
  ONE: _1n,
5404
5617
  create: (num) => mod(num, ORDER),
@@ -5429,11 +5642,11 @@ var require_modular = __commonJS((exports) => {
5429
5642
  }),
5430
5643
  invertBatch: (lst) => FpInvertBatch(f, lst),
5431
5644
  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),
5645
+ toBytes: (num) => isLE ? (0, utils_ts_1.numberToBytesLE)(num, BYTES) : (0, utils_ts_1.numberToBytesBE)(num, BYTES),
5433
5646
  fromBytes: (bytes) => {
5434
5647
  if (bytes.length !== BYTES)
5435
5648
  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);
5649
+ return isLE ? (0, utils_ts_1.bytesToNumberLE)(bytes) : (0, utils_ts_1.bytesToNumberBE)(bytes);
5437
5650
  }
5438
5651
  });
5439
5652
  return Object.freeze(f);
@@ -5451,12 +5664,12 @@ var require_modular = __commonJS((exports) => {
5451
5664
  return Fp.isOdd(root) ? Fp.neg(root) : root;
5452
5665
  }
5453
5666
  function hashToPrivateScalar(hash, groupOrder, isLE = false) {
5454
- hash = (0, utils_js_1.ensureBytes)("privateHash", hash);
5667
+ hash = (0, utils_ts_1.ensureBytes)("privateHash", hash);
5455
5668
  const hashLen = hash.length;
5456
5669
  const minLen = nLength(groupOrder).nByteLength + 8;
5457
5670
  if (minLen < 24 || hashLen < minLen || hashLen > 1024)
5458
5671
  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);
5672
+ const num = isLE ? (0, utils_ts_1.bytesToNumberLE)(hash) : (0, utils_ts_1.bytesToNumberBE)(hash);
5460
5673
  return mod(num, groupOrder - _1n) + _1n;
5461
5674
  }
5462
5675
  function getFieldBytesLength(fieldOrder) {
@@ -5475,9 +5688,9 @@ var require_modular = __commonJS((exports) => {
5475
5688
  const minLen = getMinHashLength(fieldOrder);
5476
5689
  if (len < 16 || len < minLen || len > 1024)
5477
5690
  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);
5691
+ const num = isLE ? (0, utils_ts_1.bytesToNumberLE)(key) : (0, utils_ts_1.bytesToNumberBE)(key);
5479
5692
  const reduced = mod(num, fieldOrder - _1n) + _1n;
5480
- return isLE ? (0, utils_js_1.numberToBytesLE)(reduced, fieldLen) : (0, utils_js_1.numberToBytesBE)(reduced, fieldLen);
5693
+ return isLE ? (0, utils_ts_1.numberToBytesLE)(reduced, fieldLen) : (0, utils_ts_1.numberToBytesBE)(reduced, fieldLen);
5481
5694
  }
5482
5695
  });
5483
5696
 
@@ -5489,8 +5702,8 @@ var require_curve = __commonJS((exports) => {
5489
5702
  exports.precomputeMSMUnsafe = precomputeMSMUnsafe;
5490
5703
  exports.validateBasic = validateBasic;
5491
5704
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
5492
- var modular_js_1 = require_modular();
5493
- var utils_js_1 = require_utils5();
5705
+ var modular_ts_1 = require_modular();
5706
+ var utils_ts_1 = require_utils5();
5494
5707
  var _0n = BigInt(0);
5495
5708
  var _1n = BigInt(1);
5496
5709
  function constTimeNegate(condition, item) {
@@ -5501,11 +5714,30 @@ var require_curve = __commonJS((exports) => {
5501
5714
  if (!Number.isSafeInteger(W) || W <= 0 || W > bits)
5502
5715
  throw new Error("invalid window size, expected [1.." + bits + "], got W=" + W);
5503
5716
  }
5504
- function calcWOpts(W, bits) {
5505
- validateW(W, bits);
5506
- const windows = Math.ceil(bits / W) + 1;
5717
+ function calcWOpts(W, scalarBits) {
5718
+ validateW(W, scalarBits);
5719
+ const windows = Math.ceil(scalarBits / W) + 1;
5507
5720
  const windowSize = 2 ** (W - 1);
5508
- return { windows, windowSize };
5721
+ const maxNumber = 2 ** W;
5722
+ const mask = (0, utils_ts_1.bitMask)(W);
5723
+ const shiftBy = BigInt(W);
5724
+ return { windows, windowSize, mask, maxNumber, shiftBy };
5725
+ }
5726
+ function calcOffsets(n, window2, wOpts) {
5727
+ const { windowSize, mask, maxNumber, shiftBy } = wOpts;
5728
+ let wbits = Number(n & mask);
5729
+ let nextN = n >> shiftBy;
5730
+ if (wbits > windowSize) {
5731
+ wbits -= maxNumber;
5732
+ nextN += _1n;
5733
+ }
5734
+ const offsetStart = window2 * windowSize;
5735
+ const offset = offsetStart + Math.abs(wbits) - 1;
5736
+ const isZero = wbits === 0;
5737
+ const isNeg = wbits < 0;
5738
+ const isNegF = window2 % 2 !== 0;
5739
+ const offsetF = offsetStart;
5740
+ return { nextN, offset, isZero, isNeg, isNegF, offsetF };
5509
5741
  }
5510
5742
  function validateMSMPoints(points, c) {
5511
5743
  if (!Array.isArray(points))
@@ -5561,53 +5793,33 @@ var require_curve = __commonJS((exports) => {
5561
5793
  return points;
5562
5794
  },
5563
5795
  wNAF(W, precomputes, n) {
5564
- const { windows, windowSize } = calcWOpts(W, bits);
5565
5796
  let p = c.ZERO;
5566
5797
  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]));
5798
+ const wo = calcWOpts(W, bits);
5799
+ for (let window2 = 0;window2 < wo.windows; window2++) {
5800
+ const { nextN, offset, isZero, isNeg, isNegF, offsetF } = calcOffsets(n, window2, wo);
5801
+ n = nextN;
5802
+ if (isZero) {
5803
+ f = f.add(constTimeNegate(isNegF, precomputes[offsetF]));
5584
5804
  } else {
5585
- p = p.add(constTimeNegate(cond2, precomputes[offset2]));
5805
+ p = p.add(constTimeNegate(isNeg, precomputes[offset]));
5586
5806
  }
5587
5807
  }
5588
5808
  return { p, f };
5589
5809
  },
5590
5810
  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;
5811
+ const wo = calcWOpts(W, bits);
5812
+ for (let window2 = 0;window2 < wo.windows; window2++) {
5597
5813
  if (n === _0n)
5598
5814
  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)
5815
+ const { nextN, offset, isZero, isNeg } = calcOffsets(n, window2, wo);
5816
+ n = nextN;
5817
+ if (isZero) {
5606
5818
  continue;
5607
- let curr = precomputes[offset + Math.abs(wbits) - 1];
5608
- if (wbits < 0)
5609
- curr = curr.negate();
5610
- acc = acc.add(curr);
5819
+ } else {
5820
+ const item = precomputes[offset];
5821
+ acc = acc.add(isNeg ? item.negate() : item);
5822
+ }
5611
5823
  }
5612
5824
  return acc;
5613
5825
  },
@@ -5643,17 +5855,17 @@ var require_curve = __commonJS((exports) => {
5643
5855
  if (points.length !== scalars.length)
5644
5856
  throw new Error("arrays of points and scalars must have equal length");
5645
5857
  const zero = c.ZERO;
5646
- const wbits = (0, utils_js_1.bitLen)(BigInt(points.length));
5858
+ const wbits = (0, utils_ts_1.bitLen)(BigInt(points.length));
5647
5859
  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);
5860
+ const MASK = (0, utils_ts_1.bitMask)(windowSize);
5861
+ const buckets = new Array(Number(MASK) + 1).fill(zero);
5650
5862
  const lastBits = Math.floor((fieldN.BITS - 1) / windowSize) * windowSize;
5651
5863
  let sum = zero;
5652
5864
  for (let i = lastBits;i >= 0; i -= windowSize) {
5653
5865
  buckets.fill(zero);
5654
5866
  for (let j = 0;j < scalars.length; j++) {
5655
5867
  const scalar = scalars[j];
5656
- const wbits2 = Number(scalar >> BigInt(i) & BigInt(MASK));
5868
+ const wbits2 = Number(scalar >> BigInt(i) & MASK);
5657
5869
  buckets[wbits2] = buckets[wbits2].add(points[j]);
5658
5870
  }
5659
5871
  let resI = zero;
@@ -5674,7 +5886,7 @@ var require_curve = __commonJS((exports) => {
5674
5886
  const zero = c.ZERO;
5675
5887
  const tableSize = 2 ** windowSize - 1;
5676
5888
  const chunks = Math.ceil(fieldN.BITS / windowSize);
5677
- const MASK = BigInt((1 << windowSize) - 1);
5889
+ const MASK = (0, utils_ts_1.bitMask)(windowSize);
5678
5890
  const tables = points.map((p) => {
5679
5891
  const res = [];
5680
5892
  for (let i = 0, acc = p;i < tableSize; i++) {
@@ -5705,8 +5917,8 @@ var require_curve = __commonJS((exports) => {
5705
5917
  };
5706
5918
  }
5707
5919
  function validateBasic(curve) {
5708
- (0, modular_js_1.validateField)(curve.Fp);
5709
- (0, utils_js_1.validateObject)(curve, {
5920
+ (0, modular_ts_1.validateField)(curve.Fp);
5921
+ (0, utils_ts_1.validateObject)(curve, {
5710
5922
  n: "bigint",
5711
5923
  h: "bigint",
5712
5924
  Gx: "field",
@@ -5716,7 +5928,7 @@ var require_curve = __commonJS((exports) => {
5716
5928
  nByteLength: "isSafeInteger"
5717
5929
  });
5718
5930
  return Object.freeze({
5719
- ...(0, modular_js_1.nLength)(curve.n, curve.nBitLength),
5931
+ ...(0, modular_ts_1.nLength)(curve.n, curve.nBitLength),
5720
5932
  ...curve,
5721
5933
  ...{ p: curve.Fp.ORDER }
5722
5934
  });
@@ -5728,18 +5940,17 @@ var require_edwards = __commonJS((exports) => {
5728
5940
  Object.defineProperty(exports, "__esModule", { value: true });
5729
5941
  exports.twistedEdwards = twistedEdwards;
5730
5942
  /*! 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();
5943
+ var curve_ts_1 = require_curve();
5944
+ var modular_ts_1 = require_modular();
5945
+ var utils_ts_1 = require_utils5();
5735
5946
  var _0n = BigInt(0);
5736
5947
  var _1n = BigInt(1);
5737
5948
  var _2n = BigInt(2);
5738
5949
  var _8n = BigInt(8);
5739
5950
  var VERIFY_DEFAULT = { zip215: true };
5740
5951
  function validateOpts(curve) {
5741
- const opts = (0, curve_js_1.validateBasic)(curve);
5742
- ut.validateObject(curve, {
5952
+ const opts = (0, curve_ts_1.validateBasic)(curve);
5953
+ (0, utils_ts_1.validateObject)(curve, {
5743
5954
  hash: "function",
5744
5955
  a: "bigint",
5745
5956
  d: "bigint",
@@ -5757,7 +5968,7 @@ var require_edwards = __commonJS((exports) => {
5757
5968
  const { Fp, n: CURVE_ORDER, prehash, hash: cHash, randomBytes, nByteLength, h: cofactor } = CURVE;
5758
5969
  const MASK = _2n << BigInt(nByteLength * 8) - _1n;
5759
5970
  const modP = Fp.create;
5760
- const Fn = (0, modular_js_1.Field)(CURVE.n, CURVE.nBitLength);
5971
+ const Fn = (0, modular_ts_1.Field)(CURVE.n, CURVE.nBitLength);
5761
5972
  const uvRatio = CURVE.uvRatio || ((u, v) => {
5762
5973
  try {
5763
5974
  return { isValid: true, value: Fp.sqrt(u * Fp.inv(v)) };
@@ -5767,19 +5978,20 @@ var require_edwards = __commonJS((exports) => {
5767
5978
  });
5768
5979
  const adjustScalarBytes = CURVE.adjustScalarBytes || ((bytes) => bytes);
5769
5980
  const domain = CURVE.domain || ((data, ctx, phflag) => {
5770
- (0, utils_js_1.abool)("phflag", phflag);
5981
+ (0, utils_ts_1.abool)("phflag", phflag);
5771
5982
  if (ctx.length || phflag)
5772
5983
  throw new Error("Contexts/pre-hash are not supported");
5773
5984
  return data;
5774
5985
  });
5775
- function aCoordinate(title, n) {
5776
- ut.aInRange("coordinate " + title, n, _0n, MASK);
5986
+ function aCoordinate(title, n, banZero = false) {
5987
+ const min = banZero ? _1n : _0n;
5988
+ (0, utils_ts_1.aInRange)("coordinate " + title, n, min, MASK);
5777
5989
  }
5778
- function assertPoint(other) {
5990
+ function aextpoint(other) {
5779
5991
  if (!(other instanceof Point))
5780
5992
  throw new Error("ExtendedPoint expected");
5781
5993
  }
5782
- const toAffineMemo = (0, utils_js_1.memoized)((p, iz) => {
5994
+ const toAffineMemo = (0, utils_ts_1.memoized)((p, iz) => {
5783
5995
  const { ex: x, ey: y, ez: z2 } = p;
5784
5996
  const is0 = p.is0();
5785
5997
  if (iz == null)
@@ -5793,7 +6005,7 @@ var require_edwards = __commonJS((exports) => {
5793
6005
  throw new Error("invZ was invalid");
5794
6006
  return { x: ax, y: ay };
5795
6007
  });
5796
- const assertValidMemo = (0, utils_js_1.memoized)((p) => {
6008
+ const assertValidMemo = (0, utils_ts_1.memoized)((p) => {
5797
6009
  const { a, d } = CURVE;
5798
6010
  if (p.is0())
5799
6011
  throw new Error("bad point: ZERO");
@@ -5816,14 +6028,14 @@ var require_edwards = __commonJS((exports) => {
5816
6028
 
5817
6029
  class Point {
5818
6030
  constructor(ex, ey, ez, et) {
6031
+ aCoordinate("x", ex);
6032
+ aCoordinate("y", ey);
6033
+ aCoordinate("z", ez, true);
6034
+ aCoordinate("t", et);
5819
6035
  this.ex = ex;
5820
6036
  this.ey = ey;
5821
6037
  this.ez = ez;
5822
6038
  this.et = et;
5823
- aCoordinate("x", ex);
5824
- aCoordinate("y", ey);
5825
- aCoordinate("z", ez);
5826
- aCoordinate("t", et);
5827
6039
  Object.freeze(this);
5828
6040
  }
5829
6041
  get x() {
@@ -5845,7 +6057,7 @@ var require_edwards = __commonJS((exports) => {
5845
6057
  return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);
5846
6058
  }
5847
6059
  static msm(points, scalars) {
5848
- return (0, curve_js_1.pippenger)(Point, Fn, points, scalars);
6060
+ return (0, curve_ts_1.pippenger)(Point, Fn, points, scalars);
5849
6061
  }
5850
6062
  _setWindowSize(windowSize) {
5851
6063
  wnaf.setWindowSize(this, windowSize);
@@ -5854,7 +6066,7 @@ var require_edwards = __commonJS((exports) => {
5854
6066
  assertValidMemo(this);
5855
6067
  }
5856
6068
  equals(other) {
5857
- assertPoint(other);
6069
+ aextpoint(other);
5858
6070
  const { ex: X1, ey: Y1, ez: Z1 } = this;
5859
6071
  const { ex: X2, ey: Y2, ez: Z2 } = other;
5860
6072
  const X1Z2 = modP(X1 * Z2);
@@ -5888,27 +6100,10 @@ var require_edwards = __commonJS((exports) => {
5888
6100
  return new Point(X3, Y3, Z3, T3);
5889
6101
  }
5890
6102
  add(other) {
5891
- assertPoint(other);
6103
+ aextpoint(other);
5892
6104
  const { a, d } = CURVE;
5893
6105
  const { ex: X1, ey: Y1, ez: Z1, et: T1 } = this;
5894
6106
  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
6107
  const A = modP(X1 * X2);
5913
6108
  const B = modP(Y1 * Y2);
5914
6109
  const C = modP(T1 * d * T2);
@@ -5931,13 +6126,13 @@ var require_edwards = __commonJS((exports) => {
5931
6126
  }
5932
6127
  multiply(scalar) {
5933
6128
  const n = scalar;
5934
- ut.aInRange("scalar", n, _1n, CURVE_ORDER);
6129
+ (0, utils_ts_1.aInRange)("scalar", n, _1n, CURVE_ORDER);
5935
6130
  const { p, f } = this.wNAF(n);
5936
6131
  return Point.normalizeZ([p, f])[0];
5937
6132
  }
5938
6133
  multiplyUnsafe(scalar, acc = Point.ZERO) {
5939
6134
  const n = scalar;
5940
- ut.aInRange("scalar", n, _0n, CURVE_ORDER);
6135
+ (0, utils_ts_1.aInRange)("scalar", n, _0n, CURVE_ORDER);
5941
6136
  if (n === _0n)
5942
6137
  return I;
5943
6138
  if (this.is0() || n === _1n)
@@ -5962,14 +6157,14 @@ var require_edwards = __commonJS((exports) => {
5962
6157
  static fromHex(hex, zip215 = false) {
5963
6158
  const { d, a } = CURVE;
5964
6159
  const len = Fp.BYTES;
5965
- hex = (0, utils_js_1.ensureBytes)("pointHex", hex, len);
5966
- (0, utils_js_1.abool)("zip215", zip215);
6160
+ hex = (0, utils_ts_1.ensureBytes)("pointHex", hex, len);
6161
+ (0, utils_ts_1.abool)("zip215", zip215);
5967
6162
  const normed = hex.slice();
5968
6163
  const lastByte = hex[len - 1];
5969
6164
  normed[len - 1] = lastByte & ~128;
5970
- const y = ut.bytesToNumberLE(normed);
6165
+ const y = (0, utils_ts_1.bytesToNumberLE)(normed);
5971
6166
  const max = zip215 ? MASK : Fp.ORDER;
5972
- ut.aInRange("pointHex.y", y, _0n, max);
6167
+ (0, utils_ts_1.aInRange)("pointHex.y", y, _0n, max);
5973
6168
  const y2 = modP(y * y);
5974
6169
  const u = modP(y2 - _1n);
5975
6170
  const v = modP(d * y2 - a);
@@ -5985,35 +6180,40 @@ var require_edwards = __commonJS((exports) => {
5985
6180
  return Point.fromAffine({ x, y });
5986
6181
  }
5987
6182
  static fromPrivateKey(privKey) {
5988
- return getExtendedPublicKey(privKey).point;
6183
+ const { scalar } = getPrivateScalar(privKey);
6184
+ return G.multiply(scalar);
5989
6185
  }
5990
6186
  toRawBytes() {
5991
6187
  const { x, y } = this.toAffine();
5992
- const bytes = ut.numberToBytesLE(y, Fp.BYTES);
6188
+ const bytes = (0, utils_ts_1.numberToBytesLE)(y, Fp.BYTES);
5993
6189
  bytes[bytes.length - 1] |= x & _1n ? 128 : 0;
5994
6190
  return bytes;
5995
6191
  }
5996
6192
  toHex() {
5997
- return ut.bytesToHex(this.toRawBytes());
6193
+ return (0, utils_ts_1.bytesToHex)(this.toRawBytes());
5998
6194
  }
5999
6195
  }
6000
6196
  Point.BASE = new Point(CURVE.Gx, CURVE.Gy, _1n, modP(CURVE.Gx * CURVE.Gy));
6001
6197
  Point.ZERO = new Point(_0n, _1n, _1n, _0n);
6002
6198
  const { BASE: G, ZERO: I } = Point;
6003
- const wnaf = (0, curve_js_1.wNAF)(Point, nByteLength * 8);
6199
+ const wnaf = (0, curve_ts_1.wNAF)(Point, nByteLength * 8);
6004
6200
  function modN(a) {
6005
- return (0, modular_js_1.mod)(a, CURVE_ORDER);
6201
+ return (0, modular_ts_1.mod)(a, CURVE_ORDER);
6006
6202
  }
6007
6203
  function modN_LE(hash) {
6008
- return modN(ut.bytesToNumberLE(hash));
6204
+ return modN((0, utils_ts_1.bytesToNumberLE)(hash));
6009
6205
  }
6010
- function getExtendedPublicKey(key) {
6206
+ function getPrivateScalar(key) {
6011
6207
  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);
6208
+ key = (0, utils_ts_1.ensureBytes)("private key", key, len);
6209
+ const hashed = (0, utils_ts_1.ensureBytes)("hashed private key", cHash(key), 2 * len);
6014
6210
  const head = adjustScalarBytes(hashed.slice(0, len));
6015
6211
  const prefix = hashed.slice(len, 2 * len);
6016
6212
  const scalar = modN_LE(head);
6213
+ return { head, prefix, scalar };
6214
+ }
6215
+ function getExtendedPublicKey(key) {
6216
+ const { head, prefix, scalar } = getPrivateScalar(key);
6017
6217
  const point = G.multiply(scalar);
6018
6218
  const pointBytes = point.toRawBytes();
6019
6219
  return { head, prefix, scalar, point, pointBytes };
@@ -6022,11 +6222,11 @@ var require_edwards = __commonJS((exports) => {
6022
6222
  return getExtendedPublicKey(privKey).pointBytes;
6023
6223
  }
6024
6224
  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)));
6225
+ const msg = (0, utils_ts_1.concatBytes)(...msgs);
6226
+ return modN_LE(cHash(domain(msg, (0, utils_ts_1.ensureBytes)("context", context), !!prehash)));
6027
6227
  }
6028
6228
  function sign(msg, privKey, options = {}) {
6029
- msg = (0, utils_js_1.ensureBytes)("message", msg);
6229
+ msg = (0, utils_ts_1.ensureBytes)("message", msg);
6030
6230
  if (prehash)
6031
6231
  msg = prehash(msg);
6032
6232
  const { prefix, scalar, pointBytes } = getExtendedPublicKey(privKey);
@@ -6034,22 +6234,22 @@ var require_edwards = __commonJS((exports) => {
6034
6234
  const R = G.multiply(r).toRawBytes();
6035
6235
  const k = hashDomainToScalar(options.context, R, pointBytes, msg);
6036
6236
  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);
6237
+ (0, utils_ts_1.aInRange)("signature.s", s, _0n, CURVE_ORDER);
6238
+ const res = (0, utils_ts_1.concatBytes)(R, (0, utils_ts_1.numberToBytesLE)(s, Fp.BYTES));
6239
+ return (0, utils_ts_1.ensureBytes)("result", res, Fp.BYTES * 2);
6040
6240
  }
6041
6241
  const verifyOpts = VERIFY_DEFAULT;
6042
6242
  function verify(sig, msg, publicKey, options = verifyOpts) {
6043
6243
  const { context, zip215 } = options;
6044
6244
  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);
6245
+ sig = (0, utils_ts_1.ensureBytes)("signature", sig, 2 * len);
6246
+ msg = (0, utils_ts_1.ensureBytes)("message", msg);
6247
+ publicKey = (0, utils_ts_1.ensureBytes)("publicKey", publicKey, len);
6048
6248
  if (zip215 !== undefined)
6049
- (0, utils_js_1.abool)("zip215", zip215);
6249
+ (0, utils_ts_1.abool)("zip215", zip215);
6050
6250
  if (prehash)
6051
6251
  msg = prehash(msg);
6052
- const s = ut.bytesToNumberLE(sig.slice(len, 2 * len));
6252
+ const s = (0, utils_ts_1.bytesToNumberLE)(sig.slice(len, 2 * len));
6053
6253
  let A, R, SB;
6054
6254
  try {
6055
6255
  A = Point.fromHex(publicKey, zip215);
@@ -6093,9 +6293,9 @@ var require_hash_to_curve = __commonJS((exports) => {
6093
6293
  exports.hash_to_field = hash_to_field;
6094
6294
  exports.isogenyMap = isogenyMap;
6095
6295
  exports.createHasher = createHasher;
6096
- var modular_js_1 = require_modular();
6097
- var utils_js_1 = require_utils5();
6098
- var os2ip = utils_js_1.bytesToNumberBE;
6296
+ var modular_ts_1 = require_modular();
6297
+ var utils_ts_1 = require_utils5();
6298
+ var os2ip = utils_ts_1.bytesToNumberBE;
6099
6299
  function i2osp(value, length) {
6100
6300
  anum(value);
6101
6301
  anum(length);
@@ -6120,42 +6320,42 @@ var require_hash_to_curve = __commonJS((exports) => {
6120
6320
  throw new Error("number expected");
6121
6321
  }
6122
6322
  function expand_message_xmd(msg, DST, lenInBytes, H) {
6123
- (0, utils_js_1.abytes)(msg);
6124
- (0, utils_js_1.abytes)(DST);
6323
+ (0, utils_ts_1.abytes)(msg);
6324
+ (0, utils_ts_1.abytes)(DST);
6125
6325
  anum(lenInBytes);
6126
6326
  if (DST.length > 255)
6127
- DST = H((0, utils_js_1.concatBytes)((0, utils_js_1.utf8ToBytes)("H2C-OVERSIZE-DST-"), DST));
6327
+ DST = H((0, utils_ts_1.concatBytes)((0, utils_ts_1.utf8ToBytes)("H2C-OVERSIZE-DST-"), DST));
6128
6328
  const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H;
6129
6329
  const ell = Math.ceil(lenInBytes / b_in_bytes);
6130
6330
  if (lenInBytes > 65535 || ell > 255)
6131
6331
  throw new Error("expand_message_xmd: invalid lenInBytes");
6132
- const DST_prime = (0, utils_js_1.concatBytes)(DST, i2osp(DST.length, 1));
6332
+ const DST_prime = (0, utils_ts_1.concatBytes)(DST, i2osp(DST.length, 1));
6133
6333
  const Z_pad = i2osp(0, r_in_bytes);
6134
6334
  const l_i_b_str = i2osp(lenInBytes, 2);
6135
6335
  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));
6336
+ const b_0 = H((0, utils_ts_1.concatBytes)(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime));
6337
+ b[0] = H((0, utils_ts_1.concatBytes)(b_0, i2osp(1, 1), DST_prime));
6138
6338
  for (let i = 1;i <= ell; i++) {
6139
6339
  const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime];
6140
- b[i] = H((0, utils_js_1.concatBytes)(...args));
6340
+ b[i] = H((0, utils_ts_1.concatBytes)(...args));
6141
6341
  }
6142
- const pseudo_random_bytes = (0, utils_js_1.concatBytes)(...b);
6342
+ const pseudo_random_bytes = (0, utils_ts_1.concatBytes)(...b);
6143
6343
  return pseudo_random_bytes.slice(0, lenInBytes);
6144
6344
  }
6145
6345
  function expand_message_xof(msg, DST, lenInBytes, k, H) {
6146
- (0, utils_js_1.abytes)(msg);
6147
- (0, utils_js_1.abytes)(DST);
6346
+ (0, utils_ts_1.abytes)(msg);
6347
+ (0, utils_ts_1.abytes)(DST);
6148
6348
  anum(lenInBytes);
6149
6349
  if (DST.length > 255) {
6150
6350
  const dkLen = Math.ceil(2 * k / 8);
6151
- DST = H.create({ dkLen }).update((0, utils_js_1.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(DST).digest();
6351
+ DST = H.create({ dkLen }).update((0, utils_ts_1.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(DST).digest();
6152
6352
  }
6153
6353
  if (lenInBytes > 65535 || DST.length > 255)
6154
6354
  throw new Error("expand_message_xof: invalid lenInBytes");
6155
6355
  return H.create({ dkLen: lenInBytes }).update(msg).update(i2osp(lenInBytes, 2)).update(DST).update(i2osp(DST.length, 1)).digest();
6156
6356
  }
6157
6357
  function hash_to_field(msg, count, options) {
6158
- (0, utils_js_1.validateObject)(options, {
6358
+ (0, utils_ts_1.validateObject)(options, {
6159
6359
  DST: "stringOrUint8Array",
6160
6360
  p: "bigint",
6161
6361
  m: "isSafeInteger",
@@ -6163,9 +6363,9 @@ var require_hash_to_curve = __commonJS((exports) => {
6163
6363
  hash: "hash"
6164
6364
  });
6165
6365
  const { p, k, m, hash, expand, DST: _DST } = options;
6166
- (0, utils_js_1.abytes)(msg);
6366
+ (0, utils_ts_1.abytes)(msg);
6167
6367
  anum(count);
6168
- const DST = typeof _DST === "string" ? (0, utils_js_1.utf8ToBytes)(_DST) : _DST;
6368
+ const DST = typeof _DST === "string" ? (0, utils_ts_1.utf8ToBytes)(_DST) : _DST;
6169
6369
  const log2p = p.toString(2).length;
6170
6370
  const L = Math.ceil((log2p + k) / 8);
6171
6371
  const len_in_bytes = count * m * L;
@@ -6185,7 +6385,7 @@ var require_hash_to_curve = __commonJS((exports) => {
6185
6385
  for (let j = 0;j < m; j++) {
6186
6386
  const elm_offset = L * (j + i * m);
6187
6387
  const tv = prb.subarray(elm_offset, elm_offset + L);
6188
- e[j] = (0, modular_js_1.mod)(os2ip(tv), p);
6388
+ e[j] = (0, modular_ts_1.mod)(os2ip(tv), p);
6189
6389
  }
6190
6390
  u[i] = e;
6191
6391
  }
@@ -6195,6 +6395,8 @@ var require_hash_to_curve = __commonJS((exports) => {
6195
6395
  const COEFF = map.map((i) => Array.from(i).reverse());
6196
6396
  return (x, y) => {
6197
6397
  const [xNum, xDen, yNum, yDen] = COEFF.map((val) => val.reduce((acc, i) => field.add(field.mul(acc, x), i)));
6398
+ if (field.is0(xDen) || field.is0(yDen))
6399
+ throw new Error("bad point: ZERO");
6198
6400
  x = field.div(xNum, xDen);
6199
6401
  y = field.mul(y, field.div(yNum, yDen));
6200
6402
  return { x, y };
@@ -6237,12 +6439,12 @@ var require_montgomery = __commonJS((exports) => {
6237
6439
  Object.defineProperty(exports, "__esModule", { value: true });
6238
6440
  exports.montgomery = montgomery;
6239
6441
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
6240
- var modular_js_1 = require_modular();
6241
- var utils_js_1 = require_utils5();
6442
+ var modular_ts_1 = require_modular();
6443
+ var utils_ts_1 = require_utils5();
6242
6444
  var _0n = BigInt(0);
6243
6445
  var _1n = BigInt(1);
6244
6446
  function validateOpts(curve) {
6245
- (0, utils_js_1.validateObject)(curve, {
6447
+ (0, utils_ts_1.validateObject)(curve, {
6246
6448
  a: "bigint"
6247
6449
  }, {
6248
6450
  montgomeryBits: "isSafeInteger",
@@ -6257,12 +6459,12 @@ var require_montgomery = __commonJS((exports) => {
6257
6459
  function montgomery(curveDef) {
6258
6460
  const CURVE = validateOpts(curveDef);
6259
6461
  const { P } = CURVE;
6260
- const modP = (n) => (0, modular_js_1.mod)(n, P);
6462
+ const modP = (n) => (0, modular_ts_1.mod)(n, P);
6261
6463
  const montgomeryBits = CURVE.montgomeryBits;
6262
6464
  const montgomeryBytes = Math.ceil(montgomeryBits / 8);
6263
6465
  const fieldLen = CURVE.nByteLength;
6264
6466
  const adjustScalarBytes = CURVE.adjustScalarBytes || ((bytes) => bytes);
6265
- const powPminus2 = CURVE.powPminus2 || ((x) => (0, modular_js_1.pow)(x, P - BigInt(2), P));
6467
+ const powPminus2 = CURVE.powPminus2 || ((x) => (0, modular_ts_1.pow)(x, P - BigInt(2), P));
6266
6468
  function cswap(swap, x_2, x_3) {
6267
6469
  const dummy = modP(swap * (x_2 - x_3));
6268
6470
  x_2 = modP(x_2 - dummy);
@@ -6271,8 +6473,8 @@ var require_montgomery = __commonJS((exports) => {
6271
6473
  }
6272
6474
  const a24 = (CURVE.a - BigInt(2)) / BigInt(4);
6273
6475
  function montgomeryLadder(u, scalar) {
6274
- (0, utils_js_1.aInRange)("u", u, _0n, P);
6275
- (0, utils_js_1.aInRange)("scalar", scalar, _0n, P);
6476
+ (0, utils_ts_1.aInRange)("u", u, _0n, P);
6477
+ (0, utils_ts_1.aInRange)("scalar", scalar, _0n, P);
6276
6478
  const k = scalar;
6277
6479
  const x_1 = u;
6278
6480
  let x_2 = _1n;
@@ -6317,22 +6519,22 @@ var require_montgomery = __commonJS((exports) => {
6317
6519
  return modP(x_2 * z2);
6318
6520
  }
6319
6521
  function encodeUCoordinate(u) {
6320
- return (0, utils_js_1.numberToBytesLE)(modP(u), montgomeryBytes);
6522
+ return (0, utils_ts_1.numberToBytesLE)(modP(u), montgomeryBytes);
6321
6523
  }
6322
6524
  function decodeUCoordinate(uEnc) {
6323
- const u = (0, utils_js_1.ensureBytes)("u coordinate", uEnc, montgomeryBytes);
6525
+ const u = (0, utils_ts_1.ensureBytes)("u coordinate", uEnc, montgomeryBytes);
6324
6526
  if (fieldLen === 32)
6325
6527
  u[31] &= 127;
6326
- return (0, utils_js_1.bytesToNumberLE)(u);
6528
+ return (0, utils_ts_1.bytesToNumberLE)(u);
6327
6529
  }
6328
6530
  function decodeScalar(n) {
6329
- const bytes = (0, utils_js_1.ensureBytes)("scalar", n);
6531
+ const bytes = (0, utils_ts_1.ensureBytes)("scalar", n);
6330
6532
  const len = bytes.length;
6331
6533
  if (len !== montgomeryBytes && len !== fieldLen) {
6332
6534
  let valid = "" + montgomeryBytes + " or " + fieldLen;
6333
6535
  throw new Error("invalid scalar, expected " + valid + " bytes, got " + len);
6334
6536
  }
6335
- return (0, utils_js_1.bytesToNumberLE)(adjustScalarBytes(bytes));
6537
+ return (0, utils_ts_1.bytesToNumberLE)(adjustScalarBytes(bytes));
6336
6538
  }
6337
6539
  function scalarMult(scalar, u) {
6338
6540
  const pointU = decodeUCoordinate(u);
@@ -6364,14 +6566,14 @@ var require_ed25519 = __commonJS((exports) => {
6364
6566
  exports.edwardsToMontgomeryPub = edwardsToMontgomeryPub;
6365
6567
  exports.edwardsToMontgomeryPriv = edwardsToMontgomeryPriv;
6366
6568
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
6367
- var sha512_1 = require_sha512();
6569
+ var sha2_1 = require_sha2();
6368
6570
  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();
6571
+ var curve_ts_1 = require_curve();
6572
+ var edwards_ts_1 = require_edwards();
6573
+ var hash_to_curve_ts_1 = require_hash_to_curve();
6574
+ var modular_ts_1 = require_modular();
6575
+ var montgomery_ts_1 = require_montgomery();
6576
+ var utils_ts_1 = require_utils5();
6375
6577
  var ED25519_P = BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");
6376
6578
  var ED25519_SQRT_M1 = /* @__PURE__ */ BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");
6377
6579
  var _0n = BigInt(0);
@@ -6385,16 +6587,16 @@ var require_ed25519 = __commonJS((exports) => {
6385
6587
  const P = ED25519_P;
6386
6588
  const x2 = x * x % P;
6387
6589
  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;
6590
+ const b4 = (0, modular_ts_1.pow2)(b2, _2n, P) * b2 % P;
6591
+ const b5 = (0, modular_ts_1.pow2)(b4, _1n, P) * x % P;
6592
+ const b10 = (0, modular_ts_1.pow2)(b5, _5n, P) * b5 % P;
6593
+ const b20 = (0, modular_ts_1.pow2)(b10, _10n, P) * b10 % P;
6594
+ const b40 = (0, modular_ts_1.pow2)(b20, _20n, P) * b20 % P;
6595
+ const b80 = (0, modular_ts_1.pow2)(b40, _40n, P) * b40 % P;
6596
+ const b160 = (0, modular_ts_1.pow2)(b80, _80n, P) * b80 % P;
6597
+ const b240 = (0, modular_ts_1.pow2)(b160, _80n, P) * b80 % P;
6598
+ const b250 = (0, modular_ts_1.pow2)(b240, _10n, P) * b10 % P;
6599
+ const pow_p_5_8 = (0, modular_ts_1.pow2)(b250, _2n, P) * x % P;
6398
6600
  return { pow_p_5_8, b2 };
6399
6601
  }
6400
6602
  function adjustScalarBytes(bytes) {
@@ -6405,22 +6607,22 @@ var require_ed25519 = __commonJS((exports) => {
6405
6607
  }
6406
6608
  function uvRatio(u, v) {
6407
6609
  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);
6610
+ const v3 = (0, modular_ts_1.mod)(v * v * v, P);
6611
+ const v7 = (0, modular_ts_1.mod)(v3 * v3 * v, P);
6410
6612
  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);
6613
+ let x = (0, modular_ts_1.mod)(u * v3 * pow, P);
6614
+ const vx2 = (0, modular_ts_1.mod)(v * x * x, P);
6413
6615
  const root1 = x;
6414
- const root2 = (0, modular_js_1.mod)(x * ED25519_SQRT_M1, P);
6616
+ const root2 = (0, modular_ts_1.mod)(x * ED25519_SQRT_M1, P);
6415
6617
  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);
6618
+ const useRoot2 = vx2 === (0, modular_ts_1.mod)(-u, P);
6619
+ const noRoot = vx2 === (0, modular_ts_1.mod)(-u * ED25519_SQRT_M1, P);
6418
6620
  if (useRoot1)
6419
6621
  x = root1;
6420
6622
  if (useRoot2 || noRoot)
6421
6623
  x = root2;
6422
- if ((0, modular_js_1.isNegativeLE)(x, P))
6423
- x = (0, modular_js_1.mod)(-x, P);
6624
+ if ((0, modular_ts_1.isNegativeLE)(x, P))
6625
+ x = (0, modular_ts_1.mod)(-x, P);
6424
6626
  return { isValid: useRoot1 || useRoot2, value: x };
6425
6627
  }
6426
6628
  exports.ED25519_TORSION_SUBGROUP = [
@@ -6433,35 +6635,35 @@ var require_ed25519 = __commonJS((exports) => {
6433
6635
  "0000000000000000000000000000000000000000000000000000000000000000",
6434
6636
  "c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"
6435
6637
  ];
6436
- var Fp = /* @__PURE__ */ (() => (0, modular_js_1.Field)(ED25519_P, undefined, true))();
6638
+ var Fp = /* @__PURE__ */ (() => (0, modular_ts_1.Field)(ED25519_P, undefined, true))();
6437
6639
  var ed25519Defaults = /* @__PURE__ */ (() => ({
6438
- a: BigInt(-1),
6640
+ a: Fp.create(BigInt(-1)),
6439
6641
  d: BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),
6440
6642
  Fp,
6441
6643
  n: BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),
6442
6644
  h: _8n,
6443
6645
  Gx: BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),
6444
6646
  Gy: BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),
6445
- hash: sha512_1.sha512,
6647
+ hash: sha2_1.sha512,
6446
6648
  randomBytes: utils_1.randomBytes,
6447
6649
  adjustScalarBytes,
6448
6650
  uvRatio
6449
6651
  }))();
6450
- exports.ed25519 = (() => (0, edwards_js_1.twistedEdwards)(ed25519Defaults))();
6652
+ exports.ed25519 = (() => (0, edwards_ts_1.twistedEdwards)(ed25519Defaults))();
6451
6653
  function ed25519_domain(data, ctx, phflag) {
6452
6654
  if (ctx.length > 255)
6453
6655
  throw new Error("Context is too big");
6454
6656
  return (0, utils_1.concatBytes)((0, utils_1.utf8ToBytes)("SigEd25519 no Ed25519 collisions"), new Uint8Array([phflag ? 1 : 0, ctx.length]), ctx, data);
6455
6657
  }
6456
- exports.ed25519ctx = (() => (0, edwards_js_1.twistedEdwards)({
6658
+ exports.ed25519ctx = (() => (0, edwards_ts_1.twistedEdwards)({
6457
6659
  ...ed25519Defaults,
6458
6660
  domain: ed25519_domain
6459
6661
  }))();
6460
- exports.ed25519ph = (() => (0, edwards_js_1.twistedEdwards)(Object.assign({}, ed25519Defaults, {
6662
+ exports.ed25519ph = (() => (0, edwards_ts_1.twistedEdwards)(Object.assign({}, ed25519Defaults, {
6461
6663
  domain: ed25519_domain,
6462
- prehash: sha512_1.sha512
6664
+ prehash: sha2_1.sha512
6463
6665
  })))();
6464
- exports.x25519 = (() => (0, montgomery_js_1.montgomery)({
6666
+ exports.x25519 = (() => (0, montgomery_ts_1.montgomery)({
6465
6667
  P: ED25519_P,
6466
6668
  a: BigInt(486662),
6467
6669
  montgomeryBits: 255,
@@ -6470,7 +6672,7 @@ var require_ed25519 = __commonJS((exports) => {
6470
6672
  powPminus2: (x) => {
6471
6673
  const P = ED25519_P;
6472
6674
  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);
6675
+ return (0, modular_ts_1.mod)((0, modular_ts_1.pow2)(pow_p_5_8, _3n, P) * b2, P);
6474
6676
  },
6475
6677
  adjustScalarBytes,
6476
6678
  randomBytes: utils_1.randomBytes
@@ -6531,7 +6733,7 @@ var require_ed25519 = __commonJS((exports) => {
6531
6733
  y = Fp.cmov(y, Fp.neg(y), e3 !== e4);
6532
6734
  return { xMn: xn, xMd: xd, yMn: y, yMd: _1n };
6533
6735
  }
6534
- var ELL2_C1_EDWARDS = /* @__PURE__ */ (() => (0, modular_js_1.FpSqrtEven)(Fp, Fp.neg(BigInt(486664))))();
6736
+ var ELL2_C1_EDWARDS = /* @__PURE__ */ (() => (0, modular_ts_1.FpSqrtEven)(Fp, Fp.neg(BigInt(486664))))();
6535
6737
  function map_to_curve_elligator2_edwards25519(u) {
6536
6738
  const { xMn, xMd, yMn, yMd } = map_to_curve_elligator2_curve25519(u);
6537
6739
  let xn = Fp.mul(xMn, yMd);
@@ -6548,18 +6750,18 @@ var require_ed25519 = __commonJS((exports) => {
6548
6750
  const inv = Fp.invertBatch([xd, yd]);
6549
6751
  return { x: Fp.mul(xn, inv[0]), y: Fp.mul(yn, inv[1]) };
6550
6752
  }
6551
- var htf = /* @__PURE__ */ (() => (0, hash_to_curve_js_1.createHasher)(exports.ed25519.ExtendedPoint, (scalars) => map_to_curve_elligator2_edwards25519(scalars[0]), {
6753
+ var htf = /* @__PURE__ */ (() => (0, hash_to_curve_ts_1.createHasher)(exports.ed25519.ExtendedPoint, (scalars) => map_to_curve_elligator2_edwards25519(scalars[0]), {
6552
6754
  DST: "edwards25519_XMD:SHA-512_ELL2_RO_",
6553
6755
  encodeDST: "edwards25519_XMD:SHA-512_ELL2_NU_",
6554
6756
  p: Fp.ORDER,
6555
6757
  m: 1,
6556
6758
  k: 128,
6557
6759
  expand: "xmd",
6558
- hash: sha512_1.sha512
6760
+ hash: sha2_1.sha512
6559
6761
  }))();
6560
6762
  exports.hashToCurve = (() => htf.hashToCurve)();
6561
6763
  exports.encodeToCurve = (() => htf.encodeToCurve)();
6562
- function assertRstPoint(other) {
6764
+ function aristp(other) {
6563
6765
  if (!(other instanceof RistPoint))
6564
6766
  throw new Error("RistrettoPoint expected");
6565
6767
  }
@@ -6570,7 +6772,7 @@ var require_ed25519 = __commonJS((exports) => {
6570
6772
  var D_MINUS_ONE_SQ = /* @__PURE__ */ BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");
6571
6773
  var invertSqrt = (number) => uvRatio(_1n, number);
6572
6774
  var MAX_255B = /* @__PURE__ */ BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
6573
- var bytes255ToNumberLE = (bytes) => exports.ed25519.CURVE.Fp.create((0, utils_js_1.bytesToNumberLE)(bytes) & MAX_255B);
6775
+ var bytes255ToNumberLE = (bytes) => exports.ed25519.CURVE.Fp.create((0, utils_ts_1.bytesToNumberLE)(bytes) & MAX_255B);
6574
6776
  function calcElligatorRistrettoMap(r0) {
6575
6777
  const { d } = exports.ed25519.CURVE;
6576
6778
  const P = exports.ed25519.CURVE.Fp.ORDER;
@@ -6581,7 +6783,7 @@ var require_ed25519 = __commonJS((exports) => {
6581
6783
  const D = mod((c - d * r) * mod(r + d));
6582
6784
  let { isValid: Ns_D_is_sq, value: s } = uvRatio(Ns, D);
6583
6785
  let s_ = mod(s * r0);
6584
- if (!(0, modular_js_1.isNegativeLE)(s_, P))
6786
+ if (!(0, modular_ts_1.isNegativeLE)(s_, P))
6585
6787
  s_ = mod(-s_);
6586
6788
  if (!Ns_D_is_sq)
6587
6789
  s = s_;
@@ -6604,7 +6806,7 @@ var require_ed25519 = __commonJS((exports) => {
6604
6806
  return new RistPoint(exports.ed25519.ExtendedPoint.fromAffine(ap));
6605
6807
  }
6606
6808
  static hashToCurve(hex) {
6607
- hex = (0, utils_js_1.ensureBytes)("ristrettoHash", hex, 64);
6809
+ hex = (0, utils_ts_1.ensureBytes)("ristrettoHash", hex, 64);
6608
6810
  const r1 = bytes255ToNumberLE(hex.slice(0, 32));
6609
6811
  const R1 = calcElligatorRistrettoMap(r1);
6610
6812
  const r2 = bytes255ToNumberLE(hex.slice(32, 64));
@@ -6612,13 +6814,13 @@ var require_ed25519 = __commonJS((exports) => {
6612
6814
  return new RistPoint(R1.add(R2));
6613
6815
  }
6614
6816
  static fromHex(hex) {
6615
- hex = (0, utils_js_1.ensureBytes)("ristrettoHex", hex, 32);
6817
+ hex = (0, utils_ts_1.ensureBytes)("ristrettoHex", hex, 32);
6616
6818
  const { a, d } = exports.ed25519.CURVE;
6617
6819
  const P = exports.ed25519.CURVE.Fp.ORDER;
6618
6820
  const mod = exports.ed25519.CURVE.Fp.create;
6619
6821
  const emsg = "RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint";
6620
6822
  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))
6823
+ if (!(0, utils_ts_1.equalBytes)((0, utils_ts_1.numberToBytesLE)(s, 32), hex) || (0, modular_ts_1.isNegativeLE)(s, P))
6622
6824
  throw new Error(emsg);
6623
6825
  const s2 = mod(s * s);
6624
6826
  const u1 = mod(_1n + a * s2);
@@ -6630,17 +6832,17 @@ var require_ed25519 = __commonJS((exports) => {
6630
6832
  const Dx = mod(I * u2);
6631
6833
  const Dy = mod(I * Dx * v);
6632
6834
  let x = mod((s + s) * Dx);
6633
- if ((0, modular_js_1.isNegativeLE)(x, P))
6835
+ if ((0, modular_ts_1.isNegativeLE)(x, P))
6634
6836
  x = mod(-x);
6635
6837
  const y = mod(u1 * Dy);
6636
6838
  const t = mod(x * y);
6637
- if (!isValid2 || (0, modular_js_1.isNegativeLE)(t, P) || y === _0n)
6839
+ if (!isValid2 || (0, modular_ts_1.isNegativeLE)(t, P) || y === _0n)
6638
6840
  throw new Error(emsg);
6639
6841
  return new RistPoint(new exports.ed25519.ExtendedPoint(x, y, _1n, t));
6640
6842
  }
6641
6843
  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);
6844
+ const Fn = (0, modular_ts_1.Field)(exports.ed25519.CURVE.n, exports.ed25519.CURVE.nBitLength);
6845
+ return (0, curve_ts_1.pippenger)(RistPoint, Fn, points, scalars);
6644
6846
  }
6645
6847
  toRawBytes() {
6646
6848
  let { ex: x, ey: y, ez: z2, et: t } = this.ep;
@@ -6654,7 +6856,7 @@ var require_ed25519 = __commonJS((exports) => {
6654
6856
  const D2 = mod(invsqrt * u2);
6655
6857
  const zInv = mod(D1 * D2 * t);
6656
6858
  let D;
6657
- if ((0, modular_js_1.isNegativeLE)(t * zInv, P)) {
6859
+ if ((0, modular_ts_1.isNegativeLE)(t * zInv, P)) {
6658
6860
  let _x = mod(y * SQRT_M1);
6659
6861
  let _y = mod(x * SQRT_M1);
6660
6862
  x = _x;
@@ -6663,21 +6865,21 @@ var require_ed25519 = __commonJS((exports) => {
6663
6865
  } else {
6664
6866
  D = D2;
6665
6867
  }
6666
- if ((0, modular_js_1.isNegativeLE)(x * zInv, P))
6868
+ if ((0, modular_ts_1.isNegativeLE)(x * zInv, P))
6667
6869
  y = mod(-y);
6668
6870
  let s = mod((z2 - y) * D);
6669
- if ((0, modular_js_1.isNegativeLE)(s, P))
6871
+ if ((0, modular_ts_1.isNegativeLE)(s, P))
6670
6872
  s = mod(-s);
6671
- return (0, utils_js_1.numberToBytesLE)(s, 32);
6873
+ return (0, utils_ts_1.numberToBytesLE)(s, 32);
6672
6874
  }
6673
6875
  toHex() {
6674
- return (0, utils_js_1.bytesToHex)(this.toRawBytes());
6876
+ return (0, utils_ts_1.bytesToHex)(this.toRawBytes());
6675
6877
  }
6676
6878
  toString() {
6677
6879
  return this.toHex();
6678
6880
  }
6679
6881
  equals(other) {
6680
- assertRstPoint(other);
6882
+ aristp(other);
6681
6883
  const { ex: X1, ey: Y1 } = this.ep;
6682
6884
  const { ex: X2, ey: Y2 } = other.ep;
6683
6885
  const mod = exports.ed25519.CURVE.Fp.create;
@@ -6686,11 +6888,11 @@ var require_ed25519 = __commonJS((exports) => {
6686
6888
  return one || two;
6687
6889
  }
6688
6890
  add(other) {
6689
- assertRstPoint(other);
6891
+ aristp(other);
6690
6892
  return new RistPoint(this.ep.add(other.ep));
6691
6893
  }
6692
6894
  subtract(other) {
6693
- assertRstPoint(other);
6895
+ aristp(other);
6694
6896
  return new RistPoint(this.ep.subtract(other.ep));
6695
6897
  }
6696
6898
  multiply(scalar) {
@@ -6716,7 +6918,7 @@ var require_ed25519 = __commonJS((exports) => {
6716
6918
  var hashToRistretto255 = (msg, options) => {
6717
6919
  const d = options.DST;
6718
6920
  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);
6921
+ const uniform_bytes = (0, hash_to_curve_ts_1.expand_message_xmd)(msg, DST, 64, sha2_1.sha512);
6720
6922
  const P = RistPoint.hashToCurve(uniform_bytes);
6721
6923
  return P;
6722
6924
  };
@@ -6724,193 +6926,20 @@ var require_ed25519 = __commonJS((exports) => {
6724
6926
  exports.hash_to_ristretto255 = exports.hashToRistretto255;
6725
6927
  });
6726
6928
 
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
6929
  // ../../node_modules/@noble/hashes/hmac.js
6901
6930
  var require_hmac = __commonJS((exports) => {
6902
6931
  Object.defineProperty(exports, "__esModule", { value: true });
6903
6932
  exports.hmac = exports.HMAC = undefined;
6904
- var _assert_js_1 = require__assert2();
6905
- var utils_js_1 = require_utils4();
6933
+ var _assert_ts_1 = require__assert();
6934
+ var utils_ts_1 = require_utils4();
6906
6935
 
6907
- class HMAC extends utils_js_1.Hash {
6936
+ class HMAC extends utils_ts_1.Hash {
6908
6937
  constructor(hash, _key) {
6909
6938
  super();
6910
6939
  this.finished = false;
6911
6940
  this.destroyed = false;
6912
- (0, _assert_js_1.ahash)(hash);
6913
- const key = (0, utils_js_1.toBytes)(_key);
6941
+ (0, _assert_ts_1.ahash)(hash);
6942
+ const key = (0, utils_ts_1.toBytes)(_key);
6914
6943
  this.iHash = hash.create();
6915
6944
  if (typeof this.iHash.update !== "function")
6916
6945
  throw new Error("Expected instance of class which extends utils.Hash");
@@ -6929,13 +6958,13 @@ var require_hmac = __commonJS((exports) => {
6929
6958
  pad.fill(0);
6930
6959
  }
6931
6960
  update(buf) {
6932
- (0, _assert_js_1.aexists)(this);
6961
+ (0, _assert_ts_1.aexists)(this);
6933
6962
  this.iHash.update(buf);
6934
6963
  return this;
6935
6964
  }
6936
6965
  digestInto(out) {
6937
- (0, _assert_js_1.aexists)(this);
6938
- (0, _assert_js_1.abytes)(out, this.outputLen);
6966
+ (0, _assert_ts_1.aexists)(this);
6967
+ (0, _assert_ts_1.abytes)(out, this.outputLen);
6939
6968
  this.finished = true;
6940
6969
  this.iHash.digestInto(out);
6941
6970
  this.oHash.update(out);
@@ -6980,19 +7009,18 @@ var require_weierstrass = __commonJS((exports) => {
6980
7009
  exports.SWUFpSqrtRatio = SWUFpSqrtRatio;
6981
7010
  exports.mapToCurveSimpleSWU = mapToCurveSimpleSWU;
6982
7011
  /*! 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();
7012
+ var curve_ts_1 = require_curve();
7013
+ var modular_ts_1 = require_modular();
7014
+ var utils_ts_1 = require_utils5();
6987
7015
  function validateSigVerOpts(opts) {
6988
7016
  if (opts.lowS !== undefined)
6989
- (0, utils_js_1.abool)("lowS", opts.lowS);
7017
+ (0, utils_ts_1.abool)("lowS", opts.lowS);
6990
7018
  if (opts.prehash !== undefined)
6991
- (0, utils_js_1.abool)("prehash", opts.prehash);
7019
+ (0, utils_ts_1.abool)("prehash", opts.prehash);
6992
7020
  }
6993
7021
  function validatePointOpts(curve) {
6994
- const opts = (0, curve_js_1.validateBasic)(curve);
6995
- ut.validateObject(opts, {
7022
+ const opts = (0, curve_ts_1.validateBasic)(curve);
7023
+ (0, utils_ts_1.validateObject)(opts, {
6996
7024
  a: "field",
6997
7025
  b: "field"
6998
7026
  }, {
@@ -7015,7 +7043,6 @@ var require_weierstrass = __commonJS((exports) => {
7015
7043
  }
7016
7044
  return Object.freeze({ ...opts });
7017
7045
  }
7018
- var { bytesToNumberBE: b2n, hexToBytes: h2b } = ut;
7019
7046
 
7020
7047
  class DERErr extends Error {
7021
7048
  constructor(m = "") {
@@ -7033,11 +7060,11 @@ var require_weierstrass = __commonJS((exports) => {
7033
7060
  if (data.length & 1)
7034
7061
  throw new E("tlv.encode: unpadded data");
7035
7062
  const dataLen = data.length / 2;
7036
- const len = ut.numberToHexUnpadded(dataLen);
7063
+ const len = (0, utils_ts_1.numberToHexUnpadded)(dataLen);
7037
7064
  if (len.length / 2 & 128)
7038
7065
  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);
7066
+ const lenLen = dataLen > 127 ? (0, utils_ts_1.numberToHexUnpadded)(len.length / 2 | 128) : "";
7067
+ const t = (0, utils_ts_1.numberToHexUnpadded)(tag);
7041
7068
  return t + lenLen + len + data;
7042
7069
  },
7043
7070
  decode(tag, data) {
@@ -7080,7 +7107,7 @@ var require_weierstrass = __commonJS((exports) => {
7080
7107
  const { Err: E } = exports.DER;
7081
7108
  if (num < _0n)
7082
7109
  throw new E("integer: negative integers are not allowed");
7083
- let hex = ut.numberToHexUnpadded(num);
7110
+ let hex = (0, utils_ts_1.numberToHexUnpadded)(num);
7084
7111
  if (Number.parseInt(hex[0], 16) & 8)
7085
7112
  hex = "00" + hex;
7086
7113
  if (hex.length & 1)
@@ -7093,13 +7120,12 @@ var require_weierstrass = __commonJS((exports) => {
7093
7120
  throw new E("invalid signature integer: negative");
7094
7121
  if (data[0] === 0 && !(data[1] & 128))
7095
7122
  throw new E("invalid signature integer: unnecessary leading zero");
7096
- return b2n(data);
7123
+ return (0, utils_ts_1.bytesToNumberBE)(data);
7097
7124
  }
7098
7125
  },
7099
7126
  toSig(hex) {
7100
7127
  const { Err: E, _int: int, _tlv: tlv } = exports.DER;
7101
- const data = typeof hex === "string" ? h2b(hex) : hex;
7102
- ut.abytes(data);
7128
+ const data = (0, utils_ts_1.ensureBytes)("signature", hex);
7103
7129
  const { v: seqBytes, l: seqLeftBytes } = tlv.decode(48, data);
7104
7130
  if (seqLeftBytes.length)
7105
7131
  throw new E("invalid signature: left bytes after parsing");
@@ -7125,10 +7151,10 @@ var require_weierstrass = __commonJS((exports) => {
7125
7151
  function weierstrassPoints(opts) {
7126
7152
  const CURVE = validatePointOpts(opts);
7127
7153
  const { Fp } = CURVE;
7128
- const Fn = (0, modular_js_1.Field)(CURVE.n, CURVE.nBitLength);
7154
+ const Fn = (0, modular_ts_1.Field)(CURVE.n, CURVE.nBitLength);
7129
7155
  const toBytes = CURVE.toBytes || ((_c, point, _isCompressed) => {
7130
7156
  const a = point.toAffine();
7131
- return ut.concatBytes(Uint8Array.from([4]), Fp.toBytes(a.x), Fp.toBytes(a.y));
7157
+ return (0, utils_ts_1.concatBytes)(Uint8Array.from([4]), Fp.toBytes(a.x), Fp.toBytes(a.y));
7132
7158
  });
7133
7159
  const fromBytes = CURVE.fromBytes || ((bytes) => {
7134
7160
  const tail = bytes.subarray(1);
@@ -7145,33 +7171,33 @@ var require_weierstrass = __commonJS((exports) => {
7145
7171
  if (!Fp.eql(Fp.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx)))
7146
7172
  throw new Error("bad generator point: equation left != right");
7147
7173
  function isWithinCurveOrder(num) {
7148
- return ut.inRange(num, _1n, CURVE.n);
7174
+ return (0, utils_ts_1.inRange)(num, _1n, CURVE.n);
7149
7175
  }
7150
7176
  function normPrivateKeyToScalar(key) {
7151
7177
  const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n: N } = CURVE;
7152
7178
  if (lengths && typeof key !== "bigint") {
7153
- if (ut.isBytes(key))
7154
- key = ut.bytesToHex(key);
7179
+ if ((0, utils_ts_1.isBytes)(key))
7180
+ key = (0, utils_ts_1.bytesToHex)(key);
7155
7181
  if (typeof key !== "string" || !lengths.includes(key.length))
7156
7182
  throw new Error("invalid private key");
7157
7183
  key = key.padStart(nByteLength * 2, "0");
7158
7184
  }
7159
7185
  let num;
7160
7186
  try {
7161
- num = typeof key === "bigint" ? key : ut.bytesToNumberBE((0, utils_js_1.ensureBytes)("private key", key, nByteLength));
7187
+ num = typeof key === "bigint" ? key : (0, utils_ts_1.bytesToNumberBE)((0, utils_ts_1.ensureBytes)("private key", key, nByteLength));
7162
7188
  } catch (error) {
7163
7189
  throw new Error("invalid private key, expected hex or " + nByteLength + " bytes, got " + typeof key);
7164
7190
  }
7165
7191
  if (wrapPrivateKey)
7166
- num = (0, modular_js_1.mod)(num, N);
7167
- ut.aInRange("private key", num, _1n, N);
7192
+ num = (0, modular_ts_1.mod)(num, N);
7193
+ (0, utils_ts_1.aInRange)("private key", num, _1n, N);
7168
7194
  return num;
7169
7195
  }
7170
- function assertPrjPoint(other) {
7196
+ function aprjpoint(other) {
7171
7197
  if (!(other instanceof Point))
7172
7198
  throw new Error("ProjectivePoint expected");
7173
7199
  }
7174
- const toAffineMemo = (0, utils_js_1.memoized)((p, iz) => {
7200
+ const toAffineMemo = (0, utils_ts_1.memoized)((p, iz) => {
7175
7201
  const { px: x, py: y, pz: z2 } = p;
7176
7202
  if (Fp.eql(z2, Fp.ONE))
7177
7203
  return { x, y };
@@ -7187,7 +7213,7 @@ var require_weierstrass = __commonJS((exports) => {
7187
7213
  throw new Error("invZ was invalid");
7188
7214
  return { x: ax, y: ay };
7189
7215
  });
7190
- const assertValidMemo = (0, utils_js_1.memoized)((p) => {
7216
+ const assertValidMemo = (0, utils_ts_1.memoized)((p) => {
7191
7217
  if (p.is0()) {
7192
7218
  if (CURVE.allowInfinityPoint && !Fp.is0(p.py))
7193
7219
  return;
@@ -7207,15 +7233,15 @@ var require_weierstrass = __commonJS((exports) => {
7207
7233
 
7208
7234
  class Point {
7209
7235
  constructor(px, py, pz) {
7210
- this.px = px;
7211
- this.py = py;
7212
- this.pz = pz;
7213
7236
  if (px == null || !Fp.isValid(px))
7214
7237
  throw new Error("x required");
7215
7238
  if (py == null || !Fp.isValid(py))
7216
7239
  throw new Error("y required");
7217
7240
  if (pz == null || !Fp.isValid(pz))
7218
7241
  throw new Error("z required");
7242
+ this.px = px;
7243
+ this.py = py;
7244
+ this.pz = pz;
7219
7245
  Object.freeze(this);
7220
7246
  }
7221
7247
  static fromAffine(p) {
@@ -7240,7 +7266,7 @@ var require_weierstrass = __commonJS((exports) => {
7240
7266
  return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);
7241
7267
  }
7242
7268
  static fromHex(hex) {
7243
- const P = Point.fromAffine(fromBytes((0, utils_js_1.ensureBytes)("pointHex", hex)));
7269
+ const P = Point.fromAffine(fromBytes((0, utils_ts_1.ensureBytes)("pointHex", hex)));
7244
7270
  P.assertValidity();
7245
7271
  return P;
7246
7272
  }
@@ -7248,7 +7274,7 @@ var require_weierstrass = __commonJS((exports) => {
7248
7274
  return Point.BASE.multiply(normPrivateKeyToScalar(privateKey));
7249
7275
  }
7250
7276
  static msm(points, scalars) {
7251
- return (0, curve_js_1.pippenger)(Point, Fn, points, scalars);
7277
+ return (0, curve_ts_1.pippenger)(Point, Fn, points, scalars);
7252
7278
  }
7253
7279
  _setWindowSize(windowSize) {
7254
7280
  wnaf.setWindowSize(this, windowSize);
@@ -7263,7 +7289,7 @@ var require_weierstrass = __commonJS((exports) => {
7263
7289
  throw new Error("Field doesn't support isOdd");
7264
7290
  }
7265
7291
  equals(other) {
7266
- assertPrjPoint(other);
7292
+ aprjpoint(other);
7267
7293
  const { px: X1, py: Y1, pz: Z1 } = this;
7268
7294
  const { px: X2, py: Y2, pz: Z2 } = other;
7269
7295
  const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1));
@@ -7312,7 +7338,7 @@ var require_weierstrass = __commonJS((exports) => {
7312
7338
  return new Point(X3, Y3, Z3);
7313
7339
  }
7314
7340
  add(other) {
7315
- assertPrjPoint(other);
7341
+ aprjpoint(other);
7316
7342
  const { px: X1, py: Y1, pz: Z1 } = this;
7317
7343
  const { px: X2, py: Y2, pz: Z2 } = other;
7318
7344
  let { ZERO: X3, ZERO: Y3, ZERO: Z3 } = Fp;
@@ -7371,7 +7397,7 @@ var require_weierstrass = __commonJS((exports) => {
7371
7397
  }
7372
7398
  multiplyUnsafe(sc) {
7373
7399
  const { endo, n: N } = CURVE;
7374
- ut.aInRange("scalar", sc, _0n, N);
7400
+ (0, utils_ts_1.aInRange)("scalar", sc, _0n, N);
7375
7401
  const I = Point.ZERO;
7376
7402
  if (sc === _0n)
7377
7403
  return I;
@@ -7401,7 +7427,7 @@ var require_weierstrass = __commonJS((exports) => {
7401
7427
  }
7402
7428
  multiply(scalar) {
7403
7429
  const { endo, n: N } = CURVE;
7404
- ut.aInRange("scalar", scalar, _1n, N);
7430
+ (0, utils_ts_1.aInRange)("scalar", scalar, _1n, N);
7405
7431
  let point, fake;
7406
7432
  if (endo) {
7407
7433
  const { k1neg, k1, k2neg, k2 } = endo.splitScalar(scalar);
@@ -7445,19 +7471,19 @@ var require_weierstrass = __commonJS((exports) => {
7445
7471
  return this.multiplyUnsafe(CURVE.h);
7446
7472
  }
7447
7473
  toRawBytes(isCompressed = true) {
7448
- (0, utils_js_1.abool)("isCompressed", isCompressed);
7474
+ (0, utils_ts_1.abool)("isCompressed", isCompressed);
7449
7475
  this.assertValidity();
7450
7476
  return toBytes(Point, this, isCompressed);
7451
7477
  }
7452
7478
  toHex(isCompressed = true) {
7453
- (0, utils_js_1.abool)("isCompressed", isCompressed);
7454
- return ut.bytesToHex(this.toRawBytes(isCompressed));
7479
+ (0, utils_ts_1.abool)("isCompressed", isCompressed);
7480
+ return (0, utils_ts_1.bytesToHex)(this.toRawBytes(isCompressed));
7455
7481
  }
7456
7482
  }
7457
7483
  Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);
7458
7484
  Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO);
7459
7485
  const _bits = CURVE.nBitLength;
7460
- const wnaf = (0, curve_js_1.wNAF)(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits);
7486
+ const wnaf = (0, curve_ts_1.wNAF)(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits);
7461
7487
  return {
7462
7488
  CURVE,
7463
7489
  ProjectivePoint: Point,
@@ -7467,8 +7493,8 @@ var require_weierstrass = __commonJS((exports) => {
7467
7493
  };
7468
7494
  }
7469
7495
  function validateOpts(curve) {
7470
- const opts = (0, curve_js_1.validateBasic)(curve);
7471
- ut.validateObject(opts, {
7496
+ const opts = (0, curve_ts_1.validateBasic)(curve);
7497
+ (0, utils_ts_1.validateObject)(opts, {
7472
7498
  hash: "hash",
7473
7499
  hmac: "function",
7474
7500
  randomBytes: "function"
@@ -7485,18 +7511,18 @@ var require_weierstrass = __commonJS((exports) => {
7485
7511
  const compressedLen = Fp.BYTES + 1;
7486
7512
  const uncompressedLen = 2 * Fp.BYTES + 1;
7487
7513
  function modN(a) {
7488
- return (0, modular_js_1.mod)(a, CURVE_ORDER);
7514
+ return (0, modular_ts_1.mod)(a, CURVE_ORDER);
7489
7515
  }
7490
7516
  function invN(a) {
7491
- return (0, modular_js_1.invert)(a, CURVE_ORDER);
7517
+ return (0, modular_ts_1.invert)(a, CURVE_ORDER);
7492
7518
  }
7493
7519
  const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder } = weierstrassPoints({
7494
7520
  ...CURVE,
7495
7521
  toBytes(_c, point, isCompressed) {
7496
7522
  const a = point.toAffine();
7497
7523
  const x = Fp.toBytes(a.x);
7498
- const cat = ut.concatBytes;
7499
- (0, utils_js_1.abool)("isCompressed", isCompressed);
7524
+ const cat = utils_ts_1.concatBytes;
7525
+ (0, utils_ts_1.abool)("isCompressed", isCompressed);
7500
7526
  if (isCompressed) {
7501
7527
  return cat(Uint8Array.from([point.hasEvenY() ? 2 : 3]), x);
7502
7528
  } else {
@@ -7508,8 +7534,8 @@ var require_weierstrass = __commonJS((exports) => {
7508
7534
  const head = bytes[0];
7509
7535
  const tail = bytes.subarray(1);
7510
7536
  if (len === compressedLen && (head === 2 || head === 3)) {
7511
- const x = ut.bytesToNumberBE(tail);
7512
- if (!ut.inRange(x, _1n, Fp.ORDER))
7537
+ const x = (0, utils_ts_1.bytesToNumberBE)(tail);
7538
+ if (!(0, utils_ts_1.inRange)(x, _1n, Fp.ORDER))
7513
7539
  throw new Error("Point is not on curve");
7514
7540
  const y2 = weierstrassEquation(x);
7515
7541
  let y;
@@ -7535,7 +7561,7 @@ var require_weierstrass = __commonJS((exports) => {
7535
7561
  }
7536
7562
  }
7537
7563
  });
7538
- const numToNByteStr = (num) => ut.bytesToHex(ut.numberToBytesBE(num, CURVE.nByteLength));
7564
+ const numToNByteHex = (num) => (0, utils_ts_1.bytesToHex)((0, utils_ts_1.numberToBytesBE)(num, CURVE.nByteLength));
7539
7565
  function isBiggerThanHalfOrder(number) {
7540
7566
  const HALF = CURVE_ORDER >> _1n;
7541
7567
  return number > HALF;
@@ -7543,41 +7569,41 @@ var require_weierstrass = __commonJS((exports) => {
7543
7569
  function normalizeS(s) {
7544
7570
  return isBiggerThanHalfOrder(s) ? modN(-s) : s;
7545
7571
  }
7546
- const slcNum = (b, from, to) => ut.bytesToNumberBE(b.slice(from, to));
7572
+ const slcNum = (b, from, to) => (0, utils_ts_1.bytesToNumberBE)(b.slice(from, to));
7547
7573
 
7548
7574
  class Signature {
7549
7575
  constructor(r, s, recovery) {
7576
+ (0, utils_ts_1.aInRange)("r", r, _1n, CURVE_ORDER);
7577
+ (0, utils_ts_1.aInRange)("s", s, _1n, CURVE_ORDER);
7550
7578
  this.r = r;
7551
7579
  this.s = s;
7552
- this.recovery = recovery;
7553
- this.assertValidity();
7580
+ if (recovery != null)
7581
+ this.recovery = recovery;
7582
+ Object.freeze(this);
7554
7583
  }
7555
7584
  static fromCompact(hex) {
7556
7585
  const l = CURVE.nByteLength;
7557
- hex = (0, utils_js_1.ensureBytes)("compactSignature", hex, l * 2);
7586
+ hex = (0, utils_ts_1.ensureBytes)("compactSignature", hex, l * 2);
7558
7587
  return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l));
7559
7588
  }
7560
7589
  static fromDER(hex) {
7561
- const { r, s } = exports.DER.toSig((0, utils_js_1.ensureBytes)("DER", hex));
7590
+ const { r, s } = exports.DER.toSig((0, utils_ts_1.ensureBytes)("DER", hex));
7562
7591
  return new Signature(r, s);
7563
7592
  }
7564
- assertValidity() {
7565
- ut.aInRange("r", this.r, _1n, CURVE_ORDER);
7566
- ut.aInRange("s", this.s, _1n, CURVE_ORDER);
7567
- }
7593
+ assertValidity() {}
7568
7594
  addRecoveryBit(recovery) {
7569
7595
  return new Signature(this.r, this.s, recovery);
7570
7596
  }
7571
7597
  recoverPublicKey(msgHash) {
7572
7598
  const { r, s, recovery: rec } = this;
7573
- const h = bits2int_modN((0, utils_js_1.ensureBytes)("msgHash", msgHash));
7599
+ const h = bits2int_modN((0, utils_ts_1.ensureBytes)("msgHash", msgHash));
7574
7600
  if (rec == null || ![0, 1, 2, 3].includes(rec))
7575
7601
  throw new Error("recovery id invalid");
7576
7602
  const radj = rec === 2 || rec === 3 ? r + CURVE.n : r;
7577
7603
  if (radj >= Fp.ORDER)
7578
7604
  throw new Error("recovery id 2 or 3 invalid");
7579
7605
  const prefix = (rec & 1) === 0 ? "02" : "03";
7580
- const R = Point.fromHex(prefix + numToNByteStr(radj));
7606
+ const R = Point.fromHex(prefix + numToNByteHex(radj));
7581
7607
  const ir = invN(radj);
7582
7608
  const u1 = modN(-h * ir);
7583
7609
  const u2 = modN(s * ir);
@@ -7594,16 +7620,16 @@ var require_weierstrass = __commonJS((exports) => {
7594
7620
  return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this;
7595
7621
  }
7596
7622
  toDERRawBytes() {
7597
- return ut.hexToBytes(this.toDERHex());
7623
+ return (0, utils_ts_1.hexToBytes)(this.toDERHex());
7598
7624
  }
7599
7625
  toDERHex() {
7600
7626
  return exports.DER.hexFromSig({ r: this.r, s: this.s });
7601
7627
  }
7602
7628
  toCompactRawBytes() {
7603
- return ut.hexToBytes(this.toCompactHex());
7629
+ return (0, utils_ts_1.hexToBytes)(this.toCompactHex());
7604
7630
  }
7605
7631
  toCompactHex() {
7606
- return numToNByteStr(this.r) + numToNByteStr(this.s);
7632
+ return numToNByteHex(this.r) + numToNByteHex(this.s);
7607
7633
  }
7608
7634
  }
7609
7635
  const utils = {
@@ -7617,8 +7643,8 @@ var require_weierstrass = __commonJS((exports) => {
7617
7643
  },
7618
7644
  normPrivateKeyToScalar,
7619
7645
  randomPrivateKey: () => {
7620
- const length = (0, modular_js_1.getMinHashLength)(CURVE.n);
7621
- return (0, modular_js_1.mapHashToField)(CURVE.randomBytes(length), CURVE.n);
7646
+ const length = (0, modular_ts_1.getMinHashLength)(CURVE.n);
7647
+ return (0, modular_ts_1.mapHashToField)(CURVE.randomBytes(length), CURVE.n);
7622
7648
  },
7623
7649
  precompute(windowSize = 8, point = Point.BASE) {
7624
7650
  point._setWindowSize(windowSize);
@@ -7630,7 +7656,7 @@ var require_weierstrass = __commonJS((exports) => {
7630
7656
  return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed);
7631
7657
  }
7632
7658
  function isProbPub(item) {
7633
- const arr = ut.isBytes(item);
7659
+ const arr = (0, utils_ts_1.isBytes)(item);
7634
7660
  const str = typeof item === "string";
7635
7661
  const len = (arr || str) && item.length;
7636
7662
  if (arr)
@@ -7652,17 +7678,17 @@ var require_weierstrass = __commonJS((exports) => {
7652
7678
  const bits2int = CURVE.bits2int || function(bytes) {
7653
7679
  if (bytes.length > 8192)
7654
7680
  throw new Error("input is too large");
7655
- const num = ut.bytesToNumberBE(bytes);
7681
+ const num = (0, utils_ts_1.bytesToNumberBE)(bytes);
7656
7682
  const delta = bytes.length * 8 - CURVE.nBitLength;
7657
7683
  return delta > 0 ? num >> BigInt(delta) : num;
7658
7684
  };
7659
7685
  const bits2int_modN = CURVE.bits2int_modN || function(bytes) {
7660
7686
  return modN(bits2int(bytes));
7661
7687
  };
7662
- const ORDER_MASK = ut.bitMask(CURVE.nBitLength);
7688
+ const ORDER_MASK = (0, utils_ts_1.bitMask)(CURVE.nBitLength);
7663
7689
  function int2octets(num) {
7664
- ut.aInRange("num < 2^" + CURVE.nBitLength, num, _0n, ORDER_MASK);
7665
- return ut.numberToBytesBE(num, CURVE.nByteLength);
7690
+ (0, utils_ts_1.aInRange)("num < 2^" + CURVE.nBitLength, num, _0n, ORDER_MASK);
7691
+ return (0, utils_ts_1.numberToBytesBE)(num, CURVE.nByteLength);
7666
7692
  }
7667
7693
  function prepSig(msgHash, privateKey, opts = defaultSigOpts) {
7668
7694
  if (["recovered", "canonical"].some((k) => (k in opts)))
@@ -7671,18 +7697,18 @@ var require_weierstrass = __commonJS((exports) => {
7671
7697
  let { lowS, prehash, extraEntropy: ent } = opts;
7672
7698
  if (lowS == null)
7673
7699
  lowS = true;
7674
- msgHash = (0, utils_js_1.ensureBytes)("msgHash", msgHash);
7700
+ msgHash = (0, utils_ts_1.ensureBytes)("msgHash", msgHash);
7675
7701
  validateSigVerOpts(opts);
7676
7702
  if (prehash)
7677
- msgHash = (0, utils_js_1.ensureBytes)("prehashed msgHash", hash(msgHash));
7703
+ msgHash = (0, utils_ts_1.ensureBytes)("prehashed msgHash", hash(msgHash));
7678
7704
  const h1int = bits2int_modN(msgHash);
7679
7705
  const d = normPrivateKeyToScalar(privateKey);
7680
7706
  const seedArgs = [int2octets(d), int2octets(h1int)];
7681
7707
  if (ent != null && ent !== false) {
7682
7708
  const e = ent === true ? randomBytes(Fp.BYTES) : ent;
7683
- seedArgs.push((0, utils_js_1.ensureBytes)("extraEntropy", e));
7709
+ seedArgs.push((0, utils_ts_1.ensureBytes)("extraEntropy", e));
7684
7710
  }
7685
- const seed = ut.concatBytes(...seedArgs);
7711
+ const seed = (0, utils_ts_1.concatBytes)(...seedArgs);
7686
7712
  const m = h1int;
7687
7713
  function k2sig(kBytes) {
7688
7714
  const k = bits2int(kBytes);
@@ -7711,21 +7737,21 @@ var require_weierstrass = __commonJS((exports) => {
7711
7737
  function sign(msgHash, privKey, opts = defaultSigOpts) {
7712
7738
  const { seed, k2sig } = prepSig(msgHash, privKey, opts);
7713
7739
  const C = CURVE;
7714
- const drbg = ut.createHmacDrbg(C.hash.outputLen, C.nByteLength, C.hmac);
7740
+ const drbg = (0, utils_ts_1.createHmacDrbg)(C.hash.outputLen, C.nByteLength, C.hmac);
7715
7741
  return drbg(seed, k2sig);
7716
7742
  }
7717
7743
  Point.BASE._setWindowSize(8);
7718
7744
  function verify(signature, msgHash, publicKey, opts = defaultVerOpts) {
7719
7745
  const sg = signature;
7720
- msgHash = (0, utils_js_1.ensureBytes)("msgHash", msgHash);
7721
- publicKey = (0, utils_js_1.ensureBytes)("publicKey", publicKey);
7746
+ msgHash = (0, utils_ts_1.ensureBytes)("msgHash", msgHash);
7747
+ publicKey = (0, utils_ts_1.ensureBytes)("publicKey", publicKey);
7722
7748
  const { lowS, prehash, format: format2 } = opts;
7723
7749
  validateSigVerOpts(opts);
7724
7750
  if ("strict" in opts)
7725
7751
  throw new Error("options.strict was renamed to lowS");
7726
7752
  if (format2 !== undefined && format2 !== "compact" && format2 !== "der")
7727
7753
  throw new Error("format must be compact or der");
7728
- const isHex = typeof sg === "string" || ut.isBytes(sg);
7754
+ const isHex = typeof sg === "string" || (0, utils_ts_1.isBytes)(sg);
7729
7755
  const isObj = !isHex && !format2 && typeof sg === "object" && sg !== null && typeof sg.r === "bigint" && typeof sg.s === "bigint";
7730
7756
  if (!isHex && !isObj)
7731
7757
  throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");
@@ -7840,7 +7866,7 @@ var require_weierstrass = __commonJS((exports) => {
7840
7866
  return sqrtRatio;
7841
7867
  }
7842
7868
  function mapToCurveSimpleSWU(Fp, opts) {
7843
- (0, modular_js_1.validateField)(Fp);
7869
+ (0, modular_ts_1.validateField)(Fp);
7844
7870
  if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z))
7845
7871
  throw new Error("mapToCurveSimpleSWU: invalid opts");
7846
7872
  const sqrtRatio = SWUFpSqrtRatio(Fp, opts.Z);
@@ -7886,7 +7912,7 @@ var require__shortw_utils = __commonJS((exports) => {
7886
7912
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
7887
7913
  var hmac_1 = require_hmac();
7888
7914
  var utils_1 = require_utils4();
7889
- var weierstrass_js_1 = require_weierstrass();
7915
+ var weierstrass_ts_1 = require_weierstrass();
7890
7916
  function getHash(hash) {
7891
7917
  return {
7892
7918
  hash,
@@ -7895,7 +7921,7 @@ var require__shortw_utils = __commonJS((exports) => {
7895
7921
  };
7896
7922
  }
7897
7923
  function createCurve(curveDef, defHash) {
7898
- const create = (hash) => (0, weierstrass_js_1.weierstrass)({ ...curveDef, ...getHash(hash) });
7924
+ const create = (hash) => (0, weierstrass_ts_1.weierstrass)({ ...curveDef, ...getHash(hash) });
7899
7925
  return { ...create(defHash), create };
7900
7926
  }
7901
7927
  });
@@ -7905,13 +7931,13 @@ var require_secp256k1 = __commonJS((exports) => {
7905
7931
  Object.defineProperty(exports, "__esModule", { value: true });
7906
7932
  exports.encodeToCurve = exports.hashToCurve = exports.schnorr = exports.secp256k1 = undefined;
7907
7933
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
7908
- var sha256_1 = require_sha256();
7934
+ var sha2_1 = require_sha2();
7909
7935
  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();
7936
+ var _shortw_utils_ts_1 = require__shortw_utils();
7937
+ var hash_to_curve_ts_1 = require_hash_to_curve();
7938
+ var modular_ts_1 = require_modular();
7939
+ var utils_ts_1 = require_utils5();
7940
+ var weierstrass_ts_1 = require_weierstrass();
7915
7941
  var secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
7916
7942
  var secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
7917
7943
  var _1n = BigInt(1);
@@ -7923,24 +7949,24 @@ var require_secp256k1 = __commonJS((exports) => {
7923
7949
  const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88);
7924
7950
  const b2 = y * y * y % P;
7925
7951
  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);
7952
+ const b6 = (0, modular_ts_1.pow2)(b3, _3n, P) * b3 % P;
7953
+ const b9 = (0, modular_ts_1.pow2)(b6, _3n, P) * b3 % P;
7954
+ const b11 = (0, modular_ts_1.pow2)(b9, _2n, P) * b2 % P;
7955
+ const b22 = (0, modular_ts_1.pow2)(b11, _11n, P) * b11 % P;
7956
+ const b44 = (0, modular_ts_1.pow2)(b22, _22n, P) * b22 % P;
7957
+ const b88 = (0, modular_ts_1.pow2)(b44, _44n, P) * b44 % P;
7958
+ const b176 = (0, modular_ts_1.pow2)(b88, _88n, P) * b88 % P;
7959
+ const b220 = (0, modular_ts_1.pow2)(b176, _44n, P) * b44 % P;
7960
+ const b223 = (0, modular_ts_1.pow2)(b220, _3n, P) * b3 % P;
7961
+ const t1 = (0, modular_ts_1.pow2)(b223, _23n, P) * b22 % P;
7962
+ const t2 = (0, modular_ts_1.pow2)(t1, _6n, P) * b2 % P;
7963
+ const root = (0, modular_ts_1.pow2)(t2, _2n, P);
7938
7964
  if (!Fpk1.eql(Fpk1.sqr(root), y))
7939
7965
  throw new Error("Cannot find square root");
7940
7966
  return root;
7941
7967
  }
7942
- var Fpk1 = (0, modular_js_1.Field)(secp256k1P, undefined, undefined, { sqrt: sqrtMod });
7943
- exports.secp256k1 = (0, _shortw_utils_js_1.createCurve)({
7968
+ var Fpk1 = (0, modular_ts_1.Field)(secp256k1P, undefined, undefined, { sqrt: sqrtMod });
7969
+ exports.secp256k1 = (0, _shortw_utils_ts_1.createCurve)({
7944
7970
  a: BigInt(0),
7945
7971
  b: BigInt(7),
7946
7972
  Fp: Fpk1,
@@ -7960,8 +7986,8 @@ var require_secp256k1 = __commonJS((exports) => {
7960
7986
  const POW_2_128 = BigInt("0x100000000000000000000000000000000");
7961
7987
  const c1 = divNearest(b2 * k, n);
7962
7988
  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);
7989
+ let k1 = (0, modular_ts_1.mod)(k - c1 * a1 - c2 * a2, n);
7990
+ let k2 = (0, modular_ts_1.mod)(-c1 * b1 - c2 * b2, n);
7965
7991
  const k1neg = k1 > POW_2_128;
7966
7992
  const k2neg = k2 > POW_2_128;
7967
7993
  if (k1neg)
@@ -7974,22 +8000,22 @@ var require_secp256k1 = __commonJS((exports) => {
7974
8000
  return { k1neg, k1, k2neg, k2 };
7975
8001
  }
7976
8002
  }
7977
- }, sha256_1.sha256);
8003
+ }, sha2_1.sha256);
7978
8004
  var _0n = BigInt(0);
7979
8005
  var TAGGED_HASH_PREFIXES = {};
7980
8006
  function taggedHash(tag, ...messages) {
7981
8007
  let tagP = TAGGED_HASH_PREFIXES[tag];
7982
8008
  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);
8009
+ const tagH = (0, sha2_1.sha256)(Uint8Array.from(tag, (c) => c.charCodeAt(0)));
8010
+ tagP = (0, utils_ts_1.concatBytes)(tagH, tagH);
7985
8011
  TAGGED_HASH_PREFIXES[tag] = tagP;
7986
8012
  }
7987
- return (0, sha256_1.sha256)((0, utils_js_1.concatBytes)(tagP, ...messages));
8013
+ return (0, sha2_1.sha256)((0, utils_ts_1.concatBytes)(tagP, ...messages));
7988
8014
  }
7989
8015
  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);
8016
+ var numTo32b = (n) => (0, utils_ts_1.numberToBytesBE)(n, 32);
8017
+ var modP = (x) => (0, modular_ts_1.mod)(x, secp256k1P);
8018
+ var modN = (x) => (0, modular_ts_1.mod)(x, secp256k1N);
7993
8019
  var Point = exports.secp256k1.ProjectivePoint;
7994
8020
  var GmulAdd = (Q, a, b) => Point.BASE.multiplyAndAddUnsafe(Q, a, b);
7995
8021
  function schnorrGetExtPubKey(priv) {
@@ -7999,7 +8025,7 @@ var require_secp256k1 = __commonJS((exports) => {
7999
8025
  return { scalar, bytes: pointToBytes(p) };
8000
8026
  }
8001
8027
  function lift_x(x) {
8002
- (0, utils_js_1.aInRange)("x", x, _1n, secp256k1P);
8028
+ (0, utils_ts_1.aInRange)("x", x, _1n, secp256k1P);
8003
8029
  const xx = modP(x * x);
8004
8030
  const c = modP(xx * x + BigInt(7));
8005
8031
  let y = sqrtMod(c);
@@ -8009,7 +8035,7 @@ var require_secp256k1 = __commonJS((exports) => {
8009
8035
  p.assertValidity();
8010
8036
  return p;
8011
8037
  }
8012
- var num = utils_js_1.bytesToNumberBE;
8038
+ var num = utils_ts_1.bytesToNumberBE;
8013
8039
  function challenge(...args) {
8014
8040
  return modN(num(taggedHash("BIP0340/challenge", ...args)));
8015
8041
  }
@@ -8017,9 +8043,9 @@ var require_secp256k1 = __commonJS((exports) => {
8017
8043
  return schnorrGetExtPubKey(privateKey).bytes;
8018
8044
  }
8019
8045
  function schnorrSign(message, privateKey, auxRand = (0, utils_1.randomBytes)(32)) {
8020
- const m = (0, utils_js_1.ensureBytes)("message", message);
8046
+ const m = (0, utils_ts_1.ensureBytes)("message", message);
8021
8047
  const { bytes: px, scalar: d } = schnorrGetExtPubKey(privateKey);
8022
- const a = (0, utils_js_1.ensureBytes)("auxRand", auxRand, 32);
8048
+ const a = (0, utils_ts_1.ensureBytes)("auxRand", auxRand, 32);
8023
8049
  const t = numTo32b(d ^ num(taggedHash("BIP0340/aux", a)));
8024
8050
  const rand = taggedHash("BIP0340/nonce", t, px, m);
8025
8051
  const k_ = modN(num(rand));
@@ -8035,16 +8061,16 @@ var require_secp256k1 = __commonJS((exports) => {
8035
8061
  return sig;
8036
8062
  }
8037
8063
  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);
8064
+ const sig = (0, utils_ts_1.ensureBytes)("signature", signature, 64);
8065
+ const m = (0, utils_ts_1.ensureBytes)("message", message);
8066
+ const pub = (0, utils_ts_1.ensureBytes)("publicKey", publicKey, 32);
8041
8067
  try {
8042
8068
  const P = lift_x(num(pub));
8043
8069
  const r = num(sig.subarray(0, 32));
8044
- if (!(0, utils_js_1.inRange)(r, _1n, secp256k1P))
8070
+ if (!(0, utils_ts_1.inRange)(r, _1n, secp256k1P))
8045
8071
  return false;
8046
8072
  const s = num(sig.subarray(32, 64));
8047
- if (!(0, utils_js_1.inRange)(s, _1n, secp256k1N))
8073
+ if (!(0, utils_ts_1.inRange)(s, _1n, secp256k1N))
8048
8074
  return false;
8049
8075
  const e = challenge(numTo32b(r), pointToBytes(P), m);
8050
8076
  const R = GmulAdd(P, s, modN(-e));
@@ -8063,13 +8089,13 @@ var require_secp256k1 = __commonJS((exports) => {
8063
8089
  randomPrivateKey: exports.secp256k1.utils.randomPrivateKey,
8064
8090
  lift_x,
8065
8091
  pointToBytes,
8066
- numberToBytesBE: utils_js_1.numberToBytesBE,
8067
- bytesToNumberBE: utils_js_1.bytesToNumberBE,
8092
+ numberToBytesBE: utils_ts_1.numberToBytesBE,
8093
+ bytesToNumberBE: utils_ts_1.bytesToNumberBE,
8068
8094
  taggedHash,
8069
- mod: modular_js_1.mod
8095
+ mod: modular_ts_1.mod
8070
8096
  }
8071
8097
  }))();
8072
- var isoMap = /* @__PURE__ */ (() => (0, hash_to_curve_js_1.isogenyMap)(Fpk1, [
8098
+ var isoMap = /* @__PURE__ */ (() => (0, hash_to_curve_ts_1.isogenyMap)(Fpk1, [
8073
8099
  [
8074
8100
  "0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7",
8075
8101
  "0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581",
@@ -8094,12 +8120,12 @@ var require_secp256k1 = __commonJS((exports) => {
8094
8120
  "0x0000000000000000000000000000000000000000000000000000000000000001"
8095
8121
  ]
8096
8122
  ].map((i) => i.map((j) => BigInt(j)))))();
8097
- var mapSWU = /* @__PURE__ */ (() => (0, weierstrass_js_1.mapToCurveSimpleSWU)(Fpk1, {
8123
+ var mapSWU = /* @__PURE__ */ (() => (0, weierstrass_ts_1.mapToCurveSimpleSWU)(Fpk1, {
8098
8124
  A: BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),
8099
8125
  B: BigInt("1771"),
8100
8126
  Z: Fpk1.create(BigInt("-11"))
8101
8127
  }))();
8102
- var htf = /* @__PURE__ */ (() => (0, hash_to_curve_js_1.createHasher)(exports.secp256k1.ProjectivePoint, (scalars) => {
8128
+ var htf = /* @__PURE__ */ (() => (0, hash_to_curve_ts_1.createHasher)(exports.secp256k1.ProjectivePoint, (scalars) => {
8103
8129
  const { x, y } = mapSWU(Fpk1.create(scalars[0]));
8104
8130
  return isoMap(x, y);
8105
8131
  }, {
@@ -8109,7 +8135,7 @@ var require_secp256k1 = __commonJS((exports) => {
8109
8135
  m: 1,
8110
8136
  k: 128,
8111
8137
  expand: "xmd",
8112
- hash: sha256_1.sha256
8138
+ hash: sha2_1.sha256
8113
8139
  }))();
8114
8140
  exports.hashToCurve = (() => htf.hashToCurve)();
8115
8141
  exports.encodeToCurve = (() => htf.encodeToCurve)();
@@ -8232,27 +8258,27 @@ var require_hkdf = __commonJS((exports) => {
8232
8258
  exports.hkdf = undefined;
8233
8259
  exports.extract = extract;
8234
8260
  exports.expand = expand;
8235
- var _assert_js_1 = require__assert2();
8236
- var hmac_js_1 = require_hmac();
8237
- var utils_js_1 = require_utils4();
8261
+ var _assert_ts_1 = require__assert();
8262
+ var hmac_ts_1 = require_hmac();
8263
+ var utils_ts_1 = require_utils4();
8238
8264
  function extract(hash, ikm, salt) {
8239
- (0, _assert_js_1.ahash)(hash);
8265
+ (0, _assert_ts_1.ahash)(hash);
8240
8266
  if (salt === undefined)
8241
8267
  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));
8268
+ return (0, hmac_ts_1.hmac)(hash, (0, utils_ts_1.toBytes)(salt), (0, utils_ts_1.toBytes)(ikm));
8243
8269
  }
8244
8270
  var HKDF_COUNTER = /* @__PURE__ */ new Uint8Array([0]);
8245
8271
  var EMPTY_BUFFER = /* @__PURE__ */ new Uint8Array;
8246
8272
  function expand(hash, prk, info, length = 32) {
8247
- (0, _assert_js_1.ahash)(hash);
8248
- (0, _assert_js_1.anumber)(length);
8273
+ (0, _assert_ts_1.ahash)(hash);
8274
+ (0, _assert_ts_1.anumber)(length);
8249
8275
  if (length > 255 * hash.outputLen)
8250
8276
  throw new Error("Length should be <= 255*HashLen");
8251
8277
  const blocks = Math.ceil(length / hash.outputLen);
8252
8278
  if (info === undefined)
8253
8279
  info = EMPTY_BUFFER;
8254
8280
  const okm = new Uint8Array(blocks * hash.outputLen);
8255
- const HMAC = hmac_js_1.hmac.create(hash, prk);
8281
+ const HMAC = hmac_ts_1.hmac.create(hash, prk);
8256
8282
  const HMACTmp = HMAC._cloneInto();
8257
8283
  const T = new Uint8Array(HMAC.outputLen);
8258
8284
  for (let counter = 0;counter < blocks; counter++) {
@@ -9088,7 +9114,7 @@ var require_parse2 = __commonJS((exports, module) => {
9088
9114
  // ../../node_modules/@dotenvx/dotenvx/src/lib/helpers/dotenvParse.js
9089
9115
  var require_dotenvParse = __commonJS((exports, module) => {
9090
9116
  var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
9091
- function dotenvParse(src, skipExpandForDoubleQuotes = false, skipConvertingWindowsNewlines = false) {
9117
+ function dotenvParse(src, skipExpandForDoubleQuotes = false, skipConvertingWindowsNewlines = false, collectAllValues = false) {
9092
9118
  const obj = {};
9093
9119
  let lines = src.toString();
9094
9120
  if (!skipConvertingWindowsNewlines) {
@@ -9108,7 +9134,12 @@ var require_dotenvParse = __commonJS((exports, module) => {
9108
9134
  value = value.replace(/\\r/g, "\r");
9109
9135
  value = value.replace(/\\t/g, "\t");
9110
9136
  }
9111
- obj[key] = value;
9137
+ if (collectAllValues) {
9138
+ obj[key] = obj[key] || [];
9139
+ obj[key].push(value);
9140
+ } else {
9141
+ obj[key] = value;
9142
+ }
9112
9143
  }
9113
9144
  return obj;
9114
9145
  }
@@ -31162,6 +31193,23 @@ var require_lib4 = __commonJS((exports, module) => {
31162
31193
  var fromUrl = require_from_url();
31163
31194
  var parseUrl = require_parse_url();
31164
31195
  var cache = new LRUCache2({ max: 1000 });
31196
+ function unknownHostedUrl(url) {
31197
+ try {
31198
+ const {
31199
+ protocol,
31200
+ hostname,
31201
+ pathname
31202
+ } = new URL(url);
31203
+ if (!hostname) {
31204
+ return null;
31205
+ }
31206
+ const proto = /(?:git\+)http:$/.test(protocol) ? "http:" : "https:";
31207
+ const path6 = pathname.replace(/\.git$/, "");
31208
+ return `${proto}//${hostname}${path6}`;
31209
+ } catch {
31210
+ return null;
31211
+ }
31212
+ }
31165
31213
 
31166
31214
  class GitHost {
31167
31215
  constructor(type2, user, auth, project, committish, defaultRepresentation, opts = {}) {
@@ -31205,6 +31253,22 @@ var require_lib4 = __commonJS((exports, module) => {
31205
31253
  }
31206
31254
  return cache.get(key2);
31207
31255
  }
31256
+ static fromManifest(manifest, opts = {}) {
31257
+ if (!manifest || typeof manifest !== "object") {
31258
+ return;
31259
+ }
31260
+ const r2 = manifest.repository;
31261
+ const rurl = r2 && (typeof r2 === "string" ? r2 : typeof r2 === "object" && typeof r2.url === "string" ? r2.url : null);
31262
+ if (!rurl) {
31263
+ throw new Error("no repository");
31264
+ }
31265
+ const info = rurl && GitHost.fromUrl(rurl.replace(/^git\+/, ""), opts) || null;
31266
+ if (info) {
31267
+ return info;
31268
+ }
31269
+ const unk = unknownHostedUrl(rurl);
31270
+ return GitHost.fromUrl(unk, opts) || unk;
31271
+ }
31208
31272
  static parseUrl(url) {
31209
31273
  return parseUrl(url);
31210
31274
  }
@@ -235068,7 +235132,7 @@ var is_in_ci_default = isInCi;
235068
235132
  // ../../node_modules/yocto-spinner/index.js
235069
235133
  import process2 from "node:process";
235070
235134
  import { stripVTControlCharacters } from "node:util";
235071
- var isUnicodeSupported = process2.platform !== "win32" || Boolean(process2.env.WT_SESSION);
235135
+ var isUnicodeSupported = process2.platform !== "win32" || Boolean(process2.env.WT_SESSION) || process2.env.TERM_PROGRAM === "vscode";
235072
235136
  var isInteractive = (stream) => Boolean(stream.isTTY && process2.env.TERM !== "dumb" && !("CI" in process2.env));
235073
235137
  var infoSymbol = exports_base.blue(isUnicodeSupported ? "ℹ" : "i");
235074
235138
  var successSymbol = exports_base.green(isUnicodeSupported ? "✔" : "√");
@@ -245084,8 +245148,11 @@ var DotEnvSchema = z.object({
245084
245148
  SETTLEMINT_WORKSPACE: UniqueNameSchema.optional(),
245085
245149
  SETTLEMINT_APPLICATION: UniqueNameSchema.optional(),
245086
245150
  SETTLEMINT_BLOCKCHAIN_NETWORK: UniqueNameSchema.optional(),
245151
+ SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID: z.string().optional(),
245087
245152
  SETTLEMINT_BLOCKCHAIN_NODE: UniqueNameSchema.optional(),
245088
- SETTLEMINT_LOAD_BALANCER: UniqueNameSchema.optional(),
245153
+ SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT: UrlSchema.optional(),
245154
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: UniqueNameSchema.optional(),
245155
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT: UrlSchema.optional(),
245089
245156
  SETTLEMINT_HASURA: UniqueNameSchema.optional(),
245090
245157
  SETTLEMINT_HASURA_ENDPOINT: UrlSchema.optional(),
245091
245158
  SETTLEMINT_HASURA_ADMIN_SECRET: z.string().optional(),
@@ -245278,7 +245345,7 @@ function pruneCurrentEnv(currentEnv, env2) {
245278
245345
  var package_default = {
245279
245346
  name: "@settlemint/sdk-cli",
245280
245347
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
245281
- version: "2.1.4-pr75b87279",
245348
+ version: "2.1.4-pr77f5143c",
245282
245349
  type: "module",
245283
245350
  private: false,
245284
245351
  license: "FSL-1.1-MIT",
@@ -245327,8 +245394,8 @@ var package_default = {
245327
245394
  "@inquirer/input": "4.1.9",
245328
245395
  "@inquirer/password": "4.0.12",
245329
245396
  "@inquirer/select": "4.1.1",
245330
- "@settlemint/sdk-js": "2.1.4-pr75b87279",
245331
- "@settlemint/sdk-utils": "2.1.4-pr75b87279",
245397
+ "@settlemint/sdk-js": "2.1.4-pr77f5143c",
245398
+ "@settlemint/sdk-utils": "2.1.4-pr77f5143c",
245332
245399
  "@types/node": "22.14.1",
245333
245400
  "@types/semver": "7.7.0",
245334
245401
  "@types/which": "3.0.4",
@@ -246504,6 +246571,13 @@ var cancel2 = (msg) => {
246504
246571
  console.log("");
246505
246572
  throw new CancelError2(msg);
246506
246573
  };
246574
+ var CommandError = class extends Error {
246575
+ constructor(message, code, output) {
246576
+ super(message);
246577
+ this.code = code;
246578
+ this.output = output;
246579
+ }
246580
+ };
246507
246581
  async function executeCommand(command, args, options) {
246508
246582
  const child = spawn(command, args, { env: { ...process.env, ...options?.env } });
246509
246583
  process.stdin.pipe(child.stdin);
@@ -246523,14 +246597,14 @@ async function executeCommand(command, args, options) {
246523
246597
  }
246524
246598
  output.push(maskedData);
246525
246599
  });
246526
- child.on("error", (err) => reject(err));
246600
+ child.on("error", (err) => reject(new CommandError(err.message, "code" in err && typeof err.code === "number" ? err.code : 1, output)));
246527
246601
  child.on("close", (code) => {
246528
246602
  if (code === 0 || code === null || code === 143) {
246529
246603
  process.stdin.unpipe(child.stdin);
246530
246604
  resolve(output);
246531
246605
  return;
246532
246606
  }
246533
- reject(new Error(`Command "${command}" exited with code ${code}`));
246607
+ reject(new CommandError(`Command "${command}" exited with code ${code}`, code, output));
246534
246608
  });
246535
246609
  });
246536
246610
  }
@@ -246741,8 +246815,11 @@ var DotEnvSchema2 = z.object({
246741
246815
  SETTLEMINT_WORKSPACE: UniqueNameSchema2.optional(),
246742
246816
  SETTLEMINT_APPLICATION: UniqueNameSchema2.optional(),
246743
246817
  SETTLEMINT_BLOCKCHAIN_NETWORK: UniqueNameSchema2.optional(),
246818
+ SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID: z.string().optional(),
246744
246819
  SETTLEMINT_BLOCKCHAIN_NODE: UniqueNameSchema2.optional(),
246745
- SETTLEMINT_LOAD_BALANCER: UniqueNameSchema2.optional(),
246820
+ SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT: UrlSchema2.optional(),
246821
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: UniqueNameSchema2.optional(),
246822
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT: UrlSchema2.optional(),
246746
246823
  SETTLEMINT_HASURA: UniqueNameSchema2.optional(),
246747
246824
  SETTLEMINT_HASURA_ENDPOINT: UrlSchema2.optional(),
246748
246825
  SETTLEMINT_HASURA_ADMIN_SECRET: z.string().optional(),
@@ -247641,11 +247718,61 @@ var BlockchainNetworkFragment = graphql(`
247641
247718
  healthStatus
247642
247719
  provider
247643
247720
  region
247721
+ ... on BesuQBFTBlockchainNetwork {
247722
+ chainId
247723
+ }
247724
+ ... on BesuIbftv2BlockchainNetwork {
247725
+ chainId
247726
+ }
247727
+ ... on GethPoWBlockchainNetwork {
247728
+ chainId
247729
+ }
247730
+ ... on GethPoSRinkebyBlockchainNetwork {
247731
+ chainId
247732
+ }
247733
+ ... on GethVenidiumBlockchainNetwork {
247734
+ chainId
247735
+ }
247736
+ ... on GethGoerliBlockchainNetwork {
247737
+ chainId
247738
+ }
247739
+ ... on AvalancheBlockchainNetwork {
247740
+ chainId
247741
+ }
247742
+ ... on AvalancheFujiBlockchainNetwork {
247743
+ chainId
247744
+ }
247745
+ ... on BscPoWBlockchainNetwork {
247746
+ chainId
247747
+ }
247748
+ ... on BscPoWTestnetBlockchainNetwork {
247749
+ chainId
247750
+ }
247751
+ ... on PolygonBlockchainNetwork {
247752
+ chainId
247753
+ }
247754
+ ... on PolygonMumbaiBlockchainNetwork {
247755
+ chainId
247756
+ }
247757
+ ... on PolygonEdgePoABlockchainNetwork {
247758
+ chainId
247759
+ }
247760
+ ... on QuorumQBFTBlockchainNetwork {
247761
+ chainId
247762
+ }
247763
+ ... on GethCliqueBlockchainNetwork {
247764
+ chainId
247765
+ }
247644
247766
  blockchainNodes {
247645
247767
  ... on BlockchainNode {
247646
247768
  id
247647
247769
  name
247648
247770
  uniqueName
247771
+ endpoints {
247772
+ id
247773
+ label
247774
+ displayValue
247775
+ }
247649
247776
  }
247650
247777
  }
247651
247778
  }
@@ -247807,6 +247934,51 @@ var BlockchainNodeFragment = graphql(`
247807
247934
  id
247808
247935
  name
247809
247936
  uniqueName
247937
+ ... on BesuQBFTBlockchainNetwork {
247938
+ chainId
247939
+ }
247940
+ ... on BesuIbftv2BlockchainNetwork {
247941
+ chainId
247942
+ }
247943
+ ... on GethPoWBlockchainNetwork {
247944
+ chainId
247945
+ }
247946
+ ... on GethPoSRinkebyBlockchainNetwork {
247947
+ chainId
247948
+ }
247949
+ ... on GethVenidiumBlockchainNetwork {
247950
+ chainId
247951
+ }
247952
+ ... on GethGoerliBlockchainNetwork {
247953
+ chainId
247954
+ }
247955
+ ... on AvalancheBlockchainNetwork {
247956
+ chainId
247957
+ }
247958
+ ... on AvalancheFujiBlockchainNetwork {
247959
+ chainId
247960
+ }
247961
+ ... on BscPoWBlockchainNetwork {
247962
+ chainId
247963
+ }
247964
+ ... on BscPoWTestnetBlockchainNetwork {
247965
+ chainId
247966
+ }
247967
+ ... on PolygonBlockchainNetwork {
247968
+ chainId
247969
+ }
247970
+ ... on PolygonMumbaiBlockchainNetwork {
247971
+ chainId
247972
+ }
247973
+ ... on PolygonEdgePoABlockchainNetwork {
247974
+ chainId
247975
+ }
247976
+ ... on QuorumQBFTBlockchainNetwork {
247977
+ chainId
247978
+ }
247979
+ ... on GethCliqueBlockchainNetwork {
247980
+ chainId
247981
+ }
247810
247982
  }
247811
247983
  }
247812
247984
  privateKeys {
@@ -248043,6 +248215,7 @@ var getEnv = (gqlClient) => {
248043
248215
  };
248044
248216
  var LoadBalancerFragment = graphql(`
248045
248217
  fragment LoadBalancer on LoadBalancer {
248218
+ __typename
248046
248219
  id
248047
248220
  uniqueName
248048
248221
  name
@@ -248050,6 +248223,11 @@ var LoadBalancerFragment = graphql(`
248050
248223
  healthStatus
248051
248224
  provider
248052
248225
  region
248226
+ endpoints {
248227
+ id
248228
+ label
248229
+ displayValue
248230
+ }
248053
248231
  }
248054
248232
  `);
248055
248233
  var getLoadBalancer = graphql(`
@@ -248059,6 +248237,47 @@ var getLoadBalancer = graphql(`
248059
248237
  }
248060
248238
  }
248061
248239
  `, [LoadBalancerFragment]);
248240
+ var getLoadBalancers = graphql(`
248241
+ query getLoadBalancers($applicationUniqueName: String!) {
248242
+ loadBalancersByUniqueName(applicationUniqueName: $applicationUniqueName) {
248243
+ items {
248244
+ ...LoadBalancer
248245
+ }
248246
+ }
248247
+ }
248248
+ `, [LoadBalancerFragment]);
248249
+ var createLoadBalancer = graphql(`
248250
+ mutation createLoadBalancer(
248251
+ $applicationId: ID!
248252
+ $blockchainNetworkId: ID!
248253
+ $name: String!
248254
+ $provider: String!
248255
+ $region: String!
248256
+ $size: ClusterServiceSize
248257
+ $type: ClusterServiceType
248258
+ $connectedNodes: [ID!]!
248259
+ ) {
248260
+ createLoadBalancer(
248261
+ applicationId: $applicationId
248262
+ blockchainNetworkId: $blockchainNetworkId
248263
+ name: $name
248264
+ provider: $provider
248265
+ region: $region
248266
+ size: $size
248267
+ type: $type
248268
+ connectedNodes: $connectedNodes
248269
+ ) {
248270
+ ...LoadBalancer
248271
+ }
248272
+ }
248273
+ `, [LoadBalancerFragment]);
248274
+ var restartLoadBalancer = graphql(`
248275
+ mutation RestartLoadBalancer($uniqueName: String!) {
248276
+ restartLoadBalancerByUniqueName(uniqueName: $uniqueName) {
248277
+ ...LoadBalancer
248278
+ }
248279
+ }
248280
+ `, [LoadBalancerFragment]);
248062
248281
  var loadBalancerRead = (gqlClient) => {
248063
248282
  return async (loadBalancerUniqueName) => {
248064
248283
  const { loadBalancerByUniqueName: loadBalancer } = await gqlClient.request(getLoadBalancer, {
@@ -248067,6 +248286,37 @@ var loadBalancerRead = (gqlClient) => {
248067
248286
  return loadBalancer;
248068
248287
  };
248069
248288
  };
248289
+ var loadBalancerList = (gqlClient) => {
248290
+ return async (applicationUniqueName) => {
248291
+ const {
248292
+ loadBalancersByUniqueName: { items }
248293
+ } = await gqlClient.request(getLoadBalancers, { applicationUniqueName });
248294
+ return items;
248295
+ };
248296
+ };
248297
+ var loadBalancerCreate = (gqlClient) => {
248298
+ return async (args) => {
248299
+ const { applicationUniqueName, blockchainNetworkUniqueName, connectedNodesUniqueNames, ...otherArgs } = args;
248300
+ const [application, blockchainNetwork, connectedNodes] = await Promise.all([
248301
+ applicationRead(gqlClient)(applicationUniqueName),
248302
+ blockchainNetworkRead(gqlClient)(blockchainNetworkUniqueName),
248303
+ Promise.all(connectedNodesUniqueNames.map((uniqueName) => blockchainNodeRead(gqlClient)(uniqueName)))
248304
+ ]);
248305
+ const { createLoadBalancer: loadBalancer } = await gqlClient.request(createLoadBalancer, {
248306
+ ...otherArgs,
248307
+ applicationId: application.id,
248308
+ blockchainNetworkId: blockchainNetwork.id,
248309
+ connectedNodes: connectedNodes.map((node) => node.id)
248310
+ });
248311
+ return loadBalancer;
248312
+ };
248313
+ };
248314
+ var loadBalancerRestart = (gqlClient) => async (loadBalancerUniqueName) => {
248315
+ const { restartLoadBalancerByUniqueName: loadBalancer } = await gqlClient.request(restartLoadBalancer, {
248316
+ uniqueName: loadBalancerUniqueName
248317
+ });
248318
+ return loadBalancer;
248319
+ };
248070
248320
  var InsightsFragment = graphql(`
248071
248321
  fragment Insights on Insights {
248072
248322
  __typename
@@ -248767,6 +249017,12 @@ function createSettleMintClient(options) {
248767
249017
  create: blockchainNodeCreate(gqlClient),
248768
249018
  restart: blockchainNodeRestart(gqlClient)
248769
249019
  },
249020
+ loadBalancer: {
249021
+ list: loadBalancerList(gqlClient),
249022
+ read: loadBalancerRead(gqlClient),
249023
+ create: loadBalancerCreate(gqlClient),
249024
+ restart: loadBalancerRestart(gqlClient)
249025
+ },
248770
249026
  middleware: {
248771
249027
  list: middlewareList(gqlClient),
248772
249028
  read: middlewareRead(gqlClient),
@@ -248851,6 +249107,7 @@ var LOCKS = {
248851
249107
  "bun.lockb": "bun",
248852
249108
  "deno.lock": "deno",
248853
249109
  "pnpm-lock.yaml": "pnpm",
249110
+ "pnpm-workspace.yaml": "pnpm",
248854
249111
  "yarn.lock": "yarn",
248855
249112
  "package-lock.json": "npm",
248856
249113
  "npm-shrinkwrap.json": "npm"
@@ -249841,6 +250098,16 @@ function tryParseJson3(value2, defaultValue = null) {
249841
250098
  return defaultValue;
249842
250099
  }
249843
250100
  }
250101
+ function extractJsonObject(value2) {
250102
+ if (value2.length > 5000) {
250103
+ throw new Error("Input too long");
250104
+ }
250105
+ const result = /\{([\s\S]*)\}/.exec(value2);
250106
+ if (!result) {
250107
+ return null;
250108
+ }
250109
+ return tryParseJson3(result[0]);
250110
+ }
249844
250111
  async function retryWhenFailed2(fn, maxRetries = 5, initialSleepTime = 1000, stopOnError) {
249845
250112
  let attempt = 0;
249846
250113
  while (attempt < maxRetries) {
@@ -250141,7 +250408,7 @@ export const postgresPool = createPostgresPool(process.env.SETTLEMINT_HASURA_DAT
250141
250408
  await installDependencies(PACKAGE_NAME, projectDir);
250142
250409
  }
250143
250410
  if (!databaseUrl) {
250144
- console.warn("[Codegen] Missing database environment variables");
250411
+ note("[Codegen] Missing database environment variables", "warn");
250145
250412
  }
250146
250413
  }
250147
250414
 
@@ -251604,7 +251871,13 @@ async function subgraphPrompt({
251604
251871
  if (env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH) {
251605
251872
  return [env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH];
251606
251873
  }
251607
- return subgraphNames.length === 1 ? subgraphNames : [];
251874
+ if (subgraphNames.length === 1) {
251875
+ return subgraphNames;
251876
+ }
251877
+ if (subgraphNames.includes("kit")) {
251878
+ return ["kit"];
251879
+ }
251880
+ return [];
251608
251881
  }
251609
251882
  if (!allowNew) {
251610
251883
  if (subgraphNames.length === 0) {
@@ -251698,6 +251971,7 @@ async function codegenBlockscout(env2) {
251698
251971
  __schema {
251699
251972
  queryType { name }
251700
251973
  mutationType { name }
251974
+ subscriptionType { name }
251701
251975
  types {
251702
251976
  ...FullType
251703
251977
  }
@@ -251779,10 +252053,6 @@ async function codegenBlockscout(env2) {
251779
252053
  ofType {
251780
252054
  kind
251781
252055
  name
251782
- ofType {
251783
- kind
251784
- name
251785
- }
251786
252056
  }
251787
252057
  }
251788
252058
  }
@@ -251792,7 +252062,8 @@ async function codegenBlockscout(env2) {
251792
252062
  }
251793
252063
  }
251794
252064
  }
251795
- `
252065
+ `,
252066
+ operationName: "IntrospectionQuery"
251796
252067
  })
251797
252068
  });
251798
252069
  await writeFile6(introspectionJsonPath, JSON.stringify(data));
@@ -251900,9 +252171,72 @@ export const { client } = createServerMinioClient({
251900
252171
  }
251901
252172
  }
251902
252173
 
252174
+ // src/commands/codegen/codegen-viem.ts
252175
+ var PACKAGE_NAME7 = "@settlemint/sdk-viem";
252176
+ async function codegenViem(env2) {
252177
+ const chainId = env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID;
252178
+ if (!chainId) {
252179
+ note("[Codegen] No chain ID found, skipping Viem resources generation", "warn");
252180
+ return;
252181
+ }
252182
+ const loadBalancerRpcEndpoint = env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT;
252183
+ const blockchainNodeRpcEndpoint = env2.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT;
252184
+ if (!loadBalancerRpcEndpoint && !blockchainNodeRpcEndpoint) {
252185
+ note("[Codegen] No RPC endpoints found, skipping Viem resources generation", "warn");
252186
+ return;
252187
+ }
252188
+ const projectDir = await projectRoot3();
252189
+ if (!await isPackageInstalled(PACKAGE_NAME7, projectDir)) {
252190
+ await installDependencies(PACKAGE_NAME7, projectDir);
252191
+ }
252192
+ const imports = [];
252193
+ if (loadBalancerRpcEndpoint) {
252194
+ imports.push("getPublicClient");
252195
+ }
252196
+ if (blockchainNodeRpcEndpoint) {
252197
+ imports.push("getWalletClient");
252198
+ }
252199
+ const viemTemplate = [`import { ${imports.join(", ")} } from "${PACKAGE_NAME7}";`];
252200
+ if (loadBalancerRpcEndpoint) {
252201
+ viemTemplate.push(`
252202
+ /**
252203
+ * The public client. Use this if you need to read from the blockchain.
252204
+ */
252205
+ export const publicClient = getPublicClient({
252206
+ chainId: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!,
252207
+ chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,
252208
+ rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT!,
252209
+ });`);
252210
+ }
252211
+ if (blockchainNodeRpcEndpoint) {
252212
+ viemTemplate.push(`
252213
+ /**
252214
+ * The wallet client. Use this if you need to write to the blockchain.
252215
+ */
252216
+ export const walletClient = getWalletClient({
252217
+ chainId: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!,
252218
+ chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,
252219
+ rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT!,
252220
+ })();
252221
+
252222
+ /**
252223
+ * The wallet client for HD wallets. Use this if you need to write to the blockchain.
252224
+ * HD wallets require a challenge response to be sent with the request.
252225
+ */
252226
+ export const hdWalletClient = getWalletClient({
252227
+ chainId: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!,
252228
+ chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,
252229
+ rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT!,
252230
+ });`);
252231
+ }
252232
+ await writeTemplate(viemTemplate.join(`
252233
+ `), "/lib/settlemint", "viem.ts");
252234
+ note("Viem resources generated successfully");
252235
+ }
252236
+
251903
252237
  // src/commands/codegen.ts
251904
252238
  function codegenCommand() {
251905
- 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([
252239
+ 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([
251906
252240
  {
251907
252241
  description: "Generate GraphQL types and queries for your dApp",
251908
252242
  command: "codegen"
@@ -251910,8 +252244,12 @@ function codegenCommand() {
251910
252244
  {
251911
252245
  description: "Generate GraphQL types and queries for specific TheGraph subgraphs",
251912
252246
  command: "codegen --thegraph-subgraph-names subgraph1 subgraph2"
252247
+ },
252248
+ {
252249
+ description: "Generate Viem resources",
252250
+ command: "codegen --generate-viem"
251913
252251
  }
251914
- ])).action(async ({ prod, thegraphSubgraphNames }) => {
252252
+ ])).action(async ({ prod, thegraphSubgraphNames, generateViem }) => {
251915
252253
  intro("Generating GraphQL types and queries for your dApp");
251916
252254
  const env2 = await loadEnv(true, !!prod);
251917
252255
  if (!Array.isArray(thegraphSubgraphNames)) {
@@ -251929,6 +252267,10 @@ function codegenCommand() {
251929
252267
  },
251930
252268
  stopMessage: "Tested GraphQL schemas"
251931
252269
  });
252270
+ if (generateViem) {
252271
+ note("Generating Viem resources");
252272
+ await codegenViem(env2);
252273
+ }
251932
252274
  if (hasura) {
251933
252275
  note("Generating Hasura resources");
251934
252276
  await codegenHasura(env2);
@@ -252190,6 +252532,7 @@ async function applicationPrompt(env2, applications, accept) {
252190
252532
  }
252191
252533
 
252192
252534
  // src/prompts/cluster-service/service.prompt.ts
252535
+ var ALL2 = "All";
252193
252536
  async function servicePrompt({
252194
252537
  env: env2,
252195
252538
  services,
@@ -252198,13 +252541,17 @@ async function servicePrompt({
252198
252541
  defaultHandler,
252199
252542
  isRequired = false,
252200
252543
  isCi = is_in_ci_default,
252201
- singleOptionMessage
252544
+ singleOptionMessage,
252545
+ allowAll = false
252202
252546
  }) {
252203
252547
  if (services.length === 0) {
252204
252548
  return;
252205
252549
  }
252206
- const selectedService = services.find((service) => service.uniqueName === env2[envKey]);
252550
+ const selectedService = services.find((service) => Array.isArray(service) ? false : service.uniqueName === env2[envKey]);
252207
252551
  const autoAccept = isCi || accept;
252552
+ if (autoAccept && allowAll) {
252553
+ return services;
252554
+ }
252208
252555
  if (autoAccept && selectedService) {
252209
252556
  return selectedService;
252210
252557
  }
@@ -252212,7 +252559,7 @@ async function servicePrompt({
252212
252559
  return;
252213
252560
  }
252214
252561
  if (isRequired && services.length === 1) {
252215
- if (singleOptionMessage) {
252562
+ if (singleOptionMessage && !Array.isArray(services[0])) {
252216
252563
  note(singleOptionMessage(services[0].uniqueName));
252217
252564
  }
252218
252565
  return services[0];
@@ -252221,13 +252568,37 @@ async function servicePrompt({
252221
252568
  name: `${service.name} (${service.uniqueName})`,
252222
252569
  value: service
252223
252570
  }));
252571
+ if (allowAll) {
252572
+ choices.unshift({
252573
+ name: ALL2,
252574
+ value: services
252575
+ });
252576
+ }
252224
252577
  if (!isRequired) {
252225
252578
  choices.push({
252226
252579
  name: "None",
252227
252580
  value: undefined
252228
252581
  });
252229
252582
  }
252230
- return defaultHandler({ defaultService: selectedService, choices });
252583
+ return defaultHandler({
252584
+ defaultService: selectedService,
252585
+ choices
252586
+ });
252587
+ }
252588
+
252589
+ // src/utils/cluster-service.ts
252590
+ function isValidPrivateKey(privateKey) {
252591
+ return privateKey.privateKeyType !== "HD_ECDSA_P256";
252592
+ }
252593
+ function hasValidPrivateKey(service) {
252594
+ return (service.privateKeys ?? []).some(isValidPrivateKey);
252595
+ }
252596
+ function hasPrivateKey(service) {
252597
+ const keys = service.privateKeys ?? [];
252598
+ return keys.length > 0;
252599
+ }
252600
+ function isRunning(service) {
252601
+ return service === undefined || service?.status === "COMPLETED";
252231
252602
  }
252232
252603
 
252233
252604
  // src/prompts/cluster-service/blockchain-node.prompt.ts
@@ -252238,7 +252609,8 @@ async function blockchainNodePrompt({
252238
252609
  singleOptionMessage,
252239
252610
  promptMessage,
252240
252611
  filterRunningOnly = false,
252241
- isRequired = false
252612
+ isRequired = false,
252613
+ allowAll = false
252242
252614
  }) {
252243
252615
  return servicePrompt({
252244
252616
  env: env2,
@@ -252247,14 +252619,25 @@ async function blockchainNodePrompt({
252247
252619
  envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
252248
252620
  isRequired,
252249
252621
  defaultHandler: async ({ defaultService: defaultNode, choices }) => {
252250
- const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => node === undefined || node?.status === "COMPLETED") : choices;
252622
+ const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => {
252623
+ return Array.isArray(node) ? true : isRunning(node);
252624
+ }).map((item) => {
252625
+ if (Array.isArray(item.value)) {
252626
+ return {
252627
+ ...item,
252628
+ value: item.value.filter(isRunning)
252629
+ };
252630
+ }
252631
+ return item;
252632
+ }) : choices;
252251
252633
  return esm_default3({
252252
252634
  message: promptMessage ?? "Which blockchain node do you want to connect to?",
252253
252635
  choices: filteredChoices,
252254
252636
  default: defaultNode
252255
252637
  });
252256
252638
  },
252257
- singleOptionMessage
252639
+ singleOptionMessage,
252640
+ allowAll
252258
252641
  });
252259
252642
  }
252260
252643
 
@@ -252447,7 +252830,7 @@ async function theGraphPrompt({
252447
252830
  envKey: "SETTLEMINT_THEGRAPH",
252448
252831
  isRequired,
252449
252832
  defaultHandler: async ({ defaultService: defaultMiddleware, choices }) => {
252450
- const filteredChoices = filterRunningOnly ? choices.filter(({ value: middleware }) => middleware === undefined || middleware?.status === "COMPLETED") : choices;
252833
+ const filteredChoices = filterRunningOnly ? choices.filter(({ value: middleware }) => isRunning(middleware)) : choices;
252451
252834
  return esm_default3({
252452
252835
  message: "Which The Graph instance do you want to connect to?",
252453
252836
  choices: filteredChoices,
@@ -252559,7 +252942,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
252559
252942
  storages,
252560
252943
  privateKeys,
252561
252944
  insights,
252562
- customDeployments
252945
+ customDeployments,
252946
+ loadBalancers
252563
252947
  ] = await Promise.all([
252564
252948
  shouldFetch("blockchain-network") ? settlemint.blockchainNetwork.list(applicationUniqueName) : Promise.resolve([]),
252565
252949
  shouldFetch("blockchain-node") ? settlemint.blockchainNode.list(applicationUniqueName) : Promise.resolve([]),
@@ -252568,7 +252952,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
252568
252952
  shouldFetch("storage") ? settlemint.storage.list(applicationUniqueName) : Promise.resolve([]),
252569
252953
  shouldFetch("private-key") ? settlemint.privateKey.list(applicationUniqueName) : Promise.resolve([]),
252570
252954
  shouldFetch("insights") ? settlemint.insights.list(applicationUniqueName) : Promise.resolve([]),
252571
- shouldFetch("custom-deployment") ? settlemint.customDeployment.list(applicationUniqueName) : Promise.resolve([])
252955
+ shouldFetch("custom-deployment") ? settlemint.customDeployment.list(applicationUniqueName) : Promise.resolve([]),
252956
+ shouldFetch("load-balancer") ? settlemint.loadBalancer.list(applicationUniqueName) : Promise.resolve([])
252572
252957
  ]);
252573
252958
  return {
252574
252959
  blockchainNetworks,
@@ -252578,7 +252963,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
252578
252963
  storages,
252579
252964
  privateKeys,
252580
252965
  insights,
252581
- customDeployments
252966
+ customDeployments,
252967
+ loadBalancers
252582
252968
  };
252583
252969
  }
252584
252970
  });
@@ -252617,8 +253003,11 @@ async function writeEnvSpinner(prod, env2) {
252617
253003
  SETTLEMINT_WORKSPACE: env2.SETTLEMINT_WORKSPACE,
252618
253004
  SETTLEMINT_APPLICATION: env2.SETTLEMINT_APPLICATION,
252619
253005
  SETTLEMINT_BLOCKCHAIN_NETWORK: env2.SETTLEMINT_BLOCKCHAIN_NETWORK,
253006
+ SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID: env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID,
252620
253007
  SETTLEMINT_BLOCKCHAIN_NODE: env2.SETTLEMINT_BLOCKCHAIN_NODE,
252621
- SETTLEMINT_LOAD_BALANCER: env2.SETTLEMINT_LOAD_BALANCER,
253008
+ SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT: env2.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT,
253009
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER,
253010
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT: env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT,
252622
253011
  SETTLEMINT_HASURA: env2.SETTLEMINT_HASURA,
252623
253012
  SETTLEMINT_HASURA_ENDPOINT: env2.SETTLEMINT_HASURA_ENDPOINT,
252624
253013
  SETTLEMINT_THEGRAPH: env2.SETTLEMINT_THEGRAPH,
@@ -252653,6 +253042,14 @@ async function writeEnvSpinner(prod, env2) {
252653
253042
  });
252654
253043
  }
252655
253044
 
253045
+ // src/utils/blockchain-network.ts
253046
+ function getBlockchainNetworkChainId(blockchainNetwork) {
253047
+ if (!blockchainNetwork) {
253048
+ return;
253049
+ }
253050
+ return "chainId" in blockchainNetwork && typeof blockchainNetwork.chainId === "number" ? blockchainNetwork.chainId.toString() : undefined;
253051
+ }
253052
+
252656
253053
  // src/utils/get-cluster-service-endpoint.ts
252657
253054
  async function getGraphEndpoint(settlemint, service, graphName) {
252658
253055
  if (!service || service.__typename !== "HAGraphMiddleware") {
@@ -252726,6 +253123,51 @@ function getMinioEndpoints(service) {
252726
253123
  SETTLEMINT_MINIO_SECRET_KEY: service?.credentials.find((credential) => credential.id.includes("secret-key"))?.displayValue
252727
253124
  };
252728
253125
  }
253126
+ function getBlockchainNodeEndpoints(service) {
253127
+ if (!service) {
253128
+ return {};
253129
+ }
253130
+ return {
253131
+ SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT: service.endpoints.find((endpoint) => endpoint.id.includes("json-rpc"))?.displayValue
253132
+ };
253133
+ }
253134
+ function getBlockchainNodeOrLoadBalancerEndpoints(service) {
253135
+ if (!service) {
253136
+ return {};
253137
+ }
253138
+ return {
253139
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT: service.endpoints.find((endpoint) => endpoint.id.includes("json-rpc"))?.displayValue
253140
+ };
253141
+ }
253142
+
253143
+ // src/prompts/cluster-service/blockchain-node-or-load-balancer.prompt.ts
253144
+ async function blockchainNodeOrLoadBalancerPrompt({
253145
+ env: env2,
253146
+ nodes,
253147
+ loadBalancers,
253148
+ accept,
253149
+ singleOptionMessage,
253150
+ promptMessage,
253151
+ filterRunningOnly = false,
253152
+ isRequired = false
253153
+ }) {
253154
+ return servicePrompt({
253155
+ env: env2,
253156
+ services: [...loadBalancers, ...nodes],
253157
+ accept,
253158
+ envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
253159
+ isRequired,
253160
+ defaultHandler: async ({ defaultService: defaultNode, choices }) => {
253161
+ const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => isRunning(node)) : choices;
253162
+ return esm_default3({
253163
+ message: promptMessage ?? "Which blockchain node or load balancer do you want to connect to?",
253164
+ choices: filteredChoices,
253165
+ default: defaultNode
253166
+ });
253167
+ },
253168
+ singleOptionMessage
253169
+ });
253170
+ }
252729
253171
 
252730
253172
  // src/commands/connect.ts
252731
253173
  function connectCommand() {
@@ -252746,11 +253188,30 @@ function connectCommand() {
252746
253188
  const workspace = await workspacePrompt(env2, workspaces, acceptDefaults);
252747
253189
  const application = await applicationPrompt(env2, workspace?.applications ?? [], acceptDefaults);
252748
253190
  const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, acceptDefaults);
252749
- const { middlewares, integrationTools, storages, privateKeys, insights, customDeployments, blockchainNodes } = await servicesSpinner(settlemint, application.uniqueName);
253191
+ const {
253192
+ middlewares,
253193
+ integrationTools,
253194
+ storages,
253195
+ privateKeys,
253196
+ insights,
253197
+ customDeployments,
253198
+ blockchainNodes,
253199
+ loadBalancers
253200
+ } = await servicesSpinner(settlemint, application.uniqueName);
253201
+ const nodesWithPrivateKey = blockchainNodes.filter(hasPrivateKey);
252750
253202
  const blockchainNode = await blockchainNodePrompt({
252751
253203
  env: env2,
252752
- nodes: blockchainNodes,
252753
- accept: acceptDefaults
253204
+ nodes: nodesWithPrivateKey,
253205
+ accept: acceptDefaults,
253206
+ promptMessage: "Which blockchain node do you want to use for sending transactions?"
253207
+ });
253208
+ const nodesWithoutPrivateKey = blockchainNodes.filter((node) => !hasPrivateKey(node));
253209
+ const loadBalancerOrBlockchainNode = await blockchainNodeOrLoadBalancerPrompt({
253210
+ env: env2,
253211
+ nodes: nodesWithoutPrivateKey,
253212
+ loadBalancers,
253213
+ accept: acceptDefaults,
253214
+ promptMessage: "Which load balancer or blockchain node do you want to use for read operations?"
252754
253215
  });
252755
253216
  const hasura = await hasuraPrompt({
252756
253217
  env: env2,
@@ -252816,10 +253277,15 @@ function connectCommand() {
252816
253277
  uniqueName: blockchainNode.blockchainNetwork?.uniqueName
252817
253278
  },
252818
253279
  blockchainNode && {
252819
- type: "Blockchain Node",
253280
+ type: "Blockchain Node (use for sending transactions)",
252820
253281
  name: blockchainNode.name,
252821
253282
  uniqueName: blockchainNode.uniqueName
252822
253283
  },
253284
+ loadBalancerOrBlockchainNode && {
253285
+ type: "Load Balancer or Blockchain Node (use for read operations)",
253286
+ name: loadBalancerOrBlockchainNode.name,
253287
+ uniqueName: loadBalancerOrBlockchainNode.uniqueName
253288
+ },
252823
253289
  hasura && {
252824
253290
  type: "Hasura",
252825
253291
  name: hasura.name,
@@ -252869,7 +253335,11 @@ function connectCommand() {
252869
253335
  SETTLEMINT_WORKSPACE: workspace.uniqueName,
252870
253336
  SETTLEMINT_APPLICATION: application.uniqueName,
252871
253337
  SETTLEMINT_BLOCKCHAIN_NETWORK: blockchainNode?.blockchainNetwork?.uniqueName,
253338
+ SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID: getBlockchainNetworkChainId(blockchainNode?.blockchainNetwork),
252872
253339
  SETTLEMINT_BLOCKCHAIN_NODE: blockchainNode?.uniqueName,
253340
+ ...getBlockchainNodeEndpoints(blockchainNode),
253341
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: loadBalancerOrBlockchainNode?.uniqueName,
253342
+ ...getBlockchainNodeOrLoadBalancerEndpoints(loadBalancerOrBlockchainNode),
252873
253343
  SETTLEMINT_HASURA: hasura?.uniqueName,
252874
253344
  ...getHasuraEndpoints(hasura),
252875
253345
  SETTLEMINT_THEGRAPH: thegraph?.uniqueName,
@@ -256211,7 +256681,8 @@ var SETTLEMINT_CLIENT_MAP = {
256211
256681
  "integration tool": "integrationTool",
256212
256682
  storage: "storage",
256213
256683
  insights: "insights",
256214
- "application access token": "applicationAccessToken"
256684
+ "application access token": "applicationAccessToken",
256685
+ "load balancer": "loadBalancer"
256215
256686
  };
256216
256687
  var LABELS_MAP = {
256217
256688
  application: { singular: "application", plural: "applications", command: "app" },
@@ -256232,7 +256703,8 @@ var LABELS_MAP = {
256232
256703
  singular: "application access token",
256233
256704
  plural: "application access tokens",
256234
256705
  command: "application-access-token"
256235
- }
256706
+ },
256707
+ "load balancer": { singular: "load balancer", plural: "load balancers", command: "load-balancer" }
256236
256708
  };
256237
256709
 
256238
256710
  // src/spinners/service.spinner.ts
@@ -256734,7 +257206,10 @@ function getCreateCommand({
256734
257206
  usePersonalAccessToken = true,
256735
257207
  requiresDeployment = true
256736
257208
  }) {
256737
- 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");
257209
+ 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");
257210
+ if (alias) {
257211
+ cmd2.alias(alias);
257212
+ }
256738
257213
  if (requiresDeployment) {
256739
257214
  cmd2.option("-w, --wait", "Wait until deployed").option("-r, --restart-if-timeout", "Restart if wait time is exceeded");
256740
257215
  }
@@ -256804,7 +257279,10 @@ function getCreateCommand({
256804
257279
  newEnv.SETTLEMINT_WORKSPACE = (await settlemint.application.read(updatedEnv.SETTLEMINT_APPLICATION)).workspace.uniqueName;
256805
257280
  }
256806
257281
  if (newEnv.SETTLEMINT_BLOCKCHAIN_NODE && newEnv.SETTLEMINT_BLOCKCHAIN_NODE !== env2.SETTLEMINT_BLOCKCHAIN_NODE) {
256807
- newEnv.SETTLEMINT_BLOCKCHAIN_NETWORK = (await settlemint.blockchainNode.read(newEnv.SETTLEMINT_BLOCKCHAIN_NODE)).blockchainNetwork.uniqueName;
257282
+ const newNode = await settlemint.blockchainNode.read(newEnv.SETTLEMINT_BLOCKCHAIN_NODE);
257283
+ newEnv.SETTLEMINT_BLOCKCHAIN_NETWORK = newNode.blockchainNetwork.uniqueName;
257284
+ newEnv.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID = getBlockchainNetworkChainId(newNode.blockchainNetwork);
257285
+ newEnv.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT = getBlockchainNodeEndpoints(newNode).SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT;
256808
257286
  }
256809
257287
  await writeEnvSpinner(!!prod, newEnv);
256810
257288
  note(`${capitalizeFirstLetter2(type4)} ${result.name} set as default`);
@@ -256876,7 +257354,11 @@ function blockchainNetworkBesuCreateCommand() {
256876
257354
  return {
256877
257355
  SETTLEMINT_APPLICATION: applicationUniqueName,
256878
257356
  SETTLEMINT_BLOCKCHAIN_NETWORK: result.uniqueName,
256879
- SETTLEMINT_BLOCKCHAIN_NODE: blockchainNode?.uniqueName
257357
+ SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID: getBlockchainNetworkChainId(result),
257358
+ SETTLEMINT_BLOCKCHAIN_NODE: blockchainNode?.uniqueName,
257359
+ ...getBlockchainNodeEndpoints(blockchainNode),
257360
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: undefined,
257361
+ ...getBlockchainNodeOrLoadBalancerEndpoints(undefined)
256880
257362
  };
256881
257363
  }
256882
257364
  };
@@ -257321,20 +257803,26 @@ function blockscoutInsightsCreateCommand() {
257321
257803
  if (!applicationUniqueName) {
257322
257804
  return missingApplication();
257323
257805
  }
257324
- let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
257325
- const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
257806
+ let blockchainNodeUniqueName = blockchainNode;
257807
+ let loadBalancerUniqueName = loadBalancer;
257326
257808
  if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
257327
257809
  const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257328
- const node = await blockchainNodePrompt({
257810
+ const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
257811
+ const nodeOrLoadbalancer = await blockchainNodeOrLoadBalancerPrompt({
257329
257812
  env: env2,
257330
257813
  nodes: blockchainNodes,
257814
+ loadBalancers,
257331
257815
  accept: acceptDefaults,
257332
257816
  isRequired: true
257333
257817
  });
257334
- if (!node) {
257818
+ if (!nodeOrLoadbalancer) {
257335
257819
  return nothingSelectedError("blockchain node");
257336
257820
  }
257337
- blockchainNodeUniqueName = node.uniqueName;
257821
+ if (nodeOrLoadbalancer.__typename?.endsWith("LoadBalancer")) {
257822
+ loadBalancerUniqueName = nodeOrLoadbalancer.uniqueName;
257823
+ } else {
257824
+ blockchainNodeUniqueName = nodeOrLoadbalancer.uniqueName;
257825
+ }
257338
257826
  }
257339
257827
  const result = await showSpinner(() => settlemint.insights.create({
257340
257828
  name: name3,
@@ -257440,6 +257928,117 @@ function integrationToolCreateCommand() {
257440
257928
  return cmd2;
257441
257929
  }
257442
257930
 
257931
+ // src/commands/platform/load-balancer/evm/create.ts
257932
+ function loadBalancerEvmCreateCommand() {
257933
+ return getCreateCommand({
257934
+ name: "evm",
257935
+ type: "load balancer",
257936
+ subType: "EVM",
257937
+ execute: (cmd2, baseAction) => {
257938
+ 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)").option("--blockchain-network <blockchainNetwork>", "Blockchain network unique name where the load balancer connects to, can be skipped if the --blockchain-nodes option is used (defaults to network from env)").action(async (name3, {
257939
+ application,
257940
+ provider,
257941
+ region,
257942
+ size,
257943
+ type: type4,
257944
+ blockchainNodes,
257945
+ blockchainNetwork,
257946
+ acceptDefaults,
257947
+ ...defaultArgs
257948
+ }) => {
257949
+ return baseAction({
257950
+ ...defaultArgs,
257951
+ acceptDefaults,
257952
+ provider,
257953
+ region
257954
+ }, async ({ settlemint, env: env2, showSpinner, provider: provider2, region: region2 }) => {
257955
+ const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
257956
+ if (!applicationUniqueName) {
257957
+ return missingApplication();
257958
+ }
257959
+ const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257960
+ let networkUniqueName = blockchainNetwork;
257961
+ let connectedNodesUniqueNames = blockchainNodes;
257962
+ if (!connectedNodesUniqueNames) {
257963
+ const networks = await serviceSpinner("blockchain network", () => settlemint.blockchainNetwork.list(applicationUniqueName));
257964
+ const network = networkUniqueName ? networks.find((network2) => network2.uniqueName === networkUniqueName) : await blockchainNetworkPrompt({
257965
+ env: env2,
257966
+ networks,
257967
+ accept: acceptDefaults,
257968
+ isRequired: true
257969
+ });
257970
+ if (!network) {
257971
+ return nothingSelectedError("blockchain network");
257972
+ }
257973
+ networkUniqueName = network.uniqueName;
257974
+ const connectedNodes = await blockchainNodePrompt({
257975
+ env: env2,
257976
+ nodes: applicationBlockchainNodes.filter((node) => node.blockchainNetwork?.uniqueName === network.uniqueName),
257977
+ accept: acceptDefaults,
257978
+ promptMessage: "Which blockchain node do you want to connect the load balancer to?",
257979
+ allowAll: true
257980
+ });
257981
+ connectedNodesUniqueNames = Array.isArray(connectedNodes) ? applicationBlockchainNodes.map((node) => node.uniqueName) : connectedNodes ? [connectedNodes.uniqueName] : [];
257982
+ }
257983
+ if (connectedNodesUniqueNames.length === 0) {
257984
+ return cancel2("A load balancer must connect to at least one blockchain node");
257985
+ }
257986
+ const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
257987
+ if (selectedBlockchainNodes.length === 0) {
257988
+ return cancel2(`Blockchain node(s) '${connectedNodesUniqueNames.join(", ")}' are not part of the application '${applicationUniqueName}'`);
257989
+ }
257990
+ if (!networkUniqueName) {
257991
+ networkUniqueName = selectedBlockchainNodes[0].blockchainNetwork?.uniqueName;
257992
+ }
257993
+ const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === networkUniqueName);
257994
+ if (!onTheSameNetwork) {
257995
+ return cancel2("Blockchain nodes must be on the same network");
257996
+ }
257997
+ const result = await showSpinner(() => settlemint.loadBalancer.create({
257998
+ applicationUniqueName,
257999
+ name: name3,
258000
+ blockchainNetworkUniqueName: networkUniqueName,
258001
+ provider: provider2,
258002
+ region: region2,
258003
+ size,
258004
+ type: type4,
258005
+ connectedNodesUniqueNames
258006
+ }));
258007
+ return {
258008
+ result,
258009
+ mapDefaultEnv: () => {
258010
+ return {
258011
+ SETTLEMINT_APPLICATION: applicationUniqueName,
258012
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: result.uniqueName,
258013
+ ...getBlockchainNodeOrLoadBalancerEndpoints(result)
258014
+ };
258015
+ }
258016
+ };
258017
+ });
258018
+ });
258019
+ },
258020
+ examples: [
258021
+ {
258022
+ description: "Create an EVM load balancer and save as default",
258023
+ command: "platform create load-balancer evm my-lb --accept-defaults -d"
258024
+ },
258025
+ {
258026
+ description: "Create an EVM load balancer and connect to specific blockchain nodes",
258027
+ command: "platform create load-balancer evm my-lb --blockchain-network my-network --accept-defaults"
258028
+ },
258029
+ {
258030
+ description: "Create an EVM load balancer in a different application",
258031
+ command: "platform create load-balancer evm my-lb --application my-app --accept-defaults"
258032
+ }
258033
+ ]
258034
+ });
258035
+ }
258036
+
258037
+ // src/commands/platform/load-balancer/create.ts
258038
+ function loadBalancerCreateCommand() {
258039
+ return new Command("load-balancer").alias("lb").description("Create a load balancer in the SettleMint platform").addCommand(loadBalancerEvmCreateCommand());
258040
+ }
258041
+
257443
258042
  // src/commands/platform/middleware/graph/create.ts
257444
258043
  function graphMiddlewareCreateCommand() {
257445
258044
  return getCreateCommand({
@@ -257448,7 +258047,7 @@ function graphMiddlewareCreateCommand() {
257448
258047
  subType: "The Graph",
257449
258048
  alias: "gr",
257450
258049
  execute: (cmd2, baseAction) => {
257451
- 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 }) => {
258050
+ 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 }) => {
257452
258051
  return baseAction({
257453
258052
  ...defaultArgs,
257454
258053
  acceptDefaults,
@@ -257460,24 +258059,32 @@ function graphMiddlewareCreateCommand() {
257460
258059
  return missingApplication();
257461
258060
  }
257462
258061
  let blockchainNodeUniqueName = blockchainNode;
257463
- if (!blockchainNodeUniqueName) {
258062
+ let loadBalancerUniqueName = loadBalancer;
258063
+ if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
257464
258064
  const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257465
- const node = await blockchainNodePrompt({
258065
+ const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
258066
+ const nodeOrLoadbalancer = await blockchainNodeOrLoadBalancerPrompt({
257466
258067
  env: env2,
257467
258068
  nodes: blockchainNodes,
258069
+ loadBalancers,
257468
258070
  accept: acceptDefaults,
257469
258071
  isRequired: true
257470
258072
  });
257471
- if (!node) {
257472
- return nothingSelectedError("blockchain node");
258073
+ if (!nodeOrLoadbalancer) {
258074
+ return nothingSelectedError("blockchain node or load balancer");
258075
+ }
258076
+ if (nodeOrLoadbalancer.__typename?.endsWith("LoadBalancer")) {
258077
+ loadBalancerUniqueName = nodeOrLoadbalancer.uniqueName;
258078
+ } else {
258079
+ blockchainNodeUniqueName = nodeOrLoadbalancer.uniqueName;
257473
258080
  }
257474
- blockchainNodeUniqueName = node.uniqueName;
257475
258081
  }
257476
258082
  const result = await showSpinner(() => settlemint.middleware.create({
257477
258083
  name: name3,
257478
258084
  applicationUniqueName,
257479
258085
  interface: "HA_GRAPH",
257480
258086
  blockchainNodeUniqueName,
258087
+ loadBalancerUniqueName,
257481
258088
  provider: provider2,
257482
258089
  region: region2,
257483
258090
  size,
@@ -257543,12 +258150,12 @@ function smartContractPortalMiddlewareCreateCommand() {
257543
258150
  return missingApplication();
257544
258151
  }
257545
258152
  let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
257546
- const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
258153
+ const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER;
257547
258154
  if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
257548
258155
  const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257549
258156
  const node = await blockchainNodePrompt({
257550
258157
  env: env2,
257551
- nodes: blockchainNodes,
258158
+ nodes: blockchainNodes.filter(hasValidPrivateKey),
257552
258159
  accept: acceptDefaults,
257553
258160
  isRequired: true
257554
258161
  });
@@ -257926,7 +258533,7 @@ function storageCreateCommand() {
257926
258533
 
257927
258534
  // src/commands/platform/create.ts
257928
258535
  function createCommand3() {
257929
- 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());
258536
+ 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());
257930
258537
  }
257931
258538
 
257932
258539
  // src/prompts/delete-confirmation.prompt.ts
@@ -258166,6 +258773,19 @@ function integrationToolRestartCommand() {
258166
258773
  return new Command("integration-tool").alias("it").description("Restart an integration tool service in the SettleMint platform").addCommand(hasuraRestartCommand());
258167
258774
  }
258168
258775
 
258776
+ // src/commands/platform/load-balancer/restart.ts
258777
+ function loadBalancerRestartCommand() {
258778
+ return getRestartCommand({
258779
+ name: "load-balancer",
258780
+ type: "load balancer",
258781
+ alias: "lb",
258782
+ envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
258783
+ restartFunction: async (settlemint, id) => {
258784
+ return settlemint.loadBalancer.restart(id);
258785
+ }
258786
+ });
258787
+ }
258788
+
258169
258789
  // src/commands/platform/middleware/graph/restart.ts
258170
258790
  function graphRestartCommand() {
258171
258791
  return getRestartCommand({
@@ -258232,7 +258852,7 @@ function storageRestartCommand() {
258232
258852
 
258233
258853
  // src/commands/platform/restart.ts
258234
258854
  function restartCommand() {
258235
- 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());
258855
+ 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());
258236
258856
  return cmd2;
258237
258857
  }
258238
258858
 
@@ -258702,6 +259322,8 @@ function getItemsForServiceType(services, serviceType) {
258702
259322
  return services.blockchainNetworks;
258703
259323
  case "blockchain-node":
258704
259324
  return services.blockchainNodes;
259325
+ case "load-balancer":
259326
+ return services.loadBalancers;
258705
259327
  default:
258706
259328
  return [];
258707
259329
  }
@@ -259075,38 +259697,6 @@ function getStatusAction(status) {
259075
259697
  return "Please try again later.";
259076
259698
  }
259077
259699
 
259078
- // src/prompts/smart-contract-set/address.prompt.ts
259079
- async function addressPrompt({
259080
- env: env2,
259081
- accept,
259082
- prod,
259083
- node,
259084
- hardhatConfig
259085
- }) {
259086
- const possiblePrivateKeys = node.privateKeys?.filter((privateKey) => validPrivateKey(privateKey)) ?? [];
259087
- const defaultAddress = hardhatConfig.networks?.btp?.from ?? possiblePrivateKeys[0]?.address;
259088
- const defaultPossible = accept && defaultAddress;
259089
- if (defaultPossible) {
259090
- if (possiblePrivateKeys.some((privateKey) => privateKey.address?.toLowerCase() === defaultAddress?.toLowerCase())) {
259091
- return defaultAddress;
259092
- }
259093
- note(`Private key with address '${defaultAddress}' is not activated on the node '${node.uniqueName}'.
259094
- Please select another key or activate this key on the node and try again.`, "warn");
259095
- }
259096
- const address = await esm_default3({
259097
- message: "Which private key do you want to deploy from?",
259098
- choices: possiblePrivateKeys.map(({ address: address2, name: name3 }) => ({
259099
- name: name3,
259100
- value: address2
259101
- })),
259102
- default: defaultAddress ?? possiblePrivateKeys[0]?.address
259103
- });
259104
- return address;
259105
- }
259106
- function validPrivateKey(privateKey) {
259107
- return privateKey.privateKeyType !== "HD_ECDSA_P256";
259108
- }
259109
-
259110
259700
  // src/commands/smart-contract-set/hardhat/utils/select-target-node.ts
259111
259701
  async function selectTargetNode({
259112
259702
  env: env2,
@@ -259130,6 +259720,7 @@ async function selectTargetNode({
259130
259720
  nodes: validNodes,
259131
259721
  accept: autoAccept,
259132
259722
  isRequired: true,
259723
+ filterRunningOnly: true,
259133
259724
  promptMessage: "Which blockchain node do you want to connect to? (Only nodes with private keys activated are shown)",
259134
259725
  singleOptionMessage: (node2) => `Using '${node2}' - the only node with active private keys. To use a different node, ensure it has a private key activated.`
259135
259726
  });
@@ -259151,7 +259742,7 @@ function validateNode(node, cancelOnError = true) {
259151
259742
  }
259152
259743
  return false;
259153
259744
  }
259154
- if (node.privateKeys?.filter((privateKey) => validPrivateKey(privateKey)).length === 0) {
259745
+ if (!hasValidPrivateKey(node)) {
259155
259746
  if (cancelOnError) {
259156
259747
  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.`);
259157
259748
  }
@@ -259166,19 +259757,52 @@ function validateNode(node, cancelOnError = true) {
259166
259757
  return true;
259167
259758
  }
259168
259759
 
259760
+ // src/prompts/smart-contract-set/address.prompt.ts
259761
+ async function addressPrompt({
259762
+ accept,
259763
+ node,
259764
+ hardhatConfig
259765
+ }) {
259766
+ const possiblePrivateKeys = node.privateKeys?.filter(isValidPrivateKey) ?? [];
259767
+ const defaultAddress = hardhatConfig.networks?.btp?.from ?? possiblePrivateKeys[0]?.address;
259768
+ const defaultPossible = accept && defaultAddress;
259769
+ if (defaultPossible) {
259770
+ if (possiblePrivateKeys.some((privateKey) => privateKey.address?.toLowerCase() === defaultAddress?.toLowerCase())) {
259771
+ return defaultAddress;
259772
+ }
259773
+ note(`Private key with address '${defaultAddress}' is not activated on the node '${node.uniqueName}'.
259774
+ Please select another key or activate this key on the node and try again.`, "warn");
259775
+ }
259776
+ const address = await esm_default3({
259777
+ message: "Which private key do you want to deploy from?",
259778
+ choices: possiblePrivateKeys.map(({ address: address2, name: name3 }) => ({
259779
+ name: name3,
259780
+ value: address2
259781
+ })),
259782
+ default: defaultAddress
259783
+ });
259784
+ return address;
259785
+ }
259786
+
259169
259787
  // src/utils/smart-contract-set/hardhat-config.ts
259170
259788
  async function getHardhatConfigData(envConfig) {
259171
259789
  try {
259172
259790
  const { command, args } = await getPackageManagerExecutable();
259173
- const output = await executeCommand(command, [...args, "ts-node", "-e", `import hardhat from "hardhat";
259174
- console.log(JSON.stringify(hardhat.userConfig));`], {
259791
+ const output = await executeCommand(command, [
259792
+ ...args,
259793
+ "ts-node",
259794
+ "-e",
259795
+ `import hardhat from "hardhat";
259796
+ console.log(JSON.stringify(hardhat.userConfig));`,
259797
+ "--transpileOnly"
259798
+ ], {
259175
259799
  env: {
259176
259800
  ...process.env,
259177
259801
  ...envConfig
259178
259802
  },
259179
259803
  silent: true
259180
259804
  });
259181
- const config3 = tryParseJson3(output.join(" "));
259805
+ const config3 = extractJsonObject(output.join(" "));
259182
259806
  if (isHardhatConfig(config3)) {
259183
259807
  return config3;
259184
259808
  }
@@ -259255,7 +259879,7 @@ function hardhatDeployRemoteCommand() {
259255
259879
  }
259256
259880
  let address = defaultSender ?? null;
259257
259881
  if (!defaultSender) {
259258
- address = await addressPrompt({ env: env2, accept: autoAccept, prod, node, hardhatConfig });
259882
+ address = await addressPrompt({ accept: autoAccept, node, hardhatConfig });
259259
259883
  }
259260
259884
  if (!address) {
259261
259885
  return nothingSelectedError("private key");
@@ -259901,4 +260525,4 @@ async function sdkCliCommand(argv = process.argv) {
259901
260525
  // src/cli.ts
259902
260526
  sdkCliCommand();
259903
260527
 
259904
- //# debugId=B4DCF2BA52E9D11564756E2164756E21
260528
+ //# debugId=2B373E0C09B2899D64756E2164756E21