@xyo-network/chain-api 1.16.1 → 1.16.3

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.
@@ -337,7 +337,7 @@ var getApp = /* @__PURE__ */ __name(async (node, transferSummaryMap, stakedChain
337
337
  }, "getApp");
338
338
 
339
339
  // src/server/server.ts
340
- import { assertEx as assertEx6 } from "@xylabs/assert";
340
+ import { assertEx as assertEx5 } from "@xylabs/assert";
341
341
  import { toEthAddress } from "@xylabs/hex";
342
342
  import { isDefined as isDefined6, isString } from "@xylabs/typeof";
343
343
  import { asArchivistInstance as asArchivistInstance2 } from "@xyo-network/archivist-model";
@@ -388,7 +388,7 @@ var getInfuraProviderConfig = /* @__PURE__ */ __name((config) => {
388
388
  }, "getInfuraProviderConfig");
389
389
 
390
390
  // src/manifest/getLocator.ts
391
- import { assertEx as assertEx5 } from "@xylabs/assert";
391
+ import { assertEx as assertEx4 } from "@xylabs/assert";
392
392
  import { asAddress as asAddress3, ZERO_ADDRESS } from "@xylabs/hex";
393
393
  import { BaseMongoSdk } from "@xylabs/mongo";
394
394
  import { isDefined as isDefined5 } from "@xylabs/typeof";
@@ -396,6 +396,7 @@ import { MemoryArchivist } from "@xyo-network/archivist-memory";
396
396
  import { MongoDBArchivistV2 } from "@xyo-network/archivist-mongodb";
397
397
  import { ViewArchivist } from "@xyo-network/archivist-view";
398
398
  import { AddressBalanceDivinerV2, AddressTransferDiviner, ArchivistSyncDiviner, HeadValidationDiviner } from "@xyo-network/chain-modules";
399
+ import { MongoMap } from "@xyo-network/chain-protocol";
399
400
  import { initTelemetry } from "@xyo-network/chain-telemetry";
400
401
  import { AbstractModule, LoggerModuleStatusReporter } from "@xyo-network/module-abstract";
401
402
  import { ModuleFactoryLocator } from "@xyo-network/module-factory-locator";
@@ -403,130 +404,6 @@ import { MemorySentinel } from "@xyo-network/sentinel-memory";
403
404
  import { StepSizes as StepSizes2 } from "@xyo-network/xl1-protocol";
404
405
  import { hasMongoConfig } from "@xyo-network/xl1-protocol-sdk";
405
406
  import { Semaphore as Semaphore2 } from "async-mutex";
