@xyo-network/xl1-cli 5.2.0 → 5.2.2
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-min.mjs +1316 -1030
- package/dist/cli-min.mjs.map +1 -1
- package/package.json +8 -8
package/dist/cli-min.mjs
CHANGED
|
@@ -23,9 +23,9 @@ import fs$1, { readFileSync as readFileSync$1, readdirSync as readdirSync$1 } fr
|
|
|
23
23
|
import http$1 from "node:http";
|
|
24
24
|
import { notStrictEqual, strictEqual } from "assert";
|
|
25
25
|
import { MongoClient, ObjectId } from "mongodb";
|
|
26
|
-
import FS from "node:fs/promises";
|
|
27
26
|
import { AlwaysOnSampler, BasicTracerProvider, BatchSpanProcessor, ConsoleSpanExporter } from "@opentelemetry/sdk-trace-base";
|
|
28
27
|
import tty from "node:tty";
|
|
28
|
+
import FS from "node:fs/promises";
|
|
29
29
|
import { AsyncLocalStorageContextManager } from "@opentelemetry/context-async-hooks";
|
|
30
30
|
import { CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator } from "@opentelemetry/core";
|
|
31
31
|
import { PrometheusExporter } from "@opentelemetry/exporter-prometheus";
|
|
@@ -66368,7 +66368,7 @@ config$1(en_default());
|
|
|
66368
66368
|
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/index.js
|
|
66369
66369
|
var zod_default = external_exports;
|
|
66370
66370
|
//#endregion
|
|
66371
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@5.3.
|
|
66371
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4._ff2a6e59f51e5daef4ffb30e331f5092/node_modules/@xyo-network/xl1-protocol/dist/neutral/protocol-model.mjs
|
|
66372
66372
|
var ExchangeOutcomeSchema$1 = asSchema$1("network.xyo.exchange.outcome", true);
|
|
66373
66373
|
var isExchangeOutcome$1 = isPayloadOfZodType$1(/* @__PURE__ */ object$5({
|
|
66374
66374
|
/** Hash of the ExchangeTerms payload this outcome settles */
|
|
@@ -67254,7 +67254,7 @@ var TransactionRejectionSchema$1 = asSchema$1("network.xyo.transaction.rejection
|
|
|
67254
67254
|
var isTransactionRejection$1 = isPayloadOfSchemaType$1(TransactionRejectionSchema$1);
|
|
67255
67255
|
AsObjectFactory.create(isTransactionRejection$1);
|
|
67256
67256
|
//#endregion
|
|
67257
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@5.3.
|
|
67257
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4._ff2a6e59f51e5daef4ffb30e331f5092/node_modules/@xyo-network/xl1-protocol/dist/neutral/protocol-lib.mjs
|
|
67258
67258
|
function derivedReceiveAddress(address, scope) {
|
|
67259
67259
|
return toAddress(keccak256(new TextEncoder().encode(isDefined$1(scope) ? `${scope}|${address}` : address)).slice(-40), { prefix: false });
|
|
67260
67260
|
}
|
|
@@ -67512,7 +67512,7 @@ var TransactionValidationViewerMoniker$1 = "TransactionValidationViewer";
|
|
|
67512
67512
|
var WindowedBlockViewerMoniker$1 = "WindowedBlockViewer";
|
|
67513
67513
|
var XyoViewerMoniker$1 = "XyoViewer";
|
|
67514
67514
|
//#endregion
|
|
67515
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@5.3.
|
|
67515
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4._ff2a6e59f51e5daef4ffb30e331f5092/node_modules/@xyo-network/xl1-protocol/dist/neutral/network-model.mjs
|
|
67516
67516
|
var local_default = "<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\"><g style=\"opacity:.5;\"><path d=\"M154.71,97c.46,2.59,2.5,4.62,5.1,5.05l14.05,2.34,31.71-46.17c4.57-6.65-3.62-14.62-10.14-9.87l-43.68,31.83,2.97,16.82Z\" style=\"fill:#f47f00;\"/><path d=\"M173.86,151.62l-14.05,2.34c-2.6.43-4.64,2.45-5.1,5.05l-2.97,16.82,43.68,31.83c6.52,4.75,14.71-3.21,10.14-9.87l-31.71-46.17Z\" style=\"fill:#f47f00;\"/><path d=\"M82.14,104.38l14.05-2.34c2.6-.43,4.64-2.45,5.1-5.05l2.97-16.82-43.68-31.83c-6.52-4.75-14.71,3.21-10.14,9.87l31.71,46.17Z\" style=\"fill:#f47f00;\"/><path d=\"M101.29,159c-.46-2.59-2.5-4.62-5.1-5.05l-14.05-2.34-31.71,46.17c-4.57,6.65,3.62,14.62,10.14,9.87l43.68-31.83-2.97-16.82Z\" style=\"fill:#f47f00;\"/></g><path d=\"M107.33,104l15.94-90.32c.93-5.3,8.53-5.3,9.47,0l15.94,90.32c.35,2.01,1.94,3.57,3.95,3.91l92.24,15.35c5.36.89,5.36,8.59,0,9.49l-92.24,15.35c-2.01.33-3.59,1.9-3.95,3.91l-15.94,90.32c-.93,5.3-8.53,5.3-9.47,0l-15.94-90.32c-.35-2.01-1.94-3.57-3.95-3.91l-92.24-15.35c-5.36-.89-5.36-8.59,0-9.49l92.24-15.35c2.01-.33,3.59-1.9,3.95-3.91Z\" style=\"fill:#f47f00;\"/></svg>";
|
|
67517
67517
|
var mainnet_default = "<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\"><path d=\"M154.71,97c.46,2.59,2.5,4.62,5.1,5.05l14.05,2.34,31.71-46.17c4.57-6.65-3.62-14.62-10.14-9.87l-43.68,31.83,2.97,16.82Z\" style=\"fill:#8d8fc6;\"/><path d=\"M173.86,151.62l-14.05,2.34c-2.6.43-4.64,2.45-5.1,5.05l-2.97,16.82,43.68,31.83c6.52,4.75,14.71-3.21,10.14-9.87l-31.71-46.17Z\" style=\"fill:#eb407a;\"/><path d=\"M82.14,104.38l14.05-2.34c2.6-.43,4.64-2.45,5.1-5.05l2.97-16.82-43.68-31.83c-6.52-4.75-14.71,3.21-10.14,9.87l31.71,46.17Z\" style=\"fill:#579fd6;\"/><path d=\"M101.29,159c-.46-2.59-2.5-4.62-5.1-5.05l-14.05-2.34-31.71,46.17c-4.57,6.65,3.62,14.62,10.14,9.87l43.68-31.83-2.97-16.82Z\" style=\"fill:#f27046;\"/><path d=\"M107.33,104l15.94-90.32c.93-5.3,8.53-5.3,9.47,0l15.94,90.32c.35,2.01,1.94,3.57,3.95,3.91l92.24,15.35c5.36.89,5.36,8.59,0,9.49l-92.24,15.35c-2.01.33-3.59,1.9-3.95,3.91l-15.94,90.32c-.93,5.3-8.53,5.3-9.47,0l-15.94-90.32c-.35-2.01-1.94-3.57-3.95-3.91l-92.24-15.35c-5.36-.89-5.36-8.59,0-9.49l92.24-15.35c2.01-.33,3.59-1.9,3.95-3.91Z\" style=\"fill:#572aff;\"/></svg>";
|
|
67518
67518
|
var testnet_default = "<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\"><g style=\"opacity:.5;\"><path d=\"M154.71,97c.46,2.59,2.5,4.62,5.1,5.05l14.05,2.34,31.71-46.17c4.57-6.65-3.62-14.62-10.14-9.87l-43.68,31.83,2.97,16.82Z\" style=\"fill:#579fd6;\"/><path d=\"M173.86,151.62l-14.05,2.34c-2.6.43-4.64,2.45-5.1,5.05l-2.97,16.82,43.68,31.83c6.52,4.75,14.71-3.21,10.14-9.87l-31.71-46.17Z\" style=\"fill:#579fd6;\"/><path d=\"M82.14,104.38l14.05-2.34c2.6-.43,4.64-2.45,5.1-5.05l2.97-16.82-43.68-31.83c-6.52-4.75-14.71,3.21-10.14,9.87l31.71,46.17Z\" style=\"fill:#579fd6;\"/><path d=\"M101.29,159c-.46-2.59-2.5-4.62-5.1-5.05l-14.05-2.34-31.71,46.17c-4.57,6.65,3.62,14.62,10.14,9.87l43.68-31.83-2.97-16.82Z\" style=\"fill:#579fd6;\"/></g><path d=\"M107.33,104l15.94-90.32c.93-5.3,8.53-5.3,9.47,0l15.94,90.32c.35,2.01,1.94,3.57,3.95,3.91l92.24,15.35c5.36.89,5.36,8.59,0,9.49l-92.24,15.35c-2.01.33-3.59,1.9-3.95,3.91l-15.94,90.32c-.93,5.3-8.53,5.3-9.47,0l-15.94-90.32c-.35-2.01-1.94-3.57-3.95-3.91l-92.24-15.35c-5.36-.89-5.36-8.59,0-9.49l92.24-15.35c2.01-.33,3.59-1.9,3.95-3.91Z\" style=\"fill:#579fd6;\"/></svg>";
|
|
@@ -68162,7 +68162,7 @@ function admissionShadowHeadPath() {
|
|
|
68162
68162
|
return "admission/shadow/head.json";
|
|
68163
68163
|
}
|
|
68164
68164
|
//#endregion
|
|
68165
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@5.3.
|
|
68165
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4._ff2a6e59f51e5daef4ffb30e331f5092/node_modules/@xyo-network/xl1-protocol/dist/neutral/schema.mjs
|
|
68166
68166
|
var asRequiredStrings = (required) => {
|
|
68167
68167
|
if (typeof required === "string") return [required];
|
|
68168
68168
|
if (!Array.isArray(required)) return [];
|
|
@@ -68398,7 +68398,7 @@ var TransferPayloadJsonSchema = {
|
|
|
68398
68398
|
};
|
|
68399
68399
|
var TransferPayloadJsonSchemaPayload = new PayloadBuilder$1({ schema: SchemaSchema$1 }).fields({ definition: TransferPayloadJsonSchema }).build();
|
|
68400
68400
|
//#endregion
|
|
68401
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@5.3.
|
|
68401
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4._ff2a6e59f51e5daef4ffb30e331f5092/node_modules/@xyo-network/xl1-protocol/dist/neutral/validation.mjs
|
|
68402
68402
|
function maxTransactionFeeCost(tx) {
|
|
68403
68403
|
const { base, gasLimit, priority } = tx.fees;
|
|
68404
68404
|
return hexToBigInt(base) + hexToBigInt(priority) + hexToBigInt(gasLimit);
|
|
@@ -68644,7 +68644,7 @@ var validateTransaction = async (context, tx, additionalValidators) => {
|
|
|
68644
68644
|
}
|
|
68645
68645
|
};
|
|
68646
68646
|
//#endregion
|
|
68647
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.
|
|
68647
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4.3__@o_d8f0054b13f6e551673802e6b9e450ca/node_modules/@xyo-network/xl1-sdk/dist/neutral/driver-memory.mjs
|
|
68648
68648
|
var LruCacheMap$1 = class {
|
|
68649
68649
|
lruCache;
|
|
68650
68650
|
/** Creates an instance with the supplied configuration. */
|
|
@@ -71828,7 +71828,7 @@ var require_ExplorerSync = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
71828
71828
|
exports.ExplorerSync = ExplorerSync;
|
|
71829
71829
|
}));
|
|
71830
71830
|
//#endregion
|
|
71831
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.
|
|
71831
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4.3__@o_d8f0054b13f6e551673802e6b9e450ca/node_modules/@xyo-network/xl1-sdk/dist/node/protocol-sdk.mjs
|
|
71832
71832
|
var import_dist = (/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
71833
71833
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
71834
71834
|
exports.defaultLoadersSync = exports.defaultLoaders = exports.globalConfigSearchPlacesSync = exports.globalConfigSearchPlaces = exports.getDefaultSearchPlacesSync = exports.getDefaultSearchPlaces = exports.cosmiconfigSync = exports.cosmiconfig = void 0;
|
|
@@ -73036,6 +73036,41 @@ async function hydratedBlockByNumber$1(context, blockNumber) {
|
|
|
73036
73036
|
timeBudgetLimit: 500
|
|
73037
73037
|
});
|
|
73038
73038
|
}
|
|
73039
|
+
function blockLabel$1(block, hash) {
|
|
73040
|
+
return `block ${block} [${hash}]`;
|
|
73041
|
+
}
|
|
73042
|
+
function headLabel$1(head) {
|
|
73043
|
+
return `finalized head ${head.block} [${head.hash}]`;
|
|
73044
|
+
}
|
|
73045
|
+
function transactionCount$1(hashes) {
|
|
73046
|
+
const count = hashes?.length ?? 0;
|
|
73047
|
+
return `${count} transaction${count === 1 ? "" : "s"}`;
|
|
73048
|
+
}
|
|
73049
|
+
function transactionList$1(hashes) {
|
|
73050
|
+
return hashes !== void 0 && hashes.length > 0 ? ` (tx ${hashes.join(", ")})` : "";
|
|
73051
|
+
}
|
|
73052
|
+
var DESCRIPTIONS$1 = {
|
|
73053
|
+
"behind-finalized-head": ({ blockHash, blockNumber, finalizedHead }) => `candidate ${blockLabel$1(blockNumber, blockHash)} is at or below ${headLabel$1(finalizedHead)} \u2014 the head advanced past it while it was being built, so it can no longer be appended`,
|
|
73054
|
+
"block-number-mismatch": ({ blockHash, blockNumber, candidateBase, finalizedHead }) => `candidate ${blockLabel$1(blockNumber, blockHash)} starts at block ${candidateBase?.block} but the block after ${headLabel$1(finalizedHead)} must be ${finalizedHead.block + 1} \u2014 it was built on a different head`,
|
|
73055
|
+
"previous-hash-mismatch": ({ blockHash, blockNumber, candidateBase, finalizedHead }) => `candidate ${blockLabel$1(blockNumber, blockHash)} links to previous ${candidateBase?.previous} instead of ${headLabel$1(finalizedHead)} \u2014 it was built on a superseded or competing head`,
|
|
73056
|
+
"tx-already-finalized": ({ blockHash, blockNumber, finalizedHead, offendingTransactionHashes, windowStartBlockNumber }) => `candidate ${blockLabel$1(blockNumber, blockHash)} carries ${transactionCount$1(offendingTransactionHashes)} already included in a finalized block within ${windowStartBlockNumber}..${finalizedHead.block} \u2014 its pending-transaction view was stale; exclude ${(offendingTransactionHashes?.length ?? 0) === 1 ? "it" : "them"} and rebuild` + transactionList$1(offendingTransactionHashes),
|
|
73057
|
+
"tx-before-window": ({ blockHash, blockNumber, finalizedHead, offendingTransactionHashes, windowStartBlockNumber }) => `candidate ${blockLabel$1(blockNumber, blockHash)} carries ${transactionCount$1(offendingTransactionHashes)} whose nbf precedes the finalized window ${windowStartBlockNumber}..${finalizedHead.block}, so inclusion in an earlier block cannot be ruled out` + transactionList$1(offendingTransactionHashes)
|
|
73058
|
+
};
|
|
73059
|
+
function describeUncleRejection$1(rejection) {
|
|
73060
|
+
return `${DESCRIPTIONS$1[rejection.reason](rejection)} [${rejection.reason}]`;
|
|
73061
|
+
}
|
|
73062
|
+
function describeUncleOutcome$1(finalizedChain, candidates, uncles, rejections) {
|
|
73063
|
+
const head = finalizedChain.at(-1)?.[0];
|
|
73064
|
+
const against = head === void 0 ? "the finalized head" : headLabel$1({
|
|
73065
|
+
block: head.block,
|
|
73066
|
+
hash: head._hash
|
|
73067
|
+
});
|
|
73068
|
+
const checked = `${candidates.length} candidate block${candidates.length === 1 ? "" : "s"} checked`;
|
|
73069
|
+
if (uncles.length === 0) return `No candidate block can be appended to ${against} (${checked}): ${rejections.length > 0 ? rejections.map((rejection) => describeUncleRejection$1(rejection)).join("; ") : candidates.length === 0 ? "no candidate blocks were supplied" : "the candidate blocks do not form a contiguous chain"}`;
|
|
73070
|
+
if (uncles.length === 1) return `Exactly one candidate chain extends ${against} (${checked})`;
|
|
73071
|
+
const tips = uncles.map((chain) => chain.at(-1)?.[0]).filter(exists$1).map((tip) => blockLabel$1(tip.block, tip._hash)).join(", ");
|
|
73072
|
+
return `${uncles.length} competing candidate chains extend ${against} (${checked}; tips ${tips}) \u2014 state validation needs exactly one chain, so none was validated`;
|
|
73073
|
+
}
|
|
73039
73074
|
function getProducerKey(block) {
|
|
73040
73075
|
return block[0].addresses.toSorted((a, b) => a.localeCompare(b)).join(",");
|
|
73041
73076
|
}
|
|
@@ -73083,15 +73118,25 @@ function toValidUncle$1(_context, finalizedWindowedChain, possibleUncle, onRejec
|
|
|
73083
73118
|
const finalizedWindowStartBlockNumber = finalizedWindowedChain.at(0)?.[0].block ?? -1;
|
|
73084
73119
|
const finalizedHead = assertEx$1(finalizedWindowedChain.at(-1), () => "finalizedWindowedChain is empty");
|
|
73085
73120
|
const tip = assertEx$1(possibleUncle.at(-1), () => "possibleUncle is empty");
|
|
73121
|
+
const prunedPossibleUncle = possibleUncle.filter((b) => b[0].block > finalizedHead[0].block);
|
|
73122
|
+
const base = prunedPossibleUncle.at(0);
|
|
73086
73123
|
const reject = (reason, offendingTransactionHashes) => {
|
|
73087
73124
|
onReject?.({
|
|
73088
73125
|
blockHash: tip[0]._hash,
|
|
73089
73126
|
blockNumber: tip[0].block,
|
|
73127
|
+
candidateBase: base === void 0 ? void 0 : {
|
|
73128
|
+
block: base[0].block,
|
|
73129
|
+
previous: base[0].previous
|
|
73130
|
+
},
|
|
73131
|
+
finalizedHead: {
|
|
73132
|
+
block: finalizedHead[0].block,
|
|
73133
|
+
hash: finalizedHead[0]._hash
|
|
73134
|
+
},
|
|
73090
73135
|
offendingTransactionHashes,
|
|
73091
|
-
reason
|
|
73136
|
+
reason,
|
|
73137
|
+
windowStartBlockNumber: finalizedWindowStartBlockNumber
|
|
73092
73138
|
});
|
|
73093
73139
|
};
|
|
73094
|
-
const prunedPossibleUncle = possibleUncle.filter((b) => b[0].block > finalizedHead[0].block);
|
|
73095
73140
|
if (prunedPossibleUncle.length === 0) {
|
|
73096
73141
|
reject("behind-finalized-head");
|
|
73097
73142
|
return;
|
|
@@ -75313,8 +75358,8 @@ var SimpleBlockValidationViewer$1 = class extends AbstractCreatableProvider$1 {
|
|
|
75313
75358
|
const rejections = [];
|
|
75314
75359
|
const uncles = findUncles$1(this.context, windowedUncleChain, blocks, (rejection) => rejections.push(rejection));
|
|
75315
75360
|
if (uncles.length !== 1) {
|
|
75316
|
-
const
|
|
75317
|
-
this.logger?.warn(
|
|
75361
|
+
const outcome = describeUncleOutcome$1(windowedUncleChain, blocks, uncles, rejections);
|
|
75362
|
+
this.logger?.warn(outcome);
|
|
75318
75363
|
this.logger?.debug(JSON.stringify({
|
|
75319
75364
|
uncles,
|
|
75320
75365
|
blocks: blocks.length
|
|
@@ -75323,12 +75368,13 @@ var SimpleBlockValidationViewer$1 = class extends AbstractCreatableProvider$1 {
|
|
|
75323
75368
|
return blocks.map((block) => {
|
|
75324
75369
|
const rejection = rejections.find((r) => r.blockHash === block[0]._hash);
|
|
75325
75370
|
const offendingTransactionHashes = rejection?.offendingTransactionHashes ?? [];
|
|
75326
|
-
if (rejection && offendingTransactionHashes.length > 0) return offendingTransactionHashes.map((txHash) => new HydratedBlockValidationError$1(txHash, block, `
|
|
75371
|
+
if (rejection && offendingTransactionHashes.length > 0) return offendingTransactionHashes.map((txHash) => new HydratedBlockValidationError$1(txHash, block, `Candidate rejected during state validation: ${describeUncleRejection$1(rejection)}`, {
|
|
75327
75372
|
blockHash: rejection.blockHash,
|
|
75328
75373
|
hash: txHash,
|
|
75329
75374
|
reason: rejection.reason
|
|
75330
75375
|
}));
|
|
75331
|
-
|
|
75376
|
+
const message = rejection ? `Candidate rejected during state validation: ${describeUncleRejection$1(rejection)}` : `Candidate not validated: ${outcome}`;
|
|
75377
|
+
return [new HydratedBlockValidationError$1(block[0]._hash, block, message, {
|
|
75332
75378
|
reason: rejection?.reason,
|
|
75333
75379
|
uncles: uncles.length,
|
|
75334
75380
|
blocks: blocks.length
|
|
@@ -82239,7 +82285,7 @@ function getOriginalId$1(rawRequest) {
|
|
|
82239
82285
|
return [void 0, false];
|
|
82240
82286
|
}
|
|
82241
82287
|
//#endregion
|
|
82242
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.
|
|
82288
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4.3__@o_d8f0054b13f6e551673802e6b9e450ca/node_modules/@xyo-network/xl1-sdk/dist/neutral/rpc.mjs
|
|
82243
82289
|
var __defProp$26 = Object.defineProperty;
|
|
82244
82290
|
var __getOwnPropDesc$25 = Object.getOwnPropertyDescriptor;
|
|
82245
82291
|
var __defNormalProp$24 = (obj, key, value) => key in obj ? __defProp$26(obj, key, {
|
|
@@ -82525,6 +82571,16 @@ var NetworkStakingStepRewardsByPositionViewerRpcSchemas$1 = {
|
|
|
82525
82571
|
from: /* @__PURE__ */ pipe$1(JsonToBigIntZod, /* @__PURE__ */ transform$1((val) => asAttoXL1$1(val)))
|
|
82526
82572
|
}
|
|
82527
82573
|
},
|
|
82574
|
+
networkStakingStepRewardsByPositionViewer_allocationsForStep: {
|
|
82575
|
+
params: {
|
|
82576
|
+
to: /* @__PURE__ */ tuple$1([StepIdentityZod$1]),
|
|
82577
|
+
from: /* @__PURE__ */ tuple$1([StepIdentityZod$1])
|
|
82578
|
+
},
|
|
82579
|
+
result: {
|
|
82580
|
+
to: /* @__PURE__ */ record$2(/* @__PURE__ */ number$5(), BigIntToJsonZod),
|
|
82581
|
+
from: /* @__PURE__ */ record$2(/* @__PURE__ */ number$5(), /* @__PURE__ */ pipe$1(JsonToBigIntZod, /* @__PURE__ */ transform$1((val) => asAttoXL1$1(val))))
|
|
82582
|
+
}
|
|
82583
|
+
},
|
|
82528
82584
|
networkStakingStepRewardsByPositionViewer_totalForStepForPosition: {
|
|
82529
82585
|
params: {
|
|
82530
82586
|
to: /* @__PURE__ */ tuple$1([StepIdentityZod$1, /* @__PURE__ */ number$5()]),
|
|
@@ -83210,6 +83266,16 @@ var XyoViewerRpcSchemas$1 = {
|
|
|
83210
83266
|
from: /* @__PURE__ */ pipe$1(JsonToBigIntZod, /* @__PURE__ */ transform$1((val) => asAttoXL1$1(val)))
|
|
83211
83267
|
}
|
|
83212
83268
|
},
|
|
83269
|
+
xyoViewer_networkStakeStepRewardAllocationsForStep: {
|
|
83270
|
+
params: {
|
|
83271
|
+
to: /* @__PURE__ */ tuple$1([StepIdentityZod$1]),
|
|
83272
|
+
from: /* @__PURE__ */ tuple$1([StepIdentityZod$1])
|
|
83273
|
+
},
|
|
83274
|
+
result: {
|
|
83275
|
+
to: /* @__PURE__ */ record$2(/* @__PURE__ */ number$5(), BigIntToJsonZod),
|
|
83276
|
+
from: /* @__PURE__ */ record$2(/* @__PURE__ */ number$5(), /* @__PURE__ */ pipe$1(JsonToBigIntZod, /* @__PURE__ */ transform$1((val) => asAttoXL1$1(val))))
|
|
83277
|
+
}
|
|
83278
|
+
},
|
|
83213
83279
|
xyoViewer_networkStakeStepRewardRandomizer: {
|
|
83214
83280
|
params: {
|
|
83215
83281
|
to: /* @__PURE__ */ tuple$1([StepIdentityZod$1]),
|
|
@@ -83474,6 +83540,28 @@ tuple([object$3({
|
|
|
83474
83540
|
id: string$2(),
|
|
83475
83541
|
payloads: array$1(union$1([PayloadZodLoose$1, JsonToArrayBufferZod2$1]))
|
|
83476
83542
|
})]), union$1([PayloadZodLoose$1, ArrayBufferToJsonZod$1]), union$1([PayloadZodLoose$1, JsonToArrayBufferZod2$1]);
|
|
83543
|
+
function trimTrailingNull$1(params) {
|
|
83544
|
+
let end = params.length;
|
|
83545
|
+
while (end > 0 && params[end - 1] === null) end--;
|
|
83546
|
+
return params.slice(0, end);
|
|
83547
|
+
}
|
|
83548
|
+
function parseRpcRequest$1(requestSchema, request) {
|
|
83549
|
+
const parsed = requestSchema.safeParse(request);
|
|
83550
|
+
if (parsed.success || !isObject$5(request)) return parsed;
|
|
83551
|
+
const { params } = request;
|
|
83552
|
+
if (!Array.isArray(params) || params.at(-1) !== null) return parsed;
|
|
83553
|
+
const retried = requestSchema.safeParse({
|
|
83554
|
+
...request,
|
|
83555
|
+
params: trimTrailingNull$1(params)
|
|
83556
|
+
});
|
|
83557
|
+
return retried.success ? retried : parsed;
|
|
83558
|
+
}
|
|
83559
|
+
function trimTrailingUndefined$1(params) {
|
|
83560
|
+
if (!Array.isArray(params)) return params;
|
|
83561
|
+
let end = params.length;
|
|
83562
|
+
while (end > 0 && params[end - 1] === void 0) end--;
|
|
83563
|
+
return end === params.length ? params : params.slice(0, end);
|
|
83564
|
+
}
|
|
83477
83565
|
var HttpRpcTransport$1 = class {
|
|
83478
83566
|
_passThrough;
|
|
83479
83567
|
_rpcUrl;
|
|
@@ -83497,7 +83585,7 @@ var HttpRpcTransport$1 = class {
|
|
|
83497
83585
|
};
|
|
83498
83586
|
const schema = schemas[method];
|
|
83499
83587
|
if (params !== void 0) {
|
|
83500
|
-
body.params = isDefined$1(schema) ? schema.params.to.parse(params) : this._passThrough ? (/* @__PURE__ */ json$3()).parse(params) : void 0;
|
|
83588
|
+
body.params = isDefined$1(schema) ? trimTrailingUndefined$1(schema.params.to.parse(params)) : this._passThrough ? (/* @__PURE__ */ json$3()).parse(trimTrailingUndefined$1(params)) : void 0;
|
|
83501
83589
|
if (!isDefined$1(body.params)) throw new Error(`[callRpc] RPC method ${String(method)} missing schema`);
|
|
83502
83590
|
}
|
|
83503
83591
|
body.params ??= [];
|
|
@@ -83918,6 +84006,10 @@ JsonRpcMempoolViewer$1 = __decorateClass$25([creatableProvider$1()], JsonRpcMemp
|
|
|
83918
84006
|
var JsonRpcNetworkStakeStepRewardsByPositionViewerMethods$1 = class extends AbstractJsonRpcViewer$1 {
|
|
83919
84007
|
/** Moniker implemented by this provider instance. */
|
|
83920
84008
|
moniker = NetworkStakeStepRewardsByPositionViewerMoniker$1;
|
|
84009
|
+
/** Per-position allocations for one completed step. */
|
|
84010
|
+
async allocationsForStep(step) {
|
|
84011
|
+
return await this.transport.sendRequest("networkStakingStepRewardsByPositionViewer_allocationsForStep", [step]);
|
|
84012
|
+
}
|
|
83921
84013
|
/** Returns the bonus result exposed by this provider. */
|
|
83922
84014
|
async bonus(options) {
|
|
83923
84015
|
return await this.transport.sendRequest("networkStakingStepRewardsByPositionViewer_bonus", [options]);
|
|
@@ -84528,6 +84620,10 @@ var JsonRpcXyoViewer$1 = class extends AbstractJsonRpcViewer$1 {
|
|
|
84528
84620
|
async networkStakeStepRewardAddressShare(context, address) {
|
|
84529
84621
|
return await this.transport.sendRequest("xyoViewer_networkStakeStepRewardAddressShare", [context, address]);
|
|
84530
84622
|
}
|
|
84623
|
+
/** Per-position allocations for one completed step. */
|
|
84624
|
+
async networkStakeStepRewardAllocationsForStep(context) {
|
|
84625
|
+
return await this.transport.sendRequest("xyoViewer_networkStakeStepRewardAllocationsForStep", [context]);
|
|
84626
|
+
}
|
|
84531
84627
|
/** Returns the network stake step reward claimed by address result exposed by this provider. */
|
|
84532
84628
|
async networkStakeStepRewardClaimedByAddress(address) {
|
|
84533
84629
|
return await this.transport.sendRequest("xyoViewer_networkStakeStepRewardClaimedByAddress", [address]);
|
|
@@ -84766,7 +84862,7 @@ var createRpcDispatchMiddleware = (schemas, handlers, options) => async ({ reque
|
|
|
84766
84862
|
requestSchema = createRequestSchema$1(method, schema.params.from);
|
|
84767
84863
|
requestSchemas$1[method] = requestSchema;
|
|
84768
84864
|
}
|
|
84769
|
-
const parsed = requestSchema
|
|
84865
|
+
const parsed = parseRpcRequest$1(requestSchema, request);
|
|
84770
84866
|
if (!parsed.success) {
|
|
84771
84867
|
options?.logger?.error("RPC Request Validation Error", parsed.error);
|
|
84772
84868
|
throw new Error(parsed.error.message);
|
|
@@ -84781,7 +84877,7 @@ var createRpcDispatchMiddleware = (schemas, handlers, options) => async ({ reque
|
|
|
84781
84877
|
}
|
|
84782
84878
|
};
|
|
84783
84879
|
//#endregion
|
|
84784
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.
|
|
84880
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4.3__@o_d8f0054b13f6e551673802e6b9e450ca/node_modules/@xyo-network/xl1-sdk/dist/neutral/rest-block-viewer.mjs
|
|
84785
84881
|
var __defProp$25 = Object.defineProperty;
|
|
84786
84882
|
var __getOwnPropDesc$24 = Object.getOwnPropertyDescriptor;
|
|
84787
84883
|
var __defNormalProp$23 = (obj, key, value) => key in obj ? __defProp$25(obj, key, {
|
|
@@ -105444,7 +105540,7 @@ var StakedXyoChainV2__factory = class extends ContractFactory {
|
|
|
105444
105540
|
}
|
|
105445
105541
|
};
|
|
105446
105542
|
//#endregion
|
|
105447
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.
|
|
105543
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4.3__@o_d8f0054b13f6e551673802e6b9e450ca/node_modules/@xyo-network/xl1-sdk/dist/neutral/providers.mjs
|
|
105448
105544
|
var __defProp$23 = Object.defineProperty;
|
|
105449
105545
|
var __getOwnPropDesc$23 = Object.getOwnPropertyDescriptor;
|
|
105450
105546
|
var __defNormalProp$22 = (obj, key, value) => key in obj ? __defProp$23(obj, key, {
|
|
@@ -106422,6 +106518,18 @@ var RestNetworkStakeStepRewardsByPositionViewer$1 = class extends AbstractCreata
|
|
|
106422
106518
|
get fetchFn() {
|
|
106423
106519
|
return this.context.fetchFn ?? fetch.bind(globalThis);
|
|
106424
106520
|
}
|
|
106521
|
+
/** Per-position allocations for one completed step from the durable index record. */
|
|
106522
|
+
async allocationsForStep(step) {
|
|
106523
|
+
const head = await this.getHead();
|
|
106524
|
+
this.assertPublishedStep(step, head);
|
|
106525
|
+
const record = await this.getStep(step);
|
|
106526
|
+
const result = {};
|
|
106527
|
+
for (const [positionId, amount] of Object.entries(record.positionRewards)) {
|
|
106528
|
+
const reward = asAttoXL1$1(BigInt(amount));
|
|
106529
|
+
if (reward > 0n) result[Number(positionId)] = reward;
|
|
106530
|
+
}
|
|
106531
|
+
return result;
|
|
106532
|
+
}
|
|
106425
106533
|
/** Returns the policy bonus. The unmultiplied-v1 index has no multipliers, so bonus is zero. */
|
|
106426
106534
|
async bonus(options = {}) {
|
|
106427
106535
|
const total = await this.total(options);
|
|
@@ -106913,6 +107021,18 @@ var SimpleStepRewardsByPositionViewer$1 = class extends AbstractCreatableProvide
|
|
|
106913
107021
|
get stakeViewer() {
|
|
106914
107022
|
return this._stakeViewer;
|
|
106915
107023
|
}
|
|
107024
|
+
/** Per-position allocations for one completed step (compute path). */
|
|
107025
|
+
async allocationsForStep(step) {
|
|
107026
|
+
const externalRange = await externalBlockRangeFromStep(this.context, this.blockViewer, step, this.timeAnchor);
|
|
107027
|
+
const positionCount = await this.stakeViewer.stakeEvents.positionCount(externalRange);
|
|
107028
|
+
if (positionCount === 0) return {};
|
|
107029
|
+
const positions = await this.loadPositions(positionCount);
|
|
107030
|
+
const eventsByPosition = indexStakeEventsByPosition$1(await this.stakeViewer.stakeEvents.stakeEvents([0, externalRange[1]]));
|
|
107031
|
+
const computed = await networkStakeStepRewardsForPositions$1(this.context, this.blockViewer, step, positions, eventsByPosition, this.rewardMultipliers, this.timeAnchor, externalRange);
|
|
107032
|
+
const result = {};
|
|
107033
|
+
for (const [positionId, amount] of computed.positionRewards) if (amount > 0n) result[positionId] = amount;
|
|
107034
|
+
return result;
|
|
107035
|
+
}
|
|
106916
107036
|
/** Returns the bonus result exposed by this provider. */
|
|
106917
107037
|
async bonus({ range, positions } = {}) {
|
|
106918
107038
|
const total = await this.total({
|
|
@@ -107659,6 +107779,10 @@ var SimpleXyoViewer$1 = class extends AbstractCreatableProvider$1 {
|
|
|
107659
107779
|
networkStakeStepRewardAddressShare(_context, _address) {
|
|
107660
107780
|
throw new Error("Method [networkStakeStepRewardAddressShare] not implemented.");
|
|
107661
107781
|
}
|
|
107782
|
+
/** Per-position allocations for one completed step (`positionId → reward`). */
|
|
107783
|
+
async networkStakeStepRewardAllocationsForStep(stepIdentity) {
|
|
107784
|
+
return await this.networkStepRewardsByPositionViewer.allocationsForStep(stepIdentity);
|
|
107785
|
+
}
|
|
107662
107786
|
/** Returns the network stake step reward claimed by address result exposed by this provider. */
|
|
107663
107787
|
networkStakeStepRewardClaimedByAddress(_address) {
|
|
107664
107788
|
throw new Error("Method [networkStakeStepRewardClaimedByAddress] not implemented.");
|
|
@@ -107968,7 +108092,7 @@ __publicField$22(RestChainParamsViewer$1, "monikers", [ChainParamsViewerMoniker]
|
|
|
107968
108092
|
__publicField$22(RestChainParamsViewer$1, "surface", "node");
|
|
107969
108093
|
RestChainParamsViewer$1 = __decorateClass$23([creatableProvider$1()], RestChainParamsViewer$1);
|
|
107970
108094
|
//#endregion
|
|
107971
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.
|
|
108095
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4.3__@o_d8f0054b13f6e551673802e6b9e450ca/node_modules/@xyo-network/xl1-sdk/dist/neutral/gateway.mjs
|
|
107972
108096
|
async function witnessPreviousStep(gateway, options) {
|
|
107973
108097
|
const { addToChain = false, step = 2, transactionOptions, witness: witnessOption } = options ?? {};
|
|
107974
108098
|
const size = stepSize$1(step);
|
|
@@ -107995,7 +108119,7 @@ async function witnessPreviousStep(gateway, options) {
|
|
|
107995
108119
|
return { witness };
|
|
107996
108120
|
}
|
|
107997
108121
|
//#endregion
|
|
107998
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.
|
|
108122
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4.3__@o_d8f0054b13f6e551673802e6b9e450ca/node_modules/@xyo-network/xl1-sdk/dist/neutral/wrappers.mjs
|
|
107999
108123
|
function parseHexOrBigInt(value) {
|
|
108000
108124
|
return AttoXL1$1(typeof value === "bigint" ? value : hexToBigInt(value));
|
|
108001
108125
|
}
|
|
@@ -116356,7 +116480,7 @@ __publicField$19(MemoryArchivist, "labels", {
|
|
|
116356
116480
|
});
|
|
116357
116481
|
MemoryArchivist = __decorateClass$19([creatableModule()], MemoryArchivist);
|
|
116358
116482
|
//#endregion
|
|
116359
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@5.3.
|
|
116483
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4._2ed50aef22cdff8a2ce2a77e44721cb3/node_modules/@xyo-network/xl1-protocol/dist/neutral/protocol-model.mjs
|
|
116360
116484
|
var ExchangeOutcomeSchema = asSchema("network.xyo.exchange.outcome", true);
|
|
116361
116485
|
var isExchangeOutcome = isPayloadOfZodType(/* @__PURE__ */ object$5({
|
|
116362
116486
|
/** Hash of the ExchangeTerms payload this outcome settles */
|
|
@@ -117356,7 +117480,7 @@ new import_ajv.Ajv({
|
|
|
117356
117480
|
strict: true
|
|
117357
117481
|
});
|
|
117358
117482
|
//#endregion
|
|
117359
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.
|
|
117483
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4.3__@o_549107f828095a76ec89d9dd63b02b3d/node_modules/@xyo-network/xl1-sdk/dist/neutral/driver-memory.mjs
|
|
117360
117484
|
var LruCacheMap = class {
|
|
117361
117485
|
lruCache;
|
|
117362
117486
|
/** Creates an instance with the supplied configuration. */
|
|
@@ -117438,7 +117562,7 @@ var MemoryMap = class {
|
|
|
117438
117562
|
}
|
|
117439
117563
|
};
|
|
117440
117564
|
//#endregion
|
|
117441
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.
|
|
117565
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4.3__@o_549107f828095a76ec89d9dd63b02b3d/node_modules/@xyo-network/xl1-sdk/dist/node/protocol-sdk.mjs
|
|
117442
117566
|
var __defProp$18 = Object.defineProperty;
|
|
117443
117567
|
var __getOwnPropDesc$18 = Object.getOwnPropertyDescriptor;
|
|
117444
117568
|
var __defNormalProp$18 = (obj, key, value) => key in obj ? __defProp$18(obj, key, {
|
|
@@ -118286,6 +118410,41 @@ async function hydratedBlockByNumber(context, blockNumber) {
|
|
|
118286
118410
|
timeBudgetLimit: 500
|
|
118287
118411
|
});
|
|
118288
118412
|
}
|
|
118413
|
+
function blockLabel(block, hash) {
|
|
118414
|
+
return `block ${block} [${hash}]`;
|
|
118415
|
+
}
|
|
118416
|
+
function headLabel(head) {
|
|
118417
|
+
return `finalized head ${head.block} [${head.hash}]`;
|
|
118418
|
+
}
|
|
118419
|
+
function transactionCount(hashes) {
|
|
118420
|
+
const count = hashes?.length ?? 0;
|
|
118421
|
+
return `${count} transaction${count === 1 ? "" : "s"}`;
|
|
118422
|
+
}
|
|
118423
|
+
function transactionList(hashes) {
|
|
118424
|
+
return hashes !== void 0 && hashes.length > 0 ? ` (tx ${hashes.join(", ")})` : "";
|
|
118425
|
+
}
|
|
118426
|
+
var DESCRIPTIONS = {
|
|
118427
|
+
"behind-finalized-head": ({ blockHash, blockNumber, finalizedHead }) => `candidate ${blockLabel(blockNumber, blockHash)} is at or below ${headLabel(finalizedHead)} \u2014 the head advanced past it while it was being built, so it can no longer be appended`,
|
|
118428
|
+
"block-number-mismatch": ({ blockHash, blockNumber, candidateBase, finalizedHead }) => `candidate ${blockLabel(blockNumber, blockHash)} starts at block ${candidateBase?.block} but the block after ${headLabel(finalizedHead)} must be ${finalizedHead.block + 1} \u2014 it was built on a different head`,
|
|
118429
|
+
"previous-hash-mismatch": ({ blockHash, blockNumber, candidateBase, finalizedHead }) => `candidate ${blockLabel(blockNumber, blockHash)} links to previous ${candidateBase?.previous} instead of ${headLabel(finalizedHead)} \u2014 it was built on a superseded or competing head`,
|
|
118430
|
+
"tx-already-finalized": ({ blockHash, blockNumber, finalizedHead, offendingTransactionHashes, windowStartBlockNumber }) => `candidate ${blockLabel(blockNumber, blockHash)} carries ${transactionCount(offendingTransactionHashes)} already included in a finalized block within ${windowStartBlockNumber}..${finalizedHead.block} \u2014 its pending-transaction view was stale; exclude ${(offendingTransactionHashes?.length ?? 0) === 1 ? "it" : "them"} and rebuild` + transactionList(offendingTransactionHashes),
|
|
118431
|
+
"tx-before-window": ({ blockHash, blockNumber, finalizedHead, offendingTransactionHashes, windowStartBlockNumber }) => `candidate ${blockLabel(blockNumber, blockHash)} carries ${transactionCount(offendingTransactionHashes)} whose nbf precedes the finalized window ${windowStartBlockNumber}..${finalizedHead.block}, so inclusion in an earlier block cannot be ruled out` + transactionList(offendingTransactionHashes)
|
|
118432
|
+
};
|
|
118433
|
+
function describeUncleRejection(rejection) {
|
|
118434
|
+
return `${DESCRIPTIONS[rejection.reason](rejection)} [${rejection.reason}]`;
|
|
118435
|
+
}
|
|
118436
|
+
function describeUncleOutcome(finalizedChain, candidates, uncles, rejections) {
|
|
118437
|
+
const head = finalizedChain.at(-1)?.[0];
|
|
118438
|
+
const against = head === void 0 ? "the finalized head" : headLabel({
|
|
118439
|
+
block: head.block,
|
|
118440
|
+
hash: head._hash
|
|
118441
|
+
});
|
|
118442
|
+
const checked = `${candidates.length} candidate block${candidates.length === 1 ? "" : "s"} checked`;
|
|
118443
|
+
if (uncles.length === 0) return `No candidate block can be appended to ${against} (${checked}): ${rejections.length > 0 ? rejections.map((rejection) => describeUncleRejection(rejection)).join("; ") : candidates.length === 0 ? "no candidate blocks were supplied" : "the candidate blocks do not form a contiguous chain"}`;
|
|
118444
|
+
if (uncles.length === 1) return `Exactly one candidate chain extends ${against} (${checked})`;
|
|
118445
|
+
const tips = uncles.map((chain) => chain.at(-1)?.[0]).filter(exists$1).map((tip) => blockLabel(tip.block, tip._hash)).join(", ");
|
|
118446
|
+
return `${uncles.length} competing candidate chains extend ${against} (${checked}; tips ${tips}) \u2014 state validation needs exactly one chain, so none was validated`;
|
|
118447
|
+
}
|
|
118289
118448
|
var DEFAULT_BACKOFF_MS = 12e4;
|
|
118290
118449
|
function extendUncleChain(block, map) {
|
|
118291
118450
|
const uncle = [block];
|
|
@@ -118310,15 +118469,25 @@ function toValidUncle(_context, finalizedWindowedChain, possibleUncle, onReject)
|
|
|
118310
118469
|
const finalizedWindowStartBlockNumber = finalizedWindowedChain.at(0)?.[0].block ?? -1;
|
|
118311
118470
|
const finalizedHead = assertEx$1(finalizedWindowedChain.at(-1), () => "finalizedWindowedChain is empty");
|
|
118312
118471
|
const tip = assertEx$1(possibleUncle.at(-1), () => "possibleUncle is empty");
|
|
118472
|
+
const prunedPossibleUncle = possibleUncle.filter((b) => b[0].block > finalizedHead[0].block);
|
|
118473
|
+
const base = prunedPossibleUncle.at(0);
|
|
118313
118474
|
const reject = (reason, offendingTransactionHashes) => {
|
|
118314
118475
|
onReject?.({
|
|
118315
118476
|
blockHash: tip[0]._hash,
|
|
118316
118477
|
blockNumber: tip[0].block,
|
|
118478
|
+
candidateBase: base === void 0 ? void 0 : {
|
|
118479
|
+
block: base[0].block,
|
|
118480
|
+
previous: base[0].previous
|
|
118481
|
+
},
|
|
118482
|
+
finalizedHead: {
|
|
118483
|
+
block: finalizedHead[0].block,
|
|
118484
|
+
hash: finalizedHead[0]._hash
|
|
118485
|
+
},
|
|
118317
118486
|
offendingTransactionHashes,
|
|
118318
|
-
reason
|
|
118487
|
+
reason,
|
|
118488
|
+
windowStartBlockNumber: finalizedWindowStartBlockNumber
|
|
118319
118489
|
});
|
|
118320
118490
|
};
|
|
118321
|
-
const prunedPossibleUncle = possibleUncle.filter((b) => b[0].block > finalizedHead[0].block);
|
|
118322
118491
|
if (prunedPossibleUncle.length === 0) {
|
|
118323
118492
|
reject("behind-finalized-head");
|
|
118324
118493
|
return;
|
|
@@ -119896,8 +120065,8 @@ var SimpleBlockValidationViewer = class extends AbstractCreatableProvider {
|
|
|
119896
120065
|
const rejections = [];
|
|
119897
120066
|
const uncles = findUncles(this.context, windowedUncleChain, blocks, (rejection) => rejections.push(rejection));
|
|
119898
120067
|
if (uncles.length !== 1) {
|
|
119899
|
-
const
|
|
119900
|
-
this.logger?.warn(
|
|
120068
|
+
const outcome = describeUncleOutcome(windowedUncleChain, blocks, uncles, rejections);
|
|
120069
|
+
this.logger?.warn(outcome);
|
|
119901
120070
|
this.logger?.debug(JSON.stringify({
|
|
119902
120071
|
uncles,
|
|
119903
120072
|
blocks: blocks.length
|
|
@@ -119906,12 +120075,13 @@ var SimpleBlockValidationViewer = class extends AbstractCreatableProvider {
|
|
|
119906
120075
|
return blocks.map((block) => {
|
|
119907
120076
|
const rejection = rejections.find((r) => r.blockHash === block[0]._hash);
|
|
119908
120077
|
const offendingTransactionHashes = rejection?.offendingTransactionHashes ?? [];
|
|
119909
|
-
if (rejection && offendingTransactionHashes.length > 0) return offendingTransactionHashes.map((txHash) => new HydratedBlockValidationError(txHash, block, `
|
|
120078
|
+
if (rejection && offendingTransactionHashes.length > 0) return offendingTransactionHashes.map((txHash) => new HydratedBlockValidationError(txHash, block, `Candidate rejected during state validation: ${describeUncleRejection(rejection)}`, {
|
|
119910
120079
|
blockHash: rejection.blockHash,
|
|
119911
120080
|
hash: txHash,
|
|
119912
120081
|
reason: rejection.reason
|
|
119913
120082
|
}));
|
|
119914
|
-
|
|
120083
|
+
const message = rejection ? `Candidate rejected during state validation: ${describeUncleRejection(rejection)}` : `Candidate not validated: ${outcome}`;
|
|
120084
|
+
return [new HydratedBlockValidationError(block[0]._hash, block, message, {
|
|
119915
120085
|
reason: rejection?.reason,
|
|
119916
120086
|
uncles: uncles.length,
|
|
119917
120087
|
blocks: blocks.length
|
|
@@ -124133,7 +124303,7 @@ function getOriginalId(rawRequest) {
|
|
|
124133
124303
|
return [void 0, false];
|
|
124134
124304
|
}
|
|
124135
124305
|
//#endregion
|
|
124136
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.
|
|
124306
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4.3__@o_549107f828095a76ec89d9dd63b02b3d/node_modules/@xyo-network/xl1-sdk/dist/neutral/rpc.mjs
|
|
124137
124307
|
var __defProp$17 = Object.defineProperty;
|
|
124138
124308
|
var __getOwnPropDesc$17 = Object.getOwnPropertyDescriptor;
|
|
124139
124309
|
var __defNormalProp$17 = (obj, key, value) => key in obj ? __defProp$17(obj, key, {
|
|
@@ -124189,6 +124359,7 @@ var rpcMethodHandlersFromNetworkStakingStepRewardsByPositionViewer = (viewer) =>
|
|
|
124189
124359
|
networkStakingStepRewardsByPositionViewer_total: (params) => viewer.total(...params ?? []),
|
|
124190
124360
|
networkStakingStepRewardsByPositionViewer_totalForPosition: (params) => viewer.totalForPosition(...params),
|
|
124191
124361
|
networkStakingStepRewardsByPositionViewer_totalForStep: (params) => viewer.totalForStep(...params),
|
|
124362
|
+
networkStakingStepRewardsByPositionViewer_allocationsForStep: (params) => viewer.allocationsForStep(...params),
|
|
124192
124363
|
networkStakingStepRewardsByPositionViewer_totalForStepForPosition: (params) => viewer.totalForStepForPosition(...params),
|
|
124193
124364
|
networkStakingStepRewardsByPositionViewer_unclaimed: (params) => viewer.unclaimed(...params ?? [])
|
|
124194
124365
|
};
|
|
@@ -124231,6 +124402,7 @@ var rpcMethodHandlersFromViewer = (viewer) => {
|
|
|
124231
124402
|
xyoViewer_networkStakeStepRewardPositionWeight: (params) => viewer.networkStakeStepRewardPositionWeight?.(...params ?? []),
|
|
124232
124403
|
xyoViewer_networkStakeStepRewardPotentialPositionLoss: (params) => viewer.networkStakeStepRewardPotentialPositionLoss?.(...params ?? []),
|
|
124233
124404
|
xyoViewer_networkStakeStepRewardForStep: (params) => viewer.networkStakeStepRewardForStep?.(...params ?? []),
|
|
124405
|
+
xyoViewer_networkStakeStepRewardAllocationsForStep: (params) => viewer.networkStakeStepRewardAllocationsForStep?.(...params ?? []),
|
|
124234
124406
|
xyoViewer_networkStakeStepRewardRandomizer: (params) => viewer.networkStakeStepRewardRandomizer?.(...params ?? []),
|
|
124235
124407
|
xyoViewer_networkStakeStepRewardStakerCount: (params) => viewer.networkStakeStepRewardStakerCount?.(...params ?? []),
|
|
124236
124408
|
xyoViewer_networkStakeStepRewardForStepForPosition: (params) => viewer.networkStakeStepRewardForStepForPosition?.(...params ?? []),
|
|
@@ -124511,6 +124683,16 @@ var NetworkStakingStepRewardsByPositionViewerRpcSchemas = {
|
|
|
124511
124683
|
from: /* @__PURE__ */ pipe$1(JsonToBigIntZod, /* @__PURE__ */ transform$1((val) => asAttoXL1(val)))
|
|
124512
124684
|
}
|
|
124513
124685
|
},
|
|
124686
|
+
networkStakingStepRewardsByPositionViewer_allocationsForStep: {
|
|
124687
|
+
params: {
|
|
124688
|
+
to: /* @__PURE__ */ tuple$1([StepIdentityZod]),
|
|
124689
|
+
from: /* @__PURE__ */ tuple$1([StepIdentityZod])
|
|
124690
|
+
},
|
|
124691
|
+
result: {
|
|
124692
|
+
to: /* @__PURE__ */ record$2(/* @__PURE__ */ number$5(), BigIntToJsonZod),
|
|
124693
|
+
from: /* @__PURE__ */ record$2(/* @__PURE__ */ number$5(), /* @__PURE__ */ pipe$1(JsonToBigIntZod, /* @__PURE__ */ transform$1((val) => asAttoXL1(val))))
|
|
124694
|
+
}
|
|
124695
|
+
},
|
|
124514
124696
|
networkStakingStepRewardsByPositionViewer_totalForStepForPosition: {
|
|
124515
124697
|
params: {
|
|
124516
124698
|
to: /* @__PURE__ */ tuple$1([StepIdentityZod, /* @__PURE__ */ number$5()]),
|
|
@@ -125196,6 +125378,16 @@ var XyoViewerRpcSchemas = {
|
|
|
125196
125378
|
from: /* @__PURE__ */ pipe$1(JsonToBigIntZod, /* @__PURE__ */ transform$1((val) => asAttoXL1(val)))
|
|
125197
125379
|
}
|
|
125198
125380
|
},
|
|
125381
|
+
xyoViewer_networkStakeStepRewardAllocationsForStep: {
|
|
125382
|
+
params: {
|
|
125383
|
+
to: /* @__PURE__ */ tuple$1([StepIdentityZod]),
|
|
125384
|
+
from: /* @__PURE__ */ tuple$1([StepIdentityZod])
|
|
125385
|
+
},
|
|
125386
|
+
result: {
|
|
125387
|
+
to: /* @__PURE__ */ record$2(/* @__PURE__ */ number$5(), BigIntToJsonZod),
|
|
125388
|
+
from: /* @__PURE__ */ record$2(/* @__PURE__ */ number$5(), /* @__PURE__ */ pipe$1(JsonToBigIntZod, /* @__PURE__ */ transform$1((val) => asAttoXL1(val))))
|
|
125389
|
+
}
|
|
125390
|
+
},
|
|
125199
125391
|
xyoViewer_networkStakeStepRewardRandomizer: {
|
|
125200
125392
|
params: {
|
|
125201
125393
|
to: /* @__PURE__ */ tuple$1([StepIdentityZod]),
|
|
@@ -125460,6 +125652,28 @@ tuple([object$3({
|
|
|
125460
125652
|
id: string$2(),
|
|
125461
125653
|
payloads: array$1(union$1([PayloadZodLoose, JsonToArrayBufferZod2]))
|
|
125462
125654
|
})]), union$1([PayloadZodLoose, ArrayBufferToJsonZod]), union$1([PayloadZodLoose, JsonToArrayBufferZod2]);
|
|
125655
|
+
function trimTrailingNull(params) {
|
|
125656
|
+
let end = params.length;
|
|
125657
|
+
while (end > 0 && params[end - 1] === null) end--;
|
|
125658
|
+
return params.slice(0, end);
|
|
125659
|
+
}
|
|
125660
|
+
function parseRpcRequest(requestSchema, request) {
|
|
125661
|
+
const parsed = requestSchema.safeParse(request);
|
|
125662
|
+
if (parsed.success || !isObject$5(request)) return parsed;
|
|
125663
|
+
const { params } = request;
|
|
125664
|
+
if (!Array.isArray(params) || params.at(-1) !== null) return parsed;
|
|
125665
|
+
const retried = requestSchema.safeParse({
|
|
125666
|
+
...request,
|
|
125667
|
+
params: trimTrailingNull(params)
|
|
125668
|
+
});
|
|
125669
|
+
return retried.success ? retried : parsed;
|
|
125670
|
+
}
|
|
125671
|
+
function trimTrailingUndefined(params) {
|
|
125672
|
+
if (!Array.isArray(params)) return params;
|
|
125673
|
+
let end = params.length;
|
|
125674
|
+
while (end > 0 && params[end - 1] === void 0) end--;
|
|
125675
|
+
return end === params.length ? params : params.slice(0, end);
|
|
125676
|
+
}
|
|
125463
125677
|
var HttpRpcTransport = class {
|
|
125464
125678
|
_passThrough;
|
|
125465
125679
|
_rpcUrl;
|
|
@@ -125483,7 +125697,7 @@ var HttpRpcTransport = class {
|
|
|
125483
125697
|
};
|
|
125484
125698
|
const schema = schemas[method];
|
|
125485
125699
|
if (params !== void 0) {
|
|
125486
|
-
body.params = isDefined$1(schema) ? schema.params.to.parse(params) : this._passThrough ? (/* @__PURE__ */ json$3()).parse(params) : void 0;
|
|
125700
|
+
body.params = isDefined$1(schema) ? trimTrailingUndefined(schema.params.to.parse(params)) : this._passThrough ? (/* @__PURE__ */ json$3()).parse(trimTrailingUndefined(params)) : void 0;
|
|
125487
125701
|
if (!isDefined$1(body.params)) throw new Error(`[callRpc] RPC method ${String(method)} missing schema`);
|
|
125488
125702
|
}
|
|
125489
125703
|
body.params ??= [];
|
|
@@ -125904,6 +126118,10 @@ JsonRpcMempoolViewer = __decorateClass$17([creatableProvider()], JsonRpcMempoolV
|
|
|
125904
126118
|
var JsonRpcNetworkStakeStepRewardsByPositionViewerMethods = class extends AbstractJsonRpcViewer {
|
|
125905
126119
|
/** Moniker implemented by this provider instance. */
|
|
125906
126120
|
moniker = NetworkStakeStepRewardsByPositionViewerMoniker;
|
|
126121
|
+
/** Per-position allocations for one completed step. */
|
|
126122
|
+
async allocationsForStep(step) {
|
|
126123
|
+
return await this.transport.sendRequest("networkStakingStepRewardsByPositionViewer_allocationsForStep", [step]);
|
|
126124
|
+
}
|
|
125907
126125
|
/** Returns the bonus result exposed by this provider. */
|
|
125908
126126
|
async bonus(options) {
|
|
125909
126127
|
return await this.transport.sendRequest("networkStakingStepRewardsByPositionViewer_bonus", [options]);
|
|
@@ -126514,6 +126732,10 @@ var JsonRpcXyoViewer = class extends AbstractJsonRpcViewer {
|
|
|
126514
126732
|
async networkStakeStepRewardAddressShare(context, address) {
|
|
126515
126733
|
return await this.transport.sendRequest("xyoViewer_networkStakeStepRewardAddressShare", [context, address]);
|
|
126516
126734
|
}
|
|
126735
|
+
/** Per-position allocations for one completed step. */
|
|
126736
|
+
async networkStakeStepRewardAllocationsForStep(context) {
|
|
126737
|
+
return await this.transport.sendRequest("xyoViewer_networkStakeStepRewardAllocationsForStep", [context]);
|
|
126738
|
+
}
|
|
126517
126739
|
/** Returns the network stake step reward claimed by address result exposed by this provider. */
|
|
126518
126740
|
async networkStakeStepRewardClaimedByAddress(address) {
|
|
126519
126741
|
return await this.transport.sendRequest("xyoViewer_networkStakeStepRewardClaimedByAddress", [address]);
|
|
@@ -126775,7 +126997,7 @@ var createValidationMiddleware = (schemas) => ({ request, context, next }) => {
|
|
|
126775
126997
|
requestSchema = createRequestSchema(request.method, schema.params.from);
|
|
126776
126998
|
requestSchemas[request.method] = requestSchema;
|
|
126777
126999
|
}
|
|
126778
|
-
const parsed = requestSchema
|
|
127000
|
+
const parsed = parseRpcRequest(requestSchema, request);
|
|
126779
127001
|
if (!parsed.success) throw new Error(parsed.error.message);
|
|
126780
127002
|
context.set("schema", schema);
|
|
126781
127003
|
context.set("params", parsed.data.params);
|
|
@@ -224749,7 +224971,7 @@ var import_cjs$1 = (/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
224749
224971
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
224750
224972
|
(init_tslib_es6(), __toCommonJS(tslib_es6_exports)).__exportStar(require_bullMQOtel(), exports);
|
|
224751
224973
|
})))();
|
|
224752
|
-
var DEFAULT_HEARTBEAT_INTERVAL = 15e3;
|
|
224974
|
+
var DEFAULT_HEARTBEAT_INTERVAL$1 = 15e3;
|
|
224753
224975
|
var DEFAULT_RECONNECT_BASE_DELAY = 1e3;
|
|
224754
224976
|
var DEFAULT_RECONNECT_JITTER = .25;
|
|
224755
224977
|
var DEFAULT_RECONNECT_MAX_DELAY = 3e4;
|
|
@@ -224928,7 +225150,7 @@ var ManagedWebSocketEventTransport = class {
|
|
|
224928
225150
|
this.webSocketUrl = webSocketUrl;
|
|
224929
225151
|
this.network = network;
|
|
224930
225152
|
this.options = {
|
|
224931
|
-
heartbeatInterval: options.heartbeatInterval ?? DEFAULT_HEARTBEAT_INTERVAL,
|
|
225153
|
+
heartbeatInterval: options.heartbeatInterval ?? DEFAULT_HEARTBEAT_INTERVAL$1,
|
|
224932
225154
|
reconnectBaseDelay: options.reconnectBaseDelay ?? DEFAULT_RECONNECT_BASE_DELAY,
|
|
224933
225155
|
reconnectJitter: options.reconnectJitter ?? DEFAULT_RECONNECT_JITTER,
|
|
224934
225156
|
reconnectMaxDelay: options.reconnectMaxDelay ?? DEFAULT_RECONNECT_MAX_DELAY,
|
|
@@ -225452,7 +225674,7 @@ var BaseMongoSdk = class {
|
|
|
225452
225674
|
}
|
|
225453
225675
|
};
|
|
225454
225676
|
//#endregion
|
|
225455
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-driver-mongodb@5.3.
|
|
225677
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-driver-mongodb@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zo_b41a198c42289d2824f3326456687c6d/node_modules/@xyo-network/xl1-driver-mongodb/dist/neutral/index.mjs
|
|
225456
225678
|
var __defProp$15 = Object.defineProperty;
|
|
225457
225679
|
var __getOwnPropDesc$15 = Object.getOwnPropertyDescriptor;
|
|
225458
225680
|
var __defNormalProp$15 = (obj, key, value) => key in obj ? __defProp$15(obj, key, {
|
|
@@ -228695,6 +228917,7 @@ var ChainHeadSelector = class _ChainHeadSelector extends ChainFinalizer {
|
|
|
228695
228917
|
admission;
|
|
228696
228918
|
allowedProducers;
|
|
228697
228919
|
backoffMs;
|
|
228920
|
+
heartbeatInterval;
|
|
228698
228921
|
minCandidates;
|
|
228699
228922
|
_timeSinceLastUncle = Date.now();
|
|
228700
228923
|
constructor(params) {
|
|
@@ -228702,6 +228925,7 @@ var ChainHeadSelector = class _ChainHeadSelector extends ChainFinalizer {
|
|
|
228702
228925
|
this.admission = params.admission ?? "allowlist";
|
|
228703
228926
|
this.allowedProducers = params.allowedProducers;
|
|
228704
228927
|
this.backoffMs = params.backoffMs;
|
|
228928
|
+
this.heartbeatInterval = params.heartbeatInterval;
|
|
228705
228929
|
this.minCandidates = params.minCandidates;
|
|
228706
228930
|
}
|
|
228707
228931
|
get context() {
|
|
@@ -228716,8 +228940,9 @@ var ChainHeadSelector = class _ChainHeadSelector extends ChainFinalizer {
|
|
|
228716
228940
|
const allowed = allProposedBlocks.filter((pb) => this.isAllowed(pb));
|
|
228717
228941
|
const proposedBlocks = await this.admit(allProposedBlocks, allowed);
|
|
228718
228942
|
this.windowedFinalizedChain = await getWindowedChain$1(this.context, this.blockViewer, this.maxWindowSize, this.windowedFinalizedChain);
|
|
228719
|
-
const
|
|
228720
|
-
this.
|
|
228943
|
+
const pacedBlocks = this.filterPacedHeartbeatCandidates(proposedBlocks);
|
|
228944
|
+
const uncles = findUncles$1(this.context, this.windowedFinalizedChain, pacedBlocks);
|
|
228945
|
+
this.reportSilentUncleRejections(pacedBlocks, uncles.length);
|
|
228721
228946
|
return findBestUncle(this.windowedFinalizedChain, uncles, {
|
|
228722
228947
|
backoffMs: this.backoffMs,
|
|
228723
228948
|
minCandidates: this.minCandidates
|
|
@@ -228771,6 +228996,28 @@ var ChainHeadSelector = class _ChainHeadSelector extends ChainFinalizer {
|
|
|
228771
228996
|
producer: candidate[0].addresses[0]
|
|
228772
228997
|
})));
|
|
228773
228998
|
}
|
|
228999
|
+
/**
|
|
229000
|
+
* Defense against unwanted heartbeat rates: a transaction-less (heartbeat) candidate qualifies
|
|
229001
|
+
* only when its signing epoch is at least heartbeatInterval after the current head's. Measured
|
|
229002
|
+
* on chain data, so every finalizer applies the same pace deterministically regardless of wall
|
|
229003
|
+
* clock. A producer heartbeating faster than the network's pace — misconfigured or hostile —
|
|
229004
|
+
* cannot drive the chain's block rate: its candidates never qualify and age out of the pool,
|
|
229005
|
+
* while transaction-carrying candidates are exempt and finalize immediately.
|
|
229006
|
+
*/
|
|
229007
|
+
filterPacedHeartbeatCandidates(proposedBlocks) {
|
|
229008
|
+
const interval = this.heartbeatInterval;
|
|
229009
|
+
if (interval === void 0 || proposedBlocks.length === 0) return proposedBlocks;
|
|
229010
|
+
const headEpoch = this.windowedFinalizedChain.at(-1)?.[0].$epoch;
|
|
229011
|
+
if (!isDefined$1(headEpoch)) return proposedBlocks;
|
|
229012
|
+
const paced = proposedBlocks.filter((candidate) => {
|
|
229013
|
+
if (candidate[1].some((payload) => isTransactionBoundWitness$1(payload))) return true;
|
|
229014
|
+
const candidateEpoch = candidate[0].$epoch;
|
|
229015
|
+
if (!isDefined$1(candidateEpoch)) return true;
|
|
229016
|
+
return candidateEpoch - headEpoch >= interval;
|
|
229017
|
+
});
|
|
229018
|
+
if (paced.length < proposedBlocks.length) this.context.logger?.debug(`findBestHead: paced out ${proposedBlocks.length - paced.length} heartbeat candidate(s) younger than ${interval}ms since the head`);
|
|
229019
|
+
return paced;
|
|
229020
|
+
}
|
|
228774
229021
|
/** Whether the configured allow-list admits a candidate. An empty list admits everyone. */
|
|
228775
229022
|
isAllowed(candidate) {
|
|
228776
229023
|
const allowedProducers = this.allowedProducers;
|
|
@@ -228818,6 +229065,574 @@ var ChainHeadSelector = class _ChainHeadSelector extends ChainFinalizer {
|
|
|
228818
229065
|
asSchema$1("network.xyo.chain.summary.producers", true);
|
|
228819
229066
|
asSchema$1("network.xyo.chain.summary.staked.intent", true);
|
|
228820
229067
|
asSchema$1("network.xyo.chain.summary.transfers", true);
|
|
229068
|
+
(/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
229069
|
+
module.exports = function shallowEqual(objA, objB, compare, compareContext) {
|
|
229070
|
+
var ret = compare ? compare.call(compareContext, objA, objB) : void 0;
|
|
229071
|
+
if (ret !== void 0) return !!ret;
|
|
229072
|
+
if (objA === objB) return true;
|
|
229073
|
+
if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) return false;
|
|
229074
|
+
var keysA = Object.keys(objA);
|
|
229075
|
+
var keysB = Object.keys(objB);
|
|
229076
|
+
if (keysA.length !== keysB.length) return false;
|
|
229077
|
+
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
|
|
229078
|
+
for (var idx = 0; idx < keysA.length; idx++) {
|
|
229079
|
+
var key = keysA[idx];
|
|
229080
|
+
if (!bHasOwnProperty(key)) return false;
|
|
229081
|
+
var valueA = objA[key];
|
|
229082
|
+
var valueB = objB[key];
|
|
229083
|
+
ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
|
|
229084
|
+
if (ret === false || ret === void 0 && valueA !== valueB) return false;
|
|
229085
|
+
}
|
|
229086
|
+
return true;
|
|
229087
|
+
};
|
|
229088
|
+
})))();
|
|
229089
|
+
function stringReplaceAll(string, substring, postfix) {
|
|
229090
|
+
let index = string.indexOf(substring);
|
|
229091
|
+
if (index === -1) return string;
|
|
229092
|
+
const substringLength = substring.length;
|
|
229093
|
+
let endIndex = 0;
|
|
229094
|
+
let returnValue = "";
|
|
229095
|
+
do {
|
|
229096
|
+
returnValue += string.slice(endIndex, index) + substring + postfix;
|
|
229097
|
+
endIndex = index + substringLength;
|
|
229098
|
+
index = string.indexOf(substring, endIndex);
|
|
229099
|
+
} while (index !== -1);
|
|
229100
|
+
returnValue += string.slice(endIndex);
|
|
229101
|
+
return returnValue;
|
|
229102
|
+
}
|
|
229103
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
229104
|
+
let endIndex = 0;
|
|
229105
|
+
let returnValue = "";
|
|
229106
|
+
do {
|
|
229107
|
+
const isGotCR = string[index - 1] === "\r";
|
|
229108
|
+
returnValue += string.slice(endIndex, isGotCR ? index - 1 : index) + prefix + (isGotCR ? "\r\n" : "\n") + postfix;
|
|
229109
|
+
endIndex = index + 1;
|
|
229110
|
+
index = string.indexOf("\n", endIndex);
|
|
229111
|
+
} while (index !== -1);
|
|
229112
|
+
returnValue += string.slice(endIndex);
|
|
229113
|
+
return returnValue;
|
|
229114
|
+
}
|
|
229115
|
+
//#endregion
|
|
229116
|
+
//#region ../../node_modules/.pnpm/chalk@6.0.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
229117
|
+
const ANSI_BACKGROUND_OFFSET$1 = 10;
|
|
229118
|
+
const ANSI_UNDERLINE_OFFSET = 20;
|
|
229119
|
+
const wrapAnsi16$1 = (offset = 0) => (code) => `\u{1B}[${code + offset}m`;
|
|
229120
|
+
const wrapAnsi256$1 = (offset = 0) => (code) => `\u{1B}[${38 + offset};5;${code}m`;
|
|
229121
|
+
const wrapAnsi16m$1 = (offset = 0) => (red, green, blue) => `\u{1B}[${38 + offset};2;${red};${green};${blue}m`;
|
|
229122
|
+
const wrapUnderlineAnsi = (code) => `\u{1B}[58;5;${code < 90 ? code - 30 : code - 90 + 8}m`;
|
|
229123
|
+
const styles$2 = {
|
|
229124
|
+
modifier: {
|
|
229125
|
+
reset: [0, 0],
|
|
229126
|
+
bold: [1, 22],
|
|
229127
|
+
dim: [2, 22],
|
|
229128
|
+
italic: [3, 23],
|
|
229129
|
+
underline: [4, 24],
|
|
229130
|
+
underlineDouble: ["4:2", 24],
|
|
229131
|
+
underlineCurly: ["4:3", 24],
|
|
229132
|
+
underlineDotted: ["4:4", 24],
|
|
229133
|
+
underlineDashed: ["4:5", 24],
|
|
229134
|
+
overline: [53, 55],
|
|
229135
|
+
inverse: [7, 27],
|
|
229136
|
+
hidden: [8, 28],
|
|
229137
|
+
strikethrough: [9, 29]
|
|
229138
|
+
},
|
|
229139
|
+
color: {
|
|
229140
|
+
black: [30, 39],
|
|
229141
|
+
red: [31, 39],
|
|
229142
|
+
green: [32, 39],
|
|
229143
|
+
yellow: [33, 39],
|
|
229144
|
+
blue: [34, 39],
|
|
229145
|
+
magenta: [35, 39],
|
|
229146
|
+
cyan: [36, 39],
|
|
229147
|
+
white: [37, 39],
|
|
229148
|
+
blackBright: [90, 39],
|
|
229149
|
+
gray: [90, 39],
|
|
229150
|
+
grey: [90, 39],
|
|
229151
|
+
redBright: [91, 39],
|
|
229152
|
+
greenBright: [92, 39],
|
|
229153
|
+
yellowBright: [93, 39],
|
|
229154
|
+
blueBright: [94, 39],
|
|
229155
|
+
magentaBright: [95, 39],
|
|
229156
|
+
cyanBright: [96, 39],
|
|
229157
|
+
whiteBright: [97, 39]
|
|
229158
|
+
},
|
|
229159
|
+
bgColor: {
|
|
229160
|
+
bgBlack: [40, 49],
|
|
229161
|
+
bgRed: [41, 49],
|
|
229162
|
+
bgGreen: [42, 49],
|
|
229163
|
+
bgYellow: [43, 49],
|
|
229164
|
+
bgBlue: [44, 49],
|
|
229165
|
+
bgMagenta: [45, 49],
|
|
229166
|
+
bgCyan: [46, 49],
|
|
229167
|
+
bgWhite: [47, 49],
|
|
229168
|
+
bgBlackBright: [100, 49],
|
|
229169
|
+
bgGray: [100, 49],
|
|
229170
|
+
bgGrey: [100, 49],
|
|
229171
|
+
bgRedBright: [101, 49],
|
|
229172
|
+
bgGreenBright: [102, 49],
|
|
229173
|
+
bgYellowBright: [103, 49],
|
|
229174
|
+
bgBlueBright: [104, 49],
|
|
229175
|
+
bgMagentaBright: [105, 49],
|
|
229176
|
+
bgCyanBright: [106, 49],
|
|
229177
|
+
bgWhiteBright: [107, 49]
|
|
229178
|
+
},
|
|
229179
|
+
underlineColor: {
|
|
229180
|
+
underlineBlack: ["58;5;0", 59],
|
|
229181
|
+
underlineRed: ["58;5;1", 59],
|
|
229182
|
+
underlineGreen: ["58;5;2", 59],
|
|
229183
|
+
underlineYellow: ["58;5;3", 59],
|
|
229184
|
+
underlineBlue: ["58;5;4", 59],
|
|
229185
|
+
underlineMagenta: ["58;5;5", 59],
|
|
229186
|
+
underlineCyan: ["58;5;6", 59],
|
|
229187
|
+
underlineWhite: ["58;5;7", 59],
|
|
229188
|
+
underlineBlackBright: ["58;5;8", 59],
|
|
229189
|
+
underlineGray: ["58;5;8", 59],
|
|
229190
|
+
underlineGrey: ["58;5;8", 59],
|
|
229191
|
+
underlineRedBright: ["58;5;9", 59],
|
|
229192
|
+
underlineGreenBright: ["58;5;10", 59],
|
|
229193
|
+
underlineYellowBright: ["58;5;11", 59],
|
|
229194
|
+
underlineBlueBright: ["58;5;12", 59],
|
|
229195
|
+
underlineMagentaBright: ["58;5;13", 59],
|
|
229196
|
+
underlineCyanBright: ["58;5;14", 59],
|
|
229197
|
+
underlineWhiteBright: ["58;5;15", 59]
|
|
229198
|
+
}
|
|
229199
|
+
};
|
|
229200
|
+
Object.keys(styles$2.modifier);
|
|
229201
|
+
const foregroundColorNames$1 = Object.keys(styles$2.color);
|
|
229202
|
+
const backgroundColorNames$1 = Object.keys(styles$2.bgColor);
|
|
229203
|
+
Object.keys(styles$2.underlineColor);
|
|
229204
|
+
[...foregroundColorNames$1, ...backgroundColorNames$1];
|
|
229205
|
+
function assembleStyles$1() {
|
|
229206
|
+
const codes = /* @__PURE__ */ new Map();
|
|
229207
|
+
for (const [groupName, group] of Object.entries(styles$2)) {
|
|
229208
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
229209
|
+
styles$2[styleName] = {
|
|
229210
|
+
open: `\u{1B}[${style[0]}m`,
|
|
229211
|
+
close: `\u{1B}[${style[1]}m`
|
|
229212
|
+
};
|
|
229213
|
+
group[styleName] = styles$2[styleName];
|
|
229214
|
+
codes.set(Number.parseInt(style[0], 10), style[1]);
|
|
229215
|
+
}
|
|
229216
|
+
Object.defineProperty(styles$2, groupName, {
|
|
229217
|
+
value: group,
|
|
229218
|
+
enumerable: false
|
|
229219
|
+
});
|
|
229220
|
+
}
|
|
229221
|
+
Object.defineProperty(styles$2, "codes", {
|
|
229222
|
+
value: codes,
|
|
229223
|
+
enumerable: false
|
|
229224
|
+
});
|
|
229225
|
+
styles$2.color.close = "\x1B[39m";
|
|
229226
|
+
styles$2.bgColor.close = "\x1B[49m";
|
|
229227
|
+
styles$2.underlineColor.close = "\x1B[59m";
|
|
229228
|
+
styles$2.color.ansi = wrapAnsi16$1();
|
|
229229
|
+
styles$2.color.ansi256 = wrapAnsi256$1();
|
|
229230
|
+
styles$2.color.ansi16m = wrapAnsi16m$1();
|
|
229231
|
+
styles$2.bgColor.ansi = wrapAnsi16$1(ANSI_BACKGROUND_OFFSET$1);
|
|
229232
|
+
styles$2.bgColor.ansi256 = wrapAnsi256$1(ANSI_BACKGROUND_OFFSET$1);
|
|
229233
|
+
styles$2.bgColor.ansi16m = wrapAnsi16m$1(ANSI_BACKGROUND_OFFSET$1);
|
|
229234
|
+
styles$2.underlineColor.ansi = wrapUnderlineAnsi;
|
|
229235
|
+
styles$2.underlineColor.ansi256 = wrapAnsi256$1(ANSI_UNDERLINE_OFFSET);
|
|
229236
|
+
styles$2.underlineColor.ansi16m = wrapAnsi16m$1(ANSI_UNDERLINE_OFFSET);
|
|
229237
|
+
Object.defineProperties(styles$2, {
|
|
229238
|
+
rgbToAnsi256: {
|
|
229239
|
+
value(red, green, blue) {
|
|
229240
|
+
if (red === green && green === blue) {
|
|
229241
|
+
if (red < 8) return 16;
|
|
229242
|
+
if (red > 248) return 231;
|
|
229243
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
229244
|
+
}
|
|
229245
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
229246
|
+
},
|
|
229247
|
+
enumerable: false
|
|
229248
|
+
},
|
|
229249
|
+
hexToRgb: {
|
|
229250
|
+
value(hex) {
|
|
229251
|
+
const matches = /[\da-f]{6}|[\da-f]{3}/i.exec(hex.toString(16));
|
|
229252
|
+
if (!matches) return [
|
|
229253
|
+
0,
|
|
229254
|
+
0,
|
|
229255
|
+
0
|
|
229256
|
+
];
|
|
229257
|
+
let [colorString] = matches;
|
|
229258
|
+
if (colorString.length === 3) colorString = [...colorString].map((character) => character + character).join("");
|
|
229259
|
+
const integer = Number.parseInt(colorString, 16);
|
|
229260
|
+
return [
|
|
229261
|
+
integer >> 16 & 255,
|
|
229262
|
+
integer >> 8 & 255,
|
|
229263
|
+
integer & 255
|
|
229264
|
+
];
|
|
229265
|
+
},
|
|
229266
|
+
enumerable: false
|
|
229267
|
+
},
|
|
229268
|
+
hexToAnsi256: {
|
|
229269
|
+
value: (hex) => styles$2.rgbToAnsi256(...styles$2.hexToRgb(hex)),
|
|
229270
|
+
enumerable: false
|
|
229271
|
+
},
|
|
229272
|
+
ansi256ToAnsi: {
|
|
229273
|
+
value(code) {
|
|
229274
|
+
if (code < 8) return 30 + code;
|
|
229275
|
+
if (code < 16) return 90 + (code - 8);
|
|
229276
|
+
let red;
|
|
229277
|
+
let green;
|
|
229278
|
+
let blue;
|
|
229279
|
+
if (code >= 232) {
|
|
229280
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
229281
|
+
green = red;
|
|
229282
|
+
blue = red;
|
|
229283
|
+
} else {
|
|
229284
|
+
code -= 16;
|
|
229285
|
+
const remainder = code % 36;
|
|
229286
|
+
red = Math.floor(code / 36) / 5;
|
|
229287
|
+
green = Math.floor(remainder / 6) / 5;
|
|
229288
|
+
blue = remainder % 6 / 5;
|
|
229289
|
+
}
|
|
229290
|
+
const value = Math.max(red, green, blue) * 2;
|
|
229291
|
+
if (value === 0) return 30;
|
|
229292
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
229293
|
+
if (value === 2) result += 60;
|
|
229294
|
+
return result;
|
|
229295
|
+
},
|
|
229296
|
+
enumerable: false
|
|
229297
|
+
},
|
|
229298
|
+
rgbToAnsi: {
|
|
229299
|
+
value: (red, green, blue) => styles$2.ansi256ToAnsi(styles$2.rgbToAnsi256(red, green, blue)),
|
|
229300
|
+
enumerable: false
|
|
229301
|
+
},
|
|
229302
|
+
hexToAnsi: {
|
|
229303
|
+
value: (hex) => styles$2.ansi256ToAnsi(styles$2.hexToAnsi256(hex)),
|
|
229304
|
+
enumerable: false
|
|
229305
|
+
}
|
|
229306
|
+
});
|
|
229307
|
+
return styles$2;
|
|
229308
|
+
}
|
|
229309
|
+
const ansiStyles$1 = assembleStyles$1();
|
|
229310
|
+
//#endregion
|
|
229311
|
+
//#region ../../node_modules/.pnpm/chalk@6.0.0/node_modules/chalk/source/vendor/supports-color/index.js
|
|
229312
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process$1.argv) {
|
|
229313
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
229314
|
+
const position = argv.indexOf(prefix + flag);
|
|
229315
|
+
const terminatorPosition = argv.indexOf("--");
|
|
229316
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
229317
|
+
}
|
|
229318
|
+
const { env: env$1 } = process$1;
|
|
229319
|
+
let flagForceColor;
|
|
229320
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
|
|
229321
|
+
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
|
|
229322
|
+
function hasNumericForceColor() {
|
|
229323
|
+
return /^\d+$/.test(env$1.FORCE_COLOR);
|
|
229324
|
+
}
|
|
229325
|
+
function envForceColor() {
|
|
229326
|
+
if (!("FORCE_COLOR" in env$1)) return;
|
|
229327
|
+
if (env$1.FORCE_COLOR === "false") return 0;
|
|
229328
|
+
if (env$1.FORCE_COLOR === "true" || env$1.FORCE_COLOR.length === 0) return 1;
|
|
229329
|
+
if (!hasNumericForceColor()) return;
|
|
229330
|
+
return Math.min(Number.parseInt(env$1.FORCE_COLOR, 10), 3);
|
|
229331
|
+
}
|
|
229332
|
+
function translateLevel(level) {
|
|
229333
|
+
if (level === 0) return false;
|
|
229334
|
+
return {
|
|
229335
|
+
level,
|
|
229336
|
+
hasBasic: true,
|
|
229337
|
+
has256: level >= 2,
|
|
229338
|
+
has16m: level >= 3
|
|
229339
|
+
};
|
|
229340
|
+
}
|
|
229341
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
229342
|
+
const noFlagForceColor = envForceColor();
|
|
229343
|
+
if (noFlagForceColor !== void 0) flagForceColor = noFlagForceColor;
|
|
229344
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
229345
|
+
if (forceColor === 0) return 0;
|
|
229346
|
+
if (sniffFlags) {
|
|
229347
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
|
|
229348
|
+
if (hasFlag("color=256")) return 2;
|
|
229349
|
+
}
|
|
229350
|
+
if (forceColor !== void 0 && hasNumericForceColor()) return forceColor;
|
|
229351
|
+
if ("TF_BUILD" in env$1 && "AGENT_NAME" in env$1) return 1;
|
|
229352
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
|
|
229353
|
+
const min = forceColor || 0;
|
|
229354
|
+
if (env$1.TERM === "dumb") return min;
|
|
229355
|
+
if (process$1.platform === "win32") {
|
|
229356
|
+
const osRelease = os.release().split(".");
|
|
229357
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
229358
|
+
return 1;
|
|
229359
|
+
}
|
|
229360
|
+
if ("CI" in env$1) {
|
|
229361
|
+
if ([
|
|
229362
|
+
"GITHUB_ACTIONS",
|
|
229363
|
+
"GITEA_ACTIONS",
|
|
229364
|
+
"CIRCLECI"
|
|
229365
|
+
].some((key) => key in env$1)) return 3;
|
|
229366
|
+
if ([
|
|
229367
|
+
"TRAVIS",
|
|
229368
|
+
"APPVEYOR",
|
|
229369
|
+
"GITLAB_CI",
|
|
229370
|
+
"BUILDKITE",
|
|
229371
|
+
"DRONE"
|
|
229372
|
+
].some((sign) => sign in env$1) || env$1.CI_NAME === "codeship") return 1;
|
|
229373
|
+
return min;
|
|
229374
|
+
}
|
|
229375
|
+
if ("TEAMCITY_VERSION" in env$1) return /^(?:9\.0*[1-9]\d*\.|\d{2,}\.)/.test(env$1.TEAMCITY_VERSION) ? 1 : 0;
|
|
229376
|
+
if (env$1.COLORTERM === "truecolor") return 3;
|
|
229377
|
+
if (env$1.TERM === "xterm-kitty") return 3;
|
|
229378
|
+
if (env$1.TERM === "xterm-ghostty") return 3;
|
|
229379
|
+
if (env$1.TERM === "wezterm") return 3;
|
|
229380
|
+
if ("TERM_PROGRAM" in env$1) {
|
|
229381
|
+
const version = Number.parseInt((env$1.TERM_PROGRAM_VERSION || "").split(".", 1)[0], 10);
|
|
229382
|
+
switch (env$1.TERM_PROGRAM) {
|
|
229383
|
+
case "iTerm.app": return version >= 3 ? 3 : 2;
|
|
229384
|
+
case "Apple_Terminal": return 2;
|
|
229385
|
+
}
|
|
229386
|
+
}
|
|
229387
|
+
if (/-256(?:color)?$/i.test(env$1.TERM)) return 2;
|
|
229388
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) return 1;
|
|
229389
|
+
if ("COLORTERM" in env$1) return 1;
|
|
229390
|
+
return min;
|
|
229391
|
+
}
|
|
229392
|
+
function createSupportsColor(stream, options = {}) {
|
|
229393
|
+
return translateLevel(_supportsColor(stream, {
|
|
229394
|
+
streamIsTTY: stream && stream.isTTY,
|
|
229395
|
+
...options
|
|
229396
|
+
}));
|
|
229397
|
+
}
|
|
229398
|
+
//#endregion
|
|
229399
|
+
//#region ../../node_modules/.pnpm/chalk@6.0.0/node_modules/chalk/source/index.js
|
|
229400
|
+
const { stdout: stdoutColor, stderr: stderrColor } = {
|
|
229401
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
229402
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
229403
|
+
};
|
|
229404
|
+
const GENERATOR = Symbol("GENERATOR");
|
|
229405
|
+
const STYLER = Symbol("STYLER");
|
|
229406
|
+
const IS_EMPTY = Symbol("IS_EMPTY");
|
|
229407
|
+
const LEVEL = Symbol("LEVEL");
|
|
229408
|
+
const styles$1 = Object.create(null);
|
|
229409
|
+
const assertValidLevel = (level) => {
|
|
229410
|
+
if (!Number.isSafeInteger(level) || level < 0 || level > 3) throw new Error("The `level` should be an integer from 0 to 3");
|
|
229411
|
+
};
|
|
229412
|
+
const levelDescriptor = {
|
|
229413
|
+
enumerable: true,
|
|
229414
|
+
get() {
|
|
229415
|
+
return this[LEVEL];
|
|
229416
|
+
},
|
|
229417
|
+
set(level) {
|
|
229418
|
+
assertValidLevel(level);
|
|
229419
|
+
this[LEVEL] = level;
|
|
229420
|
+
}
|
|
229421
|
+
};
|
|
229422
|
+
const applyOptions = (object, options = {}) => {
|
|
229423
|
+
if (options.level !== void 0) assertValidLevel(options.level);
|
|
229424
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
229425
|
+
object[LEVEL] = options.level === void 0 ? colorLevel : options.level;
|
|
229426
|
+
};
|
|
229427
|
+
const chalkFactory = (options) => {
|
|
229428
|
+
const chalk = (...strings) => strings.join(" ");
|
|
229429
|
+
applyOptions(chalk, options);
|
|
229430
|
+
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
229431
|
+
return chalk;
|
|
229432
|
+
};
|
|
229433
|
+
function createChalk(options) {
|
|
229434
|
+
return chalkFactory(options);
|
|
229435
|
+
}
|
|
229436
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
229437
|
+
for (const [styleName, style] of Object.entries(ansiStyles$1)) styles$1[styleName] = { get() {
|
|
229438
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
229439
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
229440
|
+
return builder;
|
|
229441
|
+
} };
|
|
229442
|
+
styles$1.visible = { get() {
|
|
229443
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
229444
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
229445
|
+
return builder;
|
|
229446
|
+
} };
|
|
229447
|
+
const createModelConverters = (model, type) => {
|
|
229448
|
+
const style = ansiStyles$1[type];
|
|
229449
|
+
if (model === "rgb") {
|
|
229450
|
+
const ansi = (red, green, blue) => style.ansi(ansiStyles$1.rgbToAnsi(red, green, blue));
|
|
229451
|
+
const ansi256 = (red, green, blue) => style.ansi256(ansiStyles$1.rgbToAnsi256(red, green, blue));
|
|
229452
|
+
return [
|
|
229453
|
+
ansi,
|
|
229454
|
+
ansi,
|
|
229455
|
+
ansi256,
|
|
229456
|
+
style.ansi16m
|
|
229457
|
+
];
|
|
229458
|
+
}
|
|
229459
|
+
if (model === "hex") {
|
|
229460
|
+
const ansi = (hex) => style.ansi(ansiStyles$1.hexToAnsi(hex));
|
|
229461
|
+
const ansi256 = (hex) => style.ansi256(ansiStyles$1.hexToAnsi256(hex));
|
|
229462
|
+
return [
|
|
229463
|
+
ansi,
|
|
229464
|
+
ansi,
|
|
229465
|
+
ansi256,
|
|
229466
|
+
(hex) => style.ansi16m(...ansiStyles$1.hexToRgb(hex))
|
|
229467
|
+
];
|
|
229468
|
+
}
|
|
229469
|
+
const ansi = (code) => style.ansi(ansiStyles$1.ansi256ToAnsi(code));
|
|
229470
|
+
return [
|
|
229471
|
+
ansi,
|
|
229472
|
+
ansi,
|
|
229473
|
+
style.ansi256,
|
|
229474
|
+
style.ansi256
|
|
229475
|
+
];
|
|
229476
|
+
};
|
|
229477
|
+
for (const model of [
|
|
229478
|
+
"rgb",
|
|
229479
|
+
"hex",
|
|
229480
|
+
"ansi256"
|
|
229481
|
+
]) {
|
|
229482
|
+
const capitalizedModel = model[0].toUpperCase() + model.slice(1);
|
|
229483
|
+
for (const [styleName, type] of [
|
|
229484
|
+
[model, "color"],
|
|
229485
|
+
["bg" + capitalizedModel, "bgColor"],
|
|
229486
|
+
["underline" + capitalizedModel, "underlineColor"]
|
|
229487
|
+
]) {
|
|
229488
|
+
const { close } = ansiStyles$1[type];
|
|
229489
|
+
const converters = createModelConverters(model, type);
|
|
229490
|
+
styles$1[styleName] = { get() {
|
|
229491
|
+
const styleFunction = function(first, second, third) {
|
|
229492
|
+
const open = converters[this.level](first, second, third);
|
|
229493
|
+
return createBuilder(this, createStyler(open, close, this[STYLER]), this[IS_EMPTY]);
|
|
229494
|
+
};
|
|
229495
|
+
Object.defineProperty(this, styleName, { value: styleFunction });
|
|
229496
|
+
return styleFunction;
|
|
229497
|
+
} };
|
|
229498
|
+
}
|
|
229499
|
+
}
|
|
229500
|
+
const proto = Object.defineProperties(() => {}, {
|
|
229501
|
+
...styles$1,
|
|
229502
|
+
level: {
|
|
229503
|
+
enumerable: true,
|
|
229504
|
+
get() {
|
|
229505
|
+
return this[GENERATOR].level;
|
|
229506
|
+
},
|
|
229507
|
+
set(level) {
|
|
229508
|
+
this[GENERATOR].level = level;
|
|
229509
|
+
}
|
|
229510
|
+
}
|
|
229511
|
+
});
|
|
229512
|
+
const createStyler = (open, close, parent) => {
|
|
229513
|
+
let openAll;
|
|
229514
|
+
let closeAll;
|
|
229515
|
+
if (parent === void 0) {
|
|
229516
|
+
openAll = open;
|
|
229517
|
+
closeAll = close;
|
|
229518
|
+
} else {
|
|
229519
|
+
openAll = parent.openAll + open;
|
|
229520
|
+
closeAll = close + parent.closeAll;
|
|
229521
|
+
}
|
|
229522
|
+
return {
|
|
229523
|
+
open,
|
|
229524
|
+
close,
|
|
229525
|
+
openAll,
|
|
229526
|
+
closeAll,
|
|
229527
|
+
parent
|
|
229528
|
+
};
|
|
229529
|
+
};
|
|
229530
|
+
const createBuilder = (self, _styler, _isEmpty) => {
|
|
229531
|
+
const builder = (...arguments_) => {
|
|
229532
|
+
if (arguments_.length === 1) return applyStyle(builder, "" + arguments_[0]);
|
|
229533
|
+
if (arguments_.length === 2) return applyStyle(builder, arguments_[0] + " " + arguments_[1]);
|
|
229534
|
+
return applyStyle(builder, arguments_.join(" "));
|
|
229535
|
+
};
|
|
229536
|
+
Object.setPrototypeOf(builder, proto);
|
|
229537
|
+
builder[GENERATOR] = self[GENERATOR] ?? self;
|
|
229538
|
+
builder[STYLER] = _styler;
|
|
229539
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
229540
|
+
return builder;
|
|
229541
|
+
};
|
|
229542
|
+
const applyStyle = (self, string) => {
|
|
229543
|
+
if (self[GENERATOR][LEVEL] <= 0 || !string) return self[IS_EMPTY] ? "" : string;
|
|
229544
|
+
let styler = self[STYLER];
|
|
229545
|
+
if (styler === void 0) return string;
|
|
229546
|
+
const { openAll, closeAll } = styler;
|
|
229547
|
+
if (string.includes("\x1B")) while (styler !== void 0) {
|
|
229548
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
229549
|
+
styler = styler.parent;
|
|
229550
|
+
}
|
|
229551
|
+
const lfIndex = string.indexOf("\n");
|
|
229552
|
+
if (lfIndex !== -1) string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
229553
|
+
return openAll + string + closeAll;
|
|
229554
|
+
};
|
|
229555
|
+
Object.defineProperties(createChalk.prototype, {
|
|
229556
|
+
...styles$1,
|
|
229557
|
+
level: levelDescriptor
|
|
229558
|
+
});
|
|
229559
|
+
const chalk = createChalk();
|
|
229560
|
+
createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
229561
|
+
//#endregion
|
|
229562
|
+
//#region ../chain-sdk/dist/neutral/utils.mjs
|
|
229563
|
+
function hexToLast4BytesInt(value) {
|
|
229564
|
+
assertEx$1(isHex(value), () => "value must be a hex string");
|
|
229565
|
+
const last4Bytes = value.slice(-8);
|
|
229566
|
+
return Number.parseInt(last4Bytes, 16);
|
|
229567
|
+
}
|
|
229568
|
+
function seededRandom(seed) {
|
|
229569
|
+
return function() {
|
|
229570
|
+
const x = Math.sin(seed++) * 1e4;
|
|
229571
|
+
return x - Math.floor(x);
|
|
229572
|
+
};
|
|
229573
|
+
}
|
|
229574
|
+
function shuffleWithSeed(set, seed) {
|
|
229575
|
+
const array = [...set].toSorted((a, b) => String(a).localeCompare(String(b)));
|
|
229576
|
+
const random = seededRandom(seed);
|
|
229577
|
+
for (let i = array.length - 1; i > 0; i--) {
|
|
229578
|
+
const j = Math.floor(random() * (i + 1));
|
|
229579
|
+
const swap = array[i];
|
|
229580
|
+
array[i] = array[j];
|
|
229581
|
+
array[j] = swap;
|
|
229582
|
+
}
|
|
229583
|
+
return array;
|
|
229584
|
+
}
|
|
229585
|
+
function spanDurationInMillis(span) {
|
|
229586
|
+
return span.duration[0] * 1e3 + span.duration[1] / 1e6;
|
|
229587
|
+
}
|
|
229588
|
+
(class _XyoConsoleSpanExporter extends ConsoleSpanExporter {
|
|
229589
|
+
static durationToLogLevel = [
|
|
229590
|
+
0,
|
|
229591
|
+
1,
|
|
229592
|
+
10,
|
|
229593
|
+
100,
|
|
229594
|
+
1e3
|
|
229595
|
+
];
|
|
229596
|
+
static logLevelToChalkColor = [
|
|
229597
|
+
chalk.grey,
|
|
229598
|
+
chalk.white,
|
|
229599
|
+
chalk.green,
|
|
229600
|
+
chalk.yellow,
|
|
229601
|
+
chalk.red
|
|
229602
|
+
];
|
|
229603
|
+
_logLevel;
|
|
229604
|
+
constructor(logLevel = 0) {
|
|
229605
|
+
super();
|
|
229606
|
+
this._logLevel = logLevel;
|
|
229607
|
+
}
|
|
229608
|
+
get logLevel() {
|
|
229609
|
+
return this._logLevel;
|
|
229610
|
+
}
|
|
229611
|
+
export(spans) {
|
|
229612
|
+
for (const span of spans) {
|
|
229613
|
+
const spanLevel = this.spanLevel(span);
|
|
229614
|
+
if (spanLevel < this.logLevel) continue;
|
|
229615
|
+
const duration = spanDurationInMillis(span);
|
|
229616
|
+
console.log(chalk.grey([
|
|
229617
|
+
`Span [${span.name}]`,
|
|
229618
|
+
this.logColor(spanLevel)(`${duration}ms`),
|
|
229619
|
+
`TraceId: ${span.spanContext().traceId}`
|
|
229620
|
+
].join(", ")));
|
|
229621
|
+
}
|
|
229622
|
+
}
|
|
229623
|
+
logColor(level) {
|
|
229624
|
+
return _XyoConsoleSpanExporter.logLevelToChalkColor[level] ?? chalk.magenta;
|
|
229625
|
+
}
|
|
229626
|
+
spanLevel(span) {
|
|
229627
|
+
let logLevel = 0;
|
|
229628
|
+
const duration = spanDurationInMillis(span);
|
|
229629
|
+
for (let x = _XyoConsoleSpanExporter.durationToLogLevel.length - 1; x >= 0; x--) if (duration > _XyoConsoleSpanExporter.durationToLogLevel[x]) {
|
|
229630
|
+
logLevel = x;
|
|
229631
|
+
break;
|
|
229632
|
+
}
|
|
229633
|
+
return logLevel;
|
|
229634
|
+
}
|
|
229635
|
+
});
|
|
228821
229636
|
//#endregion
|
|
228822
229637
|
//#region ../chain-sdk/dist/neutral/protocol.mjs
|
|
228823
229638
|
var isBaseBuildBlockOptions = (value) => {
|
|
@@ -228947,376 +229762,6 @@ var createGenesisBlock = async (initialBlockProducer, nextContractAddress, genes
|
|
|
228947
229762
|
return await buildGenesisBlock(nextContractAddress, [], blockPayloads, [initialBlockProducer]);
|
|
228948
229763
|
};
|
|
228949
229764
|
//#endregion
|
|
228950
|
-
//#region ../chain-sdk/dist/neutral/ethereum.mjs
|
|
228951
|
-
var __defProp$13 = Object.defineProperty;
|
|
228952
|
-
var __getOwnPropDesc$13 = Object.getOwnPropertyDescriptor;
|
|
228953
|
-
var __defNormalProp$13 = (obj, key, value) => key in obj ? __defProp$13(obj, key, {
|
|
228954
|
-
enumerable: true,
|
|
228955
|
-
configurable: true,
|
|
228956
|
-
writable: true,
|
|
228957
|
-
value
|
|
228958
|
-
}) : obj[key] = value;
|
|
228959
|
-
var __decorateClass$13 = (decorators, target, key, kind) => {
|
|
228960
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$13(target, key) : target;
|
|
228961
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
228962
|
-
if (kind && result) __defProp$13(target, key, result);
|
|
228963
|
-
return result;
|
|
228964
|
-
};
|
|
228965
|
-
var __publicField$13 = (obj, key, value) => __defNormalProp$13(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
228966
|
-
var STAKE_EVENT_NAMES$1 = /* @__PURE__ */ new Set([
|
|
228967
|
-
"StakeAdded",
|
|
228968
|
-
"StakeRemoved",
|
|
228969
|
-
"StakeWithdrawn"
|
|
228970
|
-
]);
|
|
228971
|
-
var DEFAULT_HEAD_POLL_INTERVAL_MS$1 = 5e3;
|
|
228972
|
-
var MIN_HEAD_POLL_INTERVAL_MS = 5e3;
|
|
228973
|
-
var RestStakeEventsViewerOptionsZod = object$3({ headPollIntervalMs: number$1().optional() });
|
|
228974
|
-
var RestStakeEventsViewer = class extends AbstractCreatableProvider$1 {
|
|
228975
|
-
moniker = RestStakeEventsViewer.defaultMoniker;
|
|
228976
|
-
completeFrames = /* @__PURE__ */ new Map();
|
|
228977
|
-
contractInterface = new Interface(IAddressStakingEvents__factory2.abi);
|
|
228978
|
-
currentHead;
|
|
228979
|
-
headPollIntervalMs = DEFAULT_HEAD_POLL_INTERVAL_MS$1;
|
|
228980
|
-
lastSuccessfulSyncAt;
|
|
228981
|
-
manifestPromise;
|
|
228982
|
-
positionCountCheckpoints = [];
|
|
228983
|
-
stakeEventCache = [];
|
|
228984
|
-
stakeEventsByPosition = /* @__PURE__ */ new Map();
|
|
228985
|
-
syncPromise;
|
|
228986
|
-
tailFrame;
|
|
228987
|
-
get address() {
|
|
228988
|
-
return toEthAddress(assertEx$1(this.config.chain.id, () => "RestStakeEventsViewer requires config.chain.id (the staking contract address)"));
|
|
228989
|
-
}
|
|
228990
|
-
get eventIndexBaseUrl() {
|
|
228991
|
-
const connection = RestStakeEventsViewer.requireBoundConnection(this.config);
|
|
228992
|
-
return assertEx$1(connection.config.type === "rest" ? connection.config.baseUrl : void 0, () => `Connection "${connection.name}" bound to RestStakeEventsViewer requires a rest baseUrl`).replace(/\/+$/, "");
|
|
228993
|
-
}
|
|
228994
|
-
get fetchFn() {
|
|
228995
|
-
return this.context.fetchFn ?? fetch.bind(globalThis);
|
|
228996
|
-
}
|
|
228997
|
-
/** Creates the provider instance after its configuration has resolved. */
|
|
228998
|
-
async createHandler() {
|
|
228999
|
-
await super.createHandler();
|
|
229000
|
-
RestStakeEventsViewer.requireBoundConnection(this.config);
|
|
229001
|
-
const { headPollIntervalMs } = RestStakeEventsViewerOptionsZod.parse(this.config.options);
|
|
229002
|
-
if (headPollIntervalMs !== void 0) assertEx$1(headPollIntervalMs >= MIN_HEAD_POLL_INTERVAL_MS, () => `headPollIntervalMs must be at least ${MIN_HEAD_POLL_INTERVAL_MS}ms`);
|
|
229003
|
-
this.headPollIntervalMs = headPollIntervalMs ?? DEFAULT_HEAD_POLL_INTERVAL_MS$1;
|
|
229004
|
-
}
|
|
229005
|
-
async positionCount(range) {
|
|
229006
|
-
await this.sync();
|
|
229007
|
-
this.assertRangeAvailable(range);
|
|
229008
|
-
if (range[0] === 0) return this.positionCountThrough(range[1]);
|
|
229009
|
-
return this.matchingStakeEvents(range).reduce((max, event) => Math.max(max, event.args.id), -1) + 1;
|
|
229010
|
-
}
|
|
229011
|
-
async stakeEvents(range = [0, "latest"], filter) {
|
|
229012
|
-
await this.sync();
|
|
229013
|
-
this.assertRangeAvailable(range);
|
|
229014
|
-
return this.matchingStakeEvents(range, filter);
|
|
229015
|
-
}
|
|
229016
|
-
assertRangeAvailable(range) {
|
|
229017
|
-
const head = assertEx$1(this.currentHead, () => "EVM event index head is unavailable");
|
|
229018
|
-
assertEx$1(range[1] === "latest" || range[1] <= head.block, () => `Stake-event range ends at ${range[1]}, beyond EVM event index head ${head.block}`);
|
|
229019
|
-
}
|
|
229020
|
-
decodeIndexedStakeEvents() {
|
|
229021
|
-
return [...[...this.completeFrames.entries()].sort(([a], [b]) => a - b).map(([, frame]) => frame), ...this.tailFrame === void 0 ? [] : [this.tailFrame]].flatMap((frame) => frame.logs).sort((a, b) => a.blockNumber - b.blockNumber || a.transactionIndex - b.transactionIndex || a.index - b.index).flatMap((log) => {
|
|
229022
|
-
const event = this.stakeEventFromLog(log);
|
|
229023
|
-
return event === void 0 ? [] : [event];
|
|
229024
|
-
});
|
|
229025
|
-
}
|
|
229026
|
-
async fetchJson(path) {
|
|
229027
|
-
const response = await this.fetchFn(`${this.eventIndexBaseUrl}/${path}`);
|
|
229028
|
-
assertEx$1(response.ok, () => `EVM event index request failed [${response.status}] for ${path}`);
|
|
229029
|
-
return await response.json();
|
|
229030
|
-
}
|
|
229031
|
-
async getManifest() {
|
|
229032
|
-
this.manifestPromise ??= (async () => {
|
|
229033
|
-
const manifest = asEvmEventIndexManifest(await this.fetchJson(evmEventIndexManifestPath(this.address)), true);
|
|
229034
|
-
assertEx$1(manifest.address.toLowerCase() === this.address.toLowerCase(), () => "EVM event index manifest address mismatch");
|
|
229035
|
-
return manifest;
|
|
229036
|
-
})();
|
|
229037
|
-
return await this.manifestPromise;
|
|
229038
|
-
}
|
|
229039
|
-
indexStakeEvents(events) {
|
|
229040
|
-
this.stakeEventCache = events;
|
|
229041
|
-
this.positionCountCheckpoints = [];
|
|
229042
|
-
this.stakeEventsByPosition.clear();
|
|
229043
|
-
let maxPositionId = -1;
|
|
229044
|
-
for (const event of events) {
|
|
229045
|
-
const positionEvents = this.stakeEventsByPosition.get(event.args.id) ?? [];
|
|
229046
|
-
positionEvents.push(event);
|
|
229047
|
-
this.stakeEventsByPosition.set(event.args.id, positionEvents);
|
|
229048
|
-
if (event.args.id > maxPositionId) {
|
|
229049
|
-
maxPositionId = event.args.id;
|
|
229050
|
-
this.positionCountCheckpoints.push({
|
|
229051
|
-
count: maxPositionId + 1,
|
|
229052
|
-
time: event.time
|
|
229053
|
-
});
|
|
229054
|
-
}
|
|
229055
|
-
}
|
|
229056
|
-
}
|
|
229057
|
-
matchesFilter(event, range, filter) {
|
|
229058
|
-
if (range[1] !== "latest" && event.time > range[1]) return false;
|
|
229059
|
-
if (event.time < range[0]) return false;
|
|
229060
|
-
if (isDefined$1(filter?.name) && event.name !== filter.name) return false;
|
|
229061
|
-
if (isDefined$1(filter?.args?.id) && event.args.id !== filter.args.id) return false;
|
|
229062
|
-
if (isDefined$1(filter?.args?.staked) && event.args.staked !== filter.args.staked) return false;
|
|
229063
|
-
if (isDefined$1(filter?.args?.staker) && event.args.staker !== filter.args.staker) return false;
|
|
229064
|
-
return true;
|
|
229065
|
-
}
|
|
229066
|
-
matchingStakeEvents(range, filter) {
|
|
229067
|
-
const positionId = filter?.args?.id;
|
|
229068
|
-
return (isDefined$1(positionId) ? this.stakeEventsByPosition.get(positionId) ?? [] : this.stakeEventCache).filter((event) => this.matchesFilter(event, range, filter));
|
|
229069
|
-
}
|
|
229070
|
-
positionCountThrough(end) {
|
|
229071
|
-
if (end === "latest") return this.positionCountCheckpoints.at(-1)?.count ?? 0;
|
|
229072
|
-
let low = 0;
|
|
229073
|
-
let high = this.positionCountCheckpoints.length;
|
|
229074
|
-
while (low < high) {
|
|
229075
|
-
const middle = Math.floor((low + high) / 2);
|
|
229076
|
-
if (this.positionCountCheckpoints[middle].time <= end) low = middle + 1;
|
|
229077
|
-
else high = middle;
|
|
229078
|
-
}
|
|
229079
|
-
return this.positionCountCheckpoints[low - 1]?.count ?? 0;
|
|
229080
|
-
}
|
|
229081
|
-
stakeEventFromLog(log) {
|
|
229082
|
-
const parsed = this.contractInterface.parseLog({
|
|
229083
|
-
data: log.data,
|
|
229084
|
-
topics: log.topics
|
|
229085
|
-
});
|
|
229086
|
-
if (parsed === null || !STAKE_EVENT_NAMES$1.has(parsed.name)) return;
|
|
229087
|
-
const [staked, staker, id, amount] = parsed.args;
|
|
229088
|
-
return {
|
|
229089
|
-
name: parsed.name,
|
|
229090
|
-
args: {
|
|
229091
|
-
amount: asAttoXL1$1(amount),
|
|
229092
|
-
id: Number(id),
|
|
229093
|
-
staked: toAddress(staked),
|
|
229094
|
-
staker: toAddress(staker)
|
|
229095
|
-
},
|
|
229096
|
-
time: log.blockNumber
|
|
229097
|
-
};
|
|
229098
|
-
}
|
|
229099
|
-
async sync() {
|
|
229100
|
-
const now = Date.now();
|
|
229101
|
-
const elapsed = this.lastSuccessfulSyncAt === void 0 ? void 0 : now - this.lastSuccessfulSyncAt;
|
|
229102
|
-
if (this.currentHead !== void 0 && elapsed !== void 0 && elapsed >= 0 && elapsed < this.headPollIntervalMs) return;
|
|
229103
|
-
this.syncPromise ??= this.syncFromHead().then(() => {
|
|
229104
|
-
this.lastSuccessfulSyncAt = Date.now();
|
|
229105
|
-
}).finally(() => {
|
|
229106
|
-
this.syncPromise = void 0;
|
|
229107
|
-
});
|
|
229108
|
-
await this.syncPromise;
|
|
229109
|
-
}
|
|
229110
|
-
async syncFromHead() {
|
|
229111
|
-
const manifest = await this.getManifest();
|
|
229112
|
-
const head = asEvmEventIndexHead(await this.fetchJson(evmEventIndexHeadPath(this.address)), true);
|
|
229113
|
-
assertEx$1(head.address.toLowerCase() === this.address.toLowerCase(), () => "EVM event index head address mismatch");
|
|
229114
|
-
assertEx$1(head.chainId === manifest.chainId, () => "EVM event index chain mismatch");
|
|
229115
|
-
if (this.currentHead?.block === head.block && this.currentHead.hash === head.hash) return;
|
|
229116
|
-
if (this.currentHead !== void 0 && (head.block < this.currentHead.block || head.block === this.currentHead.block && head.hash !== this.currentHead.hash)) {
|
|
229117
|
-
this.completeFrames.clear();
|
|
229118
|
-
this.tailFrame = void 0;
|
|
229119
|
-
}
|
|
229120
|
-
const indexedBlockCount = Math.max(0, head.block - manifest.deploymentBlock + 1);
|
|
229121
|
-
const completeFrameCount = Math.floor(indexedBlockCount / manifest.frameSize);
|
|
229122
|
-
const missingFrameIndexes = Array.from({ length: completeFrameCount }, (_, index) => index).filter((index) => !this.completeFrames.has(index));
|
|
229123
|
-
await Promise.all(missingFrameIndexes.map(async (index) => {
|
|
229124
|
-
const frame = asEvmEventIndexFrame(await this.fetchJson(evmEventIndexFramePath(this.address, index)), true);
|
|
229125
|
-
const expectedFrom = manifest.deploymentBlock + index * manifest.frameSize;
|
|
229126
|
-
assertEx$1(frame.fromBlock === expectedFrom, () => `EVM event index frame ${index} starts at the wrong block`);
|
|
229127
|
-
assertEx$1(frame.toBlock === expectedFrom + manifest.frameSize - 1, () => `EVM event index frame ${index} is incomplete`);
|
|
229128
|
-
this.completeFrames.set(index, frame);
|
|
229129
|
-
}));
|
|
229130
|
-
const tailStart = manifest.deploymentBlock + completeFrameCount * manifest.frameSize;
|
|
229131
|
-
this.tailFrame = tailStart <= head.block ? asEvmEventIndexFrame(await this.fetchJson(`${evmEventIndexTailPath(this.address)}?head=${head.hash}`), true) : void 0;
|
|
229132
|
-
if (this.tailFrame !== void 0) {
|
|
229133
|
-
assertEx$1(this.tailFrame.fromBlock === tailStart, () => "EVM event index tail starts at the wrong block");
|
|
229134
|
-
assertEx$1(this.tailFrame.toBlock === head.block, () => "EVM event index tail is stale relative to its head");
|
|
229135
|
-
}
|
|
229136
|
-
this.indexStakeEvents(this.decodeIndexedStakeEvents());
|
|
229137
|
-
this.currentHead = head;
|
|
229138
|
-
}
|
|
229139
|
-
};
|
|
229140
|
-
__publicField$13(RestStakeEventsViewer, "connectionTypes", ["rest"]);
|
|
229141
|
-
__publicField$13(RestStakeEventsViewer, "defaultMoniker", StakeEventsViewerMoniker$1);
|
|
229142
|
-
__publicField$13(RestStakeEventsViewer, "dependencies", []);
|
|
229143
|
-
__publicField$13(RestStakeEventsViewer, "monikers", [StakeEventsViewerMoniker$1]);
|
|
229144
|
-
__publicField$13(RestStakeEventsViewer, "surface", "node");
|
|
229145
|
-
RestStakeEventsViewer = __decorateClass$13([creatableProvider$1()], RestStakeEventsViewer);
|
|
229146
|
-
var DEFAULT_REFRESH_INTERVAL_MS = 5e3;
|
|
229147
|
-
var MIN_REFRESH_INTERVAL_MS = 5e3;
|
|
229148
|
-
var RestStakeViewerOptionsZod = object$3({ refreshIntervalMs: number$1().optional() });
|
|
229149
|
-
var RestStakeViewer = class extends AbstractCreatableProvider$1 {
|
|
229150
|
-
moniker = RestStakeViewer.defaultMoniker;
|
|
229151
|
-
_chainContractViewer;
|
|
229152
|
-
_stakeEventsViewer;
|
|
229153
|
-
lastSuccessfulSyncAt;
|
|
229154
|
-
positionIndex = /* @__PURE__ */ new Map();
|
|
229155
|
-
positionsByStaked = /* @__PURE__ */ new Map();
|
|
229156
|
-
positionsByStaker = /* @__PURE__ */ new Map();
|
|
229157
|
-
refreshIntervalMs = DEFAULT_REFRESH_INTERVAL_MS;
|
|
229158
|
-
syncPromise;
|
|
229159
|
-
/** Returns the finalized stake-event source used to materialize positions. */
|
|
229160
|
-
get stakeEvents() {
|
|
229161
|
-
return this._stakeEventsViewer;
|
|
229162
|
-
}
|
|
229163
|
-
/** Returns active finalized stake positions. */
|
|
229164
|
-
async activeStakes() {
|
|
229165
|
-
await this.sync();
|
|
229166
|
-
return this.positionIndex.values().filter((position) => position.removeBlock === 0 && position.withdrawBlock === 0).toArray();
|
|
229167
|
-
}
|
|
229168
|
-
/** Creates the provider after its REST binding and dependencies resolve. */
|
|
229169
|
-
async createHandler() {
|
|
229170
|
-
await super.createHandler();
|
|
229171
|
-
RestStakeViewer.requireBoundConnection(this.config);
|
|
229172
|
-
const { refreshIntervalMs } = RestStakeViewerOptionsZod.parse(this.config.options);
|
|
229173
|
-
if (refreshIntervalMs !== void 0) assertEx$1(refreshIntervalMs >= MIN_REFRESH_INTERVAL_MS, () => `refreshIntervalMs must be at least ${MIN_REFRESH_INTERVAL_MS}ms`);
|
|
229174
|
-
this.refreshIntervalMs = refreshIntervalMs ?? DEFAULT_REFRESH_INTERVAL_MS;
|
|
229175
|
-
this._chainContractViewer = await this.locator.getInstance(ChainContractViewerMoniker$1);
|
|
229176
|
-
this._stakeEventsViewer = await this.locator.getInstance(StakeEventsViewerMoniker$1);
|
|
229177
|
-
}
|
|
229178
|
-
/** Returns the configured chain's withdrawal delay. */
|
|
229179
|
-
async minWithdrawalBlocks() {
|
|
229180
|
-
return await this._chainContractViewer.minWithdrawalBlocks();
|
|
229181
|
-
}
|
|
229182
|
-
/** Returns finalized positions that have been removed but not withdrawn. */
|
|
229183
|
-
async removedStakes() {
|
|
229184
|
-
await this.sync();
|
|
229185
|
-
return this.positionIndex.values().filter((position) => position.removeBlock !== 0 && position.withdrawBlock === 0).toArray();
|
|
229186
|
-
}
|
|
229187
|
-
/** Returns the configured rewards contract address. */
|
|
229188
|
-
async rewardsContract() {
|
|
229189
|
-
return toAddress(await this._chainContractViewer.rewardsContract());
|
|
229190
|
-
}
|
|
229191
|
-
/** Returns a finalized position by its contract id. */
|
|
229192
|
-
async stakeById(id) {
|
|
229193
|
-
await this.sync();
|
|
229194
|
-
return assertEx$1(this.positionIndex.get(id), () => `RestStakeViewer: position ${id} not found in finalized event index`);
|
|
229195
|
-
}
|
|
229196
|
-
/** Returns a staker's finalized position by its contract slot. */
|
|
229197
|
-
async stakeByStaker(staker, slot) {
|
|
229198
|
-
await this.sync();
|
|
229199
|
-
const position = this.positionsByStaker.get(toAddress(staker))?.at(slot);
|
|
229200
|
-
return assertEx$1(position, () => `RestStakeViewer: staker ${staker} has no finalized position at slot ${slot}`);
|
|
229201
|
-
}
|
|
229202
|
-
/** Returns finalized positions added for an address in the supplied EVM block range. */
|
|
229203
|
-
async stakesByStaked(staked, range = [0, void 0]) {
|
|
229204
|
-
await this.sync();
|
|
229205
|
-
return this.positionsInRange(this.positionsByStaked.get(toAddress(staked)) ?? [], range);
|
|
229206
|
-
}
|
|
229207
|
-
/** Returns finalized positions added by a staker in the supplied EVM block range. */
|
|
229208
|
-
async stakesByStaker(staker, range = [0, void 0]) {
|
|
229209
|
-
await this.sync();
|
|
229210
|
-
return this.positionsInRange(this.positionsByStaker.get(toAddress(staker)) ?? [], range);
|
|
229211
|
-
}
|
|
229212
|
-
/** Returns the configured staking-token address. */
|
|
229213
|
-
async stakingTokenAddress() {
|
|
229214
|
-
return toAddress(await this._chainContractViewer.stakingTokenAddress());
|
|
229215
|
-
}
|
|
229216
|
-
/** Returns finalized positions that have completed withdrawal. */
|
|
229217
|
-
async withdrawnStakes() {
|
|
229218
|
-
await this.sync();
|
|
229219
|
-
return this.positionIndex.values().filter((position) => position.removeBlock !== 0 && position.withdrawBlock !== 0).toArray();
|
|
229220
|
-
}
|
|
229221
|
-
applyEvent(index, event) {
|
|
229222
|
-
if (event.name === "StakeAdded") {
|
|
229223
|
-
index.set(event.args.id, {
|
|
229224
|
-
id: event.args.id,
|
|
229225
|
-
staked: toAddress(event.args.staked),
|
|
229226
|
-
staker: toAddress(event.args.staker),
|
|
229227
|
-
amount: event.args.amount,
|
|
229228
|
-
addBlock: event.time,
|
|
229229
|
-
removeBlock: 0,
|
|
229230
|
-
withdrawBlock: 0
|
|
229231
|
-
});
|
|
229232
|
-
return;
|
|
229233
|
-
}
|
|
229234
|
-
const position = assertEx$1(index.get(event.args.id), () => `RestStakeViewer: ${event.name} precedes StakeAdded for position ${event.args.id}`);
|
|
229235
|
-
index.set(event.args.id, {
|
|
229236
|
-
...position,
|
|
229237
|
-
...event.name === "StakeRemoved" ? { removeBlock: event.time } : { withdrawBlock: event.time }
|
|
229238
|
-
});
|
|
229239
|
-
}
|
|
229240
|
-
positionsInRange(positions, range) {
|
|
229241
|
-
const [fromBlock, configuredToBlock] = range;
|
|
229242
|
-
const toBlock = configuredToBlock ?? Number.MAX_SAFE_INTEGER;
|
|
229243
|
-
return positions.filter((position) => position.addBlock >= fromBlock && position.addBlock <= toBlock);
|
|
229244
|
-
}
|
|
229245
|
-
rebuildPositionIndex(events) {
|
|
229246
|
-
const positionIndex = /* @__PURE__ */ new Map();
|
|
229247
|
-
for (const event of events.toSorted((left, right) => left.time - right.time)) this.applyEvent(positionIndex, event);
|
|
229248
|
-
const positionsByStaked = /* @__PURE__ */ new Map();
|
|
229249
|
-
const positionsByStaker = /* @__PURE__ */ new Map();
|
|
229250
|
-
for (const position of positionIndex.values().toArray().toSorted((left, right) => left.id - right.id)) {
|
|
229251
|
-
const staked = toAddress(position.staked);
|
|
229252
|
-
const staker = toAddress(position.staker);
|
|
229253
|
-
positionsByStaked.set(staked, [...positionsByStaked.get(staked) ?? [], position]);
|
|
229254
|
-
positionsByStaker.set(staker, [...positionsByStaker.get(staker) ?? [], position]);
|
|
229255
|
-
}
|
|
229256
|
-
this.positionIndex = positionIndex;
|
|
229257
|
-
this.positionsByStaked = positionsByStaked;
|
|
229258
|
-
this.positionsByStaker = positionsByStaker;
|
|
229259
|
-
}
|
|
229260
|
-
async sync() {
|
|
229261
|
-
const now = Date.now();
|
|
229262
|
-
const elapsed = this.lastSuccessfulSyncAt === void 0 ? void 0 : now - this.lastSuccessfulSyncAt;
|
|
229263
|
-
if (elapsed !== void 0 && elapsed >= 0 && elapsed < this.refreshIntervalMs) return;
|
|
229264
|
-
this.syncPromise ??= Promise.resolve(this.stakeEvents.stakeEvents([0, "latest"])).then((events) => this.rebuildPositionIndex(events)).then(() => {
|
|
229265
|
-
this.lastSuccessfulSyncAt = Date.now();
|
|
229266
|
-
}).finally(() => {
|
|
229267
|
-
this.syncPromise = void 0;
|
|
229268
|
-
});
|
|
229269
|
-
await this.syncPromise;
|
|
229270
|
-
}
|
|
229271
|
-
};
|
|
229272
|
-
__publicField$13(RestStakeViewer, "connectionTypes", ["rest"]);
|
|
229273
|
-
__publicField$13(RestStakeViewer, "defaultMoniker", StakeViewerMoniker$1);
|
|
229274
|
-
__publicField$13(RestStakeViewer, "dependencies", [ChainContractViewerMoniker$1, StakeEventsViewerMoniker$1]);
|
|
229275
|
-
__publicField$13(RestStakeViewer, "monikers", [StakeViewerMoniker$1]);
|
|
229276
|
-
__publicField$13(RestStakeViewer, "surface", "node");
|
|
229277
|
-
RestStakeViewer = __decorateClass$13([creatableProvider$1()], RestStakeViewer);
|
|
229278
|
-
function evmContractRunnerHandleKey(moniker) {
|
|
229279
|
-
return `evm-contract-runner:${moniker}`;
|
|
229280
|
-
}
|
|
229281
|
-
var AbstractEvmRunner = class extends AbstractEvmProvider$1 {
|
|
229282
|
-
_runner;
|
|
229283
|
-
get runner() {
|
|
229284
|
-
return assertEx$1(this._runner, () => "EVM contract runner not initialized");
|
|
229285
|
-
}
|
|
229286
|
-
/** Creates the provider instance after its dependencies and configuration have resolved. */
|
|
229287
|
-
async createHandler() {
|
|
229288
|
-
const key = evmContractRunnerHandleKey(this.moniker);
|
|
229289
|
-
this._runner = await this.connectionHandles.getOrOpen(key, () => {
|
|
229290
|
-
throw new Error(`No EVM contract runner seeded for [${this.moniker}] \u2014 set context.connectionHandles["${key}"] before create`);
|
|
229291
|
-
});
|
|
229292
|
-
await super.createHandler();
|
|
229293
|
-
}
|
|
229294
|
-
};
|
|
229295
|
-
var EvmStakeRunner = class extends AbstractEvmRunner {
|
|
229296
|
-
moniker = EvmStakeRunner.defaultMoniker;
|
|
229297
|
-
async addStake(staked, amount) {
|
|
229298
|
-
await (await this.contract.addStake(getAddress(toEthAddress(staked)), amount)).wait();
|
|
229299
|
-
return true;
|
|
229300
|
-
}
|
|
229301
|
-
async removeStake(slot) {
|
|
229302
|
-
await (await this.contract.removeStake(slot)).wait();
|
|
229303
|
-
return true;
|
|
229304
|
-
}
|
|
229305
|
-
async withdrawStake(slot) {
|
|
229306
|
-
await (await this.contract.withdrawStake(slot)).wait();
|
|
229307
|
-
return true;
|
|
229308
|
-
}
|
|
229309
|
-
connectContract(address) {
|
|
229310
|
-
return IStakedXyoChain__factory.connect(address, this.runner);
|
|
229311
|
-
}
|
|
229312
|
-
};
|
|
229313
|
-
__publicField$13(EvmStakeRunner, "connectionTypes", ["evm-rpc"]);
|
|
229314
|
-
__publicField$13(EvmStakeRunner, "defaultMoniker", StakeRunnerMoniker);
|
|
229315
|
-
__publicField$13(EvmStakeRunner, "dependencies", []);
|
|
229316
|
-
__publicField$13(EvmStakeRunner, "monikers", [StakeRunnerMoniker]);
|
|
229317
|
-
__publicField$13(EvmStakeRunner, "surface", "node");
|
|
229318
|
-
EvmStakeRunner = __decorateClass$13([creatableProvider$1()], EvmStakeRunner);
|
|
229319
|
-
//#endregion
|
|
229320
229765
|
//#region ../chain-sdk/dist/neutral/validation.mjs
|
|
229321
229766
|
var BlockAllowedPayloadSchemasValidator = (context, block) => {
|
|
229322
229767
|
const errors = [];
|
|
@@ -229859,23 +230304,23 @@ var validateHydratedTransactionState = async (context, tx) => {
|
|
|
229859
230304
|
};
|
|
229860
230305
|
//#endregion
|
|
229861
230306
|
//#region ../chain-sdk/dist/neutral/modules.mjs
|
|
229862
|
-
var __defProp$
|
|
229863
|
-
var __getOwnPropDesc$
|
|
230307
|
+
var __defProp$13 = Object.defineProperty;
|
|
230308
|
+
var __getOwnPropDesc$13 = Object.getOwnPropertyDescriptor;
|
|
229864
230309
|
var __getProtoOf$1 = Object.getPrototypeOf;
|
|
229865
230310
|
var __reflectGet$1 = Reflect.get;
|
|
229866
|
-
var __defNormalProp$
|
|
230311
|
+
var __defNormalProp$13 = (obj, key, value) => key in obj ? __defProp$13(obj, key, {
|
|
229867
230312
|
enumerable: true,
|
|
229868
230313
|
configurable: true,
|
|
229869
230314
|
writable: true,
|
|
229870
230315
|
value
|
|
229871
230316
|
}) : obj[key] = value;
|
|
229872
|
-
var __decorateClass$
|
|
229873
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
230317
|
+
var __decorateClass$13 = (decorators, target, key, kind) => {
|
|
230318
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$13(target, key) : target;
|
|
229874
230319
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
229875
|
-
if (kind && result) __defProp$
|
|
230320
|
+
if (kind && result) __defProp$13(target, key, result);
|
|
229876
230321
|
return result;
|
|
229877
230322
|
};
|
|
229878
|
-
var __publicField$
|
|
230323
|
+
var __publicField$13 = (obj, key, value) => __defNormalProp$13(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
229879
230324
|
var __superGet$1 = (cls, obj, key) => __reflectGet$1(__getProtoOf$1(cls), key, obj);
|
|
229880
230325
|
var BlockRewardDivinerConfigSchema = asSchema$1("network.xyo.diviner.chain.block.reward.config", true);
|
|
229881
230326
|
var BlockRewardDiviner = class extends AbstractDiviner {
|
|
@@ -229935,9 +230380,9 @@ var FixedPercentageBlockRewardDiviner = class extends BlockRewardDiviner {
|
|
|
229935
230380
|
}))).flat().filter(exists$1);
|
|
229936
230381
|
}
|
|
229937
230382
|
};
|
|
229938
|
-
__publicField$
|
|
229939
|
-
__publicField$
|
|
229940
|
-
FixedPercentageBlockRewardDiviner = __decorateClass$
|
|
230383
|
+
__publicField$13(FixedPercentageBlockRewardDiviner, "configSchemas", [BlockRewardDivinerConfigSchema, FixedPercentageBlockRewardDivinerConfigSchema]);
|
|
230384
|
+
__publicField$13(FixedPercentageBlockRewardDiviner, "defaultConfigSchema", FixedPercentageBlockRewardDivinerConfigSchema);
|
|
230385
|
+
FixedPercentageBlockRewardDiviner = __decorateClass$13([creatableModule$1()], FixedPercentageBlockRewardDiviner);
|
|
229941
230386
|
var countDecimalPlaces = (num) => {
|
|
229942
230387
|
if (!Number.isFinite(num)) throw new TypeError("Input must be a finite number");
|
|
229943
230388
|
const numStr = num.toString();
|
|
@@ -229983,9 +230428,9 @@ var BlockValidationDiviner = class extends AbstractDiviner {
|
|
|
229983
230428
|
return results;
|
|
229984
230429
|
}
|
|
229985
230430
|
};
|
|
229986
|
-
__publicField$
|
|
229987
|
-
__publicField$
|
|
229988
|
-
BlockValidationDiviner = __decorateClass$
|
|
230431
|
+
__publicField$13(BlockValidationDiviner, "configSchemas", [...__superGet$1(BlockValidationDiviner, BlockValidationDiviner, "configSchemas"), BlockValidationDivinerConfigSchema]);
|
|
230432
|
+
__publicField$13(BlockValidationDiviner, "targetSchema", BlockValidationDivinerConfigSchema);
|
|
230433
|
+
BlockValidationDiviner = __decorateClass$13([creatableModule$1()], BlockValidationDiviner);
|
|
229989
230434
|
var HeadValidationDivinerConfigSchema = asSchema$1("network.xyo.diviner.chain.head.validation.config", true);
|
|
229990
230435
|
var HeadValidationDiviner = class extends AbstractDiviner {
|
|
229991
230436
|
_context;
|
|
@@ -230073,9 +230518,9 @@ var HeadValidationDiviner = class extends AbstractDiviner {
|
|
|
230073
230518
|
});
|
|
230074
230519
|
}
|
|
230075
230520
|
};
|
|
230076
|
-
__publicField$
|
|
230077
|
-
__publicField$
|
|
230078
|
-
HeadValidationDiviner = __decorateClass$
|
|
230521
|
+
__publicField$13(HeadValidationDiviner, "configSchemas", [...__superGet$1(HeadValidationDiviner, HeadValidationDiviner, "configSchemas"), HeadValidationDivinerConfigSchema]);
|
|
230522
|
+
__publicField$13(HeadValidationDiviner, "targetSchema", HeadValidationDivinerConfigSchema);
|
|
230523
|
+
HeadValidationDiviner = __decorateClass$13([creatableModule$1()], HeadValidationDiviner);
|
|
230079
230524
|
var ArchivistNextWitnessConfigSchema = asSchema$1("network.xyo.witness.archivist.next.config", true);
|
|
230080
230525
|
var ArchivistNextWitness = class extends AbstractWitness {
|
|
230081
230526
|
static configSchemas = [...super.configSchemas, ArchivistNextWitnessConfigSchema];
|
|
@@ -230100,591 +230545,23 @@ AsObjectFactory.create(isWeightedNetworkStake);
|
|
|
230100
230545
|
var isNetworkStakeObserve = isPayloadOfSchemaType$1(asSchema$1("network.xyo.witness.chain.stake.network.observe", true));
|
|
230101
230546
|
AsObjectFactory.create(isNetworkStakeObserve);
|
|
230102
230547
|
AsObjectFactory.create(isNetworkStakeObserve);
|
|
230103
|
-
(/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
230104
|
-
module.exports = function shallowEqual(objA, objB, compare, compareContext) {
|
|
230105
|
-
var ret = compare ? compare.call(compareContext, objA, objB) : void 0;
|
|
230106
|
-
if (ret !== void 0) return !!ret;
|
|
230107
|
-
if (objA === objB) return true;
|
|
230108
|
-
if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) return false;
|
|
230109
|
-
var keysA = Object.keys(objA);
|
|
230110
|
-
var keysB = Object.keys(objB);
|
|
230111
|
-
if (keysA.length !== keysB.length) return false;
|
|
230112
|
-
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
|
|
230113
|
-
for (var idx = 0; idx < keysA.length; idx++) {
|
|
230114
|
-
var key = keysA[idx];
|
|
230115
|
-
if (!bHasOwnProperty(key)) return false;
|
|
230116
|
-
var valueA = objA[key];
|
|
230117
|
-
var valueB = objB[key];
|
|
230118
|
-
ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
|
|
230119
|
-
if (ret === false || ret === void 0 && valueA !== valueB) return false;
|
|
230120
|
-
}
|
|
230121
|
-
return true;
|
|
230122
|
-
};
|
|
230123
|
-
})))();
|
|
230124
|
-
function stringReplaceAll(string, substring, postfix) {
|
|
230125
|
-
let index = string.indexOf(substring);
|
|
230126
|
-
if (index === -1) return string;
|
|
230127
|
-
const substringLength = substring.length;
|
|
230128
|
-
let endIndex = 0;
|
|
230129
|
-
let returnValue = "";
|
|
230130
|
-
do {
|
|
230131
|
-
returnValue += string.slice(endIndex, index) + substring + postfix;
|
|
230132
|
-
endIndex = index + substringLength;
|
|
230133
|
-
index = string.indexOf(substring, endIndex);
|
|
230134
|
-
} while (index !== -1);
|
|
230135
|
-
returnValue += string.slice(endIndex);
|
|
230136
|
-
return returnValue;
|
|
230137
|
-
}
|
|
230138
|
-
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
230139
|
-
let endIndex = 0;
|
|
230140
|
-
let returnValue = "";
|
|
230141
|
-
do {
|
|
230142
|
-
const isGotCR = string[index - 1] === "\r";
|
|
230143
|
-
returnValue += string.slice(endIndex, isGotCR ? index - 1 : index) + prefix + (isGotCR ? "\r\n" : "\n") + postfix;
|
|
230144
|
-
endIndex = index + 1;
|
|
230145
|
-
index = string.indexOf("\n", endIndex);
|
|
230146
|
-
} while (index !== -1);
|
|
230147
|
-
returnValue += string.slice(endIndex);
|
|
230148
|
-
return returnValue;
|
|
230149
|
-
}
|
|
230150
|
-
//#endregion
|
|
230151
|
-
//#region ../../node_modules/.pnpm/chalk@6.0.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
230152
|
-
const ANSI_BACKGROUND_OFFSET$1 = 10;
|
|
230153
|
-
const ANSI_UNDERLINE_OFFSET = 20;
|
|
230154
|
-
const wrapAnsi16$1 = (offset = 0) => (code) => `\u{1B}[${code + offset}m`;
|
|
230155
|
-
const wrapAnsi256$1 = (offset = 0) => (code) => `\u{1B}[${38 + offset};5;${code}m`;
|
|
230156
|
-
const wrapAnsi16m$1 = (offset = 0) => (red, green, blue) => `\u{1B}[${38 + offset};2;${red};${green};${blue}m`;
|
|
230157
|
-
const wrapUnderlineAnsi = (code) => `\u{1B}[58;5;${code < 90 ? code - 30 : code - 90 + 8}m`;
|
|
230158
|
-
const styles$2 = {
|
|
230159
|
-
modifier: {
|
|
230160
|
-
reset: [0, 0],
|
|
230161
|
-
bold: [1, 22],
|
|
230162
|
-
dim: [2, 22],
|
|
230163
|
-
italic: [3, 23],
|
|
230164
|
-
underline: [4, 24],
|
|
230165
|
-
underlineDouble: ["4:2", 24],
|
|
230166
|
-
underlineCurly: ["4:3", 24],
|
|
230167
|
-
underlineDotted: ["4:4", 24],
|
|
230168
|
-
underlineDashed: ["4:5", 24],
|
|
230169
|
-
overline: [53, 55],
|
|
230170
|
-
inverse: [7, 27],
|
|
230171
|
-
hidden: [8, 28],
|
|
230172
|
-
strikethrough: [9, 29]
|
|
230173
|
-
},
|
|
230174
|
-
color: {
|
|
230175
|
-
black: [30, 39],
|
|
230176
|
-
red: [31, 39],
|
|
230177
|
-
green: [32, 39],
|
|
230178
|
-
yellow: [33, 39],
|
|
230179
|
-
blue: [34, 39],
|
|
230180
|
-
magenta: [35, 39],
|
|
230181
|
-
cyan: [36, 39],
|
|
230182
|
-
white: [37, 39],
|
|
230183
|
-
blackBright: [90, 39],
|
|
230184
|
-
gray: [90, 39],
|
|
230185
|
-
grey: [90, 39],
|
|
230186
|
-
redBright: [91, 39],
|
|
230187
|
-
greenBright: [92, 39],
|
|
230188
|
-
yellowBright: [93, 39],
|
|
230189
|
-
blueBright: [94, 39],
|
|
230190
|
-
magentaBright: [95, 39],
|
|
230191
|
-
cyanBright: [96, 39],
|
|
230192
|
-
whiteBright: [97, 39]
|
|
230193
|
-
},
|
|
230194
|
-
bgColor: {
|
|
230195
|
-
bgBlack: [40, 49],
|
|
230196
|
-
bgRed: [41, 49],
|
|
230197
|
-
bgGreen: [42, 49],
|
|
230198
|
-
bgYellow: [43, 49],
|
|
230199
|
-
bgBlue: [44, 49],
|
|
230200
|
-
bgMagenta: [45, 49],
|
|
230201
|
-
bgCyan: [46, 49],
|
|
230202
|
-
bgWhite: [47, 49],
|
|
230203
|
-
bgBlackBright: [100, 49],
|
|
230204
|
-
bgGray: [100, 49],
|
|
230205
|
-
bgGrey: [100, 49],
|
|
230206
|
-
bgRedBright: [101, 49],
|
|
230207
|
-
bgGreenBright: [102, 49],
|
|
230208
|
-
bgYellowBright: [103, 49],
|
|
230209
|
-
bgBlueBright: [104, 49],
|
|
230210
|
-
bgMagentaBright: [105, 49],
|
|
230211
|
-
bgCyanBright: [106, 49],
|
|
230212
|
-
bgWhiteBright: [107, 49]
|
|
230213
|
-
},
|
|
230214
|
-
underlineColor: {
|
|
230215
|
-
underlineBlack: ["58;5;0", 59],
|
|
230216
|
-
underlineRed: ["58;5;1", 59],
|
|
230217
|
-
underlineGreen: ["58;5;2", 59],
|
|
230218
|
-
underlineYellow: ["58;5;3", 59],
|
|
230219
|
-
underlineBlue: ["58;5;4", 59],
|
|
230220
|
-
underlineMagenta: ["58;5;5", 59],
|
|
230221
|
-
underlineCyan: ["58;5;6", 59],
|
|
230222
|
-
underlineWhite: ["58;5;7", 59],
|
|
230223
|
-
underlineBlackBright: ["58;5;8", 59],
|
|
230224
|
-
underlineGray: ["58;5;8", 59],
|
|
230225
|
-
underlineGrey: ["58;5;8", 59],
|
|
230226
|
-
underlineRedBright: ["58;5;9", 59],
|
|
230227
|
-
underlineGreenBright: ["58;5;10", 59],
|
|
230228
|
-
underlineYellowBright: ["58;5;11", 59],
|
|
230229
|
-
underlineBlueBright: ["58;5;12", 59],
|
|
230230
|
-
underlineMagentaBright: ["58;5;13", 59],
|
|
230231
|
-
underlineCyanBright: ["58;5;14", 59],
|
|
230232
|
-
underlineWhiteBright: ["58;5;15", 59]
|
|
230233
|
-
}
|
|
230234
|
-
};
|
|
230235
|
-
Object.keys(styles$2.modifier);
|
|
230236
|
-
const foregroundColorNames$1 = Object.keys(styles$2.color);
|
|
230237
|
-
const backgroundColorNames$1 = Object.keys(styles$2.bgColor);
|
|
230238
|
-
Object.keys(styles$2.underlineColor);
|
|
230239
|
-
[...foregroundColorNames$1, ...backgroundColorNames$1];
|
|
230240
|
-
function assembleStyles$1() {
|
|
230241
|
-
const codes = /* @__PURE__ */ new Map();
|
|
230242
|
-
for (const [groupName, group] of Object.entries(styles$2)) {
|
|
230243
|
-
for (const [styleName, style] of Object.entries(group)) {
|
|
230244
|
-
styles$2[styleName] = {
|
|
230245
|
-
open: `\u{1B}[${style[0]}m`,
|
|
230246
|
-
close: `\u{1B}[${style[1]}m`
|
|
230247
|
-
};
|
|
230248
|
-
group[styleName] = styles$2[styleName];
|
|
230249
|
-
codes.set(Number.parseInt(style[0], 10), style[1]);
|
|
230250
|
-
}
|
|
230251
|
-
Object.defineProperty(styles$2, groupName, {
|
|
230252
|
-
value: group,
|
|
230253
|
-
enumerable: false
|
|
230254
|
-
});
|
|
230255
|
-
}
|
|
230256
|
-
Object.defineProperty(styles$2, "codes", {
|
|
230257
|
-
value: codes,
|
|
230258
|
-
enumerable: false
|
|
230259
|
-
});
|
|
230260
|
-
styles$2.color.close = "\x1B[39m";
|
|
230261
|
-
styles$2.bgColor.close = "\x1B[49m";
|
|
230262
|
-
styles$2.underlineColor.close = "\x1B[59m";
|
|
230263
|
-
styles$2.color.ansi = wrapAnsi16$1();
|
|
230264
|
-
styles$2.color.ansi256 = wrapAnsi256$1();
|
|
230265
|
-
styles$2.color.ansi16m = wrapAnsi16m$1();
|
|
230266
|
-
styles$2.bgColor.ansi = wrapAnsi16$1(ANSI_BACKGROUND_OFFSET$1);
|
|
230267
|
-
styles$2.bgColor.ansi256 = wrapAnsi256$1(ANSI_BACKGROUND_OFFSET$1);
|
|
230268
|
-
styles$2.bgColor.ansi16m = wrapAnsi16m$1(ANSI_BACKGROUND_OFFSET$1);
|
|
230269
|
-
styles$2.underlineColor.ansi = wrapUnderlineAnsi;
|
|
230270
|
-
styles$2.underlineColor.ansi256 = wrapAnsi256$1(ANSI_UNDERLINE_OFFSET);
|
|
230271
|
-
styles$2.underlineColor.ansi16m = wrapAnsi16m$1(ANSI_UNDERLINE_OFFSET);
|
|
230272
|
-
Object.defineProperties(styles$2, {
|
|
230273
|
-
rgbToAnsi256: {
|
|
230274
|
-
value(red, green, blue) {
|
|
230275
|
-
if (red === green && green === blue) {
|
|
230276
|
-
if (red < 8) return 16;
|
|
230277
|
-
if (red > 248) return 231;
|
|
230278
|
-
return Math.round((red - 8) / 247 * 24) + 232;
|
|
230279
|
-
}
|
|
230280
|
-
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
230281
|
-
},
|
|
230282
|
-
enumerable: false
|
|
230283
|
-
},
|
|
230284
|
-
hexToRgb: {
|
|
230285
|
-
value(hex) {
|
|
230286
|
-
const matches = /[\da-f]{6}|[\da-f]{3}/i.exec(hex.toString(16));
|
|
230287
|
-
if (!matches) return [
|
|
230288
|
-
0,
|
|
230289
|
-
0,
|
|
230290
|
-
0
|
|
230291
|
-
];
|
|
230292
|
-
let [colorString] = matches;
|
|
230293
|
-
if (colorString.length === 3) colorString = [...colorString].map((character) => character + character).join("");
|
|
230294
|
-
const integer = Number.parseInt(colorString, 16);
|
|
230295
|
-
return [
|
|
230296
|
-
integer >> 16 & 255,
|
|
230297
|
-
integer >> 8 & 255,
|
|
230298
|
-
integer & 255
|
|
230299
|
-
];
|
|
230300
|
-
},
|
|
230301
|
-
enumerable: false
|
|
230302
|
-
},
|
|
230303
|
-
hexToAnsi256: {
|
|
230304
|
-
value: (hex) => styles$2.rgbToAnsi256(...styles$2.hexToRgb(hex)),
|
|
230305
|
-
enumerable: false
|
|
230306
|
-
},
|
|
230307
|
-
ansi256ToAnsi: {
|
|
230308
|
-
value(code) {
|
|
230309
|
-
if (code < 8) return 30 + code;
|
|
230310
|
-
if (code < 16) return 90 + (code - 8);
|
|
230311
|
-
let red;
|
|
230312
|
-
let green;
|
|
230313
|
-
let blue;
|
|
230314
|
-
if (code >= 232) {
|
|
230315
|
-
red = ((code - 232) * 10 + 8) / 255;
|
|
230316
|
-
green = red;
|
|
230317
|
-
blue = red;
|
|
230318
|
-
} else {
|
|
230319
|
-
code -= 16;
|
|
230320
|
-
const remainder = code % 36;
|
|
230321
|
-
red = Math.floor(code / 36) / 5;
|
|
230322
|
-
green = Math.floor(remainder / 6) / 5;
|
|
230323
|
-
blue = remainder % 6 / 5;
|
|
230324
|
-
}
|
|
230325
|
-
const value = Math.max(red, green, blue) * 2;
|
|
230326
|
-
if (value === 0) return 30;
|
|
230327
|
-
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
230328
|
-
if (value === 2) result += 60;
|
|
230329
|
-
return result;
|
|
230330
|
-
},
|
|
230331
|
-
enumerable: false
|
|
230332
|
-
},
|
|
230333
|
-
rgbToAnsi: {
|
|
230334
|
-
value: (red, green, blue) => styles$2.ansi256ToAnsi(styles$2.rgbToAnsi256(red, green, blue)),
|
|
230335
|
-
enumerable: false
|
|
230336
|
-
},
|
|
230337
|
-
hexToAnsi: {
|
|
230338
|
-
value: (hex) => styles$2.ansi256ToAnsi(styles$2.hexToAnsi256(hex)),
|
|
230339
|
-
enumerable: false
|
|
230340
|
-
}
|
|
230341
|
-
});
|
|
230342
|
-
return styles$2;
|
|
230343
|
-
}
|
|
230344
|
-
const ansiStyles$1 = assembleStyles$1();
|
|
230345
|
-
//#endregion
|
|
230346
|
-
//#region ../../node_modules/.pnpm/chalk@6.0.0/node_modules/chalk/source/vendor/supports-color/index.js
|
|
230347
|
-
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process$1.argv) {
|
|
230348
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
230349
|
-
const position = argv.indexOf(prefix + flag);
|
|
230350
|
-
const terminatorPosition = argv.indexOf("--");
|
|
230351
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
230352
|
-
}
|
|
230353
|
-
const { env: env$1 } = process$1;
|
|
230354
|
-
let flagForceColor;
|
|
230355
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
|
|
230356
|
-
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
|
|
230357
|
-
function hasNumericForceColor() {
|
|
230358
|
-
return /^\d+$/.test(env$1.FORCE_COLOR);
|
|
230359
|
-
}
|
|
230360
|
-
function envForceColor() {
|
|
230361
|
-
if (!("FORCE_COLOR" in env$1)) return;
|
|
230362
|
-
if (env$1.FORCE_COLOR === "false") return 0;
|
|
230363
|
-
if (env$1.FORCE_COLOR === "true" || env$1.FORCE_COLOR.length === 0) return 1;
|
|
230364
|
-
if (!hasNumericForceColor()) return;
|
|
230365
|
-
return Math.min(Number.parseInt(env$1.FORCE_COLOR, 10), 3);
|
|
230366
|
-
}
|
|
230367
|
-
function translateLevel(level) {
|
|
230368
|
-
if (level === 0) return false;
|
|
230369
|
-
return {
|
|
230370
|
-
level,
|
|
230371
|
-
hasBasic: true,
|
|
230372
|
-
has256: level >= 2,
|
|
230373
|
-
has16m: level >= 3
|
|
230374
|
-
};
|
|
230375
|
-
}
|
|
230376
|
-
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
230377
|
-
const noFlagForceColor = envForceColor();
|
|
230378
|
-
if (noFlagForceColor !== void 0) flagForceColor = noFlagForceColor;
|
|
230379
|
-
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
230380
|
-
if (forceColor === 0) return 0;
|
|
230381
|
-
if (sniffFlags) {
|
|
230382
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
|
|
230383
|
-
if (hasFlag("color=256")) return 2;
|
|
230384
|
-
}
|
|
230385
|
-
if (forceColor !== void 0 && hasNumericForceColor()) return forceColor;
|
|
230386
|
-
if ("TF_BUILD" in env$1 && "AGENT_NAME" in env$1) return 1;
|
|
230387
|
-
if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
|
|
230388
|
-
const min = forceColor || 0;
|
|
230389
|
-
if (env$1.TERM === "dumb") return min;
|
|
230390
|
-
if (process$1.platform === "win32") {
|
|
230391
|
-
const osRelease = os.release().split(".");
|
|
230392
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
230393
|
-
return 1;
|
|
230394
|
-
}
|
|
230395
|
-
if ("CI" in env$1) {
|
|
230396
|
-
if ([
|
|
230397
|
-
"GITHUB_ACTIONS",
|
|
230398
|
-
"GITEA_ACTIONS",
|
|
230399
|
-
"CIRCLECI"
|
|
230400
|
-
].some((key) => key in env$1)) return 3;
|
|
230401
|
-
if ([
|
|
230402
|
-
"TRAVIS",
|
|
230403
|
-
"APPVEYOR",
|
|
230404
|
-
"GITLAB_CI",
|
|
230405
|
-
"BUILDKITE",
|
|
230406
|
-
"DRONE"
|
|
230407
|
-
].some((sign) => sign in env$1) || env$1.CI_NAME === "codeship") return 1;
|
|
230408
|
-
return min;
|
|
230409
|
-
}
|
|
230410
|
-
if ("TEAMCITY_VERSION" in env$1) return /^(?:9\.0*[1-9]\d*\.|\d{2,}\.)/.test(env$1.TEAMCITY_VERSION) ? 1 : 0;
|
|
230411
|
-
if (env$1.COLORTERM === "truecolor") return 3;
|
|
230412
|
-
if (env$1.TERM === "xterm-kitty") return 3;
|
|
230413
|
-
if (env$1.TERM === "xterm-ghostty") return 3;
|
|
230414
|
-
if (env$1.TERM === "wezterm") return 3;
|
|
230415
|
-
if ("TERM_PROGRAM" in env$1) {
|
|
230416
|
-
const version = Number.parseInt((env$1.TERM_PROGRAM_VERSION || "").split(".", 1)[0], 10);
|
|
230417
|
-
switch (env$1.TERM_PROGRAM) {
|
|
230418
|
-
case "iTerm.app": return version >= 3 ? 3 : 2;
|
|
230419
|
-
case "Apple_Terminal": return 2;
|
|
230420
|
-
}
|
|
230421
|
-
}
|
|
230422
|
-
if (/-256(?:color)?$/i.test(env$1.TERM)) return 2;
|
|
230423
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) return 1;
|
|
230424
|
-
if ("COLORTERM" in env$1) return 1;
|
|
230425
|
-
return min;
|
|
230426
|
-
}
|
|
230427
|
-
function createSupportsColor(stream, options = {}) {
|
|
230428
|
-
return translateLevel(_supportsColor(stream, {
|
|
230429
|
-
streamIsTTY: stream && stream.isTTY,
|
|
230430
|
-
...options
|
|
230431
|
-
}));
|
|
230432
|
-
}
|
|
230433
|
-
//#endregion
|
|
230434
|
-
//#region ../../node_modules/.pnpm/chalk@6.0.0/node_modules/chalk/source/index.js
|
|
230435
|
-
const { stdout: stdoutColor, stderr: stderrColor } = {
|
|
230436
|
-
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
230437
|
-
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
230438
|
-
};
|
|
230439
|
-
const GENERATOR = Symbol("GENERATOR");
|
|
230440
|
-
const STYLER = Symbol("STYLER");
|
|
230441
|
-
const IS_EMPTY = Symbol("IS_EMPTY");
|
|
230442
|
-
const LEVEL = Symbol("LEVEL");
|
|
230443
|
-
const styles$1 = Object.create(null);
|
|
230444
|
-
const assertValidLevel = (level) => {
|
|
230445
|
-
if (!Number.isSafeInteger(level) || level < 0 || level > 3) throw new Error("The `level` should be an integer from 0 to 3");
|
|
230446
|
-
};
|
|
230447
|
-
const levelDescriptor = {
|
|
230448
|
-
enumerable: true,
|
|
230449
|
-
get() {
|
|
230450
|
-
return this[LEVEL];
|
|
230451
|
-
},
|
|
230452
|
-
set(level) {
|
|
230453
|
-
assertValidLevel(level);
|
|
230454
|
-
this[LEVEL] = level;
|
|
230455
|
-
}
|
|
230456
|
-
};
|
|
230457
|
-
const applyOptions = (object, options = {}) => {
|
|
230458
|
-
if (options.level !== void 0) assertValidLevel(options.level);
|
|
230459
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
230460
|
-
object[LEVEL] = options.level === void 0 ? colorLevel : options.level;
|
|
230461
|
-
};
|
|
230462
|
-
const chalkFactory = (options) => {
|
|
230463
|
-
const chalk = (...strings) => strings.join(" ");
|
|
230464
|
-
applyOptions(chalk, options);
|
|
230465
|
-
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
230466
|
-
return chalk;
|
|
230467
|
-
};
|
|
230468
|
-
function createChalk(options) {
|
|
230469
|
-
return chalkFactory(options);
|
|
230470
|
-
}
|
|
230471
|
-
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
230472
|
-
for (const [styleName, style] of Object.entries(ansiStyles$1)) styles$1[styleName] = { get() {
|
|
230473
|
-
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
230474
|
-
Object.defineProperty(this, styleName, { value: builder });
|
|
230475
|
-
return builder;
|
|
230476
|
-
} };
|
|
230477
|
-
styles$1.visible = { get() {
|
|
230478
|
-
const builder = createBuilder(this, this[STYLER], true);
|
|
230479
|
-
Object.defineProperty(this, "visible", { value: builder });
|
|
230480
|
-
return builder;
|
|
230481
|
-
} };
|
|
230482
|
-
const createModelConverters = (model, type) => {
|
|
230483
|
-
const style = ansiStyles$1[type];
|
|
230484
|
-
if (model === "rgb") {
|
|
230485
|
-
const ansi = (red, green, blue) => style.ansi(ansiStyles$1.rgbToAnsi(red, green, blue));
|
|
230486
|
-
const ansi256 = (red, green, blue) => style.ansi256(ansiStyles$1.rgbToAnsi256(red, green, blue));
|
|
230487
|
-
return [
|
|
230488
|
-
ansi,
|
|
230489
|
-
ansi,
|
|
230490
|
-
ansi256,
|
|
230491
|
-
style.ansi16m
|
|
230492
|
-
];
|
|
230493
|
-
}
|
|
230494
|
-
if (model === "hex") {
|
|
230495
|
-
const ansi = (hex) => style.ansi(ansiStyles$1.hexToAnsi(hex));
|
|
230496
|
-
const ansi256 = (hex) => style.ansi256(ansiStyles$1.hexToAnsi256(hex));
|
|
230497
|
-
return [
|
|
230498
|
-
ansi,
|
|
230499
|
-
ansi,
|
|
230500
|
-
ansi256,
|
|
230501
|
-
(hex) => style.ansi16m(...ansiStyles$1.hexToRgb(hex))
|
|
230502
|
-
];
|
|
230503
|
-
}
|
|
230504
|
-
const ansi = (code) => style.ansi(ansiStyles$1.ansi256ToAnsi(code));
|
|
230505
|
-
return [
|
|
230506
|
-
ansi,
|
|
230507
|
-
ansi,
|
|
230508
|
-
style.ansi256,
|
|
230509
|
-
style.ansi256
|
|
230510
|
-
];
|
|
230511
|
-
};
|
|
230512
|
-
for (const model of [
|
|
230513
|
-
"rgb",
|
|
230514
|
-
"hex",
|
|
230515
|
-
"ansi256"
|
|
230516
|
-
]) {
|
|
230517
|
-
const capitalizedModel = model[0].toUpperCase() + model.slice(1);
|
|
230518
|
-
for (const [styleName, type] of [
|
|
230519
|
-
[model, "color"],
|
|
230520
|
-
["bg" + capitalizedModel, "bgColor"],
|
|
230521
|
-
["underline" + capitalizedModel, "underlineColor"]
|
|
230522
|
-
]) {
|
|
230523
|
-
const { close } = ansiStyles$1[type];
|
|
230524
|
-
const converters = createModelConverters(model, type);
|
|
230525
|
-
styles$1[styleName] = { get() {
|
|
230526
|
-
const styleFunction = function(first, second, third) {
|
|
230527
|
-
const open = converters[this.level](first, second, third);
|
|
230528
|
-
return createBuilder(this, createStyler(open, close, this[STYLER]), this[IS_EMPTY]);
|
|
230529
|
-
};
|
|
230530
|
-
Object.defineProperty(this, styleName, { value: styleFunction });
|
|
230531
|
-
return styleFunction;
|
|
230532
|
-
} };
|
|
230533
|
-
}
|
|
230534
|
-
}
|
|
230535
|
-
const proto = Object.defineProperties(() => {}, {
|
|
230536
|
-
...styles$1,
|
|
230537
|
-
level: {
|
|
230538
|
-
enumerable: true,
|
|
230539
|
-
get() {
|
|
230540
|
-
return this[GENERATOR].level;
|
|
230541
|
-
},
|
|
230542
|
-
set(level) {
|
|
230543
|
-
this[GENERATOR].level = level;
|
|
230544
|
-
}
|
|
230545
|
-
}
|
|
230546
|
-
});
|
|
230547
|
-
const createStyler = (open, close, parent) => {
|
|
230548
|
-
let openAll;
|
|
230549
|
-
let closeAll;
|
|
230550
|
-
if (parent === void 0) {
|
|
230551
|
-
openAll = open;
|
|
230552
|
-
closeAll = close;
|
|
230553
|
-
} else {
|
|
230554
|
-
openAll = parent.openAll + open;
|
|
230555
|
-
closeAll = close + parent.closeAll;
|
|
230556
|
-
}
|
|
230557
|
-
return {
|
|
230558
|
-
open,
|
|
230559
|
-
close,
|
|
230560
|
-
openAll,
|
|
230561
|
-
closeAll,
|
|
230562
|
-
parent
|
|
230563
|
-
};
|
|
230564
|
-
};
|
|
230565
|
-
const createBuilder = (self, _styler, _isEmpty) => {
|
|
230566
|
-
const builder = (...arguments_) => {
|
|
230567
|
-
if (arguments_.length === 1) return applyStyle(builder, "" + arguments_[0]);
|
|
230568
|
-
if (arguments_.length === 2) return applyStyle(builder, arguments_[0] + " " + arguments_[1]);
|
|
230569
|
-
return applyStyle(builder, arguments_.join(" "));
|
|
230570
|
-
};
|
|
230571
|
-
Object.setPrototypeOf(builder, proto);
|
|
230572
|
-
builder[GENERATOR] = self[GENERATOR] ?? self;
|
|
230573
|
-
builder[STYLER] = _styler;
|
|
230574
|
-
builder[IS_EMPTY] = _isEmpty;
|
|
230575
|
-
return builder;
|
|
230576
|
-
};
|
|
230577
|
-
const applyStyle = (self, string) => {
|
|
230578
|
-
if (self[GENERATOR][LEVEL] <= 0 || !string) return self[IS_EMPTY] ? "" : string;
|
|
230579
|
-
let styler = self[STYLER];
|
|
230580
|
-
if (styler === void 0) return string;
|
|
230581
|
-
const { openAll, closeAll } = styler;
|
|
230582
|
-
if (string.includes("\x1B")) while (styler !== void 0) {
|
|
230583
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
|
230584
|
-
styler = styler.parent;
|
|
230585
|
-
}
|
|
230586
|
-
const lfIndex = string.indexOf("\n");
|
|
230587
|
-
if (lfIndex !== -1) string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
230588
|
-
return openAll + string + closeAll;
|
|
230589
|
-
};
|
|
230590
|
-
Object.defineProperties(createChalk.prototype, {
|
|
230591
|
-
...styles$1,
|
|
230592
|
-
level: levelDescriptor
|
|
230593
|
-
});
|
|
230594
|
-
const chalk = createChalk();
|
|
230595
|
-
createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
230596
|
-
//#endregion
|
|
230597
|
-
//#region ../chain-sdk/dist/neutral/utils.mjs
|
|
230598
|
-
function hexToLast4BytesInt(value) {
|
|
230599
|
-
assertEx$1(isHex(value), () => "value must be a hex string");
|
|
230600
|
-
const last4Bytes = value.slice(-8);
|
|
230601
|
-
return Number.parseInt(last4Bytes, 16);
|
|
230602
|
-
}
|
|
230603
|
-
function seededRandom(seed) {
|
|
230604
|
-
return function() {
|
|
230605
|
-
const x = Math.sin(seed++) * 1e4;
|
|
230606
|
-
return x - Math.floor(x);
|
|
230607
|
-
};
|
|
230608
|
-
}
|
|
230609
|
-
function shuffleWithSeed(set, seed) {
|
|
230610
|
-
const array = [...set].toSorted((a, b) => String(a).localeCompare(String(b)));
|
|
230611
|
-
const random = seededRandom(seed);
|
|
230612
|
-
for (let i = array.length - 1; i > 0; i--) {
|
|
230613
|
-
const j = Math.floor(random() * (i + 1));
|
|
230614
|
-
const swap = array[i];
|
|
230615
|
-
array[i] = array[j];
|
|
230616
|
-
array[j] = swap;
|
|
230617
|
-
}
|
|
230618
|
-
return array;
|
|
230619
|
-
}
|
|
230620
|
-
function spanDurationInMillis(span) {
|
|
230621
|
-
return span.duration[0] * 1e3 + span.duration[1] / 1e6;
|
|
230622
|
-
}
|
|
230623
|
-
(class _XyoConsoleSpanExporter extends ConsoleSpanExporter {
|
|
230624
|
-
static durationToLogLevel = [
|
|
230625
|
-
0,
|
|
230626
|
-
1,
|
|
230627
|
-
10,
|
|
230628
|
-
100,
|
|
230629
|
-
1e3
|
|
230630
|
-
];
|
|
230631
|
-
static logLevelToChalkColor = [
|
|
230632
|
-
chalk.grey,
|
|
230633
|
-
chalk.white,
|
|
230634
|
-
chalk.green,
|
|
230635
|
-
chalk.yellow,
|
|
230636
|
-
chalk.red
|
|
230637
|
-
];
|
|
230638
|
-
_logLevel;
|
|
230639
|
-
constructor(logLevel = 0) {
|
|
230640
|
-
super();
|
|
230641
|
-
this._logLevel = logLevel;
|
|
230642
|
-
}
|
|
230643
|
-
get logLevel() {
|
|
230644
|
-
return this._logLevel;
|
|
230645
|
-
}
|
|
230646
|
-
export(spans) {
|
|
230647
|
-
for (const span of spans) {
|
|
230648
|
-
const spanLevel = this.spanLevel(span);
|
|
230649
|
-
if (spanLevel < this.logLevel) continue;
|
|
230650
|
-
const duration = spanDurationInMillis(span);
|
|
230651
|
-
console.log(chalk.grey([
|
|
230652
|
-
`Span [${span.name}]`,
|
|
230653
|
-
this.logColor(spanLevel)(`${duration}ms`),
|
|
230654
|
-
`TraceId: ${span.spanContext().traceId}`
|
|
230655
|
-
].join(", ")));
|
|
230656
|
-
}
|
|
230657
|
-
}
|
|
230658
|
-
logColor(level) {
|
|
230659
|
-
return _XyoConsoleSpanExporter.logLevelToChalkColor[level] ?? chalk.magenta;
|
|
230660
|
-
}
|
|
230661
|
-
spanLevel(span) {
|
|
230662
|
-
let logLevel = 0;
|
|
230663
|
-
const duration = spanDurationInMillis(span);
|
|
230664
|
-
for (let x = _XyoConsoleSpanExporter.durationToLogLevel.length - 1; x >= 0; x--) if (duration > _XyoConsoleSpanExporter.durationToLogLevel[x]) {
|
|
230665
|
-
logLevel = x;
|
|
230666
|
-
break;
|
|
230667
|
-
}
|
|
230668
|
-
return logLevel;
|
|
230669
|
-
}
|
|
230670
|
-
});
|
|
230671
230548
|
//#endregion
|
|
230672
230549
|
//#region ../chain-sdk/dist/neutral/services.mjs
|
|
230673
|
-
var __defProp$
|
|
230674
|
-
var __getOwnPropDesc$
|
|
230675
|
-
var __defNormalProp$
|
|
230550
|
+
var __defProp$12 = Object.defineProperty;
|
|
230551
|
+
var __getOwnPropDesc$12 = Object.getOwnPropertyDescriptor;
|
|
230552
|
+
var __defNormalProp$12 = (obj, key, value) => key in obj ? __defProp$12(obj, key, {
|
|
230676
230553
|
enumerable: true,
|
|
230677
230554
|
configurable: true,
|
|
230678
230555
|
writable: true,
|
|
230679
230556
|
value
|
|
230680
230557
|
}) : obj[key] = value;
|
|
230681
|
-
var __decorateClass$
|
|
230682
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
230558
|
+
var __decorateClass$12 = (decorators, target, key, kind) => {
|
|
230559
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$12(target, key) : target;
|
|
230683
230560
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
230684
|
-
if (kind && result) __defProp$
|
|
230561
|
+
if (kind && result) __defProp$12(target, key, result);
|
|
230685
230562
|
return result;
|
|
230686
230563
|
};
|
|
230687
|
-
var __publicField$
|
|
230564
|
+
var __publicField$12 = (obj, key, value) => __defNormalProp$12(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
230688
230565
|
var ValidatorMoniker = "Validator";
|
|
230689
230566
|
var XyoValidator = class extends AbstractCreatableProvider$1 {
|
|
230690
230567
|
moniker = XyoValidator.defaultMoniker;
|
|
@@ -230705,12 +230582,12 @@ var XyoValidator = class extends AbstractCreatableProvider$1 {
|
|
|
230705
230582
|
return true;
|
|
230706
230583
|
}
|
|
230707
230584
|
};
|
|
230708
|
-
__publicField$
|
|
230709
|
-
__publicField$
|
|
230710
|
-
__publicField$
|
|
230711
|
-
__publicField$
|
|
230712
|
-
__publicField$
|
|
230713
|
-
XyoValidator = __decorateClass$
|
|
230585
|
+
__publicField$12(XyoValidator, "connectionTypes", []);
|
|
230586
|
+
__publicField$12(XyoValidator, "defaultMoniker", ValidatorMoniker);
|
|
230587
|
+
__publicField$12(XyoValidator, "dependencies", [BlockViewerMoniker$1]);
|
|
230588
|
+
__publicField$12(XyoValidator, "monikers", [ValidatorMoniker]);
|
|
230589
|
+
__publicField$12(XyoValidator, "surface", "node");
|
|
230590
|
+
XyoValidator = __decorateClass$12([creatableProvider$1()], XyoValidator);
|
|
230714
230591
|
var BaseElectionService = class extends AbstractCreatableProvider$1 {
|
|
230715
230592
|
moniker = BaseElectionService.defaultMoniker;
|
|
230716
230593
|
get blockViewer() {
|
|
@@ -230734,11 +230611,11 @@ var BaseElectionService = class extends AbstractCreatableProvider$1 {
|
|
|
230734
230611
|
return shuffleWithSeed(new Set(candidates), hexToLast4BytesInt(previousBlockHash)).slice(0, maxSize);
|
|
230735
230612
|
}
|
|
230736
230613
|
};
|
|
230737
|
-
__publicField$
|
|
230738
|
-
__publicField$
|
|
230739
|
-
__publicField$
|
|
230740
|
-
__publicField$
|
|
230741
|
-
BaseElectionService = __decorateClass$
|
|
230614
|
+
__publicField$12(BaseElectionService, "connectionTypes", []);
|
|
230615
|
+
__publicField$12(BaseElectionService, "defaultMoniker", "Election");
|
|
230616
|
+
__publicField$12(BaseElectionService, "dependencies", []);
|
|
230617
|
+
__publicField$12(BaseElectionService, "monikers", ["Election"]);
|
|
230618
|
+
BaseElectionService = __decorateClass$12([creatableProvider$1()], BaseElectionService);
|
|
230742
230619
|
var createBootstrapHead = async (account, chainId, genesisBlockRewardAmount, genesisBlockRewardAddress) => {
|
|
230743
230620
|
const chain = [];
|
|
230744
230621
|
const genesisBlock = await createGenesisBlock(account, chainId, genesisBlockRewardAmount, genesisBlockRewardAddress);
|
|
@@ -230768,7 +230645,7 @@ async function reportRejectedBlock(deadLetterQueueRunner, block, result, observe
|
|
|
230768
230645
|
const signed = observer === void 0 ? void 0 : await buildSignedBlockRejection(rejection, observer);
|
|
230769
230646
|
await deadLetterQueueRunner.rejectBlock(rejection, signed);
|
|
230770
230647
|
}
|
|
230771
|
-
async function processPendingBlocks({ blockValidationViewer, blockViewer, context, logger, mempoolViewer, finalizationRunner, allowedProducers, backoffMs, minCandidates, deadLetterQueueRunner, observer, admission, eligibility, publishAdmissionShadow }) {
|
|
230648
|
+
async function processPendingBlocks({ blockValidationViewer, blockViewer, context, logger, mempoolViewer, finalizationRunner, allowedProducers, backoffMs, heartbeatInterval, minCandidates, deadLetterQueueRunner, observer, admission, eligibility, publishAdmissionShadow }) {
|
|
230772
230649
|
const start = Date.now();
|
|
230773
230650
|
const currentBlock = await blockViewer.currentBlock();
|
|
230774
230651
|
const headSelector = new ChainHeadSelector({
|
|
@@ -230779,6 +230656,7 @@ async function processPendingBlocks({ blockValidationViewer, blockViewer, contex
|
|
|
230779
230656
|
windowedFinalizedChain: [currentBlock],
|
|
230780
230657
|
allowedProducers,
|
|
230781
230658
|
backoffMs,
|
|
230659
|
+
heartbeatInterval,
|
|
230782
230660
|
minCandidates,
|
|
230783
230661
|
admission,
|
|
230784
230662
|
eligibility,
|
|
@@ -230829,6 +230707,9 @@ var BaseNetworkStakeStepRewardService = class extends AbstractCreatableProvider$
|
|
|
230829
230707
|
networkStakeStepRewardAddressShare(_context, _address) {
|
|
230830
230708
|
throw new Error("Method [networkStakeStepRewardAddressShare] not implemented.");
|
|
230831
230709
|
}
|
|
230710
|
+
networkStakeStepRewardAllocationsForStep(_context) {
|
|
230711
|
+
throw new Error("Method [networkStakeStepRewardAllocationsForStep] not implemented.");
|
|
230712
|
+
}
|
|
230832
230713
|
networkStakeStepRewardClaimedByAddress(_address) {
|
|
230833
230714
|
throw new Error("Method [networkStakeStepRewardClaimedByAddress] not implemented.");
|
|
230834
230715
|
}
|
|
@@ -230875,11 +230756,11 @@ var BaseNetworkStakeStepRewardService = class extends AbstractCreatableProvider$
|
|
|
230875
230756
|
throw new Error("Method [networkStakeStepRewardsForStepLevel] not implemented.");
|
|
230876
230757
|
}
|
|
230877
230758
|
};
|
|
230878
|
-
__publicField$
|
|
230879
|
-
__publicField$
|
|
230880
|
-
__publicField$
|
|
230881
|
-
__publicField$
|
|
230882
|
-
BaseNetworkStakeStepRewardService = __decorateClass$
|
|
230759
|
+
__publicField$12(BaseNetworkStakeStepRewardService, "connectionTypes", []);
|
|
230760
|
+
__publicField$12(BaseNetworkStakeStepRewardService, "defaultMoniker", NetworkStakeStepRewardViewerMoniker);
|
|
230761
|
+
__publicField$12(BaseNetworkStakeStepRewardService, "dependencies", []);
|
|
230762
|
+
__publicField$12(BaseNetworkStakeStepRewardService, "monikers", [NetworkStakeStepRewardViewerMoniker]);
|
|
230763
|
+
BaseNetworkStakeStepRewardService = __decorateClass$12([creatableProvider$1()], BaseNetworkStakeStepRewardService);
|
|
230883
230764
|
function selectSupersededCandidate(candidates, address, block, previous) {
|
|
230884
230765
|
const own = candidates.filter((candidate) => candidate.block === block && candidate.previous === previous && candidate.addresses.includes(address));
|
|
230885
230766
|
if (own.length === 0) return void 0;
|
|
@@ -230971,6 +230852,7 @@ function producerTuningFromConfig(config) {
|
|
|
230971
230852
|
const parsed = ProducerTuningOptionsZod.safeParse(options);
|
|
230972
230853
|
return parsed.success ? parsed.data : {};
|
|
230973
230854
|
}
|
|
230855
|
+
var DEFAULT_HEARTBEAT_INTERVAL = 3e5;
|
|
230974
230856
|
var SimpleBlockRunner = class extends AbstractCreatableProvider$1 {
|
|
230975
230857
|
moniker = SimpleBlockRunner.defaultMoniker;
|
|
230976
230858
|
_blockRewardDiviner;
|
|
@@ -231030,7 +230912,7 @@ var SimpleBlockRunner = class extends AbstractCreatableProvider$1 {
|
|
|
231030
230912
|
return this._finalizationViewer;
|
|
231031
230913
|
}
|
|
231032
230914
|
get heartbeatInterval() {
|
|
231033
|
-
return this.params.heartbeatInterval ?? this.producerTuning.heartbeatInterval ??
|
|
230915
|
+
return this.params.heartbeatInterval ?? this.producerTuning.heartbeatInterval ?? 3e5;
|
|
231034
230916
|
}
|
|
231035
230917
|
get mempoolViewer() {
|
|
231036
230918
|
return this._mempoolViewer;
|
|
@@ -231371,14 +231253,14 @@ var SimpleBlockRunner = class extends AbstractCreatableProvider$1 {
|
|
|
231371
231253
|
* no attributable transaction to exclude). Such a build fails identically until external state
|
|
231372
231254
|
* changes, so retrying at the production tick rate only churns build → validate → DLQ.
|
|
231373
231255
|
*/
|
|
231374
|
-
__publicField$
|
|
231375
|
-
__publicField$
|
|
231256
|
+
__publicField$12(SimpleBlockRunner, "RejectedBuildBackoffMs", 1e3);
|
|
231257
|
+
__publicField$12(SimpleBlockRunner, "connectionTypes", [
|
|
231376
231258
|
"lmdb",
|
|
231377
231259
|
"mongo",
|
|
231378
231260
|
"memory"
|
|
231379
231261
|
]);
|
|
231380
|
-
__publicField$
|
|
231381
|
-
__publicField$
|
|
231262
|
+
__publicField$12(SimpleBlockRunner, "defaultMoniker", BlockRunnerMoniker);
|
|
231263
|
+
__publicField$12(SimpleBlockRunner, "dependencies", [
|
|
231382
231264
|
AccountBalanceViewerMoniker$1,
|
|
231383
231265
|
BlockRewardViewerMoniker$1,
|
|
231384
231266
|
BlockValidationViewerMoniker$1,
|
|
@@ -231386,9 +231268,379 @@ __publicField$11(SimpleBlockRunner, "dependencies", [
|
|
|
231386
231268
|
MempoolViewerMoniker$1,
|
|
231387
231269
|
TimeSyncViewerMoniker$1
|
|
231388
231270
|
]);
|
|
231389
|
-
__publicField$
|
|
231390
|
-
__publicField$
|
|
231391
|
-
SimpleBlockRunner = __decorateClass$
|
|
231271
|
+
__publicField$12(SimpleBlockRunner, "monikers", [BlockRunnerMoniker]);
|
|
231272
|
+
__publicField$12(SimpleBlockRunner, "surface", "node");
|
|
231273
|
+
SimpleBlockRunner = __decorateClass$12([creatableProvider$1()], SimpleBlockRunner);
|
|
231274
|
+
//#endregion
|
|
231275
|
+
//#region ../chain-sdk/dist/neutral/ethereum.mjs
|
|
231276
|
+
var __defProp$11 = Object.defineProperty;
|
|
231277
|
+
var __getOwnPropDesc$11 = Object.getOwnPropertyDescriptor;
|
|
231278
|
+
var __defNormalProp$11 = (obj, key, value) => key in obj ? __defProp$11(obj, key, {
|
|
231279
|
+
enumerable: true,
|
|
231280
|
+
configurable: true,
|
|
231281
|
+
writable: true,
|
|
231282
|
+
value
|
|
231283
|
+
}) : obj[key] = value;
|
|
231284
|
+
var __decorateClass$11 = (decorators, target, key, kind) => {
|
|
231285
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$11(target, key) : target;
|
|
231286
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
231287
|
+
if (kind && result) __defProp$11(target, key, result);
|
|
231288
|
+
return result;
|
|
231289
|
+
};
|
|
231290
|
+
var __publicField$11 = (obj, key, value) => __defNormalProp$11(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
231291
|
+
var STAKE_EVENT_NAMES$1 = /* @__PURE__ */ new Set([
|
|
231292
|
+
"StakeAdded",
|
|
231293
|
+
"StakeRemoved",
|
|
231294
|
+
"StakeWithdrawn"
|
|
231295
|
+
]);
|
|
231296
|
+
var DEFAULT_HEAD_POLL_INTERVAL_MS$1 = 5e3;
|
|
231297
|
+
var MIN_HEAD_POLL_INTERVAL_MS = 5e3;
|
|
231298
|
+
var RestStakeEventsViewerOptionsZod = object$3({ headPollIntervalMs: number$1().optional() });
|
|
231299
|
+
var RestStakeEventsViewer = class extends AbstractCreatableProvider$1 {
|
|
231300
|
+
moniker = RestStakeEventsViewer.defaultMoniker;
|
|
231301
|
+
completeFrames = /* @__PURE__ */ new Map();
|
|
231302
|
+
contractInterface = new Interface(IAddressStakingEvents__factory2.abi);
|
|
231303
|
+
currentHead;
|
|
231304
|
+
headPollIntervalMs = DEFAULT_HEAD_POLL_INTERVAL_MS$1;
|
|
231305
|
+
lastSuccessfulSyncAt;
|
|
231306
|
+
manifestPromise;
|
|
231307
|
+
positionCountCheckpoints = [];
|
|
231308
|
+
stakeEventCache = [];
|
|
231309
|
+
stakeEventsByPosition = /* @__PURE__ */ new Map();
|
|
231310
|
+
syncPromise;
|
|
231311
|
+
tailFrame;
|
|
231312
|
+
get address() {
|
|
231313
|
+
return toEthAddress(assertEx$1(this.config.chain.id, () => "RestStakeEventsViewer requires config.chain.id (the staking contract address)"));
|
|
231314
|
+
}
|
|
231315
|
+
get eventIndexBaseUrl() {
|
|
231316
|
+
const connection = RestStakeEventsViewer.requireBoundConnection(this.config);
|
|
231317
|
+
return assertEx$1(connection.config.type === "rest" ? connection.config.baseUrl : void 0, () => `Connection "${connection.name}" bound to RestStakeEventsViewer requires a rest baseUrl`).replace(/\/+$/, "");
|
|
231318
|
+
}
|
|
231319
|
+
get fetchFn() {
|
|
231320
|
+
return this.context.fetchFn ?? fetch.bind(globalThis);
|
|
231321
|
+
}
|
|
231322
|
+
/** Creates the provider instance after its configuration has resolved. */
|
|
231323
|
+
async createHandler() {
|
|
231324
|
+
await super.createHandler();
|
|
231325
|
+
RestStakeEventsViewer.requireBoundConnection(this.config);
|
|
231326
|
+
const { headPollIntervalMs } = RestStakeEventsViewerOptionsZod.parse(this.config.options);
|
|
231327
|
+
if (headPollIntervalMs !== void 0) assertEx$1(headPollIntervalMs >= MIN_HEAD_POLL_INTERVAL_MS, () => `headPollIntervalMs must be at least ${MIN_HEAD_POLL_INTERVAL_MS}ms`);
|
|
231328
|
+
this.headPollIntervalMs = headPollIntervalMs ?? DEFAULT_HEAD_POLL_INTERVAL_MS$1;
|
|
231329
|
+
}
|
|
231330
|
+
async positionCount(range) {
|
|
231331
|
+
await this.sync();
|
|
231332
|
+
this.assertRangeAvailable(range);
|
|
231333
|
+
if (range[0] === 0) return this.positionCountThrough(range[1]);
|
|
231334
|
+
return this.matchingStakeEvents(range).reduce((max, event) => Math.max(max, event.args.id), -1) + 1;
|
|
231335
|
+
}
|
|
231336
|
+
async stakeEvents(range = [0, "latest"], filter) {
|
|
231337
|
+
await this.sync();
|
|
231338
|
+
this.assertRangeAvailable(range);
|
|
231339
|
+
return this.matchingStakeEvents(range, filter);
|
|
231340
|
+
}
|
|
231341
|
+
assertRangeAvailable(range) {
|
|
231342
|
+
const head = assertEx$1(this.currentHead, () => "EVM event index head is unavailable");
|
|
231343
|
+
assertEx$1(range[1] === "latest" || range[1] <= head.block, () => `Stake-event range ends at ${range[1]}, beyond EVM event index head ${head.block}`);
|
|
231344
|
+
}
|
|
231345
|
+
decodeIndexedStakeEvents() {
|
|
231346
|
+
return [...[...this.completeFrames.entries()].sort(([a], [b]) => a - b).map(([, frame]) => frame), ...this.tailFrame === void 0 ? [] : [this.tailFrame]].flatMap((frame) => frame.logs).sort((a, b) => a.blockNumber - b.blockNumber || a.transactionIndex - b.transactionIndex || a.index - b.index).flatMap((log) => {
|
|
231347
|
+
const event = this.stakeEventFromLog(log);
|
|
231348
|
+
return event === void 0 ? [] : [event];
|
|
231349
|
+
});
|
|
231350
|
+
}
|
|
231351
|
+
async fetchJson(path) {
|
|
231352
|
+
const response = await this.fetchFn(`${this.eventIndexBaseUrl}/${path}`);
|
|
231353
|
+
assertEx$1(response.ok, () => `EVM event index request failed [${response.status}] for ${path}`);
|
|
231354
|
+
return await response.json();
|
|
231355
|
+
}
|
|
231356
|
+
async getManifest() {
|
|
231357
|
+
this.manifestPromise ??= (async () => {
|
|
231358
|
+
const manifest = asEvmEventIndexManifest(await this.fetchJson(evmEventIndexManifestPath(this.address)), true);
|
|
231359
|
+
assertEx$1(manifest.address.toLowerCase() === this.address.toLowerCase(), () => "EVM event index manifest address mismatch");
|
|
231360
|
+
return manifest;
|
|
231361
|
+
})();
|
|
231362
|
+
return await this.manifestPromise;
|
|
231363
|
+
}
|
|
231364
|
+
indexStakeEvents(events) {
|
|
231365
|
+
this.stakeEventCache = events;
|
|
231366
|
+
this.positionCountCheckpoints = [];
|
|
231367
|
+
this.stakeEventsByPosition.clear();
|
|
231368
|
+
let maxPositionId = -1;
|
|
231369
|
+
for (const event of events) {
|
|
231370
|
+
const positionEvents = this.stakeEventsByPosition.get(event.args.id) ?? [];
|
|
231371
|
+
positionEvents.push(event);
|
|
231372
|
+
this.stakeEventsByPosition.set(event.args.id, positionEvents);
|
|
231373
|
+
if (event.args.id > maxPositionId) {
|
|
231374
|
+
maxPositionId = event.args.id;
|
|
231375
|
+
this.positionCountCheckpoints.push({
|
|
231376
|
+
count: maxPositionId + 1,
|
|
231377
|
+
time: event.time
|
|
231378
|
+
});
|
|
231379
|
+
}
|
|
231380
|
+
}
|
|
231381
|
+
}
|
|
231382
|
+
matchesFilter(event, range, filter) {
|
|
231383
|
+
if (range[1] !== "latest" && event.time > range[1]) return false;
|
|
231384
|
+
if (event.time < range[0]) return false;
|
|
231385
|
+
if (isDefined$1(filter?.name) && event.name !== filter.name) return false;
|
|
231386
|
+
if (isDefined$1(filter?.args?.id) && event.args.id !== filter.args.id) return false;
|
|
231387
|
+
if (isDefined$1(filter?.args?.staked) && event.args.staked !== filter.args.staked) return false;
|
|
231388
|
+
if (isDefined$1(filter?.args?.staker) && event.args.staker !== filter.args.staker) return false;
|
|
231389
|
+
return true;
|
|
231390
|
+
}
|
|
231391
|
+
matchingStakeEvents(range, filter) {
|
|
231392
|
+
const positionId = filter?.args?.id;
|
|
231393
|
+
return (isDefined$1(positionId) ? this.stakeEventsByPosition.get(positionId) ?? [] : this.stakeEventCache).filter((event) => this.matchesFilter(event, range, filter));
|
|
231394
|
+
}
|
|
231395
|
+
positionCountThrough(end) {
|
|
231396
|
+
if (end === "latest") return this.positionCountCheckpoints.at(-1)?.count ?? 0;
|
|
231397
|
+
let low = 0;
|
|
231398
|
+
let high = this.positionCountCheckpoints.length;
|
|
231399
|
+
while (low < high) {
|
|
231400
|
+
const middle = Math.floor((low + high) / 2);
|
|
231401
|
+
if (this.positionCountCheckpoints[middle].time <= end) low = middle + 1;
|
|
231402
|
+
else high = middle;
|
|
231403
|
+
}
|
|
231404
|
+
return this.positionCountCheckpoints[low - 1]?.count ?? 0;
|
|
231405
|
+
}
|
|
231406
|
+
stakeEventFromLog(log) {
|
|
231407
|
+
const parsed = this.contractInterface.parseLog({
|
|
231408
|
+
data: log.data,
|
|
231409
|
+
topics: log.topics
|
|
231410
|
+
});
|
|
231411
|
+
if (parsed === null || !STAKE_EVENT_NAMES$1.has(parsed.name)) return;
|
|
231412
|
+
const [staked, staker, id, amount] = parsed.args;
|
|
231413
|
+
return {
|
|
231414
|
+
name: parsed.name,
|
|
231415
|
+
args: {
|
|
231416
|
+
amount: asAttoXL1$1(amount),
|
|
231417
|
+
id: Number(id),
|
|
231418
|
+
staked: toAddress(staked),
|
|
231419
|
+
staker: toAddress(staker)
|
|
231420
|
+
},
|
|
231421
|
+
time: log.blockNumber
|
|
231422
|
+
};
|
|
231423
|
+
}
|
|
231424
|
+
async sync() {
|
|
231425
|
+
const now = Date.now();
|
|
231426
|
+
const elapsed = this.lastSuccessfulSyncAt === void 0 ? void 0 : now - this.lastSuccessfulSyncAt;
|
|
231427
|
+
if (this.currentHead !== void 0 && elapsed !== void 0 && elapsed >= 0 && elapsed < this.headPollIntervalMs) return;
|
|
231428
|
+
this.syncPromise ??= this.syncFromHead().then(() => {
|
|
231429
|
+
this.lastSuccessfulSyncAt = Date.now();
|
|
231430
|
+
}).finally(() => {
|
|
231431
|
+
this.syncPromise = void 0;
|
|
231432
|
+
});
|
|
231433
|
+
await this.syncPromise;
|
|
231434
|
+
}
|
|
231435
|
+
async syncFromHead() {
|
|
231436
|
+
const manifest = await this.getManifest();
|
|
231437
|
+
const head = asEvmEventIndexHead(await this.fetchJson(evmEventIndexHeadPath(this.address)), true);
|
|
231438
|
+
assertEx$1(head.address.toLowerCase() === this.address.toLowerCase(), () => "EVM event index head address mismatch");
|
|
231439
|
+
assertEx$1(head.chainId === manifest.chainId, () => "EVM event index chain mismatch");
|
|
231440
|
+
if (this.currentHead?.block === head.block && this.currentHead.hash === head.hash) return;
|
|
231441
|
+
if (this.currentHead !== void 0 && (head.block < this.currentHead.block || head.block === this.currentHead.block && head.hash !== this.currentHead.hash)) {
|
|
231442
|
+
this.completeFrames.clear();
|
|
231443
|
+
this.tailFrame = void 0;
|
|
231444
|
+
}
|
|
231445
|
+
const indexedBlockCount = Math.max(0, head.block - manifest.deploymentBlock + 1);
|
|
231446
|
+
const completeFrameCount = Math.floor(indexedBlockCount / manifest.frameSize);
|
|
231447
|
+
const missingFrameIndexes = Array.from({ length: completeFrameCount }, (_, index) => index).filter((index) => !this.completeFrames.has(index));
|
|
231448
|
+
await Promise.all(missingFrameIndexes.map(async (index) => {
|
|
231449
|
+
const frame = asEvmEventIndexFrame(await this.fetchJson(evmEventIndexFramePath(this.address, index)), true);
|
|
231450
|
+
const expectedFrom = manifest.deploymentBlock + index * manifest.frameSize;
|
|
231451
|
+
assertEx$1(frame.fromBlock === expectedFrom, () => `EVM event index frame ${index} starts at the wrong block`);
|
|
231452
|
+
assertEx$1(frame.toBlock === expectedFrom + manifest.frameSize - 1, () => `EVM event index frame ${index} is incomplete`);
|
|
231453
|
+
this.completeFrames.set(index, frame);
|
|
231454
|
+
}));
|
|
231455
|
+
const tailStart = manifest.deploymentBlock + completeFrameCount * manifest.frameSize;
|
|
231456
|
+
this.tailFrame = tailStart <= head.block ? asEvmEventIndexFrame(await this.fetchJson(`${evmEventIndexTailPath(this.address)}?head=${head.hash}`), true) : void 0;
|
|
231457
|
+
if (this.tailFrame !== void 0) {
|
|
231458
|
+
assertEx$1(this.tailFrame.fromBlock === tailStart, () => "EVM event index tail starts at the wrong block");
|
|
231459
|
+
assertEx$1(this.tailFrame.toBlock === head.block, () => "EVM event index tail is stale relative to its head");
|
|
231460
|
+
}
|
|
231461
|
+
this.indexStakeEvents(this.decodeIndexedStakeEvents());
|
|
231462
|
+
this.currentHead = head;
|
|
231463
|
+
}
|
|
231464
|
+
};
|
|
231465
|
+
__publicField$11(RestStakeEventsViewer, "connectionTypes", ["rest"]);
|
|
231466
|
+
__publicField$11(RestStakeEventsViewer, "defaultMoniker", StakeEventsViewerMoniker$1);
|
|
231467
|
+
__publicField$11(RestStakeEventsViewer, "dependencies", []);
|
|
231468
|
+
__publicField$11(RestStakeEventsViewer, "monikers", [StakeEventsViewerMoniker$1]);
|
|
231469
|
+
__publicField$11(RestStakeEventsViewer, "surface", "node");
|
|
231470
|
+
RestStakeEventsViewer = __decorateClass$11([creatableProvider$1()], RestStakeEventsViewer);
|
|
231471
|
+
var DEFAULT_REFRESH_INTERVAL_MS = 5e3;
|
|
231472
|
+
var MIN_REFRESH_INTERVAL_MS = 5e3;
|
|
231473
|
+
var RestStakeViewerOptionsZod = object$3({ refreshIntervalMs: number$1().optional() });
|
|
231474
|
+
var RestStakeViewer = class extends AbstractCreatableProvider$1 {
|
|
231475
|
+
moniker = RestStakeViewer.defaultMoniker;
|
|
231476
|
+
_chainContractViewer;
|
|
231477
|
+
_stakeEventsViewer;
|
|
231478
|
+
lastSuccessfulSyncAt;
|
|
231479
|
+
positionIndex = /* @__PURE__ */ new Map();
|
|
231480
|
+
positionsByStaked = /* @__PURE__ */ new Map();
|
|
231481
|
+
positionsByStaker = /* @__PURE__ */ new Map();
|
|
231482
|
+
refreshIntervalMs = DEFAULT_REFRESH_INTERVAL_MS;
|
|
231483
|
+
syncPromise;
|
|
231484
|
+
/** Returns the finalized stake-event source used to materialize positions. */
|
|
231485
|
+
get stakeEvents() {
|
|
231486
|
+
return this._stakeEventsViewer;
|
|
231487
|
+
}
|
|
231488
|
+
/** Returns active finalized stake positions. */
|
|
231489
|
+
async activeStakes() {
|
|
231490
|
+
await this.sync();
|
|
231491
|
+
return this.positionIndex.values().filter((position) => position.removeBlock === 0 && position.withdrawBlock === 0).toArray();
|
|
231492
|
+
}
|
|
231493
|
+
/** Creates the provider after its REST binding and dependencies resolve. */
|
|
231494
|
+
async createHandler() {
|
|
231495
|
+
await super.createHandler();
|
|
231496
|
+
RestStakeViewer.requireBoundConnection(this.config);
|
|
231497
|
+
const { refreshIntervalMs } = RestStakeViewerOptionsZod.parse(this.config.options);
|
|
231498
|
+
if (refreshIntervalMs !== void 0) assertEx$1(refreshIntervalMs >= MIN_REFRESH_INTERVAL_MS, () => `refreshIntervalMs must be at least ${MIN_REFRESH_INTERVAL_MS}ms`);
|
|
231499
|
+
this.refreshIntervalMs = refreshIntervalMs ?? DEFAULT_REFRESH_INTERVAL_MS;
|
|
231500
|
+
this._chainContractViewer = await this.locator.getInstance(ChainContractViewerMoniker$1);
|
|
231501
|
+
this._stakeEventsViewer = await this.locator.getInstance(StakeEventsViewerMoniker$1);
|
|
231502
|
+
}
|
|
231503
|
+
/** Returns the configured chain's withdrawal delay. */
|
|
231504
|
+
async minWithdrawalBlocks() {
|
|
231505
|
+
return await this._chainContractViewer.minWithdrawalBlocks();
|
|
231506
|
+
}
|
|
231507
|
+
/** Returns finalized positions that have been removed but not withdrawn. */
|
|
231508
|
+
async removedStakes() {
|
|
231509
|
+
await this.sync();
|
|
231510
|
+
return this.positionIndex.values().filter((position) => position.removeBlock !== 0 && position.withdrawBlock === 0).toArray();
|
|
231511
|
+
}
|
|
231512
|
+
/** Returns the configured rewards contract address. */
|
|
231513
|
+
async rewardsContract() {
|
|
231514
|
+
return toAddress(await this._chainContractViewer.rewardsContract());
|
|
231515
|
+
}
|
|
231516
|
+
/** Returns a finalized position by its contract id. */
|
|
231517
|
+
async stakeById(id) {
|
|
231518
|
+
await this.sync();
|
|
231519
|
+
return assertEx$1(this.positionIndex.get(id), () => `RestStakeViewer: position ${id} not found in finalized event index`);
|
|
231520
|
+
}
|
|
231521
|
+
/** Returns a staker's finalized position by its contract slot. */
|
|
231522
|
+
async stakeByStaker(staker, slot) {
|
|
231523
|
+
await this.sync();
|
|
231524
|
+
const position = this.positionsByStaker.get(toAddress(staker))?.at(slot);
|
|
231525
|
+
return assertEx$1(position, () => `RestStakeViewer: staker ${staker} has no finalized position at slot ${slot}`);
|
|
231526
|
+
}
|
|
231527
|
+
/** Returns finalized positions added for an address in the supplied EVM block range. */
|
|
231528
|
+
async stakesByStaked(staked, range = [0, void 0]) {
|
|
231529
|
+
await this.sync();
|
|
231530
|
+
return this.positionsInRange(this.positionsByStaked.get(toAddress(staked)) ?? [], range);
|
|
231531
|
+
}
|
|
231532
|
+
/** Returns finalized positions added by a staker in the supplied EVM block range. */
|
|
231533
|
+
async stakesByStaker(staker, range = [0, void 0]) {
|
|
231534
|
+
await this.sync();
|
|
231535
|
+
return this.positionsInRange(this.positionsByStaker.get(toAddress(staker)) ?? [], range);
|
|
231536
|
+
}
|
|
231537
|
+
/** Returns the configured staking-token address. */
|
|
231538
|
+
async stakingTokenAddress() {
|
|
231539
|
+
return toAddress(await this._chainContractViewer.stakingTokenAddress());
|
|
231540
|
+
}
|
|
231541
|
+
/** Returns finalized positions that have completed withdrawal. */
|
|
231542
|
+
async withdrawnStakes() {
|
|
231543
|
+
await this.sync();
|
|
231544
|
+
return this.positionIndex.values().filter((position) => position.removeBlock !== 0 && position.withdrawBlock !== 0).toArray();
|
|
231545
|
+
}
|
|
231546
|
+
applyEvent(index, event) {
|
|
231547
|
+
if (event.name === "StakeAdded") {
|
|
231548
|
+
index.set(event.args.id, {
|
|
231549
|
+
id: event.args.id,
|
|
231550
|
+
staked: toAddress(event.args.staked),
|
|
231551
|
+
staker: toAddress(event.args.staker),
|
|
231552
|
+
amount: event.args.amount,
|
|
231553
|
+
addBlock: event.time,
|
|
231554
|
+
removeBlock: 0,
|
|
231555
|
+
withdrawBlock: 0
|
|
231556
|
+
});
|
|
231557
|
+
return;
|
|
231558
|
+
}
|
|
231559
|
+
const position = assertEx$1(index.get(event.args.id), () => `RestStakeViewer: ${event.name} precedes StakeAdded for position ${event.args.id}`);
|
|
231560
|
+
index.set(event.args.id, {
|
|
231561
|
+
...position,
|
|
231562
|
+
...event.name === "StakeRemoved" ? { removeBlock: event.time } : { withdrawBlock: event.time }
|
|
231563
|
+
});
|
|
231564
|
+
}
|
|
231565
|
+
positionsInRange(positions, range) {
|
|
231566
|
+
const [fromBlock, configuredToBlock] = range;
|
|
231567
|
+
const toBlock = configuredToBlock ?? Number.MAX_SAFE_INTEGER;
|
|
231568
|
+
return positions.filter((position) => position.addBlock >= fromBlock && position.addBlock <= toBlock);
|
|
231569
|
+
}
|
|
231570
|
+
rebuildPositionIndex(events) {
|
|
231571
|
+
const positionIndex = /* @__PURE__ */ new Map();
|
|
231572
|
+
for (const event of events.toSorted((left, right) => left.time - right.time)) this.applyEvent(positionIndex, event);
|
|
231573
|
+
const positionsByStaked = /* @__PURE__ */ new Map();
|
|
231574
|
+
const positionsByStaker = /* @__PURE__ */ new Map();
|
|
231575
|
+
for (const position of positionIndex.values().toArray().toSorted((left, right) => left.id - right.id)) {
|
|
231576
|
+
const staked = toAddress(position.staked);
|
|
231577
|
+
const staker = toAddress(position.staker);
|
|
231578
|
+
positionsByStaked.set(staked, [...positionsByStaked.get(staked) ?? [], position]);
|
|
231579
|
+
positionsByStaker.set(staker, [...positionsByStaker.get(staker) ?? [], position]);
|
|
231580
|
+
}
|
|
231581
|
+
this.positionIndex = positionIndex;
|
|
231582
|
+
this.positionsByStaked = positionsByStaked;
|
|
231583
|
+
this.positionsByStaker = positionsByStaker;
|
|
231584
|
+
}
|
|
231585
|
+
async sync() {
|
|
231586
|
+
const now = Date.now();
|
|
231587
|
+
const elapsed = this.lastSuccessfulSyncAt === void 0 ? void 0 : now - this.lastSuccessfulSyncAt;
|
|
231588
|
+
if (elapsed !== void 0 && elapsed >= 0 && elapsed < this.refreshIntervalMs) return;
|
|
231589
|
+
this.syncPromise ??= Promise.resolve(this.stakeEvents.stakeEvents([0, "latest"])).then((events) => this.rebuildPositionIndex(events)).then(() => {
|
|
231590
|
+
this.lastSuccessfulSyncAt = Date.now();
|
|
231591
|
+
}).finally(() => {
|
|
231592
|
+
this.syncPromise = void 0;
|
|
231593
|
+
});
|
|
231594
|
+
await this.syncPromise;
|
|
231595
|
+
}
|
|
231596
|
+
};
|
|
231597
|
+
__publicField$11(RestStakeViewer, "connectionTypes", ["rest"]);
|
|
231598
|
+
__publicField$11(RestStakeViewer, "defaultMoniker", StakeViewerMoniker$1);
|
|
231599
|
+
__publicField$11(RestStakeViewer, "dependencies", [ChainContractViewerMoniker$1, StakeEventsViewerMoniker$1]);
|
|
231600
|
+
__publicField$11(RestStakeViewer, "monikers", [StakeViewerMoniker$1]);
|
|
231601
|
+
__publicField$11(RestStakeViewer, "surface", "node");
|
|
231602
|
+
RestStakeViewer = __decorateClass$11([creatableProvider$1()], RestStakeViewer);
|
|
231603
|
+
function evmContractRunnerHandleKey(moniker) {
|
|
231604
|
+
return `evm-contract-runner:${moniker}`;
|
|
231605
|
+
}
|
|
231606
|
+
var AbstractEvmRunner = class extends AbstractEvmProvider$1 {
|
|
231607
|
+
_runner;
|
|
231608
|
+
get runner() {
|
|
231609
|
+
return assertEx$1(this._runner, () => "EVM contract runner not initialized");
|
|
231610
|
+
}
|
|
231611
|
+
/** Creates the provider instance after its dependencies and configuration have resolved. */
|
|
231612
|
+
async createHandler() {
|
|
231613
|
+
const key = evmContractRunnerHandleKey(this.moniker);
|
|
231614
|
+
this._runner = await this.connectionHandles.getOrOpen(key, () => {
|
|
231615
|
+
throw new Error(`No EVM contract runner seeded for [${this.moniker}] \u2014 set context.connectionHandles["${key}"] before create`);
|
|
231616
|
+
});
|
|
231617
|
+
await super.createHandler();
|
|
231618
|
+
}
|
|
231619
|
+
};
|
|
231620
|
+
var EvmStakeRunner = class extends AbstractEvmRunner {
|
|
231621
|
+
moniker = EvmStakeRunner.defaultMoniker;
|
|
231622
|
+
async addStake(staked, amount) {
|
|
231623
|
+
await (await this.contract.addStake(getAddress(toEthAddress(staked)), amount)).wait();
|
|
231624
|
+
return true;
|
|
231625
|
+
}
|
|
231626
|
+
async removeStake(slot) {
|
|
231627
|
+
await (await this.contract.removeStake(slot)).wait();
|
|
231628
|
+
return true;
|
|
231629
|
+
}
|
|
231630
|
+
async withdrawStake(slot) {
|
|
231631
|
+
await (await this.contract.withdrawStake(slot)).wait();
|
|
231632
|
+
return true;
|
|
231633
|
+
}
|
|
231634
|
+
connectContract(address) {
|
|
231635
|
+
return IStakedXyoChain__factory.connect(address, this.runner);
|
|
231636
|
+
}
|
|
231637
|
+
};
|
|
231638
|
+
__publicField$11(EvmStakeRunner, "connectionTypes", ["evm-rpc"]);
|
|
231639
|
+
__publicField$11(EvmStakeRunner, "defaultMoniker", StakeRunnerMoniker);
|
|
231640
|
+
__publicField$11(EvmStakeRunner, "dependencies", []);
|
|
231641
|
+
__publicField$11(EvmStakeRunner, "monikers", [StakeRunnerMoniker]);
|
|
231642
|
+
__publicField$11(EvmStakeRunner, "surface", "node");
|
|
231643
|
+
EvmStakeRunner = __decorateClass$11([creatableProvider$1()], EvmStakeRunner);
|
|
231392
231644
|
//#endregion
|
|
231393
231645
|
//#region ../chain-sdk/dist/neutral/slashing.mjs
|
|
231394
231646
|
function competes(first, second) {
|
|
@@ -232198,6 +232450,7 @@ var FinalizerConfigZod = /* @__PURE__ */ extend(HostActorIdentityZod, {
|
|
|
232198
232450
|
paramsFile: /* @__PURE__ */ optional$2(/* @__PURE__ */ string$3()),
|
|
232199
232451
|
backoffMs: /* @__PURE__ */ _default$1(/* @__PURE__ */ number$4(), DEFAULT_BACKOFF_MS$1),
|
|
232200
232452
|
finalizationCheckInterval: /* @__PURE__ */ _default$1(/* @__PURE__ */ number$4(), 500),
|
|
232453
|
+
heartbeatInterval: /* @__PURE__ */ _default$1(/* @__PURE__ */ number$4(), DEFAULT_HEARTBEAT_INTERVAL),
|
|
232201
232454
|
minCandidates: /* @__PURE__ */ _default$1((/* @__PURE__ */ number$5()).check(/* @__PURE__ */ _multipleOf(1), /* @__PURE__ */ _nonnegative()), 1),
|
|
232202
232455
|
publishContentEncoding: /* @__PURE__ */ optional$2(/* @__PURE__ */ _enum$1([
|
|
232203
232456
|
"br",
|
|
@@ -232380,6 +232633,9 @@ var FinalizerActor = class extends ChainActor {
|
|
|
232380
232633
|
get finalizationRunner() {
|
|
232381
232634
|
return this._finalizationRunner;
|
|
232382
232635
|
}
|
|
232636
|
+
get heartbeatInterval() {
|
|
232637
|
+
return this.params.config.heartbeatInterval;
|
|
232638
|
+
}
|
|
232383
232639
|
get mempoolViewer() {
|
|
232384
232640
|
return this._mempoolViewer;
|
|
232385
232641
|
}
|
|
@@ -232534,6 +232790,7 @@ var FinalizerActor = class extends ChainActor {
|
|
|
232534
232790
|
finalizationRunner: this.finalizationRunner,
|
|
232535
232791
|
allowedProducers: this.allowedProducers,
|
|
232536
232792
|
backoffMs: this.backoffMs,
|
|
232793
|
+
heartbeatInterval: this.heartbeatInterval,
|
|
232537
232794
|
minCandidates: this.minCandidates,
|
|
232538
232795
|
admission: this.admission,
|
|
232539
232796
|
eligibility: this._eligibility,
|
|
@@ -233289,7 +233546,7 @@ var ProducerConfigZod = /* @__PURE__ */ extend(ActorIdentityZod, {
|
|
|
233289
233546
|
title: "producer.disableIntentRedeclaration",
|
|
233290
233547
|
type: "boolean"
|
|
233291
233548
|
}),
|
|
233292
|
-
heartbeatInterval: (/* @__PURE__ */ _default$1(/* @__PURE__ */ number$4(),
|
|
233549
|
+
heartbeatInterval: (/* @__PURE__ */ _default$1(/* @__PURE__ */ number$4(), DEFAULT_HEARTBEAT_INTERVAL)).register(globalRegistry, {
|
|
233293
233550
|
description: "The number of milliseconds between heartbeats if no blocks are produced",
|
|
233294
233551
|
title: "producer.heartbeatInterval",
|
|
233295
233552
|
type: "number"
|
|
@@ -241908,7 +242165,7 @@ function withDeprecationWarning$1(module, host, options = {}) {
|
|
|
241908
242165
|
return module;
|
|
241909
242166
|
}
|
|
241910
242167
|
//#endregion
|
|
241911
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.
|
|
242168
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4.3__@o_d8f0054b13f6e551673802e6b9e450ca/node_modules/@xyo-network/xl1-sdk/dist/node/providers.mjs
|
|
241912
242169
|
var __defProp$3 = Object.defineProperty;
|
|
241913
242170
|
var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
|
|
241914
242171
|
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, {
|
|
@@ -242886,6 +243143,18 @@ var RestNetworkStakeStepRewardsByPositionViewer = class extends AbstractCreatabl
|
|
|
242886
243143
|
get fetchFn() {
|
|
242887
243144
|
return this.context.fetchFn ?? fetch.bind(globalThis);
|
|
242888
243145
|
}
|
|
243146
|
+
/** Per-position allocations for one completed step from the durable index record. */
|
|
243147
|
+
async allocationsForStep(step) {
|
|
243148
|
+
const head = await this.getHead();
|
|
243149
|
+
this.assertPublishedStep(step, head);
|
|
243150
|
+
const record = await this.getStep(step);
|
|
243151
|
+
const result = {};
|
|
243152
|
+
for (const [positionId, amount] of Object.entries(record.positionRewards)) {
|
|
243153
|
+
const reward = asAttoXL1$1(BigInt(amount));
|
|
243154
|
+
if (reward > 0n) result[Number(positionId)] = reward;
|
|
243155
|
+
}
|
|
243156
|
+
return result;
|
|
243157
|
+
}
|
|
242889
243158
|
/** Returns the policy bonus. The unmultiplied-v1 index has no multipliers, so bonus is zero. */
|
|
242890
243159
|
async bonus(options = {}) {
|
|
242891
243160
|
const total = await this.total(options);
|
|
@@ -243377,6 +243646,18 @@ var SimpleStepRewardsByPositionViewer = class extends AbstractCreatableProvider$
|
|
|
243377
243646
|
get stakeViewer() {
|
|
243378
243647
|
return this._stakeViewer;
|
|
243379
243648
|
}
|
|
243649
|
+
/** Per-position allocations for one completed step (compute path). */
|
|
243650
|
+
async allocationsForStep(step) {
|
|
243651
|
+
const externalRange = await externalBlockRangeFromStep(this.context, this.blockViewer, step, this.timeAnchor);
|
|
243652
|
+
const positionCount = await this.stakeViewer.stakeEvents.positionCount(externalRange);
|
|
243653
|
+
if (positionCount === 0) return {};
|
|
243654
|
+
const positions = await this.loadPositions(positionCount);
|
|
243655
|
+
const eventsByPosition = indexStakeEventsByPosition(await this.stakeViewer.stakeEvents.stakeEvents([0, externalRange[1]]));
|
|
243656
|
+
const computed = await networkStakeStepRewardsForPositions(this.context, this.blockViewer, step, positions, eventsByPosition, this.rewardMultipliers, this.timeAnchor, externalRange);
|
|
243657
|
+
const result = {};
|
|
243658
|
+
for (const [positionId, amount] of computed.positionRewards) if (amount > 0n) result[positionId] = amount;
|
|
243659
|
+
return result;
|
|
243660
|
+
}
|
|
243380
243661
|
/** Returns the bonus result exposed by this provider. */
|
|
243381
243662
|
async bonus({ range, positions } = {}) {
|
|
243382
243663
|
const total = await this.total({
|
|
@@ -244123,6 +244404,10 @@ var SimpleXyoViewer = class extends AbstractCreatableProvider$1 {
|
|
|
244123
244404
|
networkStakeStepRewardAddressShare(_context, _address) {
|
|
244124
244405
|
throw new Error("Method [networkStakeStepRewardAddressShare] not implemented.");
|
|
244125
244406
|
}
|
|
244407
|
+
/** Per-position allocations for one completed step (`positionId → reward`). */
|
|
244408
|
+
async networkStakeStepRewardAllocationsForStep(stepIdentity) {
|
|
244409
|
+
return await this.networkStepRewardsByPositionViewer.allocationsForStep(stepIdentity);
|
|
244410
|
+
}
|
|
244126
244411
|
/** Returns the network stake step reward claimed by address result exposed by this provider. */
|
|
244127
244412
|
networkStakeStepRewardClaimedByAddress(_address) {
|
|
244128
244413
|
throw new Error("Method [networkStakeStepRewardClaimedByAddress] not implemented.");
|
|
@@ -244432,7 +244717,7 @@ __publicField$3(RestChainParamsViewer, "monikers", [ChainParamsViewerMoniker]);
|
|
|
244432
244717
|
__publicField$3(RestChainParamsViewer, "surface", "node");
|
|
244433
244718
|
RestChainParamsViewer = __decorateClass$3([creatableProvider$1()], RestChainParamsViewer);
|
|
244434
244719
|
//#endregion
|
|
244435
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-s3-providers@5.3.
|
|
244720
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-s3-providers@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@_d1d2fde6ed1017438dbf810bb4a75181/node_modules/@xyo-network/xl1-s3-providers/dist/node/index.mjs
|
|
244436
244721
|
var __defProp$2 = Object.defineProperty;
|
|
244437
244722
|
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
244438
244723
|
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, {
|
|
@@ -246261,6 +246546,7 @@ function defaultDevConfig() {
|
|
|
246261
246546
|
name: "finalizer",
|
|
246262
246547
|
accountPath: "5",
|
|
246263
246548
|
finalizationCheckInterval: 200,
|
|
246549
|
+
heartbeatInterval: 5e3,
|
|
246264
246550
|
minCandidates: 1
|
|
246265
246551
|
}
|
|
246266
246552
|
]
|
|
@@ -247668,7 +247954,7 @@ async function tryParseConfig(options) {
|
|
|
247668
247954
|
return finalize ? finalizeConfig(section) : section;
|
|
247669
247955
|
}
|
|
247670
247956
|
//#endregion
|
|
247671
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-system-status@5.3.
|
|
247957
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-system-status@5.3.3_@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod_19e6693dd338050e1795f614861c0e57/node_modules/@xyo-network/xl1-system-status/dist/node/index.mjs
|
|
247672
247958
|
function resolveStatusProbe(status, url) {
|
|
247673
247959
|
switch (url) {
|
|
247674
247960
|
case "/healthz": {
|
|
@@ -248852,8 +249138,8 @@ $0 <command> [options]`).parserConfiguration({
|
|
|
248852
249138
|
}
|
|
248853
249139
|
}).help().alias("help", "h").version(fullVersion2);
|
|
248854
249140
|
}
|
|
248855
|
-
var version = isDefined$1("5.2.
|
|
248856
|
-
var gitHash = isDefined$1("
|
|
249141
|
+
var version = isDefined$1("5.2.2") ? "5.2.2" : "unknown";
|
|
249142
|
+
var gitHash = isDefined$1("0eaaafa63") ? "0eaaafa63" : "";
|
|
248857
249143
|
var fullVersion = gitHash.length > 0 ? `${version} (${gitHash})` : version;
|
|
248858
249144
|
var mapXl1CliFailure = createSysExitFailureMapper();
|
|
248859
249145
|
var defaultDependencies2 = {
|