@xyo-network/xl1-protocol-sdk 1.26.43 → 1.26.44

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/getFileConfig.ts","../../src/config/Actor.ts","../../src/config/Base.ts","../../src/config/Chain.ts","../../src/config/DataLake/DataLake.ts","../../src/config/DataLake/RestDataLakeConfig.ts","../../src/config/DataLake/DataLakeRemoteConfig.ts","../../src/config/DataLake/RouterDataLakeConfig.ts","../../src/config/Evm.ts","../../src/config/Log.ts","../../src/config/Providers.ts","../../src/config/Provider.ts","../../src/config/Remote.ts","../../src/config/storage/driver/Mongo.ts","../../src/config/storage/Storage.ts","../../src/config/Telemetry.ts","../../src/config/Validation.ts","../../src/primitives/uncle/findBestUncle.ts","../../src/config/Actors.ts","../../src/config/Config.ts"],"sourcesContent":["import { isDefined, isNull } from '@xylabs/sdk-js'\nimport { cosmiconfig } from 'cosmiconfig'\n\nimport { ConfigZod } from './config/index.ts'\n\n/**\n * The name of the configuration file to search for.\n */\nconst configName = 'xyo'\n\n/**\n * The name of the section within the configuration file to parse.\n */\nconst configSection = 'xl1' // Default section in the config file\n\n/**\n * Attempts to parse the configuration from a file using cosmiconfig.\n * @returns The parsed configuration object if found and valid, otherwise undefined.\n */\nexport async function getFileConfig(searchPlaces?: string[]) {\n const explorer = cosmiconfig(\n configName,\n {\n cache: true,\n searchPlaces,\n },\n )\n const result: unknown = (await explorer.search())?.config\n if (!isNull(result)) {\n const section = (result as Record<string, unknown>)[configSection]\n if (isDefined(section) && typeof section === 'object') {\n return ConfigZod.loose().parse(section)\n }\n }\n return ConfigZod.parse({})\n}\n","import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport { globalRegistry, z } from 'zod'\n\nimport { BaseConfigZod } from './Base.ts'\n\n/**\n * BIP-32 derivation path for an actor wallet.\n *\n * - Absolute form: starts with `m/` (e.g. `m/44'/60'/0'/0/0`). The full path is used as-is,\n * giving the caller complete control over coin type, account, and hardening.\n * - Relative form: a segment list without the `m/` prefix (e.g. `0`, `0/1`, `44'/60'/0'/0/0`).\n * The consumer appends this to its configured root base path.\n *\n * Each segment is a non-negative integer, optionally suffixed with `'` to mark it as hardened.\n */\nexport const AccountPathZod = z.string().regex(\n /^(m(\\/\\d+'?)+|\\d+'?(\\/\\d+'?)*)$/,\n 'Invalid BIP-32 derivation path. Use either an absolute path like \"m/44\\'/60\\'/0\\'/0/0\" or a relative path like \"0\", \"0/1\", or \"44\\'/60\\'/0\\'/0/0\".',\n)\n\n/** ActorConfigZod constant. */\nexport const ActorConfigZod = BaseConfigZod.extend({\n name: z.string(),\n accountPath: AccountPathZod.optional().register(globalRegistry, {\n description: 'BIP-32 derivation path for the actor wallet. Absolute when it starts with \"m/\"; otherwise relative to the root wallet base path. Each actor must derive to a distinct path.',\n title: 'accountPath',\n type: 'string',\n }),\n healthCheckPort: z.coerce.number().optional().register(globalRegistry, {\n description: 'Port for the Producer health checks',\n title: 'producer.healthCheckPort',\n type: 'number',\n }),\n})\n\n/** ActorConfig type. */\nexport type ActorConfig = z.infer<typeof ActorConfigZod>\n\n/** Type guard that checks if a value is a valid ActorConfig. */\nexport const isActorConfig = zodIsFactory(ActorConfigZod)\n/** Converts a value to ActorConfig, throwing if invalid. */\nexport const asActorConfig = zodAsFactory(ActorConfigZod, 'asActorConfig')\n/** toActorConfig constant. */\nexport const toActorConfig = zodToFactory(ActorConfigZod, 'toActorConfig')\n","import { z } from 'zod'\n\nimport { ChainConfigZod } from './Chain.ts'\nimport { DataLakeConfigZod } from './DataLake/index.ts'\nimport { EvmConfigZod } from './Evm.ts'\nimport { LogConfigZod } from './Log.ts'\nimport { ProvidersConfigZod } from './Providers.ts'\nimport { RemoteConfigZod } from './Remote.ts'\nimport { StorageConfigZod } from './storage/index.ts'\nimport { TelemetryConfigZod } from './Telemetry.ts'\nimport { ValidationConfigZod } from './Validation.ts'\n\n/** BaseConfigZod constant. */\nexport const BaseConfigZod = z.object({\n chain: ChainConfigZod.default(ChainConfigZod.parse({})).describe('Configuration for the chain'),\n dataLake: DataLakeConfigZod.optional().describe('Configuration for data lakes'),\n evm: EvmConfigZod.default(EvmConfigZod.parse({})).describe('Configuration for EVM-backed services'),\n log: LogConfigZod.default(LogConfigZod.parse({})).describe('Configuration for logging'),\n providers: ProvidersConfigZod.default(ProvidersConfigZod.parse([])).describe('Configuration for providers'),\n remote: RemoteConfigZod.default(RemoteConfigZod.parse({})).describe('Configuration for remote services'),\n storage: StorageConfigZod.default(StorageConfigZod.parse({})).describe('Configuration for the storage'),\n telemetry: TelemetryConfigZod.default(TelemetryConfigZod.parse({})).describe('Configuration for telemetry'),\n validation: ValidationConfigZod.default(ValidationConfigZod.parse({})).describe('Configuration for validation'),\n})\n\n/** BaseConfig type. */\nexport type BaseConfig = z.infer<typeof BaseConfigZod>\n","import { AddressZod, HexZod } from '@xylabs/sdk-js'\nimport { globalRegistry, z } from 'zod'\n\n/** ChainConfigZod constant. */\nexport const ChainConfigZod = z.object({\n id: HexZod.optional()\n .register(globalRegistry, {\n description:\n 'The unique identifier for the chain. Should be the staking contract address for contract-backed chains.',\n title: 'chain.id',\n type: 'string',\n }),\n genesisRewardAddress: AddressZod.optional()\n .register(globalRegistry, {\n description:\n 'Address to send the initial genesis rewards to, if a new chain is being created.',\n title: 'chain.genesisRewardAddress',\n type: 'Address',\n }),\n})\n\n/** ChainConfig type. */\nexport type ChainConfig = z.infer<typeof ChainConfigZod>\n","import { z } from 'zod'\n\nimport { type RestDataLakeConfig, RestDataLakeConfigZod } from './RestDataLakeConfig.ts'\n// eslint-disable-next-line import-x/no-cycle -- intentional cycle for z.lazy recursive type\nimport { type RouterDataLakeConfig, RouterDataLakeConfigZod } from './RouterDataLakeConfig.ts'\n\n/** DataLakeConfig type. */\nexport type DataLakeConfig = RestDataLakeConfig | RouterDataLakeConfig\n\n// z.lazy handles the circular reference between DataLakeConfigZod and RouterDataLakeZod\n/** DataLakeConfigZod constant. */\nexport const DataLakeConfigZod: z.ZodType<DataLakeConfig> = z.lazy(() =>\n z.union([RestDataLakeConfigZod, RouterDataLakeConfigZod])).describe('Configuration for a data lake')\n","import { globalRegistry, z } from 'zod'\n\nimport { DataLakeDriverConfigBaseZod } from './DataLakeRemoteConfig.ts'\n\n/** RestDataLakeConfigZod constant. */\nexport const RestDataLakeConfigZod = DataLakeDriverConfigBaseZod.extend({\n driver: z.literal('rest').register(globalRegistry, {\n description: 'Driver for the REST data lake',\n type: 'string',\n }),\n url: z.string().register(globalRegistry, {\n description: 'URL for the REST data lake',\n type: 'string',\n }),\n}).describe('Configuration for the REST data lake driver')\n\n/** RestDataLakeConfig type. */\nexport type RestDataLakeConfig = z.infer<typeof RestDataLakeConfigZod>\n","import { globalRegistry, z } from 'zod'\n\n/** DataLakeDriverConfigBaseZod constant. */\nexport const DataLakeDriverConfigBaseZod = z.object({\n driver: z.string().register(globalRegistry, {\n description: 'Driver for the data lake',\n type: 'string',\n }),\n}).describe('Base configuration for a data lake driver')\n/** DataLakeDriverConfigBase type. */\nexport type DataLakeDriverConfigBase = z.infer<typeof DataLakeDriverConfigBaseZod>\n","import { globalRegistry, z } from 'zod'\n\nimport type { DataLakeConfig } from './DataLake.ts'\n// eslint-disable-next-line import-x/no-cycle -- intentional cycle for z.lazy recursive type\nimport { DataLakeConfigZod } from './DataLake.ts'\n\n/** Configuration for RouterDataLake. */\nexport interface RouterDataLakeConfig {\n children: DataLakeConfig[]\n driver: 'router'\n}\n\n/** RouterDataLakeConfigZod constant. */\nexport const RouterDataLakeConfigZod: z.ZodType<RouterDataLakeConfig> = z.object({\n driver: z.literal('router').register(globalRegistry, {\n description: 'Driver for the router data lake',\n type: 'string',\n }),\n children: z.array(z.lazy(() => DataLakeConfigZod)).register(globalRegistry, {\n description: 'Child data lake drivers',\n type: 'array',\n }),\n}).describe('Configuration for the router data lake driver')\n","import { globalRegistry, z } from 'zod'\n\n/** EvmInfuraConfigZod constant. */\nexport const EvmInfuraConfigZod = z.object({\n projectId: z.string().optional().register(globalRegistry, {\n description: 'Infura project ID',\n title: 'evm.infura.projectId',\n type: 'string',\n }),\n projectSecret: z.string().optional().register(globalRegistry, {\n description: 'Infura project secret',\n title: 'evm.infura.projectSecret',\n type: 'string',\n }),\n})\n\n/** EvmJsonRpcConfigZod constant. */\nexport const EvmJsonRpcConfigZod = z.object({\n url: z.url().optional().register(globalRegistry, {\n description: 'JSON-RPC URL',\n title: 'evm.jsonRpc.url',\n type: 'string',\n }),\n})\n\n/** EvmConfigZod constant. */\nexport const EvmConfigZod = z.object({\n chainId: z.string().optional().register(globalRegistry, {\n description: 'EVM chain ID',\n title: 'evm.chainId',\n type: 'string',\n }),\n infura: EvmInfuraConfigZod.optional().describe('Infura Provider configuration'),\n jsonRpc: EvmJsonRpcConfigZod.optional().describe('JSON-RPC Provider configuration'),\n})\n\n/** EvmConfig type. */\nexport type EvmConfig = z.infer<typeof EvmConfigZod>\n","import type { LogLevelKey } from '@xylabs/sdk-js'\nimport { LogLevel } from '@xylabs/sdk-js'\nimport { globalRegistry, z } from 'zod'\n\nconst LogLevelNames = Object.keys(LogLevel) as [LogLevelKey]\n\n/** LogConfigZod constant. */\nexport const LogConfigZod = z.object({\n logLevel: z.enum(LogLevelNames).default('info').register(globalRegistry, {\n choices: LogLevelNames,\n default: 'info',\n description: 'Desired process verbosity',\n title: 'logLevel',\n type: 'string',\n }),\n silent: z.boolean().default(false).register(globalRegistry, {\n default: false,\n description: 'Whether to run in silent mode',\n title: 'silent',\n type: 'boolean',\n }),\n})\n\n/** LogConfig type. */\nexport type LogConfig = z.infer<typeof LogConfigZod>\n","import z from 'zod'\n\nimport { ProviderConfigZod } from './Provider.ts'\n\n/** ProvidersConfigZod constant. */\nexport const ProvidersConfigZod = z.array(ProviderConfigZod.loose()).describe('Configuration for providers').default([])\n\n/** ProvidersConfig type. */\nexport type ProvidersConfig = z.infer<typeof ProvidersConfigZod>\n","import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport { z } from 'zod'\n\n/** ProviderConfigZod constant. */\nexport const ProviderConfigZod = z.object({\n moniker: z.string(),\n labels: z.array(z.string()).optional(),\n}).describe('Configuration for a Provider')\n\n/** ProviderConfig type. */\nexport type ProviderConfig = z.infer<typeof ProviderConfigZod>\n\n/** Type guard that checks if a value is a valid ProviderConfig. */\nexport const isProviderConfig = zodIsFactory(ProviderConfigZod)\n/** Converts a value to ProviderConfig, throwing if invalid. */\nexport const asProviderConfig = zodAsFactory(ProviderConfigZod, 'asProviderConfig')\n/** toProviderConfig constant. */\nexport const toProviderConfig = zodToFactory(ProviderConfigZod, 'toProviderConfig')\n","import { globalRegistry, z } from 'zod'\n\n/** RpcRemoteConfigBaseZod constant. */\nexport const RpcRemoteConfigBaseZod = z.object({\n protocol: z.string('http').register(globalRegistry, {\n description: 'Protocol for the RPC connection',\n type: 'string',\n }),\n}).describe('Base configuration for the remote RPC')\n\n/** RpcRemoteConfigBase type. */\nexport type RpcRemoteConfigBase = z.infer<typeof RpcRemoteConfigBaseZod>\n\n/** HttpRpcRemoteConfigZod constant. */\nexport const HttpRpcRemoteConfigZod = RpcRemoteConfigBaseZod.extend({\n protocol: z.string('http').register(globalRegistry, {\n description: 'Protocol for the RPC connection',\n type: 'string',\n }).default('http'),\n url: z.string().register(globalRegistry, {\n description: 'URL for the Chain RPC API',\n type: 'string',\n }),\n}).describe('Configuration for the remote RPC using Http')\n\n/** HttpRpcRemoteConfig type. */\nexport type HttpRpcRemoteConfig = z.infer<typeof HttpRpcRemoteConfigZod>\n\n/** PostMessageRpcRemoteConfigZod constant. */\nexport const PostMessageRpcRemoteConfigZod = RpcRemoteConfigBaseZod.extend({\n protocol: z.string().register(globalRegistry, {\n description: 'Protocol for the RPC connection',\n type: 'string',\n }).default('postMessage'),\n networkId: z.string().register(globalRegistry, {\n description: 'Network ID to use for the postMessage RPC connection',\n type: 'string',\n }),\n sessionId: z.string().register(globalRegistry, {\n description: 'Session ID to use for the postMessage RPC connection',\n type: 'string',\n }),\n}).describe('Configuration for the remote RPC using postMessage')\n\n/** PostMessageRpcRemoteConfig type. */\nexport type PostMessageRpcRemoteConfig = z.infer<typeof PostMessageRpcRemoteConfigZod>\n\n/** RpcRemoteConfigZod constant. */\nexport const RpcRemoteConfigZod = z.union([HttpRpcRemoteConfigZod, PostMessageRpcRemoteConfigZod])\n .describe('Configuration for a remote RPC connection, either Http or postMessage')\n\n/** RpcRemoteConfig type. */\nexport type RpcRemoteConfig = z.infer<typeof RpcRemoteConfigZod>\n\n/** RemoteConfigZod constant. */\nexport const RemoteConfigZod = z.object({ rpc: RpcRemoteConfigZod.optional() }).describe('Configuration for remote connections, including RPC')\n\n/** RemoteConfig type. */\nexport type RemoteConfig = z.infer<typeof RemoteConfigZod>\n","import { isDefined, isUndefined } from '@xylabs/sdk-js'\nimport { globalRegistry, z } from 'zod'\n\n/**\n * Checks if the provided MongoDB configuration contains all necessary fields\n * for establishing a connection.\n * @param config MongoDB configuration object\n * @returns True if the configuration contains all necessary fields for\n * establishing a connection\n */\nexport const hasMongoConfig = (config?: MongoConfig): config is Required<MongoConfig> => {\n if (isUndefined(config)) return false\n return (\n isDefined(config.connectionString)\n && isDefined(config.database)\n && isDefined(config.domain)\n && isDefined(config.password)\n && isDefined(config.username)\n )\n}\n\n/** MongoConfigZod constant. */\nexport const MongoConfigZod = z.object({\n // TODO: Create from other arguments\n connectionString: z.string().nonempty().optional().register(globalRegistry, {\n description: 'MongoDB connection string',\n title: 'storage.mongo.connectionString',\n type: 'string',\n }),\n database: z.string().nonempty().optional().register(globalRegistry, {\n description: 'MongoDB database name',\n title: 'storage.mongo.database',\n type: 'string',\n }),\n domain: z.string().nonempty().optional().register(globalRegistry, {\n description: 'MongoDB domain',\n title: 'storage.mongo.domain',\n type: 'string',\n }),\n password: z.string().nonempty().optional().register(globalRegistry, {\n description: 'MongoDB password',\n title: 'storage.mongo.password',\n type: 'string',\n }),\n username: z.string().nonempty().optional().register(globalRegistry, {\n description: 'MongoDB username',\n title: 'storage.mongo.username',\n type: 'string',\n }),\n})\n\n/** MongoConfig type. */\nexport type MongoConfig = z.infer<typeof MongoConfigZod>\n","import { globalRegistry, z } from 'zod'\n\nimport { MongoConfigZod } from './driver/index.ts'\n\n/** StorageConfigZod constant. */\nexport const StorageConfigZod = z.object({\n mongo: MongoConfigZod.optional().describe('Configuration for the MongoD storage driver'),\n root: z.string().optional().register(globalRegistry, {\n description: 'Root directory for local storage',\n title: 'storage.root',\n type: 'string',\n }),\n}).describe('Storage configuration options')\n\n/** StorageConfig type. */\nexport type StorageConfig = z.infer<typeof StorageConfigZod>\n","import { globalRegistry, z } from 'zod'\n\n/** DefaultMetricsScrapePorts constant. */\nexport const DefaultMetricsScrapePorts = {\n api: 9465,\n bridge: 9468,\n mempool: 9466,\n producer: 9464,\n rewardRedemptionApi: 9467,\n}\n\n/** MetricsScrapeConfigZod constant. */\nexport const MetricsScrapeConfigZod = z.object({\n path: z.string().default('/metrics').register(globalRegistry, {\n default: '/metrics',\n description: 'Path for the metrics scrape endpoint',\n title: 'telemetry.metrics.scrape.path',\n type: 'string',\n }),\n port: z.coerce.number().int().positive().optional().register(globalRegistry, {\n description: 'Port for the metrics scrape endpoint',\n title: 'telemetry.metrics.scrape.port',\n type: 'number',\n }),\n}).describe('Metrics scrape configuration')\n\n/** MetricsConfigZod constant. */\nexport const MetricsConfigZod = z.object({ scrape: MetricsScrapeConfigZod }).describe('Metrics configuration options')\n\n/** OpenTelemetryConfigZod constant. */\nexport const OpenTelemetryConfigZod = z.object({\n // OpenTelemetry options\n otlpEndpoint: z.url().optional().register(globalRegistry, {\n description: 'OTLP endpoint for exporting telemetry data',\n title: 'telemetry.otel.otlpEndpoint',\n type: 'string',\n }),\n})\n\n/** TelemetryConfigZod constant. */\nexport const TelemetryConfigZod = z.object({\n // Metrics configuration\n metrics: MetricsConfigZod.optional().describe('Metrics configuration'),\n // OpenTelemetry configuration\n otel: OpenTelemetryConfigZod.optional().describe('OpenTelemetry configuration'),\n}).describe('Telemetry configuration options')\n\n/** TelemetryConfig type. */\nexport type TelemetryConfig = z.infer<typeof TelemetryConfigZod>\n","import { AddressZod, asAddress } from '@xylabs/sdk-js'\nimport { globalRegistry, z } from 'zod'\n\nimport { DEFAULT_BACKOFF_MS, DEFAULT_MIN_CANDIDATES } from '../primitives/index.ts'\n\n/** ValidationConfigZod constant. */\nexport const ValidationConfigZod = z.object({\n allowedRewardRedeemers: z.array(AddressZod).optional().register(globalRegistry, {\n description: 'List of allowed reward redeemer addresses, if undefined anyone can participate',\n title: 'allowedRewardRedeemers',\n type: 'array',\n }),\n allowedRewardEscrowAccountSigners: z.array(AddressZod).optional().register(globalRegistry, {\n description: 'List of allowed reward escrow account signer addresses, if undefined anyone can participate',\n title: 'allowedRewardEscrowAccountSigners',\n type: 'array',\n }),\n minCandidates: z.coerce.number().default(DEFAULT_MIN_CANDIDATES).register(globalRegistry, {\n default: DEFAULT_MIN_CANDIDATES,\n description: 'Minimum number of uncle candidates before selecting the best uncle',\n title: 'validation.minCandidates',\n type: 'number',\n }),\n backoffMs: z.coerce.number().default(DEFAULT_BACKOFF_MS).register(globalRegistry, {\n default: DEFAULT_BACKOFF_MS,\n description: 'Back-off timeout in ms. If head age exceeds this, minCandidates is ignored',\n title: 'validation.backoffMs',\n type: 'number',\n }),\n})\n\n/** ValidationConfig type. */\nexport type ValidationConfig = z.infer<typeof ValidationConfigZod>\n","import type { SignedHydratedBlockWithHashMeta } from '@xyo-network/xl1-protocol-lib'\n\nimport { scoreUncle } from './scoreUncle.ts'\n\n/** Default minimum number of uncle candidates before selecting. */\nexport const DEFAULT_MIN_CANDIDATES = 1\n\n/** Default back-off timeout in milliseconds. If the head has not changed for this long, minCandidates is ignored. */\nexport const DEFAULT_BACKOFF_MS = 120_000\n\n/** Options for findBestUncle block selection. */\nexport interface FindBestUncleOptions {\n /** Back-off timeout in ms. If head age exceeds this, minCandidates is ignored. Default: 120_000. */\n backoffMs?: number\n /** Minimum number of uncle candidates before selecting. Default: 1. */\n minCandidates?: number\n /** Current timestamp in ms. Injectable for testing. Default: Date.now(). */\n now?: number\n}\n\n/** Selects the best uncle chain from candidates using Proof of Perfect scoring. */\nexport function findBestUncle(\n finalizedWindowedChain: SignedHydratedBlockWithHashMeta[],\n uncles: SignedHydratedBlockWithHashMeta[][],\n options?: FindBestUncleOptions,\n): SignedHydratedBlockWithHashMeta[] | undefined {\n if (uncles.length === 0) return undefined\n\n const minCandidates = options?.minCandidates ?? DEFAULT_MIN_CANDIDATES\n const backoffMs = options?.backoffMs ?? DEFAULT_BACKOFF_MS\n const now = options?.now ?? Date.now()\n\n if (uncles.length < minCandidates) {\n const headEpoch = finalizedWindowedChain.at(-1)?.[0].$epoch ?? 0\n const headAge = now - headEpoch\n if (headAge < backoffMs) {\n return undefined\n }\n }\n\n const scores = uncles.map(uncle => ([scoreUncle(finalizedWindowedChain, uncle), uncle] as const)).toSorted((a, b) => b[0] - a[0])\n return scores[0]?.[1]\n}\n","import z from 'zod'\n\nimport { ActorConfigZod } from './Actor.ts'\n\n/** ActorsConfigZod constant. */\nexport const ActorsConfigZod = z.array(ActorConfigZod.loose()).describe('Actor-specific configurations that override the base configuration when the actor is running').default([])\n\n/** ActorsConfig type. */\nexport type ActorsConfig = z.infer<typeof ActorsConfigZod>\n","import type z from 'zod'\n\nimport { ActorConfigZod } from './Actor.ts'\nimport { ActorsConfigZod } from './Actors.ts'\nimport { BaseConfigZod } from './Base.ts'\nimport type { DeepPartial } from './DeepPartial.ts'\n\n/** ConfigZod constant. */\nexport const ConfigZod = BaseConfigZod.extend({ actors: ActorsConfigZod }).describe('The complete configuration for the protocol, including global settings and actor-specific overrides')\n\n/** Config type. */\nexport type Config = z.infer<typeof ConfigZod>\n\n/** ResolveConfig helper function. */\nexport function resolveConfig(\n config: DeepPartial<Config>,\n) {\n const parsedConfig = ConfigZod.parse(config)\n const { actors, ...rootConfig } = parsedConfig\n parsedConfig.actors = actors.map((actorConfig) => {\n return ActorConfigZod.loose().parse({ ...rootConfig, ...actorConfig })\n })\n return parsedConfig\n}\n"],"mappings":";AAAA,SAAS,aAAAA,YAAW,cAAc;AAClC,SAAS,mBAAmB;;;ACD5B;AAAA,EACE,gBAAAC;AAAA,EAAc,gBAAAC;AAAA,EAAc,gBAAAC;AAAA,OACvB;AACP,SAAS,kBAAAC,kBAAgB,KAAAC,WAAS;;;ACHlC,SAAS,KAAAC,WAAS;;;ACAlB,SAAS,YAAY,cAAc;AACnC,SAAS,gBAAgB,SAAS;AAG3B,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,IAAI,OAAO,SAAS,EACjB,SAAS,gBAAgB;AAAA,IACxB,aACA;AAAA,IACA,OAAO;AAAA,IACP,MAAM;AAAA,EACR,CAAC;AAAA,EACH,sBAAsB,WAAW,SAAS,EACvC,SAAS,gBAAgB;AAAA,IACxB,aACA;AAAA,IACA,OAAO;AAAA,IACP,MAAM;AAAA,EACR,CAAC;AACL,CAAC;;;ACnBD,SAAS,KAAAC,UAAS;;;ACAlB,SAAS,kBAAAC,iBAAgB,KAAAC,UAAS;;;ACAlC,SAAS,kBAAAC,iBAAgB,KAAAC,UAAS;AAG3B,IAAM,8BAA8BA,GAAE,OAAO;AAAA,EAClD,QAAQA,GAAE,OAAO,EAAE,SAASD,iBAAgB;AAAA,IAC1C,aAAa;AAAA,IACb,MAAM;AAAA,EACR,CAAC;AACH,CAAC,EAAE,SAAS,2CAA2C;;;ADHhD,IAAM,wBAAwB,4BAA4B,OAAO;AAAA,EACtE,QAAQE,GAAE,QAAQ,MAAM,EAAE,SAASC,iBAAgB;AAAA,IACjD,aAAa;AAAA,IACb,MAAM;AAAA,EACR,CAAC;AAAA,EACD,KAAKD,GAAE,OAAO,EAAE,SAASC,iBAAgB;AAAA,IACvC,aAAa;AAAA,IACb,MAAM;AAAA,EACR,CAAC;AACH,CAAC,EAAE,SAAS,6CAA6C;;;AEdzD,SAAS,kBAAAC,iBAAgB,K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Aa,gBAAgB,eAAe;AAElE,IAAM,gBAAgBC,cAAa,gBAAgB,eAAe;;;AiB7CzE,OAAOC,SAAO;AAKP,IAAM,kBAAkBC,IAAE,MAAM,eAAe,MAAM,CAAC,EAAE,SAAS,8FAA8F,EAAE,QAAQ,CAAC,CAAC;;;ACG3K,IAAM,YAAY,cAAc,OAAO,EAAE,QAAQ,gBAAgB,CAAC,EAAE,SAAS,qGAAqG;;;AnBAzL,IAAM,aAAa;AAKnB,IAAM,gBAAgB;AAMtB,eAAsB,cAAc,cAAyB;AAC3D,QAAM,WAAW;AAAA,IACf;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP;AAAA,IACF;AAAA,EACF;AACA,QAAM,UAAmB,MAAM,SAAS,OAAO,IAAI;AACnD,MAAI,CAAC,OAAO,MAAM,GAAG;AACnB,UAAM,UAAW,OAAmC,aAAa;AACjE,QAAIC,WAAU,OAAO,KAAK,OAAO,YAAY,UAAU;AACrD,aAAO,UAAU,MAAM,EAAE,MAAM,OAAO;AAAA,IACxC;AAAA,EACF;AACA,SAAO,UAAU,MAAM,CAAC,CAAC;AAC3B;","names":["isDefined","zodAsFactory","zodIsFactory","zodToFactory","globalRegistry","z","z","z","globalRegistry","z","globalRegistry","z","z","globalRegistry","globalRegistry","z","z","globalRegistry","z","globalRegistry","z","globalRegistry","z","z","z","z","globalRegistry","z","globalRegistry","z","z","globalRegistry","globalRegistry","z","z","globalRegistry","globalRegistry","z","z","globalRegistry","AddressZod","globalRegistry","z","z","AddressZod","globalRegistry","z","z","globalRegistry","zodIsFactory","zodAsFactory","zodToFactory","z","z","isDefined"]}
1
+ {"version":3,"sources":["../../src/getFileConfig.ts","../../src/config/Actor.ts","../../src/config/Base.ts","../../src/config/Chain.ts","../../src/config/DataLake/DataLake.ts","../../src/config/DataLake/RestDataLakeConfig.ts","../../src/config/DataLake/DataLakeRemoteConfig.ts","../../src/config/DataLake/RouterDataLakeConfig.ts","../../src/config/Evm.ts","../../src/config/Log.ts","../../src/config/Providers.ts","../../src/config/Provider.ts","../../src/config/Remote.ts","../../src/config/storage/driver/Mongo.ts","../../src/config/storage/Storage.ts","../../src/config/Telemetry.ts","../../src/config/Validation.ts","../../src/primitives/uncle/findBestUncle.ts","../../src/config/Actors.ts","../../src/config/Config.ts"],"sourcesContent":["import { isDefined, isNull } from '@xylabs/sdk-js'\nimport { cosmiconfig } from 'cosmiconfig'\n\nimport { ConfigZod } from './config/index.ts'\n\n/**\n * The name of the configuration file to search for.\n */\nconst configName = 'xyo'\n\n/**\n * The name of the section within the configuration file to parse.\n */\nconst configSection = 'xl1' // Default section in the config file\n\n/**\n * Attempts to parse the configuration from a file using cosmiconfig.\n * @returns The parsed configuration object if found and valid, otherwise undefined.\n */\nexport async function getFileConfig(searchPlaces?: string[]) {\n const explorer = cosmiconfig(\n configName,\n {\n cache: true,\n searchPlaces,\n },\n )\n const result: unknown = (await explorer.search())?.config\n if (!isNull(result)) {\n const section = (result as Record<string, unknown>)[configSection]\n if (isDefined(section) && typeof section === 'object') {\n return ConfigZod.loose().parse(section)\n }\n }\n return ConfigZod.parse({})\n}\n","import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport { globalRegistry, z } from 'zod'\n\nimport { BaseConfigZod } from './Base.ts'\n\n/**\n * BIP-32 derivation path for an actor wallet.\n *\n * - Absolute form: starts with `m/` (e.g. `m/44'/60'/0'/0/0`). The full path is used as-is,\n * giving the caller complete control over coin type, account, and hardening.\n * - Relative form: a segment list without the `m/` prefix (e.g. `0`, `0/1`, `44'/60'/0'/0/0`).\n * The consumer appends this to its configured root base path.\n *\n * Each segment is a non-negative integer, optionally suffixed with `'` to mark it as hardened.\n */\nexport const AccountPathZod = z.string().regex(\n /^(m(\\/\\d+'?)+|\\d+'?(\\/\\d+'?)*)$/,\n 'Invalid BIP-32 derivation path. Use either an absolute path like \"m/44\\'/60\\'/0\\'/0/0\" or a relative path like \"0\", \"0/1\", or \"44\\'/60\\'/0\\'/0/0\".',\n)\n\n/** ActorConfigZod constant. */\nexport const ActorConfigZod = BaseConfigZod.extend({\n name: z.string(),\n accountPath: AccountPathZod.optional().register(globalRegistry, {\n description: 'BIP-32 derivation path for the actor wallet. Absolute when it starts with \"m/\"; otherwise relative to the root wallet base path. Each actor must derive to a distinct path.',\n title: 'accountPath',\n type: 'string',\n }),\n healthCheckPort: z.coerce.number().optional().register(globalRegistry, {\n description: 'Port for the Producer health checks',\n title: 'producer.healthCheckPort',\n type: 'number',\n }),\n})\n\n/** ActorConfig type. */\nexport type ActorConfig = z.infer<typeof ActorConfigZod>\n\n/** Type guard that checks if a value is a valid ActorConfig. */\nexport const isActorConfig = zodIsFactory(ActorConfigZod)\n/** Converts a value to ActorConfig, throwing if invalid. */\nexport const asActorConfig = zodAsFactory(ActorConfigZod, 'asActorConfig')\n/** toActorConfig constant. */\nexport const toActorConfig = zodToFactory(ActorConfigZod, 'toActorConfig')\n","import { z } from 'zod'\n\nimport { ChainConfigZod } from './Chain.ts'\nimport { DataLakeConfigZod } from './DataLake/index.ts'\nimport { EvmConfigZod } from './Evm.ts'\nimport { LogConfigZod } from './Log.ts'\nimport { ProvidersConfigZod } from './Providers.ts'\nimport { RemoteConfigZod } from './Remote.ts'\nimport { StorageConfigZod } from './storage/index.ts'\nimport { TelemetryConfigZod } from './Telemetry.ts'\nimport { ValidationConfigZod } from './Validation.ts'\n\n/** BaseConfigZod constant. */\nexport const BaseConfigZod = z.object({\n chain: ChainConfigZod.default(ChainConfigZod.parse({})).describe('Configuration for the chain'),\n dataLake: DataLakeConfigZod.optional().describe('Configuration for data lakes'),\n evm: EvmConfigZod.default(EvmConfigZod.parse({})).describe('Configuration for EVM-backed services'),\n log: LogConfigZod.default(LogConfigZod.parse({})).describe('Configuration for logging'),\n providers: ProvidersConfigZod.default(ProvidersConfigZod.parse([])).describe('Configuration for providers'),\n remote: RemoteConfigZod.default(RemoteConfigZod.parse({})).describe('Configuration for remote services'),\n storage: StorageConfigZod.default(StorageConfigZod.parse({})).describe('Configuration for the storage'),\n telemetry: TelemetryConfigZod.default(TelemetryConfigZod.parse({})).describe('Configuration for telemetry'),\n validation: ValidationConfigZod.default(ValidationConfigZod.parse({})).describe('Configuration for validation'),\n})\n\n/** BaseConfig type. */\nexport type BaseConfig = z.infer<typeof BaseConfigZod>\n","import { AddressZod, HexZod } from '@xylabs/sdk-js'\nimport { globalRegistry, z } from 'zod'\n\n/** ChainConfigZod constant. */\nexport const ChainConfigZod = z.object({\n id: HexZod.optional()\n .register(globalRegistry, {\n description:\n 'The unique identifier for the chain. Should be the staking contract address for contract-backed chains.',\n title: 'chain.id',\n type: 'string',\n }),\n genesisRewardAddress: AddressZod.optional()\n .register(globalRegistry, {\n description:\n 'Address to send the initial genesis rewards to, if a new chain is being created.',\n title: 'chain.genesisRewardAddress',\n type: 'Address',\n }),\n})\n\n/** ChainConfig type. */\nexport type ChainConfig = z.infer<typeof ChainConfigZod>\n","import { z } from 'zod'\n\nimport { type RestDataLakeConfig, RestDataLakeConfigZod } from './RestDataLakeConfig.ts'\n// eslint-disable-next-line import-x/no-cycle -- intentional cycle for z.lazy recursive type\nimport { type RouterDataLakeConfig, RouterDataLakeConfigZod } from './RouterDataLakeConfig.ts'\n\n/** DataLakeConfig type. */\nexport type DataLakeConfig = RestDataLakeConfig | RouterDataLakeConfig\n\n// z.lazy handles the circular reference between DataLakeConfigZod and RouterDataLakeZod\n/** DataLakeConfigZod constant. */\nexport const DataLakeConfigZod: z.ZodType<DataLakeConfig> = z.lazy(() =>\n z.union([RestDataLakeConfigZod, RouterDataLakeConfigZod])).describe('Configuration for a data lake')\n","import { globalRegistry, z } from 'zod'\n\nimport { DataLakeDriverConfigBaseZod } from './DataLakeRemoteConfig.ts'\n\n/** RestDataLakeConfigZod constant. */\nexport const RestDataLakeConfigZod = DataLakeDriverConfigBaseZod.extend({\n driver: z.literal('rest').register(globalRegistry, {\n description: 'Driver for the REST data lake',\n type: 'string',\n }),\n url: z.string().register(globalRegistry, {\n description: 'URL for the REST data lake',\n type: 'string',\n }),\n}).describe('Configuration for the REST data lake driver')\n\n/** RestDataLakeConfig type. */\nexport type RestDataLakeConfig = z.infer<typeof RestDataLakeConfigZod>\n","import { globalRegistry, z } from 'zod'\n\n/** DataLakeDriverConfigBaseZod constant. */\nexport const DataLakeDriverConfigBaseZod = z.object({\n driver: z.string().register(globalRegistry, {\n description: 'Driver for the data lake',\n type: 'string',\n }),\n}).describe('Base configuration for a data lake driver')\n/** DataLakeDriverConfigBase type. */\nexport type DataLakeDriverConfigBase = z.infer<typeof DataLakeDriverConfigBaseZod>\n","import { globalRegistry, z } from 'zod'\n\nimport type { DataLakeConfig } from './DataLake.ts'\n// eslint-disable-next-line import-x/no-cycle -- intentional cycle for z.lazy recursive type\nimport { DataLakeConfigZod } from './DataLake.ts'\n\n/** Configuration for RouterDataLake. */\nexport interface RouterDataLakeConfig {\n children: DataLakeConfig[]\n driver: 'router'\n}\n\n/** RouterDataLakeConfigZod constant. */\nexport const RouterDataLakeConfigZod: z.ZodType<RouterDataLakeConfig> = z.object({\n driver: z.literal('router').register(globalRegistry, {\n description: 'Driver for the router data lake',\n type: 'string',\n }),\n children: z.array(z.lazy(() => DataLakeConfigZod)).register(globalRegistry, {\n description: 'Child data lake drivers',\n type: 'array',\n }),\n}).describe('Configuration for the router data lake driver')\n","import { globalRegistry, z } from 'zod'\n\n/** EvmInfuraConfigZod constant. */\nexport const EvmInfuraConfigZod = z.object({\n projectId: z.string().optional().register(globalRegistry, {\n description: 'Infura project ID',\n title: 'evm.infura.projectId',\n type: 'string',\n }),\n projectSecret: z.string().optional().register(globalRegistry, {\n description: 'Infura project secret',\n title: 'evm.infura.projectSecret',\n type: 'string',\n }),\n})\n\n/** EvmJsonRpcConfigZod constant. */\nexport const EvmJsonRpcConfigZod = z.object({\n url: z.url().optional().register(globalRegistry, {\n description: 'JSON-RPC URL',\n title: 'evm.jsonRpc.url',\n type: 'string',\n }),\n})\n\n/** EvmConfigZod constant. */\nexport const EvmConfigZod = z.object({\n chainId: z.string().optional().register(globalRegistry, {\n description: 'EVM chain ID',\n title: 'evm.chainId',\n type: 'string',\n }),\n infura: EvmInfuraConfigZod.optional().describe('Infura Provider configuration'),\n jsonRpc: EvmJsonRpcConfigZod.optional().describe('JSON-RPC Provider configuration'),\n})\n\n/** EvmConfig type. */\nexport type EvmConfig = z.infer<typeof EvmConfigZod>\n","import type { LogLevelKey } from '@xylabs/sdk-js'\nimport { LogLevel } from '@xylabs/sdk-js'\nimport { globalRegistry, z } from 'zod'\n\nconst LogLevelNames = Object.keys(LogLevel) as [LogLevelKey]\n\n/** LogConfigZod constant. */\nexport const LogConfigZod = z.object({\n logLevel: z.enum(LogLevelNames).default('info').register(globalRegistry, {\n choices: LogLevelNames,\n default: 'info',\n description: 'Desired process verbosity',\n title: 'logLevel',\n type: 'string',\n }),\n silent: z.boolean().default(false).register(globalRegistry, {\n default: false,\n description: 'Whether to run in silent mode',\n title: 'silent',\n type: 'boolean',\n }),\n})\n\n/** LogConfig type. */\nexport type LogConfig = z.infer<typeof LogConfigZod>\n","import z from 'zod'\n\nimport { ProviderConfigZod } from './Provider.ts'\n\n/** ProvidersConfigZod constant. */\nexport const ProvidersConfigZod = z.array(ProviderConfigZod.loose()).describe('Configuration for providers').default([])\n\n/** ProvidersConfig type. */\nexport type ProvidersConfig = z.infer<typeof ProvidersConfigZod>\n","import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport { z } from 'zod'\n\n/** ProviderConfigZod constant. */\nexport const ProviderConfigZod = z.object({\n moniker: z.string(),\n labels: z.array(z.string()).optional(),\n}).describe('Configuration for a Provider')\n\n/** ProviderConfig type. */\nexport type ProviderConfig = z.infer<typeof ProviderConfigZod>\n\n/** Type guard that checks if a value is a valid ProviderConfig. */\nexport const isProviderConfig = zodIsFactory(ProviderConfigZod)\n/** Converts a value to ProviderConfig, throwing if invalid. */\nexport const asProviderConfig = zodAsFactory(ProviderConfigZod, 'asProviderConfig')\n/** toProviderConfig constant. */\nexport const toProviderConfig = zodToFactory(ProviderConfigZod, 'toProviderConfig')\n","import { globalRegistry, z } from 'zod'\n\n/** RpcRemoteConfigBaseZod constant. */\nexport const RpcRemoteConfigBaseZod = z.object({\n protocol: z.string('http').register(globalRegistry, {\n description: 'Protocol for the RPC connection',\n type: 'string',\n }),\n}).describe('Base configuration for the remote RPC')\n\n/** RpcRemoteConfigBase type. */\nexport type RpcRemoteConfigBase = z.infer<typeof RpcRemoteConfigBaseZod>\n\n/** HttpRpcRemoteConfigZod constant. */\nexport const HttpRpcRemoteConfigZod = RpcRemoteConfigBaseZod.extend({\n protocol: z.string('http').register(globalRegistry, {\n description: 'Protocol for the RPC connection',\n type: 'string',\n }).default('http'),\n url: z.string().register(globalRegistry, {\n description: 'URL for the Chain RPC API',\n type: 'string',\n }),\n}).describe('Configuration for the remote RPC using Http')\n\n/** HttpRpcRemoteConfig type. */\nexport type HttpRpcRemoteConfig = z.infer<typeof HttpRpcRemoteConfigZod>\n\n/** PostMessageRpcRemoteConfigZod constant. */\nexport const PostMessageRpcRemoteConfigZod = RpcRemoteConfigBaseZod.extend({\n protocol: z.string().register(globalRegistry, {\n description: 'Protocol for the RPC connection',\n type: 'string',\n }).default('postMessage'),\n networkId: z.string().register(globalRegistry, {\n description: 'Network ID to use for the postMessage RPC connection',\n type: 'string',\n }),\n sessionId: z.string().register(globalRegistry, {\n description: 'Session ID to use for the postMessage RPC connection',\n type: 'string',\n }),\n}).describe('Configuration for the remote RPC using postMessage')\n\n/** PostMessageRpcRemoteConfig type. */\nexport type PostMessageRpcRemoteConfig = z.infer<typeof PostMessageRpcRemoteConfigZod>\n\n/** RpcRemoteConfigZod constant. */\nexport const RpcRemoteConfigZod = z.union([HttpRpcRemoteConfigZod, PostMessageRpcRemoteConfigZod])\n .describe('Configuration for a remote RPC connection, either Http or postMessage')\n\n/** RpcRemoteConfig type. */\nexport type RpcRemoteConfig = z.infer<typeof RpcRemoteConfigZod>\n\n/** RemoteConfigZod constant. */\nexport const RemoteConfigZod = z.object({ rpc: RpcRemoteConfigZod.optional() }).describe('Configuration for remote connections, including RPC')\n\n/** RemoteConfig type. */\nexport type RemoteConfig = z.infer<typeof RemoteConfigZod>\n","import { isDefined, isUndefined } from '@xylabs/sdk-js'\nimport { globalRegistry, z } from 'zod'\n\n/**\n * Checks if the provided MongoDB configuration contains all necessary fields\n * for establishing a connection.\n * @param config MongoDB configuration object\n * @returns True if the configuration contains all necessary fields for\n * establishing a connection\n */\nexport const hasMongoConfig = (config?: MongoConfig): config is Required<MongoConfig> => {\n if (isUndefined(config)) return false\n return (\n isDefined(config.connectionString)\n && isDefined(config.database)\n && isDefined(config.domain)\n && isDefined(config.password)\n && isDefined(config.username)\n )\n}\n\n/** MongoConfigZod constant. */\nexport const MongoConfigZod = z.object({\n // TODO: Create from other arguments\n connectionString: z.string().nonempty().optional().register(globalRegistry, {\n description: 'MongoDB connection string',\n title: 'storage.mongo.connectionString',\n type: 'string',\n }),\n database: z.string().nonempty().optional().register(globalRegistry, {\n description: 'MongoDB database name',\n title: 'storage.mongo.database',\n type: 'string',\n }),\n domain: z.string().nonempty().optional().register(globalRegistry, {\n description: 'MongoDB domain',\n title: 'storage.mongo.domain',\n type: 'string',\n }),\n password: z.string().nonempty().optional().register(globalRegistry, {\n description: 'MongoDB password',\n title: 'storage.mongo.password',\n type: 'string',\n }),\n username: z.string().nonempty().optional().register(globalRegistry, {\n description: 'MongoDB username',\n title: 'storage.mongo.username',\n type: 'string',\n }),\n})\n\n/** MongoConfig type. */\nexport type MongoConfig = z.infer<typeof MongoConfigZod>\n","import { globalRegistry, z } from 'zod'\n\nimport { MongoConfigZod } from './driver/index.ts'\n\n/** StorageConfigZod constant. */\nexport const StorageConfigZod = z.object({\n mongo: MongoConfigZod.optional().describe('Configuration for the MongoD storage driver'),\n root: z.string().optional().register(globalRegistry, {\n description: 'Root directory for local storage',\n title: 'storage.root',\n type: 'string',\n }),\n}).describe('Storage configuration options')\n\n/** StorageConfig type. */\nexport type StorageConfig = z.infer<typeof StorageConfigZod>\n","import { globalRegistry, z } from 'zod'\n\n/** DefaultMetricsScrapePorts constant. */\nexport const DefaultMetricsScrapePorts = {\n api: 9465,\n bridge: 9468,\n mempool: 9466,\n producer: 9464,\n rewardRedemptionApi: 9467,\n}\n\n/** MetricsScrapeConfigZod constant. */\nexport const MetricsScrapeConfigZod = z.object({\n path: z.string().default('/metrics').register(globalRegistry, {\n default: '/metrics',\n description: 'Path for the metrics scrape endpoint',\n title: 'telemetry.metrics.scrape.path',\n type: 'string',\n }),\n port: z.coerce.number().int().positive().optional().register(globalRegistry, {\n description: 'Port for the metrics scrape endpoint',\n title: 'telemetry.metrics.scrape.port',\n type: 'number',\n }),\n}).describe('Metrics scrape configuration')\n\n/** MetricsConfigZod constant. */\nexport const MetricsConfigZod = z.object({ scrape: MetricsScrapeConfigZod }).describe('Metrics configuration options')\n\n/** OpenTelemetryConfigZod constant. */\nexport const OpenTelemetryConfigZod = z.object({\n // OpenTelemetry options\n otlpEndpoint: z.url().optional().register(globalRegistry, {\n description: 'OTLP endpoint for exporting telemetry data',\n title: 'telemetry.otel.otlpEndpoint',\n type: 'string',\n }),\n})\n\n/** TelemetryConfigZod constant. */\nexport const TelemetryConfigZod = z.object({\n // Metrics configuration\n metrics: MetricsConfigZod.optional().describe('Metrics configuration'),\n // OpenTelemetry configuration\n otel: OpenTelemetryConfigZod.optional().describe('OpenTelemetry configuration'),\n}).describe('Telemetry configuration options')\n\n/** TelemetryConfig type. */\nexport type TelemetryConfig = z.infer<typeof TelemetryConfigZod>\n","import { AddressZod } from '@xylabs/sdk-js'\nimport { globalRegistry, z } from 'zod'\n\nimport { DEFAULT_BACKOFF_MS, DEFAULT_MIN_CANDIDATES } from '../primitives/index.ts'\n\n/** ValidationConfigZod constant. */\nexport const ValidationConfigZod = z.object({\n allowedRewardRedeemers: z.array(AddressZod).optional().register(globalRegistry, {\n description: 'List of allowed reward redeemer addresses, if undefined anyone can participate',\n title: 'allowedRewardRedeemers',\n type: 'array',\n }),\n allowedRewardEscrowAccountSigners: z.array(AddressZod).optional().register(globalRegistry, {\n description: 'List of allowed reward escrow account signer addresses, if undefined anyone can participate',\n title: 'allowedRewardEscrowAccountSigners',\n type: 'array',\n }),\n minCandidates: z.coerce.number().default(DEFAULT_MIN_CANDIDATES).register(globalRegistry, {\n default: DEFAULT_MIN_CANDIDATES,\n description: 'Minimum number of uncle candidates before selecting the best uncle',\n title: 'validation.minCandidates',\n type: 'number',\n }),\n backoffMs: z.coerce.number().default(DEFAULT_BACKOFF_MS).register(globalRegistry, {\n default: DEFAULT_BACKOFF_MS,\n description: 'Back-off timeout in ms. If head age exceeds this, minCandidates is ignored',\n title: 'validation.backoffMs',\n type: 'number',\n }),\n})\n\n/** ValidationConfig type. */\nexport type ValidationConfig = z.infer<typeof ValidationConfigZod>\n","import type { SignedHydratedBlockWithHashMeta } from '@xyo-network/xl1-protocol-lib'\n\nimport { scoreUncle } from './scoreUncle.ts'\n\n/** Default minimum number of uncle candidates before selecting. */\nexport const DEFAULT_MIN_CANDIDATES = 1\n\n/** Default back-off timeout in milliseconds. If the head has not changed for this long, minCandidates is ignored. */\nexport const DEFAULT_BACKOFF_MS = 120_000\n\n/** Options for findBestUncle block selection. */\nexport interface FindBestUncleOptions {\n /** Back-off timeout in ms. If head age exceeds this, minCandidates is ignored. Default: 120_000. */\n backoffMs?: number\n /** Minimum number of uncle candidates before selecting. Default: 1. */\n minCandidates?: number\n /** Current timestamp in ms. Injectable for testing. Default: Date.now(). */\n now?: number\n}\n\n/** Selects the best uncle chain from candidates using Proof of Perfect scoring. */\nexport function findBestUncle(\n finalizedWindowedChain: SignedHydratedBlockWithHashMeta[],\n uncles: SignedHydratedBlockWithHashMeta[][],\n options?: FindBestUncleOptions,\n): SignedHydratedBlockWithHashMeta[] | undefined {\n if (uncles.length === 0) return undefined\n\n const minCandidates = options?.minCandidates ?? DEFAULT_MIN_CANDIDATES\n const backoffMs = options?.backoffMs ?? DEFAULT_BACKOFF_MS\n const now = options?.now ?? Date.now()\n\n if (uncles.length < minCandidates) {\n const headEpoch = finalizedWindowedChain.at(-1)?.[0].$epoch ?? 0\n const headAge = now - headEpoch\n if (headAge < backoffMs) {\n return undefined\n }\n }\n\n const scores = uncles.map(uncle => ([scoreUncle(finalizedWindowedChain, uncle), uncle] as const)).toSorted((a, b) => b[0] - a[0])\n return scores[0]?.[1]\n}\n","import z from 'zod'\n\nimport { ActorConfigZod } from './Actor.ts'\n\n/** ActorsConfigZod constant. */\nexport const ActorsConfigZod = z.array(ActorConfigZod.loose()).describe('Actor-specific configurations that override the base configuration when the actor is running').default([])\n\n/** ActorsConfig type. */\nexport type ActorsConfig = z.infer<typeof ActorsConfigZod>\n","import type z from 'zod'\n\nimport { ActorConfigZod } from './Actor.ts'\nimport { ActorsConfigZod } from './Actors.ts'\nimport { BaseConfigZod } from './Base.ts'\nimport type { DeepPartial } from './DeepPartial.ts'\n\n/** ConfigZod constant. */\nexport const ConfigZod = BaseConfigZod.extend({ actors: ActorsConfigZod }).describe('The complete configuration for the protocol, including global settings and actor-specific overrides')\n\n/** Config type. */\nexport type Config = z.infer<typeof ConfigZod>\n\n/** ResolveConfig helper function. */\nexport function resolveConfig(\n config: DeepPartial<Config>,\n) {\n const parsedConfig = ConfigZod.parse(config)\n const { actors, ...rootConfig } = parsedConfig\n parsedConfig.actors = actors.map((actorConfig) => {\n return ActorConfigZod.loose().parse({ ...rootConfig, ...actorConfig })\n })\n return parsedConfig\n}\n"],"mappings":";AAAA,SAAS,aAAAA,YAAW,cAAc;AAClC,SAAS,mBAAmB;;;ACD5B;AAAA,EACE,gBAAAC;AAAA,EAAc,gBAAAC;AAAA,EAAc,gBAAAC;AAAA,OACvB;AACP,SAAS,kBAAAC,kBAAgB,KAAAC,WAAS;;;ACHlC,SAAS,KAAAC,WAAS;;;ACAlB,SAAS,YAAY,cAAc;AACnC,SAAS,gBAAgB,SAAS;AAG3B,IAAM,iBAAiB,EAAE,OAA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IACA;AAAA,MACE,OAAO;AAAA,MACP;AAAA,IACF;AAAA,EACF;AACA,QAAM,UAAmB,MAAM,SAAS,OAAO,IAAI;AACnD,MAAI,CAAC,OAAO,MAAM,GAAG;AACnB,UAAM,UAAW,OAAmC,aAAa;AACjE,QAAIC,WAAU,OAAO,KAAK,OAAO,YAAY,UAAU;AACrD,aAAO,UAAU,MAAM,EAAE,MAAM,OAAO;AAAA,IACxC;AAAA,EACF;AACA,SAAO,UAAU,MAAM,CAAC,CAAC;AAC3B;","names":["isDefined","zodAsFactory","zodIsFactory","zodToFactory","globalRegistry","z","z","z","globalRegistry","z","globalRegistry","z","z","globalRegistry","globalRegistry","z","z","globalRegistry","z","globalRegistry","z","globalRegistry","z","z","z","z","globalRegistry","z","globalRegistry","z","z","globalRegistry","globalRegistry","z","z","globalRegistry","globalRegistry","z","z","globalRegistry","AddressZod","globalRegistry","z","z","AddressZod","globalRegistry","z","z","globalRegistry","zodIsFactory","zodAsFactory","zodToFactory","z","z","isDefined"]}
@@ -3206,7 +3206,7 @@ async function balancesStepSummaryFromRange(context, semaphores, blockViewer, su
3206
3206
 
3207
3207
  // src/summary/primitives/balances/balancesSummary.ts
3208
3208
  import {
3209
- asAddress as asAddress2,
3209
+ asAddress,
3210
3210
  assertEx as assertEx26,
3211
3211
  spanRootAsync as spanRootAsync3
3212
3212
  } from "@xylabs/sdk-js";
@@ -3230,7 +3230,7 @@ async function balancesSummary(context, semaphores, blockViewer, summaryMap, con
3230
3230
  const balances = {};
3231
3231
  for (const summary of summaries) {
3232
3232
  for (const [address, balance] of Object.entries(summary.balances)) {
3233
- const validAddress = asAddress2(address, () => `Invalid address: ${address}`);
3233
+ const validAddress = asAddress(address, () => `Invalid address: ${address}`);
3234
3234
  balances[validAddress] = (balances[validAddress] ?? 0n) + parseSignedBigInt(balance);
3235
3235
  }
3236
3236
  }
@@ -3420,7 +3420,7 @@ async function transfersStepSummaryFromRange(context, semaphores, blockViewer, s
3420
3420
 
3421
3421
  // src/summary/primitives/transfers/transfersSummary.ts
3422
3422
  import {
3423
- asAddress as asAddress3,
3423
+ asAddress as asAddress2,
3424
3424
  assertEx as assertEx30,
3425
3425
  spanRootAsync as spanRootAsync6
3426
3426
  } from "@xylabs/sdk-js";
@@ -3444,10 +3444,10 @@ async function transfersSummary(context, semaphores, blockViewer, summaryMap, co
3444
3444
  const transfers = {};
3445
3445
  for (const summary of summaries) {
3446
3446
  for (const [from, toMap] of Object.entries(summary.transfers)) {
3447
- const validFrom = asAddress3(from, () => `Invalid address: ${from}`);
3447
+ const validFrom = asAddress2(from, () => `Invalid address: ${from}`);
3448
3448
  transfers[validFrom] = transfers[validFrom] ?? {};
3449
3449
  for (const [to, transfer] of Object.entries(toMap)) {
3450
- const validTo = asAddress3(to, () => `Invalid address: ${to}`);
3450
+ const validTo = asAddress2(to, () => `Invalid address: ${to}`);
3451
3451
  transfers[validFrom][validTo] = (transfers[validFrom][validTo] ?? 0n) + parseSignedBigInt(transfer);
3452
3452
  }
3453
3453
  }
@@ -4578,11 +4578,13 @@ import {
4578
4578
  import {
4579
4579
  BlockValidationViewerMoniker as BlockValidationViewerMoniker2,
4580
4580
  ChainContractViewerMoniker as ChainContractViewerMoniker4,
4581
+ DeadLetterQueueRunnerMoniker,
4581
4582
  DEFAULT_MAX_EXP_AHEAD,
4582
4583
  FinalizationViewerMoniker as FinalizationViewerMoniker4,
4583
4584
  isSignedHydratedBlockWithHashMeta,
4584
4585
  isSignedHydratedTransactionWithHashMeta,
4585
4586
  MempoolRunnerMoniker,
4587
+ TransactionRejectionSchema,
4586
4588
  TransactionValidationViewerMoniker
4587
4589
  } from "@xyo-network/xl1-protocol-lib";
4588
4590
  import { Mutex } from "async-mutex";
@@ -4592,6 +4594,7 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
4592
4594
  moniker = SimpleMempoolRunner.defaultMoniker;
4593
4595
  _blockValidationViewer;
4594
4596
  _chainContractViewer;
4597
+ _deadLetterQueueRunner;
4595
4598
  _finalizationViewer;
4596
4599
  _transactionValidationViewer;
4597
4600
  _syncMutex = new Mutex();
@@ -4639,6 +4642,7 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
4639
4642
  this._chainContractViewer = await this.locator.getInstance(ChainContractViewerMoniker4);
4640
4643
  this._finalizationViewer = await this.locator.getInstance(FinalizationViewerMoniker4);
4641
4644
  this._transactionValidationViewer = await this.locator.getInstance(TransactionValidationViewerMoniker);
4645
+ this._deadLetterQueueRunner = await this.locator.tryGetInstance(DeadLetterQueueRunnerMoniker);
4642
4646
  }
4643
4647
  async prunePendingBlocks({
4644
4648
  batchSize = 10,
@@ -4741,6 +4745,7 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
4741
4745
  if (!validated) {
4742
4746
  this.logger?.debug(`Pruning transaction ${bundles[remainingTransactionMap[i]]._hash} during transaction validation`);
4743
4747
  this.logger?.debug(` - validation result: ${r.at(0)?.message}`);
4748
+ await this.routeRejectedTransaction(remainingTransactions[i], r);
4744
4749
  }
4745
4750
  valid[remainingTransactionMap[i]] = validated;
4746
4751
  }
@@ -4809,6 +4814,20 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
4809
4814
  this._syncTimerId = null;
4810
4815
  }
4811
4816
  }
4817
+ async routeRejectedTransaction(transaction, errors) {
4818
+ if (!this._deadLetterQueueRunner) return;
4819
+ const rejectionErrors = errors.map((e) => ({
4820
+ hash: transaction[0]._hash,
4821
+ name: e.name ?? "TransactionStateValidationError",
4822
+ message: String(e.message ?? e)
4823
+ }));
4824
+ await this._deadLetterQueueRunner.rejectTransaction({
4825
+ schema: TransactionRejectionSchema,
4826
+ transaction,
4827
+ errors: rejectionErrors,
4828
+ rejector: "mempool"
4829
+ });
4830
+ }
4812
4831
  async simpleBlockValidationCheck(payloads) {
4813
4832
  const headNumber = await this.finalizationViewer.headNumber();
4814
4833
  const chainId = await this.chainContractViewer.chainId();
@@ -5366,7 +5385,7 @@ SimpleStakeEventsViewer = __decorateClass([
5366
5385
  ], SimpleStakeEventsViewer);
5367
5386
 
5368
5387
  // src/simple/StakeTotalsViewer/SimpleStakeTotalsViewer.ts
5369
- import { asAddress as asAddress4 } from "@xylabs/sdk-js";
5388
+ import { asAddress as asAddress3 } from "@xylabs/sdk-js";
5370
5389
  import { assertEx as assertEx41 } from "@xylabs/sdk-js";
5371
5390
  import {
5372
5391
  StakeTotalsViewerMoniker,
@@ -5392,7 +5411,7 @@ var SimpleStakeTotalsViewer = class extends AbstractCreatableProvider {
5392
5411
  let active = 0n;
5393
5412
  const positions = await this.stakeViewer.activeStakes();
5394
5413
  for (const position of positions) {
5395
- if ((position.removeBlock === 0 || position.removeBlock > time) && asAddress4(position.staked) === asAddress4(staked)) {
5414
+ if ((position.removeBlock === 0 || position.removeBlock > time) && asAddress3(position.staked) === asAddress3(staked)) {
5396
5415
  active += position.amount;
5397
5416
  }
5398
5417
  }
@@ -5402,7 +5421,7 @@ var SimpleStakeTotalsViewer = class extends AbstractCreatableProvider {
5402
5421
  let active = 0n;
5403
5422
  const positions = await this.stakeViewer.activeStakes();
5404
5423
  for (const position of positions) {
5405
- if ((position.removeBlock === 0 || position.removeBlock > time) && asAddress4(position.staker) === asAddress4(staker)) {
5424
+ if ((position.removeBlock === 0 || position.removeBlock > time) && asAddress3(position.staker) === asAddress3(staker)) {
5406
5425
  active += position.amount;
5407
5426
  }
5408
5427
  }
@@ -5429,7 +5448,7 @@ var SimpleStakeTotalsViewer = class extends AbstractCreatableProvider {
5429
5448
  let pending = 0n;
5430
5449
  const positions = await this.stakeViewer.removedStakes();
5431
5450
  for (const position of positions) {
5432
- if (position.removeBlock !== 0 && position.removeBlock <= time && (position.withdrawBlock === 0 || position.withdrawBlock > time) && asAddress4(position.staker) === asAddress4(staker)) {
5451
+ if (position.removeBlock !== 0 && position.removeBlock <= time && (position.withdrawBlock === 0 || position.withdrawBlock > time) && asAddress3(position.staker) === asAddress3(staker)) {
5433
5452
  pending += position.amount;
5434
5453
  }
5435
5454
  }
@@ -5449,7 +5468,7 @@ var SimpleStakeTotalsViewer = class extends AbstractCreatableProvider {
5449
5468
  let withdrawn = 0n;
5450
5469
  const positions = await this.stakeViewer.withdrawnStakes();
5451
5470
  for (const position of positions) {
5452
- if (position.withdrawBlock !== 0 && position.withdrawBlock <= time && asAddress4(position.staker) === asAddress4(staker)) {
5471
+ if (position.withdrawBlock !== 0 && position.withdrawBlock <= time && asAddress3(position.staker) === asAddress3(staker)) {
5453
5472
  withdrawn += position.amount;
5454
5473
  }
5455
5474
  }
@@ -5465,7 +5484,7 @@ SimpleStakeTotalsViewer = __decorateClass([
5465
5484
 
5466
5485
  // src/simple/StakeViewer/SimpleStakeViewer.ts
5467
5486
  import {
5468
- asAddress as asAddress5,
5487
+ asAddress as asAddress4,
5469
5488
  toAddress as toAddress6
5470
5489
  } from "@xylabs/sdk-js";
5471
5490
  import { assertEx as assertEx42 } from "@xylabs/sdk-js";
@@ -5496,7 +5515,7 @@ var SimpleStakeViewer = class extends AbstractCreatableProvider {
5496
5515
  let active = 0n;
5497
5516
  const positions = await this.activeStakes();
5498
5517
  for (const position of positions) {
5499
- if (position.removeBlock === 0 && asAddress5(position.staked) === asAddress5(staked)) {
5518
+ if (position.removeBlock === 0 && asAddress4(position.staked) === asAddress4(staked)) {
5500
5519
  active += position.amount;
5501
5520
  }
5502
5521
  }
@@ -5506,7 +5525,7 @@ var SimpleStakeViewer = class extends AbstractCreatableProvider {
5506
5525
  let active = 0n;
5507
5526
  const positions = await this.activeStakes();
5508
5527
  for (const position of positions) {
5509
- if (position.removeBlock === 0 && asAddress5(position.staker) === asAddress5(staker)) {
5528
+ if (position.removeBlock === 0 && asAddress4(position.staker) === asAddress4(staker)) {
5510
5529
  active += position.amount;
5511
5530
  }
5512
5531
  }
@@ -5539,7 +5558,7 @@ var SimpleStakeViewer = class extends AbstractCreatableProvider {
5539
5558
  let pending = 0n;
5540
5559
  const positions = await this.removedStakes();
5541
5560
  for (const position of positions) {
5542
- if (position.removeBlock !== 0 && position.withdrawBlock === 0 && asAddress5(position.staker) === asAddress5(staker)) {
5561
+ if (position.removeBlock !== 0 && position.withdrawBlock === 0 && asAddress4(position.staker) === asAddress4(staker)) {
5543
5562
  pending += position.amount;
5544
5563
  }
5545
5564
  }
@@ -5555,15 +5574,15 @@ var SimpleStakeViewer = class extends AbstractCreatableProvider {
5555
5574
  return assertEx42(this.positions[id], () => new Error(`Stake with id ${id} not found`));
5556
5575
  }
5557
5576
  stakeByStaker(staker, slot) {
5558
- return this.positions.filter((s) => asAddress5(s.staker) === asAddress5(staker))[slot];
5577
+ return this.positions.filter((s) => asAddress4(s.staker) === asAddress4(staker))[slot];
5559
5578
  }
5560
5579
  stakesByStaked(staked, range = [0, void 0]) {
5561
5580
  const endBlock = range[1] ?? Number.MAX_SAFE_INTEGER;
5562
- return this.positions.filter((s) => asAddress5(s.staked) === asAddress5(staked) && s.addBlock <= endBlock && s.removeBlock <= endBlock);
5581
+ return this.positions.filter((s) => asAddress4(s.staked) === asAddress4(staked) && s.addBlock <= endBlock && s.removeBlock <= endBlock);
5563
5582
  }
5564
5583
  stakesByStaker(staker, range = [0, void 0]) {
5565
5584
  const endBlock = range[1] ?? Number.MAX_SAFE_INTEGER;
5566
- return this.positions.filter((s) => asAddress5(s.staker) === asAddress5(staker) && s.addBlock <= endBlock && s.removeBlock <= endBlock);
5585
+ return this.positions.filter((s) => asAddress4(s.staker) === asAddress4(staker) && s.addBlock <= endBlock && s.removeBlock <= endBlock);
5567
5586
  }
5568
5587
  stakingTokenAddress() {
5569
5588
  return toAddress6("0x000000000000000000000000000011");
@@ -5582,7 +5601,7 @@ var SimpleStakeViewer = class extends AbstractCreatableProvider {
5582
5601
  let withdrawn = 0n;
5583
5602
  const positions = await this.withdrawnStakes();
5584
5603
  for (const position of positions) {
5585
- if (position.withdrawBlock !== 0 && asAddress5(position.staker) === asAddress5(staker)) {
5604
+ if (position.withdrawBlock !== 0 && asAddress4(position.staker) === asAddress4(staker)) {
5586
5605
  withdrawn += position.amount;
5587
5606
  }
5588
5607
  }