@xyo-network/chain-api 1.16.19 → 1.16.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -337,16 +337,20 @@ var getApp = /* @__PURE__ */ __name(async (node, transferSummaryMap, stakedChain
337
337
 
338
338
  // src/server/server.ts
339
339
  import { assertEx as assertEx6, isDefined as isDefined6, isString, toEthAddress } from "@xylabs/sdk-js";
340
+ import { Account } from "@xyo-network/account";
340
341
  import { asArchivistInstance as asArchivistInstance2 } from "@xyo-network/archivist-model";
341
342
  import { boot } from "@xyo-network/bios";
342
343
  import { EthereumChainStakeEvents, EthereumChainStakeViewer } from "@xyo-network/chain-ethereum";
343
- import { findMostRecentBlock } from "@xyo-network/chain-protocol";
344
+ import { createGenesisBlock, findMostRecentBlock } from "@xyo-network/chain-protocol";
344
345
  import { StakedXyoChainV2__factory } from "@xyo-network/typechain";
345
346
  import { HDWallet } from "@xyo-network/wallet";
346
- import { readPayloadMapFromStore } from "@xyo-network/xl1-protocol-sdk";
347
+ import { readPayloadMapFromStore, SimpleChainStakeViewer } from "@xyo-network/xl1-protocol-sdk";
347
348
 
348
349
  // src/helpers/initChainId.ts
349
350
  import { assertEx as assertEx3, hexFrom, isDefined as isDefined3, isHex } from "@xylabs/sdk-js";
351
+ var canUseChainId = /* @__PURE__ */ __name((config) => {
352
+ return isDefined3(config.evm.chainId);
353
+ }, "canUseChainId");
350
354
  var getChainId = /* @__PURE__ */ __name((config) => {
351
355
  const chainId = assertEx3(config.evm.chainId, () => "Missing config.evm.chainId");
352
356
  if (isHex(chainId, {
@@ -371,6 +375,9 @@ var initInfuraProvider = /* @__PURE__ */ __name((config) => {
371
375
  instance = Promise.resolve(new InfuraWebSocketProvider(providerConfig[0], providerConfig[1]));
372
376
  return instance;
373
377
  }, "initInfuraProvider");
378
+ var canUseInfuraProvider = /* @__PURE__ */ __name((config) => {
379
+ return canUseChainId(config) && isDefined4(config.evm?.infura?.projectId) && isDefined4(config.evm?.infura?.projectSecret);
380
+ }, "canUseInfuraProvider");
374
381
  var getInfuraProviderConfig = /* @__PURE__ */ __name((config) => {
375
382
  const projectId = assertEx4(config.evm?.infura?.projectId, () => "Missing config.evm.infura.projectId");
376
383
  const projectSecret = assertEx4(config.evm?.infura?.projectSecret, () => "Missing config.evm.infura.projectSecret");
@@ -394,7 +401,7 @@ import { AbstractModule, LoggerModuleStatusReporter } from "@xyo-network/module-
394
401
  import { ModuleFactoryLocator } from "@xyo-network/module-factory-locator";
395
402
  import { MemorySentinel } from "@xyo-network/sentinel-memory";
396
403
  import { StepSizes as StepSizes2 } from "@xyo-network/xl1-protocol";
397
- import { hasMongoConfig } from "@xyo-network/xl1-protocol-sdk";
404
+ import { hasMongoConfig, MemoryMap } from "@xyo-network/xl1-protocol-sdk";
398
405
  import { Semaphore as Semaphore2 } from "async-mutex";
399
406
  async function getTransferSummaryMap(config) {
400
407
  const mongoConfig = config.storage?.mongo;
@@ -411,13 +418,18 @@ async function getTransferSummaryMap(config) {
411
418
  ...payloadSdkConfig,
412
419
  collection: "transfer_summary_map"
413
420
  });
414
- return await MongoMap.create({
421
+ const result = await MongoMap.create({
415
422
  sdk: sdkTransferSummaryMap,
416
423
  getCache: {
417
424
  enabled: true,
418
425
  maxEntries: 5e3
419
426
  }
420
427
  });
428
+ assertEx5(await result.start(), () => "Failed to start transfer summary map");
429
+ return result;
430
+ } else {
431
+ console.warn("[API] Mongo configuration not found. Using MemoryMap for TransferSummaryMap.");
432
+ return new MemoryMap();
421
433
  }
422
434
  }
423
435
  __name(getTransferSummaryMap, "getTransferSummaryMap");
@@ -945,39 +957,65 @@ var getSeedPhrase = /* @__PURE__ */ __name(async (bios, config, logger) => {
945
957
  }
946
958
  return assertEx6(await bios.seedPhraseStore.get("os"), () => "Unable to acquire mnemonic from bios");
947
959
  }, "getSeedPhrase");
960
+ async function getStakeChainViewer(config, logger) {
961
+ if (canUseInfuraProvider(config)) {
962
+ const provider = await initInfuraProvider(config);
963
+ const contractAddress = assertEx6(config.chain.id, () => "Missing config.evm.chainId");
964
+ const contract = StakedXyoChainV2__factory.connect(toEthAddress(contractAddress), provider);
965
+ const stakeEventsViewer = await EthereumChainStakeEvents.create({
966
+ contract,
967
+ logger
968
+ });
969
+ assertEx6(await stakeEventsViewer.start(), () => "Failed to start EthereumChainStakeEvents reader");
970
+ const stakeChainViewer = await EthereumChainStakeViewer.create({
971
+ contract,
972
+ stakeEventsViewer,
973
+ logger
974
+ });
975
+ assertEx6(await stakeChainViewer.start(), () => "Failed to start EthereumChainStake viewer");
976
+ return stakeChainViewer;
977
+ } else {
978
+ console.warn("[API] Infura configuration not found. Using SimpleChainStakeViewer with no positions. This means no staking data will be available.");
979
+ const stakeChainViewer = await SimpleChainStakeViewer.create({
980
+ logger,
981
+ positions: []
982
+ });
983
+ assertEx6(await stakeChainViewer.start(), () => "Failed to start SimpleChainStake viewer");
984
+ return stakeChainViewer;
985
+ }
986
+ }
987
+ __name(getStakeChainViewer, "getStakeChainViewer");
948
988
  var getServer = /* @__PURE__ */ __name(async (context) => {
949
989
  const { config, logger, node } = context;
950
990
  const { mnemonic, port } = context.config.api;
951
991
  const bios = await boot();
952
992
  const seedPhrase = isDefined6(mnemonic) ? mnemonic : await getSeedPhrase(bios, config, logger);
953
993
  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);
994
+ const stakeChainViewer = await getStakeChainViewer(config, logger);
957
995
  const nodeContext = {
958
996
  wallet,
959
997
  logger,
960
998
  config
961
999
  };
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
1000
  const resolvedNode = node ?? await getNode(nodeContext);
974
1001
  const chainArchivist = assertEx6(asArchivistInstance2(await resolvedNode.resolve("Chain:Validated"), {
975
1002
  required: true
976
1003
  }), () => "FinalizedArchivist not found in node");
977
1004
  const chainMap = readPayloadMapFromStore(chainArchivist);
1005
+ const payloads = await chainArchivist.next();
1006
+ if (payloads.length === 0) {
1007
+ logger?.warn("[API] No blocks found in chain archivist, creating genesis block");
1008
+ const initialProducer = await Account.random();
1009
+ const chainId = stakeChainViewer.chainId;
1010
+ const block = await createGenesisBlock(initialProducer, chainId, 1000000n, initialProducer.address);
1011
+ await chainArchivist.insert([
1012
+ ...block[1].flat(),
1013
+ block[0]
1014
+ ]);
1015
+ console.log("[API] Genesis block created and inserted into chain archivist");
1016
+ }
978
1017
  const stakedChainContext = {
979
- chainId: contractAddress,
980
- events: stakeEventsViewer,
1018
+ chainId: stakeChainViewer.chainId,
981
1019
  stake: stakeChainViewer,
982
1020
  store: {
983
1021
  chainMap
@@ -986,7 +1024,7 @@ var getServer = /* @__PURE__ */ __name(async (context) => {
986
1024
  const head = await findMostRecentBlock(chainArchivist);
987
1025
  return [
988
1026
  assertEx6(head?._hash, () => "No head found in chainArchivist"),
989
- assertEx6(head?.block, () => "No head found in chainArchivist")
1027
+ head?.block ?? 0
990
1028
  ];
991
1029
  }, "head")
992
1030
  };
@@ -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;AAC1C,QAAM,EAAEC,KAAI,IAAKN,IAAIO;AACrB,QAAMJ,UAAUK,UAAUJ,gBAAAA;AAC1B,MA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sB/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/helpers/initChainId.ts","../../src/helpers/initInfuraProvider.ts","../../src/manifest/getLocator.ts","../../src/manifest/getNode.ts","../../src/manifest/node.json","../../src/manifest/nodeManifest.ts","../../src/manifest/private/index.ts","../../src/manifest/public/WithMempool/Chain.json","../../src/manifest/public/WithMempool/Pending.json","../../src/manifest/public/WithMempool/index.ts","../../src/manifest/public/WithoutMempool/Chain.json","../../src/manifest/public/WithoutMempool/Pending.json","../../src/manifest/public/WithoutMempool/index.ts"],"sourcesContent":["import {\n customPoweredByHeader,\n disableCaseSensitiveRouting,\n disableExpressDefaultPoweredByHeader,\n getJsonBodyParser,\n getJsonBodyParserOptions,\n responseProfiler,\n standardErrors,\n standardResponses,\n} from '@xylabs/express'\nimport type { NodeInstance } from '@xyo-network/node-model'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport type {\n MapType, StakedChainContextRead, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport compression from 'compression'\nimport cors from 'cors'\nimport type { Express } from 'express'\nimport express from 'express'\n\nimport { addInstrumentation } from './instrumentation.ts'\nimport { addRoutes } from './routes/index.ts'\n\nexport const getApp = async (\n node: NodeInstance,\n transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>,\n stakedChainContext: StakedChainContextRead,\n initRewardsCache?: boolean,\n): Promise<Express> => {\n addInstrumentation()\n const app = express()\n app.set('etag', false)\n\n app.use(cors())\n app.use(compression())\n app.use(responseProfiler)\n app.use(getJsonBodyParser(getJsonBodyParserOptions({ limit: '1mb' })))\n app.use(standardResponses)\n disableExpressDefaultPoweredByHeader(app)\n app.use(customPoweredByHeader)\n disableCaseSensitiveRouting(app)\n app.node = node\n await addRoutes(app, transferSummaryMap, stakedChainContext, initRewardsCache)\n app.use(standardErrors)\n return app\n}\n","import { registerInstrumentations } from '@opentelemetry/instrumentation'\nimport { ExpressInstrumentation } from '@opentelemetry/instrumentation-express'\nimport { HttpInstrumentation } from '@opentelemetry/instrumentation-http'\n\n/**\n * Registers OpenTelemetry instrumentations for HTTP and Express.\n * This function is used to set up the necessary instrumentations for monitoring\n * HTTP requests and Express applications. Since it monkey patches the Express\n * router & middleware system, it should be called before any Express applications\n * are defined.\n */\nexport const addInstrumentation = () => {\n const instrumentations = [new HttpInstrumentation(), new ExpressInstrumentation()]\n registerInstrumentations({ instrumentations })\n}\n","import type { Express } from 'express'\nimport { StatusCodes } from 'http-status-codes'\n\nimport { getAddress } from './get/index.ts'\nimport { postAddress } from './post/index.ts'\n\nexport const addNodeRoutes = (app: Express) => {\n const defaultModule = app.node\n const address = defaultModule.address\n const defaultModuleEndpoint = `/${address}`\n app.get('/', (_req, res) => res.redirect(StatusCodes.MOVED_TEMPORARILY, defaultModuleEndpoint))\n app.post('/', (_req, res) => res.redirect(StatusCodes.TEMPORARY_REDIRECT, defaultModuleEndpoint))\n app.get('/:address', getAddress)\n app.post('/:address', postAddress)\n app.get('/:hash', (_req, res) => {\n res.sendStatus(StatusCodes.NOT_FOUND)\n })\n app.post('/:hash', (_req, res) => {\n res.sendStatus(StatusCodes.NOT_FOUND)\n })\n}\n","import { asyncHandler } from '@xylabs/express'\nimport { asAddress, isDefined } from '@xylabs/sdk-js'\nimport { isModuleName } from '@xyo-network/module-model'\nimport type { Payload } from '@xyo-network/payload-model'\nimport type { RequestHandler } from 'express'\nimport { StatusCodes } from 'http-status-codes'\n\nimport type { AddressPathParams } from '../AddressPathParams.ts'\n\nconst handler: RequestHandler<AddressPathParams, Payload[]> = async (req, res, next) => {\n const { address: moduleIdentifier } = req.params\n const { node } = req.app\n const address = asAddress(moduleIdentifier)\n if (isDefined(address)) {\n let mod = node.address === address ? node : (await node.resolve(address, { direction: 'down' }))\n if (mod) {\n res.json(await mod.state())\n return\n }\n }\n if (isModuleName(moduleIdentifier)) {\n const mod = await node.resolve(moduleIdentifier, { direction: 'down' })\n if (mod) {\n res.redirect(StatusCodes.MOVED_TEMPORARILY, `/${mod.address}`)\n return\n }\n }\n next('route')\n}\nexport const getAddress = asyncHandler(handler)\n","import { asyncHandler } from '@xylabs/express'\nimport type { JsonObject } from '@xylabs/sdk-js'\nimport {\n asAddress, assertEx,\n isAddress,\n toAddress,\n} from '@xylabs/sdk-js'\nimport { isQueryBoundWitness, type QueryBoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleErrorBuilder } from '@xyo-network/module-abstract'\nimport type { ModuleInstance, ModuleQueryResult } from '@xyo-network/module-model'\nimport type { ModuleError, Payload } from '@xyo-network/payload-model'\nimport type { RequestHandler } from 'express'\nimport { StatusCodes } from 'http-status-codes'\n\nimport type { AddressPathParams } from '../AddressPathParams.ts'\nimport { getQueryConfig } from './getQueryConfig.ts'\n\ntype PostAddressRequestBody = [QueryBoundWitness, undefined | Payload[]]\n\nconst handler: RequestHandler<AddressPathParams, ModuleQueryResult | ModuleError, PostAddressRequestBody> = async (req, res, next) => {\n const returnError = (code: number, message = 'An error occurred', details?: JsonObject) => {\n const error = new ModuleErrorBuilder().message(message).details(details).build()\n res.locals.rawResponse = false\n res.status(code).json(error)\n next()\n }\n\n const { address } = req.params\n const { node } = req.app\n const [bw, payloads] = Array.isArray(req.body) ? req.body : []\n if (!isAddress(address)) {\n return returnError(StatusCodes.BAD_REQUEST, 'Missing address')\n }\n\n if (!bw) {\n return returnError(StatusCodes.BAD_REQUEST, 'Missing boundwitness')\n }\n\n if (!isQueryBoundWitness(bw)) {\n return returnError(StatusCodes.BAD_REQUEST, 'Invalid query boundwitness')\n }\n\n let modules: ModuleInstance[] = []\n const normalizedAddress = toAddress(address)\n if (node.address === normalizedAddress) modules = [node]\n else {\n const typedAddress = asAddress(address)\n const byAddress = (typedAddress === undefined) ? undefined : await node.resolve(typedAddress, { maxDepth: 10 })\n\n if (byAddress) modules = [byAddress]\n else {\n const byName = await node.resolve(address, { direction: 'down' })\n if (byName) {\n const moduleAddress = assertEx(byName?.address, () => 'Error redirecting to module by address')\n res.redirect(StatusCodes.TEMPORARY_REDIRECT, `/${moduleAddress}`)\n return\n } else {\n return returnError(StatusCodes.NOT_FOUND, 'Module not found', { address })\n }\n }\n }\n\n if (modules.length > 0) {\n const mod = modules[0]\n const queryConfig = getQueryConfig(mod, req, bw, payloads)\n try {\n const queryResult = await mod.query(bw, payloads, queryConfig)\n res.json(queryResult)\n } catch (ex) {\n return returnError(StatusCodes.INTERNAL_SERVER_ERROR, 'Query Failed', { message: (ex as Error)?.message ?? 'Unknown Error' })\n }\n } else {\n return returnError(StatusCodes.NOT_FOUND, 'Module not found', { address })\n }\n}\n\nexport const postAddress = asyncHandler(handler)\n","import type { BoundWitness, QueryBoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessSchema } from '@xyo-network/boundwitness-model'\nimport type { ModuleConfig, ModuleInstance } from '@xyo-network/module-model'\nimport { ModuleConfigSchema } from '@xyo-network/module-model'\nimport type { Payload } from '@xyo-network/payload-model'\nimport type { Request } from 'express'\n\nconst DEFAULT_DEPTH = 5 as const\n\nexport const getQueryConfig = (mod: ModuleInstance, req: Request, bw: QueryBoundWitness, payloads?: Payload[]): ModuleConfig | undefined => {\n // TODO: Filter based on query addresses?\n // Recurse through payloads for nested BWs\n const nestedBwAddresses\n = payloads\n ?.flat(DEFAULT_DEPTH)\n .filter<BoundWitness>((payload): payload is BoundWitness => payload?.schema === BoundWitnessSchema)\n .map(bw => bw.addresses) ?? []\n // TODO: Do we want to end up with a list of addresses or a list of address lists?\n const addresses = [bw.addresses, ...nestedBwAddresses].filter(address => address.length > 0)\n const allowed = addresses.length > 0 ? Object.fromEntries(mod.queries.map(schema => [schema, addresses])) : {}\n const security = { allowed }\n return { schema: ModuleConfigSchema, security }\n}\n","import { setRawResponseFormat } from '@xylabs/express'\nimport { asHash, isDefined } from '@xylabs/sdk-js'\nimport type {\n ArchivistInstance,\n ArchivistNextOptions, NextOptions,\n} from '@xyo-network/archivist-model'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { NodeInstance } from '@xyo-network/node-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isAnyPayload, isSequence } from '@xyo-network/payload-model'\nimport type { Router } from 'express'\nimport express from 'express'\nimport type { Request } from 'express-serve-static-core'\n\nconst resolveArchivist = async (node: NodeInstance, archivistModuleIdentifier: ModuleIdentifier): Promise<ArchivistInstance> => {\n const mod = await node.resolve(archivistModuleIdentifier)\n return asArchivistInstance(mod, { required: true })\n}\n\nlet archivistInstance: ArchivistInstance | undefined\n\nconst getArchivist = async (node: NodeInstance, archivistModuleIdentifier: ModuleIdentifier): Promise<ArchivistInstance> => {\n if (isDefined(archivistInstance)) return archivistInstance\n archivistInstance = await resolveArchivist(node, archivistModuleIdentifier)\n return archivistInstance\n}\n\ntype ArchivistMiddlewareOptions = {\n archivistModuleIdentifier: ModuleIdentifier\n node: NodeInstance\n}\n\nexport const archivistMiddleware = (options: ArchivistMiddlewareOptions): Router => {\n const { node, archivistModuleIdentifier } = options\n const router = express.Router({ mergeParams: true })\n\n router.post('/insert', async (req, res) => {\n setRawResponseFormat(res)\n const body = Array.isArray(req.body) ? req.body : [req.body]\n const payloads = (await PayloadBuilder.hashPairs<Payload>(body)).map(p => p[0])\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const result = await archivist.insert(payloads)\n res.status(200).json(result)\n })\n\n router.get('/next', async (req: Request<Partial<NextOptions>>, res) => {\n setRawResponseFormat(res)\n const cursor = isSequence(req.query.cursor) ? req.query.cursor : undefined\n const limit = isDefined(req.query.limit) ? Number(req.query.limit) : undefined\n const open = isDefined(req.query.open) ? Boolean(req.query.open) : undefined\n const order = req.query.order === 'asc' ? 'asc' : 'desc'\n const options: ArchivistNextOptions = {\n limit, open, order, cursor,\n }\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const result = await archivist.next(options)\n res.status(200).json(result)\n })\n router.post('/next', async (req: Request<{}, {}, ArchivistNextOptions | undefined>, res) => {\n setRawResponseFormat(res)\n const options = req.body\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const result = await (isDefined(options) ? archivist.next(options) : archivist.next())\n res.status(200).json(result)\n })\n\n router.get('/get/:hash', async (req, res) => {\n setRawResponseFormat(res)\n const { hash: rawHash } = req.params\n const hash = asHash(rawHash)\n if (isDefined(hash)) {\n const archivist = await getArchivist(node, archivistModuleIdentifier)\n const [payload] = await archivist.get([hash])\n if (isAnyPayload(payload)) {\n res.json(payload)\n return\n }\n }\n res.status(400).send()\n })\n\n return router\n}\n","import type { Express } from 'express'\n\nimport { archivistMiddleware } from './archivistMiddleware.ts'\n\nexport const addDataLakeRoutes = (app: Express) => {\n const { node } = app\n const archivistModuleIdentifier = 'Chain:Finalized'\n app.use('/chain', archivistMiddleware({ node, archivistModuleIdentifier }))\n}\n","import { setRawResponseFormat } from '@xylabs/express'\nimport { assertEx } from '@xylabs/sdk-js'\nimport { NodeXyoViewer } from '@xyo-network/chain-rpc'\nimport { SimpleNetworkStakeViewer, SimpleStepRewardsByPositionViewer } from '@xyo-network/chain-viewers'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport { StepSizes } from '@xyo-network/xl1-protocol'\nimport type {\n MapType, StakedChainContextRead, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport { RewardMultipliers } from '@xyo-network/xl1-protocol-sdk'\nimport {\n NodeXyoRunner, rpcEngineFromConnection, XyoBaseConnection,\n} from '@xyo-network/xl1-rpc'\nimport { Semaphore } from 'async-mutex'\nimport type { Express } from 'express'\n\nexport const addRpcRoutes = async (\n app: Express,\n transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>,\n stakedChainContext: StakedChainContextRead,\n initRewardsCache?: boolean,\n) => {\n const { node } = app\n const runner = new NodeXyoRunner(node)\n const networkStakeViewer = await SimpleNetworkStakeViewer.create({ context: stakedChainContext })\n\n console.log('Initializing SimpleNetworkStakeViewer...')\n assertEx(await networkStakeViewer.start(), () => 'Failed to start SimpleNetworkStakeViewer')\n console.log('Initialized SimpleNetworkStakeViewer.')\n\n const viewer = await NodeXyoViewer.create({\n node,\n rewardMultipliers: RewardMultipliers,\n initRewardsCache,\n context: stakedChainContext,\n transfersSummaryContext: {\n ...stakedChainContext, stepSemaphores: StepSizes.map(() => new Semaphore(20)), summaryMap: transferSummaryMap,\n },\n })\n\n console.log('Initializing NodeXyoViewer...')\n assertEx(await viewer.start(), () => 'Failed to start NodeXyoViewer')\n console.log('Initialized NodeXyoViewer.')\n\n const stepRewardsByPositionViewer = await SimpleStepRewardsByPositionViewer.create({\n context: stakedChainContext,\n rewardMultipliers: RewardMultipliers,\n })\n\n console.log('Initializing SimpleStepRewardsByPositionViewer...')\n assertEx(await stepRewardsByPositionViewer.start(), () => 'Failed to start SimpleStepRewardsByPositionViewer')\n console.log('Initialized SimpleStepRewardsByPositionViewer.')\n\n const connection = new XyoBaseConnection({ runner, viewer })\n const engine = rpcEngineFromConnection(connection, networkStakeViewer)\n\n app.post('/rpc', (req, res) => {\n setRawResponseFormat(res)\n engine.handle(req.body, (_, rpcResponse) => {\n res.json(rpcResponse)\n })\n })\n}\n","import type { WithStorageMeta } from '@xyo-network/payload-model'\nimport type {\n MapType, StakedChainContextRead, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport type { Express } from 'express'\n\nimport { addNodeRoutes } from './address/index.ts'\nimport { addDataLakeRoutes } from './dataLake/index.ts'\nimport { addRpcRoutes } from './rpc/index.ts'\n\nexport const addRoutes = async (\n app: Express,\n transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>,\n stakedChainContext: StakedChainContextRead,\n initRewardsCache?: boolean,\n) => {\n await addRpcRoutes(app, transferSummaryMap, stakedChainContext, initRewardsCache)\n addDataLakeRoutes(app)\n addNodeRoutes(app)\n}\n","import type { Hash, Logger } from '@xylabs/sdk-js'\nimport {\n assertEx, isDefined, isString, toEthAddress,\n} from '@xylabs/sdk-js'\nimport { Account } from '@xyo-network/account'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport { boot } from '@xyo-network/bios'\nimport type { BiosExternalInterface } from '@xyo-network/bios-model'\nimport { EthereumChainStakeEvents, EthereumChainStakeViewer } from '@xyo-network/chain-ethereum'\nimport { createGenesisBlock, findMostRecentBlock } from '@xyo-network/chain-protocol'\nimport type { NodeInstance } from '@xyo-network/node-model'\nimport type { Payload, WithStorageMeta } from '@xyo-network/payload-model'\nimport { StakedXyoChainV2__factory } from '@xyo-network/typechain'\nimport { HDWallet } from '@xyo-network/wallet'\nimport type { ChainId } from '@xyo-network/xl1-protocol'\nimport type {\n Config, StakedChainContextRead, StakeViewer,\n} from '@xyo-network/xl1-protocol-sdk'\nimport { readPayloadMapFromStore, SimpleChainStakeViewer } from '@xyo-network/xl1-protocol-sdk'\n\nimport { canUseInfuraProvider, initInfuraProvider } from '../helpers/index.ts'\nimport { getNode, getTransferSummaryMap } from '../manifest/index.ts'\nimport { getApp } from './app.ts'\n\nconst hostname = '::'\n// const hostname = '0.0.0.0'\n\n// TODO: Make nodejs version of bios support round tripping mnemonic between boots\nconst getSeedPhrase = async (bios: BiosExternalInterface, config: Config, logger?: Logger): Promise<string> => {\n const storedSeedPhrase = await bios.seedPhraseStore.get('os')\n logger?.debug(`[API] Stored mnemonic: ${storedSeedPhrase}`)\n const { mnemonic } = config.api\n if (isString(storedSeedPhrase) && isString(mnemonic)) {\n logger?.warn('[API] Stored mnemonic does not match supplied. Updating stored mnemonic to supplied.')\n await bios.seedPhraseStore.set('os', mnemonic)\n } else {\n let seedPhrase: string\n if (isString(mnemonic)) {\n seedPhrase = mnemonic\n } else {\n seedPhrase = HDWallet.generateMnemonic()\n logger?.log('[API] No mnemonic provided, using random mnemonic. This is not recommended for production use.')\n logger?.log(`[API] Mnemonic: ${seedPhrase}`)\n }\n await bios.seedPhraseStore.set('os', seedPhrase)\n }\n return assertEx(await bios.seedPhraseStore.get('os'), () => 'Unable to acquire mnemonic from bios')\n}\n\ninterface GetServerContext {\n config: Config\n logger?: Logger\n node?: NodeInstance\n}\n\nasync function getStakeChainViewer(config: Config, logger?: Logger): Promise<StakeViewer> {\n if (canUseInfuraProvider(config)) {\n const provider = await initInfuraProvider(config)\n const contractAddress = assertEx(config.chain.id, () => 'Missing config.evm.chainId') as ChainId\n const contract = StakedXyoChainV2__factory.connect(toEthAddress(contractAddress), provider)\n const stakeEventsViewer = await EthereumChainStakeEvents.create({ contract, logger })\n assertEx(await stakeEventsViewer.start(), () => 'Failed to start EthereumChainStakeEvents reader')\n const stakeChainViewer = await EthereumChainStakeViewer.create({\n contract, stakeEventsViewer, logger,\n })\n assertEx(await stakeChainViewer.start(), () => 'Failed to start EthereumChainStake viewer')\n return stakeChainViewer\n } else {\n console.warn('[API] Infura configuration not found. Using SimpleChainStakeViewer with no positions. This means no staking data will be available.')\n const stakeChainViewer = await SimpleChainStakeViewer.create({ logger, positions: [] })\n assertEx(await stakeChainViewer.start(), () => 'Failed to start SimpleChainStake viewer')\n return stakeChainViewer\n }\n}\n\nexport const getServer = async (context: GetServerContext) => {\n const {\n config, logger, node,\n } = context\n const { mnemonic, port } = context.config.api\n const bios = await boot()\n const seedPhrase = isDefined(mnemonic) ? mnemonic : await getSeedPhrase(bios, config, logger)\n const wallet = await HDWallet.fromPhrase(seedPhrase)\n\n const stakeChainViewer = await getStakeChainViewer(config, logger)\n\n const nodeContext = {\n wallet, logger, config,\n }\n\n const resolvedNode: NodeInstance = node ?? await getNode(nodeContext)\n const chainArchivist = assertEx(asArchivistInstance(\n await resolvedNode.resolve('Chain:Validated'),\n { required: true },\n ), () => 'FinalizedArchivist not found in node')\n const chainMap = readPayloadMapFromStore<WithStorageMeta<Payload>>(chainArchivist)\n\n const payloads = await chainArchivist.next()\n\n if (payloads.length === 0) {\n logger?.warn('[API] No blocks found in chain archivist, creating genesis block')\n const initialProducer = await Account.random()\n const chainId = stakeChainViewer.chainId\n const block = await createGenesisBlock(initialProducer, chainId, 1_000_000n, initialProducer.address)\n await chainArchivist.insert([...block[1].flat(), block[0]])\n console.log('[API] Genesis block created and inserted into chain archivist')\n }\n\n const stakedChainContext: StakedChainContextRead = {\n chainId: stakeChainViewer.chainId,\n stake: stakeChainViewer,\n store: { chainMap },\n head: async (): Promise<[Hash, number]> => {\n const head = await findMostRecentBlock(chainArchivist)\n return [assertEx(head?._hash, () => 'No head found in chainArchivist'), head?.block ?? 0]\n },\n }\n const mods = await resolvedNode.resolve('*')\n await Promise.all(mods.map((mod) => {\n return mod.start?.() ?? (() => true)\n }))\n const transferSummaryMap = assertEx(await getTransferSummaryMap(config), () => 'Transfer Summary Map not initialized')\n const app = await getApp(resolvedNode, transferSummaryMap, stakedChainContext, config.api.initRewardsCache)\n const server = app.listen(port, hostname, () => logger?.log(`[API] Server listening at http://${hostname}:${port}`))\n server.setTimeout(20_000)\n return server\n}\n","import {\n assertEx, hexFrom, isDefined, isHex,\n} from '@xylabs/sdk-js'\nimport type { Config } from '@xyo-network/xl1-protocol-sdk'\n\nexport const canUseChainId = (config: Config): boolean => {\n return isDefined(config.evm.chainId)\n}\n\nexport const getChainId = (config: Config) => {\n const chainId = assertEx(config.evm.chainId, () => 'Missing config.evm.chainId')\n if (isHex(chainId, { prefix: true })) {\n const hex = hexFrom(chainId)\n const parsed = Number.parseInt(hex, 16)\n return parsed\n } else {\n const parsed = Number.parseInt(chainId, 10)\n return parsed\n }\n}\n","import { assertEx, isDefined } from '@xylabs/sdk-js'\nimport type { Config } from '@xyo-network/xl1-protocol-sdk'\nimport type { Provider } from 'ethers'\nimport { InfuraWebSocketProvider } from 'ethers/providers'\n\nimport { canUseChainId, getChainId } from './initChainId.ts'\n\nlet instance: Promise<InfuraWebSocketProvider> | undefined\n\nexport const initInfuraProvider = (config: Config): Promise<Provider> => {\n if (instance) return instance\n const providerConfig = getInfuraProviderConfig(config)\n instance = Promise.resolve(new InfuraWebSocketProvider(providerConfig[0], providerConfig[1]))\n return instance\n}\n\nexport const canUseInfuraProvider = (config: Config): boolean => {\n return canUseChainId(config)\n && isDefined(config.evm?.infura?.projectId)\n && isDefined(config.evm?.infura?.projectSecret)\n}\n\nexport const getInfuraProviderConfig = (config: Config) => {\n const projectId = assertEx(config.evm?.infura?.projectId, () => 'Missing config.evm.infura.projectId')\n const projectSecret = assertEx(config.evm?.infura?.projectSecret, () => 'Missing config.evm.infura.projectSecret')\n return [getChainId(config), projectId, projectSecret] as const\n}\n","import { BaseMongoSdk, type BaseMongoSdkPrivateConfig } from '@xylabs/mongo'\nimport type { Hash, Logger } from '@xylabs/sdk-js'\nimport {\n asAddress, assertEx, isDefined,\n ZERO_ADDRESS,\n} from '@xylabs/sdk-js'\nimport { MemoryArchivist } from '@xyo-network/archivist-memory'\nimport { MongoDBArchivistV2 } from '@xyo-network/archivist-mongodb'\nimport { ViewArchivist } from '@xyo-network/archivist-view'\nimport {\n AddressBalanceDivinerV2, AddressTransferDiviner, ArchivistSyncDiviner, HeadValidationDiviner,\n} from '@xyo-network/chain-modules'\nimport { MongoMap } from '@xyo-network/chain-protocol'\nimport { initTelemetry } from '@xyo-network/chain-telemetry'\nimport { AbstractModule, LoggerModuleStatusReporter } from '@xyo-network/module-abstract'\nimport { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'\nimport type { MongoDBModuleParamsV2 } from '@xyo-network/module-model-mongodb'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport { MemorySentinel } from '@xyo-network/sentinel-memory'\nimport { StepSizes } from '@xyo-network/xl1-protocol'\nimport type {\n BalancesStepSummary, Config, MapType, TransfersStepSummary,\n} from '@xyo-network/xl1-protocol-sdk'\nimport { hasMongoConfig, MemoryMap } from '@xyo-network/xl1-protocol-sdk'\nimport { Semaphore } from 'async-mutex'\n\nexport interface GetLocatorContext {\n config: Config\n logger?: Logger\n}\n\nexport async function getTransferSummaryMap(config: Config): Promise<MapType<string, WithStorageMeta<TransfersStepSummary>>> {\n const mongoConfig = config.storage?.mongo\n if (hasMongoConfig(mongoConfig)) {\n // Create the MongoDB SDK from the configuration\n const {\n connectionString: dbConnectionString, database: dbName, domain: dbDomain, password: dbPassword, username: dbUserName,\n } = mongoConfig\n const payloadSdkConfig: BaseMongoSdkPrivateConfig = {\n dbConnectionString, dbDomain, dbName, dbPassword, dbUserName,\n }\n\n const sdkTransferSummaryMap = new BaseMongoSdk<WithStorageMeta<TransfersStepSummary>>({ ...payloadSdkConfig, collection: 'transfer_summary_map' })\n const result = await MongoMap.create<MongoMap<Hash, WithStorageMeta<TransfersStepSummary>>>({\n sdk: sdkTransferSummaryMap,\n getCache: { enabled: true, maxEntries: 5000 },\n })\n assertEx(await result.start(), () => 'Failed to start transfer summary map')\n return result\n } else {\n console.warn('[API] Mongo configuration not found. Using MemoryMap for TransferSummaryMap.')\n return new MemoryMap<string, WithStorageMeta<TransfersStepSummary>>()\n }\n}\n\n/**\n * Used for retrieving a locator with the necessary modules registered for testing\n * operation of the node (entirely in memory)\n * @returns A locator with the necessary modules registered\n */\nexport const getLocator = async (context: GetLocatorContext) => {\n const { config, logger } = context\n const { otlpEndpoint } = config.telemetry?.otel ?? {}\n const { traceProvider, meterProvider } = await initTelemetry({\n attributes: {\n serviceName: 'xl1-api',\n serviceVersion: '1.0.0',\n },\n otlpEndpoint,\n metricsConfig: {\n endpoint: '/metrics',\n port: 9465,\n },\n })\n\n if (isDefined(logger)) AbstractModule.defaultLogger = logger\n const statusReporter = logger ? new LoggerModuleStatusReporter(logger) : undefined\n\n const locator = new ModuleFactoryLocator()\n let balanceSummaryMap: MapType<string, WithStorageMeta<BalancesStepSummary>> | undefined\n let transferSummaryMap = await getTransferSummaryMap(config)\n // If there's a MongoDB configuration\n const mongoConfig = config.storage?.mongo\n if (hasMongoConfig(mongoConfig)) {\n // Create the MongoDB SDK from the configuration\n const {\n connectionString: dbConnectionString, database: dbName, domain: dbDomain, password: dbPassword, username: dbUserName,\n } = mongoConfig\n const payloadSdkConfig: BaseMongoSdkPrivateConfig = {\n dbConnectionString, dbDomain, dbName, dbPassword, dbUserName,\n }\n const params: Partial<MongoDBModuleParamsV2> = {\n meterProvider, payloadSdkConfig, statusReporter, traceProvider,\n }\n // Register the MongoDB Archivist as the default\n locator.register(MongoDBArchivistV2.factory(params), undefined, true)\n\n // Use a persistent MongoMap for the summary repository if MongoDB is configured\n const sdkBalanceSummaryMap = new BaseMongoSdk<WithStorageMeta<BalancesStepSummary>>({ ...payloadSdkConfig, collection: 'balance_summary_map' })\n balanceSummaryMap = await MongoMap.create<MongoMap<Hash, WithStorageMeta<BalancesStepSummary>>>({\n sdk: sdkBalanceSummaryMap,\n getCache: { enabled: true, maxEntries: 5000 },\n })\n }\n\n locator.register(AddressBalanceDivinerV2.factory<AddressBalanceDivinerV2>({\n traceProvider, meterProvider, statusReporter, summaryMap: balanceSummaryMap, stepSemaphores: StepSizes.map(() => new Semaphore(20)),\n }))\n\n locator.register(AddressTransferDiviner.factory<AddressTransferDiviner>({\n traceProvider, meterProvider, statusReporter, summaryMap: transferSummaryMap, stepSemaphores: StepSizes.map(() => new Semaphore(20)),\n }))\n\n const chainId = isDefined(config.chain.id)\n ? assertEx(asAddress(config.chain.id), () => 'chain.id must be an Address')\n : ZERO_ADDRESS\n locator.register(HeadValidationDiviner.factory<HeadValidationDiviner>({\n traceProvider,\n meterProvider,\n statusReporter,\n chainId,\n allowedProducers: config.producer.allowlist,\n }))\n locator.register(MemoryArchivist.factory({\n traceProvider, meterProvider, statusReporter,\n }))\n locator.register(MemorySentinel.factory({\n traceProvider, meterProvider, statusReporter,\n }))\n locator.register(ViewArchivist.factory({\n traceProvider, meterProvider, statusReporter,\n }))\n locator.register(ArchivistSyncDiviner.factory({\n traceProvider, meterProvider, statusReporter,\n }))\n return locator\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { ManifestWrapper } from '@xyo-network/manifest-wrapper'\nimport type { WalletInstance } from '@xyo-network/wallet-model'\nimport type { Config } from '@xyo-network/xl1-protocol-sdk'\n\nimport { getLocator } from './getLocator.ts'\nimport { NodeManifest } from './nodeManifest.ts'\nimport { PrivateChildManifests } from './private/index.ts'\nimport { PublicChildManifestsWithMempool, PublicChildManifestsWithoutMempool } from './public/index.ts'\n\nexport interface GetNodeContext {\n config: Config\n logger?: Logger\n wallet: WalletInstance\n}\n\n/**\n * Creates a node with the xyo-chain modules registered\n * @param context The context to use for the node\n * @returns A node with the xyo-chain modules registered\n */\nexport const getNode = async (context: GetNodeContext) => {\n const { wallet, config } = context\n const { enabled: mempoolEnabled } = config.mempool\n const PublicChildManifests = mempoolEnabled ? PublicChildManifestsWithoutMempool : PublicChildManifestsWithMempool\n const locator = await getLocator(context)\n const wrapper = new ManifestWrapper(NodeManifest, wallet, locator, PublicChildManifests, PrivateChildManifests)\n const [node, ...childNodes] = await wrapper.loadNodes()\n if (childNodes?.length > 0) {\n await Promise.all(childNodes.map(childNode => node.register(childNode)))\n await Promise.all(childNodes.map(childNode => node.attach(childNode.address, true)))\n }\n return node\n}\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"44'/60'/1\",\n \"name\": \"XYOChain\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": []\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","import type { PackageManifestPayload } from '@xyo-network/manifest-model'\n\nimport node from './node.json' with { type: 'json' }\n\n/**\n * Root Node Manifest\n */\nexport const NodeManifest = node as PackageManifestPayload\n","/**\n * Private Child Manifests\n */\nexport const PrivateChildManifests = []\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"1\",\n \"name\": \"Chain\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [\n {\n \"config\": {\n \"accountPath\": \"1/1'/1'\",\n \"name\": \"Validated\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_validated\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/2'\",\n \"schema\": \"network.xyo.diviner.chain.head.validation.config\",\n \"eventSubscriptions\": [\n {\n \"sourceEvent\": \"inserted\",\n \"sourceModule\": \"Submissions\",\n \"targetModuleFunction\": \"divine\"\n }\n ],\n \"inArchivist\": \"Submissions\",\n \"outArchivist\": \"Validated\",\n \"name\": \"HeadValidationDiviner\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/3'\",\n \"automations\": [\n {\n \"frequency\": 1000,\n \"frequencyUnits\": \"millis\",\n \"schema\": \"network.xyo.automation.interval\",\n \"type\": \"interval\"\n }\n ],\n \"name\": \"ChainValidationSentinel\",\n \"schema\": \"network.xyo.sentinel.config\",\n \"synchronous\": true,\n \"tasks\": [\n {\n \"mod\": \"HeadValidationDiviner\",\n \"endPoint\": \"divine\"\n }\n ]\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/4'\",\n \"automations\": [\n {\n \"frequency\": 10000,\n \"frequencyUnits\": \"millis\",\n \"schema\": \"network.xyo.automation.interval\",\n \"type\": \"interval\"\n }\n ],\n \"name\": \"AddressBalancePollingSentinel\",\n \"schema\": \"network.xyo.sentinel.config\",\n \"synchronous\": true,\n \"tasks\": [\n {\n \"mod\": \"AddressBalanceDiviner\",\n \"endPoint\": \"divine\"\n }\n ]\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1'/5'\",\n \"automations\": [\n {\n \"frequency\": 10000,\n \"frequencyUnits\": \"millis\",\n \"schema\": \"network.xyo.automation.interval\",\n \"type\": \"interval\"\n }\n ],\n \"name\": \"AddressTransferPollingSentinel\",\n \"schema\": \"network.xyo.sentinel.config\",\n \"synchronous\": true,\n \"tasks\": [\n {\n \"mod\": \"AddressTransferDiviner\",\n \"endPoint\": \"divine\"\n }\n ]\n }\n }\n ],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"1/1/1\",\n \"name\": \"Submissions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_submissions\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/2\",\n \"name\": \"Finalized\",\n \"allowedQueries\": [\n \"network.xyo.query.archivist.get\",\n \"network.xyo.query.archivist.next\"\n ],\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 50000\n },\n \"originArchivist\": \"Validated\",\n \"schema\": \"network.xyo.archivist.view.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/3'\",\n \"name\": \"AddressBalanceDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.balance.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_balance\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/4'\",\n \"name\": \"AddressTransferDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.transfer.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_transfer\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"2\",\n \"name\": \"Pending\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"2/1/1\",\n \"name\": \"PendingTransactions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"labels\": {\n \"network.xyo.storage.class\": \"mongodb\"\n },\n \"payloadSdkConfig\": {\n \"collection\": \"pending_bundles\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","import type { ModuleManifest, PackageManifestPayload } from '@xyo-network/manifest-model'\n\nimport Chain from './Chain.json' with { type: 'json' }\nimport Pending from './Pending.json' with { type: 'json' }\n\n/**\n * Chain Node Manifest\n */\nconst ChainNodeManifest = Chain as PackageManifestPayload\n/**\n * Pending Node Manifest\n */\nconst PendingNodeManifest = Pending as PackageManifestPayload\n/**\n * Public Child Manifests\n */\nexport const PublicChildManifestsWithMempool: ModuleManifest[] = [\n ...ChainNodeManifest.nodes,\n ...PendingNodeManifest.nodes,\n]\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"1\",\n \"name\": \"Chain\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [\n {\n \"config\": {\n \"accountPath\": \"1/1'/1'\",\n \"name\": \"Validated\",\n \"allowedQueries\": [\n \"network.xyo.query.archivist.get\",\n \"network.xyo.query.archivist.next\"\n ],\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_validated\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"1/1/1\",\n \"name\": \"Submissions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"payloadSdkConfig\": {\n \"collection\": \"chain_submissions\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/2\",\n \"name\": \"Finalized\",\n \"allowedQueries\": [\n \"network.xyo.query.archivist.get\",\n \"network.xyo.query.archivist.next\"\n ],\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 50000\n },\n \"originArchivist\": \"Validated\",\n \"schema\": \"network.xyo.archivist.view.config\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/3'\",\n \"name\": \"AddressBalanceDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.balance.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_balance\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n },\n {\n \"config\": {\n \"accountPath\": \"1/1/4'\",\n \"name\": \"AddressTransferDiviner\",\n \"schema\": \"network.xyo.diviner.chain.address.transfer.config\",\n \"map\": {\n \"lmdb\": {\n \"dbName\": \"summaries\",\n \"storeName\": \"address_transfer\",\n \"location\": \".store\"\n }\n },\n \"archivist\": \"Validated\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"2\",\n \"name\": \"Pending\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"2/1/1\",\n \"name\": \"PendingTransactions\",\n \"getCache\": {\n \"enabled\": true,\n \"maxEntries\": 5000\n },\n \"labels\": {\n \"network.xyo.storage.class\": \"mongodb\"\n },\n \"payloadSdkConfig\": {\n \"collection\": \"pending_bundles\"\n },\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}\n","import type { ModuleManifest, PackageManifestPayload } from '@xyo-network/manifest-model'\n\nimport Chain from './Chain.json' with { type: 'json' }\nimport Pending from './Pending.json' with { type: 'json' }\n\n/**\n * Chain Node Manifest\n */\n const ChainNodeManifest = Chain as PackageManifestPayload\n/**\n * Pending Node Manifest\n */\n const PendingNodeManifest = Pending as PackageManifestPayload\n/**\n * Public Child Manifests\n */\nexport const PublicChildManifestsWithoutMempool: ModuleManifest[] = [\n ...ChainNodeManifest.nodes,\n ...PendingNodeManifest.nodes,\n]\n"],"mappings":";;;;AAAA,SACEA,uBACAC,6BACAC,sCACAC,mBACAC,0BACAC,kBACAC,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,IAA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IAClBiB,MAAM,mCAAA;AACJ,YAAMA,OAAO,MAAMC,oBAAoBtB,cAAAA;AACvC,aAAO;QAAChC,UAASqD,MAAME,OAAO,MAAM,iCAAA;QAAoCF,MAAMR,SAAS;;IACzF,GAHM;EAIR;AACA,QAAMW,OAAO,MAAM1B,aAAaI,QAAQ,GAAA;AACxC,QAAMuB,QAAQC,IAAIF,KAAKG,IAAI,CAACC,QAAAA;AAC1B,WAAOA,IAAI7C,QAAK,MAAS,MAAM;EACjC,CAAA,CAAA;AACA,QAAM8C,qBAAqB7D,UAAS,MAAM8D,sBAAsB7E,MAAAA,GAAS,MAAM,sCAAA;AAC/E,QAAM8E,MAAM,MAAMC,OAAOlC,cAAc+B,oBAAoBX,oBAAoBjE,OAAOO,IAAIyE,gBAAgB;AAC1G,QAAMC,SAASH,IAAII,OAAO3C,MAAM1C,UAAU,MAAMI,QAAQa,IAAI,oCAAoCjB,QAAAA,IAAY0C,IAAAA,EAAM,CAAA;AAClH0C,SAAOE,WAAW,GAAA;AAClB,SAAOF;AACT,GAnDyB;","names":["customPoweredByHeader","disableCaseSensitiveRouting","disableExpressDefaultPoweredByHeader","getJsonBodyParser","getJsonBodyParserOptions","responseProfiler","standardErrors","standardResponses","compression","cors","express","registerInstrumentations","ExpressInstrumentation","HttpInstrumentation","addInstrumentation","instrumentations","HttpInstrumentation","ExpressInstrumentation","registerInstrumentations","StatusCodes","asyncHandler","asAddress","isDefined","isModuleName","StatusCodes","handler","req","res","next","address","moduleIdentifier","params","node","app","asAddress","isDefined","mod","resolve","direction","json","state","isModuleName","redirect","StatusCodes","MOVED_TEMPORARILY","getAddress","asyncHandler","asyncHandler","asAddress","assertEx","isAddress","toAddress","isQueryBoundWitness","ModuleErrorBuilder","StatusCodes","BoundWitnessSchema","ModuleConfigSchema","DEFAULT_DEPTH","getQueryConfig","mod","req","bw","payloads","nestedBwAddresses","flat","filter","payload","schema","BoundWitnessSchema","map","addresses","address","length","allowed","Object","fromEntries","queries","security","ModuleConfigSchema","handler","req","res","next","returnError","code","message","details","error","ModuleErrorBuilder","build","locals","rawResponse","status","json","address","params","node","app","bw","payloads","Array","isArray","body","isAddress","StatusCodes","BAD_REQUEST","isQueryBoundWitness","modules","normalizedAddress","toAddress","typedAddress","asAddress","byAddress","undefined","resolve","maxDepth","byName","direction","moduleAddress","assertEx","redirect","TEMPORARY_REDIRECT","NOT_FOUND","length","mod","queryConfig","getQueryConfig","queryResult","query","ex","INTERNAL_SERVER_ERROR","postAddress","asyncHandler","addNodeRoutes","app","defaultModule","node","address","defaultModuleEndpoint","get","_req","res","redirect","StatusCodes","MOVED_TEMPORARILY","post","TEMPORARY_REDIRECT","getAddress","postAddress","sendStatus","NOT_FOUND","setRawResponseFormat","asHash","isDefined","asArchivistInstance","PayloadBuilder","isAnyPayload","isSequence","express","resolveArchivist","node","archivistModuleIdentifier","mod","resolve","asArchivistInstance","required","archivistInstance","getArchivist","isDefined","archivistMiddleware","options","router","express","Router","mergeParams","post","req","res","setRawResponseFormat","body","Array","isArray","payloads","PayloadBuilder","hashPairs","map","p","archivist","result","insert","status","json","get","cursor","isSequence","query","undefined","limit","Number","open","Boolean","order","next","hash","rawHash","params","asHash","payload","isAnyPayload","send","addDataLakeRoutes","app","node","archivistModuleIdentifier","use","archivistMiddleware","setRawResponseFormat","assertEx","NodeXyoViewer","SimpleNetworkStakeViewer","SimpleStepRewardsByPositionViewer","StepSizes","RewardMultipliers","NodeXyoRunner","rpcEngineFromConnection","XyoBaseConnection","Semaphore","addRpcRoutes","app","transferSummaryMap","stakedChainContext","initRewardsCache","node","runner","NodeXyoRunner","networkStakeViewer","SimpleNetworkStakeViewer","create","context","console","log","assertEx","start","viewer","NodeXyoViewer","rewardMultipliers","RewardMultipliers","transfersSummaryContext","stepSemaphores","StepSizes","map","Semaphore","summaryMap","stepRewardsByPositionViewer","SimpleStepRewardsByPositionViewer","connection","XyoBaseConnection","engine","rpcEngineFromConnection","post","req","res","setRawResponseFormat","handle","body","_","rpcResponse","json","addRoutes","app","transferSummaryMap","stakedChainContext","initRewardsCache","addRpcRoutes","addDataLakeRoutes","addNodeRoutes","getApp","node","transferSummaryMap","stakedChainContext","initRewardsCache","addInstrumentation","app","express","set","use","cors","compression","responseProfiler","getJsonBodyParser","getJsonBodyParserOptions","limit","standardResponses","disableExpressDefaultPoweredByHeader","customPoweredByHeader","disableCaseSensitiveRouting","addRoutes","standardErrors","assertEx","isDefined","isString","toEthAddress","Account","asArchivistInstance","boot","EthereumChainStakeEvents","EthereumChainStakeViewer","createGenesisBlock","findMostRecentBlock","StakedXyoChainV2__factory","HDWallet","readPayloadMapFromStore","SimpleChainStakeViewer","assertEx","hexFrom","isDefined","isHex","canUseChainId","config","isDefined","evm","chainId","getChainId","assertEx","isHex","prefix","hex","hexFrom","parsed","Number","parseInt","assertEx","isDefined","InfuraWebSocketProvider","instance","initInfuraProvider","config","providerConfig","getInfuraProviderConfig","Promise","resolve","InfuraWebSocketProvider","canUseInfuraProvider","canUseChainId","isDefined","evm","infura","projectId","projectSecret","assertEx","getChainId","BaseMongoSdk","asAddress","assertEx","isDefined","ZERO_ADDRESS","MemoryArchivist","MongoDBArchivistV2","ViewArchivist","AddressBalanceDivinerV2","AddressTransferDiviner","ArchivistSyncDiviner","HeadValidationDiviner","MongoMap","initTelemetry","AbstractModule","LoggerModuleStatusReporter","ModuleFactoryLocator","MemorySentinel","StepSizes","hasMongoConfig","MemoryMap","Semaphore","getTransferSummaryMap","config","mongoConfig","storage","mongo","hasMongoConfig","connectionString","dbConnectionString","database","dbName","domain","dbDomain","password","dbPassword","username","dbUserName","payloadSdkConfig","sdkTransferSummaryMap","BaseMongoSdk","collection","result","MongoMap","create","sdk","getCache","enabled","maxEntries","assertEx","start","console","warn","MemoryMap","getLocator","context","logger","otlpEndpoint","telemetry","otel","traceProvider","meterProvider","initTelemetry","attributes","serviceName","serviceVersion","metricsConfig","endpoint","port","isDefined","AbstractModule","defaultLogger","statusReporter","LoggerModuleStatusReporter","undefined","locator","ModuleFactoryLocator","balanceSummaryMap","transferSummaryMap","params","register","MongoDBArchivistV2","factory","sdkBalanceSummaryMap","AddressBalanceDivinerV2","summaryMap","stepSemaphores","StepSizes","map","Semaphore","AddressTransferDiviner","chainId","chain","id","asAddress","ZERO_ADDRESS","HeadValidationDiviner","allowedProducers","producer","allowlist","MemoryArchivist","MemorySentinel","ViewArchivist","ArchivistSyncDiviner","ManifestWrapper","NodeManifest","node","PrivateChildManifests","ChainNodeManifest","Chain","PendingNodeManifest","Pending","PublicChildManifestsWithMempool","nodes","Chain_default","Pending_default","ChainNodeManifest","Chain","PendingNodeManifest","Pending","PublicChildManifestsWithoutMempool","nodes","getNode","context","wallet","config","enabled","mempoolEnabled","mempool","PublicChildManifests","PublicChildManifestsWithoutMempool","PublicChildManifestsWithMempool","locator","getLocator","wrapper","ManifestWrapper","NodeManifest","PrivateChildManifests","node","childNodes","loadNodes","length","Promise","all","map","childNode","register","attach","address","hostname","getSeedPhrase","bios","config","logger","storedSeedPhrase","seedPhraseStore","get","debug","mnemonic","api","isString","warn","set","seedPhrase","HDWallet","generateMnemonic","log","assertEx","getStakeChainViewer","canUseInfuraProvider","provider","initInfuraProvider","contractAddress","chain","id","contract","StakedXyoChainV2__factory","connect","toEthAddress","stakeEventsViewer","EthereumChainStakeEvents","create","start","stakeChainViewer","EthereumChainStakeViewer","console","SimpleChainStakeViewer","positions","getServer","context","node","port","boot","isDefined","wallet","fromPhrase","nodeContext","resolvedNode","getNode","chainArchivist","asArchivistInstance","resolve","required","chainMap","readPayloadMapFromStore","payloads","next","length","initialProducer","Account","random","chainId","block","createGenesisBlock","address","insert","flat","stakedChainContext","stake","store","head","findMostRecentBlock","_hash","mods","Promise","all","map","mod","transferSummaryMap","getTransferSummaryMap","app","getApp","initRewardsCache","server","listen","setTimeout"]}
@@ -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;AAUlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAK3D,OAAO,KAAK,EACV,MAAM,EACP,MAAM,+BAA+B,CAAA;AAgCtC,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,YAAY,CAAA;CACpB;AAsBD,eAAO,MAAM,SAAS,GAAU,SAAS,gBAAgB,gHAmDxD,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.20",
4
4
  "description": "XYO Layer One API",
5
5
  "homepage": "https://xylabs.com",
6
6
  "bugs": {
@@ -55,18 +55,19 @@
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/account": "~5.1.23",
58
59
  "@xyo-network/archivist-memory": "~5.1.23",
59
60
  "@xyo-network/archivist-model": "~5.1.23",
60
61
  "@xyo-network/archivist-mongodb": "~5.1.23",
61
62
  "@xyo-network/archivist-view": "~5.1.23",
62
63
  "@xyo-network/bios": "~7.1.1",
63
64
  "@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",
65
+ "@xyo-network/chain-ethereum": "~1.16.20",
66
+ "@xyo-network/chain-modules": "~1.16.20",
67
+ "@xyo-network/chain-protocol": "~1.16.20",
68
+ "@xyo-network/chain-rpc": "~1.16.20",
69
+ "@xyo-network/chain-telemetry": "~1.16.20",
70
+ "@xyo-network/chain-viewers": "~1.16.20",
70
71
  "@xyo-network/manifest-model": "~5.1.23",
71
72
  "@xyo-network/manifest-wrapper": "~5.1.23",
72
73
  "@xyo-network/module-abstract": "~5.1.23",
@@ -80,8 +81,8 @@
80
81
  "@xyo-network/wallet": "~5.1.23",
81
82
  "@xyo-network/wallet-model": "~5.1.23",
82
83
  "@xyo-network/xl1-protocol": "~1.13.11",
83
- "@xyo-network/xl1-protocol-sdk": "~1.16.19",
84
- "@xyo-network/xl1-rpc": "~1.16.19",
84
+ "@xyo-network/xl1-protocol-sdk": "~1.16.20",
85
+ "@xyo-network/xl1-rpc": "~1.16.20",
85
86
  "async-mutex": "~0.5.0",
86
87
  "compression": "~1.8.1",
87
88
  "cors": "~2.8.5",
@@ -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
 
@@ -2,20 +2,23 @@ import type { Hash, Logger } from '@xylabs/sdk-js'
2
2
  import {
3
3
  assertEx, isDefined, isString, toEthAddress,
4
4
  } from '@xylabs/sdk-js'
5
+ import { Account } from '@xyo-network/account'
5
6
  import { asArchivistInstance } from '@xyo-network/archivist-model'
6
7
  import { boot } from '@xyo-network/bios'
7
8
  import type { BiosExternalInterface } from '@xyo-network/bios-model'
8
9
  import { EthereumChainStakeEvents, EthereumChainStakeViewer } from '@xyo-network/chain-ethereum'
9
- import { findMostRecentBlock } from '@xyo-network/chain-protocol'
10
+ import { createGenesisBlock, findMostRecentBlock } from '@xyo-network/chain-protocol'
10
11
  import type { NodeInstance } from '@xyo-network/node-model'
11
12
  import type { Payload, WithStorageMeta } from '@xyo-network/payload-model'
12
13
  import { StakedXyoChainV2__factory } from '@xyo-network/typechain'
13
14
  import { HDWallet } from '@xyo-network/wallet'
14
15
  import type { ChainId } from '@xyo-network/xl1-protocol'
15
- import type { Config, StakedChainContextRead } from '@xyo-network/xl1-protocol-sdk'
16
- import { readPayloadMapFromStore } from '@xyo-network/xl1-protocol-sdk'
16
+ import type {
17
+ Config, StakedChainContextRead, StakeViewer,
18
+ } from '@xyo-network/xl1-protocol-sdk'
19
+ import { readPayloadMapFromStore, SimpleChainStakeViewer } from '@xyo-network/xl1-protocol-sdk'
17
20
 
18
- import { initInfuraProvider } from '../helpers/index.ts'
21
+ import { canUseInfuraProvider, initInfuraProvider } from '../helpers/index.ts'
19
22
  import { getNode, getTransferSummaryMap } from '../manifest/index.ts'
20
23
  import { getApp } from './app.ts'
21
24
 
@@ -50,6 +53,26 @@ interface GetServerContext {
50
53
  node?: NodeInstance
51
54
  }
52
55
 
56
+ async function getStakeChainViewer(config: Config, logger?: Logger): Promise<StakeViewer> {
57
+ if (canUseInfuraProvider(config)) {
58
+ const provider = await initInfuraProvider(config)
59
+ const contractAddress = assertEx(config.chain.id, () => 'Missing config.evm.chainId') as ChainId
60
+ const contract = StakedXyoChainV2__factory.connect(toEthAddress(contractAddress), provider)
61
+ const stakeEventsViewer = await EthereumChainStakeEvents.create({ contract, logger })
62
+ assertEx(await stakeEventsViewer.start(), () => 'Failed to start EthereumChainStakeEvents reader')
63
+ const stakeChainViewer = await EthereumChainStakeViewer.create({
64
+ contract, stakeEventsViewer, logger,
65
+ })
66
+ assertEx(await stakeChainViewer.start(), () => 'Failed to start EthereumChainStake viewer')
67
+ return stakeChainViewer
68
+ } else {
69
+ console.warn('[API] Infura configuration not found. Using SimpleChainStakeViewer with no positions. This means no staking data will be available.')
70
+ const stakeChainViewer = await SimpleChainStakeViewer.create({ logger, positions: [] })
71
+ assertEx(await stakeChainViewer.start(), () => 'Failed to start SimpleChainStake viewer')
72
+ return stakeChainViewer
73
+ }
74
+ }
75
+
53
76
  export const getServer = async (context: GetServerContext) => {
54
77
  const {
55
78
  config, logger, node,
@@ -58,18 +81,13 @@ export const getServer = async (context: GetServerContext) => {
58
81
  const bios = await boot()
59
82
  const seedPhrase = isDefined(mnemonic) ? mnemonic : await getSeedPhrase(bios, config, logger)
60
83
  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)
84
+
85
+ const stakeChainViewer = await getStakeChainViewer(config, logger)
86
+
64
87
  const nodeContext = {
65
88
  wallet, logger, config,
66
89
  }
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')
90
+
73
91
  const resolvedNode: NodeInstance = node ?? await getNode(nodeContext)
74
92
  const chainArchivist = assertEx(asArchivistInstance(
75
93
  await resolvedNode.resolve('Chain:Validated'),
@@ -77,14 +95,24 @@ export const getServer = async (context: GetServerContext) => {
77
95
  ), () => 'FinalizedArchivist not found in node')
78
96
  const chainMap = readPayloadMapFromStore<WithStorageMeta<Payload>>(chainArchivist)
79
97
 
98
+ const payloads = await chainArchivist.next()
99
+
100
+ if (payloads.length === 0) {
101
+ logger?.warn('[API] No blocks found in chain archivist, creating genesis block')
102
+ const initialProducer = await Account.random()
103
+ const chainId = stakeChainViewer.chainId
104
+ const block = await createGenesisBlock(initialProducer, chainId, 1_000_000n, initialProducer.address)
105
+ await chainArchivist.insert([...block[1].flat(), block[0]])
106
+ console.log('[API] Genesis block created and inserted into chain archivist')
107
+ }
108
+
80
109
  const stakedChainContext: StakedChainContextRead = {
81
- chainId: contractAddress,
82
- events: stakeEventsViewer,
110
+ chainId: stakeChainViewer.chainId,
83
111
  stake: stakeChainViewer,
84
112
  store: { chainMap },
85
113
  head: async (): Promise<[Hash, number]> => {
86
114
  const head = await findMostRecentBlock(chainArchivist)
87
- return [assertEx(head?._hash, () => 'No head found in chainArchivist'), assertEx(head?.block, () => 'No head found in chainArchivist')]
115
+ return [assertEx(head?._hash, () => 'No head found in chainArchivist'), head?.block ?? 0]
88
116
  },
89
117
  }
90
118
  const mods = await resolvedNode.resolve('*')