@xyo-network/xl1-cli-lib 1.16.24 → 1.16.26
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/node/index.mjs +48 -85
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/orchestration/actor/implementation/ChainHeadUpdateActor.d.ts.map +1 -1
- package/dist/node/orchestration/actor/implementation/ProducerActor.d.ts +3 -3
- package/dist/node/orchestration/actor/implementation/ProducerActor.d.ts.map +1 -1
- package/dist/node/orchestration/initServices.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/accountBalance.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/head/createBootstrapHead.d.ts +2 -2
- package/dist/node/orchestration/services/implementation/head/createBootstrapHead.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/head/createForkedHead/config/getBridgeSourceDetails.d.ts +2 -2
- package/dist/node/orchestration/services/implementation/head/createForkedHead/config/getBridgeSourceDetails.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/head/createForkedHead/createForkedHead.d.ts +2 -3
- package/dist/node/orchestration/services/implementation/head/createForkedHead/createForkedHead.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/head/createForkedHead/getBridgeDestinationObservation.d.ts +2 -2
- package/dist/node/orchestration/services/implementation/head/createForkedHead/getBridgeDestinationObservation.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/head/createForkedHead/getBridgeIntent.d.ts +2 -2
- package/dist/node/orchestration/services/implementation/head/createForkedHead/getBridgeIntent.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/head/createForkedHead/getBridgeSourceObservation.d.ts +2 -2
- package/dist/node/orchestration/services/implementation/head/createForkedHead/getBridgeSourceObservation.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/head/createForkedHead/getFirstBlockForNewChain.d.ts +2 -2
- package/dist/node/orchestration/services/implementation/head/createForkedHead/getFirstBlockForNewChain.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/head/getForkFromBlock.d.ts +2 -3
- package/dist/node/orchestration/services/implementation/head/getForkFromBlock.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/head/head.d.ts +2 -3
- package/dist/node/orchestration/services/implementation/head/head.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/head/submitNewChain.d.ts +2 -2
- package/dist/node/orchestration/services/implementation/head/submitNewChain.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/index.d.ts +0 -1
- package/dist/node/orchestration/services/implementation/index.d.ts.map +1 -1
- package/dist/node/xl1.mjs +48 -82
- package/dist/node/xl1.mjs.map +1 -1
- package/package.json +29 -29
- package/src/orchestration/actor/implementation/ChainHeadUpdateActor.ts +3 -5
- package/src/orchestration/actor/implementation/ProducerActor.ts +8 -4
- package/src/orchestration/initServices.ts +11 -4
- package/src/orchestration/services/implementation/accountBalance.ts +10 -8
- package/src/orchestration/services/implementation/head/createBootstrapHead.ts +3 -3
- package/src/orchestration/services/implementation/head/createForkedHead/createForkedHead.ts +4 -5
- package/src/orchestration/services/implementation/head/createForkedHead/getBridgeDestinationObservation.ts +7 -5
- package/src/orchestration/services/implementation/head/createForkedHead/getBridgeIntent.ts +4 -3
- package/src/orchestration/services/implementation/head/createForkedHead/getBridgeSourceObservation.ts +4 -3
- package/src/orchestration/services/implementation/head/createForkedHead/getFirstBlockForNewChain.ts +6 -3
- package/src/orchestration/services/implementation/head/getForkFromBlock.ts +5 -5
- package/src/orchestration/services/implementation/head/head.ts +4 -5
- package/src/orchestration/services/implementation/head/submitNewChain.ts +2 -2
- package/src/orchestration/services/implementation/index.ts +0 -1
- package/dist/node/orchestration/services/implementation/iterator.d.ts +0 -7
- package/dist/node/orchestration/services/implementation/iterator.d.ts.map +0 -1
- package/src/orchestration/services/implementation/iterator.ts +0 -41
package/dist/node/index.mjs
CHANGED
|
@@ -229,9 +229,9 @@ var BalanceActor = class _BalanceActor extends Actor {
|
|
|
229
229
|
};
|
|
230
230
|
|
|
231
231
|
// src/orchestration/actor/implementation/ChainHeadUpdateActor.ts
|
|
232
|
-
import { assertEx as assertEx2,
|
|
232
|
+
import { assertEx as assertEx2, toHex } from "@xylabs/sdk-js";
|
|
233
233
|
import { findMostRecentBlock, sortBlocks } from "@xyo-network/chain-protocol";
|
|
234
|
-
import {
|
|
234
|
+
import { isBlockBoundWitness } from "@xyo-network/xl1-protocol";
|
|
235
235
|
import { Mutex as Mutex2 } from "async-mutex";
|
|
236
236
|
var ChainHeadUpdateActor = class _ChainHeadUpdateActor extends Actor {
|
|
237
237
|
static {
|
|
@@ -264,7 +264,7 @@ var ChainHeadUpdateActor = class _ChainHeadUpdateActor extends Actor {
|
|
|
264
264
|
);
|
|
265
265
|
}
|
|
266
266
|
async checkInsertedForNewHead(data) {
|
|
267
|
-
const candidateBlock = sortBlocks(
|
|
267
|
+
const candidateBlock = sortBlocks(data.payloads.filter(isBlockBoundWitness)).at(-1);
|
|
268
268
|
await this.updateHeadIfNewer(candidateBlock);
|
|
269
269
|
}
|
|
270
270
|
async pollForNewHead() {
|
|
@@ -297,6 +297,7 @@ import { createDeclarationIntent } from "@xyo-network/chain-protocol";
|
|
|
297
297
|
import { BaseBlockProducerService } from "@xyo-network/chain-services";
|
|
298
298
|
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
|
|
299
299
|
import { PayloadBundleSchema } from "@xyo-network/payload-model";
|
|
300
|
+
import { asXL1BlockNumber } from "@xyo-network/xl1-protocol";
|
|
300
301
|
import { buildTransaction, flattenHydratedBlock, flattenHydratedTransaction } from "@xyo-network/xl1-protocol-sdk";
|
|
301
302
|
import { Mutex as Mutex3 } from "async-mutex";
|
|
302
303
|
var SHOULD_REGISTER_REDECLARATION_INTENT_TIMER = true;
|
|
@@ -452,7 +453,7 @@ var ProducerActor = class _ProducerActor extends Actor {
|
|
|
452
453
|
this.logger?.log("Submitting redeclaration intent for producer:", this.account.address);
|
|
453
454
|
const tx = await buildTransaction(this.chainIterator.chainId, [
|
|
454
455
|
redeclarationIntent
|
|
455
|
-
], [], this.account, currentBlock, currentBlock + 1e3);
|
|
456
|
+
], [], this.account, currentBlock, asXL1BlockNumber(currentBlock + 1e3, true));
|
|
456
457
|
const payloads = flattenHydratedTransaction(tx);
|
|
457
458
|
const root = tx[0]._hash;
|
|
458
459
|
const payloadBundle = new PayloadBuilder2({
|
|
@@ -628,8 +629,9 @@ var initHealthEndpoints = /* @__PURE__ */ __name((params) => {
|
|
|
628
629
|
}, "initHealthEndpoints");
|
|
629
630
|
|
|
630
631
|
// src/orchestration/initServices.ts
|
|
631
|
-
import { asAddress as asAddress2, assertEx as assertEx19, isDefined as
|
|
632
|
-
import { initProducerAccount } from "@xyo-network/chain-orchestration";
|
|
632
|
+
import { asAddress as asAddress2, assertEx as assertEx19, isDefined as isDefined14 } from "@xylabs/sdk-js";
|
|
633
|
+
import { initChainIterator, initElectionService, initProducerAccount, initStakeIntentService } from "@xyo-network/chain-orchestration";
|
|
634
|
+
import { blockViewerFromChainIteratorAndArchivist } from "@xyo-network/chain-services";
|
|
633
635
|
import { initTelemetry } from "@xyo-network/chain-telemetry";
|
|
634
636
|
import { startupSpanAsync as startupSpanAsync8 } from "@xyo-network/chain-utils";
|
|
635
637
|
import { validateHydratedBlockState } from "@xyo-network/chain-validation";
|
|
@@ -995,25 +997,15 @@ async function initTransferSummaryMap(params) {
|
|
|
995
997
|
__name(initTransferSummaryMap, "initTransferSummaryMap");
|
|
996
998
|
|
|
997
999
|
// src/orchestration/services/implementation/accountBalance.ts
|
|
998
|
-
import { isDefined as isDefined8 } from "@xylabs/sdk-js";
|
|
999
1000
|
import { BaseAccountBalanceService } from "@xyo-network/chain-services";
|
|
1000
1001
|
import { timeBudget as timeBudget8 } from "@xyo-network/xl1-protocol-sdk";
|
|
1001
|
-
import { AccountBalanceViewerRpcSchemas, HttpRpcTransport, JsonRpcAccountBalanceViewer } from "@xyo-network/xl1-rpc";
|
|
1002
1002
|
var balanceServiceSingleton;
|
|
1003
1003
|
var initAccountBalanceService = /* @__PURE__ */ __name(async (params) => {
|
|
1004
1004
|
const { config: config2, logger } = params;
|
|
1005
1005
|
if (balanceServiceSingleton) return balanceServiceSingleton;
|
|
1006
1006
|
return await timeBudget8("initAccountBalanceService", params.logger, async () => {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
...AccountBalanceViewerRpcSchemas
|
|
1010
|
-
});
|
|
1011
|
-
const viewer = new JsonRpcAccountBalanceViewer(transport);
|
|
1012
|
-
logger?.log("Using AccountBalanceViewer RPC service at", config2.services?.accountBalanceViewerEndpoint);
|
|
1013
|
-
return viewer;
|
|
1014
|
-
} else {
|
|
1015
|
-
balanceServiceSingleton = await BaseAccountBalanceService.create(params.params);
|
|
1016
|
-
}
|
|
1007
|
+
const endpoint = config2.services?.accountBalanceViewerEndpoint ?? config2.services?.apiEndpoint;
|
|
1008
|
+
balanceServiceSingleton = await BaseAccountBalanceService.create(params.params);
|
|
1017
1009
|
return balanceServiceSingleton;
|
|
1018
1010
|
}, 2e3, true);
|
|
1019
1011
|
}, "initAccountBalanceService");
|
|
@@ -1023,7 +1015,7 @@ import { assertEx as assertEx16 } from "@xylabs/sdk-js";
|
|
|
1023
1015
|
import { MemoryChainService } from "@xyo-network/chain-services";
|
|
1024
1016
|
|
|
1025
1017
|
// src/orchestration/services/implementation/chain/evm.ts
|
|
1026
|
-
import { asAddress, assertEx as assertEx15, isDefined as
|
|
1018
|
+
import { asAddress, assertEx as assertEx15, isDefined as isDefined11, ZERO_ADDRESS } from "@xylabs/sdk-js";
|
|
1027
1019
|
import { EvmChainService } from "@xyo-network/chain-services";
|
|
1028
1020
|
import { Wallet } from "ethers/wallet";
|
|
1029
1021
|
|
|
@@ -1031,13 +1023,13 @@ import { Wallet } from "ethers/wallet";
|
|
|
1031
1023
|
import { assertEx as assertEx14 } from "@xylabs/sdk-js";
|
|
1032
1024
|
|
|
1033
1025
|
// src/orchestration/services/implementation/evm/initInfuraProvider.ts
|
|
1034
|
-
import { assertEx as assertEx12, isDefined as
|
|
1026
|
+
import { assertEx as assertEx12, isDefined as isDefined9 } from "@xylabs/sdk-js";
|
|
1035
1027
|
import { InfuraProvider } from "ethers/providers";
|
|
1036
1028
|
|
|
1037
1029
|
// src/orchestration/services/implementation/evm/initChainId.ts
|
|
1038
|
-
import { assertEx as assertEx11, hexFrom, isDefined as
|
|
1030
|
+
import { assertEx as assertEx11, hexFrom, isDefined as isDefined8, isHex } from "@xylabs/sdk-js";
|
|
1039
1031
|
var canUseChainId = /* @__PURE__ */ __name((config2) => {
|
|
1040
|
-
return
|
|
1032
|
+
return isDefined8(config2.evm.chainId);
|
|
1041
1033
|
}, "canUseChainId");
|
|
1042
1034
|
var getChainId = /* @__PURE__ */ __name((config2) => {
|
|
1043
1035
|
const chainId = assertEx11(config2.evm.chainId, () => "Missing config.evm.chainId");
|
|
@@ -1062,7 +1054,7 @@ var initInfuraProvider = /* @__PURE__ */ __name((config2) => {
|
|
|
1062
1054
|
return instance;
|
|
1063
1055
|
}, "initInfuraProvider");
|
|
1064
1056
|
var canUseInfuraProvider = /* @__PURE__ */ __name((config2) => {
|
|
1065
|
-
return canUseChainId(config2) &&
|
|
1057
|
+
return canUseChainId(config2) && isDefined9(config2.evm?.infura?.projectId) && isDefined9(config2.evm?.infura?.projectSecret);
|
|
1066
1058
|
}, "canUseInfuraProvider");
|
|
1067
1059
|
var getInfuraProviderConfig = /* @__PURE__ */ __name((config2) => {
|
|
1068
1060
|
const projectId = assertEx12(config2.evm?.infura?.projectId, () => "Missing config.evm.infura.projectId");
|
|
@@ -1075,14 +1067,14 @@ var getInfuraProviderConfig = /* @__PURE__ */ __name((config2) => {
|
|
|
1075
1067
|
}, "getInfuraProviderConfig");
|
|
1076
1068
|
|
|
1077
1069
|
// src/orchestration/services/implementation/evm/initJsonRpcProvider.ts
|
|
1078
|
-
import { assertEx as assertEx13, isDefined as
|
|
1070
|
+
import { assertEx as assertEx13, isDefined as isDefined10 } from "@xylabs/sdk-js";
|
|
1079
1071
|
import { JsonRpcProvider } from "ethers/providers";
|
|
1080
1072
|
var initJsonRpcProvider = /* @__PURE__ */ __name((config2) => {
|
|
1081
1073
|
const providerConfig = getJsonRpcProviderConfig(config2);
|
|
1082
1074
|
return Promise.resolve(new JsonRpcProvider(...providerConfig));
|
|
1083
1075
|
}, "initJsonRpcProvider");
|
|
1084
1076
|
var canUseJsonRpcProvider = /* @__PURE__ */ __name((config2) => {
|
|
1085
|
-
return canUseChainId(config2) &&
|
|
1077
|
+
return canUseChainId(config2) && isDefined10(config2.evm.jsonRpc?.url);
|
|
1086
1078
|
}, "canUseJsonRpcProvider");
|
|
1087
1079
|
var getJsonRpcProviderConfig = /* @__PURE__ */ __name((config2) => {
|
|
1088
1080
|
const jsonRpcUrl = assertEx13(config2.evm.jsonRpc?.url, () => "Missing config.evm.jsonRpc.url");
|
|
@@ -1111,7 +1103,7 @@ var canUseEvmProvider = /* @__PURE__ */ __name(({ config: config2 }) => {
|
|
|
1111
1103
|
var chainStakeServiceSingleton;
|
|
1112
1104
|
var canUseEvmContractChainService = /* @__PURE__ */ __name((config2) => {
|
|
1113
1105
|
const { id } = config2.chain;
|
|
1114
|
-
return
|
|
1106
|
+
return isDefined11(id) && id !== ZERO_ADDRESS && canUseEvmProvider({
|
|
1115
1107
|
config: config2
|
|
1116
1108
|
});
|
|
1117
1109
|
}, "canUseEvmContractChainService");
|
|
@@ -1167,7 +1159,7 @@ var init = /* @__PURE__ */ __name(async (params) => {
|
|
|
1167
1159
|
}, "init");
|
|
1168
1160
|
|
|
1169
1161
|
// src/orchestration/services/implementation/head/head.ts
|
|
1170
|
-
import { assertEx as assertEx17, isDefined as
|
|
1162
|
+
import { assertEx as assertEx17, isDefined as isDefined13 } from "@xylabs/sdk-js";
|
|
1171
1163
|
import { findMostRecentBlock as findMostRecentBlock2 } from "@xyo-network/chain-protocol";
|
|
1172
1164
|
|
|
1173
1165
|
// src/orchestration/services/implementation/head/createBootstrapHead.ts
|
|
@@ -1306,7 +1298,7 @@ var getBridgeSourceObservation = /* @__PURE__ */ __name(async (previousBlock, ac
|
|
|
1306
1298
|
import { buildBlock } from "@xyo-network/chain-protocol";
|
|
1307
1299
|
import { AttoXL1, XYO_STEP_REWARD_ADDRESS } from "@xyo-network/xl1-protocol";
|
|
1308
1300
|
var getFirstBlockForNewChain = /* @__PURE__ */ __name(async (forkBlock, account, chainService) => {
|
|
1309
|
-
const { _hash: previousBlockHash, block: previousBlockNumber, step_hashes: previousStepHashes, protocol } = forkBlock;
|
|
1301
|
+
const { _hash: previousBlockHash, block: previousBlockNumber, step_hashes: previousStepHashes = [], protocol } = forkBlock;
|
|
1310
1302
|
const chainId = chainService.chainId;
|
|
1311
1303
|
const options = {
|
|
1312
1304
|
blockPayloads: [],
|
|
@@ -1340,20 +1332,20 @@ var createForkedHead = /* @__PURE__ */ __name(async (forkFromBlock, account, cha
|
|
|
1340
1332
|
}, "createForkedHead");
|
|
1341
1333
|
|
|
1342
1334
|
// src/orchestration/services/implementation/head/getForkFromBlock.ts
|
|
1343
|
-
import { asHash, hexFromBigInt, isDefined as
|
|
1344
|
-
import {
|
|
1335
|
+
import { asHash, hexFromBigInt, isDefined as isDefined12 } from "@xylabs/sdk-js";
|
|
1336
|
+
import { isSignedBlockBoundWitnessWithHashMeta } from "@xyo-network/xl1-protocol";
|
|
1345
1337
|
var getForkFromBlock = /* @__PURE__ */ __name(async (head, chainService, chainArchivist) => {
|
|
1346
1338
|
if (head.chain !== chainService.chainId) {
|
|
1347
1339
|
const forkedAtBigInt = await chainService.forkedAtHash();
|
|
1348
1340
|
const forkedAtHex = hexFromBigInt(forkedAtBigInt);
|
|
1349
1341
|
const forkedAtHash = asHash(forkedAtHex);
|
|
1350
|
-
if (
|
|
1342
|
+
if (isDefined12(forkedAtHash)) {
|
|
1351
1343
|
const [forkedAtBlock] = await chainArchivist.get([
|
|
1352
1344
|
forkedAtHash
|
|
1353
1345
|
]);
|
|
1354
1346
|
const forkedChainId = await chainService.forkedChainId();
|
|
1355
1347
|
const forkedAtBlockNumber = Number(await chainService.forkedAtBlockNumber());
|
|
1356
|
-
if (
|
|
1348
|
+
if (isSignedBlockBoundWitnessWithHashMeta(forkedAtBlock) && forkedAtBlock.chain === forkedChainId && forkedAtBlock.block === forkedAtBlockNumber) {
|
|
1357
1349
|
return forkedAtBlock;
|
|
1358
1350
|
}
|
|
1359
1351
|
}
|
|
@@ -1385,7 +1377,7 @@ var initHead = /* @__PURE__ */ __name(async (params) => {
|
|
|
1385
1377
|
let head = await findMostRecentBlock2(chainArchivist);
|
|
1386
1378
|
if (head) {
|
|
1387
1379
|
const forkFromBlock = await getForkFromBlock(head, chainService, chainArchivist);
|
|
1388
|
-
if (
|
|
1380
|
+
if (isDefined13(forkFromBlock)) {
|
|
1389
1381
|
const chain = await createForkedHead(forkFromBlock, account, chainService);
|
|
1390
1382
|
await submitNewChain(chain, chainArchivist, chainSubmissionsArchivistWrite);
|
|
1391
1383
|
const newBlock = assertEx17(chain.at(-1), () => new Error("Failed to get new head after forking"));
|
|
@@ -1401,41 +1393,13 @@ var initHead = /* @__PURE__ */ __name(async (params) => {
|
|
|
1401
1393
|
return headSingleton;
|
|
1402
1394
|
}, "initHead");
|
|
1403
1395
|
|
|
1404
|
-
// src/orchestration/services/implementation/iterator.ts
|
|
1405
|
-
import { BaseElectionService, ChainBlockNumberIterationService, XyoStakeIntentService } from "@xyo-network/chain-services";
|
|
1406
|
-
import { timeBudget as timeBudget9 } from "@xyo-network/xl1-protocol-sdk";
|
|
1407
|
-
var chainIteratorServiceSingleton;
|
|
1408
|
-
var stakeIntentServiceSingleton;
|
|
1409
|
-
var electionServiceSingleton;
|
|
1410
|
-
var initChainIterator = /* @__PURE__ */ __name((params) => {
|
|
1411
|
-
if (chainIteratorServiceSingleton) return chainIteratorServiceSingleton;
|
|
1412
|
-
return timeBudget9("initChainIterator", params.logger, () => {
|
|
1413
|
-
chainIteratorServiceSingleton = ChainBlockNumberIterationService.create(params);
|
|
1414
|
-
return chainIteratorServiceSingleton;
|
|
1415
|
-
}, 2e3, true);
|
|
1416
|
-
}, "initChainIterator");
|
|
1417
|
-
var initStakeIntentService = /* @__PURE__ */ __name((params) => {
|
|
1418
|
-
if (stakeIntentServiceSingleton) return stakeIntentServiceSingleton;
|
|
1419
|
-
return timeBudget9("initStakeIntentService", params.logger, () => {
|
|
1420
|
-
stakeIntentServiceSingleton = XyoStakeIntentService.create(params);
|
|
1421
|
-
return stakeIntentServiceSingleton;
|
|
1422
|
-
}, 2e3, true);
|
|
1423
|
-
}, "initStakeIntentService");
|
|
1424
|
-
var initElectionService = /* @__PURE__ */ __name((params) => {
|
|
1425
|
-
if (electionServiceSingleton) return electionServiceSingleton;
|
|
1426
|
-
return timeBudget9("initElectionService", params.logger, () => {
|
|
1427
|
-
electionServiceSingleton = BaseElectionService.create(params);
|
|
1428
|
-
return electionServiceSingleton;
|
|
1429
|
-
}, 2e3, true);
|
|
1430
|
-
}, "initElectionService");
|
|
1431
|
-
|
|
1432
1396
|
// src/orchestration/services/implementation/pendingTransactions.ts
|
|
1433
1397
|
import { BasePendingTransactionsService } from "@xyo-network/chain-services";
|
|
1434
|
-
import { timeBudget as
|
|
1398
|
+
import { timeBudget as timeBudget9 } from "@xyo-network/xl1-protocol-sdk";
|
|
1435
1399
|
var serviceSingleton;
|
|
1436
1400
|
var initPendingTransactions = /* @__PURE__ */ __name(async (params) => {
|
|
1437
1401
|
if (serviceSingleton) return serviceSingleton;
|
|
1438
|
-
return await
|
|
1402
|
+
return await timeBudget9("initPendingTransactions", params.logger, async () => {
|
|
1439
1403
|
serviceSingleton = await BasePendingTransactionsService.create(params);
|
|
1440
1404
|
return serviceSingleton;
|
|
1441
1405
|
}, 2e3, true);
|
|
@@ -1443,11 +1407,11 @@ var initPendingTransactions = /* @__PURE__ */ __name(async (params) => {
|
|
|
1443
1407
|
|
|
1444
1408
|
// src/orchestration/services/implementation/producer.ts
|
|
1445
1409
|
import { BaseBlockProducerService as BaseBlockProducerService2 } from "@xyo-network/chain-services";
|
|
1446
|
-
import { timeBudget as
|
|
1410
|
+
import { timeBudget as timeBudget10 } from "@xyo-network/xl1-protocol-sdk";
|
|
1447
1411
|
var serviceSingleton2;
|
|
1448
1412
|
var initBlockProducer = /* @__PURE__ */ __name(async (params) => {
|
|
1449
1413
|
if (serviceSingleton2) return serviceSingleton2;
|
|
1450
|
-
return await
|
|
1414
|
+
return await timeBudget10("initBlockProducer", params.logger, async () => {
|
|
1451
1415
|
serviceSingleton2 = await BaseBlockProducerService2.create(params);
|
|
1452
1416
|
return serviceSingleton2;
|
|
1453
1417
|
}, 2e3, true);
|
|
@@ -1456,11 +1420,11 @@ var initBlockProducer = /* @__PURE__ */ __name(async (params) => {
|
|
|
1456
1420
|
// src/orchestration/services/implementation/reward.ts
|
|
1457
1421
|
import { assertEx as assertEx18 } from "@xylabs/sdk-js";
|
|
1458
1422
|
import { EvmBlockRewardService, MemoryBlockRewardService } from "@xyo-network/chain-services";
|
|
1459
|
-
import { timeBudget as
|
|
1423
|
+
import { timeBudget as timeBudget11 } from "@xyo-network/xl1-protocol-sdk";
|
|
1460
1424
|
var rewardServiceSingleton;
|
|
1461
1425
|
var initBlockRewardService = /* @__PURE__ */ __name((params) => {
|
|
1462
1426
|
if (rewardServiceSingleton) return rewardServiceSingleton;
|
|
1463
|
-
return
|
|
1427
|
+
return timeBudget11("initBlockRewardService", params.logger, () => {
|
|
1464
1428
|
const { config: config2 } = params;
|
|
1465
1429
|
rewardServiceSingleton = canUseEvmBlockRewardService({
|
|
1466
1430
|
config: config2
|
|
@@ -1470,7 +1434,7 @@ var initBlockRewardService = /* @__PURE__ */ __name((params) => {
|
|
|
1470
1434
|
}, "initBlockRewardService");
|
|
1471
1435
|
var initXyoBlockRewardService = /* @__PURE__ */ __name((params) => {
|
|
1472
1436
|
if (rewardServiceSingleton) return rewardServiceSingleton;
|
|
1473
|
-
return
|
|
1437
|
+
return timeBudget11("initXyoBlockRewardService", params.logger, () => {
|
|
1474
1438
|
rewardServiceSingleton = MemoryBlockRewardService.create(params);
|
|
1475
1439
|
return rewardServiceSingleton;
|
|
1476
1440
|
}, 2e3, true);
|
|
@@ -1480,7 +1444,7 @@ var canUseEvmBlockRewardService = /* @__PURE__ */ __name((params) => canUseEvmPr
|
|
|
1480
1444
|
}), "canUseEvmBlockRewardService");
|
|
1481
1445
|
var initEvmBlockRewardService = /* @__PURE__ */ __name(async (params) => {
|
|
1482
1446
|
if (rewardServiceSingleton) return rewardServiceSingleton;
|
|
1483
|
-
return await
|
|
1447
|
+
return await timeBudget11("initEvmBlockRewardService", params.logger, async () => {
|
|
1484
1448
|
const { account: paramsAccount } = params;
|
|
1485
1449
|
const account = assertEx18(paramsAccount, () => "Account is required");
|
|
1486
1450
|
const provider2 = assertEx18(await initEvmProvider(params));
|
|
@@ -1496,11 +1460,11 @@ var initEvmBlockRewardService = /* @__PURE__ */ __name(async (params) => {
|
|
|
1496
1460
|
|
|
1497
1461
|
// src/orchestration/services/implementation/time.ts
|
|
1498
1462
|
import { BaseTimeSyncService } from "@xyo-network/chain-services";
|
|
1499
|
-
import { timeBudget as
|
|
1463
|
+
import { timeBudget as timeBudget12 } from "@xyo-network/xl1-protocol-sdk";
|
|
1500
1464
|
var timeSyncServiceSingleton;
|
|
1501
1465
|
var initTimeService = /* @__PURE__ */ __name(async ({ chainArchivist, chainIterator, config: config2, logger, meterProvider, traceProvider }) => {
|
|
1502
1466
|
if (timeSyncServiceSingleton) return timeSyncServiceSingleton;
|
|
1503
|
-
return await
|
|
1467
|
+
return await timeBudget12("initTimeService", logger, async () => {
|
|
1504
1468
|
const ethProvider = canUseEvmProvider({
|
|
1505
1469
|
config: config2
|
|
1506
1470
|
}) ? await initEvmProvider({
|
|
@@ -1520,11 +1484,11 @@ var initTimeService = /* @__PURE__ */ __name(async ({ chainArchivist, chainItera
|
|
|
1520
1484
|
|
|
1521
1485
|
// src/orchestration/services/implementation/transfer.ts
|
|
1522
1486
|
import { BaseAccountTransfersService } from "@xyo-network/chain-services";
|
|
1523
|
-
import { timeBudget as
|
|
1487
|
+
import { timeBudget as timeBudget13 } from "@xyo-network/xl1-protocol-sdk";
|
|
1524
1488
|
var transferServiceSingleton;
|
|
1525
1489
|
var initTransferService = /* @__PURE__ */ __name(async (params) => {
|
|
1526
1490
|
if (transferServiceSingleton) return transferServiceSingleton;
|
|
1527
|
-
return await
|
|
1491
|
+
return await timeBudget13("initTransferService", params.logger, async () => {
|
|
1528
1492
|
transferServiceSingleton = await BaseAccountTransfersService.create(params);
|
|
1529
1493
|
return transferServiceSingleton;
|
|
1530
1494
|
}, 2e3, true);
|
|
@@ -1631,7 +1595,7 @@ var RuntimeStatusMonitor = class extends LoggerStatusReporter {
|
|
|
1631
1595
|
// src/orchestration/initServices.ts
|
|
1632
1596
|
var isStartable = /* @__PURE__ */ __name((value) => {
|
|
1633
1597
|
const possibleStartable = value;
|
|
1634
|
-
return
|
|
1598
|
+
return isDefined14(possibleStartable.start) && typeof possibleStartable.start === "function" && possibleStartable.status === "created";
|
|
1635
1599
|
}, "isStartable");
|
|
1636
1600
|
var initServices = /* @__PURE__ */ __name(async (context) => {
|
|
1637
1601
|
const { config: config2, logger } = context;
|
|
@@ -1738,6 +1702,7 @@ var initServices = /* @__PURE__ */ __name(async (context) => {
|
|
|
1738
1702
|
...initParams
|
|
1739
1703
|
}))
|
|
1740
1704
|
]);
|
|
1705
|
+
const blockViewer = blockViewerFromChainIteratorAndArchivist(chainIterator, chainArchivist);
|
|
1741
1706
|
const balanceContext = {
|
|
1742
1707
|
stepSemaphores: StepSizes.map(() => new Semaphore2(20)),
|
|
1743
1708
|
store: {
|
|
@@ -1774,6 +1739,7 @@ var initServices = /* @__PURE__ */ __name(async (context) => {
|
|
|
1774
1739
|
name: "BalanceService",
|
|
1775
1740
|
config: {},
|
|
1776
1741
|
context: balanceContext,
|
|
1742
|
+
blockViewer,
|
|
1777
1743
|
chainArchivist,
|
|
1778
1744
|
chainIterator,
|
|
1779
1745
|
transferContext
|
|
@@ -1821,7 +1787,7 @@ var initServices = /* @__PURE__ */ __name(async (context) => {
|
|
|
1821
1787
|
validateHydratedBlockState,
|
|
1822
1788
|
...initParams
|
|
1823
1789
|
};
|
|
1824
|
-
const rewardAddress =
|
|
1790
|
+
const rewardAddress = isDefined14(config2.producer.rewardAddress) ? assertEx19(asAddress2(config2.producer.rewardAddress), () => "Invalid block reward address provided") : account.address;
|
|
1825
1791
|
const producerParams = {
|
|
1826
1792
|
...validatorParams,
|
|
1827
1793
|
name: "Producer",
|
|
@@ -1865,7 +1831,7 @@ var initServices = /* @__PURE__ */ __name(async (context) => {
|
|
|
1865
1831
|
}, "initServices");
|
|
1866
1832
|
|
|
1867
1833
|
// src/runCLI.ts
|
|
1868
|
-
import { deepMerge, isDefined as
|
|
1834
|
+
import { deepMerge, isDefined as isDefined17 } from "@xylabs/sdk-js";
|
|
1869
1835
|
import { ConfigZod } from "@xyo-network/xl1-protocol-sdk";
|
|
1870
1836
|
import yargs from "yargs";
|
|
1871
1837
|
import { hideBin } from "yargs/helpers";
|
|
@@ -1953,16 +1919,16 @@ var XL1LogoColorizedAscii = `\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\
|
|
|
1953
1919
|
\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;108;93;162m\xB2\x1B[0m\x1B[38;2;99;79;176m^\x1B[0m`;
|
|
1954
1920
|
|
|
1955
1921
|
// src/initLogger.ts
|
|
1956
|
-
import { Base as Base2, ConsoleLogger, isDefined as
|
|
1922
|
+
import { Base as Base2, ConsoleLogger, isDefined as isDefined15, LogLevel, SilentLogger } from "@xylabs/sdk-js";
|
|
1957
1923
|
var initLogger = /* @__PURE__ */ __name((config2) => {
|
|
1958
1924
|
let logger;
|
|
1959
1925
|
if (config2.silent) {
|
|
1960
1926
|
logger = new SilentLogger();
|
|
1961
1927
|
} else {
|
|
1962
1928
|
let level;
|
|
1963
|
-
if (
|
|
1929
|
+
if (isDefined15(config2.logLevel)) {
|
|
1964
1930
|
const parsed = LogLevel[config2.logLevel.toLowerCase()];
|
|
1965
|
-
if (
|
|
1931
|
+
if (isDefined15(parsed)) level = parsed;
|
|
1966
1932
|
}
|
|
1967
1933
|
logger = new ConsoleLogger(level);
|
|
1968
1934
|
}
|
|
@@ -1988,7 +1954,7 @@ var optionsFromGlobalZodRegistry = /* @__PURE__ */ __name(() => {
|
|
|
1988
1954
|
}, "optionsFromGlobalZodRegistry");
|
|
1989
1955
|
|
|
1990
1956
|
// src/tryParseConfig.ts
|
|
1991
|
-
import { isDefined as
|
|
1957
|
+
import { isDefined as isDefined16, isNull } from "@xylabs/sdk-js";
|
|
1992
1958
|
import { cosmiconfigSync } from "cosmiconfig";
|
|
1993
1959
|
var configName = "xyo";
|
|
1994
1960
|
var configSection = "xl1";
|
|
@@ -1997,7 +1963,7 @@ var tryParseConfig = /* @__PURE__ */ __name(() => {
|
|
|
1997
1963
|
const result = explorer.search();
|
|
1998
1964
|
if (!isNull(result)) {
|
|
1999
1965
|
const section = result?.config?.[configSection];
|
|
2000
|
-
if (
|
|
1966
|
+
if (isDefined16(section) && typeof section === "object") {
|
|
2001
1967
|
return section;
|
|
2002
1968
|
}
|
|
2003
1969
|
}
|
|
@@ -2027,7 +1993,7 @@ var waitForHostPort = /* @__PURE__ */ __name((host, port) => {
|
|
|
2027
1993
|
|
|
2028
1994
|
// src/runCLI.ts
|
|
2029
1995
|
var configuration;
|
|
2030
|
-
var version =
|
|
1996
|
+
var version = isDefined17("1.16.25") ? "1.16.25" : "unknown";
|
|
2031
1997
|
var getContextFromConfig = /* @__PURE__ */ __name((configuration2) => {
|
|
2032
1998
|
const logger = initLogger(configuration2);
|
|
2033
1999
|
const orchestrator = new Orchestrator(logger);
|
|
@@ -2163,16 +2129,13 @@ export {
|
|
|
2163
2129
|
initAccountBalanceService,
|
|
2164
2130
|
initBlockProducer,
|
|
2165
2131
|
initBlockRewardService,
|
|
2166
|
-
initChainIterator,
|
|
2167
2132
|
initChainService,
|
|
2168
|
-
initElectionService,
|
|
2169
2133
|
initEvmProvider,
|
|
2170
2134
|
initHead,
|
|
2171
2135
|
initHealthEndpoints,
|
|
2172
2136
|
initMemoryChainService,
|
|
2173
2137
|
initPendingTransactions,
|
|
2174
2138
|
initServices,
|
|
2175
|
-
initStakeIntentService,
|
|
2176
2139
|
initTimeService,
|
|
2177
2140
|
initTransferService,
|
|
2178
2141
|
initValidator,
|