406
-
407
- // src/driver/mongo/MongoMap.ts
408
- import { assertEx as assertEx4 } from "@xylabs/assert";
409
- import { AbstractCreatable, creatable } from "@xylabs/creatable";
410
- import { isNull } from "@xylabs/typeof";
411
- import { LRUCache } from "lru-cache";
412
- function _ts_decorate(decorators, target, key, desc) {
413
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
414
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
415
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
416
- return c > 3 && r && Object.defineProperty(target, key, r), r;
417
- }
418
- __name(_ts_decorate, "_ts_decorate");
419
- function stripMongoId(doc) {
420
- const { _id, ...rest } = doc;
421
- return rest;
422
- }
423
- __name(stripMongoId, "stripMongoId");
424
- var MongoMap = class extends AbstractCreatable {
425
- static {
426
- __name(this, "MongoMap");
427
- }
428
- _getCache;
429
- get sdk() {
430
- return assertEx4(this.params.sdk, () => "No sdk specified");
431
- }
432
- async clear() {
433
- this._getCache?.clear();
434
- await this.sdk.deleteMany({});
435
- }
436
- async delete(id) {
437
- this._getCache?.delete(id);
438
- const filter = {
439
- _id: id
440
- };
441
- const result = await this.sdk.deleteOne(filter);
442
- return result.deletedCount > 0;
443
- }
444
- async get(id) {
445
- if (this._getCache) {
446
- const getCacheResult = this._getCache.get(id);
447
- if (getCacheResult) {
448
- return getCacheResult;
449
- }
450
- }
451
- const filter = {
452
- _id: id
453
- };
454
- const doc = await this.sdk.findOne(filter);
455
- return isNull(doc) ? void 0 : stripMongoId(doc);
456
- }
457
- async getMany(ids) {
458
- const cache = this._getCache;
459
- const idSet = new Set(ids);
460
- const results = [];
461
- if (cache) {
462
- const getCacheResult = ids.map((id) => [
463
- id,
464
- cache.get(id)
465
- ]).filter(([, item]) => item !== void 0);
466
- for (const [id] of getCacheResult) {
467
- idSet.delete(id);
468
- }
469
- results.push(...getCacheResult.map(([, item]) => item));
470
- }
471
- const filter = {
472
- _id: {
473
- $in: [
474
- ...idSet
475
- ]
476
- }
477
- };
478
- const items = await (await this.sdk.find(filter)).toArray();
479
- for (const item of items) {
480
- const id = item._id;
481
- const stripped = stripMongoId(item);
482
- if (cache) {
483
- cache.set(id, stripped);
484
- }
485
- results.push(stripped);
486
- }
487
- return results;
488
- }
489
- async has(id) {
490
- if (this._getCache) {
491
- const getCacheResult = this._getCache.has(id);
492
- if (getCacheResult) {
493
- return getCacheResult;
494
- }
495
- }
496
- const filter = {
497
- _id: id
498
- };
499
- const exists = await this.sdk.findOne(filter);
500
- return isNull(exists) ? false : true;
501
- }
502
- async set(id, data) {
503
- const filter = {
504
- _id: id
505
- };
506
- const value = {
507
- ...data,
508
- _id: id
509
- };
510
- await this.sdk.replaceOne(filter, value, {
511
- upsert: true
512
- });
513
- this._getCache?.set(id, data);
514
- }
515
- async startHandler() {
516
- await super.startHandler();
517
- if (this.params.getCache?.enabled === true) {
518
- const maxEntries = this.params.getCache?.maxEntries ?? 5e3;
519
- this._getCache = new LRUCache({
520
- max: maxEntries
521
- });
522
- }
523
- }
524
- };
525
- MongoMap = _ts_decorate([
526
- creatable()
527
- ], MongoMap);
528
-
529
- // src/manifest/getLocator.ts
530
407
  async function getTransferSummaryMap(config) {
531
408
  const mongoConfig = config.storage?.mongo;
532
409
  if (hasMongoConfig(mongoConfig)) {
@@ -614,7 +491,7 @@ var getLocator = /* @__PURE__ */ __name(async (context) => {
614
491
  summaryMap: transferSummaryMap,
615
492
  stepSemaphores: StepSizes2.map(() => new Semaphore2(20))
616
493
  }));
617
- const chainId = isDefined5(config.chain.id) ? assertEx5(asAddress3(config.chain.id), () => "chain.id must be an Address") : ZERO_ADDRESS;
494
+ const chainId = isDefined5(config.chain.id) ? assertEx4(asAddress3(config.chain.id), () => "chain.id must be an Address") : ZERO_ADDRESS;
618
495
  locator.register(HeadValidationDiviner.factory({
619
496
  traceProvider,
620
497
  meterProvider,
@@ -1074,7 +951,7 @@ var getSeedPhrase = /* @__PURE__ */ __name(async (bios, config, logger) => {
1074
951
  }
1075
952
  await bios.seedPhraseStore.set("os", seedPhrase);
1076
953
  }
1077
- return assertEx6(await bios.seedPhraseStore.get("os"), () => "Unable to acquire mnemonic from bios");
954
+ return assertEx5(await bios.seedPhraseStore.get("os"), () => "Unable to acquire mnemonic from bios");
1078
955
  }, "getSeedPhrase");
1079
956
  var getServer = /* @__PURE__ */ __name(async (context) => {
1080
957
  const { config, logger, node } = context;
@@ -1083,7 +960,7 @@ var getServer = /* @__PURE__ */ __name(async (context) => {
1083
960
  const seedPhrase = isDefined6(mnemonic) ? mnemonic : await getSeedPhrase(bios, config, logger);
1084
961
  const wallet = await HDWallet.fromPhrase(seedPhrase);
1085
962
  const provider = await initInfuraProvider(config);
1086
- const contractAddress = assertEx6(config.chain.id, () => "Missing config.evm.chainId");
963
+ const contractAddress = assertEx5(config.chain.id, () => "Missing config.evm.chainId");
1087
964
  const contract = StakedXyoChainV2__factory.connect(toEthAddress(contractAddress), provider);
1088
965
  const nodeContext = {
1089
966
  wallet,
@@ -1094,15 +971,15 @@ var getServer = /* @__PURE__ */ __name(async (context) => {
1094
971
  contract,
1095
972
  logger
1096
973
  });
1097
- assertEx6(await eventsReader.start(), () => "Failed to start EthereumChainStakeEvents reader");
974
+ assertEx5(await eventsReader.start(), () => "Failed to start EthereumChainStakeEvents reader");
1098
975
  const stakeChainReader = await EthereumChainStake.create({
1099
976
  contract,
1100
977
  eventsReader,
1101
978
  logger
1102
979
  });
1103
- assertEx6(await stakeChainReader.start(), () => "Failed to start EthereumChainStake reader");
980
+ assertEx5(await stakeChainReader.start(), () => "Failed to start EthereumChainStake reader");
1104
981
  const rootNode = await getNode(nodeContext);
1105
- const chainArchivist = assertEx6(asArchivistInstance2(await rootNode.resolve("Chain:Validated"), {
982
+ const chainArchivist = assertEx5(asArchivistInstance2(await rootNode.resolve("Chain:Validated"), {
1106
983
  required: true
1107
984
  }), () => "FinalizedArchivist not found in node");
1108
985
  const chainMap = readPayloadMapFromStore(chainArchivist);
@@ -1117,8 +994,8 @@ var getServer = /* @__PURE__ */ __name(async (context) => {
1117
994
  head: /* @__PURE__ */ __name(async () => {
1118
995
  const head = await findMostRecentBlock(chainArchivist);
1119
996
  return [
1120
- assertEx6(head?._hash, () => "No head found in chainArchivist"),
1121
- assertEx6(head?.block, () => "No head found in chainArchivist")
997
+ assertEx5(head?._hash, () => "No head found in chainArchivist"),
998
+ assertEx5(head?.block, () => "No head found in chainArchivist")
1122
999
  ];
1123
1000
  }, "head")
1124
1001
  };
@@ -1126,7 +1003,7 @@ var getServer = /* @__PURE__ */ __name(async (context) => {
1126
1003
  await Promise.all(mods.map((mod) => {
1127
1004
  return mod.start?.() ?? (() => true);
1128
1005
  }));
1129
- const transferSummaryMap = assertEx6(await getTransferSummaryMap(config), () => "Transfer Summary Map not initialized");
1006
+ const transferSummaryMap = assertEx5(await getTransferSummaryMap(config), () => "Transfer Summary Map not initialized");
1130
1007
  const app = await getApp(resolvedNode, transferSummaryMap, stakedChainContext, config.api.initRewardsCache);
1131
1008
  const server = app.listen(port, hostname, () => logger?.log(`[API] Server listening at http://${hostname}:${port}`));
1132
1009
  server.setTimeout(2e4);
@@ -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/driver/mongo/MongoMap.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 } from '@xylabs/hex'\nimport { isDefined } from '@xylabs/typeof'\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 { assertEx } from '@xylabs/assert'\nimport { asyncHandler } from '@xylabs/express'\nimport {\n asAddress, isAddress,\n toAddress,\n} from '@xylabs/hex'\nimport type { JsonObject } from '@xylabs/object'\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 } from '@xylabs/hex'\nimport { isDefined } from '@xylabs/typeof'\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 {\n NodeNetworkStakeViewer, NodeStepRewardsByPositionViewer, NodeXyoViewer,\n} from '@xyo-network/chain-rpc'\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,\n 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 NodeNetworkStakeViewer.create({ context: stakedChainContext })\n\n console.log('Initializing NodeNetworkStakeViewer...')\n await networkStakeViewer.start()\n console.log('Initialized NodeNetworkStakeViewer.')\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 await viewer.start()\n console.log('Initialized NodeXyoViewer.')\n\n const stepRewardsByPositionViewer = await NodeStepRewardsByPositionViewer.create({\n context: stakedChainContext,\n rewardMultipliers: RewardMultipliers,\n })\n\n console.log('Initializing NodeStepRewardsByPositionViewer...')\n await stepRewardsByPositionViewer.start()\n console.log('Initialized NodeStepRewardsByPositionViewer.')\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 { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport { toEthAddress } from '@xylabs/hex'\nimport type { Logger } from '@xylabs/logger'\nimport { isDefined, isString } from '@xylabs/typeof'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport { boot } from '@xyo-network/bios'\nimport type { BiosExternalInterface } from '@xyo-network/bios-model'\nimport { EthereumChainStake, EthereumChainStakeEvents } from '@xyo-network/chain-ethereum'\nimport { findMostRecentBlock, getLocalPersistentMap } 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, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport { readPayloadMapFromStore } from '@xyo-network/xl1-protocol-sdk'\n\nimport { 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\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 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 nodeContext = {\n wallet, logger, config,\n }\n const eventsReader = await EthereumChainStakeEvents.create({ contract, logger })\n assertEx(await eventsReader.start(), () => 'Failed to start EthereumChainStakeEvents reader')\n const stakeChainReader = await EthereumChainStake.create({\n contract, eventsReader, logger,\n })\n assertEx(await stakeChainReader.start(), () => 'Failed to start EthereumChainStake reader')\n const rootNode = await getNode(nodeContext)\n const chainArchivist = assertEx(asArchivistInstance(\n await rootNode.resolve('Chain:Validated'),\n { required: true },\n ), () => 'FinalizedArchivist not found in node')\n const chainMap = readPayloadMapFromStore<WithStorageMeta<Payload>>(chainArchivist)\n const resolvedNode: NodeInstance = node ?? await getNode(nodeContext)\n\n const stakedChainContext: StakedChainContextRead = {\n chainId: contractAddress,\n events: eventsReader,\n stake: stakeChainReader,\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'), assertEx(head?.block, () => 'No head found in chainArchivist')]\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 { assertEx } from '@xylabs/assert'\nimport { hexFrom, isHex } from '@xylabs/hex'\nimport { isDefined } from '@xylabs/typeof'\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 } from '@xylabs/assert'\nimport { isDefined } from '@xylabs/typeof'\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 { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport { asAddress, ZERO_ADDRESS } from '@xylabs/hex'\nimport type { Logger } from '@xylabs/logger'\nimport { BaseMongoSdk, type BaseMongoSdkPrivateConfig } from '@xylabs/mongo'\nimport { isDefined } from '@xylabs/typeof'\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 { 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 } from '@xyo-network/xl1-protocol-sdk'\nimport { Semaphore } from 'async-mutex'\n\nimport { MongoMap } from '../driver/index.ts'\n\nexport interface GetLocatorContext {\n config: Config\n logger?: Logger\n}\n\nexport async function getTransferSummaryMap(config: Config): Promise<Promise<MapType<string, WithStorageMeta<TransfersStepSummary>> | undefined>> {\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 return await MongoMap.create<MongoMap<Hash, WithStorageMeta<TransfersStepSummary>>>({\n sdk: sdkTransferSummaryMap,\n getCache: { enabled: true, maxEntries: 5000 },\n })\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 { assertEx } from '@xylabs/assert'\nimport {\n AbstractCreatable, creatable, CreatableParams,\n} from '@xylabs/creatable'\nimport { BaseMongoSdk } from '@xylabs/mongo'\nimport { isNull } from '@xylabs/typeof'\nimport { AsynchronousMap } from '@xyo-network/xl1-protocol-sdk'\nimport { LRUCache } from 'lru-cache'\nimport {\n Document, Filter, OptionalUnlessRequiredId, WithId,\n} from 'mongodb'\n\nexport interface MongoMapParams<TData extends Document = Document> extends CreatableParams {\n getCache?: {\n enabled: boolean\n maxEntries?: number\n }\n sdk: BaseMongoSdk<TData>\n}\n\nfunction stripMongoId<V extends Document>(doc: WithId<V>): V {\n const { _id, ...rest } = doc\n return rest as unknown as V\n}\n\n@creatable()\nexport class MongoMap<K extends {} = string, V extends Document = Document>\n extends AbstractCreatable<MongoMapParams<V>>\n implements AsynchronousMap<K, V> {\n private _getCache: LRUCache<K, V> | undefined\n\n get sdk(): BaseMongoSdk<V> {\n return assertEx(this.params.sdk, () => 'No sdk specified')\n }\n\n async clear(): Promise<void> {\n this._getCache?.clear()\n await this.sdk.deleteMany({})\n }\n\n async delete(id: K): Promise<boolean> {\n this._getCache?.delete(id)\n\n const filter = { _id: id } as Filter<V>\n const result = await this.sdk.deleteOne(filter)\n return result.deletedCount > 0\n }\n\n async get(id: K): Promise<V | undefined> {\n if (this._getCache) {\n const getCacheResult = this._getCache.get(id)\n if (getCacheResult) {\n return getCacheResult\n }\n }\n const filter = { _id: id } as Filter<V>\n const doc = await this.sdk.findOne(filter)\n return isNull(doc) ? undefined : stripMongoId(doc)\n }\n\n async getMany(ids: K[]): Promise<V[]> {\n /* const results = await Promise.all(ids.map(async (id) => {\n return await this.get(id)\n }))\n return results.filter(exists) */\n const cache = this._getCache\n const idSet = new Set(ids)\n const results: V[] = []\n if (cache) {\n const getCacheResult = ids.map(id => ([id, cache.get(id)])).filter(([, item]) => item !== undefined) as [K, V][]\n for (const [id] of getCacheResult) {\n idSet.delete(id)\n }\n results.push(...getCacheResult.map(([, item]) => item))\n }\n const filter = { _id: { $in: [...idSet] } } as Filter<V>\n const items = await (await this.sdk.find(filter)).toArray()\n for (const item of items) {\n const id = item._id\n const stripped = stripMongoId(item)\n if (cache) {\n cache.set(id as unknown as K, stripped)\n }\n results.push(stripped)\n }\n return results\n }\n\n async has(id: K): Promise<boolean> {\n if (this._getCache) {\n const getCacheResult = this._getCache.has(id)\n if (getCacheResult) {\n return getCacheResult\n }\n }\n const filter = { _id: id } as Filter<V>\n const exists = await this.sdk.findOne(filter)\n return isNull(exists) ? false : true\n }\n\n async set(id: K, data: V): Promise<void> {\n const filter = { _id: id } as Filter<V>\n const value = { ...data, _id: id } as OptionalUnlessRequiredId<V>\n await this.sdk.replaceOne(filter, value, { upsert: true })\n this._getCache?.set(id, data)\n }\n\n override async startHandler(): Promise<void> {\n await super.startHandler()\n // TODO: Ensure index\n\n if (this.params.getCache?.enabled === true) {\n const maxEntries = this.params.getCache?.maxEntries ?? 5000\n this._getCache = new LRUCache<K, V>({ max: maxEntries })\n }\n }\n}\n","import type { Logger } from '@xylabs/logger'\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":";;;;AA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,MAAMuB,iBAAiBD,MAAK,GAAI,MAAM,2CAAA;AAC/C,QAAMG,WAAW,MAAMC,QAAQR,WAAAA;AAC/B,QAAMS,iBAAiB3B,UAAS4B,qBAC9B,MAAMH,SAASI,QAAQ,iBAAA,GACvB;IAAEC,UAAU;EAAK,CAAA,GAChB,MAAM,sCAAA;AACT,QAAMC,WAAWC,wBAAkDL,cAAAA;AACnE,QAAMM,eAA6B9B,QAAQ,MAAMuB,QAAQR,WAAAA;AAEzD,QAAMgB,qBAA6C;IACjDC,SAASxB;IACTyB,QAAQjB;IACRkB,OAAOd;IACPe,OAAO;MAAEP;IAAS;IAClBQ,MAAM,mCAAA;AACJ,YAAMA,OAAO,MAAMC,oBAAoBb,cAAAA;AACvC,aAAO;QAAC3B,UAASuC,MAAME,OAAO,MAAM,iCAAA;QAAoCzC,UAASuC,MAAMG,OAAO,MAAM,iCAAA;;IACtG,GAHM;EAIR;AACA,QAAMC,OAAO,MAAMV,aAAaJ,QAAQ,GAAA;AACxC,QAAMe,QAAQC,IAAIF,KAAKG,IAAI,CAACC,QAAAA;AAC1B,WAAOA,IAAIzB,QAAK,MAAS,MAAM;EACjC,CAAA,CAAA;AACA,QAAM0B,qBAAqBhD,UAAS,MAAMiD,sBAAsBhE,MAAAA,GAAS,MAAM,sCAAA;AAC/E,QAAMiE,MAAM,MAAMC,OAAOlB,cAAce,oBAAoBd,oBAAoBjD,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,GA/CyB;","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","assertEx","asyncHandler","asAddress","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","NodeNetworkStakeViewer","NodeStepRewardsByPositionViewer","NodeXyoViewer","StepSizes","RewardMultipliers","NodeXyoRunner","rpcEngineFromConnection","XyoBaseConnection","Semaphore","addRpcRoutes","app","transferSummaryMap","stakedChainContext","initRewardsCache","node","runner","NodeXyoRunner","networkStakeViewer","NodeNetworkStakeViewer","create","context","console","log","start","viewer","NodeXyoViewer","rewardMultipliers","RewardMultipliers","transfersSummaryContext","stepSemaphores","StepSizes","map","Semaphore","summaryMap","stepRewardsByPositionViewer","NodeStepRewardsByPositionViewer","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","toEthAddress","isDefined","isString","asArchivistInstance","boot","EthereumChainStake","EthereumChainStakeEvents","findMostRecentBlock","StakedXyoChainV2__factory","HDWallet","readPayloadMapFromStore","assertEx","hexFrom","isHex","isDefined","getChainId","config","chainId","assertEx","evm","isHex","prefix","hex","hexFrom","parsed","Number","parseInt","assertEx","isDefined","InfuraWebSocketProvider","instance","initInfuraProvider","config","providerConfig","getInfuraProviderConfig","Promise","resolve","InfuraWebSocketProvider","getInfuraProviderConfig","config","projectId","assertEx","evm","infura","projectSecret","getChainId","assertEx","asAddress","ZERO_ADDRESS","BaseMongoSdk","isDefined","MemoryArchivist","MongoDBArchivistV2","ViewArchivist","AddressBalanceDivinerV2","AddressTransferDiviner","ArchivistSyncDiviner","HeadValidationDiviner","initTelemetry","AbstractModule","LoggerModuleStatusReporter","ModuleFactoryLocator","MemorySentinel","StepSizes","hasMongoConfig","Semaphore","assertEx","AbstractCreatable","creatable","isNull","LRUCache","stripMongoId","doc","_id","rest","MongoMap","AbstractCreatable","_getCache","sdk","assertEx","params","clear","deleteMany","delete","id","filter","result","deleteOne","deletedCount","get","getCacheResult","findOne","isNull","undefined","getMany","ids","cache","idSet","Set","results","map","item","push","$in","items","find","toArray","stripped","set","has","exists","data","value","replaceOne","upsert","startHandler","getCache","enabled","maxEntries","LRUCache","max","getTransferSummaryMap","config","mongoConfig","storage","mongo","hasMongoConfig","connectionString","dbConnectionString","database","dbName","domain","dbDomain","password","dbPassword","username","dbUserName","payloadSdkConfig","sdkTransferSummaryMap","BaseMongoSdk","collection","MongoMap","create","sdk","getCache","enabled","maxEntries","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","assertEx","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","provider","initInfuraProvider","contractAddress","chain","id","contract","StakedXyoChainV2__factory","connect","toEthAddress","nodeContext","eventsReader","EthereumChainStakeEvents","create","start","stakeChainReader","EthereumChainStake","rootNode","getNode","chainArchivist","asArchivistInstance","resolve","required","chainMap","readPayloadMapFromStore","resolvedNode","stakedChainContext","chainId","events","stake","store","head","findMostRecentBlock","_hash","block","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/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 } from '@xylabs/hex'\nimport { isDefined } from '@xylabs/typeof'\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 { assertEx } from '@xylabs/assert'\nimport { asyncHandler } from '@xylabs/express'\nimport {\n asAddress, isAddress,\n toAddress,\n} from '@xylabs/hex'\nimport type { JsonObject } from '@xylabs/object'\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 } from '@xylabs/hex'\nimport { isDefined } from '@xylabs/typeof'\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 {\n NodeNetworkStakeViewer, NodeStepRewardsByPositionViewer, NodeXyoViewer,\n} from '@xyo-network/chain-rpc'\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,\n 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 NodeNetworkStakeViewer.create({ context: stakedChainContext })\n\n console.log('Initializing NodeNetworkStakeViewer...')\n await networkStakeViewer.start()\n console.log('Initialized NodeNetworkStakeViewer.')\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 await viewer.start()\n console.log('Initialized NodeXyoViewer.')\n\n const stepRewardsByPositionViewer = await NodeStepRewardsByPositionViewer.create({\n context: stakedChainContext,\n rewardMultipliers: RewardMultipliers,\n })\n\n console.log('Initializing NodeStepRewardsByPositionViewer...')\n await stepRewardsByPositionViewer.start()\n console.log('Initialized NodeStepRewardsByPositionViewer.')\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 { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport { toEthAddress } from '@xylabs/hex'\nimport type { Logger } from '@xylabs/logger'\nimport { isDefined, isString } from '@xylabs/typeof'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport { boot } from '@xyo-network/bios'\nimport type { BiosExternalInterface } from '@xyo-network/bios-model'\nimport { EthereumChainStake, EthereumChainStakeEvents } from '@xyo-network/chain-ethereum'\nimport { 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 { Config, StakedChainContextRead } from '@xyo-network/xl1-protocol-sdk'\nimport { readPayloadMapFromStore } from '@xyo-network/xl1-protocol-sdk'\n\nimport { 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\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 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 nodeContext = {\n wallet, logger, config,\n }\n const eventsReader = await EthereumChainStakeEvents.create({ contract, logger })\n assertEx(await eventsReader.start(), () => 'Failed to start EthereumChainStakeEvents reader')\n const stakeChainReader = await EthereumChainStake.create({\n contract, eventsReader, logger,\n })\n assertEx(await stakeChainReader.start(), () => 'Failed to start EthereumChainStake reader')\n const rootNode = await getNode(nodeContext)\n const chainArchivist = assertEx(asArchivistInstance(\n await rootNode.resolve('Chain:Validated'),\n { required: true },\n ), () => 'FinalizedArchivist not found in node')\n const chainMap = readPayloadMapFromStore<WithStorageMeta<Payload>>(chainArchivist)\n const resolvedNode: NodeInstance = node ?? await getNode(nodeContext)\n\n const stakedChainContext: StakedChainContextRead = {\n chainId: contractAddress,\n events: eventsReader,\n stake: stakeChainReader,\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'), assertEx(head?.block, () => 'No head found in chainArchivist')]\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 { assertEx } from '@xylabs/assert'\nimport { hexFrom, isHex } from '@xylabs/hex'\nimport { isDefined } from '@xylabs/typeof'\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 } from '@xylabs/assert'\nimport { isDefined } from '@xylabs/typeof'\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 { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport { asAddress, ZERO_ADDRESS } from '@xylabs/hex'\nimport type { Logger } from '@xylabs/logger'\nimport { BaseMongoSdk, type BaseMongoSdkPrivateConfig } from '@xylabs/mongo'\nimport { isDefined } from '@xylabs/typeof'\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 } 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<Promise<MapType<string, WithStorageMeta<TransfersStepSummary>> | undefined>> {\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 return await MongoMap.create<MongoMap<Hash, WithStorageMeta<TransfersStepSummary>>>({\n sdk: sdkTransferSummaryMap,\n getCache: { enabled: true, maxEntries: 5000 },\n })\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/logger'\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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AAW,MAAMC,QAAQR,WAAAA;AAC/B,QAAMS,iBAAiB3B,UAAS4B,qBAC9B,MAAMH,SAASI,QAAQ,iBAAA,GACvB;IAAEC,UAAU;EAAK,CAAA,GAChB,MAAM,sCAAA;AACT,QAAMC,WAAWC,wBAAkDL,cAAAA;AACnE,QAAMM,eAA6B9B,QAAQ,MAAMuB,QAAQR,WAAAA;AAEzD,QAAMgB,qBAA6C;IACjDC,SAASxB;IACTyB,QAAQjB;IACRkB,OAAOd;IACPe,OAAO;MAAEP;IAAS;IAClBQ,MAAM,mCAAA;AACJ,YAAMA,OAAO,MAAMC,oBAAoBb,cAAAA;AACvC,aAAO;QAAC3B,UAASuC,MAAME,OAAO,MAAM,iCAAA;QAAoCzC,UAASuC,MAAMG,OAAO,MAAM,iCAAA;;IACtG,GAHM;EAIR;AACA,QAAMC,OAAO,MAAMV,aAAaJ,QAAQ,GAAA;AACxC,QAAMe,QAAQC,IAAIF,KAAKG,IAAI,CAACC,QAAAA;AAC1B,WAAOA,IAAIzB,QAAK,MAAS,MAAM;EACjC,CAAA,CAAA;AACA,QAAM0B,qBAAqBhD,UAAS,MAAMiD,sBAAsBhE,MAAAA,GAAS,MAAM,sCAAA;AAC/E,QAAMiE,MAAM,MAAMC,OAAOlB,cAAce,oBAAoBd,oBAAoBjD,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,GA/CyB;","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","assertEx","asyncHandler","asAddress","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","NodeNetworkStakeViewer","NodeStepRewardsByPositionViewer","NodeXyoViewer","StepSizes","RewardMultipliers","NodeXyoRunner","rpcEngineFromConnection","XyoBaseConnection","Semaphore","addRpcRoutes","app","transferSummaryMap","stakedChainContext","initRewardsCache","node","runner","NodeXyoRunner","networkStakeViewer","NodeNetworkStakeViewer","create","context","console","log","start","viewer","NodeXyoViewer","rewardMultipliers","RewardMultipliers","transfersSummaryContext","stepSemaphores","StepSizes","map","Semaphore","summaryMap","stepRewardsByPositionViewer","NodeStepRewardsByPositionViewer","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","toEthAddress","isDefined","isString","asArchivistInstance","boot","EthereumChainStake","EthereumChainStakeEvents","findMostRecentBlock","StakedXyoChainV2__factory","HDWallet","readPayloadMapFromStore","assertEx","hexFrom","isHex","isDefined","getChainId","config","chainId","assertEx","evm","isHex","prefix","hex","hexFrom","parsed","Number","parseInt","assertEx","isDefined","InfuraWebSocketProvider","instance","initInfuraProvider","config","providerConfig","getInfuraProviderConfig","Promise","resolve","InfuraWebSocketProvider","getInfuraProviderConfig","config","projectId","assertEx","evm","infura","projectSecret","getChainId","assertEx","asAddress","ZERO_ADDRESS","BaseMongoSdk","isDefined","MemoryArchivist","MongoDBArchivistV2","ViewArchivist","AddressBalanceDivinerV2","AddressTransferDiviner","ArchivistSyncDiviner","HeadValidationDiviner","MongoMap","initTelemetry","AbstractModule","LoggerModuleStatusReporter","ModuleFactoryLocator","MemorySentinel","StepSizes","hasMongoConfig","Semaphore","getTransferSummaryMap","config","mongoConfig","storage","mongo","hasMongoConfig","connectionString","dbConnectionString","database","dbName","domain","dbDomain","password","dbPassword","username","dbUserName","payloadSdkConfig","sdkTransferSummaryMap","BaseMongoSdk","collection","MongoMap","create","sdk","getCache","enabled","maxEntries","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","assertEx","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","provider","initInfuraProvider","contractAddress","chain","id","contract","StakedXyoChainV2__factory","connect","toEthAddress","nodeContext","eventsReader","EthereumChainStakeEvents","create","start","stakeChainReader","EthereumChainStake","rootNode","getNode","chainArchivist","asArchivistInstance","resolve","required","chainMap","readPayloadMapFromStore","resolvedNode","stakedChainContext","chainId","events","stake","store","head","findMostRecentBlock","_hash","block","mods","Promise","all","map","mod","transferSummaryMap","getTransferSummaryMap","app","getApp","initRewardsCache","server","listen","setTimeout"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getLocator.d.ts","sourceRoot":"","sources":["../../../src/manifest/getLocator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAW5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAE1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAGjE,OAAO,KAAK,EACW,MAAM,EAAE,OAAO,EAAE,oBAAoB,EAC3D,MAAM,+BAA+B,CAAA;AAMtC,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAiBhJ;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,SAAS,iBAAiB,kCA4E1D,CAAA"}
1
+ {"version":3,"file":"getLocator.d.ts","sourceRoot":"","sources":["../../../src/manifest/getLocator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAY5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAE1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAGjE,OAAO,KAAK,EACW,MAAM,EAAE,OAAO,EAAE,oBAAoB,EAC3D,MAAM,+BAA+B,CAAA;AAItC,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAiBhJ;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,SAAS,iBAAiB,kCA4E1D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/server/server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAO5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAK3D,OAAO,KAAK,EACV,MAAM,EACP,MAAM,+BAA+B,CAAA;AAgCtC,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,gHA+CxD,CAAA"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/server/server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAO5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAK3D,OAAO,KAAK,EAAE,MAAM,EAA0B,MAAM,+BAA+B,CAAA;AAgCnF,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,gHA+CxD,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/chain-api",
3
- "version": "1.16.1",
3
+ "version": "1.16.3",
4
4
  "description": "XYO Layer One API",
5
5
  "homepage": "https://xylabs.com",
6
6
  "bugs": {
@@ -49,24 +49,23 @@
49
49
  "@opentelemetry/instrumentation": "~0.208.0",
50
50
  "@opentelemetry/instrumentation-express": "~0.57.0",
51
51
  "@opentelemetry/instrumentation-http": "~0.208.0",
52
- "@xylabs/assert": "~5.0.21",
53
- "@xylabs/creatable": "~5.0.21",
54
- "@xylabs/express": "~5.0.21",
55
- "@xylabs/hex": "~5.0.21",
56
- "@xylabs/logger": "~5.0.21",
57
- "@xylabs/mongo": "~5.0.21",
58
- "@xylabs/typeof": "~5.0.21",
52
+ "@xylabs/assert": "~5.0.22",
53
+ "@xylabs/express": "~5.0.22",
54
+ "@xylabs/hex": "~5.0.22",
55
+ "@xylabs/logger": "~5.0.22",
56
+ "@xylabs/mongo": "~5.0.22",
57
+ "@xylabs/typeof": "~5.0.22",
59
58
  "@xyo-network/archivist-memory": "~5.1.18",
60
59
  "@xyo-network/archivist-model": "~5.1.18",
61
60
  "@xyo-network/archivist-mongodb": "~5.1.18",
62
61
  "@xyo-network/archivist-view": "~5.1.18",
63
62
  "@xyo-network/bios": "~7.1.1",
64
63
  "@xyo-network/boundwitness-model": "~5.1.18",
65
- "@xyo-network/chain-ethereum": "~1.16.1",
66
- "@xyo-network/chain-modules": "~1.16.1",
67
- "@xyo-network/chain-protocol": "~1.16.1",
68
- "@xyo-network/chain-rpc": "~1.16.1",
69
- "@xyo-network/chain-telemetry": "~1.16.1",
64
+ "@xyo-network/chain-ethereum": "~1.16.3",
65
+ "@xyo-network/chain-modules": "~1.16.3",
66
+ "@xyo-network/chain-protocol": "~1.16.3",
67
+ "@xyo-network/chain-rpc": "~1.16.3",
68
+ "@xyo-network/chain-telemetry": "~1.16.3",
70
69
  "@xyo-network/manifest-model": "~5.1.18",
71
70
  "@xyo-network/manifest-wrapper": "~5.1.18",
72
71
  "@xyo-network/module-abstract": "~5.1.18",
@@ -79,17 +78,15 @@
79
78
  "@xyo-network/typechain": "~4.0.10",
80
79
  "@xyo-network/wallet": "~5.1.18",
81
80
  "@xyo-network/wallet-model": "~5.1.18",
82
- "@xyo-network/xl1-protocol": "~1.13.0",
83
- "@xyo-network/xl1-protocol-sdk": "~1.16.1",
84
- "@xyo-network/xl1-rpc": "~1.16.1",
81
+ "@xyo-network/xl1-protocol": "~1.13.1",
82
+ "@xyo-network/xl1-protocol-sdk": "~1.16.3",
83
+ "@xyo-network/xl1-rpc": "~1.16.3",
85
84
  "async-mutex": "~0.5.0",
86
85
  "compression": "~1.8.1",
87
86
  "cors": "~2.8.5",
88
87
  "ethers": "~6.15.0",
89
88
  "express": "~5.1.0",
90
- "http-status-codes": "~2.3.0",
91
- "lru-cache": "~11.2.2",
92
- "mongodb": "~7.0.0"
89
+ "http-status-codes": "~2.3.0"
93
90
  },
94
91
  "devDependencies": {
95
92
  "@types/compression": "~1.8.1",
@@ -97,9 +94,9 @@
97
94
  "@types/express": "5.0.5",
98
95
  "@types/express-serve-static-core": "~5.1.0",
99
96
  "@types/node": "~24.10.0",
100
- "@xylabs/base": "~5.0.21",
101
- "@xylabs/object": "~5.0.21",
102
- "@xylabs/promise": "~5.0.21",
97
+ "@xylabs/base": "~5.0.22",
98
+ "@xylabs/object": "~5.0.22",
99
+ "@xylabs/promise": "~5.0.22",
103
100
  "@xylabs/ts-scripts-yarn3": "~7.2.8",
104
101
  "@xylabs/tsconfig": "~7.2.8",
105
102
  "@xyo-network/account": "~5.1.18",
@@ -110,7 +107,7 @@
110
107
  "@xyo-network/module-abstract-mongodb": "~5.1.18",
111
108
  "@xyo-network/module-model-mongodb": "~5.1.18",
112
109
  "@xyo-network/node-memory": "~5.1.18",
113
- "@xyo-network/xl1-protocol": "~1.13.0",
110
+ "@xyo-network/xl1-protocol": "~1.13.1",
114
111
  "dotenv": "~17.2.3",
115
112
  "eslint": "^9.39.1",
116
113
  "nodemon": "~3.1.10",
@@ -10,6 +10,7 @@ import { ViewArchivist } from '@xyo-network/archivist-view'
10
10
  import {
11
11
  AddressBalanceDivinerV2, AddressTransferDiviner, ArchivistSyncDiviner, HeadValidationDiviner,
12
12
  } from '@xyo-network/chain-modules'
13
+ import { MongoMap } from '@xyo-network/chain-protocol'
13
14
  import { initTelemetry } from '@xyo-network/chain-telemetry'
14
15
  import { AbstractModule, LoggerModuleStatusReporter } from '@xyo-network/module-abstract'
15
16
  import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
@@ -23,8 +24,6 @@ import type {
23
24
  import { hasMongoConfig } from '@xyo-network/xl1-protocol-sdk'
24
25
  import { Semaphore } from 'async-mutex'
25
26
 
26
- import { MongoMap } from '../driver/index.ts'
27
-
28
27
  export interface GetLocatorContext {
29
28
  config: Config
30
29
  logger?: Logger
@@ -7,15 +7,13 @@ import { asArchivistInstance } from '@xyo-network/archivist-model'
7
7
  import { boot } from '@xyo-network/bios'
8
8
  import type { BiosExternalInterface } from '@xyo-network/bios-model'
9
9
  import { EthereumChainStake, EthereumChainStakeEvents } from '@xyo-network/chain-ethereum'
10
- import { findMostRecentBlock, getLocalPersistentMap } from '@xyo-network/chain-protocol'
10
+ import { findMostRecentBlock } from '@xyo-network/chain-protocol'
11
11
  import type { NodeInstance } from '@xyo-network/node-model'
12
12
  import type { Payload, WithStorageMeta } from '@xyo-network/payload-model'
13
13
  import { StakedXyoChainV2__factory } from '@xyo-network/typechain'
14
14
  import { HDWallet } from '@xyo-network/wallet'
15
15
  import type { ChainId } from '@xyo-network/xl1-protocol'
16
- import type {
17
- Config, StakedChainContextRead, TransfersStepSummary,
18
- } from '@xyo-network/xl1-protocol-sdk'
16
+ import type { Config, StakedChainContextRead } from '@xyo-network/xl1-protocol-sdk'
19
17
  import { readPayloadMapFromStore } from '@xyo-network/xl1-protocol-sdk'
20
18
 
21
19
  import { initInfuraProvider } from '../helpers/index.ts'
@@ -1,2 +0,0 @@
1
- export * from './mongo/index.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/driver/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1,23 +0,0 @@
1
- import { AbstractCreatable, CreatableParams } from '@xylabs/creatable';
2
- import { BaseMongoSdk } from '@xylabs/mongo';
3
- import { AsynchronousMap } from '@xyo-network/xl1-protocol-sdk';
4
- import { Document } from 'mongodb';
5
- export interface MongoMapParams<TData extends Document = Document> extends CreatableParams {
6
- getCache?: {
7
- enabled: boolean;
8
- maxEntries?: number;
9
- };
10
- sdk: BaseMongoSdk<TData>;
11
- }
12
- export declare class MongoMap<K extends {} = string, V extends Document = Document> extends AbstractCreatable<MongoMapParams<V>> implements AsynchronousMap<K, V> {
13
- private _getCache;
14
- get sdk(): BaseMongoSdk<V>;
15
- clear(): Promise<void>;
16
- delete(id: K): Promise<boolean>;
17
- get(id: K): Promise<V | undefined>;
18
- getMany(ids: K[]): Promise<V[]>;
19
- has(id: K): Promise<boolean>;
20
- set(id: K, data: V): Promise<void>;
21
- startHandler(): Promise<void>;
22
- }
23
- //# sourceMappingURL=MongoMap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MongoMap.d.ts","sourceRoot":"","sources":["../../../../src/driver/mongo/MongoMap.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EAAa,eAAe,EAC9C,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE/D,OAAO,EACL,QAAQ,EACT,MAAM,SAAS,CAAA;AAEhB,MAAM,WAAW,cAAc,CAAC,KAAK,SAAS,QAAQ,GAAG,QAAQ,CAAE,SAAQ,eAAe;IACxF,QAAQ,CAAC,EAAE;QACT,OAAO,EAAE,OAAO,CAAA;QAChB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;IACD,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,CAAA;CACzB;AAOD,qBACa,QAAQ,CAAC,CAAC,SAAS,EAAE,GAAG,MAAM,EAAE,CAAC,SAAS,QAAQ,GAAG,QAAQ,CACxE,SAAQ,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,CAC3C,YAAW,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;IAChC,OAAO,CAAC,SAAS,CAA4B;IAE7C,IAAI,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAEzB;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAKtB,MAAM,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ/B,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAYlC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IA4B/B,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAY5B,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAOzB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAS7C"}
@@ -1,2 +0,0 @@
1
- export * from './MongoMap.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/driver/mongo/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=MongoMap.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MongoMap.spec.d.ts","sourceRoot":"","sources":["../../../../../src/driver/mongo/spec/MongoMap.spec.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- export * from './mongo/index.ts'
@@ -1,117 +0,0 @@
1
- import { assertEx } from '@xylabs/assert'
2
- import {
3
- AbstractCreatable, creatable, CreatableParams,
4
- } from '@xylabs/creatable'
5
- import { BaseMongoSdk } from '@xylabs/mongo'
6
- import { isNull } from '@xylabs/typeof'
7
- import { AsynchronousMap } from '@xyo-network/xl1-protocol-sdk'
8
- import { LRUCache } from 'lru-cache'
9
- import {
10
- Document, Filter, OptionalUnlessRequiredId, WithId,
11
- } from 'mongodb'
12
-
13
- export interface MongoMapParams<TData extends Document = Document> extends CreatableParams {
14
- getCache?: {
15
- enabled: boolean
16
- maxEntries?: number
17
- }
18
- sdk: BaseMongoSdk<TData>
19
- }
20
-
21
- function stripMongoId<V extends Document>(doc: WithId<V>): V {
22
- const { _id, ...rest } = doc
23
- return rest as unknown as V
24
- }
25
-
26
- @creatable()
27
- export class MongoMap<K extends {} = string, V extends Document = Document>
28
- extends AbstractCreatable<MongoMapParams<V>>
29
- implements AsynchronousMap<K, V> {
30
- private _getCache: LRUCache<K, V> | undefined
31
-
32
- get sdk(): BaseMongoSdk<V> {
33
- return assertEx(this.params.sdk, () => 'No sdk specified')
34
- }
35
-
36
- async clear(): Promise<void> {
37
- this._getCache?.clear()
38
- await this.sdk.deleteMany({})
39
- }
40
-
41
- async delete(id: K): Promise<boolean> {
42
- this._getCache?.delete(id)
43
-
44
- const filter = { _id: id } as Filter<V>
45
- const result = await this.sdk.deleteOne(filter)
46
- return result.deletedCount > 0
47
- }
48
-
49
- async get(id: K): Promise<V | undefined> {
50
- if (this._getCache) {
51
- const getCacheResult = this._getCache.get(id)
52
- if (getCacheResult) {
53
- return getCacheResult
54
- }
55
- }
56
- const filter = { _id: id } as Filter<V>
57
- const doc = await this.sdk.findOne(filter)
58
- return isNull(doc) ? undefined : stripMongoId(doc)
59
- }
60
-
61
- async getMany(ids: K[]): Promise<V[]> {
62
- /* const results = await Promise.all(ids.map(async (id) => {
63
- return await this.get(id)
64
- }))
65
- return results.filter(exists) */
66
- const cache = this._getCache
67
- const idSet = new Set(ids)
68
- const results: V[] = []
69
- if (cache) {
70
- const getCacheResult = ids.map(id => ([id, cache.get(id)])).filter(([, item]) => item !== undefined) as [K, V][]
71
- for (const [id] of getCacheResult) {
72
- idSet.delete(id)
73
- }
74
- results.push(...getCacheResult.map(([, item]) => item))
75
- }
76
- const filter = { _id: { $in: [...idSet] } } as Filter<V>
77
- const items = await (await this.sdk.find(filter)).toArray()
78
- for (const item of items) {
79
- const id = item._id
80
- const stripped = stripMongoId(item)
81
- if (cache) {
82
- cache.set(id as unknown as K, stripped)
83
- }
84
- results.push(stripped)
85
- }
86
- return results
87
- }
88
-
89
- async has(id: K): Promise<boolean> {
90
- if (this._getCache) {
91
- const getCacheResult = this._getCache.has(id)
92
- if (getCacheResult) {
93
- return getCacheResult
94
- }
95
- }
96
- const filter = { _id: id } as Filter<V>
97
- const exists = await this.sdk.findOne(filter)
98
- return isNull(exists) ? false : true
99
- }
100
-
101
- async set(id: K, data: V): Promise<void> {
102
- const filter = { _id: id } as Filter<V>
103
- const value = { ...data, _id: id } as OptionalUnlessRequiredId<V>
104
- await this.sdk.replaceOne(filter, value, { upsert: true })
105
- this._getCache?.set(id, data)
106
- }
107
-
108
- override async startHandler(): Promise<void> {
109
- await super.startHandler()
110
- // TODO: Ensure index
111
-
112
- if (this.params.getCache?.enabled === true) {
113
- const maxEntries = this.params.getCache?.maxEntries ?? 5000
114
- this._getCache = new LRUCache<K, V>({ max: maxEntries })
115
- }
116
- }
117
- }
@@ -1 +0,0 @@
1
- export * from './MongoMap.ts'
@@ -1,67 +0,0 @@
1
- import { BaseMongoSdk } from '@xylabs/mongo'
2
- import { getBaseMongoSdkPrivateConfig, hasMongoDBConfig } from '@xyo-network/module-abstract-mongodb'
3
- import {
4
- beforeAll, beforeEach, describe, expect, it,
5
- } from 'vitest'
6
-
7
- import { MongoMap } from '../MongoMap.ts'
8
-
9
- describe.runIf(hasMongoDBConfig())('MongoMap', () => {
10
- interface TestDoc {
11
- name: string
12
- value: number
13
- }
14
- const collection = 'test_mongo_map'
15
- let sdk: BaseMongoSdk<TestDoc>
16
- let map: MongoMap<string, TestDoc>
17
- beforeAll(async () => {
18
- const payloadSdkConfig = getBaseMongoSdkPrivateConfig()
19
- sdk = new BaseMongoSdk<TestDoc>({ ...payloadSdkConfig, collection })
20
- map = await MongoMap.create<MongoMap<string, TestDoc>>({ sdk })
21
- await map.start()
22
- })
23
-
24
- beforeEach(async () => {
25
- await map.clear()
26
- })
27
-
28
- it('can set and get a value', async () => {
29
- await map.set('foo', { name: 'Test', value: 42 })
30
- const result = await map.get('foo')
31
- expect(result).toEqual({ name: 'Test', value: 42 })
32
- })
33
-
34
- it('returns undefined for missing key', async () => {
35
- const result = await map.get('missing')
36
- expect(result).toBeUndefined()
37
- })
38
-
39
- it('can detect if key exists', async () => {
40
- await map.set('exists', { name: 'Check', value: 100 })
41
- const hasExists = await map.has('exists')
42
- const hasMissing = await map.has('does-not-exist')
43
- expect(hasExists).toBe(true)
44
- expect(hasMissing).toBe(false)
45
- })
46
-
47
- it('can delete a key', async () => {
48
- await map.set('delete-me', { name: 'ToDelete', value: 1 })
49
- const deleted = await map.delete('delete-me')
50
- const stillExists = await map.has('delete-me')
51
- expect(deleted).toBe(true)
52
- expect(stillExists).toBe(false)
53
- })
54
-
55
- it('delete returns false for non-existent key', async () => {
56
- const deleted = await map.delete('non-existent')
57
- expect(deleted).toBe(false)
58
- })
59
-
60
- it('can clear all entries', async () => {
61
- await map.set('one', { name: 'A', value: 1 })
62
- await map.set('two', { name: 'B', value: 2 })
63
- await map.clear()
64
- expect(await map.has('one')).toBe(false)
65
- expect(await map.has('two')).toBe(false)
66
- })
67
- })