@xyo-network/chain-api 1.16.20 → 1.16.21
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 +30 -89
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/server/server.d.ts.map +1 -1
- package/package.json +32 -34
- package/src/server/server.ts +14 -34
package/dist/node/index.mjs
CHANGED
|
@@ -336,61 +336,18 @@ var getApp = /* @__PURE__ */ __name(async (node, transferSummaryMap, stakedChain
|
|
|
336
336
|
}, "getApp");
|
|
337
337
|
|
|
338
338
|
// src/server/server.ts
|
|
339
|
-
import { assertEx as
|
|
340
|
-
import { Account } from "@xyo-network/account";
|
|
339
|
+
import { assertEx as assertEx4, isDefined as isDefined4, isString } from "@xylabs/sdk-js";
|
|
341
340
|
import { asArchivistInstance as asArchivistInstance2 } from "@xyo-network/archivist-model";
|
|
342
341
|
import { boot } from "@xyo-network/bios";
|
|
343
|
-
import {
|
|
342
|
+
import { createProducerChainStakeIntentBlock, initChainStakeViewer, initProducerAccount } from "@xyo-network/chain-orchestration";
|
|
344
343
|
import { createGenesisBlock, findMostRecentBlock } from "@xyo-network/chain-protocol";
|
|
345
|
-
import { StakedXyoChainV2__factory } from "@xyo-network/typechain";
|
|
346
344
|
import { HDWallet } from "@xyo-network/wallet";
|
|
347
|
-
import {
|
|
348
|
-
|
|
349
|
-
// src/helpers/initChainId.ts
|
|
350
|
-
import { assertEx as assertEx3, hexFrom, isDefined as isDefined3, isHex } from "@xylabs/sdk-js";
|
|
351
|
-
var canUseChainId = /* @__PURE__ */ __name((config) => {
|
|
352
|
-
return isDefined3(config.evm.chainId);
|
|
353
|
-
}, "canUseChainId");
|
|
354
|
-
var getChainId = /* @__PURE__ */ __name((config) => {
|
|
355
|
-
const chainId = assertEx3(config.evm.chainId, () => "Missing config.evm.chainId");
|
|
356
|
-
if (isHex(chainId, {
|
|
357
|
-
prefix: true
|
|
358
|
-
})) {
|
|
359
|
-
const hex = hexFrom(chainId);
|
|
360
|
-
const parsed = Number.parseInt(hex, 16);
|
|
361
|
-
return parsed;
|
|
362
|
-
} else {
|
|
363
|
-
const parsed = Number.parseInt(chainId, 10);
|
|
364
|
-
return parsed;
|
|
365
|
-
}
|
|
366
|
-
}, "getChainId");
|
|
367
|
-
|
|
368
|
-
// src/helpers/initInfuraProvider.ts
|
|
369
|
-
import { assertEx as assertEx4, isDefined as isDefined4 } from "@xylabs/sdk-js";
|
|
370
|
-
import { InfuraWebSocketProvider } from "ethers/providers";
|
|
371
|
-
var instance;
|
|
372
|
-
var initInfuraProvider = /* @__PURE__ */ __name((config) => {
|
|
373
|
-
if (instance) return instance;
|
|
374
|
-
const providerConfig = getInfuraProviderConfig(config);
|
|
375
|
-
instance = Promise.resolve(new InfuraWebSocketProvider(providerConfig[0], providerConfig[1]));
|
|
376
|
-
return instance;
|
|
377
|
-
}, "initInfuraProvider");
|
|
378
|
-
var canUseInfuraProvider = /* @__PURE__ */ __name((config) => {
|
|
379
|
-
return canUseChainId(config) && isDefined4(config.evm?.infura?.projectId) && isDefined4(config.evm?.infura?.projectSecret);
|
|
380
|
-
}, "canUseInfuraProvider");
|
|
381
|
-
var getInfuraProviderConfig = /* @__PURE__ */ __name((config) => {
|
|
382
|
-
const projectId = assertEx4(config.evm?.infura?.projectId, () => "Missing config.evm.infura.projectId");
|
|
383
|
-
const projectSecret = assertEx4(config.evm?.infura?.projectSecret, () => "Missing config.evm.infura.projectSecret");
|
|
384
|
-
return [
|
|
385
|
-
getChainId(config),
|
|
386
|
-
projectId,
|
|
387
|
-
projectSecret
|
|
388
|
-
];
|
|
389
|
-
}, "getInfuraProviderConfig");
|
|
345
|
+
import { asXL1BlockRange } from "@xyo-network/xl1-protocol";
|
|
346
|
+
import { readPayloadMapFromStore } from "@xyo-network/xl1-protocol-sdk";
|
|
390
347
|
|
|
391
348
|
// src/manifest/getLocator.ts
|
|
392
349
|
import { BaseMongoSdk } from "@xylabs/mongo";
|
|
393
|
-
import { asAddress as asAddress3, assertEx as
|
|
350
|
+
import { asAddress as asAddress3, assertEx as assertEx3, isDefined as isDefined3, ZERO_ADDRESS } from "@xylabs/sdk-js";
|
|
394
351
|
import { MemoryArchivist } from "@xyo-network/archivist-memory";
|
|
395
352
|
import { MongoDBArchivistV2 } from "@xyo-network/archivist-mongodb";
|
|
396
353
|
import { ViewArchivist } from "@xyo-network/archivist-view";
|
|
@@ -425,7 +382,7 @@ async function getTransferSummaryMap(config) {
|
|
|
425
382
|
maxEntries: 5e3
|
|
426
383
|
}
|
|
427
384
|
});
|
|
428
|
-
|
|
385
|
+
assertEx3(await result.start(), () => "Failed to start transfer summary map");
|
|
429
386
|
return result;
|
|
430
387
|
} else {
|
|
431
388
|
console.warn("[API] Mongo configuration not found. Using MemoryMap for TransferSummaryMap.");
|
|
@@ -447,7 +404,7 @@ var getLocator = /* @__PURE__ */ __name(async (context) => {
|
|
|
447
404
|
port: 9465
|
|
448
405
|
}
|
|
449
406
|
});
|
|
450
|
-
if (
|
|
407
|
+
if (isDefined3(logger)) AbstractModule.defaultLogger = logger;
|
|
451
408
|
const statusReporter = logger ? new LoggerModuleStatusReporter(logger) : void 0;
|
|
452
409
|
const locator = new ModuleFactoryLocator();
|
|
453
410
|
let balanceSummaryMap;
|
|
@@ -495,7 +452,7 @@ var getLocator = /* @__PURE__ */ __name(async (context) => {
|
|
|
495
452
|
summaryMap: transferSummaryMap,
|
|
496
453
|
stepSemaphores: StepSizes2.map(() => new Semaphore2(20))
|
|
497
454
|
}));
|
|
498
|
-
const chainId =
|
|
455
|
+
const chainId = isDefined3(config.chain.id) ? assertEx3(asAddress3(config.chain.id), () => "chain.id must be an Address") : ZERO_ADDRESS;
|
|
499
456
|
locator.register(HeadValidationDiviner.factory({
|
|
500
457
|
traceProvider,
|
|
501
458
|
meterProvider,
|
|
@@ -955,64 +912,48 @@ var getSeedPhrase = /* @__PURE__ */ __name(async (bios, config, logger) => {
|
|
|
955
912
|
}
|
|
956
913
|
await bios.seedPhraseStore.set("os", seedPhrase);
|
|
957
914
|
}
|
|
958
|
-
return
|
|
915
|
+
return assertEx4(await bios.seedPhraseStore.get("os"), () => "Unable to acquire mnemonic from bios");
|
|
959
916
|
}, "getSeedPhrase");
|
|
960
|
-
async function getStakeChainViewer(config, logger) {
|
|
961
|
-
if (canUseInfuraProvider(config)) {
|
|
962
|
-
const provider = await initInfuraProvider(config);
|
|
963
|
-
const contractAddress = assertEx6(config.chain.id, () => "Missing config.evm.chainId");
|
|
964
|
-
const contract = StakedXyoChainV2__factory.connect(toEthAddress(contractAddress), provider);
|
|
965
|
-
const stakeEventsViewer = await EthereumChainStakeEvents.create({
|
|
966
|
-
contract,
|
|
967
|
-
logger
|
|
968
|
-
});
|
|
969
|
-
assertEx6(await stakeEventsViewer.start(), () => "Failed to start EthereumChainStakeEvents reader");
|
|
970
|
-
const stakeChainViewer = await EthereumChainStakeViewer.create({
|
|
971
|
-
contract,
|
|
972
|
-
stakeEventsViewer,
|
|
973
|
-
logger
|
|
974
|
-
});
|
|
975
|
-
assertEx6(await stakeChainViewer.start(), () => "Failed to start EthereumChainStake viewer");
|
|
976
|
-
return stakeChainViewer;
|
|
977
|
-
} else {
|
|
978
|
-
console.warn("[API] Infura configuration not found. Using SimpleChainStakeViewer with no positions. This means no staking data will be available.");
|
|
979
|
-
const stakeChainViewer = await SimpleChainStakeViewer.create({
|
|
980
|
-
logger,
|
|
981
|
-
positions: []
|
|
982
|
-
});
|
|
983
|
-
assertEx6(await stakeChainViewer.start(), () => "Failed to start SimpleChainStake viewer");
|
|
984
|
-
return stakeChainViewer;
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
__name(getStakeChainViewer, "getStakeChainViewer");
|
|
988
917
|
var getServer = /* @__PURE__ */ __name(async (context) => {
|
|
989
918
|
const { config, logger, node } = context;
|
|
990
919
|
const { mnemonic, port } = context.config.api;
|
|
991
920
|
const bios = await boot();
|
|
992
|
-
const seedPhrase =
|
|
921
|
+
const seedPhrase = isDefined4(mnemonic) ? mnemonic : await getSeedPhrase(bios, config, logger);
|
|
993
922
|
const wallet = await HDWallet.fromPhrase(seedPhrase);
|
|
994
|
-
const stakeChainViewer = await
|
|
923
|
+
const stakeChainViewer = await initChainStakeViewer(config, logger);
|
|
995
924
|
const nodeContext = {
|
|
996
925
|
wallet,
|
|
997
926
|
logger,
|
|
998
927
|
config
|
|
999
928
|
};
|
|
1000
929
|
const resolvedNode = node ?? await getNode(nodeContext);
|
|
1001
|
-
const chainArchivist =
|
|
930
|
+
const chainArchivist = assertEx4(asArchivistInstance2(await resolvedNode.resolve("Chain:Validated"), {
|
|
1002
931
|
required: true
|
|
1003
932
|
}), () => "FinalizedArchivist not found in node");
|
|
1004
933
|
const chainMap = readPayloadMapFromStore(chainArchivist);
|
|
1005
934
|
const payloads = await chainArchivist.next();
|
|
1006
935
|
if (payloads.length === 0) {
|
|
1007
936
|
logger?.warn("[API] No blocks found in chain archivist, creating genesis block");
|
|
1008
|
-
const
|
|
937
|
+
const producerAccount = await initProducerAccount({
|
|
938
|
+
config,
|
|
939
|
+
logger
|
|
940
|
+
});
|
|
1009
941
|
const chainId = stakeChainViewer.chainId;
|
|
1010
|
-
const
|
|
942
|
+
const block0 = await createGenesisBlock(producerAccount, chainId, 1000000n, producerAccount.address);
|
|
1011
943
|
await chainArchivist.insert([
|
|
1012
|
-
...
|
|
1013
|
-
|
|
944
|
+
...block0[1].flat(),
|
|
945
|
+
block0[0]
|
|
1014
946
|
]);
|
|
1015
947
|
console.log("[API] Genesis block created and inserted into chain archivist");
|
|
948
|
+
const block1 = await createProducerChainStakeIntentBlock(block0[0], producerAccount, asXL1BlockRange([
|
|
949
|
+
0,
|
|
950
|
+
1e4
|
|
951
|
+
], true));
|
|
952
|
+
await chainArchivist.insert([
|
|
953
|
+
...block1[1].flat(),
|
|
954
|
+
block1[0]
|
|
955
|
+
]);
|
|
956
|
+
console.log(`[API] Producer declared: ${producerAccount.address}`);
|
|
1016
957
|
}
|
|
1017
958
|
const stakedChainContext = {
|
|
1018
959
|
chainId: stakeChainViewer.chainId,
|
|
@@ -1023,7 +964,7 @@ var getServer = /* @__PURE__ */ __name(async (context) => {
|
|
|
1023
964
|
head: /* @__PURE__ */ __name(async () => {
|
|
1024
965
|
const head = await findMostRecentBlock(chainArchivist);
|
|
1025
966
|
return [
|
|
1026
|
-
|
|
967
|
+
assertEx4(head?._hash, () => "No head found in chainArchivist"),
|
|
1027
968
|
head?.block ?? 0
|
|
1028
969
|
];
|
|
1029
970
|
}, "head")
|
|
@@ -1032,7 +973,7 @@ var getServer = /* @__PURE__ */ __name(async (context) => {
|
|
|
1032
973
|
await Promise.all(mods.map((mod) => {
|
|
1033
974
|
return mod.start?.() ?? (() => true);
|
|
1034
975
|
}));
|
|
1035
|
-
const transferSummaryMap =
|
|
976
|
+
const transferSummaryMap = assertEx4(await getTransferSummaryMap(config), () => "Transfer Summary Map not initialized");
|
|
1036
977
|
const app = await getApp(resolvedNode, transferSummaryMap, stakedChainContext, config.api.initRewardsCache);
|
|
1037
978
|
const server = app.listen(port, hostname, () => logger?.log(`[API] Server listening at http://${hostname}:${port}`));
|
|
1038
979
|
server.setTimeout(2e4);
|
package/dist/node/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/server/app.ts","../../src/server/instrumentation.ts","../../src/server/routes/address/addNodeRoutes.ts","../../src/server/routes/address/get/get.ts","../../src/server/routes/address/post/post.ts","../../src/server/routes/address/post/getQueryConfig.ts","../../src/server/routes/dataLake/archivistMiddleware.ts","../../src/server/routes/dataLake/addDataLakeRoutes.ts","../../src/server/routes/rpc/routes/addRpcRoutes.ts","../../src/server/routes/addRoutes.ts","../../src/server/server.ts","../../src/helpers/initChainId.ts","../../src/helpers/initInfuraProvider.ts","../../src/manifest/getLocator.ts","../../src/manifest/getNode.ts","../../src/manifest/node.json","../../src/manifest/nodeManifest.ts","../../src/manifest/private/index.ts","../../src/manifest/public/WithMempool/Chain.json","../../src/manifest/public/WithMempool/Pending.json","../../src/manifest/public/WithMempool/index.ts","../../src/manifest/public/WithoutMempool/Chain.json","../../src/manifest/public/WithoutMempool/Pending.json","../../src/manifest/public/WithoutMempool/index.ts"],"sourcesContent":["import {\n customPoweredByHeader,\n disableCaseSensitiveRouting,\n disableExpressDefaultPoweredByHeader,\n getJsonBodyParser,\n getJsonBodyParserOptions,\n responseProfiler,\n standardErrors,\n standardResponses,\n} from '@xylabs/express'\nimport type { NodeInstance } from '@xyo-network/node-model'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport type {\n MapType, StakedChainContextRead, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport compression from 'compression'\nimport cors from 'cors'\nimport type { Express } from 'express'\nimport express from 'express'\n\nimport { addInstrumentation } from './instrumentation.ts'\nimport { addRoutes } from './routes/index.ts'\n\nexport const getApp = async (\n node: NodeInstance,\n transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>,\n stakedChainContext: StakedChainContextRead,\n initRewardsCache?: boolean,\n): Promise<Express> => {\n addInstrumentation()\n const app = express()\n app.set('etag', false)\n\n app.use(cors())\n app.use(compression())\n app.use(responseProfiler)\n app.use(getJsonBodyParser(getJsonBodyParserOptions({ limit: '1mb' })))\n app.use(standardResponses)\n disableExpressDefaultPoweredByHeader(app)\n app.use(customPoweredByHeader)\n disableCaseSensitiveRouting(app)\n app.node = node\n await addRoutes(app, transferSummaryMap, stakedChainContext, initRewardsCache)\n app.use(standardErrors)\n return app\n}\n","import { registerInstrumentations } from '@opentelemetry/instrumentation'\nimport { ExpressInstrumentation } from '@opentelemetry/instrumentation-express'\nimport { HttpInstrumentation } from '@opentelemetry/instrumentation-http'\n\n/**\n * Registers OpenTelemetry instrumentations for HTTP and Express.\n * This function is used to set up the necessary instrumentations for monitoring\n * HTTP requests and Express applications. Since it monkey patches the Express\n * router & middleware system, it should be called before any Express applications\n * are defined.\n */\nexport const addInstrumentation = () => {\n const instrumentations = [new HttpInstrumentation(), new ExpressInstrumentation()]\n registerInstrumentations({ instrumentations })\n}\n","import type { Express } from 'express'\nimport { StatusCodes } from 'http-status-codes'\n\nimport { getAddress } from './get/index.ts'\nimport { postAddress } from './post/index.ts'\n\nexport const addNodeRoutes = (app: Express) => {\n const defaultModule = app.node\n const address = defaultModule.address\n const defaultModuleEndpoint = `/${address}`\n app.get('/', (_req, res) => res.redirect(StatusCodes.MOVED_TEMPORARILY, defaultModuleEndpoint))\n app.post('/', (_req, res) => res.redirect(StatusCodes.TEMPORARY_REDIRECT, defaultModuleEndpoint))\n app.get('/:address', getAddress)\n app.post('/:address', postAddress)\n app.get('/:hash', (_req, res) => {\n res.sendStatus(StatusCodes.NOT_FOUND)\n })\n app.post('/:hash', (_req, res) => {\n res.sendStatus(StatusCodes.NOT_FOUND)\n })\n}\n","import { asyncHandler } from '@xylabs/express'\nimport { asAddress, isDefined } from '@xylabs/sdk-js'\nimport { isModuleName } from '@xyo-network/module-model'\nimport type { Payload } from '@xyo-network/payload-model'\nimport type { RequestHandler } from 'express'\nimport { StatusCodes } from 'http-status-codes'\n\nimport type { AddressPathParams } from '../AddressPathParams.ts'\n\nconst handler: RequestHandler<AddressPathParams, Payload[]> = async (req, res, next) => {\n const { address: moduleIdentifier } = req.params\n const { node } = req.app\n const address = asAddress(moduleIdentifier)\n if (isDefined(address)) {\n let mod = node.address === address ? node : (await node.resolve(address, { direction: 'down' }))\n if (mod) {\n res.json(await mod.state())\n return\n }\n }\n if (isModuleName(moduleIdentifier)) {\n const mod = await node.resolve(moduleIdentifier, { direction: 'down' })\n if (mod) {\n res.redirect(StatusCodes.MOVED_TEMPORARILY, `/${mod.address}`)\n return\n }\n }\n next('route')\n}\nexport const getAddress = asyncHandler(handler)\n","import { asyncHandler } from '@xylabs/express'\nimport type { JsonObject } from '@xylabs/sdk-js'\nimport {\n asAddress, assertEx,\n isAddress,\n toAddress,\n} from '@xylabs/sdk-js'\nimport { isQueryBoundWitness, type QueryBoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleErrorBuilder } from '@xyo-network/module-abstract'\nimport type { ModuleInstance, ModuleQueryResult } from '@xyo-network/module-model'\nimport type { ModuleError, Payload } from '@xyo-network/payload-model'\nimport type { RequestHandler } from 'express'\nimport { StatusCodes } from 'http-status-codes'\n\nimport type { AddressPathParams } from '../AddressPathParams.ts'\nimport { getQueryConfig } from './getQueryConfig.ts'\n\ntype PostAddressRequestBody = [QueryBoundWitness, undefined | Payload[]]\n\nconst handler: RequestHandler<AddressPathParams, ModuleQueryResult | ModuleError, PostAddressRequestBody> = async (req, res, next) => {\n const returnError = (code: number, message = 'An error occurred', details?: JsonObject) => {\n const error = new ModuleErrorBuilder().message(message).details(details).build()\n res.locals.rawResponse = false\n res.status(code).json(error)\n next()\n }\n\n const { address } = req.params\n const { node } = req.app\n const [bw, payloads] = Array.isArray(req.body) ? req.body : []\n if (!isAddress(address)) {\n return returnError(StatusCodes.BAD_REQUEST, 'Missing address')\n }\n\n if (!bw) {\n return returnError(StatusCodes.BAD_REQUEST, 'Missing boundwitness')\n }\n\n if (!isQueryBoundWitness(bw)) {\n return returnError(StatusCodes.BAD_REQUEST, 'Invalid query boundwitness')\n }\n\n let modules: ModuleInstance[] = []\n const normalizedAddress = toAddress(address)\n if (node.address === normalizedAddress) modules = [node]\n else {\n const typedAddress = asAddress(address)\n const byAddress = (typedAddress === undefined) ? undefined : await node.resolve(typedAddress, { maxDepth: 10 })\n\n if (byAddress) modules = [byAddress]\n else {\n const byName = await node.resolve(address, { direction: 'down' })\n if (byName) {\n const moduleAddress = assertEx(byName?.address, () => 'Error redirecting to module by address')\n res.redirect(StatusCodes.TEMPORARY_REDIRECT, `/${moduleAddress}`)\n return\n } else {\n return returnError(StatusCodes.NOT_FOUND, 'Module not found', { address })\n }\n }\n }\n\n if (modules.length > 0) {\n const mod = modules[0]\n const queryConfig = getQueryConfig(mod, req, bw, payloads)\n try {\n const queryResult = await mod.query(bw, payloads, queryConfig)\n res.json(queryResult)\n } catch (ex) {\n return returnError(StatusCodes.INTERNAL_SERVER_ERROR, 'Query Failed', { message: (ex as Error)?.message ?? 'Unknown Error' })\n }\n } else {\n return returnError(StatusCodes.NOT_FOUND, 'Module not found', { address })\n }\n}\n\nexport const postAddress = asyncHandler(handler)\n","import type { BoundWitness, QueryBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessSchema } from '@xyo-network/boundwitness-model'\nimport type { ModuleConfig, ModuleInstance } from '@xyo-network/module-model'\nimport { ModuleConfigSchema } from '@xyo-network/module-model'\nimport type { Payload } from '@xyo-network/payload-model'\nimport type { Request } from 'express'\n\nconst DEFAULT_DEPTH = 5 as const\n\nexport const getQueryConfig = (mod: ModuleInstance, req: Request, bw: QueryBoundWitness, payloads?: Payload[]): ModuleConfig | undefined => {\n // TODO: Filter based on query addresses?\n // Recurse through payloads for nested BWs\n const nestedBwAddresses\n = payloads\n ?.flat(DEFAULT_DEPTH)\n .filter<BoundWitness>((payload): payload is BoundWitness => payload?.schema === BoundWitnessSchema)\n .map(bw => bw.addresses) ?? []\n // TODO: Do we want to end up with a list of addresses or a list of address lists?\n const addresses = [bw.addresses, ...nestedBwAddresses].filter(address => address.length > 0)\n const allowed = addresses.length > 0 ? Object.fromEntries(mod.queries.map(schema => [schema, addresses])) : {}\n const security = { allowed }\n return { schema: ModuleConfigSchema, security }\n}\n","import { setRawResponseFormat } from '@xylabs/express'\nimport { asHash, isDefined } from '@xylabs/sdk-js'\nimport type {\n ArchivistInstance,\n ArchivistNextOptions, NextOptions,\n} from '@xyo-network/archivist-model'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { NodeInstance } from '@xyo-network/node-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isAnyPayload, isSequence } from '@xyo-network/payload-model'\nimport type { Router } from 'express'\nimport express from 'express'\nimport type { Request } from 'express-serve-static-core'\n\nconst resolveArchivist = async (node: NodeInstance, archivistModuleIdentifier: ModuleIdentifier): Promise<ArchivistInstance> => {\n const mod = await node.resolve(archivistModuleIdentifier)\n return asArchivistInstance(mod, { required: true })\n}\n\nlet archivistInstance: ArchivistInstance | undefined\n\nconst getArchivist = async (node: NodeInstance, archivistModuleIdentifier: ModuleIdentifier): Promise<ArchivistInstance> => {\n if (isDefined(archivistInstance)) return archivistInstance\n archivistInstance = await resolveArchivist(node, archivistModuleIdentifier)\n return archivistInstance\n}\n\ntype ArchivistMiddlewareOptions = {\n archivistModuleIdentifier: ModuleIdentifier\n node: NodeInstance\n}\n\nexport const archivistMiddleware = (options: ArchivistMiddlewareOptions): Router => {\n const { node, archivistModuleIdentifier } = options\n const router = express.Router({ mergeParams: true })\n\n router.post('/insert', async (req, res) => {\n setRawResponseFormat(res)\n const body = Array.isArray(req.body) ? req.body : [req.body]\n const payloads = (await PayloadBuilder.hashPairs<Payload>(body)).map(p => p[0])\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const result = await archivist.insert(payloads)\n res.status(200).json(result)\n })\n\n router.get('/next', async (req: Request<Partial<NextOptions>>, res) => {\n setRawResponseFormat(res)\n const cursor = isSequence(req.query.cursor) ? req.query.cursor : undefined\n const limit = isDefined(req.query.limit) ? Number(req.query.limit) : undefined\n const open = isDefined(req.query.open) ? Boolean(req.query.open) : undefined\n const order = req.query.order === 'asc' ? 'asc' : 'desc'\n const options: ArchivistNextOptions = {\n limit, open, order, cursor,\n }\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const result = await archivist.next(options)\n res.status(200).json(result)\n })\n router.post('/next', async (req: Request<{}, {}, ArchivistNextOptions | undefined>, res) => {\n setRawResponseFormat(res)\n const options = req.body\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const result = await (isDefined(options) ? archivist.next(options) : archivist.next())\n res.status(200).json(result)\n })\n\n router.get('/get/:hash', async (req, res) => {\n setRawResponseFormat(res)\n const { hash: rawHash } = req.params\n const hash = asHash(rawHash)\n if (isDefined(hash)) {\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const [payload] = await archivist.get([hash])\n if (isAnyPayload(payload)) {\n res.json(payload)\n return\n }\n }\n res.status(400).send()\n })\n\n return router\n}\n","import type { Express } from 'express'\n\nimport { archivistMiddleware } from './archivistMiddleware.ts'\n\nexport const addDataLakeRoutes = (app: Express) => {\n const { node } = app\n const archivistModuleIdentifier = 'Chain:Finalized'\n app.use('/chain', archivistMiddleware({ node, archivistModuleIdentifier }))\n}\n","import { setRawResponseFormat } from '@xylabs/express'\nimport { assertEx } from '@xylabs/sdk-js'\nimport { NodeXyoViewer } from '@xyo-network/chain-rpc'\nimport { SimpleNetworkStakeViewer, SimpleStepRewardsByPositionViewer } from '@xyo-network/chain-viewers'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport { StepSizes } from '@xyo-network/xl1-protocol'\nimport type {\n MapType, StakedChainContextRead, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport { RewardMultipliers } from '@xyo-network/xl1-protocol-sdk'\nimport {\n NodeXyoRunner, rpcEngineFromConnection, XyoBaseConnection,\n} from '@xyo-network/xl1-rpc'\nimport { Semaphore } from 'async-mutex'\nimport type { Express } from 'express'\n\nexport const addRpcRoutes = async (\n app: Express,\n transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>,\n stakedChainContext: StakedChainContextRead,\n initRewardsCache?: boolean,\n) => {\n const { node } = app\n const runner = new NodeXyoRunner(node)\n const networkStakeViewer = await SimpleNetworkStakeViewer.create({ context: stakedChainContext })\n\n console.log('Initializing SimpleNetworkStakeViewer...')\n assertEx(await networkStakeViewer.start(), () => 'Failed to start SimpleNetworkStakeViewer')\n console.log('Initialized SimpleNetworkStakeViewer.')\n\n const viewer = await NodeXyoViewer.create({\n node,\n rewardMultipliers: RewardMultipliers,\n initRewardsCache,\n context: stakedChainContext,\n transfersSummaryContext: {\n ...stakedChainContext, stepSemaphores: StepSizes.map(() => new Semaphore(20)), summaryMap: transferSummaryMap,\n },\n })\n\n console.log('Initializing NodeXyoViewer...')\n assertEx(await viewer.start(), () => 'Failed to start NodeXyoViewer')\n console.log('Initialized NodeXyoViewer.')\n\n const stepRewardsByPositionViewer = await SimpleStepRewardsByPositionViewer.create({\n context: stakedChainContext,\n rewardMultipliers: RewardMultipliers,\n })\n\n console.log('Initializing SimpleStepRewardsByPositionViewer...')\n assertEx(await stepRewardsByPositionViewer.start(), () => 'Failed to start SimpleStepRewardsByPositionViewer')\n console.log('Initialized SimpleStepRewardsByPositionViewer.')\n\n const connection = new XyoBaseConnection({ runner, viewer })\n const engine = rpcEngineFromConnection(connection, networkStakeViewer)\n\n app.post('/rpc', (req, res) => {\n setRawResponseFormat(res)\n engine.handle(req.body, (_, rpcResponse) => {\n res.json(rpcResponse)\n })\n })\n}\n","import type { WithStorageMeta } from '@xyo-network/payload-model'\nimport type {\n MapType, StakedChainContextRead, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport type { Express } from 'express'\n\nimport { addNodeRoutes } from './address/index.ts'\nimport { addDataLakeRoutes } from './dataLake/index.ts'\nimport { addRpcRoutes } from './rpc/index.ts'\n\nexport const addRoutes = async (\n app: Express,\n transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>,\n stakedChainContext: StakedChainContextRead,\n initRewardsCache?: boolean,\n) => {\n await addRpcRoutes(app, transferSummaryMap, stakedChainContext, initRewardsCache)\n addDataLakeRoutes(app)\n addNodeRoutes(app)\n}\n","import type { Hash, Logger } from '@xylabs/sdk-js'\nimport {\n assertEx, isDefined, isString, toEthAddress,\n} from '@xylabs/sdk-js'\nimport { Account } from '@xyo-network/account'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport { boot } from '@xyo-network/bios'\nimport type { BiosExternalInterface } from '@xyo-network/bios-model'\nimport { EthereumChainStakeEvents, EthereumChainStakeViewer } from '@xyo-network/chain-ethereum'\nimport { createGenesisBlock, findMostRecentBlock } from '@xyo-network/chain-protocol'\nimport type { NodeInstance } from '@xyo-network/node-model'\nimport type { Payload, WithStorageMeta } from '@xyo-network/payload-model'\nimport { StakedXyoChainV2__factory } from '@xyo-network/typechain'\nimport { HDWallet } from '@xyo-network/wallet'\nimport type { ChainId } from '@xyo-network/xl1-protocol'\nimport type {\n Config, StakedChainContextRead, StakeViewer,\n} from '@xyo-network/xl1-protocol-sdk'\nimport { readPayloadMapFromStore, SimpleChainStakeViewer } from '@xyo-network/xl1-protocol-sdk'\n\nimport { canUseInfuraProvider, initInfuraProvider } from '../helpers/index.ts'\nimport { getNode, getTransferSummaryMap } from '../manifest/index.ts'\nimport { getApp } from './app.ts'\n\nconst hostname = '::'\n// const hostname = '0.0.0.0'\n\n// TODO: Make nodejs version of bios support round tripping mnemonic between boots\nconst getSeedPhrase = async (bios: BiosExternalInterface, config: Config, logger?: Logger): Promise<string> => {\n const storedSeedPhrase = await bios.seedPhraseStore.get('os')\n logger?.debug(`[API] Stored mnemonic: ${storedSeedPhrase}`)\n const { mnemonic } = config.api\n if (isString(storedSeedPhrase) && isString(mnemonic)) {\n logger?.warn('[API] Stored mnemonic does not match supplied. Updating stored mnemonic to supplied.')\n await bios.seedPhraseStore.set('os', mnemonic)\n } else {\n let seedPhrase: string\n if (isString(mnemonic)) {\n seedPhrase = mnemonic\n } else {\n seedPhrase = HDWallet.generateMnemonic()\n logger?.log('[API] No mnemonic provided, using random mnemonic. This is not recommended for production use.')\n logger?.log(`[API] Mnemonic: ${seedPhrase}`)\n }\n await bios.seedPhraseStore.set('os', seedPhrase)\n }\n return assertEx(await bios.seedPhraseStore.get('os'), () => 'Unable to acquire mnemonic from bios')\n}\n\ninterface GetServerContext {\n config: Config\n logger?: Logger\n node?: NodeInstance\n}\n\nasync function getStakeChainViewer(config: Config, logger?: Logger): Promise<StakeViewer> {\n if (canUseInfuraProvider(config)) {\n const provider = await initInfuraProvider(config)\n const contractAddress = assertEx(config.chain.id, () => 'Missing config.evm.chainId') as ChainId\n const contract = StakedXyoChainV2__factory.connect(toEthAddress(contractAddress), provider)\n const stakeEventsViewer = await EthereumChainStakeEvents.create({ contract, logger })\n assertEx(await stakeEventsViewer.start(), () => 'Failed to start EthereumChainStakeEvents reader')\n const stakeChainViewer = await EthereumChainStakeViewer.create({\n contract, stakeEventsViewer, logger,\n })\n assertEx(await stakeChainViewer.start(), () => 'Failed to start EthereumChainStake viewer')\n return stakeChainViewer\n } else {\n console.warn('[API] Infura configuration not found. Using SimpleChainStakeViewer with no positions. This means no staking data will be available.')\n const stakeChainViewer = await SimpleChainStakeViewer.create({ logger, positions: [] })\n assertEx(await stakeChainViewer.start(), () => 'Failed to start SimpleChainStake viewer')\n return stakeChainViewer\n }\n}\n\nexport const getServer = async (context: GetServerContext) => {\n const {\n config, logger, node,\n } = context\n const { mnemonic, port } = context.config.api\n const bios = await boot()\n const seedPhrase = isDefined(mnemonic) ? mnemonic : await getSeedPhrase(bios, config, logger)\n const wallet = await HDWallet.fromPhrase(seedPhrase)\n\n const stakeChainViewer = await getStakeChainViewer(config, logger)\n\n const nodeContext = {\n wallet, logger, config,\n }\n\n const resolvedNode: NodeInstance = node ?? await getNode(nodeContext)\n const chainArchivist = assertEx(asArchivistInstance(\n await resolvedNode.resolve('Chain:Validated'),\n { required: true },\n ), () => 'FinalizedArchivist not found in node')\n const chainMap = readPayloadMapFromStore<WithStorageMeta<Payload>>(chainArchivist)\n\n const payloads = await chainArchivist.next()\n\n if (payloads.length === 0) {\n logger?.warn('[API] No blocks found in chain archivist, creating genesis block')\n const initialProducer = await Account.random()\n const chainId = stakeChainViewer.chainId\n const block = await createGenesisBlock(initialProducer, chainId, 1_000_000n, initialProducer.address)\n await chainArchivist.insert([...block[1].flat(), block[0]])\n console.log('[API] Genesis block created and inserted into chain archivist')\n }\n\n const stakedChainContext: StakedChainContextRead = {\n chainId: stakeChainViewer.chainId,\n stake: stakeChainViewer,\n store: { chainMap },\n head: async (): Promise<[Hash, number]> => {\n const head = await findMostRecentBlock(chainArchivist)\n return [assertEx(head?._hash, () => 'No head found in chainArchivist'), head?.block ?? 0]\n },\n }\n const mods = await resolvedNode.resolve('*')\n await Promise.all(mods.map((mod) => {\n return mod.start?.() ?? (() => true)\n }))\n const transferSummaryMap = assertEx(await getTransferSummaryMap(config), () => 'Transfer Summary Map not initialized')\n const app = await getApp(resolvedNode, transferSummaryMap, stakedChainContext, config.api.initRewardsCache)\n const server = app.listen(port, hostname, () => logger?.log(`[API] Server listening at http://${hostname}:${port}`))\n server.setTimeout(20_000)\n return server\n}\n","import {\n assertEx, hexFrom, isDefined, isHex,\n} from '@xylabs/sdk-js'\nimport type { Config } from '@xyo-network/xl1-protocol-sdk'\n\nexport const canUseChainId = (config: Config): boolean => {\n return isDefined(config.evm.chainId)\n}\n\nexport const getChainId = (config: Config) => {\n const chainId = assertEx(config.evm.chainId, () => 'Missing config.evm.chainId')\n if (isHex(chainId, { prefix: true })) {\n const hex = hexFrom(chainId)\n const parsed = Number.parseInt(hex, 16)\n return parsed\n } else {\n const parsed = Number.parseInt(chainId, 10)\n return parsed\n }\n}\n","import { assertEx, isDefined } from '@xylabs/sdk-js'\nimport type { Config } from '@xyo-network/xl1-protocol-sdk'\nimport type { Provider } from 'ethers'\nimport { InfuraWebSocketProvider } from 'ethers/providers'\n\nimport { canUseChainId, getChainId } from './initChainId.ts'\n\nlet instance: Promise<InfuraWebSocketProvider> | undefined\n\nexport const initInfuraProvider = (config: Config): Promise<Provider> => {\n if (instance) return instance\n const providerConfig = getInfuraProviderConfig(config)\n instance = Promise.resolve(new InfuraWebSocketProvider(providerConfig[0], providerConfig[1]))\n return instance\n}\n\nexport const canUseInfuraProvider = (config: Config): boolean => {\n return canUseChainId(config)\n && isDefined(config.evm?.infura?.projectId)\n && isDefined(config.evm?.infura?.projectSecret)\n}\n\nexport const getInfuraProviderConfig = (config: Config) => {\n const projectId = assertEx(config.evm?.infura?.projectId, () => 'Missing config.evm.infura.projectId')\n const projectSecret = assertEx(config.evm?.infura?.projectSecret, () => 'Missing config.evm.infura.projectSecret')\n return [getChainId(config), projectId, projectSecret] as const\n}\n","import { BaseMongoSdk, type BaseMongoSdkPrivateConfig } from '@xylabs/mongo'\nimport type { Hash, Logger } from '@xylabs/sdk-js'\nimport {\n asAddress, assertEx, isDefined,\n ZERO_ADDRESS,\n} from '@xylabs/sdk-js'\nimport { MemoryArchivist } from '@xyo-network/archivist-memory'\nimport { MongoDBArchivistV2 } from '@xyo-network/archivist-mongodb'\nimport { ViewArchivist } from '@xyo-network/archivist-view'\nimport {\n AddressBalanceDivinerV2, AddressTransferDiviner, ArchivistSyncDiviner, HeadValidationDiviner,\n} from '@xyo-network/chain-modules'\nimport { MongoMap } from '@xyo-network/chain-protocol'\nimport { initTelemetry } from '@xyo-network/chain-telemetry'\nimport { AbstractModule, LoggerModuleStatusReporter } from '@xyo-network/module-abstract'\nimport { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'\nimport type { MongoDBModuleParamsV2 } from '@xyo-network/module-model-mongodb'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport { MemorySentinel } from '@xyo-network/sentinel-memory'\nimport { StepSizes } from '@xyo-network/xl1-protocol'\nimport type {\n BalancesStepSummary, Config, MapType, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport { hasMongoConfig, MemoryMap } from '@xyo-network/xl1-protocol-sdk'\nimport { Semaphore } from 'async-mutex'\n\nexport interface GetLocatorContext {\n config: Config\n logger?: Logger\n}\n\nexport async function getTransferSummaryMap(config: Config): Promise<MapType<string, WithStorageMeta<TransfersStepSummary>>> {\n const mongoConfig = config.storage?.mongo\n if (hasMongoConfig(mongoConfig)) {\n // Create the MongoDB SDK from the configuration\n const {\n connectionString: dbConnectionString, database: dbName, domain: dbDomain, password: dbPassword, username: dbUserName,\n } = mongoConfig\n const payloadSdkConfig: BaseMongoSdkPrivateConfig = {\n dbConnectionString, dbDomain, dbName, dbPassword, dbUserName,\n }\n\n const sdkTransferSummaryMap = new BaseMongoSdk<WithStorageMeta<TransfersStepSummary>>({ ...payloadSdkConfig, collection: 'transfer_summary_map' })\n const result = await MongoMap.create<MongoMap<Hash, WithStorageMeta<TransfersStepSummary>>>({\n sdk: sdkTransferSummaryMap,\n getCache: { enabled: true, maxEntries: 5000 },\n })\n assertEx(await result.start(), () => 'Failed to start transfer summary map')\n return result\n } else {\n console.warn('[API] Mongo configuration not found. Using MemoryMap for TransferSummaryMap.')\n return new MemoryMap<string, WithStorageMeta<TransfersStepSummary>>()\n }\n}\n\n/**\n * Used for retrieving a locator with the necessary modules registered for testing\n * operation of the node (entirely in memory)\n * @returns A locator with the necessary modules registered\n */\nexport const getLocator = async (context: GetLocatorContext) => {\n const { config, logger } = context\n const { otlpEndpoint } = config.telemetry?.otel ?? {}\n const { traceProvider, meterProvider } = await initTelemetry({\n attributes: {\n serviceName: 'xl1-api',\n serviceVersion: '1.0.0',\n },\n otlpEndpoint,\n metricsConfig: {\n endpoint: '/metrics',\n port: 9465,\n },\n })\n\n if (isDefined(logger)) AbstractModule.defaultLogger = logger\n const statusReporter = logger ? new LoggerModuleStatusReporter(logger) : undefined\n\n const locator = new ModuleFactoryLocator()\n let balanceSummaryMap: MapType<string, WithStorageMeta<BalancesStepSummary>> | undefined\n let transferSummaryMap = await getTransferSummaryMap(config)\n // If there's a MongoDB configuration\n const mongoConfig = config.storage?.mongo\n if (hasMongoConfig(mongoConfig)) {\n // Create the MongoDB SDK from the configuration\n const {\n connectionString: dbConnectionString, database: dbName, domain: dbDomain, password: dbPassword, username: dbUserName,\n } = mongoConfig\n const payloadSdkConfig: BaseMongoSdkPrivateConfig = {\n dbConnectionString, dbDomain, dbName, dbPassword, dbUserName,\n }\n const params: Partial<MongoDBModuleParamsV2> = {\n meterProvider, payloadSdkConfig, statusReporter, traceProvider,\n }\n // Register the MongoDB Archivist as the default\n locator.register(MongoDBArchivistV2.factory(params), undefined, true)\n\n // Use a persistent MongoMap for the summary repository if MongoDB is configured\n const sdkBalanceSummaryMap = new BaseMongoSdk<WithStorageMeta<BalancesStepSummary>>({ ...payloadSdkConfig, collection: 'balance_summary_map' })\n balanceSummaryMap = await MongoMap.create<MongoMap<Hash, WithStorageMeta<BalancesStepSummary>>>({\n sdk: sdkBalanceSummaryMap,\n getCache: { enabled: true, maxEntries: 5000 },\n })\n }\n\n locator.register(AddressBalanceDivinerV2.factory<AddressBalanceDivinerV2>({\n traceProvider, meterProvider, statusReporter, summaryMap: balanceSummaryMap, stepSemaphores: StepSizes.map(() => new Semaphore(20)),\n }))\n\n locator.register(AddressTransferDiviner.factory<AddressTransferDiviner>({\n traceProvider, meterProvider, statusReporter, summaryMap: transferSummaryMap, stepSemaphores: StepSizes.map(() => new Semaphore(20)),\n }))\n\n const chainId = isDefined(config.chain.id)\n ? assertEx(asAddress(config.chain.id), () => 'chain.id must be an Address')\n : ZERO_ADDRESS\n locator.register(HeadValidationDiviner.factory<HeadValidationDiviner>({\n traceProvider,\n meterProvider,\n statusReporter,\n chainId,\n allowedProducers: config.producer.allowlist,\n }))\n locator.register(MemoryArchivist.factory({\n traceProvider, meterProvider, statusReporter,\n }))\n locator.register(MemorySentinel.factory({\n traceProvider, meterProvider, statusReporter,\n }))\n locator.register(ViewArchivist.factory({\n traceProvider, meterProvider, statusReporter,\n }))\n locator.register(ArchivistSyncDiviner.factory({\n traceProvider, meterProvider, statusReporter,\n }))\n return locator\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { ManifestWrapper } from '@xyo-network/manifest-wrapper'\nimport type { WalletInstance } from '@xyo-network/wallet-model'\nimport type { Config } from '@xyo-network/xl1-protocol-sdk'\n\nimport { getLocator } from './getLocator.ts'\nimport { NodeManifest } from './nodeManifest.ts'\nimport { PrivateChildManifests } from './private/index.ts'\nimport { PublicChildManifestsWithMempool, PublicChildManifestsWithoutMempool } from './public/index.ts'\n\nexport interface GetNodeContext {\n config: Config\n logger?: Logger\n wallet: WalletInstance\n}\n\n/**\n * Creates a node with the xyo-chain modules registered\n * @param context The context to use for the node\n * @returns A node with the xyo-chain modules registered\n */\nexport const getNode = async (context: GetNodeContext) => {\n const { wallet, config } = context\n const { enabled: mempoolEnabled } = config.mempool\n const PublicChildManifests = mempoolEnabled ? PublicChildManifestsWithoutMempool : PublicChildManifestsWithMempool\n const locator = await getLocator(context)\n const wrapper = new ManifestWrapper(NodeManifest, wallet, locator, PublicChildManifests, PrivateChildManifests)\n const [node, ...childNodes] = await wrapper.loadNodes()\n if (childNodes?.length > 0) {\n await Promise.all(childNodes.map(childNode => node.register(childNode)))\n await Promise.all(childNodes.map(childNode => node.attach(childNode.address, true)))\n }\n return node\n}\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"44'/60'/1\",\n \"name\": \"XYOChain\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": []\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","import type { PackageManifestPayload } from '@xyo-network/manifest-model'\n\nimport node from './node.json' with { type: 'json' }\n\n/**\n * Root Node Manifest\n */\nexport const NodeManifest = node as PackageManifestPayload\n","/**\n * Private Child Manifests\n */\nexport const PrivateChildManifests = []\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"1\",\n \"name\": \"Chain\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [\n {\n \"config\": {\n \"accountPath\": \"1/1'/1'\",\n \"name\": \"Validated\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_validated\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/2'\",\n \"schema\": \"network.xyo.diviner.chain.head.validation.config\",\n \"eventSubscriptions\": [\n {\n \"sourceEvent\": \"inserted\",\n \"sourceModule\": \"Submissions\",\n \"targetModuleFunction\": \"divine\"\n }\n ],\n \"inArchivist\": \"Submissions\",\n \"outArchivist\": \"Validated\",\n \"name\": \"HeadValidationDiviner\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/3'\",\n \"automations\": [\n {\n \"frequency\": 1000,\n \"frequencyUnits\": \"millis\",\n \"schema\": \"network.xyo.automation.interval\",\n \"type\": \"interval\"\n }\n ],\n \"name\": \"ChainValidationSentinel\",\n \"schema\": \"network.xyo.sentinel.config\",\n \"synchronous\": true,\n \"tasks\": [\n {\n \"mod\": \"HeadValidationDiviner\",\n \"endPoint\": \"divine\"\n }\n ]\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/4'\",\n \"automations\": [\n {\n \"frequency\": 10000,\n \"frequencyUnits\": \"millis\",\n \"schema\": \"network.xyo.automation.interval\",\n \"type\": \"interval\"\n }\n ],\n \"name\": \"AddressBalancePollingSentinel\",\n \"schema\": \"network.xyo.sentinel.config\",\n \"synchronous\": true,\n \"tasks\": [\n {\n \"mod\": \"AddressBalanceDiviner\",\n \"endPoint\": \"divine\"\n }\n ]\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/5'\",\n \"automations\": [\n {\n \"frequency\": 10000,\n \"frequencyUnits\": \"millis\",\n \"schema\": \"network.xyo.automation.interval\",\n \"type\": \"interval\"\n }\n ],\n \"name\": \"AddressTransferPollingSentinel\",\n \"schema\": \"network.xyo.sentinel.config\",\n \"synchronous\": true,\n \"tasks\": [\n {\n \"mod\": \"AddressTransferDiviner\",\n \"endPoint\": \"divine\"\n }\n ]\n }\n }\n ],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"1/1/1\",\n \"name\": \"Submissions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_submissions\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/2\",\n \"name\": \"Finalized\",\n \"allowedQueries\": [\n \"network.xyo.query.archivist.get\",\n \"network.xyo.query.archivist.next\"\n ],\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 50000\n },\n \"originArchivist\": \"Validated\",\n \"schema\": \"network.xyo.archivist.view.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/3'\",\n \"name\": \"AddressBalanceDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.balance.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_balance\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/4'\",\n \"name\": \"AddressTransferDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.transfer.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_transfer\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"2\",\n \"name\": \"Pending\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"2/1/1\",\n \"name\": \"PendingTransactions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"labels\": {\n \"network.xyo.storage.class\": \"mongodb\"\n },\n \"payloadSdkConfig\": {\n \"collection\": \"pending_bundles\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","import type { ModuleManifest, PackageManifestPayload } from '@xyo-network/manifest-model'\n\nimport Chain from './Chain.json' with { type: 'json' }\nimport Pending from './Pending.json' with { type: 'json' }\n\n/**\n * Chain Node Manifest\n */\nconst ChainNodeManifest = Chain as PackageManifestPayload\n/**\n * Pending Node Manifest\n */\nconst PendingNodeManifest = Pending as PackageManifestPayload\n/**\n * Public Child Manifests\n */\nexport const PublicChildManifestsWithMempool: ModuleManifest[] = [\n ...ChainNodeManifest.nodes,\n ...PendingNodeManifest.nodes,\n]\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"1\",\n \"name\": \"Chain\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [\n {\n \"config\": {\n \"accountPath\": \"1/1'/1'\",\n \"name\": \"Validated\",\n \"allowedQueries\": [\n \"network.xyo.query.archivist.get\",\n \"network.xyo.query.archivist.next\"\n ],\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_validated\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"1/1/1\",\n \"name\": \"Submissions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_submissions\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/2\",\n \"name\": \"Finalized\",\n \"allowedQueries\": [\n \"network.xyo.query.archivist.get\",\n \"network.xyo.query.archivist.next\"\n ],\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 50000\n },\n \"originArchivist\": \"Validated\",\n \"schema\": \"network.xyo.archivist.view.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/3'\",\n \"name\": \"AddressBalanceDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.balance.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_balance\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/4'\",\n \"name\": \"AddressTransferDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.transfer.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_transfer\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"2\",\n \"name\": \"Pending\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"2/1/1\",\n \"name\": \"PendingTransactions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"labels\": {\n \"network.xyo.storage.class\": \"mongodb\"\n },\n \"payloadSdkConfig\": {\n \"collection\": \"pending_bundles\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","import type { ModuleManifest, PackageManifestPayload } from '@xyo-network/manifest-model'\n\nimport Chain from './Chain.json' with { type: 'json' }\nimport Pending from './Pending.json' with { type: 'json' }\n\n/**\n * Chain Node Manifest\n */\n const ChainNodeManifest = Chain as PackageManifestPayload\n/**\n * Pending Node Manifest\n */\n const PendingNodeManifest = Pending as PackageManifestPayload\n/**\n * Public Child Manifests\n */\nexport const PublicChildManifestsWithoutMempool: ModuleManifest[] = [\n ...ChainNodeManifest.nodes,\n ...PendingNodeManifest.nodes,\n]\n"],"mappings":";;;;AAAA,SACEA,uBACAC,6BACAC,sCACAC,mBACAC,0BACAC,kBACAC,gB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egB,OAAO;SAAIH,MAAM,CAAA,EAAGI,KAAI;MAAIJ,MAAM,CAAA;KAAG;AAC1D3B,YAAQnB,IAAI,+DAAA;EACd;AAEA,QAAMmD,qBAA6C;IACjDN,SAAS5B,iBAAiB4B;IAC1BO,OAAOnC;IACPoC,OAAO;MAAEhB;IAAS;IAClBiB,MAAM,mCAAA;AACJ,YAAMA,OAAO,MAAMC,oBAAoBtB,cAAAA;AACvC,aAAO;QAAChC,UAASqD,MAAME,OAAO,MAAM,iCAAA;QAAoCF,MAAMR,SAAS;;IACzF,GAHM;EAIR;AACA,QAAMW,OAAO,MAAM1B,aAAaI,QAAQ,GAAA;AACxC,QAAMuB,QAAQC,IAAIF,KAAKG,IAAI,CAACC,QAAAA;AAC1B,WAAOA,IAAI7C,QAAK,MAAS,MAAM;EACjC,CAAA,CAAA;AACA,QAAM8C,qBAAqB7D,UAAS,MAAM8D,sBAAsB7E,MAAAA,GAAS,MAAM,sCAAA;AAC/E,QAAM8E,MAAM,MAAMC,OAAOlC,cAAc+B,oBAAoBX,oBAAoBjE,OAAOO,IAAIyE,gBAAgB;AAC1G,QAAMC,SAASH,IAAII,OAAO3C,MAAM1C,UAAU,MAAMI,QAAQa,IAAI,oCAAoCjB,QAAAA,IAAY0C,IAAAA,EAAM,CAAA;AAClH0C,SAAOE,WAAW,GAAA;AAClB,SAAOF;AACT,GAnDyB;","names":["customPoweredByHeader","disableCaseSensitiveRouting","disableExpressDefaultPoweredByHeader","getJsonBodyParser","getJsonBodyParserOptions","responseProfiler","standardErrors","standardResponses","compression","cors","express","registerInstrumentations","ExpressInstrumentation","HttpInstrumentation","addInstrumentation","instrumentations","HttpInstrumentation","ExpressInstrumentation","registerInstrumentations","StatusCodes","asyncHandler","asAddress","isDefined","isModuleName","StatusCodes","handler","req","res","next","address","moduleIdentifier","params","node","app","asAddress","isDefined","mod","resolve","direction","json","state","isModuleName","redirect","StatusCodes","MOVED_TEMPORARILY","getAddress","asyncHandler","asyncHandler","asAddress","assertEx","isAddress","toAddress","isQueryBoundWitness","ModuleErrorBuilder","StatusCodes","BoundWitnessSchema","ModuleConfigSchema","DEFAULT_DEPTH","getQueryConfig","mod","req","bw","payloads","nestedBwAddresses","flat","filter","payload","schema","BoundWitnessSchema","map","addresses","address","length","allowed","Object","fromEntries","queries","security","ModuleConfigSchema","handler","req","res","next","returnError","code","message","details","error","ModuleErrorBuilder","build","locals","rawResponse","status","json","address","params","node","app","bw","payloads","Array","isArray","body","isAddress","StatusCodes","BAD_REQUEST","isQueryBoundWitness","modules","normalizedAddress","toAddress","typedAddress","asAddress","byAddress","undefined","resolve","maxDepth","byName","direction","moduleAddress","assertEx","redirect","TEMPORARY_REDIRECT","NOT_FOUND","length","mod","queryConfig","getQueryConfig","queryResult","query","ex","INTERNAL_SERVER_ERROR","postAddress","asyncHandler","addNodeRoutes","app","defaultModule","node","address","defaultModuleEndpoint","get","_req","res","redirect","StatusCodes","MOVED_TEMPORARILY","post","TEMPORARY_REDIRECT","getAddress","postAddress","sendStatus","NOT_FOUND","setRawResponseFormat","asHash","isDefined","asArchivistInstance","PayloadBuilder","isAnyPayload","isSequence","express","resolveArchivist","node","archivistModuleIdentifier","mod","resolve","asArchivistInstance","required","archivistInstance","getArchivist","isDefined","archivistMiddleware","options","router","express","Router","mergeParams","post","req","res","setRawResponseFormat","body","Array","isArray","payloads","PayloadBuilder","hashPairs","map","p","archivist","result","insert","status","json","get","cursor","isSequence","query","undefined","limit","Number","open","Boolean","order","next","hash","rawHash","params","asHash","payload","isAnyPayload","send","addDataLakeRoutes","app","node","archivistModuleIdentifier","use","archivistMiddleware","setRawResponseFormat","assertEx","NodeXyoViewer","SimpleNetworkStakeViewer","SimpleStepRewardsByPositionViewer","StepSizes","RewardMultipliers","NodeXyoRunner","rpcEngineFromConnection","XyoBaseConnection","Semaphore","addRpcRoutes","app","transferSummaryMap","stakedChainContext","initRewardsCache","node","runner","NodeXyoRunner","networkStakeViewer","SimpleNetworkStakeViewer","create","context","console","log","assertEx","start","viewer","NodeXyoViewer","rewardMultipliers","RewardMultipliers","transfersSummaryContext","stepSemaphores","StepSizes","map","Semaphore","summaryMap","stepRewardsByPositionViewer","SimpleStepRewardsByPositionViewer","connection","XyoBaseConnection","engine","rpcEngineFromConnection","post","req","res","setRawResponseFormat","handle","body","_","rpcResponse","json","addRoutes","app","transferSummaryMap","stakedChainContext","initRewardsCache","addRpcRoutes","addDataLakeRoutes","addNodeRoutes","getApp","node","transferSummaryMap","stakedChainContext","initRewardsCache","addInstrumentation","app","express","set","use","cors","compression","responseProfiler","getJsonBodyParser","getJsonBodyParserOptions","limit","standardResponses","disableExpressDefaultPoweredByHeader","customPoweredByHeader","disableCaseSensitiveRouting","addRoutes","standardErrors","assertEx","isDefined","isString","toEthAddress","Account","asArchivistInstance","boot","EthereumChainStakeEvents","EthereumChainStakeViewer","createGenesisBlock","findMostRecentBlock","StakedXyoChainV2__factory","HDWallet","readPayloadMapFromStore","SimpleChainStakeViewer","assertEx","hexFrom","isDefined","isHex","canUseChainId","config","isDefined","evm","chainId","getChainId","assertEx","isHex","prefix","hex","hexFrom","parsed","Number","parseInt","assertEx","isDefined","InfuraWebSocketProvider","instance","initInfuraProvider","config","providerConfig","getInfuraProviderConfig","Promise","resolve","InfuraWebSocketProvider","canUseInfuraProvider","canUseChainId","isDefined","evm","infura","projectId","projectSecret","assertEx","getChainId","BaseMongoSdk","asAddress","assertEx","isDefined","ZERO_ADDRESS","MemoryArchivist","MongoDBArchivistV2","ViewArchivist","AddressBalanceDivinerV2","AddressTransferDiviner","ArchivistSyncDiviner","HeadValidationDiviner","MongoMap","initTelemetry","AbstractModule","LoggerModuleStatusReporter","ModuleFactoryLocator","MemorySentinel","StepSizes","hasMongoConfig","MemoryMap","Semaphore","getTransferSummaryMap","config","mongoConfig","storage","mongo","hasMongoConfig","connectionString","dbConnectionString","database","dbName","domain","dbDomain","password","dbPassword","username","dbUserName","payloadSdkConfig","sdkTransferSummaryMap","BaseMongoSdk","collection","result","MongoMap","create","sdk","getCache","enabled","maxEntries","assertEx","start","console","warn","MemoryMap","getLocator","context","logger","otlpEndpoint","telemetry","otel","traceProvider","meterProvider","initTelemetry","attributes","serviceName","serviceVersion","metricsConfig","endpoint","port","isDefined","AbstractModule","defaultLogger","statusReporter","LoggerModuleStatusReporter","undefined","locator","ModuleFactoryLocator","balanceSummaryMap","transferSummaryMap","params","register","MongoDBArchivistV2","factory","sdkBalanceSummaryMap","AddressBalanceDivinerV2","summaryMap","stepSemaphores","StepSizes","map","Semaphore","AddressTransferDiviner","chainId","chain","id","asAddress","ZERO_ADDRESS","HeadValidationDiviner","allowedProducers","producer","allowlist","MemoryArchivist","MemorySentinel","ViewArchivist","ArchivistSyncDiviner","ManifestWrapper","NodeManifest","node","PrivateChildManifests","ChainNodeManifest","Chain","PendingNodeManifest","Pending","PublicChildManifestsWithMempool","nodes","Chain_default","Pending_default","ChainNodeManifest","Chain","PendingNodeManifest","Pending","PublicChildManifestsWithoutMempool","nodes","getNode","context","wallet","config","enabled","mempoolEnabled","mempool","PublicChildManifests","PublicChildManifestsWithoutMempool","PublicChildManifestsWithMempool","locator","getLocator","wrapper","ManifestWrapper","NodeManifest","PrivateChildManifests","node","childNodes","loadNodes","length","Promise","all","map","childNode","register","attach","address","hostname","getSeedPhrase","bios","config","logger","storedSeedPhrase","seedPhraseStore","get","debug","mnemonic","api","isString","warn","set","seedPhrase","HDWallet","generateMnemonic","log","assertEx","getStakeChainViewer","canUseInfuraProvider","provider","initInfuraProvider","contractAddress","chain","id","contract","StakedXyoChainV2__factory","connect","toEthAddress","stakeEventsViewer","EthereumChainStakeEvents","create","start","stakeChainViewer","EthereumChainStakeViewer","console","SimpleChainStakeViewer","positions","getServer","context","node","port","boot","isDefined","wallet","fromPhrase","nodeContext","resolvedNode","getNode","chainArchivist","asArchivistInstance","resolve","required","chainMap","readPayloadMapFromStore","payloads","next","length","initialProducer","Account","random","chainId","block","createGenesisBlock","address","insert","flat","stakedChainContext","stake","store","head","findMostRecentBlock","_hash","mods","Promise","all","map","mod","transferSummaryMap","getTransferSummaryMap","app","getApp","initRewardsCache","server","listen","setTimeout"]}
|
|
1
|
+
{"version":3,"sources":["../../src/server/app.ts","../../src/server/instrumentation.ts","../../src/server/routes/address/addNodeRoutes.ts","../../src/server/routes/address/get/get.ts","../../src/server/routes/address/post/post.ts","../../src/server/routes/address/post/getQueryConfig.ts","../../src/server/routes/dataLake/archivistMiddleware.ts","../../src/server/routes/dataLake/addDataLakeRoutes.ts","../../src/server/routes/rpc/routes/addRpcRoutes.ts","../../src/server/routes/addRoutes.ts","../../src/server/server.ts","../../src/manifest/getLocator.ts","../../src/manifest/getNode.ts","../../src/manifest/node.json","../../src/manifest/nodeManifest.ts","../../src/manifest/private/index.ts","../../src/manifest/public/WithMempool/Chain.json","../../src/manifest/public/WithMempool/Pending.json","../../src/manifest/public/WithMempool/index.ts","../../src/manifest/public/WithoutMempool/Chain.json","../../src/manifest/public/WithoutMempool/Pending.json","../../src/manifest/public/WithoutMempool/index.ts"],"sourcesContent":["import {\n customPoweredByHeader,\n disableCaseSensitiveRouting,\n disableExpressDefaultPoweredByHeader,\n getJsonBodyParser,\n getJsonBodyParserOptions,\n responseProfiler,\n standardErrors,\n standardResponses,\n} from '@xylabs/express'\nimport type { NodeInstance } from '@xyo-network/node-model'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport type {\n MapType, StakedChainContextRead, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport compression from 'compression'\nimport cors from 'cors'\nimport type { Express } from 'express'\nimport express from 'express'\n\nimport { addInstrumentation } from './instrumentation.ts'\nimport { addRoutes } from './routes/index.ts'\n\nexport const getApp = async (\n node: NodeInstance,\n transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>,\n stakedChainContext: StakedChainContextRead,\n initRewardsCache?: boolean,\n): Promise<Express> => {\n addInstrumentation()\n const app = express()\n app.set('etag', false)\n\n app.use(cors())\n app.use(compression())\n app.use(responseProfiler)\n app.use(getJsonBodyParser(getJsonBodyParserOptions({ limit: '1mb' })))\n app.use(standardResponses)\n disableExpressDefaultPoweredByHeader(app)\n app.use(customPoweredByHeader)\n disableCaseSensitiveRouting(app)\n app.node = node\n await addRoutes(app, transferSummaryMap, stakedChainContext, initRewardsCache)\n app.use(standardErrors)\n return app\n}\n","import { registerInstrumentations } from '@opentelemetry/instrumentation'\nimport { ExpressInstrumentation } from '@opentelemetry/instrumentation-express'\nimport { HttpInstrumentation } from '@opentelemetry/instrumentation-http'\n\n/**\n * Registers OpenTelemetry instrumentations for HTTP and Express.\n * This function is used to set up the necessary instrumentations for monitoring\n * HTTP requests and Express applications. Since it monkey patches the Express\n * router & middleware system, it should be called before any Express applications\n * are defined.\n */\nexport const addInstrumentation = () => {\n const instrumentations = [new HttpInstrumentation(), new ExpressInstrumentation()]\n registerInstrumentations({ instrumentations })\n}\n","import type { Express } from 'express'\nimport { StatusCodes } from 'http-status-codes'\n\nimport { getAddress } from './get/index.ts'\nimport { postAddress } from './post/index.ts'\n\nexport const addNodeRoutes = (app: Express) => {\n const defaultModule = app.node\n const address = defaultModule.address\n const defaultModuleEndpoint = `/${address}`\n app.get('/', (_req, res) => res.redirect(StatusCodes.MOVED_TEMPORARILY, defaultModuleEndpoint))\n app.post('/', (_req, res) => res.redirect(StatusCodes.TEMPORARY_REDIRECT, defaultModuleEndpoint))\n app.get('/:address', getAddress)\n app.post('/:address', postAddress)\n app.get('/:hash', (_req, res) => {\n res.sendStatus(StatusCodes.NOT_FOUND)\n })\n app.post('/:hash', (_req, res) => {\n res.sendStatus(StatusCodes.NOT_FOUND)\n })\n}\n","import { asyncHandler } from '@xylabs/express'\nimport { asAddress, isDefined } from '@xylabs/sdk-js'\nimport { isModuleName } from '@xyo-network/module-model'\nimport type { Payload } from '@xyo-network/payload-model'\nimport type { RequestHandler } from 'express'\nimport { StatusCodes } from 'http-status-codes'\n\nimport type { AddressPathParams } from '../AddressPathParams.ts'\n\nconst handler: RequestHandler<AddressPathParams, Payload[]> = async (req, res, next) => {\n const { address: moduleIdentifier } = req.params\n const { node } = req.app\n const address = asAddress(moduleIdentifier)\n if (isDefined(address)) {\n let mod = node.address === address ? node : (await node.resolve(address, { direction: 'down' }))\n if (mod) {\n res.json(await mod.state())\n return\n }\n }\n if (isModuleName(moduleIdentifier)) {\n const mod = await node.resolve(moduleIdentifier, { direction: 'down' })\n if (mod) {\n res.redirect(StatusCodes.MOVED_TEMPORARILY, `/${mod.address}`)\n return\n }\n }\n next('route')\n}\nexport const getAddress = asyncHandler(handler)\n","import { asyncHandler } from '@xylabs/express'\nimport type { JsonObject } from '@xylabs/sdk-js'\nimport {\n asAddress, assertEx,\n isAddress,\n toAddress,\n} from '@xylabs/sdk-js'\nimport { isQueryBoundWitness, type QueryBoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleErrorBuilder } from '@xyo-network/module-abstract'\nimport type { ModuleInstance, ModuleQueryResult } from '@xyo-network/module-model'\nimport type { ModuleError, Payload } from '@xyo-network/payload-model'\nimport type { RequestHandler } from 'express'\nimport { StatusCodes } from 'http-status-codes'\n\nimport type { AddressPathParams } from '../AddressPathParams.ts'\nimport { getQueryConfig } from './getQueryConfig.ts'\n\ntype PostAddressRequestBody = [QueryBoundWitness, undefined | Payload[]]\n\nconst handler: RequestHandler<AddressPathParams, ModuleQueryResult | ModuleError, PostAddressRequestBody> = async (req, res, next) => {\n const returnError = (code: number, message = 'An error occurred', details?: JsonObject) => {\n const error = new ModuleErrorBuilder().message(message).details(details).build()\n res.locals.rawResponse = false\n res.status(code).json(error)\n next()\n }\n\n const { address } = req.params\n const { node } = req.app\n const [bw, payloads] = Array.isArray(req.body) ? req.body : []\n if (!isAddress(address)) {\n return returnError(StatusCodes.BAD_REQUEST, 'Missing address')\n }\n\n if (!bw) {\n return returnError(StatusCodes.BAD_REQUEST, 'Missing boundwitness')\n }\n\n if (!isQueryBoundWitness(bw)) {\n return returnError(StatusCodes.BAD_REQUEST, 'Invalid query boundwitness')\n }\n\n let modules: ModuleInstance[] = []\n const normalizedAddress = toAddress(address)\n if (node.address === normalizedAddress) modules = [node]\n else {\n const typedAddress = asAddress(address)\n const byAddress = (typedAddress === undefined) ? undefined : await node.resolve(typedAddress, { maxDepth: 10 })\n\n if (byAddress) modules = [byAddress]\n else {\n const byName = await node.resolve(address, { direction: 'down' })\n if (byName) {\n const moduleAddress = assertEx(byName?.address, () => 'Error redirecting to module by address')\n res.redirect(StatusCodes.TEMPORARY_REDIRECT, `/${moduleAddress}`)\n return\n } else {\n return returnError(StatusCodes.NOT_FOUND, 'Module not found', { address })\n }\n }\n }\n\n if (modules.length > 0) {\n const mod = modules[0]\n const queryConfig = getQueryConfig(mod, req, bw, payloads)\n try {\n const queryResult = await mod.query(bw, payloads, queryConfig)\n res.json(queryResult)\n } catch (ex) {\n return returnError(StatusCodes.INTERNAL_SERVER_ERROR, 'Query Failed', { message: (ex as Error)?.message ?? 'Unknown Error' })\n }\n } else {\n return returnError(StatusCodes.NOT_FOUND, 'Module not found', { address })\n }\n}\n\nexport const postAddress = asyncHandler(handler)\n","import type { BoundWitness, QueryBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessSchema } from '@xyo-network/boundwitness-model'\nimport type { ModuleConfig, ModuleInstance } from '@xyo-network/module-model'\nimport { ModuleConfigSchema } from '@xyo-network/module-model'\nimport type { Payload } from '@xyo-network/payload-model'\nimport type { Request } from 'express'\n\nconst DEFAULT_DEPTH = 5 as const\n\nexport const getQueryConfig = (mod: ModuleInstance, req: Request, bw: QueryBoundWitness, payloads?: Payload[]): ModuleConfig | undefined => {\n // TODO: Filter based on query addresses?\n // Recurse through payloads for nested BWs\n const nestedBwAddresses\n = payloads\n ?.flat(DEFAULT_DEPTH)\n .filter<BoundWitness>((payload): payload is BoundWitness => payload?.schema === BoundWitnessSchema)\n .map(bw => bw.addresses) ?? []\n // TODO: Do we want to end up with a list of addresses or a list of address lists?\n const addresses = [bw.addresses, ...nestedBwAddresses].filter(address => address.length > 0)\n const allowed = addresses.length > 0 ? Object.fromEntries(mod.queries.map(schema => [schema, addresses])) : {}\n const security = { allowed }\n return { schema: ModuleConfigSchema, security }\n}\n","import { setRawResponseFormat } from '@xylabs/express'\nimport { asHash, isDefined } from '@xylabs/sdk-js'\nimport type {\n ArchivistInstance,\n ArchivistNextOptions, NextOptions,\n} from '@xyo-network/archivist-model'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { NodeInstance } from '@xyo-network/node-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isAnyPayload, isSequence } from '@xyo-network/payload-model'\nimport type { Router } from 'express'\nimport express from 'express'\nimport type { Request } from 'express-serve-static-core'\n\nconst resolveArchivist = async (node: NodeInstance, archivistModuleIdentifier: ModuleIdentifier): Promise<ArchivistInstance> => {\n const mod = await node.resolve(archivistModuleIdentifier)\n return asArchivistInstance(mod, { required: true })\n}\n\nlet archivistInstance: ArchivistInstance | undefined\n\nconst getArchivist = async (node: NodeInstance, archivistModuleIdentifier: ModuleIdentifier): Promise<ArchivistInstance> => {\n if (isDefined(archivistInstance)) return archivistInstance\n archivistInstance = await resolveArchivist(node, archivistModuleIdentifier)\n return archivistInstance\n}\n\ntype ArchivistMiddlewareOptions = {\n archivistModuleIdentifier: ModuleIdentifier\n node: NodeInstance\n}\n\nexport const archivistMiddleware = (options: ArchivistMiddlewareOptions): Router => {\n const { node, archivistModuleIdentifier } = options\n const router = express.Router({ mergeParams: true })\n\n router.post('/insert', async (req, res) => {\n setRawResponseFormat(res)\n const body = Array.isArray(req.body) ? req.body : [req.body]\n const payloads = (await PayloadBuilder.hashPairs<Payload>(body)).map(p => p[0])\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const result = await archivist.insert(payloads)\n res.status(200).json(result)\n })\n\n router.get('/next', async (req: Request<Partial<NextOptions>>, res) => {\n setRawResponseFormat(res)\n const cursor = isSequence(req.query.cursor) ? req.query.cursor : undefined\n const limit = isDefined(req.query.limit) ? Number(req.query.limit) : undefined\n const open = isDefined(req.query.open) ? Boolean(req.query.open) : undefined\n const order = req.query.order === 'asc' ? 'asc' : 'desc'\n const options: ArchivistNextOptions = {\n limit, open, order, cursor,\n }\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const result = await archivist.next(options)\n res.status(200).json(result)\n })\n router.post('/next', async (req: Request<{}, {}, ArchivistNextOptions | undefined>, res) => {\n setRawResponseFormat(res)\n const options = req.body\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const result = await (isDefined(options) ? archivist.next(options) : archivist.next())\n res.status(200).json(result)\n })\n\n router.get('/get/:hash', async (req, res) => {\n setRawResponseFormat(res)\n const { hash: rawHash } = req.params\n const hash = asHash(rawHash)\n if (isDefined(hash)) {\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const [payload] = await archivist.get([hash])\n if (isAnyPayload(payload)) {\n res.json(payload)\n return\n }\n }\n res.status(400).send()\n })\n\n return router\n}\n","import type { Express } from 'express'\n\nimport { archivistMiddleware } from './archivistMiddleware.ts'\n\nexport const addDataLakeRoutes = (app: Express) => {\n const { node } = app\n const archivistModuleIdentifier = 'Chain:Finalized'\n app.use('/chain', archivistMiddleware({ node, archivistModuleIdentifier }))\n}\n","import { setRawResponseFormat } from '@xylabs/express'\nimport { assertEx } from '@xylabs/sdk-js'\nimport { NodeXyoViewer } from '@xyo-network/chain-rpc'\nimport { SimpleNetworkStakeViewer, SimpleStepRewardsByPositionViewer } from '@xyo-network/chain-viewers'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport { StepSizes } from '@xyo-network/xl1-protocol'\nimport type {\n MapType, StakedChainContextRead, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport { RewardMultipliers } from '@xyo-network/xl1-protocol-sdk'\nimport {\n NodeXyoRunner, rpcEngineFromConnection, XyoBaseConnection,\n} from '@xyo-network/xl1-rpc'\nimport { Semaphore } from 'async-mutex'\nimport type { Express } from 'express'\n\nexport const addRpcRoutes = async (\n app: Express,\n transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>,\n stakedChainContext: StakedChainContextRead,\n initRewardsCache?: boolean,\n) => {\n const { node } = app\n const runner = new NodeXyoRunner(node)\n const networkStakeViewer = await SimpleNetworkStakeViewer.create({ context: stakedChainContext })\n\n console.log('Initializing SimpleNetworkStakeViewer...')\n assertEx(await networkStakeViewer.start(), () => 'Failed to start SimpleNetworkStakeViewer')\n console.log('Initialized SimpleNetworkStakeViewer.')\n\n const viewer = await NodeXyoViewer.create({\n node,\n rewardMultipliers: RewardMultipliers,\n initRewardsCache,\n context: stakedChainContext,\n transfersSummaryContext: {\n ...stakedChainContext, stepSemaphores: StepSizes.map(() => new Semaphore(20)), summaryMap: transferSummaryMap,\n },\n })\n\n console.log('Initializing NodeXyoViewer...')\n assertEx(await viewer.start(), () => 'Failed to start NodeXyoViewer')\n console.log('Initialized NodeXyoViewer.')\n\n const stepRewardsByPositionViewer = await SimpleStepRewardsByPositionViewer.create({\n context: stakedChainContext,\n rewardMultipliers: RewardMultipliers,\n })\n\n console.log('Initializing SimpleStepRewardsByPositionViewer...')\n assertEx(await stepRewardsByPositionViewer.start(), () => 'Failed to start SimpleStepRewardsByPositionViewer')\n console.log('Initialized SimpleStepRewardsByPositionViewer.')\n\n const connection = new XyoBaseConnection({ runner, viewer })\n const engine = rpcEngineFromConnection(connection, networkStakeViewer)\n\n app.post('/rpc', (req, res) => {\n setRawResponseFormat(res)\n engine.handle(req.body, (_, rpcResponse) => {\n res.json(rpcResponse)\n })\n })\n}\n","import type { WithStorageMeta } from '@xyo-network/payload-model'\nimport type {\n MapType, StakedChainContextRead, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport type { Express } from 'express'\n\nimport { addNodeRoutes } from './address/index.ts'\nimport { addDataLakeRoutes } from './dataLake/index.ts'\nimport { addRpcRoutes } from './rpc/index.ts'\n\nexport const addRoutes = async (\n app: Express,\n transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>,\n stakedChainContext: StakedChainContextRead,\n initRewardsCache?: boolean,\n) => {\n await addRpcRoutes(app, transferSummaryMap, stakedChainContext, initRewardsCache)\n addDataLakeRoutes(app)\n addNodeRoutes(app)\n}\n","import type { Hash, Logger } from '@xylabs/sdk-js'\nimport {\n assertEx, isDefined, isString,\n} from '@xylabs/sdk-js'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport { boot } from '@xyo-network/bios'\nimport type { BiosExternalInterface } from '@xyo-network/bios-model'\nimport {\n createProducerChainStakeIntentBlock, initChainStakeViewer, initProducerAccount,\n} from '@xyo-network/chain-orchestration'\nimport { createGenesisBlock, findMostRecentBlock } from '@xyo-network/chain-protocol'\nimport type { NodeInstance } from '@xyo-network/node-model'\nimport type { Payload, WithStorageMeta } from '@xyo-network/payload-model'\nimport { HDWallet } from '@xyo-network/wallet'\nimport { asXL1BlockRange } from '@xyo-network/xl1-protocol'\nimport type { Config, StakedChainContextRead } from '@xyo-network/xl1-protocol-sdk'\nimport { readPayloadMapFromStore } from '@xyo-network/xl1-protocol-sdk'\n\nimport { getNode, getTransferSummaryMap } from '../manifest/index.ts'\nimport { getApp } from './app.ts'\n\nconst hostname = '::'\n// const hostname = '0.0.0.0'\n\n// TODO: Make nodejs version of bios support round tripping mnemonic between boots\nconst getSeedPhrase = async (bios: BiosExternalInterface, config: Config, logger?: Logger): Promise<string> => {\n const storedSeedPhrase = await bios.seedPhraseStore.get('os')\n logger?.debug(`[API] Stored mnemonic: ${storedSeedPhrase}`)\n const { mnemonic } = config.api\n if (isString(storedSeedPhrase) && isString(mnemonic)) {\n logger?.warn('[API] Stored mnemonic does not match supplied. Updating stored mnemonic to supplied.')\n await bios.seedPhraseStore.set('os', mnemonic)\n } else {\n let seedPhrase: string\n if (isString(mnemonic)) {\n seedPhrase = mnemonic\n } else {\n seedPhrase = HDWallet.generateMnemonic()\n logger?.log('[API] No mnemonic provided, using random mnemonic. This is not recommended for production use.')\n logger?.log(`[API] Mnemonic: ${seedPhrase}`)\n }\n await bios.seedPhraseStore.set('os', seedPhrase)\n }\n return assertEx(await bios.seedPhraseStore.get('os'), () => 'Unable to acquire mnemonic from bios')\n}\n\ninterface GetServerContext {\n config: Config\n logger?: Logger\n node?: NodeInstance\n}\n\nexport const getServer = async (context: GetServerContext) => {\n const {\n config, logger, node,\n } = context\n const { mnemonic, port } = context.config.api\n const bios = await boot()\n const seedPhrase = isDefined(mnemonic) ? mnemonic : await getSeedPhrase(bios, config, logger)\n const wallet = await HDWallet.fromPhrase(seedPhrase)\n\n const stakeChainViewer = await initChainStakeViewer(config, logger)\n\n const nodeContext = {\n wallet, logger, config,\n }\n\n const resolvedNode: NodeInstance = node ?? await getNode(nodeContext)\n const chainArchivist = assertEx(asArchivistInstance(\n await resolvedNode.resolve('Chain:Validated'),\n { required: true },\n ), () => 'FinalizedArchivist not found in node')\n const chainMap = readPayloadMapFromStore<WithStorageMeta<Payload>>(chainArchivist)\n\n const payloads = await chainArchivist.next()\n\n if (payloads.length === 0) {\n logger?.warn('[API] No blocks found in chain archivist, creating genesis block')\n const producerAccount = await initProducerAccount({ config, logger })\n const chainId = stakeChainViewer.chainId\n const block0 = await createGenesisBlock(producerAccount, chainId, 1_000_000n, producerAccount.address)\n await chainArchivist.insert([...block0[1].flat(), block0[0]])\n console.log('[API] Genesis block created and inserted into chain archivist')\n const block1 = await createProducerChainStakeIntentBlock(block0[0], producerAccount, asXL1BlockRange([0, 10_000], true))\n await chainArchivist.insert([...block1[1].flat(), block1[0]])\n console.log(`[API] Producer declared: ${producerAccount.address}`)\n }\n\n const stakedChainContext: StakedChainContextRead = {\n chainId: stakeChainViewer.chainId,\n stake: stakeChainViewer,\n store: { chainMap },\n head: async (): Promise<[Hash, number]> => {\n const head = await findMostRecentBlock(chainArchivist)\n return [assertEx(head?._hash, () => 'No head found in chainArchivist'), head?.block ?? 0]\n },\n }\n const mods = await resolvedNode.resolve('*')\n await Promise.all(mods.map((mod) => {\n return mod.start?.() ?? (() => true)\n }))\n const transferSummaryMap = assertEx(await getTransferSummaryMap(config), () => 'Transfer Summary Map not initialized')\n const app = await getApp(resolvedNode, transferSummaryMap, stakedChainContext, config.api.initRewardsCache)\n const server = app.listen(port, hostname, () => logger?.log(`[API] Server listening at http://${hostname}:${port}`))\n server.setTimeout(20_000)\n return server\n}\n","import { BaseMongoSdk, type BaseMongoSdkPrivateConfig } from '@xylabs/mongo'\nimport type { Hash, Logger } from '@xylabs/sdk-js'\nimport {\n asAddress, assertEx, isDefined,\n ZERO_ADDRESS,\n} from '@xylabs/sdk-js'\nimport { MemoryArchivist } from '@xyo-network/archivist-memory'\nimport { MongoDBArchivistV2 } from '@xyo-network/archivist-mongodb'\nimport { ViewArchivist } from '@xyo-network/archivist-view'\nimport {\n AddressBalanceDivinerV2, AddressTransferDiviner, ArchivistSyncDiviner, HeadValidationDiviner,\n} from '@xyo-network/chain-modules'\nimport { MongoMap } from '@xyo-network/chain-protocol'\nimport { initTelemetry } from '@xyo-network/chain-telemetry'\nimport { AbstractModule, LoggerModuleStatusReporter } from '@xyo-network/module-abstract'\nimport { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'\nimport type { MongoDBModuleParamsV2 } from '@xyo-network/module-model-mongodb'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport { MemorySentinel } from '@xyo-network/sentinel-memory'\nimport { StepSizes } from '@xyo-network/xl1-protocol'\nimport type {\n BalancesStepSummary, Config, MapType, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport { hasMongoConfig, MemoryMap } from '@xyo-network/xl1-protocol-sdk'\nimport { Semaphore } from 'async-mutex'\n\nexport interface GetLocatorContext {\n config: Config\n logger?: Logger\n}\n\nexport async function getTransferSummaryMap(config: Config): Promise<MapType<string, WithStorageMeta<TransfersStepSummary>>> {\n const mongoConfig = config.storage?.mongo\n if (hasMongoConfig(mongoConfig)) {\n // Create the MongoDB SDK from the configuration\n const {\n connectionString: dbConnectionString, database: dbName, domain: dbDomain, password: dbPassword, username: dbUserName,\n } = mongoConfig\n const payloadSdkConfig: BaseMongoSdkPrivateConfig = {\n dbConnectionString, dbDomain, dbName, dbPassword, dbUserName,\n }\n\n const sdkTransferSummaryMap = new BaseMongoSdk<WithStorageMeta<TransfersStepSummary>>({ ...payloadSdkConfig, collection: 'transfer_summary_map' })\n const result = await MongoMap.create<MongoMap<Hash, WithStorageMeta<TransfersStepSummary>>>({\n sdk: sdkTransferSummaryMap,\n getCache: { enabled: true, maxEntries: 5000 },\n })\n assertEx(await result.start(), () => 'Failed to start transfer summary map')\n return result\n } else {\n console.warn('[API] Mongo configuration not found. Using MemoryMap for TransferSummaryMap.')\n return new MemoryMap<string, WithStorageMeta<TransfersStepSummary>>()\n }\n}\n\n/**\n * Used for retrieving a locator with the necessary modules registered for testing\n * operation of the node (entirely in memory)\n * @returns A locator with the necessary modules registered\n */\nexport const getLocator = async (context: GetLocatorContext) => {\n const { config, logger } = context\n const { otlpEndpoint } = config.telemetry?.otel ?? {}\n const { traceProvider, meterProvider } = await initTelemetry({\n attributes: {\n serviceName: 'xl1-api',\n serviceVersion: '1.0.0',\n },\n otlpEndpoint,\n metricsConfig: {\n endpoint: '/metrics',\n port: 9465,\n },\n })\n\n if (isDefined(logger)) AbstractModule.defaultLogger = logger\n const statusReporter = logger ? new LoggerModuleStatusReporter(logger) : undefined\n\n const locator = new ModuleFactoryLocator()\n let balanceSummaryMap: MapType<string, WithStorageMeta<BalancesStepSummary>> | undefined\n let transferSummaryMap = await getTransferSummaryMap(config)\n // If there's a MongoDB configuration\n const mongoConfig = config.storage?.mongo\n if (hasMongoConfig(mongoConfig)) {\n // Create the MongoDB SDK from the configuration\n const {\n connectionString: dbConnectionString, database: dbName, domain: dbDomain, password: dbPassword, username: dbUserName,\n } = mongoConfig\n const payloadSdkConfig: BaseMongoSdkPrivateConfig = {\n dbConnectionString, dbDomain, dbName, dbPassword, dbUserName,\n }\n const params: Partial<MongoDBModuleParamsV2> = {\n meterProvider, payloadSdkConfig, statusReporter, traceProvider,\n }\n // Register the MongoDB Archivist as the default\n locator.register(MongoDBArchivistV2.factory(params), undefined, true)\n\n // Use a persistent MongoMap for the summary repository if MongoDB is configured\n const sdkBalanceSummaryMap = new BaseMongoSdk<WithStorageMeta<BalancesStepSummary>>({ ...payloadSdkConfig, collection: 'balance_summary_map' })\n balanceSummaryMap = await MongoMap.create<MongoMap<Hash, WithStorageMeta<BalancesStepSummary>>>({\n sdk: sdkBalanceSummaryMap,\n getCache: { enabled: true, maxEntries: 5000 },\n })\n }\n\n locator.register(AddressBalanceDivinerV2.factory<AddressBalanceDivinerV2>({\n traceProvider, meterProvider, statusReporter, summaryMap: balanceSummaryMap, stepSemaphores: StepSizes.map(() => new Semaphore(20)),\n }))\n\n locator.register(AddressTransferDiviner.factory<AddressTransferDiviner>({\n traceProvider, meterProvider, statusReporter, summaryMap: transferSummaryMap, stepSemaphores: StepSizes.map(() => new Semaphore(20)),\n }))\n\n const chainId = isDefined(config.chain.id)\n ? assertEx(asAddress(config.chain.id), () => 'chain.id must be an Address')\n : ZERO_ADDRESS\n locator.register(HeadValidationDiviner.factory<HeadValidationDiviner>({\n traceProvider,\n meterProvider,\n statusReporter,\n chainId,\n allowedProducers: config.producer.allowlist,\n }))\n locator.register(MemoryArchivist.factory({\n traceProvider, meterProvider, statusReporter,\n }))\n locator.register(MemorySentinel.factory({\n traceProvider, meterProvider, statusReporter,\n }))\n locator.register(ViewArchivist.factory({\n traceProvider, meterProvider, statusReporter,\n }))\n locator.register(ArchivistSyncDiviner.factory({\n traceProvider, meterProvider, statusReporter,\n }))\n return locator\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { ManifestWrapper } from '@xyo-network/manifest-wrapper'\nimport type { WalletInstance } from '@xyo-network/wallet-model'\nimport type { Config } from '@xyo-network/xl1-protocol-sdk'\n\nimport { getLocator } from './getLocator.ts'\nimport { NodeManifest } from './nodeManifest.ts'\nimport { PrivateChildManifests } from './private/index.ts'\nimport { PublicChildManifestsWithMempool, PublicChildManifestsWithoutMempool } from './public/index.ts'\n\nexport interface GetNodeContext {\n config: Config\n logger?: Logger\n wallet: WalletInstance\n}\n\n/**\n * Creates a node with the xyo-chain modules registered\n * @param context The context to use for the node\n * @returns A node with the xyo-chain modules registered\n */\nexport const getNode = async (context: GetNodeContext) => {\n const { wallet, config } = context\n const { enabled: mempoolEnabled } = config.mempool\n const PublicChildManifests = mempoolEnabled ? PublicChildManifestsWithoutMempool : PublicChildManifestsWithMempool\n const locator = await getLocator(context)\n const wrapper = new ManifestWrapper(NodeManifest, wallet, locator, PublicChildManifests, PrivateChildManifests)\n const [node, ...childNodes] = await wrapper.loadNodes()\n if (childNodes?.length > 0) {\n await Promise.all(childNodes.map(childNode => node.register(childNode)))\n await Promise.all(childNodes.map(childNode => node.attach(childNode.address, true)))\n }\n return node\n}\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"44'/60'/1\",\n \"name\": \"XYOChain\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": []\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","import type { PackageManifestPayload } from '@xyo-network/manifest-model'\n\nimport node from './node.json' with { type: 'json' }\n\n/**\n * Root Node Manifest\n */\nexport const NodeManifest = node as PackageManifestPayload\n","/**\n * Private Child Manifests\n */\nexport const PrivateChildManifests = []\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"1\",\n \"name\": \"Chain\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [\n {\n \"config\": {\n \"accountPath\": \"1/1'/1'\",\n \"name\": \"Validated\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_validated\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/2'\",\n \"schema\": \"network.xyo.diviner.chain.head.validation.config\",\n \"eventSubscriptions\": [\n {\n \"sourceEvent\": \"inserted\",\n \"sourceModule\": \"Submissions\",\n \"targetModuleFunction\": \"divine\"\n }\n ],\n \"inArchivist\": \"Submissions\",\n \"outArchivist\": \"Validated\",\n \"name\": \"HeadValidationDiviner\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/3'\",\n \"automations\": [\n {\n \"frequency\": 1000,\n \"frequencyUnits\": \"millis\",\n \"schema\": \"network.xyo.automation.interval\",\n \"type\": \"interval\"\n }\n ],\n \"name\": \"ChainValidationSentinel\",\n \"schema\": \"network.xyo.sentinel.config\",\n \"synchronous\": true,\n \"tasks\": [\n {\n \"mod\": \"HeadValidationDiviner\",\n \"endPoint\": \"divine\"\n }\n ]\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/4'\",\n \"automations\": [\n {\n \"frequency\": 10000,\n \"frequencyUnits\": \"millis\",\n \"schema\": \"network.xyo.automation.interval\",\n \"type\": \"interval\"\n }\n ],\n \"name\": \"AddressBalancePollingSentinel\",\n \"schema\": \"network.xyo.sentinel.config\",\n \"synchronous\": true,\n \"tasks\": [\n {\n \"mod\": \"AddressBalanceDiviner\",\n \"endPoint\": \"divine\"\n }\n ]\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/5'\",\n \"automations\": [\n {\n \"frequency\": 10000,\n \"frequencyUnits\": \"millis\",\n \"schema\": \"network.xyo.automation.interval\",\n \"type\": \"interval\"\n }\n ],\n \"name\": \"AddressTransferPollingSentinel\",\n \"schema\": \"network.xyo.sentinel.config\",\n \"synchronous\": true,\n \"tasks\": [\n {\n \"mod\": \"AddressTransferDiviner\",\n \"endPoint\": \"divine\"\n }\n ]\n }\n }\n ],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"1/1/1\",\n \"name\": \"Submissions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_submissions\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/2\",\n \"name\": \"Finalized\",\n \"allowedQueries\": [\n \"network.xyo.query.archivist.get\",\n \"network.xyo.query.archivist.next\"\n ],\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 50000\n },\n \"originArchivist\": \"Validated\",\n \"schema\": \"network.xyo.archivist.view.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/3'\",\n \"name\": \"AddressBalanceDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.balance.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_balance\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/4'\",\n \"name\": \"AddressTransferDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.transfer.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_transfer\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"2\",\n \"name\": \"Pending\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"2/1/1\",\n \"name\": \"PendingTransactions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"labels\": {\n \"network.xyo.storage.class\": \"mongodb\"\n },\n \"payloadSdkConfig\": {\n \"collection\": \"pending_bundles\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","import type { ModuleManifest, PackageManifestPayload } from '@xyo-network/manifest-model'\n\nimport Chain from './Chain.json' with { type: 'json' }\nimport Pending from './Pending.json' with { type: 'json' }\n\n/**\n * Chain Node Manifest\n */\nconst ChainNodeManifest = Chain as PackageManifestPayload\n/**\n * Pending Node Manifest\n */\nconst PendingNodeManifest = Pending as PackageManifestPayload\n/**\n * Public Child Manifests\n */\nexport const PublicChildManifestsWithMempool: ModuleManifest[] = [\n ...ChainNodeManifest.nodes,\n ...PendingNodeManifest.nodes,\n]\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"1\",\n \"name\": \"Chain\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [\n {\n \"config\": {\n \"accountPath\": \"1/1'/1'\",\n \"name\": \"Validated\",\n \"allowedQueries\": [\n \"network.xyo.query.archivist.get\",\n \"network.xyo.query.archivist.next\"\n ],\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_validated\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"1/1/1\",\n \"name\": \"Submissions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_submissions\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/2\",\n \"name\": \"Finalized\",\n \"allowedQueries\": [\n \"network.xyo.query.archivist.get\",\n \"network.xyo.query.archivist.next\"\n ],\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 50000\n },\n \"originArchivist\": \"Validated\",\n \"schema\": \"network.xyo.archivist.view.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/3'\",\n \"name\": \"AddressBalanceDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.balance.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_balance\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/4'\",\n \"name\": \"AddressTransferDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.transfer.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_transfer\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"2\",\n \"name\": \"Pending\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"2/1/1\",\n \"name\": \"PendingTransactions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"labels\": {\n \"network.xyo.storage.class\": \"mongodb\"\n },\n \"payloadSdkConfig\": {\n \"collection\": \"pending_bundles\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","import type { ModuleManifest, PackageManifestPayload } from '@xyo-network/manifest-model'\n\nimport Chain from './Chain.json' with { type: 'json' }\nimport Pending from './Pending.json' with { type: 'json' }\n\n/**\n * Chain Node Manifest\n */\n const ChainNodeManifest = Chain as PackageManifestPayload\n/**\n * Pending Node Manifest\n */\n const PendingNodeManifest = Pending as PackageManifestPayload\n/**\n * Public Child Manifests\n */\nexport const PublicChildManifestsWithoutMempool: ModuleManifest[] = [\n ...ChainNodeManifest.nodes,\n ...PendingNodeManifest.nodes,\n]\n"],"mappings":";;;;AAAA,SACEA,uBACAC,6BACAC,sCACAC,mBACAC,0BACAC,kBACAC,gBACAC,yBACK;AAMP,OAAOC,iBAAiB;AACxB,OAAOC,UAAU;AAEjB,OAAOC,cAAa;;;AClBpB,SAASC,gCAAgC;AACzC,SAASC,8BAA8B;AACvC,SAASC,2BAA2B;AAS7B,IAAMC,qBAAqB,6BAAA;AAChC,QAAMC,mBAAmB;IAAC,IAAIC,oBAAAA;IAAuB,IAAIC,uBAAAA;;AACzDC,2BAAyB;IAAEH;EAAiB,CAAA;AAC9C,GAHkC;;;ACVlC,SAASI,eAAAA,oBAAmB;;;ACD5B,SAASC,oBAAoB;AAC7B,SAASC,WAAWC,iBAAiB;AACrC,SAASC,oBAAoB;AAG7B,SAASC,mBAAmB;AAI5B,IAAMC,UAAwD,8BAAOC,KAAKC,KAAKC,SAAAA;AAC7E,QAAM,EAAEC,SAASC,iBAAgB,IAAKJ,IAAIK;AAC1C,QAAM,EAAEC,KAAI,IAAKN,IAAIO;AACrB,QAAMJ,UAAUK,UAAUJ,gBAAAA;AAC1B,MAAIK,UAAUN,OAAAA,GAAU;AACtB,QAAIO,MAAMJ,KAAKH,YAAYA,UAAUG,OAAQ,MAAMA,KAAKK,QAAQR,SAAS;MAAES,WAAW;IAAO,CAAA;AAC7F,QAAIF,KAAK;AACPT,UAAIY,KAAK,MAAMH,IAAII,MAAK,CAAA;AACxB;IACF;EACF;AACA,MAAIC,aAAaX,gBAAAA,GAAmB;AAClC,UAAMM,MAAM,MAAMJ,KAAKK,QAAQP,kBAAkB;MAAEQ,WAAW;IAAO,CAAA;AACrE,QAAIF,KAAK;AACPT,UAAIe,SAASC,YAAYC,mBAAmB,IAAIR,IAAIP,OAAO,EAAE;AAC7D;IACF;EACF;AACAD,OA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AAM,iCAAA;QAAoCF,MAAMG,SAAS;;IACzF,GAHM;EAIR;AACA,QAAMC,OAAO,MAAM9B,aAAaI,QAAQ,GAAA;AACxC,QAAM2B,QAAQC,IAAIF,KAAKG,IAAI,CAACC,QAAAA;AAC1B,WAAOA,IAAIC,QAAK,MAAS,MAAM;EACjC,CAAA,CAAA;AACA,QAAMC,qBAAqBhD,UAAS,MAAMiD,sBAAsBhE,MAAAA,GAAS,MAAM,sCAAA;AAC/E,QAAMiE,MAAM,MAAMC,OAAOvC,cAAcoC,oBAAoBb,oBAAoBlD,OAAOO,IAAI4D,gBAAgB;AAC1G,QAAMC,SAASH,IAAII,OAAOlD,MAAMtB,UAAU,MAAMI,QAAQa,IAAI,oCAAoCjB,QAAAA,IAAYsB,IAAAA,EAAM,CAAA;AAClHiD,SAAOE,WAAW,GAAA;AAClB,SAAOF;AACT,GAtDyB;","names":["customPoweredByHeader","disableCaseSensitiveRouting","disableExpressDefaultPoweredByHeader","getJsonBodyParser","getJsonBodyParserOptions","responseProfiler","standardErrors","standardResponses","compression","cors","express","registerInstrumentations","ExpressInstrumentation","HttpInstrumentation","addInstrumentation","instrumentations","HttpInstrumentation","ExpressInstrumentation","registerInstrumentations","StatusCodes","asyncHandler","asAddress","isDefined","isModuleName","StatusCodes","handler","req","res","next","address","moduleIdentifier","params","node","app","asAddress","isDefined","mod","resolve","direction","json","state","isModuleName","redirect","StatusCodes","MOVED_TEMPORARILY","getAddress","asyncHandler","asyncHandler","asAddress","assertEx","isAddress","toAddress","isQueryBoundWitness","ModuleErrorBuilder","StatusCodes","BoundWitnessSchema","ModuleConfigSchema","DEFAULT_DEPTH","getQueryConfig","mod","req","bw","payloads","nestedBwAddresses","flat","filter","payload","schema","BoundWitnessSchema","map","addresses","address","length","allowed","Object","fromEntries","queries","security","ModuleConfigSchema","handler","req","res","next","returnError","code","message","details","error","ModuleErrorBuilder","build","locals","rawResponse","status","json","address","params","node","app","bw","payloads","Array","isArray","body","isAddress","StatusCodes","BAD_REQUEST","isQueryBoundWitness","modules","normalizedAddress","toAddress","typedAddress","asAddress","byAddress","undefined","resolve","maxDepth","byName","direction","moduleAddress","assertEx","redirect","TEMPORARY_REDIRECT","NOT_FOUND","length","mod","queryConfig","getQueryConfig","queryResult","query","ex","INTERNAL_SERVER_ERROR","postAddress","asyncHandler","addNodeRoutes","app","defaultModule","node","address","defaultModuleEndpoint","get","_req","res","redirect","StatusCodes","MOVED_TEMPORARILY","post","TEMPORARY_REDIRECT","getAddress","postAddress","sendStatus","NOT_FOUND","setRawResponseFormat","asHash","isDefined","asArchivistInstance","PayloadBuilder","isAnyPayload","isSequence","express","resolveArchivist","node","archivistModuleIdentifier","mod","resolve","asArchivistInstance","required","archivistInstance","getArchivist","isDefined","archivistMiddleware","options","router","express","Router","mergeParams","post","req","res","setRawResponseFormat","body","Array","isArray","payloads","PayloadBuilder","hashPairs","map","p","archivist","result","insert","status","json","get","cursor","isSequence","query","undefined","limit","Number","open","Boolean","order","next","hash","rawHash","params","asHash","payload","isAnyPayload","send","addDataLakeRoutes","app","node","archivistModuleIdentifier","use","archivistMiddleware","setRawResponseFormat","assertEx","NodeXyoViewer","SimpleNetworkStakeViewer","SimpleStepRewardsByPositionViewer","StepSizes","RewardMultipliers","NodeXyoRunner","rpcEngineFromConnection","XyoBaseConnection","Semaphore","addRpcRoutes","app","transferSummaryMap","stakedChainContext","initRewardsCache","node","runner","NodeXyoRunner","networkStakeViewer","SimpleNetworkStakeViewer","create","context","console","log","assertEx","start","viewer","NodeXyoViewer","rewardMultipliers","RewardMultipliers","transfersSummaryContext","stepSemaphores","StepSizes","map","Semaphore","summaryMap","stepRewardsByPositionViewer","SimpleStepRewardsByPositionViewer","connection","XyoBaseConnection","engine","rpcEngineFromConnection","post","req","res","setRawResponseFormat","handle","body","_","rpcResponse","json","addRoutes","app","transferSummaryMap","stakedChainContext","initRewardsCache","addRpcRoutes","addDataLakeRoutes","addNodeRoutes","getApp","node","transferSummaryMap","stakedChainContext","initRewardsCache","addInstrumentation","app","express","set","use","cors","compression","responseProfiler","getJsonBodyParser","getJsonBodyParserOptions","limit","standardResponses","disableExpressDefaultPoweredByHeader","customPoweredByHeader","disableCaseSensitiveRouting","addRoutes","standardErrors","assertEx","isDefined","isString","asArchivistInstance","boot","createProducerChainStakeIntentBlock","initChainStakeViewer","initProducerAccount","createGenesisBlock","findMostRecentBlock","HDWallet","asXL1BlockRange","readPayloadMapFromStore","BaseMongoSdk","asAddress","assertEx","isDefined","ZERO_ADDRESS","MemoryArchivist","MongoDBArchivistV2","ViewArchivist","AddressBalanceDivinerV2","AddressTransferDiviner","ArchivistSyncDiviner","HeadValidationDiviner","MongoMap","initTelemetry","AbstractModule","LoggerModuleStatusReporter","ModuleFactoryLocator","MemorySentinel","StepSizes","hasMongoConfig","MemoryMap","Semaphore","getTransferSummaryMap","config","mongoConfig","storage","mongo","hasMongoConfig","connectionString","dbConnectionString","database","dbName","domain","dbDomain","password","dbPassword","username","dbUserName","payloadSdkConfig","sdkTransferSummaryMap","BaseMongoSdk","collection","result","MongoMap","create","sdk","getCache","enabled","maxEntries","assertEx","start","console","warn","MemoryMap","getLocator","context","logger","otlpEndpoint","telemetry","otel","traceProvider","meterProvider","initTelemetry","attributes","serviceName","serviceVersion","metricsConfig","endpoint","port","isDefined","AbstractModule","defaultLogger","statusReporter","LoggerModuleStatusReporter","undefined","locator","ModuleFactoryLocator","balanceSummaryMap","transferSummaryMap","params","register","MongoDBArchivistV2","factory","sdkBalanceSummaryMap","AddressBalanceDivinerV2","summaryMap","stepSemaphores","StepSizes","map","Semaphore","AddressTransferDiviner","chainId","chain","id","asAddress","ZERO_ADDRESS","HeadValidationDiviner","allowedProducers","producer","allowlist","MemoryArchivist","MemorySentinel","ViewArchivist","ArchivistSyncDiviner","ManifestWrapper","NodeManifest","node","PrivateChildManifests","ChainNodeManifest","Chain","PendingNodeManifest","Pending","PublicChildManifestsWithMempool","nodes","Chain_default","Pending_default","ChainNodeManifest","Chain","PendingNodeManifest","Pending","PublicChildManifestsWithoutMempool","nodes","getNode","context","wallet","config","enabled","mempoolEnabled","mempool","PublicChildManifests","PublicChildManifestsWithoutMempool","PublicChildManifestsWithMempool","locator","getLocator","wrapper","ManifestWrapper","NodeManifest","PrivateChildManifests","node","childNodes","loadNodes","length","Promise","all","map","childNode","register","attach","address","hostname","getSeedPhrase","bios","config","logger","storedSeedPhrase","seedPhraseStore","get","debug","mnemonic","api","isString","warn","set","seedPhrase","HDWallet","generateMnemonic","log","assertEx","getServer","context","node","port","boot","isDefined","wallet","fromPhrase","stakeChainViewer","initChainStakeViewer","nodeContext","resolvedNode","getNode","chainArchivist","asArchivistInstance","resolve","required","chainMap","readPayloadMapFromStore","payloads","next","length","producerAccount","initProducerAccount","chainId","block0","createGenesisBlock","address","insert","flat","console","block1","createProducerChainStakeIntentBlock","asXL1BlockRange","stakedChainContext","stake","store","head","findMostRecentBlock","_hash","block","mods","Promise","all","map","mod","start","transferSummaryMap","getTransferSummaryMap","app","getApp","initRewardsCache","server","listen","setTimeout"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,MAAM,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAWlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAI3D,OAAO,KAAK,EAAE,MAAM,EAA0B,MAAM,+BAA+B,CAAA;AA+BnF,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,YAAY,CAAA;CACpB;AAED,eAAO,MAAM,SAAS,GAAU,SAAS,gBAAgB,gHAsDxD,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/chain-api",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.21",
|
|
4
4
|
"description": "XYO Layer One API",
|
|
5
5
|
"homepage": "https://xylabs.com",
|
|
6
6
|
"bugs": {
|
|
@@ -55,34 +55,32 @@
|
|
|
55
55
|
"@xylabs/express": "~5.0.37",
|
|
56
56
|
"@xylabs/mongo": "~5.0.37",
|
|
57
57
|
"@xylabs/sdk-js": "~5.0.37",
|
|
58
|
-
"@xyo-network/
|
|
59
|
-
"@xyo-network/archivist-
|
|
60
|
-
"@xyo-network/archivist-
|
|
61
|
-
"@xyo-network/archivist-
|
|
62
|
-
"@xyo-network/archivist-view": "~5.1.23",
|
|
58
|
+
"@xyo-network/archivist-memory": "~5.1.24",
|
|
59
|
+
"@xyo-network/archivist-model": "~5.1.24",
|
|
60
|
+
"@xyo-network/archivist-mongodb": "~5.1.24",
|
|
61
|
+
"@xyo-network/archivist-view": "~5.1.24",
|
|
63
62
|
"@xyo-network/bios": "~7.1.1",
|
|
64
|
-
"@xyo-network/boundwitness-model": "~5.1.
|
|
65
|
-
"@xyo-network/chain-
|
|
66
|
-
"@xyo-network/chain-
|
|
67
|
-
"@xyo-network/chain-protocol": "~1.16.
|
|
68
|
-
"@xyo-network/chain-rpc": "~1.16.
|
|
69
|
-
"@xyo-network/chain-telemetry": "~1.16.
|
|
70
|
-
"@xyo-network/chain-viewers": "~1.16.
|
|
71
|
-
"@xyo-network/manifest-model": "~5.1.
|
|
72
|
-
"@xyo-network/manifest-wrapper": "~5.1.
|
|
73
|
-
"@xyo-network/module-abstract": "~5.1.
|
|
74
|
-
"@xyo-network/module-factory-locator": "~5.1.
|
|
75
|
-
"@xyo-network/module-model": "~5.1.
|
|
76
|
-
"@xyo-network/node-model": "~5.1.
|
|
77
|
-
"@xyo-network/payload-builder": "~5.1.
|
|
78
|
-
"@xyo-network/payload-model": "~5.1.
|
|
79
|
-
"@xyo-network/sentinel-memory": "~5.1.
|
|
80
|
-
"@xyo-network/
|
|
81
|
-
"@xyo-network/wallet": "~5.1.
|
|
82
|
-
"@xyo-network/wallet-model": "~5.1.23",
|
|
63
|
+
"@xyo-network/boundwitness-model": "~5.1.24",
|
|
64
|
+
"@xyo-network/chain-modules": "~1.16.21",
|
|
65
|
+
"@xyo-network/chain-orchestration": "~1.16.21",
|
|
66
|
+
"@xyo-network/chain-protocol": "~1.16.21",
|
|
67
|
+
"@xyo-network/chain-rpc": "~1.16.21",
|
|
68
|
+
"@xyo-network/chain-telemetry": "~1.16.21",
|
|
69
|
+
"@xyo-network/chain-viewers": "~1.16.21",
|
|
70
|
+
"@xyo-network/manifest-model": "~5.1.24",
|
|
71
|
+
"@xyo-network/manifest-wrapper": "~5.1.24",
|
|
72
|
+
"@xyo-network/module-abstract": "~5.1.24",
|
|
73
|
+
"@xyo-network/module-factory-locator": "~5.1.24",
|
|
74
|
+
"@xyo-network/module-model": "~5.1.24",
|
|
75
|
+
"@xyo-network/node-model": "~5.1.24",
|
|
76
|
+
"@xyo-network/payload-builder": "~5.1.24",
|
|
77
|
+
"@xyo-network/payload-model": "~5.1.24",
|
|
78
|
+
"@xyo-network/sentinel-memory": "~5.1.24",
|
|
79
|
+
"@xyo-network/wallet": "~5.1.24",
|
|
80
|
+
"@xyo-network/wallet-model": "~5.1.24",
|
|
83
81
|
"@xyo-network/xl1-protocol": "~1.13.11",
|
|
84
|
-
"@xyo-network/xl1-protocol-sdk": "~1.16.
|
|
85
|
-
"@xyo-network/xl1-rpc": "~1.16.
|
|
82
|
+
"@xyo-network/xl1-protocol-sdk": "~1.16.21",
|
|
83
|
+
"@xyo-network/xl1-rpc": "~1.16.21",
|
|
86
84
|
"async-mutex": "~0.5.0",
|
|
87
85
|
"compression": "~1.8.1",
|
|
88
86
|
"cors": "~2.8.5",
|
|
@@ -99,14 +97,14 @@
|
|
|
99
97
|
"@xylabs/sdk-js": "~5.0.37",
|
|
100
98
|
"@xylabs/ts-scripts-yarn3": "~7.2.8",
|
|
101
99
|
"@xylabs/tsconfig": "~7.2.8",
|
|
102
|
-
"@xyo-network/account": "~5.1.
|
|
103
|
-
"@xyo-network/account-model": "~5.1.
|
|
104
|
-
"@xyo-network/archivist-abstract": "~5.1.
|
|
100
|
+
"@xyo-network/account": "~5.1.24",
|
|
101
|
+
"@xyo-network/account-model": "~5.1.24",
|
|
102
|
+
"@xyo-network/archivist-abstract": "~5.1.24",
|
|
105
103
|
"@xyo-network/bios-model": "~7.1.1",
|
|
106
|
-
"@xyo-network/boundwitness-builder": "~5.1.
|
|
107
|
-
"@xyo-network/module-abstract-mongodb": "~5.1.
|
|
108
|
-
"@xyo-network/module-model-mongodb": "~5.1.
|
|
109
|
-
"@xyo-network/node-memory": "~5.1.
|
|
104
|
+
"@xyo-network/boundwitness-builder": "~5.1.24",
|
|
105
|
+
"@xyo-network/module-abstract-mongodb": "~5.1.24",
|
|
106
|
+
"@xyo-network/module-model-mongodb": "~5.1.24",
|
|
107
|
+
"@xyo-network/node-memory": "~5.1.24",
|
|
110
108
|
"@xyo-network/xl1-protocol": "~1.13.11",
|
|
111
109
|
"dotenv": "~17.2.3",
|
|
112
110
|
"eslint": "^9.39.1",
|
package/src/server/server.ts
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import type { Hash, Logger } from '@xylabs/sdk-js'
|
|
2
2
|
import {
|
|
3
|
-
assertEx, isDefined, isString,
|
|
3
|
+
assertEx, isDefined, isString,
|
|
4
4
|
} from '@xylabs/sdk-js'
|
|
5
|
-
import { Account } from '@xyo-network/account'
|
|
6
5
|
import { asArchivistInstance } from '@xyo-network/archivist-model'
|
|
7
6
|
import { boot } from '@xyo-network/bios'
|
|
8
7
|
import type { BiosExternalInterface } from '@xyo-network/bios-model'
|
|
9
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
createProducerChainStakeIntentBlock, initChainStakeViewer, initProducerAccount,
|
|
10
|
+
} from '@xyo-network/chain-orchestration'
|
|
10
11
|
import { createGenesisBlock, findMostRecentBlock } from '@xyo-network/chain-protocol'
|
|
11
12
|
import type { NodeInstance } from '@xyo-network/node-model'
|
|
12
13
|
import type { Payload, WithStorageMeta } from '@xyo-network/payload-model'
|
|
13
|
-
import { StakedXyoChainV2__factory } from '@xyo-network/typechain'
|
|
14
14
|
import { HDWallet } from '@xyo-network/wallet'
|
|
15
|
-
import
|
|
16
|
-
import type {
|
|
17
|
-
|
|
18
|
-
} from '@xyo-network/xl1-protocol-sdk'
|
|
19
|
-
import { readPayloadMapFromStore, SimpleChainStakeViewer } from '@xyo-network/xl1-protocol-sdk'
|
|
15
|
+
import { asXL1BlockRange } from '@xyo-network/xl1-protocol'
|
|
16
|
+
import type { Config, StakedChainContextRead } from '@xyo-network/xl1-protocol-sdk'
|
|
17
|
+
import { readPayloadMapFromStore } from '@xyo-network/xl1-protocol-sdk'
|
|
20
18
|
|
|
21
|
-
import { canUseInfuraProvider, initInfuraProvider } from '../helpers/index.ts'
|
|
22
19
|
import { getNode, getTransferSummaryMap } from '../manifest/index.ts'
|
|
23
20
|
import { getApp } from './app.ts'
|
|
24
21
|
|
|
@@ -53,26 +50,6 @@ interface GetServerContext {
|
|
|
53
50
|
node?: NodeInstance
|
|
54
51
|
}
|
|
55
52
|
|
|
56
|
-
async function getStakeChainViewer(config: Config, logger?: Logger): Promise<StakeViewer> {
|
|
57
|
-
if (canUseInfuraProvider(config)) {
|
|
58
|
-
const provider = await initInfuraProvider(config)
|
|
59
|
-
const contractAddress = assertEx(config.chain.id, () => 'Missing config.evm.chainId') as ChainId
|
|
60
|
-
const contract = StakedXyoChainV2__factory.connect(toEthAddress(contractAddress), provider)
|
|
61
|
-
const stakeEventsViewer = await EthereumChainStakeEvents.create({ contract, logger })
|
|
62
|
-
assertEx(await stakeEventsViewer.start(), () => 'Failed to start EthereumChainStakeEvents reader')
|
|
63
|
-
const stakeChainViewer = await EthereumChainStakeViewer.create({
|
|
64
|
-
contract, stakeEventsViewer, logger,
|
|
65
|
-
})
|
|
66
|
-
assertEx(await stakeChainViewer.start(), () => 'Failed to start EthereumChainStake viewer')
|
|
67
|
-
return stakeChainViewer
|
|
68
|
-
} else {
|
|
69
|
-
console.warn('[API] Infura configuration not found. Using SimpleChainStakeViewer with no positions. This means no staking data will be available.')
|
|
70
|
-
const stakeChainViewer = await SimpleChainStakeViewer.create({ logger, positions: [] })
|
|
71
|
-
assertEx(await stakeChainViewer.start(), () => 'Failed to start SimpleChainStake viewer')
|
|
72
|
-
return stakeChainViewer
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
53
|
export const getServer = async (context: GetServerContext) => {
|
|
77
54
|
const {
|
|
78
55
|
config, logger, node,
|
|
@@ -82,7 +59,7 @@ export const getServer = async (context: GetServerContext) => {
|
|
|
82
59
|
const seedPhrase = isDefined(mnemonic) ? mnemonic : await getSeedPhrase(bios, config, logger)
|
|
83
60
|
const wallet = await HDWallet.fromPhrase(seedPhrase)
|
|
84
61
|
|
|
85
|
-
const stakeChainViewer = await
|
|
62
|
+
const stakeChainViewer = await initChainStakeViewer(config, logger)
|
|
86
63
|
|
|
87
64
|
const nodeContext = {
|
|
88
65
|
wallet, logger, config,
|
|
@@ -99,11 +76,14 @@ export const getServer = async (context: GetServerContext) => {
|
|
|
99
76
|
|
|
100
77
|
if (payloads.length === 0) {
|
|
101
78
|
logger?.warn('[API] No blocks found in chain archivist, creating genesis block')
|
|
102
|
-
const
|
|
79
|
+
const producerAccount = await initProducerAccount({ config, logger })
|
|
103
80
|
const chainId = stakeChainViewer.chainId
|
|
104
|
-
const
|
|
105
|
-
await chainArchivist.insert([...
|
|
81
|
+
const block0 = await createGenesisBlock(producerAccount, chainId, 1_000_000n, producerAccount.address)
|
|
82
|
+
await chainArchivist.insert([...block0[1].flat(), block0[0]])
|
|
106
83
|
console.log('[API] Genesis block created and inserted into chain archivist')
|
|
84
|
+
const block1 = await createProducerChainStakeIntentBlock(block0[0], producerAccount, asXL1BlockRange([0, 10_000], true))
|
|
85
|
+
await chainArchivist.insert([...block1[1].flat(), block1[0]])
|
|
86
|
+
console.log(`[API] Producer declared: ${producerAccount.address}`)
|
|
107
87
|
}
|
|
108
88
|
|
|
109
89
|
const stakedChainContext: StakedChainContextRead = {
|