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