zk-credits 0.2.2 → 0.2.4
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/README.md +43 -43
- package/circuits/manifest.json +20 -3
- package/dist/artifact-bundle.d.ts +19 -0
- package/dist/artifact-bundle.js +61 -1
- package/dist/artifact-release.d.ts +10 -0
- package/dist/artifact-release.js +243 -0
- package/dist/cli.js +12 -5
- package/dist/gateway-root-check.d.ts +2 -0
- package/dist/gateway-root-check.js +28 -0
- package/dist/responses-bridge.js +3 -2
- package/dist/setup-config.d.ts +2 -0
- package/dist/setup-config.js +43 -6
- package/dist/zk-credits.js +494 -158
- package/package.json +4 -1
package/dist/zk-credits.js
CHANGED
|
@@ -34651,7 +34651,7 @@ var require_lib = __commonJS({
|
|
|
34651
34651
|
};
|
|
34652
34652
|
}
|
|
34653
34653
|
// @__NO_SIDE_EFFECTS__
|
|
34654
|
-
function
|
|
34654
|
+
function join8(separator = "") {
|
|
34655
34655
|
astr("join", separator);
|
|
34656
34656
|
return {
|
|
34657
34657
|
encode: (from) => {
|
|
@@ -34867,15 +34867,15 @@ var require_lib = __commonJS({
|
|
|
34867
34867
|
convertRadix2,
|
|
34868
34868
|
radix,
|
|
34869
34869
|
radix2,
|
|
34870
|
-
join:
|
|
34870
|
+
join: join8,
|
|
34871
34871
|
padding
|
|
34872
34872
|
};
|
|
34873
|
-
exports.base16 = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(4), /* @__PURE__ */ alphabet("0123456789ABCDEF"), /* @__PURE__ */
|
|
34874
|
-
exports.base32 = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(5), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"), /* @__PURE__ */ padding(5), /* @__PURE__ */
|
|
34875
|
-
exports.base32nopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(5), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"), /* @__PURE__ */
|
|
34876
|
-
exports.base32hex = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(5), /* @__PURE__ */ alphabet("0123456789ABCDEFGHIJKLMNOPQRSTUV"), /* @__PURE__ */ padding(5), /* @__PURE__ */
|
|
34877
|
-
exports.base32hexnopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(5), /* @__PURE__ */ alphabet("0123456789ABCDEFGHIJKLMNOPQRSTUV"), /* @__PURE__ */
|
|
34878
|
-
exports.base32crockford = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(5), /* @__PURE__ */ alphabet("0123456789ABCDEFGHJKMNPQRSTVWXYZ"), /* @__PURE__ */
|
|
34873
|
+
exports.base16 = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(4), /* @__PURE__ */ alphabet("0123456789ABCDEF"), /* @__PURE__ */ join8(""));
|
|
34874
|
+
exports.base32 = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(5), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"), /* @__PURE__ */ padding(5), /* @__PURE__ */ join8(""));
|
|
34875
|
+
exports.base32nopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(5), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"), /* @__PURE__ */ join8(""));
|
|
34876
|
+
exports.base32hex = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(5), /* @__PURE__ */ alphabet("0123456789ABCDEFGHIJKLMNOPQRSTUV"), /* @__PURE__ */ padding(5), /* @__PURE__ */ join8(""));
|
|
34877
|
+
exports.base32hexnopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(5), /* @__PURE__ */ alphabet("0123456789ABCDEFGHIJKLMNOPQRSTUV"), /* @__PURE__ */ join8(""));
|
|
34878
|
+
exports.base32crockford = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(5), /* @__PURE__ */ alphabet("0123456789ABCDEFGHJKMNPQRSTVWXYZ"), /* @__PURE__ */ join8(""), /* @__PURE__ */ normalize((s) => s.toUpperCase().replace(/O/g, "0").replace(/[IL]/g, "1")));
|
|
34879
34879
|
var hasBase64Builtin = /* @__PURE__ */ (() => typeof Uint8Array.from([]).toBase64 === "function" && typeof Uint8Array.fromBase64 === "function")();
|
|
34880
34880
|
var decodeBase64Builtin = (s, isUrl) => {
|
|
34881
34881
|
astr("base64", s);
|
|
@@ -34893,8 +34893,8 @@ var require_lib = __commonJS({
|
|
|
34893
34893
|
decode(s) {
|
|
34894
34894
|
return decodeBase64Builtin(s, false);
|
|
34895
34895
|
}
|
|
34896
|
-
} : /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ padding(6), /* @__PURE__ */
|
|
34897
|
-
exports.base64nopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */
|
|
34896
|
+
} : /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ padding(6), /* @__PURE__ */ join8(""));
|
|
34897
|
+
exports.base64nopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ join8(""));
|
|
34898
34898
|
exports.base64url = hasBase64Builtin ? {
|
|
34899
34899
|
encode(b) {
|
|
34900
34900
|
abytes(b);
|
|
@@ -34903,9 +34903,9 @@ var require_lib = __commonJS({
|
|
|
34903
34903
|
decode(s) {
|
|
34904
34904
|
return decodeBase64Builtin(s, true);
|
|
34905
34905
|
}
|
|
34906
|
-
} : /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"), /* @__PURE__ */ padding(6), /* @__PURE__ */
|
|
34907
|
-
exports.base64urlnopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"), /* @__PURE__ */
|
|
34908
|
-
var genBase58 = /* @__NO_SIDE_EFFECTS__ */ (abc) => /* @__PURE__ */ chain(/* @__PURE__ */ radix(58), /* @__PURE__ */ alphabet(abc), /* @__PURE__ */
|
|
34906
|
+
} : /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"), /* @__PURE__ */ padding(6), /* @__PURE__ */ join8(""));
|
|
34907
|
+
exports.base64urlnopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"), /* @__PURE__ */ join8(""));
|
|
34908
|
+
var genBase58 = /* @__NO_SIDE_EFFECTS__ */ (abc) => /* @__PURE__ */ chain(/* @__PURE__ */ radix(58), /* @__PURE__ */ alphabet(abc), /* @__PURE__ */ join8(""));
|
|
34909
34909
|
exports.base58 = /* @__PURE__ */ genBase58("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
|
|
34910
34910
|
exports.base58flickr = /* @__PURE__ */ genBase58("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");
|
|
34911
34911
|
exports.base58xrp = /* @__PURE__ */ genBase58("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");
|
|
@@ -34937,7 +34937,7 @@ var require_lib = __commonJS({
|
|
|
34937
34937
|
var createBase58check = (sha256) => /* @__PURE__ */ chain(checksum(4, (data) => sha256(sha256(data))), exports.base58);
|
|
34938
34938
|
exports.createBase58check = createBase58check;
|
|
34939
34939
|
exports.base58check = exports.createBase58check;
|
|
34940
|
-
var BECH_ALPHABET = /* @__PURE__ */ chain(/* @__PURE__ */ alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), /* @__PURE__ */
|
|
34940
|
+
var BECH_ALPHABET = /* @__PURE__ */ chain(/* @__PURE__ */ alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), /* @__PURE__ */ join8(""));
|
|
34941
34941
|
var POLYMOD_GENERATORS = [996825010, 642813549, 513874426, 1027748829, 705979059];
|
|
34942
34942
|
function bech32Polymod(pre) {
|
|
34943
34943
|
const b = pre >> 25;
|
|
@@ -35046,7 +35046,7 @@ var require_lib = __commonJS({
|
|
|
35046
35046
|
return Uint8Array.fromHex(s);
|
|
35047
35047
|
}
|
|
35048
35048
|
};
|
|
35049
|
-
exports.hex = hasHexBuiltin ? hexBuiltin : /* @__PURE__ */ chain(/* @__PURE__ */ radix2(4), /* @__PURE__ */ alphabet("0123456789abcdef"), /* @__PURE__ */
|
|
35049
|
+
exports.hex = hasHexBuiltin ? hexBuiltin : /* @__PURE__ */ chain(/* @__PURE__ */ radix2(4), /* @__PURE__ */ alphabet("0123456789abcdef"), /* @__PURE__ */ join8(""), /* @__PURE__ */ normalize((s) => {
|
|
35050
35050
|
if (typeof s !== "string" || s.length % 2 !== 0)
|
|
35051
35051
|
throw new TypeError(`hex.decode: expected string, got ${typeof s} with length ${s.length}`);
|
|
35052
35052
|
return s.toLowerCase();
|
|
@@ -38581,9 +38581,9 @@ var require_SignatureEnvelope = __commonJS({
|
|
|
38581
38581
|
}
|
|
38582
38582
|
function sortMultisigApprovals(value) {
|
|
38583
38583
|
const { signatures } = value;
|
|
38584
|
-
const
|
|
38584
|
+
const digest2 = MultisigConfig.getSignPayload(value);
|
|
38585
38585
|
return signatures.map((signature) => ({
|
|
38586
|
-
key: Hex.toBigInt(extractAddress({ payload:
|
|
38586
|
+
key: Hex.toBigInt(extractAddress({ payload: digest2, signature })),
|
|
38587
38587
|
signature
|
|
38588
38588
|
})).sort((a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0).map((entry) => entry.signature);
|
|
38589
38589
|
}
|
|
@@ -38760,20 +38760,20 @@ var require_TempoAddress = __commonJS({
|
|
|
38760
38760
|
"use strict";
|
|
38761
38761
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38762
38762
|
exports.InvalidPrefixError = void 0;
|
|
38763
|
-
exports.resolve =
|
|
38763
|
+
exports.resolve = resolve4;
|
|
38764
38764
|
exports.format = format;
|
|
38765
38765
|
exports.parse = parse;
|
|
38766
38766
|
exports.validate = validate;
|
|
38767
38767
|
var core_Address = require_Address();
|
|
38768
38768
|
var Errors = require_Errors();
|
|
38769
38769
|
var Hex = require_Hex();
|
|
38770
|
-
function
|
|
38770
|
+
function resolve4(address2) {
|
|
38771
38771
|
if (address2.startsWith("tempo"))
|
|
38772
38772
|
return parse(address2).address;
|
|
38773
38773
|
return address2;
|
|
38774
38774
|
}
|
|
38775
38775
|
function format(address2) {
|
|
38776
|
-
const resolved =
|
|
38776
|
+
const resolved = resolve4(address2);
|
|
38777
38777
|
return `tempox${resolved.toLowerCase()}`;
|
|
38778
38778
|
}
|
|
38779
38779
|
function parse(tempoAddress) {
|
|
@@ -41421,12 +41421,12 @@ var require_MultisigOperation = __commonJS({
|
|
|
41421
41421
|
});
|
|
41422
41422
|
retained.splice(index, 1);
|
|
41423
41423
|
}
|
|
41424
|
-
const
|
|
41424
|
+
const digest2 = MultisigConfig.getSignPayload({
|
|
41425
41425
|
account: operation.account,
|
|
41426
41426
|
config: operation.config,
|
|
41427
41427
|
payload: KeyAuthorization_.getSignPayload(authorization)
|
|
41428
41428
|
});
|
|
41429
|
-
const addresses = selected.map((signature) => SignatureEnvelope.extractAddress({ payload:
|
|
41429
|
+
const addresses = selected.map((signature) => SignatureEnvelope.extractAddress({ payload: digest2, signature }));
|
|
41430
41430
|
for (let index = 1; index < addresses.length; index++) {
|
|
41431
41431
|
const previous = Hex.toBigInt(addresses[index - 1]);
|
|
41432
41432
|
const current = Hex.toBigInt(addresses[index]);
|
|
@@ -42868,13 +42868,13 @@ var require_virtualMasterPool = __commonJS({
|
|
|
42868
42868
|
"node_modules/ox/_cjs/tempo/internal/virtualMasterPool.js"(exports) {
|
|
42869
42869
|
"use strict";
|
|
42870
42870
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42871
|
-
exports.resolve =
|
|
42871
|
+
exports.resolve = resolve4;
|
|
42872
42872
|
exports.resolveNode = resolveNode;
|
|
42873
42873
|
exports.resolveBrowser = resolveBrowser;
|
|
42874
42874
|
var Errors = require_Errors();
|
|
42875
42875
|
var cachedPool;
|
|
42876
42876
|
var isNode = typeof globalThis.process !== "undefined" && typeof globalThis.process.versions?.node === "string";
|
|
42877
|
-
async function
|
|
42877
|
+
async function resolve4() {
|
|
42878
42878
|
if (cachedPool)
|
|
42879
42879
|
return cachedPool;
|
|
42880
42880
|
cachedPool = isNode ? await resolveNode() : await resolveBrowser();
|
|
@@ -43152,7 +43152,7 @@ var require_VirtualMaster = __commonJS({
|
|
|
43152
43152
|
}
|
|
43153
43153
|
function mineSaltWithWorkerPool(value) {
|
|
43154
43154
|
const startedAt = Date.now();
|
|
43155
|
-
return new Promise((
|
|
43155
|
+
return new Promise((resolve4, reject) => {
|
|
43156
43156
|
let settled = false;
|
|
43157
43157
|
let attempts = 0;
|
|
43158
43158
|
let completedWorkers = 0;
|
|
@@ -43182,7 +43182,7 @@ var require_VirtualMaster = __commonJS({
|
|
|
43182
43182
|
settled = true;
|
|
43183
43183
|
value.signal?.removeEventListener("abort", onAbort);
|
|
43184
43184
|
terminateAll();
|
|
43185
|
-
|
|
43185
|
+
resolve4(result);
|
|
43186
43186
|
};
|
|
43187
43187
|
const fail = (error) => {
|
|
43188
43188
|
if (settled)
|
|
@@ -46248,13 +46248,13 @@ var require_withResolvers = __commonJS({
|
|
|
46248
46248
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46249
46249
|
exports.withResolvers = withResolvers;
|
|
46250
46250
|
function withResolvers() {
|
|
46251
|
-
let
|
|
46251
|
+
let resolve4 = () => void 0;
|
|
46252
46252
|
let reject = () => void 0;
|
|
46253
46253
|
const promise = new Promise((resolve_, reject_) => {
|
|
46254
|
-
|
|
46254
|
+
resolve4 = resolve_;
|
|
46255
46255
|
reject = reject_;
|
|
46256
46256
|
});
|
|
46257
|
-
return { promise, resolve:
|
|
46257
|
+
return { promise, resolve: resolve4, reject };
|
|
46258
46258
|
}
|
|
46259
46259
|
}
|
|
46260
46260
|
});
|
|
@@ -46278,8 +46278,8 @@ var require_createBatchScheduler = __commonJS({
|
|
|
46278
46278
|
if (sort && Array.isArray(data))
|
|
46279
46279
|
data.sort(sort);
|
|
46280
46280
|
for (let i = 0; i < scheduler.length; i++) {
|
|
46281
|
-
const { resolve:
|
|
46282
|
-
|
|
46281
|
+
const { resolve: resolve4 } = scheduler[i];
|
|
46282
|
+
resolve4?.([data[i], data]);
|
|
46283
46283
|
}
|
|
46284
46284
|
}).catch((err) => {
|
|
46285
46285
|
for (let i = 0; i < scheduler.length; i++) {
|
|
@@ -46295,16 +46295,16 @@ var require_createBatchScheduler = __commonJS({
|
|
|
46295
46295
|
return {
|
|
46296
46296
|
flush,
|
|
46297
46297
|
async schedule(args) {
|
|
46298
|
-
const { promise, resolve:
|
|
46298
|
+
const { promise, resolve: resolve4, reject } = (0, withResolvers_js_1.withResolvers)();
|
|
46299
46299
|
const split = shouldSplitBatch?.([...getBatchedArgs(), args]);
|
|
46300
46300
|
if (split)
|
|
46301
46301
|
exec();
|
|
46302
46302
|
const hasActiveScheduler = getScheduler().length > 0;
|
|
46303
46303
|
if (hasActiveScheduler) {
|
|
46304
|
-
setScheduler({ args, resolve:
|
|
46304
|
+
setScheduler({ args, resolve: resolve4, reject });
|
|
46305
46305
|
return promise;
|
|
46306
46306
|
}
|
|
46307
|
-
setScheduler({ args, resolve:
|
|
46307
|
+
setScheduler({ args, resolve: resolve4, reject });
|
|
46308
46308
|
setTimeout(exec, wait);
|
|
46309
46309
|
return promise;
|
|
46310
46310
|
}
|
|
@@ -47463,7 +47463,7 @@ var require_wait = __commonJS({
|
|
|
47463
47463
|
exports.wait = wait;
|
|
47464
47464
|
var utils_js_1 = require_utils5();
|
|
47465
47465
|
async function wait(time, { signal } = {}) {
|
|
47466
|
-
return new Promise((
|
|
47466
|
+
return new Promise((resolve4, reject) => {
|
|
47467
47467
|
if (signal?.aborted) {
|
|
47468
47468
|
reject((0, utils_js_1.getAbortError)(signal));
|
|
47469
47469
|
return;
|
|
@@ -47471,7 +47471,7 @@ var require_wait = __commonJS({
|
|
|
47471
47471
|
const cleanup = () => signal?.removeEventListener("abort", onAbort);
|
|
47472
47472
|
const timeout = setTimeout(() => {
|
|
47473
47473
|
cleanup();
|
|
47474
|
-
|
|
47474
|
+
resolve4();
|
|
47475
47475
|
}, time);
|
|
47476
47476
|
const onAbort = () => {
|
|
47477
47477
|
clearTimeout(timeout);
|
|
@@ -49127,7 +49127,7 @@ var require_withRetry = __commonJS({
|
|
|
49127
49127
|
var utils_js_1 = require_utils5();
|
|
49128
49128
|
var wait_js_1 = require_wait();
|
|
49129
49129
|
function withRetry(fn, { delay: delay_ = 100, retryCount = 2, shouldRetry = () => true, signal } = {}) {
|
|
49130
|
-
return new Promise((
|
|
49130
|
+
return new Promise((resolve4, reject) => {
|
|
49131
49131
|
const attemptRetry = async ({ count = 0 } = {}) => {
|
|
49132
49132
|
if (signal?.aborted) {
|
|
49133
49133
|
reject((0, utils_js_1.getAbortError)(signal));
|
|
@@ -49147,7 +49147,7 @@ var require_withRetry = __commonJS({
|
|
|
49147
49147
|
};
|
|
49148
49148
|
try {
|
|
49149
49149
|
const data = await fn();
|
|
49150
|
-
|
|
49150
|
+
resolve4(data);
|
|
49151
49151
|
} catch (err) {
|
|
49152
49152
|
if (signal?.aborted) {
|
|
49153
49153
|
reject((0, utils_js_1.getAbortError)(signal));
|
|
@@ -49327,13 +49327,13 @@ var require_waitForTransactionReceipt = __commonJS({
|
|
|
49327
49327
|
let retrying = false;
|
|
49328
49328
|
let _unobserve;
|
|
49329
49329
|
let _unwatch;
|
|
49330
|
-
const { promise, resolve:
|
|
49330
|
+
const { promise, resolve: resolve4, reject } = (0, withResolvers_js_1.withResolvers)();
|
|
49331
49331
|
const timer = timeout ? setTimeout(() => {
|
|
49332
49332
|
_unwatch?.();
|
|
49333
49333
|
_unobserve?.();
|
|
49334
49334
|
reject(new transaction_js_1.WaitForTransactionReceiptTimeoutError({ hash }));
|
|
49335
49335
|
}, timeout) : void 0;
|
|
49336
|
-
_unobserve = (0, observe_js_1.observe)(observerId, { onReplaced, resolve:
|
|
49336
|
+
_unobserve = (0, observe_js_1.observe)(observerId, { onReplaced, resolve: resolve4, reject }, async (emit) => {
|
|
49337
49337
|
receipt = await (0, getAction_js_1.getAction)(client, getTransactionReceipt_js_1.getTransactionReceipt, "getTransactionReceipt")({ hash }).catch(() => void 0);
|
|
49338
49338
|
if (receipt && confirmations <= 1) {
|
|
49339
49339
|
clearTimeout(timer);
|
|
@@ -59405,7 +59405,7 @@ var require_Account = __commonJS({
|
|
|
59405
59405
|
const currentConfig = config ?? account.config;
|
|
59406
59406
|
if (!currentConfig)
|
|
59407
59407
|
throw new Error("A current multisig config is required for local signing.");
|
|
59408
|
-
const
|
|
59408
|
+
const digest2 = tempo_1.MultisigConfig.getSignPayload({
|
|
59409
59409
|
account: account.address,
|
|
59410
59410
|
config: currentConfig,
|
|
59411
59411
|
payload
|
|
@@ -59415,7 +59415,7 @@ var require_Account = __commonJS({
|
|
|
59415
59415
|
let weight = 0;
|
|
59416
59416
|
for (const signature of providedSignatures) {
|
|
59417
59417
|
const address2 = tempo_1.SignatureEnvelope.extractAddress({
|
|
59418
|
-
payload:
|
|
59418
|
+
payload: digest2,
|
|
59419
59419
|
signature
|
|
59420
59420
|
}).toLowerCase();
|
|
59421
59421
|
const owner = currentConfig.owners.find((owner2) => Address.isEqual(owner2.owner, address2));
|
|
@@ -59436,7 +59436,7 @@ var require_Account = __commonJS({
|
|
|
59436
59436
|
continue;
|
|
59437
59437
|
if (!ownerAccount.sign)
|
|
59438
59438
|
throw new Error("Multisig owner account cannot sign.");
|
|
59439
|
-
signatures.push((0, Signature_js_1.parseApproval)(await ownerAccount.sign({ hash:
|
|
59439
|
+
signatures.push((0, Signature_js_1.parseApproval)(await ownerAccount.sign({ hash: digest2 })));
|
|
59440
59440
|
signedOwners.add(address2);
|
|
59441
59441
|
weight += Number(owner.weight);
|
|
59442
59442
|
if (weight >= Number(currentConfig.threshold))
|
|
@@ -59623,12 +59623,12 @@ var require_Account = __commonJS({
|
|
|
59623
59623
|
if (!from2)
|
|
59624
59624
|
throw new Error("A multisig sender is required for signing.");
|
|
59625
59625
|
const config = tempo_1.MultisigConfig.from(multisigSimulation.config);
|
|
59626
|
-
const
|
|
59626
|
+
const digest2 = tempo_1.MultisigConfig.getSignPayload({
|
|
59627
59627
|
account: from2,
|
|
59628
59628
|
config,
|
|
59629
59629
|
payload
|
|
59630
59630
|
});
|
|
59631
|
-
return await sign({ hash:
|
|
59631
|
+
return await sign({ hash: digest2, raw: true });
|
|
59632
59632
|
}
|
|
59633
59633
|
const signature = await sign({ hash: payload });
|
|
59634
59634
|
const envelope = tempo_1.SignatureEnvelope.from(signature);
|
|
@@ -60344,7 +60344,7 @@ var require_withTimeout = __commonJS({
|
|
|
60344
60344
|
exports.withTimeout = withTimeout;
|
|
60345
60345
|
var utils_js_1 = require_utils5();
|
|
60346
60346
|
function withTimeout(fn, { errorInstance = new Error("timed out"), timeout, signal }) {
|
|
60347
|
-
return new Promise((
|
|
60347
|
+
return new Promise((resolve4, reject) => {
|
|
60348
60348
|
;
|
|
60349
60349
|
(async () => {
|
|
60350
60350
|
let timeoutId;
|
|
@@ -60359,7 +60359,7 @@ var require_withTimeout = __commonJS({
|
|
|
60359
60359
|
}
|
|
60360
60360
|
}, timeout);
|
|
60361
60361
|
}
|
|
60362
|
-
|
|
60362
|
+
resolve4(await fn({ signal: controller?.signal || null }));
|
|
60363
60363
|
} catch (err) {
|
|
60364
60364
|
if (controller?.signal.aborted && (0, utils_js_1.isAbortError)(err)) {
|
|
60365
60365
|
reject(errorInstance);
|
|
@@ -62994,7 +62994,7 @@ var require_websocket = __commonJS({
|
|
|
62994
62994
|
var http2 = __require("http");
|
|
62995
62995
|
var net = __require("net");
|
|
62996
62996
|
var tls = __require("tls");
|
|
62997
|
-
var { randomBytes: randomBytes4, createHash:
|
|
62997
|
+
var { randomBytes: randomBytes4, createHash: createHash3 } = __require("crypto");
|
|
62998
62998
|
var { Duplex, Readable } = __require("stream");
|
|
62999
62999
|
var { URL: URL2 } = __require("url");
|
|
63000
63000
|
var PerMessageDeflate = require_permessage_deflate();
|
|
@@ -63662,8 +63662,8 @@ var require_websocket = __commonJS({
|
|
|
63662
63662
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
63663
63663
|
return;
|
|
63664
63664
|
}
|
|
63665
|
-
const
|
|
63666
|
-
if (res.headers["sec-websocket-accept"] !==
|
|
63665
|
+
const digest2 = createHash3("sha1").update(key + GUID).digest("base64");
|
|
63666
|
+
if (res.headers["sec-websocket-accept"] !== digest2) {
|
|
63667
63667
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
63668
63668
|
return;
|
|
63669
63669
|
}
|
|
@@ -63943,7 +63943,7 @@ var require_stream = __commonJS({
|
|
|
63943
63943
|
};
|
|
63944
63944
|
duplex._final = function(callback) {
|
|
63945
63945
|
if (ws.readyState === ws.CONNECTING) {
|
|
63946
|
-
ws.once("open", function
|
|
63946
|
+
ws.once("open", function open4() {
|
|
63947
63947
|
duplex._final(callback);
|
|
63948
63948
|
});
|
|
63949
63949
|
return;
|
|
@@ -63964,7 +63964,7 @@ var require_stream = __commonJS({
|
|
|
63964
63964
|
};
|
|
63965
63965
|
duplex._write = function(chunk, encoding, callback) {
|
|
63966
63966
|
if (ws.readyState === ws.CONNECTING) {
|
|
63967
|
-
ws.once("open", function
|
|
63967
|
+
ws.once("open", function open4() {
|
|
63968
63968
|
duplex._write(chunk, encoding, callback);
|
|
63969
63969
|
});
|
|
63970
63970
|
return;
|
|
@@ -64031,7 +64031,7 @@ var require_websocket_server = __commonJS({
|
|
|
64031
64031
|
var EventEmitter = __require("events");
|
|
64032
64032
|
var http2 = __require("http");
|
|
64033
64033
|
var { Duplex } = __require("stream");
|
|
64034
|
-
var { createHash:
|
|
64034
|
+
var { createHash: createHash3 } = __require("crypto");
|
|
64035
64035
|
var extension = require_extension();
|
|
64036
64036
|
var PerMessageDeflate = require_permessage_deflate();
|
|
64037
64037
|
var subprotocol = require_subprotocol();
|
|
@@ -64338,12 +64338,12 @@ var require_websocket_server = __commonJS({
|
|
|
64338
64338
|
);
|
|
64339
64339
|
}
|
|
64340
64340
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
64341
|
-
const
|
|
64341
|
+
const digest2 = createHash3("sha1").update(key + GUID).digest("base64");
|
|
64342
64342
|
const headers = [
|
|
64343
64343
|
"HTTP/1.1 101 Switching Protocols",
|
|
64344
64344
|
"Upgrade: websocket",
|
|
64345
64345
|
"Connection: Upgrade",
|
|
64346
|
-
`Sec-WebSocket-Accept: ${
|
|
64346
|
+
`Sec-WebSocket-Accept: ${digest2}`
|
|
64347
64347
|
];
|
|
64348
64348
|
const ws = new this.options.WebSocket(null, void 0, this.options);
|
|
64349
64349
|
if (protocols.size) {
|
|
@@ -64527,10 +64527,10 @@ var require_webSocket = __commonJS({
|
|
|
64527
64527
|
socket.addEventListener("error", onError);
|
|
64528
64528
|
socket.addEventListener("open", onOpen);
|
|
64529
64529
|
if (socket.readyState === WebSocket2.CONNECTING) {
|
|
64530
|
-
await new Promise((
|
|
64530
|
+
await new Promise((resolve4, reject) => {
|
|
64531
64531
|
if (!socket)
|
|
64532
64532
|
return;
|
|
64533
|
-
socket.onopen =
|
|
64533
|
+
socket.onopen = resolve4;
|
|
64534
64534
|
socket.onerror = reject;
|
|
64535
64535
|
});
|
|
64536
64536
|
}
|
|
@@ -73671,7 +73671,7 @@ var require_sendCalls = __commonJS({
|
|
|
73671
73671
|
results.push({ reason, status: "rejected" });
|
|
73672
73672
|
}
|
|
73673
73673
|
if (experimental_fallbackDelay > 0)
|
|
73674
|
-
await new Promise((
|
|
73674
|
+
await new Promise((resolve4) => setTimeout(resolve4, experimental_fallbackDelay));
|
|
73675
73675
|
}
|
|
73676
73676
|
if (results.every((r) => r.status === "rejected"))
|
|
73677
73677
|
throw results[0].reason;
|
|
@@ -73793,9 +73793,9 @@ var require_waitForCallsStatus = __commonJS({
|
|
|
73793
73793
|
async function waitForCallsStatus(client, parameters) {
|
|
73794
73794
|
const { id, pollingInterval = client.pollingInterval, status = ({ statusCode }) => statusCode === 200 || statusCode >= 300, retryCount = 4, retryDelay = ({ count }) => ~~(1 << count) * 200, timeout = 6e4, throwOnFailure = false } = parameters;
|
|
73795
73795
|
const observerId = (0, stringify_js_1.stringify)(["waitForCallsStatus", client.uid, id]);
|
|
73796
|
-
const { promise, resolve:
|
|
73796
|
+
const { promise, resolve: resolve4, reject } = (0, withResolvers_js_1.withResolvers)();
|
|
73797
73797
|
let timer;
|
|
73798
|
-
const unobserve = (0, observe_js_1.observe)(observerId, { resolve:
|
|
73798
|
+
const unobserve = (0, observe_js_1.observe)(observerId, { resolve: resolve4, reject }, (emit) => {
|
|
73799
73799
|
const unpoll = (0, poll_js_1.poll)(async () => {
|
|
73800
73800
|
const done = (fn) => {
|
|
73801
73801
|
clearTimeout(timer);
|
|
@@ -74281,13 +74281,13 @@ var require_utils11 = __commonJS({
|
|
|
74281
74281
|
}
|
|
74282
74282
|
if (!Object.hasOwn(globalThis, "Image"))
|
|
74283
74283
|
return false;
|
|
74284
|
-
return new Promise((
|
|
74284
|
+
return new Promise((resolve4) => {
|
|
74285
74285
|
const img = new Image();
|
|
74286
74286
|
img.onload = () => {
|
|
74287
|
-
|
|
74287
|
+
resolve4(true);
|
|
74288
74288
|
};
|
|
74289
74289
|
img.onerror = () => {
|
|
74290
|
-
|
|
74290
|
+
resolve4(false);
|
|
74291
74291
|
};
|
|
74292
74292
|
img.src = uri;
|
|
74293
74293
|
});
|
|
@@ -78763,7 +78763,7 @@ var require_webSocket2 = __commonJS({
|
|
|
78763
78763
|
},
|
|
78764
78764
|
async subscribe({ params, onData, onError }) {
|
|
78765
78765
|
const rpcClient = await (0, webSocket_js_1.getWebSocketRpcClient)(url_, wsRpcClientOpts);
|
|
78766
|
-
const { result: subscriptionId } = await new Promise((
|
|
78766
|
+
const { result: subscriptionId } = await new Promise((resolve4, reject) => rpcClient.request({
|
|
78767
78767
|
body: {
|
|
78768
78768
|
method: "eth_subscribe",
|
|
78769
78769
|
params
|
|
@@ -78780,7 +78780,7 @@ var require_webSocket2 = __commonJS({
|
|
|
78780
78780
|
return;
|
|
78781
78781
|
}
|
|
78782
78782
|
if (typeof response.id === "number") {
|
|
78783
|
-
|
|
78783
|
+
resolve4(response);
|
|
78784
78784
|
return;
|
|
78785
78785
|
}
|
|
78786
78786
|
if (response.method !== "eth_subscription")
|
|
@@ -78791,12 +78791,12 @@ var require_webSocket2 = __commonJS({
|
|
|
78791
78791
|
return {
|
|
78792
78792
|
subscriptionId,
|
|
78793
78793
|
async unsubscribe() {
|
|
78794
|
-
return new Promise((
|
|
78794
|
+
return new Promise((resolve4) => rpcClient.request({
|
|
78795
78795
|
body: {
|
|
78796
78796
|
method: "eth_unsubscribe",
|
|
78797
78797
|
params: [subscriptionId]
|
|
78798
78798
|
},
|
|
78799
|
-
onResponse:
|
|
78799
|
+
onResponse: resolve4
|
|
78800
78800
|
}));
|
|
78801
78801
|
}
|
|
78802
78802
|
};
|
|
@@ -80654,8 +80654,8 @@ var require_cjs2 = __commonJS({
|
|
|
80654
80654
|
|
|
80655
80655
|
// dist/cli.js
|
|
80656
80656
|
import { homedir } from "node:os";
|
|
80657
|
-
import { readFile as
|
|
80658
|
-
import { join as
|
|
80657
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
80658
|
+
import { join as join7 } from "node:path";
|
|
80659
80659
|
import { createInterface } from "node:readline/promises";
|
|
80660
80660
|
|
|
80661
80661
|
// dist/codex-launcher.js
|
|
@@ -80768,7 +80768,7 @@ async function isCodexProfileInstalled(codexHome) {
|
|
|
80768
80768
|
var spawnCommand = (command, args, options) => spawn(command, args, options);
|
|
80769
80769
|
async function launchCodexProcess(args, spawnImpl = spawnCommand) {
|
|
80770
80770
|
const child = spawnImpl("codex", ["--profile", CODEX_PROFILE_NAME, ...args], { stdio: "inherit" });
|
|
80771
|
-
return new Promise((
|
|
80771
|
+
return new Promise((resolve4, reject) => {
|
|
80772
80772
|
child.once("error", (error) => {
|
|
80773
80773
|
if (error.code === "ENOENT") {
|
|
80774
80774
|
reject(new Error("Codex CLI was not found; install it before running zk-credits codex"));
|
|
@@ -80776,7 +80776,7 @@ async function launchCodexProcess(args, spawnImpl = spawnCommand) {
|
|
|
80776
80776
|
}
|
|
80777
80777
|
reject(error);
|
|
80778
80778
|
});
|
|
80779
|
-
child.once("exit", (code) =>
|
|
80779
|
+
child.once("exit", (code) => resolve4(code ?? 1));
|
|
80780
80780
|
});
|
|
80781
80781
|
}
|
|
80782
80782
|
|
|
@@ -80818,7 +80818,7 @@ function assertManagedProviderArguments(args) {
|
|
|
80818
80818
|
}
|
|
80819
80819
|
}
|
|
80820
80820
|
function waitForCline(child) {
|
|
80821
|
-
return new Promise((
|
|
80821
|
+
return new Promise((resolve4, reject) => {
|
|
80822
80822
|
child.once("error", (error) => {
|
|
80823
80823
|
if (error.code === "ENOENT") {
|
|
80824
80824
|
reject(new Error("Cline CLI was not found; install it with npm install --global cline"));
|
|
@@ -80826,7 +80826,7 @@ function waitForCline(child) {
|
|
|
80826
80826
|
}
|
|
80827
80827
|
reject(error);
|
|
80828
80828
|
});
|
|
80829
|
-
child.once("exit", (code) =>
|
|
80829
|
+
child.once("exit", (code) => resolve4(code ?? 1));
|
|
80830
80830
|
});
|
|
80831
80831
|
}
|
|
80832
80832
|
async function launchClineProcess(options, spawnImpl = spawnCommand2) {
|
|
@@ -81423,6 +81423,8 @@ var ArtifactBundleError = class extends Error {
|
|
|
81423
81423
|
var SHA256_PATTERN = /^[0-9a-f]{64}$/u;
|
|
81424
81424
|
var SAFE_FILE_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u;
|
|
81425
81425
|
var REMOTE_PATTERN = /^[A-Za-z][A-Za-z0-9+.-]*:\/\//u;
|
|
81426
|
+
var ADDRESS_PATTERN = /^0x[0-9a-fA-F]{40}$/u;
|
|
81427
|
+
var RELEASE_REPOSITORY_PATTERN = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u;
|
|
81426
81428
|
function isRecord(value) {
|
|
81427
81429
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
81428
81430
|
}
|
|
@@ -81447,6 +81449,7 @@ function parseCircuitManifest(value) {
|
|
|
81447
81449
|
if (!isRecord(value.circuit))
|
|
81448
81450
|
throw new ArtifactBundleError("artifact_manifest_malformed", "Circuit manifest is missing the circuit block");
|
|
81449
81451
|
const circuit = value.circuit;
|
|
81452
|
+
const network = requiredString(value, "network");
|
|
81450
81453
|
const depth = circuit.depth;
|
|
81451
81454
|
if (!Number.isSafeInteger(depth) || depth <= 0) {
|
|
81452
81455
|
throw new ArtifactBundleError("artifact_manifest_malformed", "Circuit depth must be a positive integer");
|
|
@@ -81469,7 +81472,7 @@ function parseCircuitManifest(value) {
|
|
|
81469
81472
|
const resolved = {
|
|
81470
81473
|
version: 1,
|
|
81471
81474
|
scheme: requiredString(value, "scheme"),
|
|
81472
|
-
network
|
|
81475
|
+
network,
|
|
81473
81476
|
circuit: {
|
|
81474
81477
|
id: requiredString(circuit, "id"),
|
|
81475
81478
|
depth,
|
|
@@ -81477,8 +81480,13 @@ function parseCircuitManifest(value) {
|
|
|
81477
81480
|
zkey: pinnedFile(circuit.zkey, "zkey"),
|
|
81478
81481
|
verificationKey: pinnedFile(circuit.verificationKey, "verificationKey")
|
|
81479
81482
|
},
|
|
81480
|
-
artifacts
|
|
81483
|
+
artifacts,
|
|
81484
|
+
...value.release === void 0 ? {} : { release: parseRelease(value.release) },
|
|
81485
|
+
...value.deployment === void 0 ? {} : { deployment: parseDeployment(value.deployment, requiredString(circuit, "id")) }
|
|
81481
81486
|
};
|
|
81487
|
+
if (resolved.deployment && network !== "eip155:84532") {
|
|
81488
|
+
throw new ArtifactBundleError("artifact_manifest_malformed", "Pinned V2 deployment must use Base Sepolia");
|
|
81489
|
+
}
|
|
81482
81490
|
const pinned = new Set(artifacts.map((artifact) => artifact.file));
|
|
81483
81491
|
for (const role of ARTIFACT_HASHES) {
|
|
81484
81492
|
const file = resolved.circuit[role];
|
|
@@ -81488,6 +81496,33 @@ function parseCircuitManifest(value) {
|
|
|
81488
81496
|
}
|
|
81489
81497
|
return resolved;
|
|
81490
81498
|
}
|
|
81499
|
+
function parseRelease(value) {
|
|
81500
|
+
if (!isRecord(value) || typeof value.repository !== "string" || !RELEASE_REPOSITORY_PATTERN.test(value.repository) || typeof value.tag !== "string" || !/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u.test(value.tag) || !Number.isSafeInteger(value.releaseId) || value.releaseId <= 0 || typeof value.assetName !== "string" || !SAFE_FILE_PATTERN.test(value.assetName) || value.assetName.includes("..") || typeof value.sha256 !== "string" || !SHA256_PATTERN.test(value.sha256)) {
|
|
81501
|
+
throw new ArtifactBundleError("artifact_manifest_malformed", "Circuit manifest release pin is malformed");
|
|
81502
|
+
}
|
|
81503
|
+
return {
|
|
81504
|
+
repository: value.repository,
|
|
81505
|
+
tag: value.tag,
|
|
81506
|
+
releaseId: value.releaseId,
|
|
81507
|
+
assetName: value.assetName,
|
|
81508
|
+
sha256: value.sha256
|
|
81509
|
+
};
|
|
81510
|
+
}
|
|
81511
|
+
function parseDeployment(value, circuitId) {
|
|
81512
|
+
if (!isRecord(value) || value.chainId !== 84532 || typeof value.bondAddress !== "string" || !ADDRESS_PATTERN.test(value.bondAddress) || typeof value.deploymentBlock !== "string" || !/^\d+$/u.test(value.deploymentBlock) || typeof value.deploymentDomain !== "string" || value.deploymentDomain !== "84532" || value.circuitId !== circuitId || typeof value.verifyingKeyId !== "string" || value.verifyingKeyId.length === 0 || typeof value.spendVerifierAddress !== "string" || !ADDRESS_PATTERN.test(value.spendVerifierAddress) || typeof value.groth16VerifierAddress !== "string" || !ADDRESS_PATTERN.test(value.groth16VerifierAddress)) {
|
|
81513
|
+
throw new ArtifactBundleError("artifact_manifest_malformed", "Circuit manifest V2 deployment pin is malformed");
|
|
81514
|
+
}
|
|
81515
|
+
return {
|
|
81516
|
+
chainId: 84532,
|
|
81517
|
+
bondAddress: value.bondAddress,
|
|
81518
|
+
deploymentBlock: value.deploymentBlock,
|
|
81519
|
+
deploymentDomain: value.deploymentDomain,
|
|
81520
|
+
circuitId,
|
|
81521
|
+
verifyingKeyId: value.verifyingKeyId,
|
|
81522
|
+
spendVerifierAddress: value.spendVerifierAddress,
|
|
81523
|
+
groth16VerifierAddress: value.groth16VerifierAddress
|
|
81524
|
+
};
|
|
81525
|
+
}
|
|
81491
81526
|
async function loadCircuitManifest(manifestPath) {
|
|
81492
81527
|
const path = manifestPath ?? resolve(dirname2(fileURLToPath(import.meta.url)), "..", "circuits", "manifest.json");
|
|
81493
81528
|
let raw;
|
|
@@ -81564,8 +81599,8 @@ async function resolvePinnedArtifactBundle(options) {
|
|
|
81564
81599
|
throw new ArtifactBundleError("artifact_missing", `Artifact ${artifact.file} is missing from the pinned bundle`);
|
|
81565
81600
|
}
|
|
81566
81601
|
assertWithinDirectory(realDirectory, realFile, artifact.file);
|
|
81567
|
-
const
|
|
81568
|
-
if (
|
|
81602
|
+
const digest2 = await sha256File(realFile);
|
|
81603
|
+
if (digest2 !== artifact.sha256) {
|
|
81569
81604
|
throw new ArtifactBundleError("artifact_hash_mismatch", `Artifact ${artifact.file} does not match the pinned SHA-256 digest`);
|
|
81570
81605
|
}
|
|
81571
81606
|
}
|
|
@@ -81683,8 +81718,8 @@ function proverProcessFactory(proverPath) {
|
|
|
81683
81718
|
execArgv: [],
|
|
81684
81719
|
stdio: ["ignore", "pipe", "pipe", "ipc"]
|
|
81685
81720
|
});
|
|
81686
|
-
const result = new Promise((
|
|
81687
|
-
child.once("message", (message) =>
|
|
81721
|
+
const result = new Promise((resolve4, reject) => {
|
|
81722
|
+
child.once("message", (message) => resolve4(message));
|
|
81688
81723
|
child.once("error", (error) => reject(error));
|
|
81689
81724
|
child.once("exit", (code, signal) => {
|
|
81690
81725
|
if (code !== 0 && signal === null)
|
|
@@ -81698,11 +81733,11 @@ function proverProcessFactory(proverPath) {
|
|
|
81698
81733
|
terminate: async () => {
|
|
81699
81734
|
if (child.exitCode === null && child.signalCode === null)
|
|
81700
81735
|
child.kill("SIGKILL");
|
|
81701
|
-
await new Promise((
|
|
81736
|
+
await new Promise((resolve4) => {
|
|
81702
81737
|
if (child.exitCode !== null || child.signalCode !== null)
|
|
81703
|
-
|
|
81738
|
+
resolve4();
|
|
81704
81739
|
else
|
|
81705
|
-
child.once("exit", () =>
|
|
81740
|
+
child.once("exit", () => resolve4());
|
|
81706
81741
|
});
|
|
81707
81742
|
}
|
|
81708
81743
|
};
|
|
@@ -82116,8 +82151,8 @@ async function startDetachedProcess(specification) {
|
|
|
82116
82151
|
env: specification.env,
|
|
82117
82152
|
stdio: [specification.stdin === void 0 ? "ignore" : "pipe", log.fd, log.fd]
|
|
82118
82153
|
});
|
|
82119
|
-
await new Promise((
|
|
82120
|
-
child.once("spawn",
|
|
82154
|
+
await new Promise((resolve4, reject) => {
|
|
82155
|
+
child.once("spawn", resolve4);
|
|
82121
82156
|
child.once("error", reject);
|
|
82122
82157
|
});
|
|
82123
82158
|
if (specification.stdin !== void 0 && child.stdin) {
|
|
@@ -82132,7 +82167,7 @@ async function startDetachedProcess(specification) {
|
|
|
82132
82167
|
var defaultRuntime = {
|
|
82133
82168
|
fetchHealth: async (url) => fetch(url, { signal: AbortSignal.timeout(500) }),
|
|
82134
82169
|
startDetachedProcess,
|
|
82135
|
-
wait: async (milliseconds) => new Promise((
|
|
82170
|
+
wait: async (milliseconds) => new Promise((resolve4) => setTimeout(resolve4, milliseconds))
|
|
82136
82171
|
};
|
|
82137
82172
|
function createNodeSidecarLifecycle(options, runtime = defaultRuntime) {
|
|
82138
82173
|
const url = new URL(options.loopbackBaseUrl);
|
|
@@ -82177,9 +82212,241 @@ async function activateSidecarServer(activation) {
|
|
|
82177
82212
|
}
|
|
82178
82213
|
|
|
82179
82214
|
// dist/setup-config.js
|
|
82180
|
-
import { randomUUID } from "node:crypto";
|
|
82181
|
-
import { chmod as
|
|
82215
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
82216
|
+
import { chmod as chmod6, lstat as lstat2, mkdir as mkdir8, open as open3, readFile as readFile6, readdir, realpath as realpath2, rename as rename5, rm as rm2 } from "node:fs/promises";
|
|
82217
|
+
import { dirname as dirname7, join as join6, resolve as resolve3 } from "node:path";
|
|
82218
|
+
|
|
82219
|
+
// dist/artifact-release.js
|
|
82220
|
+
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
82221
|
+
import { execFile as nodeExecFile } from "node:child_process";
|
|
82222
|
+
import { gunzipSync } from "node:zlib";
|
|
82223
|
+
import { promisify as promisify2 } from "node:util";
|
|
82224
|
+
import { chmod as chmod5, lstat, mkdir as mkdir7, open as open2, readFile as readFile5, rename as rename4, rm } from "node:fs/promises";
|
|
82182
82225
|
import { dirname as dirname6, join as join5, resolve as resolve2 } from "node:path";
|
|
82226
|
+
var execFile = promisify2(nodeExecFile);
|
|
82227
|
+
var MAX_COMPRESSED_BYTES = 20 * 1024 * 1024;
|
|
82228
|
+
var MAX_EXPANDED_BYTES = 32 * 1024 * 1024;
|
|
82229
|
+
var BLOCK_BYTES = 512;
|
|
82230
|
+
var SAFE_TAR_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u;
|
|
82231
|
+
function digest(bytes) {
|
|
82232
|
+
return createHash2("sha256").update(bytes).digest("hex");
|
|
82233
|
+
}
|
|
82234
|
+
function zeroBlock(block) {
|
|
82235
|
+
return block.every((byte) => byte === 0);
|
|
82236
|
+
}
|
|
82237
|
+
function tarText(header, start, length, label) {
|
|
82238
|
+
const bytes = header.subarray(start, start + length);
|
|
82239
|
+
const terminator = bytes.indexOf(0);
|
|
82240
|
+
const value = bytes.subarray(0, terminator < 0 ? bytes.length : terminator);
|
|
82241
|
+
if (!value.every((byte) => byte >= 32 && byte <= 126)) {
|
|
82242
|
+
throw new Error("Pinned proving bundle archive contains an invalid " + label);
|
|
82243
|
+
}
|
|
82244
|
+
return value.toString("ascii");
|
|
82245
|
+
}
|
|
82246
|
+
function tarOctal(header, start, length, label) {
|
|
82247
|
+
const value = tarText(header, start, length, label).trim();
|
|
82248
|
+
if (!value)
|
|
82249
|
+
return 0;
|
|
82250
|
+
if (!/^[0-7]+$/u.test(value))
|
|
82251
|
+
throw new Error("Pinned proving bundle archive has an invalid " + label);
|
|
82252
|
+
const parsed = Number.parseInt(value, 8);
|
|
82253
|
+
if (!Number.isSafeInteger(parsed) || parsed < 0)
|
|
82254
|
+
throw new Error("Pinned proving bundle archive has an invalid " + label);
|
|
82255
|
+
return parsed;
|
|
82256
|
+
}
|
|
82257
|
+
function parseTar(archive, allowedNames) {
|
|
82258
|
+
if (archive.length === 0 || archive.length > MAX_EXPANDED_BYTES || archive.length % BLOCK_BYTES !== 0) {
|
|
82259
|
+
throw new Error("Pinned proving bundle archive has an invalid size");
|
|
82260
|
+
}
|
|
82261
|
+
const files = /* @__PURE__ */ new Map();
|
|
82262
|
+
let offset = 0;
|
|
82263
|
+
let endBlocks = 0;
|
|
82264
|
+
while (offset + BLOCK_BYTES <= archive.length) {
|
|
82265
|
+
const header = archive.subarray(offset, offset + BLOCK_BYTES);
|
|
82266
|
+
if (zeroBlock(header)) {
|
|
82267
|
+
endBlocks += 1;
|
|
82268
|
+
offset += BLOCK_BYTES;
|
|
82269
|
+
if (endBlocks === 2)
|
|
82270
|
+
break;
|
|
82271
|
+
continue;
|
|
82272
|
+
}
|
|
82273
|
+
if (endBlocks > 0)
|
|
82274
|
+
throw new Error("Pinned proving bundle archive has a malformed end marker");
|
|
82275
|
+
const recordedChecksum = tarOctal(header, 148, 8, "header checksum");
|
|
82276
|
+
const checksumHeader = Buffer.from(header);
|
|
82277
|
+
checksumHeader.fill(32, 148, 156);
|
|
82278
|
+
const actualChecksum = checksumHeader.reduce((sum, byte) => sum + byte, 0);
|
|
82279
|
+
if (recordedChecksum !== actualChecksum)
|
|
82280
|
+
throw new Error("Pinned proving bundle archive failed its header checksum");
|
|
82281
|
+
const magic = header.subarray(257, 263).toString("ascii");
|
|
82282
|
+
if (magic !== "ustar\0" && magic !== "ustar ") {
|
|
82283
|
+
throw new Error("Pinned proving bundle archive must use the USTAR format");
|
|
82284
|
+
}
|
|
82285
|
+
const name = tarText(header, 0, 100, "entry name");
|
|
82286
|
+
const prefix = tarText(header, 345, 155, "entry prefix");
|
|
82287
|
+
if (!name || prefix || !SAFE_TAR_NAME.test(name) || name.includes("..") || !allowedNames.has(name)) {
|
|
82288
|
+
throw new Error("Pinned proving bundle archive contains an unexpected entry");
|
|
82289
|
+
}
|
|
82290
|
+
const type = header[156];
|
|
82291
|
+
if (type !== 0 && type !== 48)
|
|
82292
|
+
throw new Error("Pinned proving bundle archive contains a non-file entry");
|
|
82293
|
+
if (tarText(header, 157, 100, "link target"))
|
|
82294
|
+
throw new Error("Pinned proving bundle archive contains a link");
|
|
82295
|
+
if (files.has(name))
|
|
82296
|
+
throw new Error("Pinned proving bundle archive contains a duplicate entry");
|
|
82297
|
+
const size = tarOctal(header, 124, 12, "entry size");
|
|
82298
|
+
const dataStart = offset + BLOCK_BYTES;
|
|
82299
|
+
const dataEnd = dataStart + size;
|
|
82300
|
+
const paddedEnd = dataStart + Math.ceil(size / BLOCK_BYTES) * BLOCK_BYTES;
|
|
82301
|
+
if (size <= 0 || dataEnd > archive.length || paddedEnd > archive.length) {
|
|
82302
|
+
throw new Error("Pinned proving bundle archive entry exceeds its bounds");
|
|
82303
|
+
}
|
|
82304
|
+
if (!zeroBlock(archive.subarray(dataEnd, paddedEnd))) {
|
|
82305
|
+
throw new Error("Pinned proving bundle archive has invalid entry padding");
|
|
82306
|
+
}
|
|
82307
|
+
files.set(name, Buffer.from(archive.subarray(dataStart, dataEnd)));
|
|
82308
|
+
offset = paddedEnd;
|
|
82309
|
+
}
|
|
82310
|
+
if (endBlocks !== 2)
|
|
82311
|
+
throw new Error("Pinned proving bundle archive is missing its end marker");
|
|
82312
|
+
if (!zeroBlock(archive.subarray(offset)))
|
|
82313
|
+
throw new Error("Pinned proving bundle archive has trailing data");
|
|
82314
|
+
if (files.size !== allowedNames.size || [...allowedNames].some((name) => !files.has(name))) {
|
|
82315
|
+
throw new Error("Pinned proving bundle archive is incomplete");
|
|
82316
|
+
}
|
|
82317
|
+
return files;
|
|
82318
|
+
}
|
|
82319
|
+
async function defaultGithubCommand(arguments_) {
|
|
82320
|
+
try {
|
|
82321
|
+
const { stdout } = await execFile("gh", [...arguments_], {
|
|
82322
|
+
encoding: "utf8",
|
|
82323
|
+
timeout: 6e4,
|
|
82324
|
+
maxBuffer: 2 * 1024 * 1024,
|
|
82325
|
+
windowsHide: true
|
|
82326
|
+
});
|
|
82327
|
+
return stdout;
|
|
82328
|
+
} catch {
|
|
82329
|
+
throw new Error("Pinned proving release could not be read; authenticate with gh and confirm repository access.");
|
|
82330
|
+
}
|
|
82331
|
+
}
|
|
82332
|
+
function pinnedAsset(release, raw) {
|
|
82333
|
+
let value;
|
|
82334
|
+
try {
|
|
82335
|
+
value = JSON.parse(raw);
|
|
82336
|
+
} catch {
|
|
82337
|
+
throw new Error("Pinned proving release metadata is invalid");
|
|
82338
|
+
}
|
|
82339
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
82340
|
+
throw new Error("Pinned proving release metadata is invalid");
|
|
82341
|
+
}
|
|
82342
|
+
const record = value;
|
|
82343
|
+
const assets = Array.isArray(record.assets) ? record.assets : [];
|
|
82344
|
+
const asset = assets.find((entry) => entry && typeof entry === "object" && !Array.isArray(entry) && entry.name === release.assetName);
|
|
82345
|
+
if (record.id !== release.releaseId || record.tag_name !== release.tag || record.draft !== false || record.immutable !== true || !asset || typeof asset.digest === "string" && asset.digest !== "sha256:" + release.sha256) {
|
|
82346
|
+
throw new Error("Pinned proving release identity or immutability check failed");
|
|
82347
|
+
}
|
|
82348
|
+
}
|
|
82349
|
+
async function writeBundleFile(directory, name, bytes) {
|
|
82350
|
+
const file = await open2(join5(directory, name), "wx", 384);
|
|
82351
|
+
try {
|
|
82352
|
+
await file.writeFile(bytes);
|
|
82353
|
+
await file.sync();
|
|
82354
|
+
} finally {
|
|
82355
|
+
await file.close();
|
|
82356
|
+
}
|
|
82357
|
+
}
|
|
82358
|
+
async function replaceDirectoryAtomically(stage, target) {
|
|
82359
|
+
const parent = dirname6(target);
|
|
82360
|
+
await mkdir7(parent, { recursive: true, mode: 448 });
|
|
82361
|
+
const backup = join5(parent, ".base-sepolia-old-" + randomUUID());
|
|
82362
|
+
let movedOld = false;
|
|
82363
|
+
try {
|
|
82364
|
+
try {
|
|
82365
|
+
const existing = await lstat(target);
|
|
82366
|
+
if (existing.isSymbolicLink() || !existing.isDirectory()) {
|
|
82367
|
+
throw new Error("Local proving bundle destination must be a regular directory");
|
|
82368
|
+
}
|
|
82369
|
+
await rename4(target, backup);
|
|
82370
|
+
movedOld = true;
|
|
82371
|
+
} catch (error) {
|
|
82372
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
82373
|
+
} else {
|
|
82374
|
+
throw error;
|
|
82375
|
+
}
|
|
82376
|
+
}
|
|
82377
|
+
try {
|
|
82378
|
+
await rename4(stage, target);
|
|
82379
|
+
await chmod5(target, 448);
|
|
82380
|
+
} catch (error) {
|
|
82381
|
+
if (movedOld)
|
|
82382
|
+
await rename4(backup, target);
|
|
82383
|
+
throw error;
|
|
82384
|
+
}
|
|
82385
|
+
if (movedOld)
|
|
82386
|
+
await rm(backup, { recursive: true, force: true }).catch(() => void 0);
|
|
82387
|
+
} finally {
|
|
82388
|
+
await rm(stage, { recursive: true, force: true });
|
|
82389
|
+
}
|
|
82390
|
+
}
|
|
82391
|
+
async function acquirePinnedArtifactBundle(options) {
|
|
82392
|
+
const release = options.manifest.release;
|
|
82393
|
+
if (!release)
|
|
82394
|
+
throw new Error("This sidecar manifest has no pinned artifact release");
|
|
82395
|
+
const names = new Set(options.manifest.artifacts.map((artifact) => artifact.file));
|
|
82396
|
+
const command = options.runGithubCommand ?? defaultGithubCommand;
|
|
82397
|
+
const parent = dirname6(resolve2(options.targetDirectory));
|
|
82398
|
+
const tempDirectory = join5(parent, ".base-sepolia-download-" + randomUUID());
|
|
82399
|
+
const stage = join5(parent, ".base-sepolia-stage-" + randomUUID());
|
|
82400
|
+
try {
|
|
82401
|
+
await mkdir7(parent, { recursive: true, mode: 448 });
|
|
82402
|
+
await mkdir7(tempDirectory, { recursive: false, mode: 448 });
|
|
82403
|
+
await mkdir7(stage, { recursive: false, mode: 448 });
|
|
82404
|
+
const releaseJson = await command(["api", `repos/${release.repository}/releases/${release.releaseId}`]);
|
|
82405
|
+
pinnedAsset(release, releaseJson);
|
|
82406
|
+
await command([
|
|
82407
|
+
"release",
|
|
82408
|
+
"download",
|
|
82409
|
+
release.tag,
|
|
82410
|
+
"--repo",
|
|
82411
|
+
release.repository,
|
|
82412
|
+
"--dir",
|
|
82413
|
+
tempDirectory,
|
|
82414
|
+
"--pattern",
|
|
82415
|
+
release.assetName
|
|
82416
|
+
]);
|
|
82417
|
+
const archivePath = join5(tempDirectory, release.assetName);
|
|
82418
|
+
const archiveInfo = await lstat(archivePath);
|
|
82419
|
+
if (archiveInfo.isSymbolicLink() || !archiveInfo.isFile() || archiveInfo.size > MAX_COMPRESSED_BYTES) {
|
|
82420
|
+
throw new Error("Pinned proving bundle archive is missing or too large");
|
|
82421
|
+
}
|
|
82422
|
+
const compressed = await readFile5(archivePath);
|
|
82423
|
+
if (digest(compressed) !== release.sha256)
|
|
82424
|
+
throw new Error("Pinned proving bundle archive failed its SHA-256 check");
|
|
82425
|
+
let expanded;
|
|
82426
|
+
try {
|
|
82427
|
+
expanded = gunzipSync(compressed, { maxOutputLength: MAX_EXPANDED_BYTES });
|
|
82428
|
+
} catch {
|
|
82429
|
+
throw new Error("Pinned proving bundle archive is not a bounded gzip tarball");
|
|
82430
|
+
}
|
|
82431
|
+
const files = parseTar(expanded, names);
|
|
82432
|
+
for (const [name, bytes] of files)
|
|
82433
|
+
await writeBundleFile(stage, name, bytes);
|
|
82434
|
+
await chmod5(stage, 448);
|
|
82435
|
+
await resolvePinnedArtifactBundle({ artifactDirectory: stage, manifest: options.manifest });
|
|
82436
|
+
await replaceDirectoryAtomically(stage, resolve2(options.targetDirectory));
|
|
82437
|
+
await resolvePinnedArtifactBundle({ artifactDirectory: resolve2(options.targetDirectory), manifest: options.manifest });
|
|
82438
|
+
return resolve2(options.targetDirectory);
|
|
82439
|
+
} catch (error) {
|
|
82440
|
+
if (error instanceof Error && /^(Pinned proving|This sidecar manifest|Local proving bundle)/u.test(error.message))
|
|
82441
|
+
throw error;
|
|
82442
|
+
throw new Error("Pinned proving bundle acquisition failed; verify gh access and the published release pin.");
|
|
82443
|
+
} finally {
|
|
82444
|
+
await rm(tempDirectory, { recursive: true, force: true });
|
|
82445
|
+
await rm(stage, { recursive: true, force: true });
|
|
82446
|
+
}
|
|
82447
|
+
}
|
|
82448
|
+
|
|
82449
|
+
// dist/setup-config.js
|
|
82183
82450
|
var WITNESS_FILENAMES = /* @__PURE__ */ new Set([
|
|
82184
82451
|
"base-tree.json",
|
|
82185
82452
|
"base-sepolia-tree.json",
|
|
@@ -82197,7 +82464,7 @@ function absolutePath(value, label) {
|
|
|
82197
82464
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
82198
82465
|
throw new Error("Setup configuration " + label + " is required");
|
|
82199
82466
|
}
|
|
82200
|
-
return
|
|
82467
|
+
return resolve3(value);
|
|
82201
82468
|
}
|
|
82202
82469
|
function optionalUnsignedString(value, label) {
|
|
82203
82470
|
if (value === void 0)
|
|
@@ -82247,9 +82514,9 @@ function optionalEnvironmentInteger(environment, name) {
|
|
|
82247
82514
|
}
|
|
82248
82515
|
async function candidateDirectories(homeDirectory, stateDirectory2) {
|
|
82249
82516
|
const roots = [
|
|
82250
|
-
|
|
82251
|
-
|
|
82252
|
-
|
|
82517
|
+
join6(stateDirectory2, "artifacts", "base-sepolia"),
|
|
82518
|
+
join6(homeDirectory, ".zk-credits", "artifacts", "base-sepolia"),
|
|
82519
|
+
join6(homeDirectory, "Downloads")
|
|
82253
82520
|
];
|
|
82254
82521
|
const candidates = [...roots];
|
|
82255
82522
|
for (const root of roots) {
|
|
@@ -82261,10 +82528,10 @@ async function candidateDirectories(homeDirectory, stateDirectory2) {
|
|
|
82261
82528
|
}
|
|
82262
82529
|
for (const entry of entries) {
|
|
82263
82530
|
if (entry.isDirectory())
|
|
82264
|
-
candidates.push(
|
|
82531
|
+
candidates.push(join6(root, entry.name));
|
|
82265
82532
|
}
|
|
82266
82533
|
}
|
|
82267
|
-
return [...new Set(candidates.map((path) =>
|
|
82534
|
+
return [...new Set(candidates.map((path) => resolve3(path)))];
|
|
82268
82535
|
}
|
|
82269
82536
|
async function chooseOne(kind, candidates, chooseCandidate) {
|
|
82270
82537
|
if (candidates.length === 1)
|
|
@@ -82274,14 +82541,14 @@ async function chooseOne(kind, candidates, chooseCandidate) {
|
|
|
82274
82541
|
throw new Error("Found more than one valid " + kind + "; set " + variable + " to choose one.");
|
|
82275
82542
|
}
|
|
82276
82543
|
const selected = await chooseCandidate(kind, candidates);
|
|
82277
|
-
if (!candidates.includes(
|
|
82544
|
+
if (!candidates.includes(resolve3(selected))) {
|
|
82278
82545
|
throw new Error("The selected " + kind + " is not one of the validated local candidates");
|
|
82279
82546
|
}
|
|
82280
|
-
return
|
|
82547
|
+
return resolve3(selected);
|
|
82281
82548
|
}
|
|
82282
82549
|
async function resolveArtifactDirectory(options, saved) {
|
|
82283
82550
|
const explicit = options.environment.ZK_CREDITS_ARTIFACT_DIR?.trim();
|
|
82284
|
-
const candidates = explicit ? [
|
|
82551
|
+
const candidates = explicit ? [resolve3(options.workingDirectory ?? process.cwd(), explicit)] : [
|
|
82285
82552
|
...saved ? [saved.artifactDirectory] : [],
|
|
82286
82553
|
...await candidateDirectories(options.homeDirectory, options.stateDirectory)
|
|
82287
82554
|
];
|
|
@@ -82293,7 +82560,7 @@ async function resolveArtifactDirectory(options, saved) {
|
|
|
82293
82560
|
artifactDirectory: candidate,
|
|
82294
82561
|
manifest: options.manifest
|
|
82295
82562
|
});
|
|
82296
|
-
let identity =
|
|
82563
|
+
let identity = resolve3(bundle.directory);
|
|
82297
82564
|
try {
|
|
82298
82565
|
identity = await realpath2(bundle.directory);
|
|
82299
82566
|
} catch {
|
|
@@ -82309,42 +82576,72 @@ async function resolveArtifactDirectory(options, saved) {
|
|
|
82309
82576
|
throw new Error("The configured proving bundle at " + explicit + " failed its pinned checks." + reason);
|
|
82310
82577
|
}
|
|
82311
82578
|
if (valid.size === 0) {
|
|
82312
|
-
|
|
82579
|
+
if (options.manifest.release && !explicit) {
|
|
82580
|
+
const targetDirectory = resolve3(options.stateDirectory, "artifacts", "base-sepolia");
|
|
82581
|
+
const acquire = options.acquireArtifactBundle ?? (async (target, manifest) => {
|
|
82582
|
+
await acquirePinnedArtifactBundle({ manifest, targetDirectory: target });
|
|
82583
|
+
});
|
|
82584
|
+
await acquire(targetDirectory, options.manifest);
|
|
82585
|
+
const bundle = await resolvePinnedArtifactBundle({ artifactDirectory: targetDirectory, manifest: options.manifest });
|
|
82586
|
+
return resolve3(bundle.directory);
|
|
82587
|
+
}
|
|
82588
|
+
throw new Error("Could not find a valid pinned proving bundle. Set ZK_CREDITS_ARTIFACT_DIR to a verified local bundle.");
|
|
82313
82589
|
}
|
|
82314
82590
|
const selected = await chooseOne("proving bundle", [...valid.values()], options.chooseCandidate);
|
|
82315
|
-
return
|
|
82591
|
+
return resolve3(selected);
|
|
82316
82592
|
}
|
|
82317
|
-
function eventSourceFromEnvironment(environment) {
|
|
82593
|
+
function eventSourceFromEnvironment(environment, manifest) {
|
|
82318
82594
|
const rpcUrl = environment.BASE_RPC_URL?.trim();
|
|
82319
|
-
const
|
|
82595
|
+
const configuredContract = environment.BASE_PRIVATE_CREDIT_BOND_ADDRESS?.trim();
|
|
82596
|
+
const configuredBlock = optionalEnvironmentInteger(environment, "BASE_DEPLOYMENT_BLOCK");
|
|
82597
|
+
const deployment = manifest.deployment;
|
|
82598
|
+
if (deployment) {
|
|
82599
|
+
if (configuredContract && configuredContract.toLowerCase() !== deployment.bondAddress.toLowerCase()) {
|
|
82600
|
+
throw new Error("BASE_PRIVATE_CREDIT_BOND_ADDRESS does not match the pinned Base Sepolia V2 bond");
|
|
82601
|
+
}
|
|
82602
|
+
if (configuredBlock && configuredBlock !== deployment.deploymentBlock) {
|
|
82603
|
+
throw new Error("BASE_DEPLOYMENT_BLOCK does not match the pinned Base Sepolia V2 deployment block");
|
|
82604
|
+
}
|
|
82605
|
+
}
|
|
82606
|
+
const contractAddress = deployment?.bondAddress ?? configuredContract;
|
|
82320
82607
|
if (!rpcUrl || !contractAddress)
|
|
82321
82608
|
return void 0;
|
|
82322
|
-
const deploymentBlock = optionalEnvironmentInteger(environment, "BASE_DEPLOYMENT_BLOCK");
|
|
82323
82609
|
const confirmations = optionalEnvironmentInteger(environment, "BASE_CONFIRMATIONS");
|
|
82324
82610
|
return {
|
|
82325
82611
|
kind: "base-events",
|
|
82326
82612
|
rpcUrl,
|
|
82327
82613
|
contractAddress,
|
|
82328
|
-
...deploymentBlock === void 0 ? {} : { deploymentBlock },
|
|
82614
|
+
...deployment ? { deploymentBlock: deployment.deploymentBlock } : configuredBlock === void 0 ? {} : { deploymentBlock: configuredBlock },
|
|
82329
82615
|
...confirmations === void 0 ? {} : { confirmations }
|
|
82330
82616
|
};
|
|
82331
82617
|
}
|
|
82618
|
+
function assertPinnedEventSource(source, manifest) {
|
|
82619
|
+
const deployment = manifest.deployment;
|
|
82620
|
+
if (!deployment)
|
|
82621
|
+
return;
|
|
82622
|
+
if (source.kind !== "base-events" || source.contractAddress.toLowerCase() !== deployment.bondAddress.toLowerCase() || source.deploymentBlock !== deployment.deploymentBlock) {
|
|
82623
|
+
throw new Error("Saved Base event witness source does not match the pinned Base Sepolia V2 deployment");
|
|
82624
|
+
}
|
|
82625
|
+
}
|
|
82332
82626
|
function witnessCandidates(homeDirectory, stateDirectory2) {
|
|
82333
82627
|
const roots = [
|
|
82334
|
-
|
|
82335
|
-
|
|
82336
|
-
|
|
82337
|
-
|
|
82628
|
+
join6(stateDirectory2, "witnesses"),
|
|
82629
|
+
join6(stateDirectory2, "witness"),
|
|
82630
|
+
join6(homeDirectory, ".zk-credits", "witnesses"),
|
|
82631
|
+
join6(homeDirectory, "Downloads")
|
|
82338
82632
|
];
|
|
82339
|
-
return [...new Set(roots.flatMap((root) => [...WITNESS_FILENAMES].map((name) =>
|
|
82633
|
+
return [...new Set(roots.flatMap((root) => [...WITNESS_FILENAMES].map((name) => resolve3(root, name))))];
|
|
82340
82634
|
}
|
|
82341
82635
|
async function resolveWitnessSource(options, saved) {
|
|
82342
82636
|
const environment = options.environment;
|
|
82343
82637
|
const explicitPath = environment.ZK_CREDITS_WITNESS_PATH?.trim();
|
|
82344
82638
|
if (explicitPath) {
|
|
82639
|
+
if (options.manifest.deployment) {
|
|
82640
|
+
throw new Error("Base Sepolia V2 setup requires a witness synchronized from the pinned public Base events");
|
|
82641
|
+
}
|
|
82345
82642
|
const source = {
|
|
82346
82643
|
kind: "file",
|
|
82347
|
-
path:
|
|
82644
|
+
path: resolve3(options.workingDirectory ?? process.cwd(), explicitPath)
|
|
82348
82645
|
};
|
|
82349
82646
|
try {
|
|
82350
82647
|
await options.validateWitness(source);
|
|
@@ -82354,7 +82651,7 @@ async function resolveWitnessSource(options, saved) {
|
|
|
82354
82651
|
throw new Error("The configured Base witness at " + explicitPath + " failed validation." + reason);
|
|
82355
82652
|
}
|
|
82356
82653
|
}
|
|
82357
|
-
const environmentSource = eventSourceFromEnvironment(environment);
|
|
82654
|
+
const environmentSource = eventSourceFromEnvironment(environment, options.manifest);
|
|
82358
82655
|
if (environmentSource) {
|
|
82359
82656
|
try {
|
|
82360
82657
|
await options.validateWitness(environmentSource);
|
|
@@ -82366,6 +82663,7 @@ async function resolveWitnessSource(options, saved) {
|
|
|
82366
82663
|
}
|
|
82367
82664
|
if (saved?.witness.kind === "base-events") {
|
|
82368
82665
|
try {
|
|
82666
|
+
assertPinnedEventSource(saved.witness, options.manifest);
|
|
82369
82667
|
await options.validateWitness(saved.witness);
|
|
82370
82668
|
return saved.witness;
|
|
82371
82669
|
} catch (error) {
|
|
@@ -82373,6 +82671,9 @@ async function resolveWitnessSource(options, saved) {
|
|
|
82373
82671
|
throw new Error("Saved Base event witness source failed validation." + reason);
|
|
82374
82672
|
}
|
|
82375
82673
|
}
|
|
82674
|
+
if (options.manifest.deployment) {
|
|
82675
|
+
throw new Error("Base Sepolia V2 setup requires BASE_RPC_URL to sync the pinned V2 bond from its deployment block");
|
|
82676
|
+
}
|
|
82376
82677
|
if (saved?.witness.kind === "file") {
|
|
82377
82678
|
try {
|
|
82378
82679
|
await options.validateWitness(saved.witness);
|
|
@@ -82383,7 +82684,7 @@ async function resolveWitnessSource(options, saved) {
|
|
|
82383
82684
|
const valid = [];
|
|
82384
82685
|
for (const path of witnessCandidates(options.homeDirectory, options.stateDirectory)) {
|
|
82385
82686
|
try {
|
|
82386
|
-
const info = await
|
|
82687
|
+
const info = await lstat2(path);
|
|
82387
82688
|
if (!info.isFile())
|
|
82388
82689
|
continue;
|
|
82389
82690
|
const source = { kind: "file", path };
|
|
@@ -82406,10 +82707,10 @@ async function resolveSetupInputs(options) {
|
|
|
82406
82707
|
async function readSetupConfig(path) {
|
|
82407
82708
|
let raw;
|
|
82408
82709
|
try {
|
|
82409
|
-
const info = await
|
|
82710
|
+
const info = await lstat2(path);
|
|
82410
82711
|
if (!info.isFile())
|
|
82411
82712
|
throw new Error("Local setup config must be a regular file");
|
|
82412
|
-
raw = await
|
|
82713
|
+
raw = await readFile6(path, "utf8");
|
|
82413
82714
|
} catch (error) {
|
|
82414
82715
|
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT")
|
|
82415
82716
|
return void 0;
|
|
@@ -82426,30 +82727,30 @@ async function readSetupConfig(path) {
|
|
|
82426
82727
|
}
|
|
82427
82728
|
async function writeSetupConfig(path, config) {
|
|
82428
82729
|
const normalized = parseSetupConfig(config);
|
|
82429
|
-
const directory =
|
|
82430
|
-
await
|
|
82431
|
-
const destination =
|
|
82730
|
+
const directory = dirname7(resolve3(path));
|
|
82731
|
+
await mkdir8(directory, { recursive: true, mode: 448 });
|
|
82732
|
+
const destination = resolve3(path);
|
|
82432
82733
|
try {
|
|
82433
|
-
const existing = await
|
|
82734
|
+
const existing = await lstat2(destination);
|
|
82434
82735
|
if (existing.isSymbolicLink())
|
|
82435
82736
|
throw new Error("Local setup config cannot be a symbolic link");
|
|
82436
82737
|
} catch (error) {
|
|
82437
82738
|
if (!(error && typeof error === "object" && "code" in error && error.code === "ENOENT"))
|
|
82438
82739
|
throw error;
|
|
82439
82740
|
}
|
|
82440
|
-
const temporary =
|
|
82741
|
+
const temporary = join6(directory, ".config-" + randomUUID2() + ".tmp");
|
|
82441
82742
|
try {
|
|
82442
|
-
const file = await
|
|
82743
|
+
const file = await open3(temporary, "wx", 384);
|
|
82443
82744
|
try {
|
|
82444
82745
|
await file.writeFile(JSON.stringify(normalized, null, 2) + "\n", "utf8");
|
|
82445
82746
|
await file.sync();
|
|
82446
82747
|
} finally {
|
|
82447
82748
|
await file.close();
|
|
82448
82749
|
}
|
|
82449
|
-
await
|
|
82450
|
-
await
|
|
82750
|
+
await rename5(temporary, destination);
|
|
82751
|
+
await chmod6(destination, 384);
|
|
82451
82752
|
} finally {
|
|
82452
|
-
await
|
|
82753
|
+
await rm2(temporary, { force: true });
|
|
82453
82754
|
}
|
|
82454
82755
|
}
|
|
82455
82756
|
function applySetupConfig(environment, config) {
|
|
@@ -82494,7 +82795,7 @@ async function ensureSidecarReady(dependencies, options = {}) {
|
|
|
82494
82795
|
import { createServer } from "node:http";
|
|
82495
82796
|
|
|
82496
82797
|
// dist/responses-bridge.js
|
|
82497
|
-
import { randomUUID as
|
|
82798
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
82498
82799
|
function isRecord3(value) {
|
|
82499
82800
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
82500
82801
|
}
|
|
@@ -82636,7 +82937,7 @@ function translateResponsesRequest(body) {
|
|
|
82636
82937
|
if (body.include !== void 0 && (!Array.isArray(body.include) || body.include.some((value) => value !== "reasoning.encrypted_content"))) {
|
|
82637
82938
|
return { ok: false, error: "unsupported_include" };
|
|
82638
82939
|
}
|
|
82639
|
-
if (body.reasoning !== void 0 && (!isRecord3(body.reasoning) || !hasOnlyKeys(body.reasoning, ["summary"]) || body.reasoning.summary !== void 0 && !["auto", "concise", "detailed"].includes(String(body.reasoning.summary)))) {
|
|
82940
|
+
if (body.reasoning !== void 0 && (!isRecord3(body.reasoning) || !hasOnlyKeys(body.reasoning, ["effort", "summary"]) || body.reasoning.effort !== void 0 && body.reasoning.effort !== "none" || body.reasoning.summary !== void 0 && !["none", "auto", "concise", "detailed"].includes(String(body.reasoning.summary)))) {
|
|
82640
82941
|
return { ok: false, error: "unsupported_reasoning_controls" };
|
|
82641
82942
|
}
|
|
82642
82943
|
if (body.parallel_tool_calls !== void 0 && typeof body.parallel_tool_calls !== "boolean") {
|
|
@@ -82699,7 +83000,7 @@ function responsesEventStream(chatValue, model) {
|
|
|
82699
83000
|
if (!isRecord3(choice.message))
|
|
82700
83001
|
throw new Error("Gateway returned an invalid chat message");
|
|
82701
83002
|
const message = choice.message;
|
|
82702
|
-
const responseSuffix =
|
|
83003
|
+
const responseSuffix = randomUUID3().replaceAll("-", "");
|
|
82703
83004
|
const responseId = `resp_${responseSuffix}`;
|
|
82704
83005
|
const events = [];
|
|
82705
83006
|
let sequence = 0;
|
|
@@ -82733,7 +83034,7 @@ function responsesEventStream(chatValue, model) {
|
|
|
82733
83034
|
if (refusal !== void 0 && typeof refusal !== "string")
|
|
82734
83035
|
throw new Error("Gateway returned an invalid refusal value");
|
|
82735
83036
|
if (typeof text === "string" || typeof refusal === "string") {
|
|
82736
|
-
const itemId = `msg_${
|
|
83037
|
+
const itemId = `msg_${randomUUID3().replaceAll("-", "")}`;
|
|
82737
83038
|
const isRefusal = typeof refusal === "string";
|
|
82738
83039
|
const part = isRefusal ? { type: "refusal", refusal } : { type: "output_text", text: text ?? "", annotations: [] };
|
|
82739
83040
|
const item = { id: itemId, type: "message", status: "completed", role: "assistant", content: [part] };
|
|
@@ -82766,8 +83067,8 @@ function responsesEventStream(chatValue, model) {
|
|
|
82766
83067
|
if (!isRecord3(callValue) || callValue.type !== "function" || !isRecord3(callValue.function) || typeof callValue.function.name !== "string" || typeof callValue.function.arguments !== "string") {
|
|
82767
83068
|
throw new Error("Gateway returned an invalid function call");
|
|
82768
83069
|
}
|
|
82769
|
-
const callId = typeof callValue.id === "string" ? callValue.id : `call_${
|
|
82770
|
-
const itemId = `fc_${
|
|
83070
|
+
const callId = typeof callValue.id === "string" ? callValue.id : `call_${randomUUID3().replaceAll("-", "")}`;
|
|
83071
|
+
const itemId = `fc_${randomUUID3().replaceAll("-", "")}`;
|
|
82771
83072
|
const item = {
|
|
82772
83073
|
id: itemId,
|
|
82773
83074
|
type: "function_call",
|
|
@@ -83008,11 +83309,11 @@ function createSidecarServer(options) {
|
|
|
83008
83309
|
const request = handler(req, res).finally(() => inFlight.delete(request));
|
|
83009
83310
|
inFlight.add(request);
|
|
83010
83311
|
});
|
|
83011
|
-
await new Promise((
|
|
83312
|
+
await new Promise((resolve4, reject) => {
|
|
83012
83313
|
server.once("error", reject);
|
|
83013
83314
|
server.listen(port, "127.0.0.1", () => {
|
|
83014
83315
|
server.off("error", reject);
|
|
83015
|
-
|
|
83316
|
+
resolve4();
|
|
83016
83317
|
});
|
|
83017
83318
|
});
|
|
83018
83319
|
const address2 = server.address();
|
|
@@ -83023,11 +83324,11 @@ function createSidecarServer(options) {
|
|
|
83023
83324
|
return;
|
|
83024
83325
|
const activeServer = server;
|
|
83025
83326
|
server = null;
|
|
83026
|
-
await new Promise((
|
|
83327
|
+
await new Promise((resolve4, reject) => activeServer.close((error) => {
|
|
83027
83328
|
if (error)
|
|
83028
83329
|
reject(error);
|
|
83029
83330
|
else
|
|
83030
|
-
|
|
83331
|
+
resolve4();
|
|
83031
83332
|
}));
|
|
83032
83333
|
await Promise.all(inFlight);
|
|
83033
83334
|
}
|
|
@@ -83176,13 +83477,42 @@ async function runBaseRegisteredTrialExchange(options) {
|
|
|
83176
83477
|
|
|
83177
83478
|
// dist/cli.js
|
|
83178
83479
|
import { BASE_SEPOLIA_NETWORK as BASE_SEPOLIA_NETWORK2 } from "@zk-credits/x402-zk-prepaid";
|
|
83480
|
+
|
|
83481
|
+
// dist/gateway-root-check.js
|
|
83482
|
+
function isRecord5(value) {
|
|
83483
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
83484
|
+
}
|
|
83485
|
+
async function requireGatewayKnownRoot(root, origin, fetcher = fetch) {
|
|
83486
|
+
let response;
|
|
83487
|
+
try {
|
|
83488
|
+
response = await fetcher(new URL("/v1/root-known", origin), {
|
|
83489
|
+
method: "POST",
|
|
83490
|
+
headers: { accept: "application/json", "content-type": "application/json" },
|
|
83491
|
+
body: JSON.stringify({ root }),
|
|
83492
|
+
signal: AbortSignal.timeout(1e4)
|
|
83493
|
+
});
|
|
83494
|
+
} catch {
|
|
83495
|
+
throw new Error("The gateway could not confirm that the activated credential root is known");
|
|
83496
|
+
}
|
|
83497
|
+
let body;
|
|
83498
|
+
try {
|
|
83499
|
+
body = await response.json();
|
|
83500
|
+
} catch {
|
|
83501
|
+
body = void 0;
|
|
83502
|
+
}
|
|
83503
|
+
if (response.status !== 200 || !isRecord5(body) || body.known !== true) {
|
|
83504
|
+
throw new Error("The activated credential root is not in the gateway known-root set; stop setup and reconcile the V2 activation");
|
|
83505
|
+
}
|
|
83506
|
+
}
|
|
83507
|
+
|
|
83508
|
+
// dist/cli.js
|
|
83179
83509
|
var DEFAULT_GATEWAY_URL = "https://zk-credits-gateway.onrender.com";
|
|
83180
83510
|
var DEFAULT_PORT = 3210;
|
|
83181
83511
|
function stateDirectory() {
|
|
83182
|
-
return process.env.ZK_CREDITS_HOME ||
|
|
83512
|
+
return process.env.ZK_CREDITS_HOME || join7(homedir(), ".zk-credits");
|
|
83183
83513
|
}
|
|
83184
83514
|
function setupConfigPath(directory = stateDirectory()) {
|
|
83185
|
-
return
|
|
83515
|
+
return join7(directory, "config.json");
|
|
83186
83516
|
}
|
|
83187
83517
|
async function applySavedSetupConfig(environment, directory = stateDirectory()) {
|
|
83188
83518
|
const config = await readSetupConfig(setupConfigPath(directory));
|
|
@@ -83229,7 +83559,7 @@ async function witnessProviderForSource(source, cachePath) {
|
|
|
83229
83559
|
if (source.kind === "file") {
|
|
83230
83560
|
let value;
|
|
83231
83561
|
try {
|
|
83232
|
-
value = JSON.parse(await
|
|
83562
|
+
value = JSON.parse(await readFile7(source.path, "utf8"));
|
|
83233
83563
|
} catch {
|
|
83234
83564
|
throw new Error("The Base witness file could not be read as JSON");
|
|
83235
83565
|
}
|
|
@@ -83262,7 +83592,7 @@ async function readHiddenValue(prompt) {
|
|
|
83262
83592
|
process.stdout.write(prompt);
|
|
83263
83593
|
process.stdin.setRawMode(true);
|
|
83264
83594
|
process.stdin.resume();
|
|
83265
|
-
return new Promise((
|
|
83595
|
+
return new Promise((resolve4, reject) => {
|
|
83266
83596
|
let value = "";
|
|
83267
83597
|
const done = (error) => {
|
|
83268
83598
|
process.stdin.off("data", onData);
|
|
@@ -83272,7 +83602,7 @@ async function readHiddenValue(prompt) {
|
|
|
83272
83602
|
if (error)
|
|
83273
83603
|
reject(error);
|
|
83274
83604
|
else
|
|
83275
|
-
|
|
83605
|
+
resolve4(value.trim());
|
|
83276
83606
|
};
|
|
83277
83607
|
const onData = (chunk) => {
|
|
83278
83608
|
for (const byte of chunk) {
|
|
@@ -83295,7 +83625,7 @@ async function readHiddenValue(prompt) {
|
|
|
83295
83625
|
});
|
|
83296
83626
|
}
|
|
83297
83627
|
async function readEncryptedCredential(path, password) {
|
|
83298
|
-
const parsed = JSON.parse(await
|
|
83628
|
+
const parsed = JSON.parse(await readFile7(path, "utf8"));
|
|
83299
83629
|
if (parsed.format !== "zk-credits-credential" || parsed.version !== 1 && parsed.version !== 2) {
|
|
83300
83630
|
throw new Error("Credential file is not a supported zk-credits export");
|
|
83301
83631
|
}
|
|
@@ -83317,10 +83647,11 @@ non-streaming POST /v1/chat/completions; Codex Responses requests pass through
|
|
|
83317
83647
|
the sidecar's bounded local compatibility bridge.
|
|
83318
83648
|
"zk-credits trial-registered-adapter" runs one confirmed, billable internal
|
|
83319
83649
|
trial request through the directly registered official x402 client adapter.
|
|
83320
|
-
Set ZK_CREDITS_CREDENTIAL_PATH before setup.
|
|
83321
|
-
|
|
83322
|
-
|
|
83323
|
-
|
|
83650
|
+
Set ZK_CREDITS_CREDENTIAL_PATH and BASE_RPC_URL before setup. For Base Sepolia
|
|
83651
|
+
V2, setup can download the immutable bundle pinned by the package manifest by
|
|
83652
|
+
using this machine's authenticated GitHub CLI session, then synchronizes the
|
|
83653
|
+
witness from the pinned public Base events and checks the resulting root with
|
|
83654
|
+
the gateway. It saves local paths and prompts for the credential password
|
|
83324
83655
|
without echo; the encrypted export is decrypted only in local memory.`);
|
|
83325
83656
|
}
|
|
83326
83657
|
async function loadBaseClientRuntime(passwordInput) {
|
|
@@ -83334,18 +83665,18 @@ async function loadBaseClientRuntime(passwordInput) {
|
|
|
83334
83665
|
if (!artifactDirectory) {
|
|
83335
83666
|
throw new Error("Set ZK_CREDITS_ARTIFACT_DIR to the directory holding the installed pinned proving bundle");
|
|
83336
83667
|
}
|
|
83337
|
-
const witnessProvider = witnessPath ? createFileWitnessProvider(JSON.parse(await
|
|
83668
|
+
const witnessProvider = witnessPath ? createFileWitnessProvider(JSON.parse(await readFile7(witnessPath, "utf8"))) : process.env.BASE_RPC_URL && process.env.BASE_PRIVATE_CREDIT_BOND_ADDRESS ? createBaseEventWitnessProvider({
|
|
83338
83669
|
rpcUrl: process.env.BASE_RPC_URL,
|
|
83339
83670
|
contractAddress: process.env.BASE_PRIVATE_CREDIT_BOND_ADDRESS,
|
|
83340
83671
|
deploymentBlock: process.env.BASE_DEPLOYMENT_BLOCK && /^\d+$/u.test(process.env.BASE_DEPLOYMENT_BLOCK) ? BigInt(process.env.BASE_DEPLOYMENT_BLOCK) : void 0,
|
|
83341
83672
|
confirmations: process.env.BASE_CONFIRMATIONS && /^\d+$/u.test(process.env.BASE_CONFIRMATIONS) ? BigInt(process.env.BASE_CONFIRMATIONS) : void 0,
|
|
83342
|
-
cachePath:
|
|
83673
|
+
cachePath: join7(stateDirectory(), "base-event-sync.json")
|
|
83343
83674
|
}) : (() => {
|
|
83344
83675
|
throw new Error("Set ZK_CREDITS_WITNESS_PATH or configure BASE_RPC_URL and BASE_PRIVATE_CREDIT_BOND_ADDRESS");
|
|
83345
83676
|
})();
|
|
83346
83677
|
const proofMetrics = createBaseProofMetrics();
|
|
83347
83678
|
const exchangeMetrics = createZkPrepaidLifecycleMetrics();
|
|
83348
|
-
const slotLedger = await BaseSlotLedger.open({ path:
|
|
83679
|
+
const slotLedger = await BaseSlotLedger.open({ path: join7(stateDirectory(), "base-slots.json") });
|
|
83349
83680
|
const prove = await createPinnedBaseProofGenerator({ artifactDirectory, metrics: proofMetrics });
|
|
83350
83681
|
validateBaseCreditWitness(await witnessProvider.witnessForCredential(credential));
|
|
83351
83682
|
return { credential, witnessProvider, slotLedger, proofMetrics, exchangeMetrics, prove };
|
|
@@ -83370,7 +83701,7 @@ var GATEWAY_COUNTER_NAMES = [
|
|
|
83370
83701
|
];
|
|
83371
83702
|
var GATEWAY_CLAIM_COUNT_NAMES = ["reserved", "ready", "committed", "cancelled"];
|
|
83372
83703
|
var GATEWAY_READINESS_CHECK_NAMES = /* @__PURE__ */ new Set(["launchControl", "database", "baseRoot", "baseRpc", "verifierAssets", "provider"]);
|
|
83373
|
-
function
|
|
83704
|
+
function isRecord6(value) {
|
|
83374
83705
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
83375
83706
|
}
|
|
83376
83707
|
function safeCount(value) {
|
|
@@ -83397,12 +83728,15 @@ async function readGatewayJson(url, headers) {
|
|
|
83397
83728
|
return { status: null };
|
|
83398
83729
|
}
|
|
83399
83730
|
}
|
|
83731
|
+
async function requireGatewayKnownRoot2(root) {
|
|
83732
|
+
await requireGatewayKnownRoot(root, gatewayOrigin());
|
|
83733
|
+
}
|
|
83400
83734
|
async function gatewayReadiness(origin) {
|
|
83401
83735
|
const response = await readGatewayJson(new URL("/ready", origin), { accept: "application/json" });
|
|
83402
|
-
const report =
|
|
83736
|
+
const report = isRecord6(response.body) ? response.body : void 0;
|
|
83403
83737
|
const checks = Array.isArray(report?.checks) ? report.checks : [];
|
|
83404
|
-
const failedChecks = checks.flatMap((check) =>
|
|
83405
|
-
const hasLaunchCheck = checks.some((check) =>
|
|
83738
|
+
const failedChecks = checks.flatMap((check) => isRecord6(check) && check.ok === true ? [] : [isRecord6(check) && typeof check.name === "string" && GATEWAY_READINESS_CHECK_NAMES.has(check.name) ? check.name : "unknown"]);
|
|
83739
|
+
const hasLaunchCheck = checks.some((check) => isRecord6(check) && check.name === "launchControl" && check.ok === true);
|
|
83406
83740
|
return {
|
|
83407
83741
|
status: response.status,
|
|
83408
83742
|
passed: response.status === 200 && report?.ready === true && failedChecks.length === 0 && hasLaunchCheck,
|
|
@@ -83414,12 +83748,12 @@ async function gatewayTrialSnapshot(origin, token) {
|
|
|
83414
83748
|
accept: "application/json",
|
|
83415
83749
|
authorization: `Bearer ${token}`
|
|
83416
83750
|
});
|
|
83417
|
-
const body =
|
|
83418
|
-
const launch =
|
|
83419
|
-
const base =
|
|
83420
|
-
const spend =
|
|
83421
|
-
const rawMetrics =
|
|
83422
|
-
const rawClaims =
|
|
83751
|
+
const body = isRecord6(response.body) ? response.body : void 0;
|
|
83752
|
+
const launch = isRecord6(body?.launchControl) ? body.launchControl : void 0;
|
|
83753
|
+
const base = isRecord6(body?.base) ? body.base : void 0;
|
|
83754
|
+
const spend = isRecord6(body?.spend) ? body.spend : void 0;
|
|
83755
|
+
const rawMetrics = isRecord6(body?.metrics) ? body.metrics : void 0;
|
|
83756
|
+
const rawClaims = isRecord6(body?.claims) ? body.claims : void 0;
|
|
83423
83757
|
const metrics = {};
|
|
83424
83758
|
const claims = {};
|
|
83425
83759
|
let countersValid = Boolean(rawMetrics && rawClaims);
|
|
@@ -83684,7 +84018,7 @@ async function main() {
|
|
|
83684
84018
|
if (!path)
|
|
83685
84019
|
return false;
|
|
83686
84020
|
try {
|
|
83687
|
-
await
|
|
84021
|
+
await readFile7(path);
|
|
83688
84022
|
return true;
|
|
83689
84023
|
} catch {
|
|
83690
84024
|
return false;
|
|
@@ -83704,8 +84038,10 @@ async function main() {
|
|
|
83704
84038
|
configPath: setupConfigPath(sidecarHome),
|
|
83705
84039
|
manifest,
|
|
83706
84040
|
validateWitness: async (source) => {
|
|
83707
|
-
const provider = await witnessProviderForSource(source,
|
|
83708
|
-
validateBaseCreditWitness(await provider.witnessForCredential(credential));
|
|
84041
|
+
const provider = await witnessProviderForSource(source, join7(stateDirectory(), "base-event-sync.json"));
|
|
84042
|
+
const witness = validateBaseCreditWitness(await provider.witnessForCredential(credential));
|
|
84043
|
+
if (manifest.deployment)
|
|
84044
|
+
await requireGatewayKnownRoot2(witness.root);
|
|
83709
84045
|
},
|
|
83710
84046
|
chooseCandidate: chooseSetupCandidate
|
|
83711
84047
|
});
|