@xyo-network/chain-api 1.16.19 → 1.16.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -336,54 +336,18 @@ var getApp = /* @__PURE__ */ __name(async (node, transferSummaryMap, stakedChain
336
336
  }, "getApp");
337
337
 
338
338
  // src/server/server.ts
339
- import { assertEx as assertEx6, isDefined as isDefined6, isString, toEthAddress } from "@xylabs/sdk-js";
339
+ import { assertEx as assertEx4, isDefined as isDefined4, isString } from "@xylabs/sdk-js";
340
340
  import { asArchivistInstance as asArchivistInstance2 } from "@xyo-network/archivist-model";
341
341
  import { boot } from "@xyo-network/bios";
342
- import { EthereumChainStakeEvents, EthereumChainStakeViewer } from "@xyo-network/chain-ethereum";
343
- import { findMostRecentBlock } from "@xyo-network/chain-protocol";
344
- import { StakedXyoChainV2__factory } from "@xyo-network/typechain";
342
+ import { createProducerChainStakeIntentBlock, initChainStakeViewer, initProducerAccount } from "@xyo-network/chain-orchestration";
343
+ import { createGenesisBlock, findMostRecentBlock } from "@xyo-network/chain-protocol";
345
344
  import { HDWallet } from "@xyo-network/wallet";
345
+ import { asXL1BlockRange } from "@xyo-network/xl1-protocol";
346
346
  import { readPayloadMapFromStore } from "@xyo-network/xl1-protocol-sdk";
347
347
 
348
- // src/helpers/initChainId.ts
349
- import { assertEx as assertEx3, hexFrom, isDefined as isDefined3, isHex } from "@xylabs/sdk-js";
350
- var getChainId = /* @__PURE__ */ __name((config) => {
351
- const chainId = assertEx3(config.evm.chainId, () => "Missing config.evm.chainId");
352
- if (isHex(chainId, {
353
- prefix: true
354
- })) {
355
- const hex = hexFrom(chainId);
356
- const parsed = Number.parseInt(hex, 16);
357
- return parsed;
358
- } else {
359
- const parsed = Number.parseInt(chainId, 10);
360
- return parsed;
361
- }
362
- }, "getChainId");
363
-
364
- // src/helpers/initInfuraProvider.ts
365
- import { assertEx as assertEx4, isDefined as isDefined4 } from "@xylabs/sdk-js";
366
- import { InfuraWebSocketProvider } from "ethers/providers";
367
- var instance;
368
- var initInfuraProvider = /* @__PURE__ */ __name((config) => {
369
- if (instance) return instance;
370
- const providerConfig = getInfuraProviderConfig(config);
371
- instance = Promise.resolve(new InfuraWebSocketProvider(providerConfig[0], providerConfig[1]));
372
- return instance;
373
- }, "initInfuraProvider");
374
- var getInfuraProviderConfig = /* @__PURE__ */ __name((config) => {
375
- const projectId = assertEx4(config.evm?.infura?.projectId, () => "Missing config.evm.infura.projectId");
376
- const projectSecret = assertEx4(config.evm?.infura?.projectSecret, () => "Missing config.evm.infura.projectSecret");
377
- return [
378
- getChainId(config),
379
- projectId,
380
- projectSecret
381
- ];
382
- }, "getInfuraProviderConfig");
383
-
384
348
  // src/manifest/getLocator.ts
385
349
  import { BaseMongoSdk } from "@xylabs/mongo";
386
- import { asAddress as asAddress3, assertEx as assertEx5, isDefined as isDefined5, ZERO_ADDRESS } from "@xylabs/sdk-js";
350
+ import { asAddress as asAddress3, assertEx as assertEx3, isDefined as isDefined3, ZERO_ADDRESS } from "@xylabs/sdk-js";
387
351
  import { MemoryArchivist } from "@xyo-network/archivist-memory";
388
352
  import { MongoDBArchivistV2 } from "@xyo-network/archivist-mongodb";
389
353
  import { ViewArchivist } from "@xyo-network/archivist-view";
@@ -394,7 +358,7 @@ import { AbstractModule, LoggerModuleStatusReporter } from "@xyo-network/module-
394
358
  import { ModuleFactoryLocator } from "@xyo-network/module-factory-locator";
395
359
  import { MemorySentinel } from "@xyo-network/sentinel-memory";
396
360
  import { StepSizes as StepSizes2 } from "@xyo-network/xl1-protocol";
397
- import { hasMongoConfig } from "@xyo-network/xl1-protocol-sdk";
361
+ import { hasMongoConfig, MemoryMap } from "@xyo-network/xl1-protocol-sdk";
398
362
  import { Semaphore as Semaphore2 } from "async-mutex";
399
363
  async function getTransferSummaryMap(config) {
400
364
  const mongoConfig = config.storage?.mongo;
@@ -411,13 +375,18 @@ async function getTransferSummaryMap(config) {
411
375
  ...payloadSdkConfig,
412
376
  collection: "transfer_summary_map"
413
377
  });
414
- return await MongoMap.create({
378
+ const result = await MongoMap.create({
415
379
  sdk: sdkTransferSummaryMap,
416
380
  getCache: {
417
381
  enabled: true,
418
382
  maxEntries: 5e3
419
383
  }
420
384
  });
385
+ assertEx3(await result.start(), () => "Failed to start transfer summary map");
386
+ return result;
387
+ } else {
388
+ console.warn("[API] Mongo configuration not found. Using MemoryMap for TransferSummaryMap.");
389
+ return new MemoryMap();
421
390
  }
422
391
  }
423
392
  __name(getTransferSummaryMap, "getTransferSummaryMap");
@@ -435,7 +404,7 @@ var getLocator = /* @__PURE__ */ __name(async (context) => {
435
404
  port: 9465
436
405
  }
437
406
  });
438
- if (isDefined5(logger)) AbstractModule.defaultLogger = logger;
407
+ if (isDefined3(logger)) AbstractModule.defaultLogger = logger;
439
408
  const statusReporter = logger ? new LoggerModuleStatusReporter(logger) : void 0;
440
409
  const locator = new ModuleFactoryLocator();
441
410
  let balanceSummaryMap;
@@ -483,7 +452,7 @@ var getLocator = /* @__PURE__ */ __name(async (context) => {
483
452
  summaryMap: transferSummaryMap,
484
453
  stepSemaphores: StepSizes2.map(() => new Semaphore2(20))
485
454
  }));
486
- const chainId = isDefined5(config.chain.id) ? assertEx5(asAddress3(config.chain.id), () => "chain.id must be an Address") : ZERO_ADDRESS;
455
+ const chainId = isDefined3(config.chain.id) ? assertEx3(asAddress3(config.chain.id), () => "chain.id must be an Address") : ZERO_ADDRESS;
487
456
  locator.register(HeadValidationDiviner.factory({
488
457
  traceProvider,
489
458
  meterProvider,
@@ -943,41 +912,51 @@ var getSeedPhrase = /* @__PURE__ */ __name(async (bios, config, logger) => {
943
912
  }
944
913
  await bios.seedPhraseStore.set("os", seedPhrase);
945
914
  }
946
- return assertEx6(await bios.seedPhraseStore.get("os"), () => "Unable to acquire mnemonic from bios");
915
+ return assertEx4(await bios.seedPhraseStore.get("os"), () => "Unable to acquire mnemonic from bios");
947
916
  }, "getSeedPhrase");
948
917
  var getServer = /* @__PURE__ */ __name(async (context) => {
949
918
  const { config, logger, node } = context;
950
919
  const { mnemonic, port } = context.config.api;
951
920
  const bios = await boot();
952
- const seedPhrase = isDefined6(mnemonic) ? mnemonic : await getSeedPhrase(bios, config, logger);
921
+ const seedPhrase = isDefined4(mnemonic) ? mnemonic : await getSeedPhrase(bios, config, logger);
953
922
  const wallet = await HDWallet.fromPhrase(seedPhrase);
954
- const provider = await initInfuraProvider(config);
955
- const contractAddress = assertEx6(config.chain.id, () => "Missing config.evm.chainId");
956
- const contract = StakedXyoChainV2__factory.connect(toEthAddress(contractAddress), provider);
923
+ const stakeChainViewer = await initChainStakeViewer(config, logger);
957
924
  const nodeContext = {
958
925
  wallet,
959
926
  logger,
960
927
  config
961
928
  };
962
- const stakeEventsViewer = await EthereumChainStakeEvents.create({
963
- contract,
964
- logger
965
- });
966
- assertEx6(await stakeEventsViewer.start(), () => "Failed to start EthereumChainStakeEvents reader");
967
- const stakeChainViewer = await EthereumChainStakeViewer.create({
968
- contract,
969
- stakeEventsViewer,
970
- logger
971
- });
972
- assertEx6(await stakeChainViewer.start(), () => "Failed to start EthereumChainStake viewer");
973
929
  const resolvedNode = node ?? await getNode(nodeContext);
974
- const chainArchivist = assertEx6(asArchivistInstance2(await resolvedNode.resolve("Chain:Validated"), {
930
+ const chainArchivist = assertEx4(asArchivistInstance2(await resolvedNode.resolve("Chain:Validated"), {
975
931
  required: true
976
932
  }), () => "FinalizedArchivist not found in node");
977
933
  const chainMap = readPayloadMapFromStore(chainArchivist);
934
+ const payloads = await chainArchivist.next();
935
+ if (payloads.length === 0) {
936
+ logger?.warn("[API] No blocks found in chain archivist, creating genesis block");
937
+ const producerAccount = await initProducerAccount({
938
+ config,
939
+ logger
940
+ });
941
+ const chainId = stakeChainViewer.chainId;
942
+ const block0 = await createGenesisBlock(producerAccount, chainId, 1000000n, producerAccount.address);
943
+ await chainArchivist.insert([
944
+ ...block0[1].flat(),
945
+ block0[0]
946
+ ]);
947
+ console.log("[API] Genesis block created and inserted into chain archivist");
948
+ const block1 = await createProducerChainStakeIntentBlock(block0[0], producerAccount, asXL1BlockRange([
949
+ 0,
950
+ 1e4
951
+ ], true));
952
+ await chainArchivist.insert([
953
+ ...block1[1].flat(),
954
+ block1[0]
955
+ ]);
956
+ console.log(`[API] Producer declared: ${producerAccount.address}`);
957
+ }
978
958
  const stakedChainContext = {
979
- chainId: contractAddress,
980
- events: stakeEventsViewer,
959
+ chainId: stakeChainViewer.chainId,
981
960
  stake: stakeChainViewer,
982
961
  store: {
983
962
  chainMap
@@ -985,8 +964,8 @@ var getServer = /* @__PURE__ */ __name(async (context) => {
985
964
  head: /* @__PURE__ */ __name(async () => {
986
965
  const head = await findMostRecentBlock(chainArchivist);
987
966
  return [
988
- assertEx6(head?._hash, () => "No head found in chainArchivist"),
989
- assertEx6(head?.block, () => "No head found in chainArchivist")
967
+ assertEx4(head?._hash, () => "No head found in chainArchivist"),
968
+ head?.block ?? 0
990
969
  ];
991
970
  }, "head")
992
971
  };
@@ -994,7 +973,7 @@ var getServer = /* @__PURE__ */ __name(async (context) => {
994
973
  await Promise.all(mods.map((mod) => {
995
974
  return mod.start?.() ?? (() => true);
996
975
  }));
997
- const transferSummaryMap = assertEx6(await getTransferSummaryMap(config), () => "Transfer Summary Map not initialized");
976
+ const transferSummaryMap = assertEx4(await getTransferSummaryMap(config), () => "Transfer Summary Map not initialized");
998
977
  const app = await getApp(resolvedNode, transferSummaryMap, stakedChainContext, config.api.initRewardsCache);
999
978
  const server = app.listen(port, hostname, () => logger?.log(`[API] Server listening at http://${hostname}:${port}`));
1000
979
  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/manifest/getNode.ts","../../src/manifest/node.json","../../src/manifest/nodeManifest.ts","../../src/manifest/private/index.ts","../../src/manifest/public/WithMempool/Chain.json","../../src/manifest/public/WithMempool/Pending.json","../../src/manifest/public/WithMempool/index.ts","../../src/manifest/public/WithoutMempool/Chain.json","../../src/manifest/public/WithoutMempool/Pending.json","../../src/manifest/public/WithoutMempool/index.ts"],"sourcesContent":["import {\n customPoweredByHeader,\n disableCaseSensitiveRouting,\n disableExpressDefaultPoweredByHeader,\n getJsonBodyParser,\n getJsonBodyParserOptions,\n responseProfiler,\n standardErrors,\n standardResponses,\n} from '@xylabs/express'\nimport type { NodeInstance } from '@xyo-network/node-model'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport type {\n MapType, StakedChainContextRead, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport compression from 'compression'\nimport cors from 'cors'\nimport type { Express } from 'express'\nimport express from 'express'\n\nimport { addInstrumentation } from './instrumentation.ts'\nimport { addRoutes } from './routes/index.ts'\n\nexport const getApp = async (\n node: NodeInstance,\n transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>,\n stakedChainContext: StakedChainContextRead,\n initRewardsCache?: boolean,\n): Promise<Express> => {\n addInstrumentation()\n const app = express()\n app.set('etag', false)\n\n app.use(cors())\n app.use(compression())\n app.use(responseProfiler)\n app.use(getJsonBodyParser(getJsonBodyParserOptions({ limit: '1mb' })))\n app.use(standardResponses)\n disableExpressDefaultPoweredByHeader(app)\n app.use(customPoweredByHeader)\n disableCaseSensitiveRouting(app)\n app.node = node\n await addRoutes(app, transferSummaryMap, stakedChainContext, initRewardsCache)\n app.use(standardErrors)\n return app\n}\n","import { registerInstrumentations } from '@opentelemetry/instrumentation'\nimport { ExpressInstrumentation } from '@opentelemetry/instrumentation-express'\nimport { HttpInstrumentation } from '@opentelemetry/instrumentation-http'\n\n/**\n * Registers OpenTelemetry instrumentations for HTTP and Express.\n * This function is used to set up the necessary instrumentations for monitoring\n * HTTP requests and Express applications. Since it monkey patches the Express\n * router & middleware system, it should be called before any Express applications\n * are defined.\n */\nexport const addInstrumentation = () => {\n const instrumentations = [new HttpInstrumentation(), new ExpressInstrumentation()]\n registerInstrumentations({ instrumentations })\n}\n","import type { Express } from 'express'\nimport { StatusCodes } from 'http-status-codes'\n\nimport { getAddress } from './get/index.ts'\nimport { postAddress } from './post/index.ts'\n\nexport const addNodeRoutes = (app: Express) => {\n const defaultModule = app.node\n const address = defaultModule.address\n const defaultModuleEndpoint = `/${address}`\n app.get('/', (_req, res) => res.redirect(StatusCodes.MOVED_TEMPORARILY, defaultModuleEndpoint))\n app.post('/', (_req, res) => res.redirect(StatusCodes.TEMPORARY_REDIRECT, defaultModuleEndpoint))\n app.get('/:address', getAddress)\n app.post('/:address', postAddress)\n app.get('/:hash', (_req, res) => {\n res.sendStatus(StatusCodes.NOT_FOUND)\n })\n app.post('/:hash', (_req, res) => {\n res.sendStatus(StatusCodes.NOT_FOUND)\n })\n}\n","import { asyncHandler } from '@xylabs/express'\nimport { asAddress, isDefined } from '@xylabs/sdk-js'\nimport { isModuleName } from '@xyo-network/module-model'\nimport type { Payload } from '@xyo-network/payload-model'\nimport type { RequestHandler } from 'express'\nimport { StatusCodes } from 'http-status-codes'\n\nimport type { AddressPathParams } from '../AddressPathParams.ts'\n\nconst handler: RequestHandler<AddressPathParams, Payload[]> = async (req, res, next) => {\n const { address: moduleIdentifier } = req.params\n const { node } = req.app\n const address = asAddress(moduleIdentifier)\n if (isDefined(address)) {\n let mod = node.address === address ? node : (await node.resolve(address, { direction: 'down' }))\n if (mod) {\n res.json(await mod.state())\n return\n }\n }\n if (isModuleName(moduleIdentifier)) {\n const mod = await node.resolve(moduleIdentifier, { direction: 'down' })\n if (mod) {\n res.redirect(StatusCodes.MOVED_TEMPORARILY, `/${mod.address}`)\n return\n }\n }\n next('route')\n}\nexport const getAddress = asyncHandler(handler)\n","import { asyncHandler } from '@xylabs/express'\nimport type { JsonObject } from '@xylabs/sdk-js'\nimport {\n asAddress, assertEx,\n isAddress,\n toAddress,\n} from '@xylabs/sdk-js'\nimport { isQueryBoundWitness, type QueryBoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleErrorBuilder } from '@xyo-network/module-abstract'\nimport type { ModuleInstance, ModuleQueryResult } from '@xyo-network/module-model'\nimport type { ModuleError, Payload } from '@xyo-network/payload-model'\nimport type { RequestHandler } from 'express'\nimport { StatusCodes } from 'http-status-codes'\n\nimport type { AddressPathParams } from '../AddressPathParams.ts'\nimport { getQueryConfig } from './getQueryConfig.ts'\n\ntype PostAddressRequestBody = [QueryBoundWitness, undefined | Payload[]]\n\nconst handler: RequestHandler<AddressPathParams, ModuleQueryResult | ModuleError, PostAddressRequestBody> = async (req, res, next) => {\n const returnError = (code: number, message = 'An error occurred', details?: JsonObject) => {\n const error = new ModuleErrorBuilder().message(message).details(details).build()\n res.locals.rawResponse = false\n res.status(code).json(error)\n next()\n }\n\n const { address } = req.params\n const { node } = req.app\n const [bw, payloads] = Array.isArray(req.body) ? req.body : []\n if (!isAddress(address)) {\n return returnError(StatusCodes.BAD_REQUEST, 'Missing address')\n }\n\n if (!bw) {\n return returnError(StatusCodes.BAD_REQUEST, 'Missing boundwitness')\n }\n\n if (!isQueryBoundWitness(bw)) {\n return returnError(StatusCodes.BAD_REQUEST, 'Invalid query boundwitness')\n }\n\n let modules: ModuleInstance[] = []\n const normalizedAddress = toAddress(address)\n if (node.address === normalizedAddress) modules = [node]\n else {\n const typedAddress = asAddress(address)\n const byAddress = (typedAddress === undefined) ? undefined : await node.resolve(typedAddress, { maxDepth: 10 })\n\n if (byAddress) modules = [byAddress]\n else {\n const byName = await node.resolve(address, { direction: 'down' })\n if (byName) {\n const moduleAddress = assertEx(byName?.address, () => 'Error redirecting to module by address')\n res.redirect(StatusCodes.TEMPORARY_REDIRECT, `/${moduleAddress}`)\n return\n } else {\n return returnError(StatusCodes.NOT_FOUND, 'Module not found', { address })\n }\n }\n }\n\n if (modules.length > 0) {\n const mod = modules[0]\n const queryConfig = getQueryConfig(mod, req, bw, payloads)\n try {\n const queryResult = await mod.query(bw, payloads, queryConfig)\n res.json(queryResult)\n } catch (ex) {\n return returnError(StatusCodes.INTERNAL_SERVER_ERROR, 'Query Failed', { message: (ex as Error)?.message ?? 'Unknown Error' })\n }\n } else {\n return returnError(StatusCodes.NOT_FOUND, 'Module not found', { address })\n }\n}\n\nexport const postAddress = asyncHandler(handler)\n","import type { BoundWitness, QueryBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessSchema } from '@xyo-network/boundwitness-model'\nimport type { ModuleConfig, ModuleInstance } from '@xyo-network/module-model'\nimport { ModuleConfigSchema } from '@xyo-network/module-model'\nimport type { Payload } from '@xyo-network/payload-model'\nimport type { Request } from 'express'\n\nconst DEFAULT_DEPTH = 5 as const\n\nexport const getQueryConfig = (mod: ModuleInstance, req: Request, bw: QueryBoundWitness, payloads?: Payload[]): ModuleConfig | undefined => {\n // TODO: Filter based on query addresses?\n // Recurse through payloads for nested BWs\n const nestedBwAddresses\n = payloads\n ?.flat(DEFAULT_DEPTH)\n .filter<BoundWitness>((payload): payload is BoundWitness => payload?.schema === BoundWitnessSchema)\n .map(bw => bw.addresses) ?? []\n // TODO: Do we want to end up with a list of addresses or a list of address lists?\n const addresses = [bw.addresses, ...nestedBwAddresses].filter(address => address.length > 0)\n const allowed = addresses.length > 0 ? Object.fromEntries(mod.queries.map(schema => [schema, addresses])) : {}\n const security = { allowed }\n return { schema: ModuleConfigSchema, security }\n}\n","import { setRawResponseFormat } from '@xylabs/express'\nimport { asHash, isDefined } from '@xylabs/sdk-js'\nimport type {\n ArchivistInstance,\n ArchivistNextOptions, NextOptions,\n} from '@xyo-network/archivist-model'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { NodeInstance } from '@xyo-network/node-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isAnyPayload, isSequence } from '@xyo-network/payload-model'\nimport type { Router } from 'express'\nimport express from 'express'\nimport type { Request } from 'express-serve-static-core'\n\nconst resolveArchivist = async (node: NodeInstance, archivistModuleIdentifier: ModuleIdentifier): Promise<ArchivistInstance> => {\n const mod = await node.resolve(archivistModuleIdentifier)\n return asArchivistInstance(mod, { required: true })\n}\n\nlet archivistInstance: ArchivistInstance | undefined\n\nconst getArchivist = async (node: NodeInstance, archivistModuleIdentifier: ModuleIdentifier): Promise<ArchivistInstance> => {\n if (isDefined(archivistInstance)) return archivistInstance\n archivistInstance = await resolveArchivist(node, archivistModuleIdentifier)\n return archivistInstance\n}\n\ntype ArchivistMiddlewareOptions = {\n archivistModuleIdentifier: ModuleIdentifier\n node: NodeInstance\n}\n\nexport const archivistMiddleware = (options: ArchivistMiddlewareOptions): Router => {\n const { node, archivistModuleIdentifier } = options\n const router = express.Router({ mergeParams: true })\n\n router.post('/insert', async (req, res) => {\n setRawResponseFormat(res)\n const body = Array.isArray(req.body) ? req.body : [req.body]\n const payloads = (await PayloadBuilder.hashPairs<Payload>(body)).map(p => p[0])\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const result = await archivist.insert(payloads)\n res.status(200).json(result)\n })\n\n router.get('/next', async (req: Request<Partial<NextOptions>>, res) => {\n setRawResponseFormat(res)\n const cursor = isSequence(req.query.cursor) ? req.query.cursor : undefined\n const limit = isDefined(req.query.limit) ? Number(req.query.limit) : undefined\n const open = isDefined(req.query.open) ? Boolean(req.query.open) : undefined\n const order = req.query.order === 'asc' ? 'asc' : 'desc'\n const options: ArchivistNextOptions = {\n limit, open, order, cursor,\n }\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const result = await archivist.next(options)\n res.status(200).json(result)\n })\n router.post('/next', async (req: Request<{}, {}, ArchivistNextOptions | undefined>, res) => {\n setRawResponseFormat(res)\n const options = req.body\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const result = await (isDefined(options) ? archivist.next(options) : archivist.next())\n res.status(200).json(result)\n })\n\n router.get('/get/:hash', async (req, res) => {\n setRawResponseFormat(res)\n const { hash: rawHash } = req.params\n const hash = asHash(rawHash)\n if (isDefined(hash)) {\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const [payload] = await archivist.get([hash])\n if (isAnyPayload(payload)) {\n res.json(payload)\n return\n }\n }\n res.status(400).send()\n })\n\n return router\n}\n","import type { Express } from 'express'\n\nimport { archivistMiddleware } from './archivistMiddleware.ts'\n\nexport const addDataLakeRoutes = (app: Express) => {\n const { node } = app\n const archivistModuleIdentifier = 'Chain:Finalized'\n app.use('/chain', archivistMiddleware({ node, archivistModuleIdentifier }))\n}\n","import { setRawResponseFormat } from '@xylabs/express'\nimport { assertEx } from '@xylabs/sdk-js'\nimport { NodeXyoViewer } from '@xyo-network/chain-rpc'\nimport { SimpleNetworkStakeViewer, SimpleStepRewardsByPositionViewer } from '@xyo-network/chain-viewers'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport { StepSizes } from '@xyo-network/xl1-protocol'\nimport type {\n MapType, StakedChainContextRead, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport { RewardMultipliers } from '@xyo-network/xl1-protocol-sdk'\nimport {\n NodeXyoRunner, rpcEngineFromConnection, XyoBaseConnection,\n} from '@xyo-network/xl1-rpc'\nimport { Semaphore } from 'async-mutex'\nimport type { Express } from 'express'\n\nexport const addRpcRoutes = async (\n app: Express,\n transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>,\n stakedChainContext: StakedChainContextRead,\n initRewardsCache?: boolean,\n) => {\n const { node } = app\n const runner = new NodeXyoRunner(node)\n const networkStakeViewer = await SimpleNetworkStakeViewer.create({ context: stakedChainContext })\n\n console.log('Initializing SimpleNetworkStakeViewer...')\n assertEx(await networkStakeViewer.start(), () => 'Failed to start SimpleNetworkStakeViewer')\n console.log('Initialized SimpleNetworkStakeViewer.')\n\n const viewer = await NodeXyoViewer.create({\n node,\n rewardMultipliers: RewardMultipliers,\n initRewardsCache,\n context: stakedChainContext,\n transfersSummaryContext: {\n ...stakedChainContext, stepSemaphores: StepSizes.map(() => new Semaphore(20)), summaryMap: transferSummaryMap,\n },\n })\n\n console.log('Initializing NodeXyoViewer...')\n assertEx(await viewer.start(), () => 'Failed to start NodeXyoViewer')\n console.log('Initialized NodeXyoViewer.')\n\n const stepRewardsByPositionViewer = await SimpleStepRewardsByPositionViewer.create({\n context: stakedChainContext,\n rewardMultipliers: RewardMultipliers,\n })\n\n console.log('Initializing SimpleStepRewardsByPositionViewer...')\n assertEx(await stepRewardsByPositionViewer.start(), () => 'Failed to start SimpleStepRewardsByPositionViewer')\n console.log('Initialized SimpleStepRewardsByPositionViewer.')\n\n const connection = new XyoBaseConnection({ runner, viewer })\n const engine = rpcEngineFromConnection(connection, networkStakeViewer)\n\n app.post('/rpc', (req, res) => {\n setRawResponseFormat(res)\n engine.handle(req.body, (_, rpcResponse) => {\n res.json(rpcResponse)\n })\n })\n}\n","import type { WithStorageMeta } from '@xyo-network/payload-model'\nimport type {\n MapType, StakedChainContextRead, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport type { Express } from 'express'\n\nimport { addNodeRoutes } from './address/index.ts'\nimport { addDataLakeRoutes } from './dataLake/index.ts'\nimport { addRpcRoutes } from './rpc/index.ts'\n\nexport const addRoutes = async (\n app: Express,\n transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>,\n stakedChainContext: StakedChainContextRead,\n initRewardsCache?: boolean,\n) => {\n await addRpcRoutes(app, transferSummaryMap, stakedChainContext, initRewardsCache)\n addDataLakeRoutes(app)\n addNodeRoutes(app)\n}\n","import type { Hash, Logger } from '@xylabs/sdk-js'\nimport {\n assertEx, isDefined, isString, toEthAddress,\n} from '@xylabs/sdk-js'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport { boot } from '@xyo-network/bios'\nimport type { BiosExternalInterface } from '@xyo-network/bios-model'\nimport { EthereumChainStakeEvents, EthereumChainStakeViewer } from '@xyo-network/chain-ethereum'\nimport { 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 stakeEventsViewer = await EthereumChainStakeEvents.create({ contract, logger })\n assertEx(await stakeEventsViewer.start(), () => 'Failed to start EthereumChainStakeEvents reader')\n const stakeChainViewer = await EthereumChainStakeViewer.create({\n contract, stakeEventsViewer, logger,\n })\n assertEx(await stakeChainViewer.start(), () => 'Failed to start EthereumChainStake viewer')\n const resolvedNode: NodeInstance = node ?? await getNode(nodeContext)\n const chainArchivist = assertEx(asArchivistInstance(\n await resolvedNode.resolve('Chain:Validated'),\n { required: true },\n ), () => 'FinalizedArchivist not found in node')\n const chainMap = readPayloadMapFromStore<WithStorageMeta<Payload>>(chainArchivist)\n\n const stakedChainContext: StakedChainContextRead = {\n chainId: contractAddress,\n events: stakeEventsViewer,\n stake: stakeChainViewer,\n store: { chainMap },\n head: async (): Promise<[Hash, number]> => {\n const head = await findMostRecentBlock(chainArchivist)\n return [assertEx(head?._hash, () => 'No head found in chainArchivist'), 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 {\n assertEx, hexFrom, isDefined, isHex,\n} from '@xylabs/sdk-js'\nimport type { Config } from '@xyo-network/xl1-protocol-sdk'\n\nexport const canUseChainId = (config: Config): boolean => {\n return isDefined(config.evm.chainId)\n}\n\nexport const getChainId = (config: Config) => {\n const chainId = assertEx(config.evm.chainId, () => 'Missing config.evm.chainId')\n if (isHex(chainId, { prefix: true })) {\n const hex = hexFrom(chainId)\n const parsed = Number.parseInt(hex, 16)\n return parsed\n } else {\n const parsed = Number.parseInt(chainId, 10)\n return parsed\n }\n}\n","import { assertEx, isDefined } from '@xylabs/sdk-js'\nimport type { Config } from '@xyo-network/xl1-protocol-sdk'\nimport type { Provider } from 'ethers'\nimport { InfuraWebSocketProvider } from 'ethers/providers'\n\nimport { canUseChainId, getChainId } from './initChainId.ts'\n\nlet instance: Promise<InfuraWebSocketProvider> | undefined\n\nexport const initInfuraProvider = (config: Config): Promise<Provider> => {\n if (instance) return instance\n const providerConfig = getInfuraProviderConfig(config)\n instance = Promise.resolve(new InfuraWebSocketProvider(providerConfig[0], providerConfig[1]))\n return instance\n}\n\nexport const canUseInfuraProvider = (config: Config): boolean => {\n return canUseChainId(config)\n && isDefined(config.evm?.infura?.projectId)\n && isDefined(config.evm?.infura?.projectSecret)\n}\n\nexport const getInfuraProviderConfig = (config: Config) => {\n const projectId = assertEx(config.evm?.infura?.projectId, () => 'Missing config.evm.infura.projectId')\n const projectSecret = assertEx(config.evm?.infura?.projectSecret, () => 'Missing config.evm.infura.projectSecret')\n return [getChainId(config), projectId, projectSecret] as const\n}\n","import { BaseMongoSdk, type BaseMongoSdkPrivateConfig } from '@xylabs/mongo'\nimport type { Hash, Logger } from '@xylabs/sdk-js'\nimport {\n asAddress, assertEx, isDefined,\n ZERO_ADDRESS,\n} from '@xylabs/sdk-js'\nimport { MemoryArchivist } from '@xyo-network/archivist-memory'\nimport { MongoDBArchivistV2 } from '@xyo-network/archivist-mongodb'\nimport { ViewArchivist } from '@xyo-network/archivist-view'\nimport {\n AddressBalanceDivinerV2, AddressTransferDiviner, ArchivistSyncDiviner, HeadValidationDiviner,\n} from '@xyo-network/chain-modules'\nimport { MongoMap } from '@xyo-network/chain-protocol'\nimport { initTelemetry } from '@xyo-network/chain-telemetry'\nimport { AbstractModule, LoggerModuleStatusReporter } from '@xyo-network/module-abstract'\nimport { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'\nimport type { MongoDBModuleParamsV2 } from '@xyo-network/module-model-mongodb'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport { MemorySentinel } from '@xyo-network/sentinel-memory'\nimport { StepSizes } from '@xyo-network/xl1-protocol'\nimport type {\n BalancesStepSummary, Config, MapType, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport { hasMongoConfig } 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/sdk-js'\nimport { ManifestWrapper } from '@xyo-network/manifest-wrapper'\nimport type { WalletInstance } from '@xyo-network/wallet-model'\nimport type { Config } from '@xyo-network/xl1-protocol-sdk'\n\nimport { getLocator } from './getLocator.ts'\nimport { NodeManifest } from './nodeManifest.ts'\nimport { PrivateChildManifests } from './private/index.ts'\nimport { PublicChildManifestsWithMempool, PublicChildManifestsWithoutMempool } from './public/index.ts'\n\nexport interface GetNodeContext {\n config: Config\n logger?: Logger\n wallet: WalletInstance\n}\n\n/**\n * Creates a node with the xyo-chain modules registered\n * @param context The context to use for the node\n * @returns A node with the xyo-chain modules registered\n */\nexport const getNode = async (context: GetNodeContext) => {\n const { wallet, config } = context\n const { enabled: mempoolEnabled } = config.mempool\n const PublicChildManifests = mempoolEnabled ? PublicChildManifestsWithoutMempool : PublicChildManifestsWithMempool\n const locator = await getLocator(context)\n const wrapper = new ManifestWrapper(NodeManifest, wallet, locator, PublicChildManifests, PrivateChildManifests)\n const [node, ...childNodes] = await wrapper.loadNodes()\n if (childNodes?.length > 0) {\n await Promise.all(childNodes.map(childNode => node.register(childNode)))\n await Promise.all(childNodes.map(childNode => node.attach(childNode.address, true)))\n }\n return node\n}\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"44'/60'/1\",\n \"name\": \"XYOChain\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": []\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","import type { PackageManifestPayload } from '@xyo-network/manifest-model'\n\nimport node from './node.json' with { type: 'json' }\n\n/**\n * Root Node Manifest\n */\nexport const NodeManifest = node as PackageManifestPayload\n","/**\n * Private Child Manifests\n */\nexport const PrivateChildManifests = []\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"1\",\n \"name\": \"Chain\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [\n {\n \"config\": {\n \"accountPath\": \"1/1'/1'\",\n \"name\": \"Validated\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_validated\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/2'\",\n \"schema\": \"network.xyo.diviner.chain.head.validation.config\",\n \"eventSubscriptions\": [\n {\n \"sourceEvent\": \"inserted\",\n \"sourceModule\": \"Submissions\",\n \"targetModuleFunction\": \"divine\"\n }\n ],\n \"inArchivist\": \"Submissions\",\n \"outArchivist\": \"Validated\",\n \"name\": \"HeadValidationDiviner\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/3'\",\n \"automations\": [\n {\n \"frequency\": 1000,\n \"frequencyUnits\": \"millis\",\n \"schema\": \"network.xyo.automation.interval\",\n \"type\": \"interval\"\n }\n ],\n \"name\": \"ChainValidationSentinel\",\n \"schema\": \"network.xyo.sentinel.config\",\n \"synchronous\": true,\n \"tasks\": [\n {\n \"mod\": \"HeadValidationDiviner\",\n \"endPoint\": \"divine\"\n }\n ]\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/4'\",\n \"automations\": [\n {\n \"frequency\": 10000,\n \"frequencyUnits\": \"millis\",\n \"schema\": \"network.xyo.automation.interval\",\n \"type\": \"interval\"\n }\n ],\n \"name\": \"AddressBalancePollingSentinel\",\n \"schema\": \"network.xyo.sentinel.config\",\n \"synchronous\": true,\n \"tasks\": [\n {\n \"mod\": \"AddressBalanceDiviner\",\n \"endPoint\": \"divine\"\n }\n ]\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/5'\",\n \"automations\": [\n {\n \"frequency\": 10000,\n \"frequencyUnits\": \"millis\",\n \"schema\": \"network.xyo.automation.interval\",\n \"type\": \"interval\"\n }\n ],\n \"name\": \"AddressTransferPollingSentinel\",\n \"schema\": \"network.xyo.sentinel.config\",\n \"synchronous\": true,\n \"tasks\": [\n {\n \"mod\": \"AddressTransferDiviner\",\n \"endPoint\": \"divine\"\n }\n ]\n }\n }\n ],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"1/1/1\",\n \"name\": \"Submissions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_submissions\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/2\",\n \"name\": \"Finalized\",\n \"allowedQueries\": [\n \"network.xyo.query.archivist.get\",\n \"network.xyo.query.archivist.next\"\n ],\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 50000\n },\n \"originArchivist\": \"Validated\",\n \"schema\": \"network.xyo.archivist.view.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/3'\",\n \"name\": \"AddressBalanceDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.balance.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_balance\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/4'\",\n \"name\": \"AddressTransferDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.transfer.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_transfer\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"2\",\n \"name\": \"Pending\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"2/1/1\",\n \"name\": \"PendingTransactions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"labels\": {\n \"network.xyo.storage.class\": \"mongodb\"\n },\n \"payloadSdkConfig\": {\n \"collection\": \"pending_bundles\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","import type { ModuleManifest, PackageManifestPayload } from '@xyo-network/manifest-model'\n\nimport Chain from './Chain.json' with { type: 'json' }\nimport Pending from './Pending.json' with { type: 'json' }\n\n/**\n * Chain Node Manifest\n */\nconst ChainNodeManifest = Chain as PackageManifestPayload\n/**\n * Pending Node Manifest\n */\nconst PendingNodeManifest = Pending as PackageManifestPayload\n/**\n * Public Child Manifests\n */\nexport const PublicChildManifestsWithMempool: ModuleManifest[] = [\n ...ChainNodeManifest.nodes,\n ...PendingNodeManifest.nodes,\n]\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"1\",\n \"name\": \"Chain\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [\n {\n \"config\": {\n \"accountPath\": \"1/1'/1'\",\n \"name\": \"Validated\",\n \"allowedQueries\": [\n \"network.xyo.query.archivist.get\",\n \"network.xyo.query.archivist.next\"\n ],\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_validated\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"1/1/1\",\n \"name\": \"Submissions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_submissions\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/2\",\n \"name\": \"Finalized\",\n \"allowedQueries\": [\n \"network.xyo.query.archivist.get\",\n \"network.xyo.query.archivist.next\"\n ],\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 50000\n },\n \"originArchivist\": \"Validated\",\n \"schema\": \"network.xyo.archivist.view.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/3'\",\n \"name\": \"AddressBalanceDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.balance.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_balance\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/4'\",\n \"name\": \"AddressTransferDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.transfer.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_transfer\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"2\",\n \"name\": \"Pending\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"2/1/1\",\n \"name\": \"PendingTransactions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"labels\": {\n \"network.xyo.storage.class\": \"mongodb\"\n },\n \"payloadSdkConfig\": {\n \"collection\": \"pending_bundles\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","import type { ModuleManifest, PackageManifestPayload } from '@xyo-network/manifest-model'\n\nimport Chain from './Chain.json' with { type: 'json' }\nimport Pending from './Pending.json' with { type: 'json' }\n\n/**\n * Chain Node Manifest\n */\n const ChainNodeManifest = Chain as PackageManifestPayload\n/**\n * Pending Node Manifest\n */\n const PendingNodeManifest = Pending as PackageManifestPayload\n/**\n * Public Child Manifests\n */\nexport const PublicChildManifestsWithoutMempool: ModuleManifest[] = [\n ...ChainNodeManifest.nodes,\n ...PendingNodeManifest.nodes,\n]\n"],"mappings":";;;;AAAA,SACEA,uBACAC,6BACAC,sCACAC,mBACAC,0BACAC,kBACAC,gBACAC,yBACK;AAMP,OAAOC,iBAAiB;AACxB,OAAOC,UAAU;AAEjB,OAAOC,cAAa;;;AClBpB,SAASC,gCAAgC;AACzC,SAASC,8BAA8B;AACvC,SAASC,2BAA2B;AAS7B,IAAMC,qBAAqB,6BAAA;AAChC,QAAMC,mBAAmB;IAAC,IAAIC,oBAAAA;IAAuB,IAAIC,uBAAAA;;AACzDC,2BAAyB;IAAEH;EAAiB,CAAA;AAC9C,GAHkC;;;ACVlC,SAASI,eAAAA,oBAAmB;;;ACD5B,SAASC,oBAAoB;AAC7B,SAASC,WAAWC,iBAAiB;AACrC,SAASC,oBAAoB;AAG7B,SAASC,mBAAmB;AAI5B,IAAMC,UAAwD,8BAAOC,KAAKC,KAAKC,SAAAA;AAC7E,QAAM,EAAEC,SAASC,iBAAgB,IAAKJ,IAAIK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A,IAAIxB,QAAK,MAAS,MAAM;EACjC,CAAA,CAAA;AACA,QAAMyB,qBAAqB/C,UAAS,MAAMgD,sBAAsB/D,MAAAA,GAAS,MAAM,sCAAA;AAC/E,QAAMgE,MAAM,MAAMC,OAAOzB,cAAcsB,oBAAoBd,oBAAoBhD,OAAOO,IAAI2D,gBAAgB;AAC1G,QAAMC,SAASH,IAAII,OAAOjD,MAAMtB,UAAU,MAAMI,QAAQa,IAAI,oCAAoCjB,QAAAA,IAAYsB,IAAAA,EAAM,CAAA;AAClHgD,SAAOE,WAAW,GAAA;AAClB,SAAOF;AACT,GA9CyB;","names":["customPoweredByHeader","disableCaseSensitiveRouting","disableExpressDefaultPoweredByHeader","getJsonBodyParser","getJsonBodyParserOptions","responseProfiler","standardErrors","standardResponses","compression","cors","express","registerInstrumentations","ExpressInstrumentation","HttpInstrumentation","addInstrumentation","instrumentations","HttpInstrumentation","ExpressInstrumentation","registerInstrumentations","StatusCodes","asyncHandler","asAddress","isDefined","isModuleName","StatusCodes","handler","req","res","next","address","moduleIdentifier","params","node","app","asAddress","isDefined","mod","resolve","direction","json","state","isModuleName","redirect","StatusCodes","MOVED_TEMPORARILY","getAddress","asyncHandler","asyncHandler","asAddress","assertEx","isAddress","toAddress","isQueryBoundWitness","ModuleErrorBuilder","StatusCodes","BoundWitnessSchema","ModuleConfigSchema","DEFAULT_DEPTH","getQueryConfig","mod","req","bw","payloads","nestedBwAddresses","flat","filter","payload","schema","BoundWitnessSchema","map","addresses","address","length","allowed","Object","fromEntries","queries","security","ModuleConfigSchema","handler","req","res","next","returnError","code","message","details","error","ModuleErrorBuilder","build","locals","rawResponse","status","json","address","params","node","app","bw","payloads","Array","isArray","body","isAddress","StatusCodes","BAD_REQUEST","isQueryBoundWitness","modules","normalizedAddress","toAddress","typedAddress","asAddress","byAddress","undefined","resolve","maxDepth","byName","direction","moduleAddress","assertEx","redirect","TEMPORARY_REDIRECT","NOT_FOUND","length","mod","queryConfig","getQueryConfig","queryResult","query","ex","INTERNAL_SERVER_ERROR","postAddress","asyncHandler","addNodeRoutes","app","defaultModule","node","address","defaultModuleEndpoint","get","_req","res","redirect","StatusCodes","MOVED_TEMPORARILY","post","TEMPORARY_REDIRECT","getAddress","postAddress","sendStatus","NOT_FOUND","setRawResponseFormat","asHash","isDefined","asArchivistInstance","PayloadBuilder","isAnyPayload","isSequence","express","resolveArchivist","node","archivistModuleIdentifier","mod","resolve","asArchivistInstance","required","archivistInstance","getArchivist","isDefined","archivistMiddleware","options","router","express","Router","mergeParams","post","req","res","setRawResponseFormat","body","Array","isArray","payloads","PayloadBuilder","hashPairs","map","p","archivist","result","insert","status","json","get","cursor","isSequence","query","undefined","limit","Number","open","Boolean","order","next","hash","rawHash","params","asHash","payload","isAnyPayload","send","addDataLakeRoutes","app","node","archivistModuleIdentifier","use","archivistMiddleware","setRawResponseFormat","assertEx","NodeXyoViewer","SimpleNetworkStakeViewer","SimpleStepRewardsByPositionViewer","StepSizes","RewardMultipliers","NodeXyoRunner","rpcEngineFromConnection","XyoBaseConnection","Semaphore","addRpcRoutes","app","transferSummaryMap","stakedChainContext","initRewardsCache","node","runner","NodeXyoRunner","networkStakeViewer","SimpleNetworkStakeViewer","create","context","console","log","assertEx","start","viewer","NodeXyoViewer","rewardMultipliers","RewardMultipliers","transfersSummaryContext","stepSemaphores","StepSizes","map","Semaphore","summaryMap","stepRewardsByPositionViewer","SimpleStepRewardsByPositionViewer","connection","XyoBaseConnection","engine","rpcEngineFromConnection","post","req","res","setRawResponseFormat","handle","body","_","rpcResponse","json","addRoutes","app","transferSummaryMap","stakedChainContext","initRewardsCache","addRpcRoutes","addDataLakeRoutes","addNodeRoutes","getApp","node","transferSummaryMap","stakedChainContext","initRewardsCache","addInstrumentation","app","express","set","use","cors","compression","responseProfiler","getJsonBodyParser","getJsonBodyParserOptions","limit","standardResponses","disableExpressDefaultPoweredByHeader","customPoweredByHeader","disableCaseSensitiveRouting","addRoutes","standardErrors","assertEx","isDefined","isString","toEthAddress","asArchivistInstance","boot","EthereumChainStakeEvents","EthereumChainStakeViewer","findMostRecentBlock","StakedXyoChainV2__factory","HDWallet","readPayloadMapFromStore","assertEx","hexFrom","isDefined","isHex","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","BaseMongoSdk","asAddress","assertEx","isDefined","ZERO_ADDRESS","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","stakeEventsViewer","EthereumChainStakeEvents","create","start","stakeChainViewer","EthereumChainStakeViewer","resolvedNode","getNode","chainArchivist","asArchivistInstance","resolve","required","chainMap","readPayloadMapFromStore","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/manifest/getLocator.ts","../../src/manifest/getNode.ts","../../src/manifest/node.json","../../src/manifest/nodeManifest.ts","../../src/manifest/private/index.ts","../../src/manifest/public/WithMempool/Chain.json","../../src/manifest/public/WithMempool/Pending.json","../../src/manifest/public/WithMempool/index.ts","../../src/manifest/public/WithoutMempool/Chain.json","../../src/manifest/public/WithoutMempool/Pending.json","../../src/manifest/public/WithoutMempool/index.ts"],"sourcesContent":["import {\n customPoweredByHeader,\n disableCaseSensitiveRouting,\n disableExpressDefaultPoweredByHeader,\n getJsonBodyParser,\n getJsonBodyParserOptions,\n responseProfiler,\n standardErrors,\n standardResponses,\n} from '@xylabs/express'\nimport type { NodeInstance } from '@xyo-network/node-model'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport type {\n MapType, StakedChainContextRead, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport compression from 'compression'\nimport cors from 'cors'\nimport type { Express } from 'express'\nimport express from 'express'\n\nimport { addInstrumentation } from './instrumentation.ts'\nimport { addRoutes } from './routes/index.ts'\n\nexport const getApp = async (\n node: NodeInstance,\n transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>,\n stakedChainContext: StakedChainContextRead,\n initRewardsCache?: boolean,\n): Promise<Express> => {\n addInstrumentation()\n const app = express()\n app.set('etag', false)\n\n app.use(cors())\n app.use(compression())\n app.use(responseProfiler)\n app.use(getJsonBodyParser(getJsonBodyParserOptions({ limit: '1mb' })))\n app.use(standardResponses)\n disableExpressDefaultPoweredByHeader(app)\n app.use(customPoweredByHeader)\n disableCaseSensitiveRouting(app)\n app.node = node\n await addRoutes(app, transferSummaryMap, stakedChainContext, initRewardsCache)\n app.use(standardErrors)\n return app\n}\n","import { registerInstrumentations } from '@opentelemetry/instrumentation'\nimport { ExpressInstrumentation } from '@opentelemetry/instrumentation-express'\nimport { HttpInstrumentation } from '@opentelemetry/instrumentation-http'\n\n/**\n * Registers OpenTelemetry instrumentations for HTTP and Express.\n * This function is used to set up the necessary instrumentations for monitoring\n * HTTP requests and Express applications. Since it monkey patches the Express\n * router & middleware system, it should be called before any Express applications\n * are defined.\n */\nexport const addInstrumentation = () => {\n const instrumentations = [new HttpInstrumentation(), new ExpressInstrumentation()]\n registerInstrumentations({ instrumentations })\n}\n","import type { Express } from 'express'\nimport { StatusCodes } from 'http-status-codes'\n\nimport { getAddress } from './get/index.ts'\nimport { postAddress } from './post/index.ts'\n\nexport const addNodeRoutes = (app: Express) => {\n const defaultModule = app.node\n const address = defaultModule.address\n const defaultModuleEndpoint = `/${address}`\n app.get('/', (_req, res) => res.redirect(StatusCodes.MOVED_TEMPORARILY, defaultModuleEndpoint))\n app.post('/', (_req, res) => res.redirect(StatusCodes.TEMPORARY_REDIRECT, defaultModuleEndpoint))\n app.get('/:address', getAddress)\n app.post('/:address', postAddress)\n app.get('/:hash', (_req, res) => {\n res.sendStatus(StatusCodes.NOT_FOUND)\n })\n app.post('/:hash', (_req, res) => {\n res.sendStatus(StatusCodes.NOT_FOUND)\n })\n}\n","import { asyncHandler } from '@xylabs/express'\nimport { asAddress, isDefined } from '@xylabs/sdk-js'\nimport { isModuleName } from '@xyo-network/module-model'\nimport type { Payload } from '@xyo-network/payload-model'\nimport type { RequestHandler } from 'express'\nimport { StatusCodes } from 'http-status-codes'\n\nimport type { AddressPathParams } from '../AddressPathParams.ts'\n\nconst handler: RequestHandler<AddressPathParams, Payload[]> = async (req, res, next) => {\n const { address: moduleIdentifier } = req.params\n const { node } = req.app\n const address = asAddress(moduleIdentifier)\n if (isDefined(address)) {\n let mod = node.address === address ? node : (await node.resolve(address, { direction: 'down' }))\n if (mod) {\n res.json(await mod.state())\n return\n }\n }\n if (isModuleName(moduleIdentifier)) {\n const mod = await node.resolve(moduleIdentifier, { direction: 'down' })\n if (mod) {\n res.redirect(StatusCodes.MOVED_TEMPORARILY, `/${mod.address}`)\n return\n }\n }\n next('route')\n}\nexport const getAddress = asyncHandler(handler)\n","import { asyncHandler } from '@xylabs/express'\nimport type { JsonObject } from '@xylabs/sdk-js'\nimport {\n asAddress, assertEx,\n isAddress,\n toAddress,\n} from '@xylabs/sdk-js'\nimport { isQueryBoundWitness, type QueryBoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleErrorBuilder } from '@xyo-network/module-abstract'\nimport type { ModuleInstance, ModuleQueryResult } from '@xyo-network/module-model'\nimport type { ModuleError, Payload } from '@xyo-network/payload-model'\nimport type { RequestHandler } from 'express'\nimport { StatusCodes } from 'http-status-codes'\n\nimport type { AddressPathParams } from '../AddressPathParams.ts'\nimport { getQueryConfig } from './getQueryConfig.ts'\n\ntype PostAddressRequestBody = [QueryBoundWitness, undefined | Payload[]]\n\nconst handler: RequestHandler<AddressPathParams, ModuleQueryResult | ModuleError, PostAddressRequestBody> = async (req, res, next) => {\n const returnError = (code: number, message = 'An error occurred', details?: JsonObject) => {\n const error = new ModuleErrorBuilder().message(message).details(details).build()\n res.locals.rawResponse = false\n res.status(code).json(error)\n next()\n }\n\n const { address } = req.params\n const { node } = req.app\n const [bw, payloads] = Array.isArray(req.body) ? req.body : []\n if (!isAddress(address)) {\n return returnError(StatusCodes.BAD_REQUEST, 'Missing address')\n }\n\n if (!bw) {\n return returnError(StatusCodes.BAD_REQUEST, 'Missing boundwitness')\n }\n\n if (!isQueryBoundWitness(bw)) {\n return returnError(StatusCodes.BAD_REQUEST, 'Invalid query boundwitness')\n }\n\n let modules: ModuleInstance[] = []\n const normalizedAddress = toAddress(address)\n if (node.address === normalizedAddress) modules = [node]\n else {\n const typedAddress = asAddress(address)\n const byAddress = (typedAddress === undefined) ? undefined : await node.resolve(typedAddress, { maxDepth: 10 })\n\n if (byAddress) modules = [byAddress]\n else {\n const byName = await node.resolve(address, { direction: 'down' })\n if (byName) {\n const moduleAddress = assertEx(byName?.address, () => 'Error redirecting to module by address')\n res.redirect(StatusCodes.TEMPORARY_REDIRECT, `/${moduleAddress}`)\n return\n } else {\n return returnError(StatusCodes.NOT_FOUND, 'Module not found', { address })\n }\n }\n }\n\n if (modules.length > 0) {\n const mod = modules[0]\n const queryConfig = getQueryConfig(mod, req, bw, payloads)\n try {\n const queryResult = await mod.query(bw, payloads, queryConfig)\n res.json(queryResult)\n } catch (ex) {\n return returnError(StatusCodes.INTERNAL_SERVER_ERROR, 'Query Failed', { message: (ex as Error)?.message ?? 'Unknown Error' })\n }\n } else {\n return returnError(StatusCodes.NOT_FOUND, 'Module not found', { address })\n }\n}\n\nexport const postAddress = asyncHandler(handler)\n","import type { BoundWitness, QueryBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessSchema } from '@xyo-network/boundwitness-model'\nimport type { ModuleConfig, ModuleInstance } from '@xyo-network/module-model'\nimport { ModuleConfigSchema } from '@xyo-network/module-model'\nimport type { Payload } from '@xyo-network/payload-model'\nimport type { Request } from 'express'\n\nconst DEFAULT_DEPTH = 5 as const\n\nexport const getQueryConfig = (mod: ModuleInstance, req: Request, bw: QueryBoundWitness, payloads?: Payload[]): ModuleConfig | undefined => {\n // TODO: Filter based on query addresses?\n // Recurse through payloads for nested BWs\n const nestedBwAddresses\n = payloads\n ?.flat(DEFAULT_DEPTH)\n .filter<BoundWitness>((payload): payload is BoundWitness => payload?.schema === BoundWitnessSchema)\n .map(bw => bw.addresses) ?? []\n // TODO: Do we want to end up with a list of addresses or a list of address lists?\n const addresses = [bw.addresses, ...nestedBwAddresses].filter(address => address.length > 0)\n const allowed = addresses.length > 0 ? Object.fromEntries(mod.queries.map(schema => [schema, addresses])) : {}\n const security = { allowed }\n return { schema: ModuleConfigSchema, security }\n}\n","import { setRawResponseFormat } from '@xylabs/express'\nimport { asHash, isDefined } from '@xylabs/sdk-js'\nimport type {\n ArchivistInstance,\n ArchivistNextOptions, NextOptions,\n} from '@xyo-network/archivist-model'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { NodeInstance } from '@xyo-network/node-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isAnyPayload, isSequence } from '@xyo-network/payload-model'\nimport type { Router } from 'express'\nimport express from 'express'\nimport type { Request } from 'express-serve-static-core'\n\nconst resolveArchivist = async (node: NodeInstance, archivistModuleIdentifier: ModuleIdentifier): Promise<ArchivistInstance> => {\n const mod = await node.resolve(archivistModuleIdentifier)\n return asArchivistInstance(mod, { required: true })\n}\n\nlet archivistInstance: ArchivistInstance | undefined\n\nconst getArchivist = async (node: NodeInstance, archivistModuleIdentifier: ModuleIdentifier): Promise<ArchivistInstance> => {\n if (isDefined(archivistInstance)) return archivistInstance\n archivistInstance = await resolveArchivist(node, archivistModuleIdentifier)\n return archivistInstance\n}\n\ntype ArchivistMiddlewareOptions = {\n archivistModuleIdentifier: ModuleIdentifier\n node: NodeInstance\n}\n\nexport const archivistMiddleware = (options: ArchivistMiddlewareOptions): Router => {\n const { node, archivistModuleIdentifier } = options\n const router = express.Router({ mergeParams: true })\n\n router.post('/insert', async (req, res) => {\n setRawResponseFormat(res)\n const body = Array.isArray(req.body) ? req.body : [req.body]\n const payloads = (await PayloadBuilder.hashPairs<Payload>(body)).map(p => p[0])\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const result = await archivist.insert(payloads)\n res.status(200).json(result)\n })\n\n router.get('/next', async (req: Request<Partial<NextOptions>>, res) => {\n setRawResponseFormat(res)\n const cursor = isSequence(req.query.cursor) ? req.query.cursor : undefined\n const limit = isDefined(req.query.limit) ? Number(req.query.limit) : undefined\n const open = isDefined(req.query.open) ? Boolean(req.query.open) : undefined\n const order = req.query.order === 'asc' ? 'asc' : 'desc'\n const options: ArchivistNextOptions = {\n limit, open, order, cursor,\n }\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const result = await archivist.next(options)\n res.status(200).json(result)\n })\n router.post('/next', async (req: Request<{}, {}, ArchivistNextOptions | undefined>, res) => {\n setRawResponseFormat(res)\n const options = req.body\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const result = await (isDefined(options) ? archivist.next(options) : archivist.next())\n res.status(200).json(result)\n })\n\n router.get('/get/:hash', async (req, res) => {\n setRawResponseFormat(res)\n const { hash: rawHash } = req.params\n const hash = asHash(rawHash)\n if (isDefined(hash)) {\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const [payload] = await archivist.get([hash])\n if (isAnyPayload(payload)) {\n res.json(payload)\n return\n }\n }\n res.status(400).send()\n })\n\n return router\n}\n","import type { Express } from 'express'\n\nimport { archivistMiddleware } from './archivistMiddleware.ts'\n\nexport const addDataLakeRoutes = (app: Express) => {\n const { node } = app\n const archivistModuleIdentifier = 'Chain:Finalized'\n app.use('/chain', archivistMiddleware({ node, archivistModuleIdentifier }))\n}\n","import { setRawResponseFormat } from '@xylabs/express'\nimport { assertEx } from '@xylabs/sdk-js'\nimport { NodeXyoViewer } from '@xyo-network/chain-rpc'\nimport { SimpleNetworkStakeViewer, SimpleStepRewardsByPositionViewer } from '@xyo-network/chain-viewers'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport { StepSizes } from '@xyo-network/xl1-protocol'\nimport type {\n MapType, StakedChainContextRead, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport { RewardMultipliers } from '@xyo-network/xl1-protocol-sdk'\nimport {\n NodeXyoRunner, rpcEngineFromConnection, XyoBaseConnection,\n} from '@xyo-network/xl1-rpc'\nimport { Semaphore } from 'async-mutex'\nimport type { Express } from 'express'\n\nexport const addRpcRoutes = async (\n app: Express,\n transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>,\n stakedChainContext: StakedChainContextRead,\n initRewardsCache?: boolean,\n) => {\n const { node } = app\n const runner = new NodeXyoRunner(node)\n const networkStakeViewer = await SimpleNetworkStakeViewer.create({ context: stakedChainContext })\n\n console.log('Initializing SimpleNetworkStakeViewer...')\n assertEx(await networkStakeViewer.start(), () => 'Failed to start SimpleNetworkStakeViewer')\n console.log('Initialized SimpleNetworkStakeViewer.')\n\n const viewer = await NodeXyoViewer.create({\n node,\n rewardMultipliers: RewardMultipliers,\n initRewardsCache,\n context: stakedChainContext,\n transfersSummaryContext: {\n ...stakedChainContext, stepSemaphores: StepSizes.map(() => new Semaphore(20)), summaryMap: transferSummaryMap,\n },\n })\n\n console.log('Initializing NodeXyoViewer...')\n assertEx(await viewer.start(), () => 'Failed to start NodeXyoViewer')\n console.log('Initialized NodeXyoViewer.')\n\n const stepRewardsByPositionViewer = await SimpleStepRewardsByPositionViewer.create({\n context: stakedChainContext,\n rewardMultipliers: RewardMultipliers,\n })\n\n console.log('Initializing SimpleStepRewardsByPositionViewer...')\n assertEx(await stepRewardsByPositionViewer.start(), () => 'Failed to start SimpleStepRewardsByPositionViewer')\n console.log('Initialized SimpleStepRewardsByPositionViewer.')\n\n const connection = new XyoBaseConnection({ runner, viewer })\n const engine = rpcEngineFromConnection(connection, networkStakeViewer)\n\n app.post('/rpc', (req, res) => {\n setRawResponseFormat(res)\n engine.handle(req.body, (_, rpcResponse) => {\n res.json(rpcResponse)\n })\n })\n}\n","import type { WithStorageMeta } from '@xyo-network/payload-model'\nimport type {\n MapType, StakedChainContextRead, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport type { Express } from 'express'\n\nimport { addNodeRoutes } from './address/index.ts'\nimport { addDataLakeRoutes } from './dataLake/index.ts'\nimport { addRpcRoutes } from './rpc/index.ts'\n\nexport const addRoutes = async (\n app: Express,\n transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>,\n stakedChainContext: StakedChainContextRead,\n initRewardsCache?: boolean,\n) => {\n await addRpcRoutes(app, transferSummaryMap, stakedChainContext, initRewardsCache)\n addDataLakeRoutes(app)\n addNodeRoutes(app)\n}\n","import type { Hash, Logger } from '@xylabs/sdk-js'\nimport {\n assertEx, isDefined, isString,\n} from '@xylabs/sdk-js'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport { boot } from '@xyo-network/bios'\nimport type { BiosExternalInterface } from '@xyo-network/bios-model'\nimport {\n createProducerChainStakeIntentBlock, initChainStakeViewer, initProducerAccount,\n} from '@xyo-network/chain-orchestration'\nimport { createGenesisBlock, findMostRecentBlock } from '@xyo-network/chain-protocol'\nimport type { NodeInstance } from '@xyo-network/node-model'\nimport type { Payload, WithStorageMeta } from '@xyo-network/payload-model'\nimport { HDWallet } from '@xyo-network/wallet'\nimport { asXL1BlockRange } from '@xyo-network/xl1-protocol'\nimport type { Config, StakedChainContextRead } from '@xyo-network/xl1-protocol-sdk'\nimport { readPayloadMapFromStore } from '@xyo-network/xl1-protocol-sdk'\n\nimport { getNode, getTransferSummaryMap } from '../manifest/index.ts'\nimport { getApp } from './app.ts'\n\nconst hostname = '::'\n// const hostname = '0.0.0.0'\n\n// TODO: Make nodejs version of bios support round tripping mnemonic between boots\nconst getSeedPhrase = async (bios: BiosExternalInterface, config: Config, logger?: Logger): Promise<string> => {\n const storedSeedPhrase = await bios.seedPhraseStore.get('os')\n logger?.debug(`[API] Stored mnemonic: ${storedSeedPhrase}`)\n const { mnemonic } = config.api\n if (isString(storedSeedPhrase) && isString(mnemonic)) {\n logger?.warn('[API] Stored mnemonic does not match supplied. Updating stored mnemonic to supplied.')\n await bios.seedPhraseStore.set('os', mnemonic)\n } else {\n let seedPhrase: string\n if (isString(mnemonic)) {\n seedPhrase = mnemonic\n } else {\n seedPhrase = HDWallet.generateMnemonic()\n logger?.log('[API] No mnemonic provided, using random mnemonic. This is not recommended for production use.')\n logger?.log(`[API] Mnemonic: ${seedPhrase}`)\n }\n await bios.seedPhraseStore.set('os', seedPhrase)\n }\n return assertEx(await bios.seedPhraseStore.get('os'), () => 'Unable to acquire mnemonic from bios')\n}\n\ninterface GetServerContext {\n config: Config\n logger?: Logger\n node?: NodeInstance\n}\n\nexport const getServer = async (context: GetServerContext) => {\n const {\n config, logger, node,\n } = context\n const { mnemonic, port } = context.config.api\n const bios = await boot()\n const seedPhrase = isDefined(mnemonic) ? mnemonic : await getSeedPhrase(bios, config, logger)\n const wallet = await HDWallet.fromPhrase(seedPhrase)\n\n const stakeChainViewer = await initChainStakeViewer(config, logger)\n\n const nodeContext = {\n wallet, logger, config,\n }\n\n const resolvedNode: NodeInstance = node ?? await getNode(nodeContext)\n const chainArchivist = assertEx(asArchivistInstance(\n await resolvedNode.resolve('Chain:Validated'),\n { required: true },\n ), () => 'FinalizedArchivist not found in node')\n const chainMap = readPayloadMapFromStore<WithStorageMeta<Payload>>(chainArchivist)\n\n const payloads = await chainArchivist.next()\n\n if (payloads.length === 0) {\n logger?.warn('[API] No blocks found in chain archivist, creating genesis block')\n const producerAccount = await initProducerAccount({ config, logger })\n const chainId = stakeChainViewer.chainId\n const block0 = await createGenesisBlock(producerAccount, chainId, 1_000_000n, producerAccount.address)\n await chainArchivist.insert([...block0[1].flat(), block0[0]])\n console.log('[API] Genesis block created and inserted into chain archivist')\n const block1 = await createProducerChainStakeIntentBlock(block0[0], producerAccount, asXL1BlockRange([0, 10_000], true))\n await chainArchivist.insert([...block1[1].flat(), block1[0]])\n console.log(`[API] Producer declared: ${producerAccount.address}`)\n }\n\n const stakedChainContext: StakedChainContextRead = {\n chainId: stakeChainViewer.chainId,\n stake: stakeChainViewer,\n store: { chainMap },\n head: async (): Promise<[Hash, number]> => {\n const head = await findMostRecentBlock(chainArchivist)\n return [assertEx(head?._hash, () => 'No head found in chainArchivist'), head?.block ?? 0]\n },\n }\n const mods = await resolvedNode.resolve('*')\n await Promise.all(mods.map((mod) => {\n return mod.start?.() ?? (() => true)\n }))\n const transferSummaryMap = assertEx(await getTransferSummaryMap(config), () => 'Transfer Summary Map not initialized')\n const app = await getApp(resolvedNode, transferSummaryMap, stakedChainContext, config.api.initRewardsCache)\n const server = app.listen(port, hostname, () => logger?.log(`[API] Server listening at http://${hostname}:${port}`))\n server.setTimeout(20_000)\n return server\n}\n","import { BaseMongoSdk, type BaseMongoSdkPrivateConfig } from '@xylabs/mongo'\nimport type { Hash, Logger } from '@xylabs/sdk-js'\nimport {\n asAddress, assertEx, isDefined,\n ZERO_ADDRESS,\n} from '@xylabs/sdk-js'\nimport { MemoryArchivist } from '@xyo-network/archivist-memory'\nimport { MongoDBArchivistV2 } from '@xyo-network/archivist-mongodb'\nimport { ViewArchivist } from '@xyo-network/archivist-view'\nimport {\n AddressBalanceDivinerV2, AddressTransferDiviner, ArchivistSyncDiviner, HeadValidationDiviner,\n} from '@xyo-network/chain-modules'\nimport { MongoMap } from '@xyo-network/chain-protocol'\nimport { initTelemetry } from '@xyo-network/chain-telemetry'\nimport { AbstractModule, LoggerModuleStatusReporter } from '@xyo-network/module-abstract'\nimport { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'\nimport type { MongoDBModuleParamsV2 } from '@xyo-network/module-model-mongodb'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport { MemorySentinel } from '@xyo-network/sentinel-memory'\nimport { StepSizes } from '@xyo-network/xl1-protocol'\nimport type {\n BalancesStepSummary, Config, MapType, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport { hasMongoConfig, MemoryMap } from '@xyo-network/xl1-protocol-sdk'\nimport { Semaphore } from 'async-mutex'\n\nexport interface GetLocatorContext {\n config: Config\n logger?: Logger\n}\n\nexport async function getTransferSummaryMap(config: Config): Promise<MapType<string, WithStorageMeta<TransfersStepSummary>>> {\n const mongoConfig = config.storage?.mongo\n if (hasMongoConfig(mongoConfig)) {\n // Create the MongoDB SDK from the configuration\n const {\n connectionString: dbConnectionString, database: dbName, domain: dbDomain, password: dbPassword, username: dbUserName,\n } = mongoConfig\n const payloadSdkConfig: BaseMongoSdkPrivateConfig = {\n dbConnectionString, dbDomain, dbName, dbPassword, dbUserName,\n }\n\n const sdkTransferSummaryMap = new BaseMongoSdk<WithStorageMeta<TransfersStepSummary>>({ ...payloadSdkConfig, collection: 'transfer_summary_map' })\n const result = await MongoMap.create<MongoMap<Hash, WithStorageMeta<TransfersStepSummary>>>({\n sdk: sdkTransferSummaryMap,\n getCache: { enabled: true, maxEntries: 5000 },\n })\n assertEx(await result.start(), () => 'Failed to start transfer summary map')\n return result\n } else {\n console.warn('[API] Mongo configuration not found. Using MemoryMap for TransferSummaryMap.')\n return new MemoryMap<string, WithStorageMeta<TransfersStepSummary>>()\n }\n}\n\n/**\n * Used for retrieving a locator with the necessary modules registered for testing\n * operation of the node (entirely in memory)\n * @returns A locator with the necessary modules registered\n */\nexport const getLocator = async (context: GetLocatorContext) => {\n const { config, logger } = context\n const { otlpEndpoint } = config.telemetry?.otel ?? {}\n const { traceProvider, meterProvider } = await initTelemetry({\n attributes: {\n serviceName: 'xl1-api',\n serviceVersion: '1.0.0',\n },\n otlpEndpoint,\n metricsConfig: {\n endpoint: '/metrics',\n port: 9465,\n },\n })\n\n if (isDefined(logger)) AbstractModule.defaultLogger = logger\n const statusReporter = logger ? new LoggerModuleStatusReporter(logger) : undefined\n\n const locator = new ModuleFactoryLocator()\n let balanceSummaryMap: MapType<string, WithStorageMeta<BalancesStepSummary>> | undefined\n let transferSummaryMap = await getTransferSummaryMap(config)\n // If there's a MongoDB configuration\n const mongoConfig = config.storage?.mongo\n if (hasMongoConfig(mongoConfig)) {\n // Create the MongoDB SDK from the configuration\n const {\n connectionString: dbConnectionString, database: dbName, domain: dbDomain, password: dbPassword, username: dbUserName,\n } = mongoConfig\n const payloadSdkConfig: BaseMongoSdkPrivateConfig = {\n dbConnectionString, dbDomain, dbName, dbPassword, dbUserName,\n }\n const params: Partial<MongoDBModuleParamsV2> = {\n meterProvider, payloadSdkConfig, statusReporter, traceProvider,\n }\n // Register the MongoDB Archivist as the default\n locator.register(MongoDBArchivistV2.factory(params), undefined, true)\n\n // Use a persistent MongoMap for the summary repository if MongoDB is configured\n const sdkBalanceSummaryMap = new BaseMongoSdk<WithStorageMeta<BalancesStepSummary>>({ ...payloadSdkConfig, collection: 'balance_summary_map' })\n balanceSummaryMap = await MongoMap.create<MongoMap<Hash, WithStorageMeta<BalancesStepSummary>>>({\n sdk: sdkBalanceSummaryMap,\n getCache: { enabled: true, maxEntries: 5000 },\n })\n }\n\n locator.register(AddressBalanceDivinerV2.factory<AddressBalanceDivinerV2>({\n traceProvider, meterProvider, statusReporter, summaryMap: balanceSummaryMap, stepSemaphores: StepSizes.map(() => new Semaphore(20)),\n }))\n\n locator.register(AddressTransferDiviner.factory<AddressTransferDiviner>({\n traceProvider, meterProvider, statusReporter, summaryMap: transferSummaryMap, stepSemaphores: StepSizes.map(() => new Semaphore(20)),\n }))\n\n const chainId = isDefined(config.chain.id)\n ? assertEx(asAddress(config.chain.id), () => 'chain.id must be an Address')\n : ZERO_ADDRESS\n locator.register(HeadValidationDiviner.factory<HeadValidationDiviner>({\n traceProvider,\n meterProvider,\n statusReporter,\n chainId,\n allowedProducers: config.producer.allowlist,\n }))\n locator.register(MemoryArchivist.factory({\n traceProvider, meterProvider, statusReporter,\n }))\n locator.register(MemorySentinel.factory({\n traceProvider, meterProvider, statusReporter,\n }))\n locator.register(ViewArchivist.factory({\n traceProvider, meterProvider, statusReporter,\n }))\n locator.register(ArchivistSyncDiviner.factory({\n traceProvider, meterProvider, statusReporter,\n }))\n return locator\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { ManifestWrapper } from '@xyo-network/manifest-wrapper'\nimport type { WalletInstance } from '@xyo-network/wallet-model'\nimport type { Config } from '@xyo-network/xl1-protocol-sdk'\n\nimport { getLocator } from './getLocator.ts'\nimport { NodeManifest } from './nodeManifest.ts'\nimport { PrivateChildManifests } from './private/index.ts'\nimport { PublicChildManifestsWithMempool, PublicChildManifestsWithoutMempool } from './public/index.ts'\n\nexport interface GetNodeContext {\n config: Config\n logger?: Logger\n wallet: WalletInstance\n}\n\n/**\n * Creates a node with the xyo-chain modules registered\n * @param context The context to use for the node\n * @returns A node with the xyo-chain modules registered\n */\nexport const getNode = async (context: GetNodeContext) => {\n const { wallet, config } = context\n const { enabled: mempoolEnabled } = config.mempool\n const PublicChildManifests = mempoolEnabled ? PublicChildManifestsWithoutMempool : PublicChildManifestsWithMempool\n const locator = await getLocator(context)\n const wrapper = new ManifestWrapper(NodeManifest, wallet, locator, PublicChildManifests, PrivateChildManifests)\n const [node, ...childNodes] = await wrapper.loadNodes()\n if (childNodes?.length > 0) {\n await Promise.all(childNodes.map(childNode => node.register(childNode)))\n await Promise.all(childNodes.map(childNode => node.attach(childNode.address, true)))\n }\n return node\n}\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"44'/60'/1\",\n \"name\": \"XYOChain\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": []\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","import type { PackageManifestPayload } from '@xyo-network/manifest-model'\n\nimport node from './node.json' with { type: 'json' }\n\n/**\n * Root Node Manifest\n */\nexport const NodeManifest = node as PackageManifestPayload\n","/**\n * Private Child Manifests\n */\nexport const PrivateChildManifests = []\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"1\",\n \"name\": \"Chain\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [\n {\n \"config\": {\n \"accountPath\": \"1/1'/1'\",\n \"name\": \"Validated\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_validated\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/2'\",\n \"schema\": \"network.xyo.diviner.chain.head.validation.config\",\n \"eventSubscriptions\": [\n {\n \"sourceEvent\": \"inserted\",\n \"sourceModule\": \"Submissions\",\n \"targetModuleFunction\": \"divine\"\n }\n ],\n \"inArchivist\": \"Submissions\",\n \"outArchivist\": \"Validated\",\n \"name\": \"HeadValidationDiviner\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/3'\",\n \"automations\": [\n {\n \"frequency\": 1000,\n \"frequencyUnits\": \"millis\",\n \"schema\": \"network.xyo.automation.interval\",\n \"type\": \"interval\"\n }\n ],\n \"name\": \"ChainValidationSentinel\",\n \"schema\": \"network.xyo.sentinel.config\",\n \"synchronous\": true,\n \"tasks\": [\n {\n \"mod\": \"HeadValidationDiviner\",\n \"endPoint\": \"divine\"\n }\n ]\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/4'\",\n \"automations\": [\n {\n \"frequency\": 10000,\n \"frequencyUnits\": \"millis\",\n \"schema\": \"network.xyo.automation.interval\",\n \"type\": \"interval\"\n }\n ],\n \"name\": \"AddressBalancePollingSentinel\",\n \"schema\": \"network.xyo.sentinel.config\",\n \"synchronous\": true,\n \"tasks\": [\n {\n \"mod\": \"AddressBalanceDiviner\",\n \"endPoint\": \"divine\"\n }\n ]\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/5'\",\n \"automations\": [\n {\n \"frequency\": 10000,\n \"frequencyUnits\": \"millis\",\n \"schema\": \"network.xyo.automation.interval\",\n \"type\": \"interval\"\n }\n ],\n \"name\": \"AddressTransferPollingSentinel\",\n \"schema\": \"network.xyo.sentinel.config\",\n \"synchronous\": true,\n \"tasks\": [\n {\n \"mod\": \"AddressTransferDiviner\",\n \"endPoint\": \"divine\"\n }\n ]\n }\n }\n ],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"1/1/1\",\n \"name\": \"Submissions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_submissions\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/2\",\n \"name\": \"Finalized\",\n \"allowedQueries\": [\n \"network.xyo.query.archivist.get\",\n \"network.xyo.query.archivist.next\"\n ],\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 50000\n },\n \"originArchivist\": \"Validated\",\n \"schema\": \"network.xyo.archivist.view.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/3'\",\n \"name\": \"AddressBalanceDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.balance.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_balance\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/4'\",\n \"name\": \"AddressTransferDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.transfer.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_transfer\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"2\",\n \"name\": \"Pending\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"2/1/1\",\n \"name\": \"PendingTransactions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"labels\": {\n \"network.xyo.storage.class\": \"mongodb\"\n },\n \"payloadSdkConfig\": {\n \"collection\": \"pending_bundles\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","import type { ModuleManifest, PackageManifestPayload } from '@xyo-network/manifest-model'\n\nimport Chain from './Chain.json' with { type: 'json' }\nimport Pending from './Pending.json' with { type: 'json' }\n\n/**\n * Chain Node Manifest\n */\nconst ChainNodeManifest = Chain as PackageManifestPayload\n/**\n * Pending Node Manifest\n */\nconst PendingNodeManifest = Pending as PackageManifestPayload\n/**\n * Public Child Manifests\n */\nexport const PublicChildManifestsWithMempool: ModuleManifest[] = [\n ...ChainNodeManifest.nodes,\n ...PendingNodeManifest.nodes,\n]\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"1\",\n \"name\": \"Chain\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [\n {\n \"config\": {\n \"accountPath\": \"1/1'/1'\",\n \"name\": \"Validated\",\n \"allowedQueries\": [\n \"network.xyo.query.archivist.get\",\n \"network.xyo.query.archivist.next\"\n ],\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_validated\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"1/1/1\",\n \"name\": \"Submissions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_submissions\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/2\",\n \"name\": \"Finalized\",\n \"allowedQueries\": [\n \"network.xyo.query.archivist.get\",\n \"network.xyo.query.archivist.next\"\n ],\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 50000\n },\n \"originArchivist\": \"Validated\",\n \"schema\": \"network.xyo.archivist.view.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/3'\",\n \"name\": \"AddressBalanceDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.balance.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_balance\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/4'\",\n \"name\": \"AddressTransferDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.transfer.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_transfer\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"2\",\n \"name\": \"Pending\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"2/1/1\",\n \"name\": \"PendingTransactions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"labels\": {\n \"network.xyo.storage.class\": \"mongodb\"\n },\n \"payloadSdkConfig\": {\n \"collection\": \"pending_bundles\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","import type { ModuleManifest, PackageManifestPayload } from '@xyo-network/manifest-model'\n\nimport Chain from './Chain.json' with { type: 'json' }\nimport Pending from './Pending.json' with { type: 'json' }\n\n/**\n * Chain Node Manifest\n */\n const ChainNodeManifest = Chain as PackageManifestPayload\n/**\n * Pending Node Manifest\n */\n const PendingNodeManifest = Pending as PackageManifestPayload\n/**\n * Public Child Manifests\n */\nexport const PublicChildManifestsWithoutMempool: ModuleManifest[] = [\n ...ChainNodeManifest.nodes,\n ...PendingNodeManifest.nodes,\n]\n"],"mappings":";;;;AAAA,SACEA,uBACAC,6BACAC,sCACAC,mBACAC,0BACAC,kBACAC,gBACAC,yBACK;AAMP,OAAOC,iBAAiB;AACxB,OAAOC,UAAU;AAEjB,OAAOC,cAAa;;;AClBpB,SAASC,gCAAgC;AACzC,SAASC,8BAA8B;AACvC,SAASC,2BAA2B;AAS7B,IAAMC,qBAAqB,6BAAA;AAChC,QAAMC,mBAAmB;IAAC,IAAIC,oBAAAA;IAAuB,IAAIC,uBAAAA;;AACzDC,2BAAyB;IAAEH;EAAiB,CAAA;AAC9C,GAHkC;;;ACVlC,SAASI,eAAAA,oBAAmB;;;ACD5B,SAASC,oBAAoB;AAC7B,SAASC,WAAWC,iBAAiB;AACrC,SAASC,oBAAoB;AAG7B,SAASC,mBAAmB;AAI5B,IAAMC,UAAwD,8BAAOC,KAAK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AAYF,gBAAgBK,OAAO;AACrG,UAAMd,eAAee,OAAO;SAAIH,OAAO,CAAA,EAAGI,KAAI;MAAIJ,OAAO,CAAA;KAAG;AAC5DK,YAAQhC,IAAI,+DAAA;AACZ,UAAMiC,SAAS,MAAMC,oCAAoCP,OAAO,CAAA,GAAIH,iBAAiBW,gBAAgB;MAAC;MAAG;OAAS,IAAA,CAAA;AAClH,UAAMpB,eAAee,OAAO;SAAIG,OAAO,CAAA,EAAGF,KAAI;MAAIE,OAAO,CAAA;KAAG;AAC5DD,YAAQhC,IAAI,4BAA4BwB,gBAAgBK,OAAO,EAAE;EACnE;AAEA,QAAMO,qBAA6C;IACjDV,SAAShB,iBAAiBgB;IAC1BW,OAAO3B;IACP4B,OAAO;MAAEnB;IAAS;IAClBoB,MAAM,mCAAA;AACJ,YAAMA,OAAO,MAAMC,oBAAoBzB,cAAAA;AACvC,aAAO;QAACd,UAASsC,MAAME,OAAO,MAAM,iCAAA;QAAoCF,MAAMG,SAAS;;IACzF,GAHM;EAIR;AACA,QAAMC,OAAO,MAAM9B,aAAaI,QAAQ,GAAA;AACxC,QAAM2B,QAAQC,IAAIF,KAAKG,IAAI,CAACC,QAAAA;AAC1B,WAAOA,IAAIC,QAAK,MAAS,MAAM;EACjC,CAAA,CAAA;AACA,QAAMC,qBAAqBhD,UAAS,MAAMiD,sBAAsBhE,MAAAA,GAAS,MAAM,sCAAA;AAC/E,QAAMiE,MAAM,MAAMC,OAAOvC,cAAcoC,oBAAoBb,oBAAoBlD,OAAOO,IAAI4D,gBAAgB;AAC1G,QAAMC,SAASH,IAAII,OAAOlD,MAAMtB,UAAU,MAAMI,QAAQa,IAAI,oCAAoCjB,QAAAA,IAAYsB,IAAAA,EAAM,CAAA;AAClHiD,SAAOE,WAAW,GAAA;AAClB,SAAOF;AACT,GAtDyB;","names":["customPoweredByHeader","disableCaseSensitiveRouting","disableExpressDefaultPoweredByHeader","getJsonBodyParser","getJsonBodyParserOptions","responseProfiler","standardErrors","standardResponses","compression","cors","express","registerInstrumentations","ExpressInstrumentation","HttpInstrumentation","addInstrumentation","instrumentations","HttpInstrumentation","ExpressInstrumentation","registerInstrumentations","StatusCodes","asyncHandler","asAddress","isDefined","isModuleName","StatusCodes","handler","req","res","next","address","moduleIdentifier","params","node","app","asAddress","isDefined","mod","resolve","direction","json","state","isModuleName","redirect","StatusCodes","MOVED_TEMPORARILY","getAddress","asyncHandler","asyncHandler","asAddress","assertEx","isAddress","toAddress","isQueryBoundWitness","ModuleErrorBuilder","StatusCodes","BoundWitnessSchema","ModuleConfigSchema","DEFAULT_DEPTH","getQueryConfig","mod","req","bw","payloads","nestedBwAddresses","flat","filter","payload","schema","BoundWitnessSchema","map","addresses","address","length","allowed","Object","fromEntries","queries","security","ModuleConfigSchema","handler","req","res","next","returnError","code","message","details","error","ModuleErrorBuilder","build","locals","rawResponse","status","json","address","params","node","app","bw","payloads","Array","isArray","body","isAddress","StatusCodes","BAD_REQUEST","isQueryBoundWitness","modules","normalizedAddress","toAddress","typedAddress","asAddress","byAddress","undefined","resolve","maxDepth","byName","direction","moduleAddress","assertEx","redirect","TEMPORARY_REDIRECT","NOT_FOUND","length","mod","queryConfig","getQueryConfig","queryResult","query","ex","INTERNAL_SERVER_ERROR","postAddress","asyncHandler","addNodeRoutes","app","defaultModule","node","address","defaultModuleEndpoint","get","_req","res","redirect","StatusCodes","MOVED_TEMPORARILY","post","TEMPORARY_REDIRECT","getAddress","postAddress","sendStatus","NOT_FOUND","setRawResponseFormat","asHash","isDefined","asArchivistInstance","PayloadBuilder","isAnyPayload","isSequence","express","resolveArchivist","node","archivistModuleIdentifier","mod","resolve","asArchivistInstance","required","archivistInstance","getArchivist","isDefined","archivistMiddleware","options","router","express","Router","mergeParams","post","req","res","setRawResponseFormat","body","Array","isArray","payloads","PayloadBuilder","hashPairs","map","p","archivist","result","insert","status","json","get","cursor","isSequence","query","undefined","limit","Number","open","Boolean","order","next","hash","rawHash","params","asHash","payload","isAnyPayload","send","addDataLakeRoutes","app","node","archivistModuleIdentifier","use","archivistMiddleware","setRawResponseFormat","assertEx","NodeXyoViewer","SimpleNetworkStakeViewer","SimpleStepRewardsByPositionViewer","StepSizes","RewardMultipliers","NodeXyoRunner","rpcEngineFromConnection","XyoBaseConnection","Semaphore","addRpcRoutes","app","transferSummaryMap","stakedChainContext","initRewardsCache","node","runner","NodeXyoRunner","networkStakeViewer","SimpleNetworkStakeViewer","create","context","console","log","assertEx","start","viewer","NodeXyoViewer","rewardMultipliers","RewardMultipliers","transfersSummaryContext","stepSemaphores","StepSizes","map","Semaphore","summaryMap","stepRewardsByPositionViewer","SimpleStepRewardsByPositionViewer","connection","XyoBaseConnection","engine","rpcEngineFromConnection","post","req","res","setRawResponseFormat","handle","body","_","rpcResponse","json","addRoutes","app","transferSummaryMap","stakedChainContext","initRewardsCache","addRpcRoutes","addDataLakeRoutes","addNodeRoutes","getApp","node","transferSummaryMap","stakedChainContext","initRewardsCache","addInstrumentation","app","express","set","use","cors","compression","responseProfiler","getJsonBodyParser","getJsonBodyParserOptions","limit","standardResponses","disableExpressDefaultPoweredByHeader","customPoweredByHeader","disableCaseSensitiveRouting","addRoutes","standardErrors","assertEx","isDefined","isString","asArchivistInstance","boot","createProducerChainStakeIntentBlock","initChainStakeViewer","initProducerAccount","createGenesisBlock","findMostRecentBlock","HDWallet","asXL1BlockRange","readPayloadMapFromStore","BaseMongoSdk","asAddress","assertEx","isDefined","ZERO_ADDRESS","MemoryArchivist","MongoDBArchivistV2","ViewArchivist","AddressBalanceDivinerV2","AddressTransferDiviner","ArchivistSyncDiviner","HeadValidationDiviner","MongoMap","initTelemetry","AbstractModule","LoggerModuleStatusReporter","ModuleFactoryLocator","MemorySentinel","StepSizes","hasMongoConfig","MemoryMap","Semaphore","getTransferSummaryMap","config","mongoConfig","storage","mongo","hasMongoConfig","connectionString","dbConnectionString","database","dbName","domain","dbDomain","password","dbPassword","username","dbUserName","payloadSdkConfig","sdkTransferSummaryMap","BaseMongoSdk","collection","result","MongoMap","create","sdk","getCache","enabled","maxEntries","assertEx","start","console","warn","MemoryMap","getLocator","context","logger","otlpEndpoint","telemetry","otel","traceProvider","meterProvider","initTelemetry","attributes","serviceName","serviceVersion","metricsConfig","endpoint","port","isDefined","AbstractModule","defaultLogger","statusReporter","LoggerModuleStatusReporter","undefined","locator","ModuleFactoryLocator","balanceSummaryMap","transferSummaryMap","params","register","MongoDBArchivistV2","factory","sdkBalanceSummaryMap","AddressBalanceDivinerV2","summaryMap","stepSemaphores","StepSizes","map","Semaphore","AddressTransferDiviner","chainId","chain","id","asAddress","ZERO_ADDRESS","HeadValidationDiviner","allowedProducers","producer","allowlist","MemoryArchivist","MemorySentinel","ViewArchivist","ArchivistSyncDiviner","ManifestWrapper","NodeManifest","node","PrivateChildManifests","ChainNodeManifest","Chain","PendingNodeManifest","Pending","PublicChildManifestsWithMempool","nodes","Chain_default","Pending_default","ChainNodeManifest","Chain","PendingNodeManifest","Pending","PublicChildManifestsWithoutMempool","nodes","getNode","context","wallet","config","enabled","mempoolEnabled","mempool","PublicChildManifests","PublicChildManifestsWithoutMempool","PublicChildManifestsWithMempool","locator","getLocator","wrapper","ManifestWrapper","NodeManifest","PrivateChildManifests","node","childNodes","loadNodes","length","Promise","all","map","childNode","register","attach","address","hostname","getSeedPhrase","bios","config","logger","storedSeedPhrase","seedPhraseStore","get","debug","mnemonic","api","isString","warn","set","seedPhrase","HDWallet","generateMnemonic","log","assertEx","getServer","context","node","port","boot","isDefined","wallet","fromPhrase","stakeChainViewer","initChainStakeViewer","nodeContext","resolvedNode","getNode","chainArchivist","asArchivistInstance","resolve","required","chainMap","readPayloadMapFromStore","payloads","next","length","producerAccount","initProducerAccount","chainId","block0","createGenesisBlock","address","insert","flat","console","block1","createProducerChainStakeIntentBlock","asXL1BlockRange","stakedChainContext","stake","store","head","findMostRecentBlock","_hash","block","mods","Promise","all","map","mod","start","transferSummaryMap","getTransferSummaryMap","app","getApp","initRewardsCache","server","listen","setTimeout"]}
@@ -6,7 +6,7 @@ export interface GetLocatorContext {
6
6
  config: Config;
7
7
  logger?: Logger;
8
8
  }
9
- export declare function getTransferSummaryMap(config: Config): Promise<Promise<MapType<string, WithStorageMeta<TransfersStepSummary>> | undefined>>;
9
+ export declare function getTransferSummaryMap(config: Config): Promise<MapType<string, WithStorageMeta<TransfersStepSummary>>>;
10
10
  /**
11
11
  * Used for retrieving a locator with the necessary modules registered for testing
12
12
  * operation of the node (entirely in memory)
@@ -1 +1 @@
1
- {"version":3,"file":"getLocator.d.ts","sourceRoot":"","sources":["../../../src/manifest/getLocator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAclD,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
+ {"version":3,"file":"getLocator.d.ts","sourceRoot":"","sources":["../../../src/manifest/getLocator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAclD,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,MAAM,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAsB3H;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":"AAAA,OAAO,KAAK,EAAQ,MAAM,EAAE,MAAM,gBAAgB,CAAA;AASlD,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,gHA8CxD,CAAA"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAWlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAI3D,OAAO,KAAK,EAAE,MAAM,EAA0B,MAAM,+BAA+B,CAAA;AA+BnF,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,YAAY,CAAA;CACpB;AAED,eAAO,MAAM,SAAS,GAAU,SAAS,gBAAgB,gHAsDxD,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/chain-api",
3
- "version": "1.16.19",
3
+ "version": "1.16.21",
4
4
  "description": "XYO Layer One API",
5
5
  "homepage": "https://xylabs.com",
6
6
  "bugs": {
@@ -55,33 +55,32 @@
55
55
  "@xylabs/express": "~5.0.37",
56
56
  "@xylabs/mongo": "~5.0.37",
57
57
  "@xylabs/sdk-js": "~5.0.37",
58
- "@xyo-network/archivist-memory": "~5.1.23",
59
- "@xyo-network/archivist-model": "~5.1.23",
60
- "@xyo-network/archivist-mongodb": "~5.1.23",
61
- "@xyo-network/archivist-view": "~5.1.23",
58
+ "@xyo-network/archivist-memory": "~5.1.24",
59
+ "@xyo-network/archivist-model": "~5.1.24",
60
+ "@xyo-network/archivist-mongodb": "~5.1.24",
61
+ "@xyo-network/archivist-view": "~5.1.24",
62
62
  "@xyo-network/bios": "~7.1.1",
63
- "@xyo-network/boundwitness-model": "~5.1.23",
64
- "@xyo-network/chain-ethereum": "~1.16.19",
65
- "@xyo-network/chain-modules": "~1.16.19",
66
- "@xyo-network/chain-protocol": "~1.16.19",
67
- "@xyo-network/chain-rpc": "~1.16.19",
68
- "@xyo-network/chain-telemetry": "~1.16.19",
69
- "@xyo-network/chain-viewers": "~1.16.19",
70
- "@xyo-network/manifest-model": "~5.1.23",
71
- "@xyo-network/manifest-wrapper": "~5.1.23",
72
- "@xyo-network/module-abstract": "~5.1.23",
73
- "@xyo-network/module-factory-locator": "~5.1.23",
74
- "@xyo-network/module-model": "~5.1.23",
75
- "@xyo-network/node-model": "~5.1.23",
76
- "@xyo-network/payload-builder": "~5.1.23",
77
- "@xyo-network/payload-model": "~5.1.23",
78
- "@xyo-network/sentinel-memory": "~5.1.23",
79
- "@xyo-network/typechain": "~4.0.10",
80
- "@xyo-network/wallet": "~5.1.23",
81
- "@xyo-network/wallet-model": "~5.1.23",
63
+ "@xyo-network/boundwitness-model": "~5.1.24",
64
+ "@xyo-network/chain-modules": "~1.16.21",
65
+ "@xyo-network/chain-orchestration": "~1.16.21",
66
+ "@xyo-network/chain-protocol": "~1.16.21",
67
+ "@xyo-network/chain-rpc": "~1.16.21",
68
+ "@xyo-network/chain-telemetry": "~1.16.21",
69
+ "@xyo-network/chain-viewers": "~1.16.21",
70
+ "@xyo-network/manifest-model": "~5.1.24",
71
+ "@xyo-network/manifest-wrapper": "~5.1.24",
72
+ "@xyo-network/module-abstract": "~5.1.24",
73
+ "@xyo-network/module-factory-locator": "~5.1.24",
74
+ "@xyo-network/module-model": "~5.1.24",
75
+ "@xyo-network/node-model": "~5.1.24",
76
+ "@xyo-network/payload-builder": "~5.1.24",
77
+ "@xyo-network/payload-model": "~5.1.24",
78
+ "@xyo-network/sentinel-memory": "~5.1.24",
79
+ "@xyo-network/wallet": "~5.1.24",
80
+ "@xyo-network/wallet-model": "~5.1.24",
82
81
  "@xyo-network/xl1-protocol": "~1.13.11",
83
- "@xyo-network/xl1-protocol-sdk": "~1.16.19",
84
- "@xyo-network/xl1-rpc": "~1.16.19",
82
+ "@xyo-network/xl1-protocol-sdk": "~1.16.21",
83
+ "@xyo-network/xl1-rpc": "~1.16.21",
85
84
  "async-mutex": "~0.5.0",
86
85
  "compression": "~1.8.1",
87
86
  "cors": "~2.8.5",
@@ -98,14 +97,14 @@
98
97
  "@xylabs/sdk-js": "~5.0.37",
99
98
  "@xylabs/ts-scripts-yarn3": "~7.2.8",
100
99
  "@xylabs/tsconfig": "~7.2.8",
101
- "@xyo-network/account": "~5.1.23",
102
- "@xyo-network/account-model": "~5.1.23",
103
- "@xyo-network/archivist-abstract": "~5.1.23",
100
+ "@xyo-network/account": "~5.1.24",
101
+ "@xyo-network/account-model": "~5.1.24",
102
+ "@xyo-network/archivist-abstract": "~5.1.24",
104
103
  "@xyo-network/bios-model": "~7.1.1",
105
- "@xyo-network/boundwitness-builder": "~5.1.23",
106
- "@xyo-network/module-abstract-mongodb": "~5.1.23",
107
- "@xyo-network/module-model-mongodb": "~5.1.23",
108
- "@xyo-network/node-memory": "~5.1.23",
104
+ "@xyo-network/boundwitness-builder": "~5.1.24",
105
+ "@xyo-network/module-abstract-mongodb": "~5.1.24",
106
+ "@xyo-network/module-model-mongodb": "~5.1.24",
107
+ "@xyo-network/node-memory": "~5.1.24",
109
108
  "@xyo-network/xl1-protocol": "~1.13.11",
110
109
  "dotenv": "~17.2.3",
111
110
  "eslint": "^9.39.1",
@@ -21,7 +21,7 @@ import { StepSizes } from '@xyo-network/xl1-protocol'
21
21
  import type {
22
22
  BalancesStepSummary, Config, MapType, TransfersStepSummary,
23
23
  } from '@xyo-network/xl1-protocol-sdk'
24
- import { hasMongoConfig } from '@xyo-network/xl1-protocol-sdk'
24
+ import { hasMongoConfig, MemoryMap } from '@xyo-network/xl1-protocol-sdk'
25
25
  import { Semaphore } from 'async-mutex'
26
26
 
27
27
  export interface GetLocatorContext {
@@ -29,7 +29,7 @@ export interface GetLocatorContext {
29
29
  logger?: Logger
30
30
  }
31
31
 
32
- export async function getTransferSummaryMap(config: Config): Promise<Promise<MapType<string, WithStorageMeta<TransfersStepSummary>> | undefined>> {
32
+ export async function getTransferSummaryMap(config: Config): Promise<MapType<string, WithStorageMeta<TransfersStepSummary>>> {
33
33
  const mongoConfig = config.storage?.mongo
34
34
  if (hasMongoConfig(mongoConfig)) {
35
35
  // Create the MongoDB SDK from the configuration
@@ -41,10 +41,15 @@ export async function getTransferSummaryMap(config: Config): Promise<Promise<Map
41
41
  }
42
42
 
43
43
  const sdkTransferSummaryMap = new BaseMongoSdk<WithStorageMeta<TransfersStepSummary>>({ ...payloadSdkConfig, collection: 'transfer_summary_map' })
44
- return await MongoMap.create<MongoMap<Hash, WithStorageMeta<TransfersStepSummary>>>({
44
+ const result = await MongoMap.create<MongoMap<Hash, WithStorageMeta<TransfersStepSummary>>>({
45
45
  sdk: sdkTransferSummaryMap,
46
46
  getCache: { enabled: true, maxEntries: 5000 },
47
47
  })
48
+ assertEx(await result.start(), () => 'Failed to start transfer summary map')
49
+ return result
50
+ } else {
51
+ console.warn('[API] Mongo configuration not found. Using MemoryMap for TransferSummaryMap.')
52
+ return new MemoryMap<string, WithStorageMeta<TransfersStepSummary>>()
48
53
  }
49
54
  }
50
55
 
@@ -1,21 +1,21 @@
1
1
  import type { Hash, Logger } from '@xylabs/sdk-js'
2
2
  import {
3
- assertEx, isDefined, isString, toEthAddress,
3
+ assertEx, isDefined, isString,
4
4
  } from '@xylabs/sdk-js'
5
5
  import { asArchivistInstance } from '@xyo-network/archivist-model'
6
6
  import { boot } from '@xyo-network/bios'
7
7
  import type { BiosExternalInterface } from '@xyo-network/bios-model'
8
- import { EthereumChainStakeEvents, EthereumChainStakeViewer } from '@xyo-network/chain-ethereum'
9
- import { findMostRecentBlock } from '@xyo-network/chain-protocol'
8
+ import {
9
+ createProducerChainStakeIntentBlock, initChainStakeViewer, initProducerAccount,
10
+ } from '@xyo-network/chain-orchestration'
11
+ import { createGenesisBlock, findMostRecentBlock } from '@xyo-network/chain-protocol'
10
12
  import type { NodeInstance } from '@xyo-network/node-model'
11
13
  import type { Payload, WithStorageMeta } from '@xyo-network/payload-model'
12
- import { StakedXyoChainV2__factory } from '@xyo-network/typechain'
13
14
  import { HDWallet } from '@xyo-network/wallet'
14
- import type { ChainId } from '@xyo-network/xl1-protocol'
15
+ import { asXL1BlockRange } from '@xyo-network/xl1-protocol'
15
16
  import type { Config, StakedChainContextRead } from '@xyo-network/xl1-protocol-sdk'
16
17
  import { readPayloadMapFromStore } from '@xyo-network/xl1-protocol-sdk'
17
18
 
18
- import { initInfuraProvider } from '../helpers/index.ts'
19
19
  import { getNode, getTransferSummaryMap } from '../manifest/index.ts'
20
20
  import { getApp } from './app.ts'
21
21
 
@@ -58,18 +58,13 @@ export const getServer = async (context: GetServerContext) => {
58
58
  const bios = await boot()
59
59
  const seedPhrase = isDefined(mnemonic) ? mnemonic : await getSeedPhrase(bios, config, logger)
60
60
  const wallet = await HDWallet.fromPhrase(seedPhrase)
61
- const provider = await initInfuraProvider(config)
62
- const contractAddress = assertEx(config.chain.id, () => 'Missing config.evm.chainId') as ChainId
63
- const contract = StakedXyoChainV2__factory.connect(toEthAddress(contractAddress), provider)
61
+
62
+ const stakeChainViewer = await initChainStakeViewer(config, logger)
63
+
64
64
  const nodeContext = {
65
65
  wallet, logger, config,
66
66
  }
67
- const stakeEventsViewer = await EthereumChainStakeEvents.create({ contract, logger })
68
- assertEx(await stakeEventsViewer.start(), () => 'Failed to start EthereumChainStakeEvents reader')
69
- const stakeChainViewer = await EthereumChainStakeViewer.create({
70
- contract, stakeEventsViewer, logger,
71
- })
72
- assertEx(await stakeChainViewer.start(), () => 'Failed to start EthereumChainStake viewer')
67
+
73
68
  const resolvedNode: NodeInstance = node ?? await getNode(nodeContext)
74
69
  const chainArchivist = assertEx(asArchivistInstance(
75
70
  await resolvedNode.resolve('Chain:Validated'),
@@ -77,14 +72,27 @@ export const getServer = async (context: GetServerContext) => {
77
72
  ), () => 'FinalizedArchivist not found in node')
78
73
  const chainMap = readPayloadMapFromStore<WithStorageMeta<Payload>>(chainArchivist)
79
74
 
75
+ const payloads = await chainArchivist.next()
76
+
77
+ if (payloads.length === 0) {
78
+ logger?.warn('[API] No blocks found in chain archivist, creating genesis block')
79
+ const producerAccount = await initProducerAccount({ config, logger })
80
+ const chainId = stakeChainViewer.chainId
81
+ const block0 = await createGenesisBlock(producerAccount, chainId, 1_000_000n, producerAccount.address)
82
+ await chainArchivist.insert([...block0[1].flat(), block0[0]])
83
+ console.log('[API] Genesis block created and inserted into chain archivist')
84
+ const block1 = await createProducerChainStakeIntentBlock(block0[0], producerAccount, asXL1BlockRange([0, 10_000], true))
85
+ await chainArchivist.insert([...block1[1].flat(), block1[0]])
86
+ console.log(`[API] Producer declared: ${producerAccount.address}`)
87
+ }
88
+
80
89
  const stakedChainContext: StakedChainContextRead = {
81
- chainId: contractAddress,
82
- events: stakeEventsViewer,
90
+ chainId: stakeChainViewer.chainId,
83
91
  stake: stakeChainViewer,
84
92
  store: { chainMap },
85
93
  head: async (): Promise<[Hash, number]> => {
86
94
  const head = await findMostRecentBlock(chainArchivist)
87
- return [assertEx(head?._hash, () => 'No head found in chainArchivist'), assertEx(head?.block, () => 'No head found in chainArchivist')]
95
+ return [assertEx(head?._hash, () => 'No head found in chainArchivist'), head?.block ?? 0]
88
96
  },
89
97
  }
90
98
  const mods = await resolvedNode.resolve('*')