@xyo-network/chain-orchestration 1.21.3 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser/index.mjs
CHANGED
|
@@ -333,7 +333,7 @@ var DEFAULT_FIXED_FEE = toHex(XL1(1000n) * AttoXL1ConvertFactor.xl1);
|
|
|
333
333
|
var DEFAULT_VARIABLE_FEE_BASIS_POINTS = 300;
|
|
334
334
|
var DEFAULT_HARDHAT_BRIDGE_CONTRACT = toAddress("2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6");
|
|
335
335
|
var DEFAULT_HARDHAT_CHAIN_ID = toHex("7A69");
|
|
336
|
-
var DEFAULT_HARDHAT_REMOTE_CHAIN_WALLET_PRIVATE_KEY = toHex("
|
|
336
|
+
var DEFAULT_HARDHAT_REMOTE_CHAIN_WALLET_PRIVATE_KEY = toHex("0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d");
|
|
337
337
|
var DEFAULT_HARDHAT_TOKEN_CONTRACT = toAddress("5FbDB2315678afecb367f032d93F642f64180aa3");
|
|
338
338
|
var DEFAULT_MAX_BRIDGE_AMOUNT = toHex(XL1(1000000n) * AttoXL1ConvertFactor.xl1);
|
|
339
339
|
var DEFAULT_MIN_BRIDGE_AMOUNT = toHex(XL1(1500n) * AttoXL1ConvertFactor.xl1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/shared/actor/v3/ActorV3.ts","../../src/shared/buildTelemetryConfig.ts","../../src/shared/config/actors/Api.ts","../../src/shared/config/actors/Bridge.ts","../../src/shared/config/actors/Finalizer.ts","../../src/shared/config/actors/Mempool.ts","../../src/shared/config/actors/Producer.ts","../../src/shared/config/actors/RewardRedemption.ts","../../src/shared/config/mergeConfig.ts","../../src/shared/createDeclarationIntentBlock.ts","../../src/shared/host/implementation/DefaultHost.ts","../../src/shared/host/implementation/DefaultServiceProvider.ts","../../src/shared/host/model/ServiceCollection.ts","../../src/shared/init/initActorSeedPhrase.ts","../../src/shared/init/walletResolution.ts","../../src/shared/init/initBridgedModule.ts","../../src/shared/init/initStatusReporter.ts","../../src/shared/init/initWallet.ts","../../src/shared/orchestrator/Orchestrator.ts","../../src/shared/provider/SimpleRejectedTransactionsArchivistProvider.ts","../../src/neutral/config/locators/basicRemoteRunnerLocator.ts","../../src/neutral/config/locators/basicRemoteViewerLocator.ts","../../src/neutral/config/locators/rootLocatorFromConfig.ts"],"sourcesContent":["import type {\n Counter, Gauge, Histogram, UpDownCounter,\n} from '@opentelemetry/api'\nimport type {\n CreatableInstance, CreatableName, CreatableParams,\n CreatableStatusReporter, EmptyObject, Logger,\n} from '@xylabs/sdk-js'\nimport {\n AbstractCreatable, assertEx, delay, IdLogger,\n} from '@xylabs/sdk-js'\nimport type { AccountInstance } from '@xyo-network/sdk-js'\nimport type { CreatableProviderContextType, ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk'\nimport { Semaphore } from 'async-mutex'\nimport z from 'zod'\n\n/**\n * No-op `Counter` returned when `this.meter` is unavailable. Lets call sites\n * drop the optional-chain on `.add()` without checking whether instrumentation\n * is wired.\n */\n/* eslint-disable @typescript-eslint/no-empty-function */\nconst noopCounter: Counter = { add: () => {} }\nconst noopUpDownCounter: UpDownCounter = { add: () => {} }\nconst noopGauge: Gauge = { record: () => {} }\nconst noopHistogram: Histogram = { record: () => {} }\n/* eslint-enable @typescript-eslint/no-empty-function */\n\nconst CreatableNameZod = z.custom<CreatableName>(val => typeof val === 'string' && val.length > 0)\nconst StatusReporterInstanceZod = z.custom<CreatableStatusReporter<void>>(\n val => val !== null && typeof val === 'object' && 'report' in (val as Record<string, unknown>),\n)\nconst AccountInstanceZod = z.custom<AccountInstance>(\n val => val !== null && typeof val === 'object' && 'address' in (val as Record<string, unknown>),\n)\n\nexport const ActorParamsV3Zod = z.object({\n account: AccountInstanceZod,\n locator: z.unknown(),\n name: CreatableNameZod,\n statusReporter: StatusReporterInstanceZod.optional(),\n})\n\nexport type ActorParamsV3<T extends EmptyObject | void = void> = CreatableParams & {\n account: AccountInstance\n locator: ProviderFactoryLocatorInstance\n} & (T extends void ? EmptyObject : T)\n\nexport type ActorInstanceV3<T extends ActorParamsV3 = ActorParamsV3> = CreatableInstance<T>\n\nexport type ReadyState = 'pending' | 'ready' | 'failed'\n\nexport interface ReadinessSignal {\n readonly readyError?: Error\n readonly readyState: ReadyState\n whenReady(timeoutMs?: number): Promise<void>\n}\n\n/**\n * Declarative description of the providers an actor needs from a locator.\n * Surfaced as `static readonly needs` on each `ActorV3` subclass; consumed\n * by `locatorFromActorNeeds` to plan which providers to register in a\n * shared per-process locator.\n *\n * `required` monikers must resolve or boot fails fast.\n * `optional` monikers are looked up via `tryGetInstance` and tolerate absence.\n */\nexport interface ActorCapabilityNeeds {\n readonly optional?: readonly string[]\n readonly required: readonly string[]\n}\n\ninterface Deferred<T> {\n promise: Promise<T>\n reject: (reason: unknown) => void\n resolve: (value: T) => void\n}\n\nfunction createDeferred<T>(): Deferred<T> {\n let resolve!: (value: T) => void\n let reject!: (reason: unknown) => void\n const promise = new Promise<T>((res, rej) => {\n resolve = res\n reject = rej\n })\n return {\n promise, resolve, reject,\n }\n}\n\n/**\n * In-repo fork of `ActorV3` from `@xyo-network/xl1-sdk`, extended with a\n * readiness contract.\n *\n * - `start()` (inherited from `AbstractCreatable`) brings up machinery: timers\n * registered, servers bound. Status transitions to `started`.\n * - `runReadyHandler()` is invoked by the `Orchestrator` after `start()` to\n * run a warm-pass via `readyHandler()`. Subclasses override `readyHandler`\n * if they need to prove they can do useful work (first block produced,\n * first finalization pass, first prune, etc).\n * - `whenReady()` resolves once `readyHandler` resolves; rejects on warm-pass\n * failure.\n */\nexport abstract class ActorV3<TParams extends ActorParamsV3 = ActorParamsV3>\n extends AbstractCreatable<TParams>\n implements ReadinessSignal {\n protected readonly _intervals = new Map<string, NodeJS.Timeout>()\n protected readonly _semaphores = new Map<string, Semaphore>()\n protected readonly _timeouts = new Map<string, NodeJS.Timeout>()\n\n private _logger?: Logger\n private _readyDeferred = createDeferred<void>()\n private _readyError?: Error\n private _readyState: ReadyState = 'pending'\n\n override get logger(): Logger {\n this._logger = new IdLogger(\n assertEx(this.context.logger, () => `Logger is required in context for actor ${this.name}.`),\n () => this.name,\n )\n return this._logger\n }\n\n get readyError(): Error | undefined {\n return this._readyError\n }\n\n get readyState(): ReadyState {\n return this._readyState\n }\n\n protected get account(): AccountInstance {\n return this.params.account\n }\n\n protected get context(): CreatableProviderContextType {\n return this.locator.context\n }\n\n protected get locator(): ProviderFactoryLocatorInstance {\n return this.params.locator\n }\n\n static override async paramsHandler<T extends ActorInstanceV3>(\n params: Partial<T['params']>,\n ): Promise<T['params']> {\n const baseParams = await super.paramsHandler(\n { ...params, name: params.name ?? 'UnknownActor' },\n ) as T['params']\n const account = assertEx(params.account, () => `params.account is required for actor ${baseParams.name}.`)\n const locator = assertEx(params.locator, () => `params.locator is required for actor ${baseParams.name}.`)\n return {\n ...baseParams, account, locator,\n } as T['params']\n }\n\n /**\n * The timer runs until the actor is deactivated (or you manually stop it).\n */\n registerTimer(timerName: string, callback: () => Promise<void>, dueTimeMs: number, periodMs: number): void {\n if (this.status !== 'starting') {\n this.logger?.warn(`Cannot register timer '${timerName}' because actor is not starting.`)\n return\n }\n let running = false\n this._semaphores.set(timerName, new Semaphore(1))\n const timeoutId = setTimeout(() => {\n const intervalId = setInterval(() => {\n const semaphore = this._semaphores.get(timerName)\n if (this.status !== 'started' || !this._intervals.has(timerName) || !semaphore || running) return\n if (semaphore.isLocked()) {\n this.logger?.warn(`Skipping timer '${this.name}:${timerName}' execution because previous execution is still running.`)\n return\n }\n semaphore.acquire().then(([, release]) => {\n const startTime = Date.now()\n running = true\n callback().then(() => {\n const duration = Date.now() - startTime\n if (duration > periodMs) {\n this.logger?.warn(`Timer '${this.name}:${timerName}' execution took longer (${duration}ms) than the period (${periodMs}ms).`)\n } else if (duration > 5000) {\n this.logger?.warn(`Timer '${this.name}:${timerName}' execution took longer (${duration}ms) than 5000ms.`)\n }\n }).catch((error: unknown) => {\n const err = error instanceof Error ? error : new Error(String(error))\n this.logger?.error(`Error in timer '${this.name}:${timerName}': ${err.message}`)\n if (err.stack) this.logger?.error(err.stack)\n }).finally(() => {\n release()\n running = false\n })\n }).catch((error: unknown) => {\n const err = error instanceof Error ? error : new Error(String(error))\n this.logger?.error(`Error acquiring semaphore for timer '${this.name}:${timerName}': ${err.message}`)\n })\n }, periodMs)\n this._intervals.set(timerName, intervalId)\n }, dueTimeMs)\n this._timeouts.set(timerName, timeoutId)\n this.logger?.debug(`Timer '${this.name}:${timerName}' registered: first call after ${dueTimeMs}ms, recurring every ${periodMs}ms.`)\n }\n\n /**\n * Invoked by the Orchestrator after `start()` to run the warm-pass.\n * Idempotent: returns immediately if already invoked.\n * Throws if `readyHandler` throws; resolves once `readyHandler` resolves.\n */\n async runReadyHandler(): Promise<void> {\n if (this._readyState !== 'pending') return\n try {\n await this.readyHandler()\n this._readyState = 'ready'\n this._readyDeferred.resolve()\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n this._readyState = 'failed'\n this._readyError = error\n this._readyDeferred.reject(error)\n throw error\n }\n }\n\n override async stopHandler(): Promise<void> {\n await super.stopHandler()\n this.logger?.debug('Stopping all timers...')\n await Promise.all(\n [...this._semaphores.values()].map(async (semaphore) => {\n while (semaphore.isLocked()) {\n this.logger?.debug('Waiting for running timer task to complete...')\n await delay(500)\n }\n await semaphore.acquire()\n }),\n )\n this._semaphores.clear()\n for (const [, timeoutRef] of this._timeouts.entries()) {\n clearTimeout(timeoutRef)\n }\n this._timeouts.clear()\n for (const [, intervalRef] of this._intervals.entries()) {\n clearInterval(intervalRef)\n }\n this._intervals.clear()\n this.logger?.debug('Stopped.')\n }\n\n async whenReady(timeoutMs?: number): Promise<void> {\n if (timeoutMs === undefined) {\n await this._readyDeferred.promise\n return\n }\n let timer: NodeJS.Timeout | undefined\n const timeout = new Promise<never>((_, reject) => {\n timer = setTimeout(() => {\n reject(new Error(`Actor ${this.name} did not become ready within ${timeoutMs}ms`))\n }, timeoutMs)\n })\n try {\n await Promise.race([this._readyDeferred.promise, timeout])\n } finally {\n if (timer) clearTimeout(timer)\n }\n }\n\n /**\n * Create a `Counter` instrument bound to this actor's meter, or a no-op\n * stub if telemetry is not wired. Always returns a non-undefined value so\n * call sites can drop the optional-chain on `.add()`.\n *\n * TODO: in a future pass, consider folding these single-instrument helpers\n * into a declarative `createActorMeters({ counters: {...}, gauges: {...} })`\n * spec API for actors with many instruments.\n */\n protected counter(name: string, description: string): Counter {\n return this.meter?.createCounter(name, { description }) ?? noopCounter\n }\n\n /** Create a synchronous `Gauge` instrument, or a no-op stub if telemetry is not wired. */\n protected gauge(name: string, description: string): Gauge {\n return this.meter?.createGauge(name, { description }) ?? noopGauge\n }\n\n /** Create a `Histogram` instrument, or a no-op stub if telemetry is not wired. */\n protected histogram(name: string, description: string): Histogram {\n return this.meter?.createHistogram(name, { description }) ?? noopHistogram\n }\n\n /**\n * Override in subclasses to prove the actor can do useful work.\n * Default: no-op (the actor declares itself ready as soon as `start()` returns).\n */\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n protected async readyHandler(): Promise<void> {}\n\n /** Create an `UpDownCounter` instrument, or a no-op stub if telemetry is not wired. */\n protected upDownCounter(name: string, description: string): UpDownCounter {\n return this.meter?.createUpDownCounter(name, { description }) ?? noopUpDownCounter\n }\n}\n\nexport abstract class Actor<TParams extends ActorParamsV3 = ActorParamsV3> extends ActorV3<TParams> {}\n","import type { Config } from '@xyo-network/xl1-sdk'\n\nexport function buildTelemetryConfig(config: Config, serviceName: string, serviceVersion: string, defaultMetricsScrapePort = 9464) {\n const { otlpEndpoint } = config.telemetry?.otel ?? {}\n const { path: endpoint = '/metrics', port = defaultMetricsScrapePort } = config.telemetry?.metrics?.scrape ?? {}\n const telemetryConfig = {\n attributes: { serviceName, serviceVersion }, otlpEndpoint, metricsConfig: { endpoint, port },\n }\n return telemetryConfig\n}\n","import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport type { BaseConfigContext } from '@xyo-network/xl1-sdk'\nimport { BaseConfigContextZod, HostActorConfigZod } from '@xyo-network/xl1-sdk'\nimport { globalRegistry, z } from 'zod'\n\nexport const ApiConfigZod = HostActorConfigZod.extend(z.object({\n initRewardsCache: z.union([z.number(), z.string(), z.boolean()]).transform(\n v => v !== '0' && v !== 'false' && v !== false && v != 0,\n ).default(true).register(globalRegistry, {\n description: 'Whether to initialize the rewards cache on startup',\n title: 'api.initRewardsCache',\n type: 'boolean',\n }),\n /**\n * When `true`, the API actor runs in stateless mode: it holds no local\n * backing-store ownership, never loads the local LMDB/MongoDB node, and\n * federates every JSON-RPC request to upstream owner-actors via `JsonRpc*`\n * providers. Multiple stateless API instances can run behind a load\n * balancer for horizontal scaling. Requires `remote.rpc` to point at the\n * upstream API/Finalizer/Mempool/Indexer surfaces.\n */\n stateless: z.union([z.number(), z.string(), z.boolean()]).transform(\n v => v === '1' || v === 'true' || v === true || v == 1,\n ).default(false).register(globalRegistry, {\n description: 'Run the API actor as a stateless federation node (availableBackings: [network])',\n title: 'api.stateless',\n type: 'boolean',\n }),\n /**\n * Back-compat for the surface-aware route split. When `true`, `POST /rpc`\n * serves the full `XyoConnection` (both node-surface and indexed-surface\n * methods), preserving pre-Phase-7 behavior for clients that haven't yet\n * migrated to `POST /rpc/indexed`. When `false`, `/rpc` is strictly\n * node-surface only and indexed methods are 404 at `/rpc`.\n *\n * `/rpc/indexed` mounts independently of this flag whenever the locator's\n * connection has any indexed branch.\n *\n * Default `true` for the first release that includes Phase 7 — flip to\n * `false` per environment once external clients (explorers, wallets, dApps)\n * have moved their indexed-method calls to `/rpc/indexed`.\n */\n legacyMixedRpc: z.union([z.number(), z.string(), z.boolean()]).transform(\n v => v !== '0' && v !== 'false' && v !== false && v != 0,\n ).default(true).register(globalRegistry, {\n description: 'Serve the full XyoConnection at POST /rpc (no surface filter). Set false to enforce node-surface-only at /rpc; indexed methods always available at /rpc/indexed regardless.',\n title: 'api.legacyMixedRpc',\n type: 'boolean',\n }),\n}).shape)\n\nexport type ApiConfig = z.infer<typeof ApiConfigZod>\n\nexport const isApiConfig = zodIsFactory(ApiConfigZod)\nexport const asApiConfig = zodAsFactory(ApiConfigZod, 'asApiConfig')\nexport const toApiConfig = zodToFactory(ApiConfigZod, 'toApiConfig')\n\nexport interface ApiConfigContext extends Omit<BaseConfigContext, 'config'> {\n config: ApiConfig\n}\n\nexport const ApiConfigContext: z.ZodType<ApiConfigContext> = BaseConfigContextZod.extend({ config: ApiConfigZod })\n\nexport const isApiConfigContext: <T>(value: T) => value is T & ApiConfigContext = zodIsFactory(ApiConfigContext)\nexport const asApiConfigContext: ReturnType<typeof zodAsFactory<ApiConfigContext>> = zodAsFactory(ApiConfigContext, 'asApiConfigContext')\nexport const toApiConfigContext: ReturnType<typeof zodToFactory<ApiConfigContext>> = zodToFactory(ApiConfigContext, 'toApiConfigContext')\n","import {\n AddressZod, HexZod, toAddress, toHex, zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport type { BaseConfigContext, ChainId } from '@xyo-network/xl1-sdk'\nimport {\n AttoXL1ConvertFactor, BaseConfigContextZod, HostActorConfigZod, XL1,\n} from '@xyo-network/xl1-sdk'\nimport { globalRegistry, z } from 'zod'\n\nconst DEFAULT_FIXED_FEE = toHex(XL1(1000n) * AttoXL1ConvertFactor.xl1)\nconst DEFAULT_VARIABLE_FEE_BASIS_POINTS = 300 // 3%\nconst DEFAULT_HARDHAT_BRIDGE_CONTRACT = toAddress('2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6')\nconst DEFAULT_HARDHAT_CHAIN_ID: ChainId = toHex('7A69')\nconst DEFAULT_HARDHAT_REMOTE_CHAIN_WALLET_PRIVATE_KEY = toHex('0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80')\nconst DEFAULT_HARDHAT_TOKEN_CONTRACT = toAddress('5FbDB2315678afecb367f032d93F642f64180aa3')\nconst DEFAULT_MAX_BRIDGE_AMOUNT = toHex(XL1(1_000_000n) * AttoXL1ConvertFactor.xl1)\nconst DEFAULT_MIN_BRIDGE_AMOUNT = toHex(XL1(1500n) * AttoXL1ConvertFactor.xl1)\nconst DEFAULT_SCANNER_INTERVAL_MS = 30_000\n\nexport const BasisPointsZod = z.coerce.number().int().nonnegative().max(10_000)\nexport type BasisPoints = z.infer<typeof BasisPointsZod>\n\nexport const BridgeConfigZod = HostActorConfigZod.extend({\n escrowAddress: AddressZod.optional().register(globalRegistry, {\n description: 'Address to which bridge escrow will be sent',\n title: 'bridge.escrowAddress',\n type: 'string',\n }),\n feesAddress: AddressZod.optional().register(globalRegistry, {\n description: 'Address to which bridge fees will be sent',\n title: 'bridge.feesAddress',\n type: 'string',\n }),\n feeFixed: HexZod.default(DEFAULT_FIXED_FEE).register(globalRegistry, {\n default: DEFAULT_FIXED_FEE,\n description: 'Fixed fee (in AttoXL1) applied to bridge transfers',\n title: 'bridge.feeFixed',\n type: 'bigint',\n }),\n feeRateBasisPoints: BasisPointsZod.default(DEFAULT_VARIABLE_FEE_BASIS_POINTS).register(globalRegistry, {\n default: DEFAULT_VARIABLE_FEE_BASIS_POINTS,\n description: 'Variable rate fee (in basis points where 1 bps = 0.01%) applied to bridge transfers',\n title: 'bridge.feeRateBasisPoints',\n type: 'number',\n }),\n maxBridgeAmount: HexZod.default(DEFAULT_MAX_BRIDGE_AMOUNT).register(globalRegistry, {\n default: DEFAULT_MAX_BRIDGE_AMOUNT,\n description: 'Maximum amount allowed for a bridge transfer',\n title: 'bridge.maxBridgeAmount',\n type: 'string',\n }),\n minBridgeAmount: HexZod.default(DEFAULT_MIN_BRIDGE_AMOUNT).register(globalRegistry, {\n default: DEFAULT_MIN_BRIDGE_AMOUNT,\n description: 'Minimum amount required for a bridge transfer',\n title: 'bridge.minBridgeAmount',\n type: 'string',\n }),\n redisHost: z.string().default('localhost').register(globalRegistry, {\n default: 'localhost',\n description: 'Host for the Bridge Redis instance',\n title: 'bridge.redisHost',\n type: 'string',\n }),\n redisPort: z.coerce.number().int().positive().default(6379).register(globalRegistry, {\n default: 6379,\n description: 'Port for the Bridge Redis instance',\n title: 'bridge.redisPort',\n type: 'number',\n }),\n scannerIntervalMs: z.coerce.number().int().positive().default(DEFAULT_SCANNER_INTERVAL_MS).register(globalRegistry, {\n default: DEFAULT_SCANNER_INTERVAL_MS,\n description: 'How often (ms) the EVM->XL1 scanner polls the remote bridge contract for new BridgedToRemote ids confirmed at depth.',\n title: 'bridge.scannerIntervalMs',\n type: 'number',\n }),\n remoteBridgeContractAddress: AddressZod.default(DEFAULT_HARDHAT_BRIDGE_CONTRACT).register(globalRegistry, {\n default: DEFAULT_HARDHAT_BRIDGE_CONTRACT,\n description: 'Hex representation of remote token address used for bridging',\n title: 'bridge.remoteBridgeContractAddress',\n type: 'string',\n }),\n remoteChainId: HexZod.default(DEFAULT_HARDHAT_CHAIN_ID).register(globalRegistry, {\n default: DEFAULT_HARDHAT_CHAIN_ID,\n description: 'Remote chain ID',\n title: 'bridge.remoteChainId',\n type: 'string',\n }),\n remoteConfirmationDepth: z.union([\n z.coerce.number().int().nonnegative(),\n z.literal('finalized'),\n ]).optional().register(globalRegistry, {\n description: 'Block depth or BlockTag at which the remote (EVM) chain is read as canonical. Numeric: number of confirmations behind head. '\n + \"\\'finalized\\': Casper FFG finalized block. Resolved per-chain by getRemoteConfirmationDepth when unset.\",\n title: 'bridge.remoteConfirmationDepth',\n type: 'string',\n }),\n remoteTokenAddress: HexZod.default(DEFAULT_HARDHAT_TOKEN_CONTRACT).register(globalRegistry, {\n default: DEFAULT_HARDHAT_TOKEN_CONTRACT,\n description: 'Hex representation of remote token address used for bridging',\n title: 'bridge.remoteTokenAddress',\n type: 'string',\n }),\n remoteChainWalletPrivateKey: HexZod.default(DEFAULT_HARDHAT_REMOTE_CHAIN_WALLET_PRIVATE_KEY).register(globalRegistry, {\n description: 'Private key for the wallet to use for the remote chain wallet',\n title: 'bridge.remoteChainWalletPrivateKey',\n type: 'string',\n }),\n xl1ChainId: HexZod.optional().register(globalRegistry, {\n description: 'XL1 chain id used for bridging',\n title: 'bridge.xl1ChainId',\n type: 'string',\n }),\n xl1TokenAddress: HexZod.optional().register(globalRegistry, {\n description: 'XL1 token address used for bridging',\n title: 'bridge.xl1TokenAddress',\n type: 'string',\n }),\n})\n\nexport type BridgeConfig = z.infer<typeof BridgeConfigZod>\n\nexport const BridgeSettingsZod = BridgeConfigZod.pick({\n feeFixed: true,\n feeRateBasisPoints: true,\n feesAddress: true,\n escrowAddress: true,\n maxBridgeAmount: true,\n minBridgeAmount: true,\n remoteChainId: true,\n remoteTokenAddress: true,\n xl1TokenAddress: true,\n xl1ChainId: true,\n}).required()\n\nexport type BridgeSettings = z.infer<typeof BridgeSettingsZod>\n\nexport const isBridgeConfig = zodIsFactory(BridgeConfigZod)\nexport const asBridgeConfig = zodAsFactory(BridgeConfigZod, 'asBridgeConfig')\nexport const toBridgeConfig = zodToFactory(BridgeConfigZod, 'toBridgeConfig')\n\nexport interface BridgeConfigContext extends Omit<BaseConfigContext, 'config'> {\n config: BridgeConfig\n}\n\nexport const BridgeConfigContext: z.ZodType<BridgeConfigContext> = BaseConfigContextZod.extend({ config: BridgeConfigZod })\n\nexport const isBridgeConfigContext: <T>(value: T) => value is T & BridgeConfigContext = zodIsFactory(BridgeConfigContext)\nexport const asBridgeConfigContext: ReturnType<typeof zodAsFactory<BridgeConfigContext>> = zodAsFactory(BridgeConfigContext, 'asBridgeConfigContext')\nexport const toBridgeConfigContext: ReturnType<typeof zodToFactory<BridgeConfigContext>> = zodToFactory(BridgeConfigContext, 'toBridgeConfigContext')\n","import {\n AddressZod,\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport type { BaseConfigContext } from '@xyo-network/xl1-sdk'\nimport {\n BaseConfigContextZod, DEFAULT_MIN_CANDIDATES, HostActorConfigZod,\n} from '@xyo-network/xl1-sdk'\nimport { z } from 'zod'\n\nexport const FinalizerConfigZod = HostActorConfigZod.extend({\n allowedProducers: z.array(AddressZod).optional(),\n // Period (ms) between finalizer ticks. Default matches the historical\n // hardcoded value in FinalizerActor; tests can lower it to drive faster\n // block finalization.\n finalizationCheckInterval: z.coerce.number().default(500),\n minCandidates: z.number().int().min(0).default(DEFAULT_MIN_CANDIDATES),\n})\n\nexport type FinalizerConfig = z.infer<typeof FinalizerConfigZod>\n\nexport const isFinalizerConfig = zodIsFactory(FinalizerConfigZod)\nexport const asFinalizerConfig = zodAsFactory(FinalizerConfigZod, 'asFinalizerConfig')\nexport const toFinalizerConfig = zodToFactory(FinalizerConfigZod, 'toFinalizerConfig')\n\nexport interface FinalizerConfigContext extends Omit<BaseConfigContext, 'config'> {\n config: FinalizerConfig\n}\n\nexport const FinalizerConfigContext: z.ZodType<FinalizerConfigContext> = BaseConfigContextZod.extend({ config: FinalizerConfigZod })\n\nexport const isFinalizerConfigContext: <T>(value: T) => value is T & FinalizerConfigContext = zodIsFactory(FinalizerConfigContext)\nexport const asFinalizerConfigContext: ReturnType<typeof zodAsFactory<FinalizerConfigContext>> = zodAsFactory(FinalizerConfigContext, 'asFinalizerConfigContext')\nexport const toFinalizerConfigContext: ReturnType<typeof zodToFactory<FinalizerConfigContext>> = zodToFactory(FinalizerConfigContext, 'toFinalizerConfigContext')\n","import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport type { BaseConfigContext } from '@xyo-network/xl1-sdk'\nimport { BaseConfigContextZod, HostActorConfigZod } from '@xyo-network/xl1-sdk'\nimport { globalRegistry, z } from 'zod'\n\nexport const DEFAULT_MEMPOOL_BLOCK_PRUNE_INTERVAL = 1000\nexport const DEFAULT_MEMPOOL_TRANSACTION_PRUNE_INTERVAL = 1000\n\nexport const MempoolConfigZod = HostActorConfigZod.extend({\n enabled: z.union([z.string(), z.boolean()]).default('false').transform((val, ctx) => {\n if (typeof val === 'boolean') return val\n const normalized = val.toLowerCase().trim()\n if (['true', '1', 'yes', 'on'].includes(normalized)) return true\n if (['false', '0', 'no', 'off'].includes(normalized)) return false\n ctx.addIssue({\n code: 'invalid_type',\n expected: 'boolean',\n message: `Invalid boolean value: \"${val}\". Use true/false, 1/0, yes/no.`,\n })\n return z.NEVER\n }).register(globalRegistry, {\n default: 'false',\n description: 'Enable the Mempool',\n title: 'mempool.enabled',\n type: 'boolean',\n }),\n blockPruneInterval: z.coerce.number().default(DEFAULT_MEMPOOL_BLOCK_PRUNE_INTERVAL).register(globalRegistry, {\n description: 'The interval time (in milliseconds) between pending block prune attempts',\n title: 'mempool.blockPruneInterval',\n type: 'number',\n }),\n transactionPruneInterval: z.coerce.number().default(DEFAULT_MEMPOOL_TRANSACTION_PRUNE_INTERVAL).register(globalRegistry, {\n description: 'The interval time (in milliseconds) between pending transaction prune attempts',\n title: 'mempool.transactionPruneInterval',\n type: 'number',\n }),\n})\n\nexport type MempoolConfig = z.infer<typeof MempoolConfigZod>\n\nexport const isMempoolConfig = zodIsFactory(MempoolConfigZod)\nexport const asMempoolConfig = zodAsFactory(MempoolConfigZod, 'asMempoolConfig')\nexport const toMempoolConfig = zodToFactory(MempoolConfigZod, 'toMempoolConfig')\n\nexport interface MempoolConfigContext extends Omit<BaseConfigContext, 'config'> {\n config: MempoolConfig\n}\n\nexport const MempoolConfigContext: z.ZodType<MempoolConfigContext> = BaseConfigContextZod.extend({ config: MempoolConfigZod })\n\nexport const isMempoolConfigContext: <T>(value: T) => value is T & MempoolConfigContext = zodIsFactory(MempoolConfigContext)\nexport const asMempoolConfigContext: ReturnType<typeof zodAsFactory<MempoolConfigContext>> = zodAsFactory(MempoolConfigContext, 'asMempoolConfigContext')\nexport const toMempoolConfigContext: ReturnType<typeof zodToFactory<MempoolConfigContext>> = zodToFactory(MempoolConfigContext, 'toMempoolConfigContext')\n","import {\n AddressZod,\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport type { BaseConfigContext } from '@xyo-network/xl1-sdk'\nimport { ActorConfigZod, BaseConfigContextZod } from '@xyo-network/xl1-sdk'\nimport { globalRegistry, z } from 'zod'\n\nexport const DEFAULT_BLOCK_PRODUCTION_CHECK_INTERVAL = 10_000 // 10 seconds\n\nexport const ProducerConfigZod = ActorConfigZod.extend(z.object({\n allowlist: z.array(AddressZod).optional().register(globalRegistry, {\n description: 'List of allowed producer addresses, if undefined anyone can participate',\n title: 'allowlist',\n type: 'array',\n }),\n\n blockProductionCheckInterval: z.coerce.number().default(DEFAULT_BLOCK_PRODUCTION_CHECK_INTERVAL).register(globalRegistry, {\n description: 'The interval time (in milliseconds) between block production attempts',\n title: 'producer.blockProductionCheckInterval',\n type: 'number',\n }),\n disableIntentRedeclaration: z.boolean().optional().register(globalRegistry, {\n description: 'Should the producer skip redeclaring their intent to continue producing blocks',\n title: 'producer.disableIntentRedeclaration',\n type: 'boolean',\n }),\n heartbeatInterval: z.coerce.number().default(3_600_000).register(globalRegistry, {\n description: 'The number of milliseconds between heartbeats if no blocks are produced',\n title: 'producer.heartbeatInterval',\n type: 'number',\n }),\n // TODO: BigInt schema\n minStake: z.coerce.number().default(1).register(globalRegistry, {\n description: 'Minimum stake required to be a Producer',\n title: 'producer.minStake',\n type: 'number',\n }),\n // TODO: Address schema\n rewardAddress: z.string().optional().register(globalRegistry, {\n description: 'Address to receive block rewards',\n title: 'producer.rewardAddress',\n type: 'string',\n }),\n}).shape)\n\nexport type ProducerConfig = z.infer<typeof ProducerConfigZod>\n\nexport const isProducerConfig = zodIsFactory(ProducerConfigZod)\nexport const asProducerConfig = zodAsFactory(ProducerConfigZod, 'asProducerConfig')\nexport const toProducerConfig = zodToFactory(ProducerConfigZod, 'toProducerConfig')\n\nexport interface ProducerConfigContext extends Omit<BaseConfigContext, 'config'> {\n config: ProducerConfig\n}\n\nexport const ProducerConfigContext: z.ZodType<ProducerConfigContext> = BaseConfigContextZod.extend({ config: ProducerConfigZod })\n\nexport const isProducerConfigContext: <T>(value: T) => value is T & ProducerConfigContext = zodIsFactory(ProducerConfigContext)\nexport const asProducerConfigContext: ReturnType<typeof zodAsFactory<ProducerConfigContext>> = zodAsFactory(ProducerConfigContext, 'asProducerConfigContext')\nexport const toProducerConfigContext: ReturnType<typeof zodToFactory<ProducerConfigContext>> = zodToFactory(ProducerConfigContext, 'toProducerConfigContext')\n","import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport type { BaseConfigContext } from '@xyo-network/xl1-sdk'\nimport { BaseConfigContextZod, HostActorConfigZod } from '@xyo-network/xl1-sdk'\nimport type { z } from 'zod'\n\nexport const RewardRedemptionConfigZod = HostActorConfigZod.extend({})\n\nexport type RewardRedemptionConfig = z.infer<typeof RewardRedemptionConfigZod>\n\nexport const isRewardRedemptionConfig = zodIsFactory(RewardRedemptionConfigZod)\nexport const asRewardRedemptionConfig = zodAsFactory(RewardRedemptionConfigZod, 'asRewardRedemptionConfig')\nexport const toRewardRedemptionConfig = zodToFactory(RewardRedemptionConfigZod, 'toRewardRedemptionConfig')\n\nexport interface RewardRedemptionConfigContext extends Omit<BaseConfigContext, 'config'> {\n config: RewardRedemptionConfig\n}\n\nexport const RewardRedemptionConfigContext: z.ZodType<RewardRedemptionConfigContext> = BaseConfigContextZod.extend({ config: RewardRedemptionConfigZod })\n\nexport const isRewardRedemptionConfigContext: <T>(value: T) => value is T & RewardRedemptionConfigContext = zodIsFactory(RewardRedemptionConfigContext)\nexport const asRewardRedemptionConfigContext: ReturnType<typeof zodAsFactory<RewardRedemptionConfigContext>> = zodAsFactory(RewardRedemptionConfigContext, 'asRewardRedemptionConfigContext')\nexport const toRewardRedemptionConfigContext: ReturnType<typeof zodToFactory<RewardRedemptionConfigContext>> = zodToFactory(RewardRedemptionConfigContext, 'toRewardRedemptionConfigContext')\n","import { deepMerge } from '@xylabs/sdk-js'\nimport type { Config } from '@xyo-network/xl1-sdk'\n\nexport function mergeConfig({ actors, ...baseConfig }: Config) {\n return {\n ...baseConfig,\n actors: actors.map((actor) => {\n return deepMerge(baseConfig, actor)\n }),\n }\n}\n","import { buildNextBlock } from '@xyo-network/chain-sdk'\nimport type { AccountInstance, WithHashMeta } from '@xyo-network/sdk-js'\nimport type { BlockBoundWitness, XL1BlockRange } from '@xyo-network/xl1-sdk'\nimport { createDeclarationIntent } from '@xyo-network/xl1-sdk'\n\nexport async function createProducerChainStakeIntentBlock(prevBlock: WithHashMeta<BlockBoundWitness>, producerAccount: AccountInstance, range: XL1BlockRange) {\n const producerDeclarationPayload = createDeclarationIntent(\n producerAccount.address,\n 'producer',\n range[0],\n range[1],\n )\n return await buildNextBlock(\n prevBlock,\n [],\n [producerDeclarationPayload],\n [producerAccount],\n )\n}\n","import type { Host, ServiceProvider } from '../model/index.ts'\n\n/**\n * A generic host implementation that can be used as a starting point for\n * more complex host implementations.\n */\nexport class GenericHost implements Host {\n services: ServiceProvider\n\n constructor(services: ServiceProvider) {\n this.services = services\n }\n\n async start(): Promise<void> {\n await Promise.resolve()\n // Initialize or start your services here\n console.log('Host is starting...')\n }\n\n async stop(): Promise<void> {\n await Promise.resolve()\n // Stop or clean up services here\n console.log('Host is stopping...')\n }\n}\n","import type { ServiceProvider } from '../model/index.ts'\n\nexport class DefaultServiceProvider implements ServiceProvider {\n protected _services: Record<string, unknown>\n constructor(services: Record<string, unknown>) {\n this._services = services\n }\n\n getService<T>(serviceIdentifier: string): T | undefined {\n return this._services[serviceIdentifier] as T\n }\n}\n","import type { ServiceProvider } from './ServiceProvider.ts'\n\nexport interface ServiceCollection {\n build(): ServiceProvider\n}\n\n/**\n * Represents the lifetime of a service\n */\nexport const ServiceLifetime = {\n Singleton: 'Singleton',\n Transient: 'Transient',\n} as const\n\n/**\n * Describes a single service registration\n */\nexport interface ServiceDescriptor<T = unknown> {\n identifier: string | symbol\n implementationFactory: () => T\n lifetime: keyof typeof ServiceLifetime\n}\n","import { assertEx, isString } from '@xylabs/sdk-js'\nimport type { BiosExternalInterface } from '@xyo-network/bios-model'\nimport type { WalletKind } from '@xyo-network/storage-model'\nimport type { ActorConfigContext } from '@xyo-network/xl1-sdk'\n\nimport { getBuiltInDevMnemonic, getResolvedWalletReport } from './walletResolution.ts'\n\nexport async function initActorSeedPhrase(context: ActorConfigContext, bios: BiosExternalInterface): Promise<string> {\n const { logger, config } = context\n const walletKind = config.name as WalletKind\n void bios\n const report = getResolvedWalletReport()\n if (isString(report?.root.mnemonic)) return report.root.mnemonic\n const fallback = getBuiltInDevMnemonic()\n logger?.debug(`[${walletKind}] Falling back to built-in development mnemonic`)\n return assertEx(fallback, () => 'Unable to resolve mnemonic')\n}\n","import type { Address } from '@xylabs/sdk-js'\nimport { HDWallet } from '@xyo-network/sdk-js'\nimport type { WalletInstance } from '@xyo-network/wallet-model'\nimport type { ActorConfig, Config } from '@xyo-network/xl1-sdk'\nimport { DEFAULT_WALLET_PATH, generateXyoBaseWalletFromPhrase } from '@xyo-network/xl1-sdk'\nimport { HDNodeWallet, Mnemonic } from 'ethers'\n\n/**\n * Default BIP-32 derivation path per actor, expressed as a *relative* path\n * (the consumer appends it to the root wallet base path). Each actor resolves\n * to a distinct slot to avoid collisions out of the box.\n */\nexport const DEFAULT_ACTOR_ACCOUNT_PATH: Record<string, string> = {\n api: '3',\n bridge: '1',\n finalizer: '5',\n mempool: '4',\n producer: '0',\n rewardRedemption: '2',\n}\n\nexport const BUILT_IN_DEV_MNEMONIC = 'crane ribbon cook cousin tobacco vital moral protect merit knock veteran hint knee ocean nurse'\nexport const INSECURE_GENESIS_REWARD_MNEMONIC = 'test test test test test test test test test test test junk'\nexport const GENESIS_REWARD_AMOUNT = 20_000_000_000_000_000_000_000n\nconst ATTO_XL1_PER_XL1 = 1_000_000_000_000_000_000n\n\nexport const ROOT_WALLET_RUNTIME_ID = '_root'\nexport const SHARED_ACCOUNT_REPORT_COUNT = 10\nexport type RootMnemonicConfig = Config & { mnemonic?: string }\ntype ActorWalletConfig = Partial<ActorConfig> & { accountPath?: string }\n\nexport type MnemonicKind = 'built-in-dev' | 'configured-root' | 'insecure-genesis-reward'\n\nexport interface ResolvedRootWallet {\n basePath: string\n isBuiltInDevMnemonic: boolean\n isConfigured: boolean\n mnemonic: string\n mnemonicKind: Extract<MnemonicKind, 'built-in-dev' | 'configured-root'>\n}\n\nexport interface ResolvedWalletMetadata {\n accountPath: string\n actorName: string\n address: string\n derivationPath: string\n label: string\n mnemonic: string\n mnemonicKind: MnemonicKind\n privateKey?: string\n usesBuiltInDevMnemonic: boolean\n}\n\nexport interface ResolvedWalletReport {\n requestedActors: string[]\n root: ResolvedRootWallet\n sharedAccounts: ResolvedWalletMetadata[]\n}\n\nconst ACTOR_LABELS: Record<string, string> = {\n [ROOT_WALLET_RUNTIME_ID]: 'root/local-node',\n api: 'api',\n bridge: 'bridge',\n finalizer: 'finalizer',\n mempool: 'mempool',\n producer: 'producer',\n rewardRedemption: 'rewardRedemption',\n}\n\nlet activeWalletReport: ResolvedWalletReport | undefined\n\nfunction getAccountLabel(actorName: string): string {\n return ACTOR_LABELS[actorName] ?? actorName\n}\n\nexport function clearResolvedWalletReport() {\n activeWalletReport = undefined\n}\n\n/**\n * Resolve the effective BIP-32 derivation path for an actor.\n *\n * - If the actor config specifies `accountPath`, use it.\n * - Otherwise fall back to `DEFAULT_ACTOR_ACCOUNT_PATH[actorName]`.\n * - Otherwise fall back to `\"0\"` (a relative path that derives to the first slot\n * under the root wallet's base path).\n *\n * The returned value is exactly what the user provided (or the default) —\n * absolute paths keep their `m/` prefix; relative paths do not.\n */\nexport function resolveActorAccountPath(actorName: string, actorConfig?: ActorWalletConfig): string {\n if (actorConfig?.accountPath !== undefined) return actorConfig.accountPath\n return DEFAULT_ACTOR_ACCOUNT_PATH[actorName] ?? '0'\n}\n\nexport function isAbsoluteAccountPath(accountPath: string): boolean {\n return accountPath.startsWith('m/')\n}\n\n/**\n * Expand a (possibly relative) actor accountPath into a fully qualified BIP-32\n * derivation path. Used for reporting and collision detection.\n */\nexport function expandAccountPath(accountPath: string, basePath: string = DEFAULT_WALLET_PATH): string {\n return isAbsoluteAccountPath(accountPath) ? accountPath : `${basePath}/${accountPath}`\n}\n\nasync function deriveWalletAtPath(mnemonic: string, accountPath: string): Promise<WalletInstance> {\n if (isAbsoluteAccountPath(accountPath)) {\n // `HDWallet.fromPhrase` defaults to a derived path, not the root, so an\n // arbitrary absolute path (e.g. m/44'/60'/1'/0/0) can't be derived through\n // it. Build a true root node via ethers, derive the full path, then wrap.\n const seed = Mnemonic.fromPhrase(mnemonic).computeSeed()\n const rootNode = HDNodeWallet.fromSeed(seed)\n const derivedNode = rootNode.derivePath(accountPath)\n return await HDWallet.createFromNode(derivedNode)\n }\n const baseWallet = await generateXyoBaseWalletFromPhrase(mnemonic)\n return await baseWallet.derivePath(accountPath)\n}\n\nexport function getBuiltInDevMnemonic(): string {\n return BUILT_IN_DEV_MNEMONIC\n}\n\nexport function getInsecureGenesisRewardMnemonic(): string {\n return INSECURE_GENESIS_REWARD_MNEMONIC\n}\n\nexport function resolveRootWallet(configuration: RootMnemonicConfig): ResolvedRootWallet {\n const isConfigured = configuration.mnemonic !== undefined\n const mnemonic = configuration.mnemonic ?? BUILT_IN_DEV_MNEMONIC\n const isBuiltInDevMnemonic = mnemonic === BUILT_IN_DEV_MNEMONIC\n return {\n basePath: DEFAULT_WALLET_PATH,\n isBuiltInDevMnemonic,\n isConfigured,\n mnemonic,\n mnemonicKind: isBuiltInDevMnemonic ? 'built-in-dev' : 'configured-root',\n }\n}\n\nasync function resolveWalletMetadata({\n accountPath,\n actorName,\n mnemonic,\n mnemonicKind,\n}: {\n accountPath: string\n actorName: string\n mnemonic: string\n mnemonicKind: MnemonicKind\n}): Promise<ResolvedWalletMetadata> {\n const account = await deriveWalletAtPath(mnemonic, accountPath)\n return {\n accountPath,\n actorName,\n address: account.address,\n derivationPath: expandAccountPath(accountPath),\n label: getAccountLabel(actorName),\n mnemonic,\n mnemonicKind,\n privateKey: account.privateKey,\n usesBuiltInDevMnemonic: mnemonic === BUILT_IN_DEV_MNEMONIC,\n }\n}\n\nexport async function resolveActorWallet(\n actorName: string,\n actorConfig: ActorWalletConfig | undefined,\n root: ResolvedRootWallet,\n): Promise<ResolvedWalletMetadata> {\n return await resolveWalletMetadata({\n accountPath: resolveActorAccountPath(actorName, actorConfig),\n actorName,\n mnemonic: root.mnemonic,\n mnemonicKind: root.mnemonicKind,\n })\n}\n\nexport class ActorMnemonicNotAllowedError extends Error {\n readonly actors: string[]\n constructor(actors: string[]) {\n super([\n `Per-actor mnemonics are no longer allowed (found on: ${actors.join(', ')}).`,\n 'Move the mnemonic to the root (XL1_MNEMONIC, --mnemonic, or config file \"xl1.mnemonic\") and give each actor a distinct accountPath.',\n ].join('\\n'))\n this.name = 'ActorMnemonicNotAllowedError'\n this.actors = actors\n }\n}\n\nexport function assertNoActorMnemonics(configuration: RootMnemonicConfig): void {\n const offenders = configuration.actors\n .filter((actor): actor is ActorConfig & { mnemonic: string } => typeof (actor as { mnemonic?: unknown }).mnemonic === 'string')\n .map(actor => actor.name)\n if (offenders.length > 0) throw new ActorMnemonicNotAllowedError(offenders)\n}\n\nexport class DerivationPathCollisionError extends Error {\n readonly collisions: Record<string, string[]>\n constructor(collisions: Record<string, string[]>) {\n const lines = Object.entries(collisions).map(\n ([path, actors]) => ` - ${actors.join(', ')} → ${path}`,\n )\n super([\n 'Two or more actors resolve to the same wallet derivation path:',\n ...lines,\n 'Change each actor\\'s accountPath so every actor has a distinct path.',\n ].join('\\n'))\n this.name = 'DerivationPathCollisionError'\n this.collisions = collisions\n }\n}\n\nexport function detectDerivationPathCollisions(\n requestedActors: string[],\n configuration: RootMnemonicConfig,\n): DerivationPathCollisionError | undefined {\n const actorConfigMap = new Map(configuration.actors.map(actor => [actor.name, actor]))\n const bucketsByPath = new Map<string, string[]>()\n for (const actorName of requestedActors) {\n const accountPath = resolveActorAccountPath(actorName, actorConfigMap.get(actorName))\n const fullPath = expandAccountPath(accountPath)\n const bucket = bucketsByPath.get(fullPath) ?? []\n bucket.push(actorName)\n bucketsByPath.set(fullPath, bucket)\n }\n const collisions: Record<string, string[]> = {}\n for (const [path, actors] of bucketsByPath) {\n if (actors.length > 1) collisions[path] = actors\n }\n if (Object.keys(collisions).length === 0) return undefined\n return new DerivationPathCollisionError(collisions)\n}\n\nexport async function resolveWalletReport(\n requestedActors: string[],\n configuration: RootMnemonicConfig,\n): Promise<ResolvedWalletReport> {\n const root = resolveRootWallet(configuration)\n const actorConfigMap = new Map(configuration.actors.map(actor => [actor.name, actor]))\n\n const resolvedActors = await Promise.all(\n requestedActors.map(async actorName => await resolveActorWallet(actorName, actorConfigMap.get(actorName), root)),\n )\n\n const labelMap = new Map<string, string[]>()\n for (const actor of resolvedActors) {\n const labels = labelMap.get(actor.derivationPath) ?? []\n labels.push(actor.label)\n labelMap.set(actor.derivationPath, labels)\n }\n\n const sharedAccounts = await Promise.all(\n Array.from({ length: SHARED_ACCOUNT_REPORT_COUNT }, (_, index) => index).map(async (sharedIndex) => {\n const account = await resolveWalletMetadata({\n accountPath: `${sharedIndex}`,\n actorName: ROOT_WALLET_RUNTIME_ID,\n mnemonic: root.mnemonic,\n mnemonicKind: root.mnemonicKind,\n })\n const labels = labelMap.get(account.derivationPath)\n return { ...account, label: labels?.join(', ') ?? `shared[${sharedIndex}]` }\n }),\n )\n\n return {\n requestedActors: [...requestedActors],\n root,\n sharedAccounts,\n }\n}\n\nexport async function buildInsecureGenesisRewardAccounts(): Promise<ResolvedWalletMetadata[]> {\n const accounts = await Promise.all(\n Array.from({ length: SHARED_ACCOUNT_REPORT_COUNT }, (_, index) => index).map(async (sharedIndex) => {\n const account = await resolveWalletMetadata({\n accountPath: `${sharedIndex}`,\n actorName: 'genesisReward',\n mnemonic: INSECURE_GENESIS_REWARD_MNEMONIC,\n mnemonicKind: 'insecure-genesis-reward',\n })\n return { ...account, label: sharedIndex === 0 ? 'genesisRewardAddress' : `genesisReward[${sharedIndex}]` }\n }),\n )\n return accounts\n}\n\nexport async function initializeResolvedWalletReport(\n requestedActors: string[],\n configuration: RootMnemonicConfig,\n): Promise<ResolvedWalletReport> {\n activeWalletReport = await resolveWalletReport(requestedActors, configuration)\n return activeWalletReport\n}\n\nexport function getResolvedWalletReport(): ResolvedWalletReport | undefined {\n return activeWalletReport\n}\n\nfunction formatSharedAccount(account: ResolvedWalletMetadata, showPrivateKey: boolean) {\n const lines = [\n `[${account.accountPath}] ${account.label}`,\n `source: ${account.mnemonicKind === 'built-in-dev' ? 'built-in dev mnemonic' : 'configured root mnemonic'}`,\n `path: ${account.derivationPath}`,\n `address: ${account.address}`,\n ]\n if (showPrivateKey) lines.push(`privateKey: ${account.privateKey ?? 'unavailable'}`)\n return lines.join('\\n')\n}\n\nfunction formatGenesisRewardAccount(account: ResolvedWalletMetadata) {\n const balance = account.accountPath === '0' ? GENESIS_REWARD_AMOUNT / ATTO_XL1_PER_XL1 : 0n\n return [\n `[${account.accountPath}] ${account.label}`,\n `path: ${account.derivationPath}`,\n `address: ${account.address}`,\n `privateKey: ${account.privateKey ?? 'unavailable'}`,\n `balance: ${balance.toString()} XL1`,\n ].join('\\n')\n}\n\nexport function formatWalletReport(report: ResolvedWalletReport): string {\n const sections: string[] = []\n const showSecrets = report.root.isBuiltInDevMnemonic\n\n sections.push(showSecrets ? 'Development wallet detected.' : 'Wallet summary')\n\n if (showSecrets) {\n sections.push([\n 'DEVELOPMENT WALLET WARNING',\n '',\n 'XL1 is using the built-in development mnemonic.',\n 'This mnemonic is fixed, public, and does not change between runs.',\n 'The addresses and private keys below are unsafe and must never be used for real funds, production systems, or shared environments.',\n 'Anyone with this information can fully control these accounts.',\n '',\n 'Mnemonic:',\n report.root.mnemonic,\n ].join('\\n'))\n }\n\n sections.push([\n `Shared wallet accounts from ${report.root.basePath}:`,\n '',\n report.sharedAccounts.map(account => formatSharedAccount(account, showSecrets)).join('\\n\\n'),\n ].join('\\n'))\n\n return sections.join('\\n\\n')\n}\n\nexport function formatInsecureGenesisRewardWarning(accounts: ResolvedWalletMetadata[]): string {\n return [\n 'INSECURE GENESIS REWARD WALLET WARNING',\n '',\n 'XL1 is using a public, insecure fallback wallet for the genesis reward address.',\n 'This phrase is intentionally unsafe and must never be used for real funds, production systems, or shared environments.',\n 'Anyone with this information can fully control the genesis reward wallet.',\n '',\n 'Genesis reward phrase:',\n INSECURE_GENESIS_REWARD_MNEMONIC,\n '',\n `The genesis reward is sent to index 0 and starts with ${(GENESIS_REWARD_AMOUNT / ATTO_XL1_PER_XL1).toString()} XL1.`,\n '',\n `Genesis reward wallet accounts from ${DEFAULT_WALLET_PATH}:`,\n '',\n accounts.map(account => formatGenesisRewardAccount(account)).join('\\n\\n'),\n ].join('\\n')\n}\n\nexport async function resolveGenesisRewardAddress(config: Pick<Config, 'chain'>): Promise<Address> {\n if (config.chain.genesisRewardAddress) return config.chain.genesisRewardAddress\n const wallet = await generateXyoBaseWalletFromPhrase(INSECURE_GENESIS_REWARD_MNEMONIC)\n const account = await wallet.derivePath('0')\n return account.address\n}\n\nexport async function resolveWalletForActor(actorName: string, accountPath?: string): Promise<WalletInstance> {\n const report = activeWalletReport\n const mnemonic = report?.root.mnemonic ?? BUILT_IN_DEV_MNEMONIC\n const resolvedAccountPath = accountPath ?? resolveActorAccountPath(actorName)\n return await deriveWalletAtPath(mnemonic, resolvedAccountPath)\n}\n","import type { Address } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport type {\n AttachableArchivistInstance, AttachableModuleInstance, BridgeInstance, ModuleIdentifier,\n} from '@xyo-network/sdk-js'\nimport { asAttachableArchivistInstance, asAttachableModuleInstance } from '@xyo-network/sdk-js'\nimport { Mutex } from 'async-mutex'\n\nconst initMutex = new Mutex()\ntype ModuleDictionary = Record<ModuleIdentifier, AttachableModuleInstance | undefined>\ntype BridgedModuleDictionary = Record<Address, ModuleDictionary | undefined>\nconst bridgedModuleDictionary: BridgedModuleDictionary = {}\n\nexport async function initBridgedModule({ bridge, moduleName }: { bridge: BridgeInstance; moduleName: ModuleIdentifier }): Promise<AttachableModuleInstance> {\n return await initMutex.runExclusive(async () => {\n const existing = bridgedModuleDictionary?.[bridge.address]?.[moduleName]\n if (existing) return existing\n const mod = assertEx(await bridge.resolve(moduleName), () => `Could not resolve ${moduleName}`)\n const moduleInstance = assertEx(asAttachableModuleInstance(mod), () => `Could not convert ${moduleName} to attachable module instance`)\n // Initialize the nested dictionary if needed\n let moduleMap = bridgedModuleDictionary[bridge.address]\n if (moduleMap === undefined) {\n moduleMap = {}\n bridgedModuleDictionary[bridge.address] = moduleMap\n }\n // Store and return the module instance\n moduleMap[moduleName] = moduleInstance\n return moduleInstance\n })\n}\n\nexport async function initBridgedArchivistModule({ bridge, moduleName }: {\n bridge: BridgeInstance\n moduleName: ModuleIdentifier\n}): Promise<AttachableArchivistInstance> {\n return assertEx(\n asAttachableArchivistInstance(await initBridgedModule({ bridge, moduleName })),\n () => `Could not convert ${moduleName} to attachable archivist instance`,\n )\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { RuntimeStatusMonitor } from '@xyo-network/xl1-sdk'\n\nexport function initStatusReporter({ logger }: { logger: Logger }) {\n const statusReporter = new RuntimeStatusMonitor(logger)\n statusReporter.onGlobalTransition({ to: 'started' }, () => {\n logger.log('All services started.')\n })\n statusReporter.onGlobalTransition({ to: 'error' }, () => {\n logger.error('Producer encountered an unhandled error!')\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1)\n })\n return statusReporter\n}\n","import type { Promisable } from '@xylabs/sdk-js'\nimport { isDefined } from '@xylabs/sdk-js'\nimport type { WalletInstance } from '@xyo-network/wallet-model'\nimport type { ActorConfigContext } from '@xyo-network/xl1-sdk'\n\nimport { resolveWalletForActor } from './walletResolution.ts'\n\n/**\n * Process-global singleton cache, keyed by actor name. Preserves referential\n * identity of the resolved wallet across repeated calls (e.g. locator rebuilds\n * during tests) and avoids redundant HD-derivation work.\n */\nconst actorAccountSingletons: Record<string, Promisable<WalletInstance>> = {}\n\n/**\n * Resolve the `WalletInstance` for an actor, deriving it from the active\n * root mnemonic at the actor's configured account path.\n *\n * Memoized by `context.config.name` for the lifetime of the process.\n */\nexport async function initActorWallet(context: ActorConfigContext): Promise<WalletInstance> {\n const actorName = context.config.name\n if (isDefined(actorAccountSingletons[actorName])) return actorAccountSingletons[actorName]\n const accountPath = typeof context.config.accountPath === 'string' ? context.config.accountPath : undefined\n const account = await resolveWalletForActor(actorName, accountPath)\n context.logger?.debug(`[${actorName}] Using wallet address ${account.address}`)\n actorAccountSingletons[actorName] = account\n return actorAccountSingletons[actorName]\n}\n","import type { CreatableInstance } from '@xylabs/sdk-js'\nimport { AbstractCreatable, creatable } from '@xylabs/sdk-js'\n\nimport type { ActorInstanceV3, ReadyState } from '../actor/v3/index.ts'\nimport { ActorV3 } from '../actor/v3/index.ts'\n\nexport interface OrchestratorInstance extends CreatableInstance {\n readonly readyState: ReadyState\n isReady(): boolean\n isShuttingDown(): boolean\n registerActor(actor: ActorInstanceV3): Promise<void>\n whenReady(timeoutMs?: number): Promise<void>\n}\n\n@creatable()\nexport class Orchestrator extends AbstractCreatable implements OrchestratorInstance {\n protected actors: (ActorInstanceV3)[] = []\n protected running = false\n protected shuttingDown = false\n\n get readyState(): ReadyState {\n if (this.actors.length === 0) return 'pending'\n if (this.actors.some(a => isLocalActor(a) && a.readyState === 'failed')) return 'failed'\n if (this.actors.every(a => isLocalActor(a) && a.readyState === 'ready')) return 'ready'\n return 'pending'\n }\n\n isReady(): boolean {\n return this.readyState === 'ready' && !this.shuttingDown\n }\n\n isShuttingDown(): boolean {\n return this.shuttingDown\n }\n\n /**\n * Registers an actor.\n * (We won't activate the actor until `start()` is called.)\n */\n async registerActor(actor: ActorInstanceV3) {\n this.actors.push(actor)\n if (this.running) {\n // Already running — bring this actor up immediately and trigger its ready handler.\n await actor.start()\n if (isLocalActor(actor)) {\n actor.runReadyHandler().catch((err: unknown) => {\n this.logger?.error(`[Orchestrator] Actor [${actor.name}] readyHandler failed: ${formatError(err)}`)\n })\n }\n }\n }\n\n /**\n * Starts the orchestrator: activates all actors in parallel and kicks off their warm-pass.\n * `whenReady()` resolves once every actor's `readyHandler` has succeeded.\n */\n override async startHandler() {\n await super.startHandler()\n if (this.running) {\n this.logger?.warn('[Orchestrator] Already started.')\n return\n }\n\n this.logger?.log(`[Orchestrator] Starting ${this.actors.length} actor(s) in parallel...`)\n this.running = true\n\n const startResults = await Promise.allSettled(this.actors.map(a => a.start()))\n const startFailures = startResults.flatMap((r, i) => (r.status === 'rejected' ? [{ actor: this.actors[i], reason: r.reason as unknown }] : []))\n if (startFailures.length > 0) {\n for (const f of startFailures) this.logger?.error(`[Orchestrator] Actor [${f.actor?.name ?? '?'}] failed to start: ${formatError(f.reason)}`)\n throw new Error(`[Orchestrator] ${startFailures.length} actor(s) failed to start`)\n }\n\n // Kick off readyHandlers in parallel; do not await — `whenReady()` is the join point.\n for (const actor of this.actors) {\n if (isLocalActor(actor)) {\n actor.runReadyHandler().catch((err: unknown) => {\n this.logger?.error(`[Orchestrator] Actor [${actor.name}] readyHandler failed: ${formatError(err)}`)\n })\n }\n }\n }\n\n /**\n * Stops the orchestrator: deactivates all actors.\n */\n override async stopHandler() {\n await super.stopHandler()\n if (!this.running) {\n this.logger?.log('[Orchestrator] Already stopped.')\n return\n }\n\n this.logger?.log('[Orchestrator] Stopping...')\n this.shuttingDown = true\n await Promise.allSettled(this.actors.map(a => a.stop()))\n this.running = false\n this.shuttingDown = false\n this.logger?.log('[Orchestrator] Stopped.')\n }\n\n /**\n * Resolves once every actor reports ready. Rejects if any actor's `readyHandler` throws,\n * or after `timeoutMs` if provided.\n */\n async whenReady(timeoutMs?: number): Promise<void> {\n const localActors = this.actors.filter(isLocalActor)\n if (localActors.length === 0) return\n if (timeoutMs === undefined) {\n await Promise.all(localActors.map(a => a.whenReady()))\n return\n }\n let timer: NodeJS.Timeout | undefined\n const timeout = new Promise<never>((_, reject) => {\n timer = setTimeout(() => {\n reject(new Error(`[Orchestrator] Not ready within ${timeoutMs}ms`))\n }, timeoutMs)\n })\n try {\n await Promise.race([Promise.all(localActors.map(a => a.whenReady())), timeout])\n } finally {\n if (timer) clearTimeout(timer)\n }\n }\n}\n\nfunction isLocalActor(actor: ActorInstanceV3): actor is ActorInstanceV3 & ActorV3 {\n return actor instanceof ActorV3\n}\n\nfunction formatError(err: unknown): string {\n if (err instanceof Error) return `${err.message}${err.stack ? `\\n${err.stack}` : ''}`\n return String(err)\n}\n","import { assertEx } from '@xylabs/sdk-js'\nimport type { ArchivistInstance } from '@xyo-network/sdk-js'\nimport type { CreatableProviderParams } from '@xyo-network/xl1-sdk'\nimport { AbstractCreatableProvider, creatableProvider } from '@xyo-network/xl1-sdk'\n\n/**\n * Moniker used to resolve a SimpleRejectedTransactionsArchivistProvider\n * from a ProviderFactoryLocator. Actor-local locators (e.g. the producer)\n * resolve this from the root locator to reuse the shared rejected-transactions\n * archivist that the DLQ runner and viewer also write to.\n */\nexport const RejectedTransactionsArchivistProviderMoniker = 'RejectedTransactionsArchivistProvider'\n\n/**\n * Parameters for SimpleRejectedTransactionsArchivistProvider.\n */\nexport interface SimpleRejectedTransactionsArchivistProviderParams extends CreatableProviderParams {\n archivist: ArchivistInstance\n}\n\n/**\n * Pass-through provider that exposes the shared rejected-transactions\n * archivist under a locator moniker so downstream actor locators can\n * reuse the same backing store rather than constructing their own\n * ephemeral MemoryArchivist.\n */\n@creatableProvider()\nexport class SimpleRejectedTransactionsArchivistProvider extends AbstractCreatableProvider<SimpleRejectedTransactionsArchivistProviderParams> {\n static readonly defaultMoniker = RejectedTransactionsArchivistProviderMoniker\n static readonly dependencies: string[] = []\n static readonly monikers = [RejectedTransactionsArchivistProviderMoniker]\n\n moniker = SimpleRejectedTransactionsArchivistProvider.defaultMoniker\n\n get archivist(): ArchivistInstance {\n return this.params.archivist\n }\n\n static override async paramsHandler(\n params?: Partial<SimpleRejectedTransactionsArchivistProviderParams>,\n ): Promise<SimpleRejectedTransactionsArchivistProviderParams> {\n return {\n ...(await super.paramsHandler(params)),\n archivist: assertEx(params?.archivist, () => 'archivist is required'),\n }\n }\n}\n","import type {\n BlockValidators,\n RemoteConfig, RpcTransport, XyoSignerRpcSchemas,\n} from '@xyo-network/xl1-sdk'\nimport { basicRemoteRunnerLocator as sdkBasicRemoteRunnerLocator } from '@xyo-network/xl1-sdk'\n\n/** @deprecated Use basicRemoteRunnerLocator from \\@xyo-network/xl1-providers instead */\nexport function basicRemoteRunnerLocator(\n name: string,\n remoteConfig: RemoteConfig,\n signerTransport: RpcTransport<XyoSignerRpcSchemas>,\n dataLakeEndpoint?: string,\n validators?: BlockValidators,\n) {\n return sdkBasicRemoteRunnerLocator(name, remoteConfig, signerTransport, dataLakeEndpoint, { validators })\n}\n","import type { BlockValidators, RemoteConfig } from '@xyo-network/xl1-sdk'\nimport { basicRemoteViewerLocator as sdkBasicRemoteViewerLocator } from '@xyo-network/xl1-sdk'\n\n/** @deprecated Use basicRemoteViewerLocator from \\@xyo-network/xl1-providers instead */\nexport function basicRemoteViewerLocator(\n name: string,\n remoteConfig: RemoteConfig,\n dataLakeEndpoint?: string,\n validators?: BlockValidators,\n) {\n return sdkBasicRemoteViewerLocator(name, remoteConfig, dataLakeEndpoint, { validators })\n}\n","import { assertEx } from '@xylabs/sdk-js'\nimport type { ActorConfigContext, ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk'\nimport { commonLocatorFromConfig, remoteLocatorFromConfig } from '@xyo-network/xl1-sdk'\n\n/** @deprecated Use rootLocatorFromConfig from \\@xyo-network/xl1-providers instead */\nexport async function rootLocatorFromConfig(\n context: ActorConfigContext,\n validateDepsOnRegister = false,\n): Promise<ProviderFactoryLocatorInstance> {\n const { config } = context\n await commonLocatorFromConfig(context, validateDepsOnRegister)\n const locator = assertEx(\n await (config.remote.rpc ? remoteLocatorFromConfig(context, validateDepsOnRegister) : undefined),\n () => 'Root locator could not be created from config. No supported configuration found.',\n )\n locator.freeze()\n return locator\n}\n"],"mappings":";;;;AAOA,SACEA,mBAAm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,OAAgBC,iBAAiBH;EACjC,OAAgBI,eAAyB,CAAA;EACzC,OAAgBC,WAAW;IAACL;;EAE5BM,UAAUL,6CAA4CE;EAEtD,IAAII,YAA+B;AACjC,WAAO,KAAKC,OAAOD;EACrB;EAEA,aAAsBE,cACpBD,QAC4D;AAC5D,WAAO;MACL,GAAI,MAAM,MAAMC,cAAcD,MAAAA;MAC9BD,WAAWG,UAASF,QAAQD,WAAW,MAAM,uBAAA;IAC/C;EACF;AACF;;;;;;AC1CA,SAASI,4BAA4BC,mCAAmC;AAGjE,SAASC,yBACdC,MACAC,cACAC,iBACAC,kBACAC,YAA4B;AAE5B,SAAOC,4BAA4BL,MAAMC,cAAcC,iBAAiBC,kBAAkB;IAAEC;EAAW,CAAA;AACzG;AARgBL;;;ACNhB,SAASO,4BAA4BC,mCAAmC;AAGjE,SAASC,yBACdC,MACAC,cACAC,kBACAC,YAA4B;AAE5B,SAAOC,4BAA4BJ,MAAMC,cAAcC,kBAAkB;IAAEC;EAAW,CAAA;AACxF;AAPgBJ;;;ACJhB,SAASM,YAAAA,iBAAgB;AAEzB,SAASC,yBAAyBC,+BAA+B;AAGjE,eAAsBC,sBACpBC,SACAC,yBAAyB,OAAK;AAE9B,QAAM,EAAEC,OAAM,IAAKF;AACnB,QAAMG,wBAAwBH,SAASC,sBAAAA;AACvC,QAAMG,UAAUC,UACd,OAAOH,OAAOI,OAAOC,MAAMC,wBAAwBR,SAASC,sBAAAA,IAA0BQ,SACtF,MAAM,kFAAA;AAERL,UAAQM,OAAM;AACd,SAAON;AACT;AAZsBL;","names":["AbstractCreatable","assertEx","delay","IdLogger","Semaphore","z","noopCounter","add","noopUpDownCounter","noopGauge","record","noopHistogram","CreatableNameZod","z","custom","val","length","StatusReporterInstanceZod","AccountInstanceZod","ActorParamsV3Zod","object","account","locator","unknown","name","statusReporter","optional","createDeferred","resolve","reject","promise","Promise","res","rej","ActorV3","AbstractCreatable","_intervals","Map","_semaphores","_timeouts","_logger","_readyDeferred","_readyError","_readyState","logger","IdLogger","assertEx","context","readyError","readyState","params","paramsHandler","baseParams","registerTimer","timerName","callback","dueTimeMs","periodMs","status","warn","running","set","Semaphore","timeoutId","setTimeout","intervalId","setInterval","semaphore","get","has","isLocked","acquire","then","release","startTime","Date","now","duration","catch","error","err","Error","String","message","stack","finally","debug","runReadyHandler","readyHandler","stopHandler","all","values","map","delay","clear","timeoutRef","entries","clearTimeout","intervalRef","clearInterval","whenReady","timeoutMs","undefined","timer","timeout","_","race","counter","description","meter","createCounter","gauge","createGauge","histogram","createHistogram","upDownCounter","createUpDownCounter","Actor","buildTelemetryConfig","config","serviceName","serviceVersion","defaultMetricsScrapePort","otlpEndpoint","telemetry","otel","path","endpoint","port","metrics","scrape","telemetryConfig","attributes","metricsConfig","zodAsFactory","zodIsFactory","zodToFactory","BaseConfigContextZod","HostActorConfigZod","globalRegistry","z","ApiConfigZod","extend","object","initRewardsCache","union","number","string","boolean","transform","v","default","register","description","title","type","stateless","legacyMixedRpc","shape","isApiConfig","asApiConfig","toApiConfig","ApiConfigContext","config","isApiConfigContext","asApiConfigContext","toApiConfigContext","AddressZod","HexZod","toAddress","toHex","zodAsFactory","zodIsFactory","zodToFactory","AttoXL1ConvertFactor","BaseConfigContextZod","HostActorConfigZod","XL1","globalRegistry","z","DEFAULT_FIXED_FEE","xl1","DEFAULT_VARIABLE_FEE_BASIS_POINTS","DEFAULT_HARDHAT_BRIDGE_CONTRACT","DEFAULT_HARDHAT_CHAIN_ID","DEFAULT_HARDHAT_REMOTE_CHAIN_WALLET_PRIVATE_KEY","DEFAULT_HARDHAT_TOKEN_CONTRACT","DEFAULT_MAX_BRIDGE_AMOUNT","DEFAULT_MIN_BRIDGE_AMOUNT","DEFAULT_SCANNER_INTERVAL_MS","BasisPointsZod","coerce","number","int","nonnegative","max","BridgeConfigZod","extend","escrowAddress","optional","register","description","title","type","feesAddress","feeFixed","default","feeRateBasisPoints","maxBridgeAmount","minBridgeAmount","redisHost","string","redisPort","positive","scannerIntervalMs","remoteBridgeContractAddress","remoteChainId","remoteConfirmationDepth","union","literal","remoteTokenAddress","remoteChainWalletPrivateKey","xl1ChainId","xl1TokenAddress","BridgeSettingsZod","pick","required","isBridgeConfig","asBridgeConfig","toBridgeConfig","BridgeConfigContext","config","isBridgeConfigContext","asBridgeConfigContext","toBridgeConfigContext","AddressZod","zodAsFactory","zodIsFactory","zodToFactory","BaseConfigContextZod","DEFAULT_MIN_CANDIDATES","HostActorConfigZod","z","FinalizerConfigZod","extend","allowedProducers","array","optional","finalizationCheckInterval","coerce","number","default","minCandidates","int","min","isFinalizerConfig","asFinalizerConfig","toFinalizerConfig","FinalizerConfigContext","config","isFinalizerConfigContext","asFinalizerConfigContext","toFinalizerConfigContext","zodAsFactory","zodIsFactory","zodToFactory","BaseConfigContextZod","HostActorConfigZod","globalRegistry","z","DEFAULT_MEMPOOL_BLOCK_PRUNE_INTERVAL","DEFAULT_MEMPOOL_TRANSACTION_PRUNE_INTERVAL","MempoolConfigZod","extend","enabled","union","string","boolean","default","transform","val","ctx","normalized","toLowerCase","trim","includes","addIssue","code","expected","message","NEVER","register","description","title","type","blockPruneInterval","coerce","number","transactionPruneInterval","isMempoolConfig","asMempoolConfig","toMempoolConfig","MempoolConfigContext","config","isMempoolConfigContext","asMempoolConfigContext","toMempoolConfigContext","AddressZod","zodAsFactory","zodIsFactory","zodToFactory","ActorConfigZod","BaseConfigContextZod","globalRegistry","z","DEFAULT_BLOCK_PRODUCTION_CHECK_INTERVAL","ProducerConfigZod","extend","object","allowlist","array","optional","register","description","title","type","blockProductionCheckInterval","coerce","number","default","disableIntentRedeclaration","boolean","heartbeatInterval","minStake","rewardAddress","string","shape","isProducerConfig","asProducerConfig","toProducerConfig","ProducerConfigContext","config","isProducerConfigContext","asProducerConfigContext","toProducerConfigContext","zodAsFactory","zodIsFactory","zodToFactory","BaseConfigContextZod","HostActorConfigZod","RewardRedemptionConfigZod","extend","isRewardRedemptionConfig","asRewardRedemptionConfig","toRewardRedemptionConfig","RewardRedemptionConfigContext","config","isRewardRedemptionConfigContext","asRewardRedemptionConfigContext","toRewardRedemptionConfigContext","deepMerge","mergeConfig","actors","baseConfig","map","actor","deepMerge","buildNextBlock","createDeclarationIntent","createProducerChainStakeIntentBlock","prevBlock","producerAccount","range","producerDeclarationPayload","createDeclarationIntent","address","buildNextBlock","GenericHost","services","start","Promise","resolve","console","log","stop","DefaultServiceProvider","_services","services","getService","serviceIdentifier","ServiceLifetime","Singleton","Transient","assertEx","isString","HDWallet","DEFAULT_WALLET_PATH","generateXyoBaseWalletFromPhrase","HDNodeWallet","Mnemonic","DEFAULT_ACTOR_ACCOUNT_PATH","api","bridge","finalizer","mempool","producer","rewardRedemption","BUILT_IN_DEV_MNEMONIC","INSECURE_GENESIS_REWARD_MNEMONIC","GENESIS_REWARD_AMOUNT","ATTO_XL1_PER_XL1","ROOT_WALLET_RUNTIME_ID","SHARED_ACCOUNT_REPORT_COUNT","ACTOR_LABELS","activeWalletReport","getAccountLabel","actorName","clearResolvedWalletReport","undefined","resolveActorAccountPath","actorConfig","accountPath","isAbsoluteAccountPath","startsWith","expandAccountPath","basePath","DEFAULT_WALLET_PATH","deriveWalletAtPath","mnemonic","seed","Mnemonic","fromPhrase","computeSeed","rootNode","HDNodeWallet","fromSeed","derivedNode","derivePath","HDWallet","createFromNode","baseWallet","generateXyoBaseWalletFromPhrase","getBuiltInDevMnemonic","getInsecureGenesisRewardMnemonic","resolveRootWallet","configuration","isConfigured","isBuiltInDevMnemonic","mnemonicKind","resolveWalletMetadata","account","address","derivationPath","label","privateKey","usesBuiltInDevMnemonic","resolveActorWallet","root","ActorMnemonicNotAllowedError","Error","actors","join","name","assertNoActorMnemonics","offenders","filter","actor","map","length","DerivationPathCollisionError","collisions","lines","Object","entries","path","detectDerivationPathCollisions","requestedActors","actorConfigMap","Map","bucketsByPath","get","fullPath","bucket","push","set","keys","resolveWalletReport","resolvedActors","Promise","all","labelMap","labels","sharedAccounts","Array","from","_","index","sharedIndex","buildInsecureGenesisRewardAccounts","accounts","initializeResolvedWalletReport","getResolvedWalletReport","formatSharedAccount","showPrivateKey","formatGenesisRewardAccount","balance","toString","formatWalletReport","report","sections","showSecrets","formatInsecureGenesisRewardWarning","resolveGenesisRewardAddress","config","chain","genesisRewardAddress","wallet","resolveWalletForActor","resolvedAccountPath","initActorSeedPhrase","context","bios","logger","config","walletKind","name","report","getResolvedWalletReport","isString","root","mnemonic","fallback","getBuiltInDevMnemonic","debug","assertEx","assertEx","asAttachableArchivistInstance","asAttachableModuleInstance","Mutex","initMutex","Mutex","bridgedModuleDictionary","initBridgedModule","bridge","moduleName","runExclusive","existing","address","mod","assertEx","resolve","moduleInstance","asAttachableModuleInstance","moduleMap","undefined","initBridgedArchivistModule","asAttachableArchivistInstance","RuntimeStatusMonitor","initStatusReporter","logger","statusReporter","RuntimeStatusMonitor","onGlobalTransition","to","log","error","process","exit","isDefined","actorAccountSingletons","initActorWallet","context","actorName","config","name","isDefined","accountPath","undefined","account","resolveWalletForActor","logger","debug","address","AbstractCreatable","creatable","Orchestrator","AbstractCreatable","actors","running","shuttingDown","readyState","length","some","a","isLocalActor","every","isReady","isShuttingDown","registerActor","actor","push","start","runReadyHandler","catch","err","logger","error","name","formatError","startHandler","warn","log","startResults","Promise","allSettled","map","startFailures","flatMap","r","i","status","reason","f","Error","stopHandler","stop","whenReady","timeoutMs","localActors","filter","undefined","all","timer","timeout","_","reject","setTimeout","race","clearTimeout","ActorV3","message","stack","String","assertEx","AbstractCreatableProvider","creatableProvider","RejectedTransactionsArchivistProviderMoniker","SimpleRejectedTransactionsArchivistProvider","AbstractCreatableProvider","defaultMoniker","dependencies","monikers","moniker","archivist","params","paramsHandler","assertEx","basicRemoteRunnerLocator","sdkBasicRemoteRunnerLocator","basicRemoteRunnerLocator","name","remoteConfig","signerTransport","dataLakeEndpoint","validators","sdkBasicRemoteRunnerLocator","basicRemoteViewerLocator","sdkBasicRemoteViewerLocator","basicRemoteViewerLocator","name","remoteConfig","dataLakeEndpoint","validators","sdkBasicRemoteViewerLocator","assertEx","commonLocatorFromConfig","remoteLocatorFromConfig","rootLocatorFromConfig","context","validateDepsOnRegister","config","commonLocatorFromConfig","locator","assertEx","remote","rpc","remoteLocatorFromConfig","undefined","freeze"]}
|
|
1
|
+
{"version":3,"sources":["../../src/shared/actor/v3/ActorV3.ts","../../src/shared/buildTelemetryConfig.ts","../../src/shared/config/actors/Api.ts","../../src/shared/config/actors/Bridge.ts","../../src/shared/config/actors/Finalizer.ts","../../src/shared/config/actors/Mempool.ts","../../src/shared/config/actors/Producer.ts","../../src/shared/config/actors/RewardRedemption.ts","../../src/shared/config/mergeConfig.ts","../../src/shared/createDeclarationIntentBlock.ts","../../src/shared/host/implementation/DefaultHost.ts","../../src/shared/host/implementation/DefaultServiceProvider.ts","../../src/shared/host/model/ServiceCollection.ts","../../src/shared/init/initActorSeedPhrase.ts","../../src/shared/init/walletResolution.ts","../../src/shared/init/initBridgedModule.ts","../../src/shared/init/initStatusReporter.ts","../../src/shared/init/initWallet.ts","../../src/shared/orchestrator/Orchestrator.ts","../../src/shared/provider/SimpleRejectedTransactionsArchivistProvider.ts","../../src/neutral/config/locators/basicRemoteRunnerLocator.ts","../../src/neutral/config/locators/basicRemoteViewerLocator.ts","../../src/neutral/config/locators/rootLocatorFromConfig.ts"],"sourcesContent":["import type {\n Counter, Gauge, Histogram, UpDownCounter,\n} from '@opentelemetry/api'\nimport type {\n CreatableInstance, CreatableName, CreatableParams,\n CreatableStatusReporter, EmptyObject, Logger,\n} from '@xylabs/sdk-js'\nimport {\n AbstractCreatable, assertEx, delay, IdLogger,\n} from '@xylabs/sdk-js'\nimport type { AccountInstance } from '@xyo-network/sdk-js'\nimport type { CreatableProviderContextType, ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk'\nimport { Semaphore } from 'async-mutex'\nimport z from 'zod'\n\n/**\n * No-op `Counter` returned when `this.meter` is unavailable. Lets call sites\n * drop the optional-chain on `.add()` without checking whether instrumentation\n * is wired.\n */\n/* eslint-disable @typescript-eslint/no-empty-function */\nconst noopCounter: Counter = { add: () => {} }\nconst noopUpDownCounter: UpDownCounter = { add: () => {} }\nconst noopGauge: Gauge = { record: () => {} }\nconst noopHistogram: Histogram = { record: () => {} }\n/* eslint-enable @typescript-eslint/no-empty-function */\n\nconst CreatableNameZod = z.custom<CreatableName>(val => typeof val === 'string' && val.length > 0)\nconst StatusReporterInstanceZod = z.custom<CreatableStatusReporter<void>>(\n val => val !== null && typeof val === 'object' && 'report' in (val as Record<string, unknown>),\n)\nconst AccountInstanceZod = z.custom<AccountInstance>(\n val => val !== null && typeof val === 'object' && 'address' in (val as Record<string, unknown>),\n)\n\nexport const ActorParamsV3Zod = z.object({\n account: AccountInstanceZod,\n locator: z.unknown(),\n name: CreatableNameZod,\n statusReporter: StatusReporterInstanceZod.optional(),\n})\n\nexport type ActorParamsV3<T extends EmptyObject | void = void> = CreatableParams & {\n account: AccountInstance\n locator: ProviderFactoryLocatorInstance\n} & (T extends void ? EmptyObject : T)\n\nexport type ActorInstanceV3<T extends ActorParamsV3 = ActorParamsV3> = CreatableInstance<T>\n\nexport type ReadyState = 'pending' | 'ready' | 'failed'\n\nexport interface ReadinessSignal {\n readonly readyError?: Error\n readonly readyState: ReadyState\n whenReady(timeoutMs?: number): Promise<void>\n}\n\n/**\n * Declarative description of the providers an actor needs from a locator.\n * Surfaced as `static readonly needs` on each `ActorV3` subclass; consumed\n * by `locatorFromActorNeeds` to plan which providers to register in a\n * shared per-process locator.\n *\n * `required` monikers must resolve or boot fails fast.\n * `optional` monikers are looked up via `tryGetInstance` and tolerate absence.\n */\nexport interface ActorCapabilityNeeds {\n readonly optional?: readonly string[]\n readonly required: readonly string[]\n}\n\ninterface Deferred<T> {\n promise: Promise<T>\n reject: (reason: unknown) => void\n resolve: (value: T) => void\n}\n\nfunction createDeferred<T>(): Deferred<T> {\n let resolve!: (value: T) => void\n let reject!: (reason: unknown) => void\n const promise = new Promise<T>((res, rej) => {\n resolve = res\n reject = rej\n })\n return {\n promise, resolve, reject,\n }\n}\n\n/**\n * In-repo fork of `ActorV3` from `@xyo-network/xl1-sdk`, extended with a\n * readiness contract.\n *\n * - `start()` (inherited from `AbstractCreatable`) brings up machinery: timers\n * registered, servers bound. Status transitions to `started`.\n * - `runReadyHandler()` is invoked by the `Orchestrator` after `start()` to\n * run a warm-pass via `readyHandler()`. Subclasses override `readyHandler`\n * if they need to prove they can do useful work (first block produced,\n * first finalization pass, first prune, etc).\n * - `whenReady()` resolves once `readyHandler` resolves; rejects on warm-pass\n * failure.\n */\nexport abstract class ActorV3<TParams extends ActorParamsV3 = ActorParamsV3>\n extends AbstractCreatable<TParams>\n implements ReadinessSignal {\n protected readonly _intervals = new Map<string, NodeJS.Timeout>()\n protected readonly _semaphores = new Map<string, Semaphore>()\n protected readonly _timeouts = new Map<string, NodeJS.Timeout>()\n\n private _logger?: Logger\n private _readyDeferred = createDeferred<void>()\n private _readyError?: Error\n private _readyState: ReadyState = 'pending'\n\n override get logger(): Logger {\n this._logger = new IdLogger(\n assertEx(this.context.logger, () => `Logger is required in context for actor ${this.name}.`),\n () => this.name,\n )\n return this._logger\n }\n\n get readyError(): Error | undefined {\n return this._readyError\n }\n\n get readyState(): ReadyState {\n return this._readyState\n }\n\n protected get account(): AccountInstance {\n return this.params.account\n }\n\n protected get context(): CreatableProviderContextType {\n return this.locator.context\n }\n\n protected get locator(): ProviderFactoryLocatorInstance {\n return this.params.locator\n }\n\n static override async paramsHandler<T extends ActorInstanceV3>(\n params: Partial<T['params']>,\n ): Promise<T['params']> {\n const baseParams = await super.paramsHandler(\n { ...params, name: params.name ?? 'UnknownActor' },\n ) as T['params']\n const account = assertEx(params.account, () => `params.account is required for actor ${baseParams.name}.`)\n const locator = assertEx(params.locator, () => `params.locator is required for actor ${baseParams.name}.`)\n return {\n ...baseParams, account, locator,\n } as T['params']\n }\n\n /**\n * The timer runs until the actor is deactivated (or you manually stop it).\n */\n registerTimer(timerName: string, callback: () => Promise<void>, dueTimeMs: number, periodMs: number): void {\n if (this.status !== 'starting') {\n this.logger?.warn(`Cannot register timer '${timerName}' because actor is not starting.`)\n return\n }\n let running = false\n this._semaphores.set(timerName, new Semaphore(1))\n const timeoutId = setTimeout(() => {\n const intervalId = setInterval(() => {\n const semaphore = this._semaphores.get(timerName)\n if (this.status !== 'started' || !this._intervals.has(timerName) || !semaphore || running) return\n if (semaphore.isLocked()) {\n this.logger?.warn(`Skipping timer '${this.name}:${timerName}' execution because previous execution is still running.`)\n return\n }\n semaphore.acquire().then(([, release]) => {\n const startTime = Date.now()\n running = true\n callback().then(() => {\n const duration = Date.now() - startTime\n if (duration > periodMs) {\n this.logger?.warn(`Timer '${this.name}:${timerName}' execution took longer (${duration}ms) than the period (${periodMs}ms).`)\n } else if (duration > 5000) {\n this.logger?.warn(`Timer '${this.name}:${timerName}' execution took longer (${duration}ms) than 5000ms.`)\n }\n }).catch((error: unknown) => {\n const err = error instanceof Error ? error : new Error(String(error))\n this.logger?.error(`Error in timer '${this.name}:${timerName}': ${err.message}`)\n if (err.stack) this.logger?.error(err.stack)\n }).finally(() => {\n release()\n running = false\n })\n }).catch((error: unknown) => {\n const err = error instanceof Error ? error : new Error(String(error))\n this.logger?.error(`Error acquiring semaphore for timer '${this.name}:${timerName}': ${err.message}`)\n })\n }, periodMs)\n this._intervals.set(timerName, intervalId)\n }, dueTimeMs)\n this._timeouts.set(timerName, timeoutId)\n this.logger?.debug(`Timer '${this.name}:${timerName}' registered: first call after ${dueTimeMs}ms, recurring every ${periodMs}ms.`)\n }\n\n /**\n * Invoked by the Orchestrator after `start()` to run the warm-pass.\n * Idempotent: returns immediately if already invoked.\n * Throws if `readyHandler` throws; resolves once `readyHandler` resolves.\n */\n async runReadyHandler(): Promise<void> {\n if (this._readyState !== 'pending') return\n try {\n await this.readyHandler()\n this._readyState = 'ready'\n this._readyDeferred.resolve()\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n this._readyState = 'failed'\n this._readyError = error\n this._readyDeferred.reject(error)\n throw error\n }\n }\n\n override async stopHandler(): Promise<void> {\n await super.stopHandler()\n this.logger?.debug('Stopping all timers...')\n await Promise.all(\n [...this._semaphores.values()].map(async (semaphore) => {\n while (semaphore.isLocked()) {\n this.logger?.debug('Waiting for running timer task to complete...')\n await delay(500)\n }\n await semaphore.acquire()\n }),\n )\n this._semaphores.clear()\n for (const [, timeoutRef] of this._timeouts.entries()) {\n clearTimeout(timeoutRef)\n }\n this._timeouts.clear()\n for (const [, intervalRef] of this._intervals.entries()) {\n clearInterval(intervalRef)\n }\n this._intervals.clear()\n this.logger?.debug('Stopped.')\n }\n\n async whenReady(timeoutMs?: number): Promise<void> {\n if (timeoutMs === undefined) {\n await this._readyDeferred.promise\n return\n }\n let timer: NodeJS.Timeout | undefined\n const timeout = new Promise<never>((_, reject) => {\n timer = setTimeout(() => {\n reject(new Error(`Actor ${this.name} did not become ready within ${timeoutMs}ms`))\n }, timeoutMs)\n })\n try {\n await Promise.race([this._readyDeferred.promise, timeout])\n } finally {\n if (timer) clearTimeout(timer)\n }\n }\n\n /**\n * Create a `Counter` instrument bound to this actor's meter, or a no-op\n * stub if telemetry is not wired. Always returns a non-undefined value so\n * call sites can drop the optional-chain on `.add()`.\n *\n * TODO: in a future pass, consider folding these single-instrument helpers\n * into a declarative `createActorMeters({ counters: {...}, gauges: {...} })`\n * spec API for actors with many instruments.\n */\n protected counter(name: string, description: string): Counter {\n return this.meter?.createCounter(name, { description }) ?? noopCounter\n }\n\n /** Create a synchronous `Gauge` instrument, or a no-op stub if telemetry is not wired. */\n protected gauge(name: string, description: string): Gauge {\n return this.meter?.createGauge(name, { description }) ?? noopGauge\n }\n\n /** Create a `Histogram` instrument, or a no-op stub if telemetry is not wired. */\n protected histogram(name: string, description: string): Histogram {\n return this.meter?.createHistogram(name, { description }) ?? noopHistogram\n }\n\n /**\n * Override in subclasses to prove the actor can do useful work.\n * Default: no-op (the actor declares itself ready as soon as `start()` returns).\n */\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n protected async readyHandler(): Promise<void> {}\n\n /** Create an `UpDownCounter` instrument, or a no-op stub if telemetry is not wired. */\n protected upDownCounter(name: string, description: string): UpDownCounter {\n return this.meter?.createUpDownCounter(name, { description }) ?? noopUpDownCounter\n }\n}\n\nexport abstract class Actor<TParams extends ActorParamsV3 = ActorParamsV3> extends ActorV3<TParams> {}\n","import type { Config } from '@xyo-network/xl1-sdk'\n\nexport function buildTelemetryConfig(config: Config, serviceName: string, serviceVersion: string, defaultMetricsScrapePort = 9464) {\n const { otlpEndpoint } = config.telemetry?.otel ?? {}\n const { path: endpoint = '/metrics', port = defaultMetricsScrapePort } = config.telemetry?.metrics?.scrape ?? {}\n const telemetryConfig = {\n attributes: { serviceName, serviceVersion }, otlpEndpoint, metricsConfig: { endpoint, port },\n }\n return telemetryConfig\n}\n","import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport type { BaseConfigContext } from '@xyo-network/xl1-sdk'\nimport { BaseConfigContextZod, HostActorConfigZod } from '@xyo-network/xl1-sdk'\nimport { globalRegistry, z } from 'zod'\n\nexport const ApiConfigZod = HostActorConfigZod.extend(z.object({\n initRewardsCache: z.union([z.number(), z.string(), z.boolean()]).transform(\n v => v !== '0' && v !== 'false' && v !== false && v != 0,\n ).default(true).register(globalRegistry, {\n description: 'Whether to initialize the rewards cache on startup',\n title: 'api.initRewardsCache',\n type: 'boolean',\n }),\n /**\n * When `true`, the API actor runs in stateless mode: it holds no local\n * backing-store ownership, never loads the local LMDB/MongoDB node, and\n * federates every JSON-RPC request to upstream owner-actors via `JsonRpc*`\n * providers. Multiple stateless API instances can run behind a load\n * balancer for horizontal scaling. Requires `remote.rpc` to point at the\n * upstream API/Finalizer/Mempool/Indexer surfaces.\n */\n stateless: z.union([z.number(), z.string(), z.boolean()]).transform(\n v => v === '1' || v === 'true' || v === true || v == 1,\n ).default(false).register(globalRegistry, {\n description: 'Run the API actor as a stateless federation node (availableBackings: [network])',\n title: 'api.stateless',\n type: 'boolean',\n }),\n /**\n * Back-compat for the surface-aware route split. When `true`, `POST /rpc`\n * serves the full `XyoConnection` (both node-surface and indexed-surface\n * methods), preserving pre-Phase-7 behavior for clients that haven't yet\n * migrated to `POST /rpc/indexed`. When `false`, `/rpc` is strictly\n * node-surface only and indexed methods are 404 at `/rpc`.\n *\n * `/rpc/indexed` mounts independently of this flag whenever the locator's\n * connection has any indexed branch.\n *\n * Default `true` for the first release that includes Phase 7 — flip to\n * `false` per environment once external clients (explorers, wallets, dApps)\n * have moved their indexed-method calls to `/rpc/indexed`.\n */\n legacyMixedRpc: z.union([z.number(), z.string(), z.boolean()]).transform(\n v => v !== '0' && v !== 'false' && v !== false && v != 0,\n ).default(true).register(globalRegistry, {\n description: 'Serve the full XyoConnection at POST /rpc (no surface filter). Set false to enforce node-surface-only at /rpc; indexed methods always available at /rpc/indexed regardless.',\n title: 'api.legacyMixedRpc',\n type: 'boolean',\n }),\n}).shape)\n\nexport type ApiConfig = z.infer<typeof ApiConfigZod>\n\nexport const isApiConfig = zodIsFactory(ApiConfigZod)\nexport const asApiConfig = zodAsFactory(ApiConfigZod, 'asApiConfig')\nexport const toApiConfig = zodToFactory(ApiConfigZod, 'toApiConfig')\n\nexport interface ApiConfigContext extends Omit<BaseConfigContext, 'config'> {\n config: ApiConfig\n}\n\nexport const ApiConfigContext: z.ZodType<ApiConfigContext> = BaseConfigContextZod.extend({ config: ApiConfigZod })\n\nexport const isApiConfigContext: <T>(value: T) => value is T & ApiConfigContext = zodIsFactory(ApiConfigContext)\nexport const asApiConfigContext: ReturnType<typeof zodAsFactory<ApiConfigContext>> = zodAsFactory(ApiConfigContext, 'asApiConfigContext')\nexport const toApiConfigContext: ReturnType<typeof zodToFactory<ApiConfigContext>> = zodToFactory(ApiConfigContext, 'toApiConfigContext')\n","import {\n AddressZod, HexZod, toAddress, toHex, zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport type { BaseConfigContext, ChainId } from '@xyo-network/xl1-sdk'\nimport {\n AttoXL1ConvertFactor, BaseConfigContextZod, HostActorConfigZod, XL1,\n} from '@xyo-network/xl1-sdk'\nimport { globalRegistry, z } from 'zod'\n\nconst DEFAULT_FIXED_FEE = toHex(XL1(1000n) * AttoXL1ConvertFactor.xl1)\nconst DEFAULT_VARIABLE_FEE_BASIS_POINTS = 300 // 3%\nconst DEFAULT_HARDHAT_BRIDGE_CONTRACT = toAddress('2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6')\nconst DEFAULT_HARDHAT_CHAIN_ID: ChainId = toHex('7A69')\nconst DEFAULT_HARDHAT_REMOTE_CHAIN_WALLET_PRIVATE_KEY = toHex('0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d')\nconst DEFAULT_HARDHAT_TOKEN_CONTRACT = toAddress('5FbDB2315678afecb367f032d93F642f64180aa3')\nconst DEFAULT_MAX_BRIDGE_AMOUNT = toHex(XL1(1_000_000n) * AttoXL1ConvertFactor.xl1)\nconst DEFAULT_MIN_BRIDGE_AMOUNT = toHex(XL1(1500n) * AttoXL1ConvertFactor.xl1)\nconst DEFAULT_SCANNER_INTERVAL_MS = 30_000\n\nexport const BasisPointsZod = z.coerce.number().int().nonnegative().max(10_000)\nexport type BasisPoints = z.infer<typeof BasisPointsZod>\n\nexport const BridgeConfigZod = HostActorConfigZod.extend({\n escrowAddress: AddressZod.optional().register(globalRegistry, {\n description: 'Address to which bridge escrow will be sent',\n title: 'bridge.escrowAddress',\n type: 'string',\n }),\n feesAddress: AddressZod.optional().register(globalRegistry, {\n description: 'Address to which bridge fees will be sent',\n title: 'bridge.feesAddress',\n type: 'string',\n }),\n feeFixed: HexZod.default(DEFAULT_FIXED_FEE).register(globalRegistry, {\n default: DEFAULT_FIXED_FEE,\n description: 'Fixed fee (in AttoXL1) applied to bridge transfers',\n title: 'bridge.feeFixed',\n type: 'bigint',\n }),\n feeRateBasisPoints: BasisPointsZod.default(DEFAULT_VARIABLE_FEE_BASIS_POINTS).register(globalRegistry, {\n default: DEFAULT_VARIABLE_FEE_BASIS_POINTS,\n description: 'Variable rate fee (in basis points where 1 bps = 0.01%) applied to bridge transfers',\n title: 'bridge.feeRateBasisPoints',\n type: 'number',\n }),\n maxBridgeAmount: HexZod.default(DEFAULT_MAX_BRIDGE_AMOUNT).register(globalRegistry, {\n default: DEFAULT_MAX_BRIDGE_AMOUNT,\n description: 'Maximum amount allowed for a bridge transfer',\n title: 'bridge.maxBridgeAmount',\n type: 'string',\n }),\n minBridgeAmount: HexZod.default(DEFAULT_MIN_BRIDGE_AMOUNT).register(globalRegistry, {\n default: DEFAULT_MIN_BRIDGE_AMOUNT,\n description: 'Minimum amount required for a bridge transfer',\n title: 'bridge.minBridgeAmount',\n type: 'string',\n }),\n redisHost: z.string().default('localhost').register(globalRegistry, {\n default: 'localhost',\n description: 'Host for the Bridge Redis instance',\n title: 'bridge.redisHost',\n type: 'string',\n }),\n redisPort: z.coerce.number().int().positive().default(6379).register(globalRegistry, {\n default: 6379,\n description: 'Port for the Bridge Redis instance',\n title: 'bridge.redisPort',\n type: 'number',\n }),\n scannerIntervalMs: z.coerce.number().int().positive().default(DEFAULT_SCANNER_INTERVAL_MS).register(globalRegistry, {\n default: DEFAULT_SCANNER_INTERVAL_MS,\n description: 'How often (ms) the EVM->XL1 scanner polls the remote bridge contract for new BridgedToRemote ids confirmed at depth.',\n title: 'bridge.scannerIntervalMs',\n type: 'number',\n }),\n remoteBridgeContractAddress: AddressZod.default(DEFAULT_HARDHAT_BRIDGE_CONTRACT).register(globalRegistry, {\n default: DEFAULT_HARDHAT_BRIDGE_CONTRACT,\n description: 'Hex representation of remote token address used for bridging',\n title: 'bridge.remoteBridgeContractAddress',\n type: 'string',\n }),\n remoteChainId: HexZod.default(DEFAULT_HARDHAT_CHAIN_ID).register(globalRegistry, {\n default: DEFAULT_HARDHAT_CHAIN_ID,\n description: 'Remote chain ID',\n title: 'bridge.remoteChainId',\n type: 'string',\n }),\n remoteConfirmationDepth: z.union([\n z.coerce.number().int().nonnegative(),\n z.literal('finalized'),\n ]).optional().register(globalRegistry, {\n description: 'Block depth or BlockTag at which the remote (EVM) chain is read as canonical. Numeric: number of confirmations behind head. '\n + \"\\'finalized\\': Casper FFG finalized block. Resolved per-chain by getRemoteConfirmationDepth when unset.\",\n title: 'bridge.remoteConfirmationDepth',\n type: 'string',\n }),\n remoteTokenAddress: HexZod.default(DEFAULT_HARDHAT_TOKEN_CONTRACT).register(globalRegistry, {\n default: DEFAULT_HARDHAT_TOKEN_CONTRACT,\n description: 'Hex representation of remote token address used for bridging',\n title: 'bridge.remoteTokenAddress',\n type: 'string',\n }),\n remoteChainWalletPrivateKey: HexZod.default(DEFAULT_HARDHAT_REMOTE_CHAIN_WALLET_PRIVATE_KEY).register(globalRegistry, {\n description: 'Private key for the wallet to use for the remote chain wallet',\n title: 'bridge.remoteChainWalletPrivateKey',\n type: 'string',\n }),\n xl1ChainId: HexZod.optional().register(globalRegistry, {\n description: 'XL1 chain id used for bridging',\n title: 'bridge.xl1ChainId',\n type: 'string',\n }),\n xl1TokenAddress: HexZod.optional().register(globalRegistry, {\n description: 'XL1 token address used for bridging',\n title: 'bridge.xl1TokenAddress',\n type: 'string',\n }),\n})\n\nexport type BridgeConfig = z.infer<typeof BridgeConfigZod>\n\nexport const BridgeSettingsZod = BridgeConfigZod.pick({\n feeFixed: true,\n feeRateBasisPoints: true,\n feesAddress: true,\n escrowAddress: true,\n maxBridgeAmount: true,\n minBridgeAmount: true,\n remoteChainId: true,\n remoteTokenAddress: true,\n xl1TokenAddress: true,\n xl1ChainId: true,\n}).required()\n\nexport type BridgeSettings = z.infer<typeof BridgeSettingsZod>\n\nexport const isBridgeConfig = zodIsFactory(BridgeConfigZod)\nexport const asBridgeConfig = zodAsFactory(BridgeConfigZod, 'asBridgeConfig')\nexport const toBridgeConfig = zodToFactory(BridgeConfigZod, 'toBridgeConfig')\n\nexport interface BridgeConfigContext extends Omit<BaseConfigContext, 'config'> {\n config: BridgeConfig\n}\n\nexport const BridgeConfigContext: z.ZodType<BridgeConfigContext> = BaseConfigContextZod.extend({ config: BridgeConfigZod })\n\nexport const isBridgeConfigContext: <T>(value: T) => value is T & BridgeConfigContext = zodIsFactory(BridgeConfigContext)\nexport const asBridgeConfigContext: ReturnType<typeof zodAsFactory<BridgeConfigContext>> = zodAsFactory(BridgeConfigContext, 'asBridgeConfigContext')\nexport const toBridgeConfigContext: ReturnType<typeof zodToFactory<BridgeConfigContext>> = zodToFactory(BridgeConfigContext, 'toBridgeConfigContext')\n","import {\n AddressZod,\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport type { BaseConfigContext } from '@xyo-network/xl1-sdk'\nimport {\n BaseConfigContextZod, DEFAULT_MIN_CANDIDATES, HostActorConfigZod,\n} from '@xyo-network/xl1-sdk'\nimport { z } from 'zod'\n\nexport const FinalizerConfigZod = HostActorConfigZod.extend({\n allowedProducers: z.array(AddressZod).optional(),\n // Period (ms) between finalizer ticks. Default matches the historical\n // hardcoded value in FinalizerActor; tests can lower it to drive faster\n // block finalization.\n finalizationCheckInterval: z.coerce.number().default(500),\n minCandidates: z.number().int().min(0).default(DEFAULT_MIN_CANDIDATES),\n})\n\nexport type FinalizerConfig = z.infer<typeof FinalizerConfigZod>\n\nexport const isFinalizerConfig = zodIsFactory(FinalizerConfigZod)\nexport const asFinalizerConfig = zodAsFactory(FinalizerConfigZod, 'asFinalizerConfig')\nexport const toFinalizerConfig = zodToFactory(FinalizerConfigZod, 'toFinalizerConfig')\n\nexport interface FinalizerConfigContext extends Omit<BaseConfigContext, 'config'> {\n config: FinalizerConfig\n}\n\nexport const FinalizerConfigContext: z.ZodType<FinalizerConfigContext> = BaseConfigContextZod.extend({ config: FinalizerConfigZod })\n\nexport const isFinalizerConfigContext: <T>(value: T) => value is T & FinalizerConfigContext = zodIsFactory(FinalizerConfigContext)\nexport const asFinalizerConfigContext: ReturnType<typeof zodAsFactory<FinalizerConfigContext>> = zodAsFactory(FinalizerConfigContext, 'asFinalizerConfigContext')\nexport const toFinalizerConfigContext: ReturnType<typeof zodToFactory<FinalizerConfigContext>> = zodToFactory(FinalizerConfigContext, 'toFinalizerConfigContext')\n","import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport type { BaseConfigContext } from '@xyo-network/xl1-sdk'\nimport { BaseConfigContextZod, HostActorConfigZod } from '@xyo-network/xl1-sdk'\nimport { globalRegistry, z } from 'zod'\n\nexport const DEFAULT_MEMPOOL_BLOCK_PRUNE_INTERVAL = 1000\nexport const DEFAULT_MEMPOOL_TRANSACTION_PRUNE_INTERVAL = 1000\n\nexport const MempoolConfigZod = HostActorConfigZod.extend({\n enabled: z.union([z.string(), z.boolean()]).default('false').transform((val, ctx) => {\n if (typeof val === 'boolean') return val\n const normalized = val.toLowerCase().trim()\n if (['true', '1', 'yes', 'on'].includes(normalized)) return true\n if (['false', '0', 'no', 'off'].includes(normalized)) return false\n ctx.addIssue({\n code: 'invalid_type',\n expected: 'boolean',\n message: `Invalid boolean value: \"${val}\". Use true/false, 1/0, yes/no.`,\n })\n return z.NEVER\n }).register(globalRegistry, {\n default: 'false',\n description: 'Enable the Mempool',\n title: 'mempool.enabled',\n type: 'boolean',\n }),\n blockPruneInterval: z.coerce.number().default(DEFAULT_MEMPOOL_BLOCK_PRUNE_INTERVAL).register(globalRegistry, {\n description: 'The interval time (in milliseconds) between pending block prune attempts',\n title: 'mempool.blockPruneInterval',\n type: 'number',\n }),\n transactionPruneInterval: z.coerce.number().default(DEFAULT_MEMPOOL_TRANSACTION_PRUNE_INTERVAL).register(globalRegistry, {\n description: 'The interval time (in milliseconds) between pending transaction prune attempts',\n title: 'mempool.transactionPruneInterval',\n type: 'number',\n }),\n})\n\nexport type MempoolConfig = z.infer<typeof MempoolConfigZod>\n\nexport const isMempoolConfig = zodIsFactory(MempoolConfigZod)\nexport const asMempoolConfig = zodAsFactory(MempoolConfigZod, 'asMempoolConfig')\nexport const toMempoolConfig = zodToFactory(MempoolConfigZod, 'toMempoolConfig')\n\nexport interface MempoolConfigContext extends Omit<BaseConfigContext, 'config'> {\n config: MempoolConfig\n}\n\nexport const MempoolConfigContext: z.ZodType<MempoolConfigContext> = BaseConfigContextZod.extend({ config: MempoolConfigZod })\n\nexport const isMempoolConfigContext: <T>(value: T) => value is T & MempoolConfigContext = zodIsFactory(MempoolConfigContext)\nexport const asMempoolConfigContext: ReturnType<typeof zodAsFactory<MempoolConfigContext>> = zodAsFactory(MempoolConfigContext, 'asMempoolConfigContext')\nexport const toMempoolConfigContext: ReturnType<typeof zodToFactory<MempoolConfigContext>> = zodToFactory(MempoolConfigContext, 'toMempoolConfigContext')\n","import {\n AddressZod,\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport type { BaseConfigContext } from '@xyo-network/xl1-sdk'\nimport { ActorConfigZod, BaseConfigContextZod } from '@xyo-network/xl1-sdk'\nimport { globalRegistry, z } from 'zod'\n\nexport const DEFAULT_BLOCK_PRODUCTION_CHECK_INTERVAL = 10_000 // 10 seconds\n\nexport const ProducerConfigZod = ActorConfigZod.extend(z.object({\n allowlist: z.array(AddressZod).optional().register(globalRegistry, {\n description: 'List of allowed producer addresses, if undefined anyone can participate',\n title: 'allowlist',\n type: 'array',\n }),\n\n blockProductionCheckInterval: z.coerce.number().default(DEFAULT_BLOCK_PRODUCTION_CHECK_INTERVAL).register(globalRegistry, {\n description: 'The interval time (in milliseconds) between block production attempts',\n title: 'producer.blockProductionCheckInterval',\n type: 'number',\n }),\n disableIntentRedeclaration: z.boolean().optional().register(globalRegistry, {\n description: 'Should the producer skip redeclaring their intent to continue producing blocks',\n title: 'producer.disableIntentRedeclaration',\n type: 'boolean',\n }),\n heartbeatInterval: z.coerce.number().default(3_600_000).register(globalRegistry, {\n description: 'The number of milliseconds between heartbeats if no blocks are produced',\n title: 'producer.heartbeatInterval',\n type: 'number',\n }),\n // TODO: BigInt schema\n minStake: z.coerce.number().default(1).register(globalRegistry, {\n description: 'Minimum stake required to be a Producer',\n title: 'producer.minStake',\n type: 'number',\n }),\n // TODO: Address schema\n rewardAddress: z.string().optional().register(globalRegistry, {\n description: 'Address to receive block rewards',\n title: 'producer.rewardAddress',\n type: 'string',\n }),\n}).shape)\n\nexport type ProducerConfig = z.infer<typeof ProducerConfigZod>\n\nexport const isProducerConfig = zodIsFactory(ProducerConfigZod)\nexport const asProducerConfig = zodAsFactory(ProducerConfigZod, 'asProducerConfig')\nexport const toProducerConfig = zodToFactory(ProducerConfigZod, 'toProducerConfig')\n\nexport interface ProducerConfigContext extends Omit<BaseConfigContext, 'config'> {\n config: ProducerConfig\n}\n\nexport const ProducerConfigContext: z.ZodType<ProducerConfigContext> = BaseConfigContextZod.extend({ config: ProducerConfigZod })\n\nexport const isProducerConfigContext: <T>(value: T) => value is T & ProducerConfigContext = zodIsFactory(ProducerConfigContext)\nexport const asProducerConfigContext: ReturnType<typeof zodAsFactory<ProducerConfigContext>> = zodAsFactory(ProducerConfigContext, 'asProducerConfigContext')\nexport const toProducerConfigContext: ReturnType<typeof zodToFactory<ProducerConfigContext>> = zodToFactory(ProducerConfigContext, 'toProducerConfigContext')\n","import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport type { BaseConfigContext } from '@xyo-network/xl1-sdk'\nimport { BaseConfigContextZod, HostActorConfigZod } from '@xyo-network/xl1-sdk'\nimport type { z } from 'zod'\n\nexport const RewardRedemptionConfigZod = HostActorConfigZod.extend({})\n\nexport type RewardRedemptionConfig = z.infer<typeof RewardRedemptionConfigZod>\n\nexport const isRewardRedemptionConfig = zodIsFactory(RewardRedemptionConfigZod)\nexport const asRewardRedemptionConfig = zodAsFactory(RewardRedemptionConfigZod, 'asRewardRedemptionConfig')\nexport const toRewardRedemptionConfig = zodToFactory(RewardRedemptionConfigZod, 'toRewardRedemptionConfig')\n\nexport interface RewardRedemptionConfigContext extends Omit<BaseConfigContext, 'config'> {\n config: RewardRedemptionConfig\n}\n\nexport const RewardRedemptionConfigContext: z.ZodType<RewardRedemptionConfigContext> = BaseConfigContextZod.extend({ config: RewardRedemptionConfigZod })\n\nexport const isRewardRedemptionConfigContext: <T>(value: T) => value is T & RewardRedemptionConfigContext = zodIsFactory(RewardRedemptionConfigContext)\nexport const asRewardRedemptionConfigContext: ReturnType<typeof zodAsFactory<RewardRedemptionConfigContext>> = zodAsFactory(RewardRedemptionConfigContext, 'asRewardRedemptionConfigContext')\nexport const toRewardRedemptionConfigContext: ReturnType<typeof zodToFactory<RewardRedemptionConfigContext>> = zodToFactory(RewardRedemptionConfigContext, 'toRewardRedemptionConfigContext')\n","import { deepMerge } from '@xylabs/sdk-js'\nimport type { Config } from '@xyo-network/xl1-sdk'\n\nexport function mergeConfig({ actors, ...baseConfig }: Config) {\n return {\n ...baseConfig,\n actors: actors.map((actor) => {\n return deepMerge(baseConfig, actor)\n }),\n }\n}\n","import { buildNextBlock } from '@xyo-network/chain-sdk'\nimport type { AccountInstance, WithHashMeta } from '@xyo-network/sdk-js'\nimport type { BlockBoundWitness, XL1BlockRange } from '@xyo-network/xl1-sdk'\nimport { createDeclarationIntent } from '@xyo-network/xl1-sdk'\n\nexport async function createProducerChainStakeIntentBlock(prevBlock: WithHashMeta<BlockBoundWitness>, producerAccount: AccountInstance, range: XL1BlockRange) {\n const producerDeclarationPayload = createDeclarationIntent(\n producerAccount.address,\n 'producer',\n range[0],\n range[1],\n )\n return await buildNextBlock(\n prevBlock,\n [],\n [producerDeclarationPayload],\n [producerAccount],\n )\n}\n","import type { Host, ServiceProvider } from '../model/index.ts'\n\n/**\n * A generic host implementation that can be used as a starting point for\n * more complex host implementations.\n */\nexport class GenericHost implements Host {\n services: ServiceProvider\n\n constructor(services: ServiceProvider) {\n this.services = services\n }\n\n async start(): Promise<void> {\n await Promise.resolve()\n // Initialize or start your services here\n console.log('Host is starting...')\n }\n\n async stop(): Promise<void> {\n await Promise.resolve()\n // Stop or clean up services here\n console.log('Host is stopping...')\n }\n}\n","import type { ServiceProvider } from '../model/index.ts'\n\nexport class DefaultServiceProvider implements ServiceProvider {\n protected _services: Record<string, unknown>\n constructor(services: Record<string, unknown>) {\n this._services = services\n }\n\n getService<T>(serviceIdentifier: string): T | undefined {\n return this._services[serviceIdentifier] as T\n }\n}\n","import type { ServiceProvider } from './ServiceProvider.ts'\n\nexport interface ServiceCollection {\n build(): ServiceProvider\n}\n\n/**\n * Represents the lifetime of a service\n */\nexport const ServiceLifetime = {\n Singleton: 'Singleton',\n Transient: 'Transient',\n} as const\n\n/**\n * Describes a single service registration\n */\nexport interface ServiceDescriptor<T = unknown> {\n identifier: string | symbol\n implementationFactory: () => T\n lifetime: keyof typeof ServiceLifetime\n}\n","import { assertEx, isString } from '@xylabs/sdk-js'\nimport type { BiosExternalInterface } from '@xyo-network/bios-model'\nimport type { WalletKind } from '@xyo-network/storage-model'\nimport type { ActorConfigContext } from '@xyo-network/xl1-sdk'\n\nimport { getBuiltInDevMnemonic, getResolvedWalletReport } from './walletResolution.ts'\n\nexport async function initActorSeedPhrase(context: ActorConfigContext, bios: BiosExternalInterface): Promise<string> {\n const { logger, config } = context\n const walletKind = config.name as WalletKind\n void bios\n const report = getResolvedWalletReport()\n if (isString(report?.root.mnemonic)) return report.root.mnemonic\n const fallback = getBuiltInDevMnemonic()\n logger?.debug(`[${walletKind}] Falling back to built-in development mnemonic`)\n return assertEx(fallback, () => 'Unable to resolve mnemonic')\n}\n","import type { Address } from '@xylabs/sdk-js'\nimport { HDWallet } from '@xyo-network/sdk-js'\nimport type { WalletInstance } from '@xyo-network/wallet-model'\nimport type { ActorConfig, Config } from '@xyo-network/xl1-sdk'\nimport { DEFAULT_WALLET_PATH, generateXyoBaseWalletFromPhrase } from '@xyo-network/xl1-sdk'\nimport { HDNodeWallet, Mnemonic } from 'ethers'\n\n/**\n * Default BIP-32 derivation path per actor, expressed as a *relative* path\n * (the consumer appends it to the root wallet base path). Each actor resolves\n * to a distinct slot to avoid collisions out of the box.\n */\nexport const DEFAULT_ACTOR_ACCOUNT_PATH: Record<string, string> = {\n api: '3',\n bridge: '1',\n finalizer: '5',\n mempool: '4',\n producer: '0',\n rewardRedemption: '2',\n}\n\nexport const BUILT_IN_DEV_MNEMONIC = 'crane ribbon cook cousin tobacco vital moral protect merit knock veteran hint knee ocean nurse'\nexport const INSECURE_GENESIS_REWARD_MNEMONIC = 'test test test test test test test test test test test junk'\nexport const GENESIS_REWARD_AMOUNT = 20_000_000_000_000_000_000_000n\nconst ATTO_XL1_PER_XL1 = 1_000_000_000_000_000_000n\n\nexport const ROOT_WALLET_RUNTIME_ID = '_root'\nexport const SHARED_ACCOUNT_REPORT_COUNT = 10\nexport type RootMnemonicConfig = Config & { mnemonic?: string }\ntype ActorWalletConfig = Partial<ActorConfig> & { accountPath?: string }\n\nexport type MnemonicKind = 'built-in-dev' | 'configured-root' | 'insecure-genesis-reward'\n\nexport interface ResolvedRootWallet {\n basePath: string\n isBuiltInDevMnemonic: boolean\n isConfigured: boolean\n mnemonic: string\n mnemonicKind: Extract<MnemonicKind, 'built-in-dev' | 'configured-root'>\n}\n\nexport interface ResolvedWalletMetadata {\n accountPath: string\n actorName: string\n address: string\n derivationPath: string\n label: string\n mnemonic: string\n mnemonicKind: MnemonicKind\n privateKey?: string\n usesBuiltInDevMnemonic: boolean\n}\n\nexport interface ResolvedWalletReport {\n requestedActors: string[]\n root: ResolvedRootWallet\n sharedAccounts: ResolvedWalletMetadata[]\n}\n\nconst ACTOR_LABELS: Record<string, string> = {\n [ROOT_WALLET_RUNTIME_ID]: 'root/local-node',\n api: 'api',\n bridge: 'bridge',\n finalizer: 'finalizer',\n mempool: 'mempool',\n producer: 'producer',\n rewardRedemption: 'rewardRedemption',\n}\n\nlet activeWalletReport: ResolvedWalletReport | undefined\n\nfunction getAccountLabel(actorName: string): string {\n return ACTOR_LABELS[actorName] ?? actorName\n}\n\nexport function clearResolvedWalletReport() {\n activeWalletReport = undefined\n}\n\n/**\n * Resolve the effective BIP-32 derivation path for an actor.\n *\n * - If the actor config specifies `accountPath`, use it.\n * - Otherwise fall back to `DEFAULT_ACTOR_ACCOUNT_PATH[actorName]`.\n * - Otherwise fall back to `\"0\"` (a relative path that derives to the first slot\n * under the root wallet's base path).\n *\n * The returned value is exactly what the user provided (or the default) —\n * absolute paths keep their `m/` prefix; relative paths do not.\n */\nexport function resolveActorAccountPath(actorName: string, actorConfig?: ActorWalletConfig): string {\n if (actorConfig?.accountPath !== undefined) return actorConfig.accountPath\n return DEFAULT_ACTOR_ACCOUNT_PATH[actorName] ?? '0'\n}\n\nexport function isAbsoluteAccountPath(accountPath: string): boolean {\n return accountPath.startsWith('m/')\n}\n\n/**\n * Expand a (possibly relative) actor accountPath into a fully qualified BIP-32\n * derivation path. Used for reporting and collision detection.\n */\nexport function expandAccountPath(accountPath: string, basePath: string = DEFAULT_WALLET_PATH): string {\n return isAbsoluteAccountPath(accountPath) ? accountPath : `${basePath}/${accountPath}`\n}\n\nasync function deriveWalletAtPath(mnemonic: string, accountPath: string): Promise<WalletInstance> {\n if (isAbsoluteAccountPath(accountPath)) {\n // `HDWallet.fromPhrase` defaults to a derived path, not the root, so an\n // arbitrary absolute path (e.g. m/44'/60'/1'/0/0) can't be derived through\n // it. Build a true root node via ethers, derive the full path, then wrap.\n const seed = Mnemonic.fromPhrase(mnemonic).computeSeed()\n const rootNode = HDNodeWallet.fromSeed(seed)\n const derivedNode = rootNode.derivePath(accountPath)\n return await HDWallet.createFromNode(derivedNode)\n }\n const baseWallet = await generateXyoBaseWalletFromPhrase(mnemonic)\n return await baseWallet.derivePath(accountPath)\n}\n\nexport function getBuiltInDevMnemonic(): string {\n return BUILT_IN_DEV_MNEMONIC\n}\n\nexport function getInsecureGenesisRewardMnemonic(): string {\n return INSECURE_GENESIS_REWARD_MNEMONIC\n}\n\nexport function resolveRootWallet(configuration: RootMnemonicConfig): ResolvedRootWallet {\n const isConfigured = configuration.mnemonic !== undefined\n const mnemonic = configuration.mnemonic ?? BUILT_IN_DEV_MNEMONIC\n const isBuiltInDevMnemonic = mnemonic === BUILT_IN_DEV_MNEMONIC\n return {\n basePath: DEFAULT_WALLET_PATH,\n isBuiltInDevMnemonic,\n isConfigured,\n mnemonic,\n mnemonicKind: isBuiltInDevMnemonic ? 'built-in-dev' : 'configured-root',\n }\n}\n\nasync function resolveWalletMetadata({\n accountPath,\n actorName,\n mnemonic,\n mnemonicKind,\n}: {\n accountPath: string\n actorName: string\n mnemonic: string\n mnemonicKind: MnemonicKind\n}): Promise<ResolvedWalletMetadata> {\n const account = await deriveWalletAtPath(mnemonic, accountPath)\n return {\n accountPath,\n actorName,\n address: account.address,\n derivationPath: expandAccountPath(accountPath),\n label: getAccountLabel(actorName),\n mnemonic,\n mnemonicKind,\n privateKey: account.privateKey,\n usesBuiltInDevMnemonic: mnemonic === BUILT_IN_DEV_MNEMONIC,\n }\n}\n\nexport async function resolveActorWallet(\n actorName: string,\n actorConfig: ActorWalletConfig | undefined,\n root: ResolvedRootWallet,\n): Promise<ResolvedWalletMetadata> {\n return await resolveWalletMetadata({\n accountPath: resolveActorAccountPath(actorName, actorConfig),\n actorName,\n mnemonic: root.mnemonic,\n mnemonicKind: root.mnemonicKind,\n })\n}\n\nexport class ActorMnemonicNotAllowedError extends Error {\n readonly actors: string[]\n constructor(actors: string[]) {\n super([\n `Per-actor mnemonics are no longer allowed (found on: ${actors.join(', ')}).`,\n 'Move the mnemonic to the root (XL1_MNEMONIC, --mnemonic, or config file \"xl1.mnemonic\") and give each actor a distinct accountPath.',\n ].join('\\n'))\n this.name = 'ActorMnemonicNotAllowedError'\n this.actors = actors\n }\n}\n\nexport function assertNoActorMnemonics(configuration: RootMnemonicConfig): void {\n const offenders = configuration.actors\n .filter((actor): actor is ActorConfig & { mnemonic: string } => typeof (actor as { mnemonic?: unknown }).mnemonic === 'string')\n .map(actor => actor.name)\n if (offenders.length > 0) throw new ActorMnemonicNotAllowedError(offenders)\n}\n\nexport class DerivationPathCollisionError extends Error {\n readonly collisions: Record<string, string[]>\n constructor(collisions: Record<string, string[]>) {\n const lines = Object.entries(collisions).map(\n ([path, actors]) => ` - ${actors.join(', ')} → ${path}`,\n )\n super([\n 'Two or more actors resolve to the same wallet derivation path:',\n ...lines,\n 'Change each actor\\'s accountPath so every actor has a distinct path.',\n ].join('\\n'))\n this.name = 'DerivationPathCollisionError'\n this.collisions = collisions\n }\n}\n\nexport function detectDerivationPathCollisions(\n requestedActors: string[],\n configuration: RootMnemonicConfig,\n): DerivationPathCollisionError | undefined {\n const actorConfigMap = new Map(configuration.actors.map(actor => [actor.name, actor]))\n const bucketsByPath = new Map<string, string[]>()\n for (const actorName of requestedActors) {\n const accountPath = resolveActorAccountPath(actorName, actorConfigMap.get(actorName))\n const fullPath = expandAccountPath(accountPath)\n const bucket = bucketsByPath.get(fullPath) ?? []\n bucket.push(actorName)\n bucketsByPath.set(fullPath, bucket)\n }\n const collisions: Record<string, string[]> = {}\n for (const [path, actors] of bucketsByPath) {\n if (actors.length > 1) collisions[path] = actors\n }\n if (Object.keys(collisions).length === 0) return undefined\n return new DerivationPathCollisionError(collisions)\n}\n\nexport async function resolveWalletReport(\n requestedActors: string[],\n configuration: RootMnemonicConfig,\n): Promise<ResolvedWalletReport> {\n const root = resolveRootWallet(configuration)\n const actorConfigMap = new Map(configuration.actors.map(actor => [actor.name, actor]))\n\n const resolvedActors = await Promise.all(\n requestedActors.map(async actorName => await resolveActorWallet(actorName, actorConfigMap.get(actorName), root)),\n )\n\n const labelMap = new Map<string, string[]>()\n for (const actor of resolvedActors) {\n const labels = labelMap.get(actor.derivationPath) ?? []\n labels.push(actor.label)\n labelMap.set(actor.derivationPath, labels)\n }\n\n const sharedAccounts = await Promise.all(\n Array.from({ length: SHARED_ACCOUNT_REPORT_COUNT }, (_, index) => index).map(async (sharedIndex) => {\n const account = await resolveWalletMetadata({\n accountPath: `${sharedIndex}`,\n actorName: ROOT_WALLET_RUNTIME_ID,\n mnemonic: root.mnemonic,\n mnemonicKind: root.mnemonicKind,\n })\n const labels = labelMap.get(account.derivationPath)\n return { ...account, label: labels?.join(', ') ?? `shared[${sharedIndex}]` }\n }),\n )\n\n return {\n requestedActors: [...requestedActors],\n root,\n sharedAccounts,\n }\n}\n\nexport async function buildInsecureGenesisRewardAccounts(): Promise<ResolvedWalletMetadata[]> {\n const accounts = await Promise.all(\n Array.from({ length: SHARED_ACCOUNT_REPORT_COUNT }, (_, index) => index).map(async (sharedIndex) => {\n const account = await resolveWalletMetadata({\n accountPath: `${sharedIndex}`,\n actorName: 'genesisReward',\n mnemonic: INSECURE_GENESIS_REWARD_MNEMONIC,\n mnemonicKind: 'insecure-genesis-reward',\n })\n return { ...account, label: sharedIndex === 0 ? 'genesisRewardAddress' : `genesisReward[${sharedIndex}]` }\n }),\n )\n return accounts\n}\n\nexport async function initializeResolvedWalletReport(\n requestedActors: string[],\n configuration: RootMnemonicConfig,\n): Promise<ResolvedWalletReport> {\n activeWalletReport = await resolveWalletReport(requestedActors, configuration)\n return activeWalletReport\n}\n\nexport function getResolvedWalletReport(): ResolvedWalletReport | undefined {\n return activeWalletReport\n}\n\nfunction formatSharedAccount(account: ResolvedWalletMetadata, showPrivateKey: boolean) {\n const lines = [\n `[${account.accountPath}] ${account.label}`,\n `source: ${account.mnemonicKind === 'built-in-dev' ? 'built-in dev mnemonic' : 'configured root mnemonic'}`,\n `path: ${account.derivationPath}`,\n `address: ${account.address}`,\n ]\n if (showPrivateKey) lines.push(`privateKey: ${account.privateKey ?? 'unavailable'}`)\n return lines.join('\\n')\n}\n\nfunction formatGenesisRewardAccount(account: ResolvedWalletMetadata) {\n const balance = account.accountPath === '0' ? GENESIS_REWARD_AMOUNT / ATTO_XL1_PER_XL1 : 0n\n return [\n `[${account.accountPath}] ${account.label}`,\n `path: ${account.derivationPath}`,\n `address: ${account.address}`,\n `privateKey: ${account.privateKey ?? 'unavailable'}`,\n `balance: ${balance.toString()} XL1`,\n ].join('\\n')\n}\n\nexport function formatWalletReport(report: ResolvedWalletReport): string {\n const sections: string[] = []\n const showSecrets = report.root.isBuiltInDevMnemonic\n\n sections.push(showSecrets ? 'Development wallet detected.' : 'Wallet summary')\n\n if (showSecrets) {\n sections.push([\n 'DEVELOPMENT WALLET WARNING',\n '',\n 'XL1 is using the built-in development mnemonic.',\n 'This mnemonic is fixed, public, and does not change between runs.',\n 'The addresses and private keys below are unsafe and must never be used for real funds, production systems, or shared environments.',\n 'Anyone with this information can fully control these accounts.',\n '',\n 'Mnemonic:',\n report.root.mnemonic,\n ].join('\\n'))\n }\n\n sections.push([\n `Shared wallet accounts from ${report.root.basePath}:`,\n '',\n report.sharedAccounts.map(account => formatSharedAccount(account, showSecrets)).join('\\n\\n'),\n ].join('\\n'))\n\n return sections.join('\\n\\n')\n}\n\nexport function formatInsecureGenesisRewardWarning(accounts: ResolvedWalletMetadata[]): string {\n return [\n 'INSECURE GENESIS REWARD WALLET WARNING',\n '',\n 'XL1 is using a public, insecure fallback wallet for the genesis reward address.',\n 'This phrase is intentionally unsafe and must never be used for real funds, production systems, or shared environments.',\n 'Anyone with this information can fully control the genesis reward wallet.',\n '',\n 'Genesis reward phrase:',\n INSECURE_GENESIS_REWARD_MNEMONIC,\n '',\n `The genesis reward is sent to index 0 and starts with ${(GENESIS_REWARD_AMOUNT / ATTO_XL1_PER_XL1).toString()} XL1.`,\n '',\n `Genesis reward wallet accounts from ${DEFAULT_WALLET_PATH}:`,\n '',\n accounts.map(account => formatGenesisRewardAccount(account)).join('\\n\\n'),\n ].join('\\n')\n}\n\nexport async function resolveGenesisRewardAddress(config: Pick<Config, 'chain'>): Promise<Address> {\n if (config.chain.genesisRewardAddress) return config.chain.genesisRewardAddress\n const wallet = await generateXyoBaseWalletFromPhrase(INSECURE_GENESIS_REWARD_MNEMONIC)\n const account = await wallet.derivePath('0')\n return account.address\n}\n\nexport async function resolveWalletForActor(actorName: string, accountPath?: string): Promise<WalletInstance> {\n const report = activeWalletReport\n const mnemonic = report?.root.mnemonic ?? BUILT_IN_DEV_MNEMONIC\n const resolvedAccountPath = accountPath ?? resolveActorAccountPath(actorName)\n return await deriveWalletAtPath(mnemonic, resolvedAccountPath)\n}\n","import type { Address } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport type {\n AttachableArchivistInstance, AttachableModuleInstance, BridgeInstance, ModuleIdentifier,\n} from '@xyo-network/sdk-js'\nimport { asAttachableArchivistInstance, asAttachableModuleInstance } from '@xyo-network/sdk-js'\nimport { Mutex } from 'async-mutex'\n\nconst initMutex = new Mutex()\ntype ModuleDictionary = Record<ModuleIdentifier, AttachableModuleInstance | undefined>\ntype BridgedModuleDictionary = Record<Address, ModuleDictionary | undefined>\nconst bridgedModuleDictionary: BridgedModuleDictionary = {}\n\nexport async function initBridgedModule({ bridge, moduleName }: { bridge: BridgeInstance; moduleName: ModuleIdentifier }): Promise<AttachableModuleInstance> {\n return await initMutex.runExclusive(async () => {\n const existing = bridgedModuleDictionary?.[bridge.address]?.[moduleName]\n if (existing) return existing\n const mod = assertEx(await bridge.resolve(moduleName), () => `Could not resolve ${moduleName}`)\n const moduleInstance = assertEx(asAttachableModuleInstance(mod), () => `Could not convert ${moduleName} to attachable module instance`)\n // Initialize the nested dictionary if needed\n let moduleMap = bridgedModuleDictionary[bridge.address]\n if (moduleMap === undefined) {\n moduleMap = {}\n bridgedModuleDictionary[bridge.address] = moduleMap\n }\n // Store and return the module instance\n moduleMap[moduleName] = moduleInstance\n return moduleInstance\n })\n}\n\nexport async function initBridgedArchivistModule({ bridge, moduleName }: {\n bridge: BridgeInstance\n moduleName: ModuleIdentifier\n}): Promise<AttachableArchivistInstance> {\n return assertEx(\n asAttachableArchivistInstance(await initBridgedModule({ bridge, moduleName })),\n () => `Could not convert ${moduleName} to attachable archivist instance`,\n )\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { RuntimeStatusMonitor } from '@xyo-network/xl1-sdk'\n\nexport function initStatusReporter({ logger }: { logger: Logger }) {\n const statusReporter = new RuntimeStatusMonitor(logger)\n statusReporter.onGlobalTransition({ to: 'started' }, () => {\n logger.log('All services started.')\n })\n statusReporter.onGlobalTransition({ to: 'error' }, () => {\n logger.error('Producer encountered an unhandled error!')\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1)\n })\n return statusReporter\n}\n","import type { Promisable } from '@xylabs/sdk-js'\nimport { isDefined } from '@xylabs/sdk-js'\nimport type { WalletInstance } from '@xyo-network/wallet-model'\nimport type { ActorConfigContext } from '@xyo-network/xl1-sdk'\n\nimport { resolveWalletForActor } from './walletResolution.ts'\n\n/**\n * Process-global singleton cache, keyed by actor name. Preserves referential\n * identity of the resolved wallet across repeated calls (e.g. locator rebuilds\n * during tests) and avoids redundant HD-derivation work.\n */\nconst actorAccountSingletons: Record<string, Promisable<WalletInstance>> = {}\n\n/**\n * Resolve the `WalletInstance` for an actor, deriving it from the active\n * root mnemonic at the actor's configured account path.\n *\n * Memoized by `context.config.name` for the lifetime of the process.\n */\nexport async function initActorWallet(context: ActorConfigContext): Promise<WalletInstance> {\n const actorName = context.config.name\n if (isDefined(actorAccountSingletons[actorName])) return actorAccountSingletons[actorName]\n const accountPath = typeof context.config.accountPath === 'string' ? context.config.accountPath : undefined\n const account = await resolveWalletForActor(actorName, accountPath)\n context.logger?.debug(`[${actorName}] Using wallet address ${account.address}`)\n actorAccountSingletons[actorName] = account\n return actorAccountSingletons[actorName]\n}\n","import type { CreatableInstance } from '@xylabs/sdk-js'\nimport { AbstractCreatable, creatable } from '@xylabs/sdk-js'\n\nimport type { ActorInstanceV3, ReadyState } from '../actor/v3/index.ts'\nimport { ActorV3 } from '../actor/v3/index.ts'\n\nexport interface OrchestratorInstance extends CreatableInstance {\n readonly readyState: ReadyState\n isReady(): boolean\n isShuttingDown(): boolean\n registerActor(actor: ActorInstanceV3): Promise<void>\n whenReady(timeoutMs?: number): Promise<void>\n}\n\n@creatable()\nexport class Orchestrator extends AbstractCreatable implements OrchestratorInstance {\n protected actors: (ActorInstanceV3)[] = []\n protected running = false\n protected shuttingDown = false\n\n get readyState(): ReadyState {\n if (this.actors.length === 0) return 'pending'\n if (this.actors.some(a => isLocalActor(a) && a.readyState === 'failed')) return 'failed'\n if (this.actors.every(a => isLocalActor(a) && a.readyState === 'ready')) return 'ready'\n return 'pending'\n }\n\n isReady(): boolean {\n return this.readyState === 'ready' && !this.shuttingDown\n }\n\n isShuttingDown(): boolean {\n return this.shuttingDown\n }\n\n /**\n * Registers an actor.\n * (We won't activate the actor until `start()` is called.)\n */\n async registerActor(actor: ActorInstanceV3) {\n this.actors.push(actor)\n if (this.running) {\n // Already running — bring this actor up immediately and trigger its ready handler.\n await actor.start()\n if (isLocalActor(actor)) {\n actor.runReadyHandler().catch((err: unknown) => {\n this.logger?.error(`[Orchestrator] Actor [${actor.name}] readyHandler failed: ${formatError(err)}`)\n })\n }\n }\n }\n\n /**\n * Starts the orchestrator: activates all actors in parallel and kicks off their warm-pass.\n * `whenReady()` resolves once every actor's `readyHandler` has succeeded.\n */\n override async startHandler() {\n await super.startHandler()\n if (this.running) {\n this.logger?.warn('[Orchestrator] Already started.')\n return\n }\n\n this.logger?.log(`[Orchestrator] Starting ${this.actors.length} actor(s) in parallel...`)\n this.running = true\n\n const startResults = await Promise.allSettled(this.actors.map(a => a.start()))\n const startFailures = startResults.flatMap((r, i) => (r.status === 'rejected' ? [{ actor: this.actors[i], reason: r.reason as unknown }] : []))\n if (startFailures.length > 0) {\n for (const f of startFailures) this.logger?.error(`[Orchestrator] Actor [${f.actor?.name ?? '?'}] failed to start: ${formatError(f.reason)}`)\n throw new Error(`[Orchestrator] ${startFailures.length} actor(s) failed to start`)\n }\n\n // Kick off readyHandlers in parallel; do not await — `whenReady()` is the join point.\n for (const actor of this.actors) {\n if (isLocalActor(actor)) {\n actor.runReadyHandler().catch((err: unknown) => {\n this.logger?.error(`[Orchestrator] Actor [${actor.name}] readyHandler failed: ${formatError(err)}`)\n })\n }\n }\n }\n\n /**\n * Stops the orchestrator: deactivates all actors.\n */\n override async stopHandler() {\n await super.stopHandler()\n if (!this.running) {\n this.logger?.log('[Orchestrator] Already stopped.')\n return\n }\n\n this.logger?.log('[Orchestrator] Stopping...')\n this.shuttingDown = true\n await Promise.allSettled(this.actors.map(a => a.stop()))\n this.running = false\n this.shuttingDown = false\n this.logger?.log('[Orchestrator] Stopped.')\n }\n\n /**\n * Resolves once every actor reports ready. Rejects if any actor's `readyHandler` throws,\n * or after `timeoutMs` if provided.\n */\n async whenReady(timeoutMs?: number): Promise<void> {\n const localActors = this.actors.filter(isLocalActor)\n if (localActors.length === 0) return\n if (timeoutMs === undefined) {\n await Promise.all(localActors.map(a => a.whenReady()))\n return\n }\n let timer: NodeJS.Timeout | undefined\n const timeout = new Promise<never>((_, reject) => {\n timer = setTimeout(() => {\n reject(new Error(`[Orchestrator] Not ready within ${timeoutMs}ms`))\n }, timeoutMs)\n })\n try {\n await Promise.race([Promise.all(localActors.map(a => a.whenReady())), timeout])\n } finally {\n if (timer) clearTimeout(timer)\n }\n }\n}\n\nfunction isLocalActor(actor: ActorInstanceV3): actor is ActorInstanceV3 & ActorV3 {\n return actor instanceof ActorV3\n}\n\nfunction formatError(err: unknown): string {\n if (err instanceof Error) return `${err.message}${err.stack ? `\\n${err.stack}` : ''}`\n return String(err)\n}\n","import { assertEx } from '@xylabs/sdk-js'\nimport type { ArchivistInstance } from '@xyo-network/sdk-js'\nimport type { CreatableProviderParams } from '@xyo-network/xl1-sdk'\nimport { AbstractCreatableProvider, creatableProvider } from '@xyo-network/xl1-sdk'\n\n/**\n * Moniker used to resolve a SimpleRejectedTransactionsArchivistProvider\n * from a ProviderFactoryLocator. Actor-local locators (e.g. the producer)\n * resolve this from the root locator to reuse the shared rejected-transactions\n * archivist that the DLQ runner and viewer also write to.\n */\nexport const RejectedTransactionsArchivistProviderMoniker = 'RejectedTransactionsArchivistProvider'\n\n/**\n * Parameters for SimpleRejectedTransactionsArchivistProvider.\n */\nexport interface SimpleRejectedTransactionsArchivistProviderParams extends CreatableProviderParams {\n archivist: ArchivistInstance\n}\n\n/**\n * Pass-through provider that exposes the shared rejected-transactions\n * archivist under a locator moniker so downstream actor locators can\n * reuse the same backing store rather than constructing their own\n * ephemeral MemoryArchivist.\n */\n@creatableProvider()\nexport class SimpleRejectedTransactionsArchivistProvider extends AbstractCreatableProvider<SimpleRejectedTransactionsArchivistProviderParams> {\n static readonly defaultMoniker = RejectedTransactionsArchivistProviderMoniker\n static readonly dependencies: string[] = []\n static readonly monikers = [RejectedTransactionsArchivistProviderMoniker]\n\n moniker = SimpleRejectedTransactionsArchivistProvider.defaultMoniker\n\n get archivist(): ArchivistInstance {\n return this.params.archivist\n }\n\n static override async paramsHandler(\n params?: Partial<SimpleRejectedTransactionsArchivistProviderParams>,\n ): Promise<SimpleRejectedTransactionsArchivistProviderParams> {\n return {\n ...(await super.paramsHandler(params)),\n archivist: assertEx(params?.archivist, () => 'archivist is required'),\n }\n }\n}\n","import type {\n BlockValidators,\n RemoteConfig, RpcTransport, XyoSignerRpcSchemas,\n} from '@xyo-network/xl1-sdk'\nimport { basicRemoteRunnerLocator as sdkBasicRemoteRunnerLocator } from '@xyo-network/xl1-sdk'\n\n/** @deprecated Use basicRemoteRunnerLocator from \\@xyo-network/xl1-providers instead */\nexport function basicRemoteRunnerLocator(\n name: string,\n remoteConfig: RemoteConfig,\n signerTransport: RpcTransport<XyoSignerRpcSchemas>,\n dataLakeEndpoint?: string,\n validators?: BlockValidators,\n) {\n return sdkBasicRemoteRunnerLocator(name, remoteConfig, signerTransport, dataLakeEndpoint, { validators })\n}\n","import type { BlockValidators, RemoteConfig } from '@xyo-network/xl1-sdk'\nimport { basicRemoteViewerLocator as sdkBasicRemoteViewerLocator } from '@xyo-network/xl1-sdk'\n\n/** @deprecated Use basicRemoteViewerLocator from \\@xyo-network/xl1-providers instead */\nexport function basicRemoteViewerLocator(\n name: string,\n remoteConfig: RemoteConfig,\n dataLakeEndpoint?: string,\n validators?: BlockValidators,\n) {\n return sdkBasicRemoteViewerLocator(name, remoteConfig, dataLakeEndpoint, { validators })\n}\n","import { assertEx } from '@xylabs/sdk-js'\nimport type { ActorConfigContext, ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk'\nimport { commonLocatorFromConfig, remoteLocatorFromConfig } from '@xyo-network/xl1-sdk'\n\n/** @deprecated Use rootLocatorFromConfig from \\@xyo-network/xl1-providers instead */\nexport async function rootLocatorFromConfig(\n context: ActorConfigContext,\n validateDepsOnRegister = false,\n): Promise<ProviderFactoryLocatorInstance> {\n const { config } = context\n await commonLocatorFromConfig(context, validateDepsOnRegister)\n const locator = assertEx(\n await (config.remote.rpc ? remoteLocatorFromConfig(context, validateDepsOnRegister) : undefined),\n () => 'Root locator could not be created from config. No supported configuration found.',\n )\n locator.freeze()\n return locator\n}\n"],"mappings":";;;;AAOA,SACEA,mBAAmBC,UAAUC,OAAOC,gBAC/B;AAGP,SAASC,iBAAiB;AAC1B,OAAOC,OAAO;AAQd,IAAMC,cAAuB;EAAEC,KAAK,6BAAA;EAAO,GAAP;AAAS;AAC7C,IAAMC,oBAAmC;EAAED,KAAK,6BAAA;EAAO,GAAP;AAAS;AACzD,IAAME,YAAmB;EAAEC,QAAQ,6BAAA;EAAO,GAAP;AAAS;AAC5C,IAAMC,gBAA2B;EAAED,QAAQ,6BAAA;EAAO,GAAP;AAAS;AAGpD,IAAME,mBAAmBC,EAAEC,OAAsBC,CAAAA,QAAO,OAAOA,QAAQ,YAAYA,IAAIC,SAAS,CAAA;AAChG,IAAMC,4BAA4BJ,EAAEC,OAClCC,CAAAA,QAAOA,QAAQ,QAAQ,OAAOA,QAAQ,YAAY,YAAaA,GAAAA;AAEjE,IAAMG,qBAAqBL,EAAEC,OAC3BC,CAAAA,QAAOA,QAAQ,QAAQ,OAAOA,QAAQ,YAAY,aAAcA,GAAAA;AAG3D,IAAMI,mBAAmBN,EAAEO,OAAO;EACvCC,SAASH;EACTI,SAAST,EAAEU,QAAO;EAClBC,MAAMZ;EACNa,gBAAgBR,0BAA0BS,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BACpBC,SACAC,yBAAyB,OAAK;AAE9B,QAAM,EAAEC,OAAM,IAAKF;AACnB,QAAMG,wBAAwBH,SAASC,sBAAAA;AACvC,QAAMG,UAAUC,UACd,OAAOH,OAAOI,OAAOC,MAAMC,wBAAwBR,SAASC,sBAAAA,IAA0BQ,SACtF,MAAM,kFAAA;AAERL,UAAQM,OAAM;AACd,SAAON;AACT;AAZsBL;","names":["AbstractCreatable","assertEx","delay","IdLogger","Semaphore","z","noopCounter","add","noopUpDownCounter","noopGauge","record","noopHistogram","CreatableNameZod","z","custom","val","length","StatusReporterInstanceZod","AccountInstanceZod","ActorParamsV3Zod","object","account","locator","unknown","name","statusReporter","optional","createDeferred","resolve","reject","promise","Promise","res","rej","ActorV3","AbstractCreatable","_intervals","Map","_semaphores","_timeouts","_logger","_readyDeferred","_readyError","_readyState","logger","IdLogger","assertEx","context","readyError","readyState","params","paramsHandler","baseParams","registerTimer","timerName","callback","dueTimeMs","periodMs","status","warn","running","set","Semaphore","timeoutId","setTimeout","intervalId","setInterval","semaphore","get","has","isLocked","acquire","then","release","startTime","Date","now","duration","catch","error","err","Error","String","message","stack","finally","debug","runReadyHandler","readyHandler","stopHandler","all","values","map","delay","clear","timeoutRef","entries","clearTimeout","intervalRef","clearInterval","whenReady","timeoutMs","undefined","timer","timeout","_","race","counter","description","meter","createCounter","gauge","createGauge","histogram","createHistogram","upDownCounter","createUpDownCounter","Actor","buildTelemetryConfig","config","serviceName","serviceVersion","defaultMetricsScrapePort","otlpEndpoint","telemetry","otel","path","endpoint","port","metrics","scrape","telemetryConfig","attributes","metricsConfig","zodAsFactory","zodIsFactory","zodToFactory","BaseConfigContextZod","HostActorConfigZod","globalRegistry","z","ApiConfigZod","extend","object","initRewardsCache","union","number","string","boolean","transform","v","default","register","description","title","type","stateless","legacyMixedRpc","shape","isApiConfig","asApiConfig","toApiConfig","ApiConfigContext","config","isApiConfigContext","asApiConfigContext","toApiConfigContext","AddressZod","HexZod","toAddress","toHex","zodAsFactory","zodIsFactory","zodToFactory","AttoXL1ConvertFactor","BaseConfigContextZod","HostActorConfigZod","XL1","globalRegistry","z","DEFAULT_FIXED_FEE","xl1","DEFAULT_VARIABLE_FEE_BASIS_POINTS","DEFAULT_HARDHAT_BRIDGE_CONTRACT","DEFAULT_HARDHAT_CHAIN_ID","DEFAULT_HARDHAT_REMOTE_CHAIN_WALLET_PRIVATE_KEY","DEFAULT_HARDHAT_TOKEN_CONTRACT","DEFAULT_MAX_BRIDGE_AMOUNT","DEFAULT_MIN_BRIDGE_AMOUNT","DEFAULT_SCANNER_INTERVAL_MS","BasisPointsZod","coerce","number","int","nonnegative","max","BridgeConfigZod","extend","escrowAddress","optional","register","description","title","type","feesAddress","feeFixed","default","feeRateBasisPoints","maxBridgeAmount","minBridgeAmount","redisHost","string","redisPort","positive","scannerIntervalMs","remoteBridgeContractAddress","remoteChainId","remoteConfirmationDepth","union","literal","remoteTokenAddress","remoteChainWalletPrivateKey","xl1ChainId","xl1TokenAddress","BridgeSettingsZod","pick","required","isBridgeConfig","asBridgeConfig","toBridgeConfig","BridgeConfigContext","config","isBridgeConfigContext","asBridgeConfigContext","toBridgeConfigContext","AddressZod","zodAsFactory","zodIsFactory","zodToFactory","BaseConfigContextZod","DEFAULT_MIN_CANDIDATES","HostActorConfigZod","z","FinalizerConfigZod","extend","allowedProducers","array","optional","finalizationCheckInterval","coerce","number","default","minCandidates","int","min","isFinalizerConfig","asFinalizerConfig","toFinalizerConfig","FinalizerConfigContext","config","isFinalizerConfigContext","asFinalizerConfigContext","toFinalizerConfigContext","zodAsFactory","zodIsFactory","zodToFactory","BaseConfigContextZod","HostActorConfigZod","globalRegistry","z","DEFAULT_MEMPOOL_BLOCK_PRUNE_INTERVAL","DEFAULT_MEMPOOL_TRANSACTION_PRUNE_INTERVAL","MempoolConfigZod","extend","enabled","union","string","boolean","default","transform","val","ctx","normalized","toLowerCase","trim","includes","addIssue","code","expected","message","NEVER","register","description","title","type","blockPruneInterval","coerce","number","transactionPruneInterval","isMempoolConfig","asMempoolConfig","toMempoolConfig","MempoolConfigContext","config","isMempoolConfigContext","asMempoolConfigContext","toMempoolConfigContext","AddressZod","zodAsFactory","zodIsFactory","zodToFactory","ActorConfigZod","BaseConfigContextZod","globalRegistry","z","DEFAULT_BLOCK_PRODUCTION_CHECK_INTERVAL","ProducerConfigZod","extend","object","allowlist","array","optional","register","description","title","type","blockProductionCheckInterval","coerce","number","default","disableIntentRedeclaration","boolean","heartbeatInterval","minStake","rewardAddress","string","shape","isProducerConfig","asProducerConfig","toProducerConfig","ProducerConfigContext","config","isProducerConfigContext","asProducerConfigContext","toProducerConfigContext","zodAsFactory","zodIsFactory","zodToFactory","BaseConfigContextZod","HostActorConfigZod","RewardRedemptionConfigZod","extend","isRewardRedemptionConfig","asRewardRedemptionConfig","toRewardRedemptionConfig","RewardRedemptionConfigContext","config","isRewardRedemptionConfigContext","asRewardRedemptionConfigContext","toRewardRedemptionConfigContext","deepMerge","mergeConfig","actors","baseConfig","map","actor","deepMerge","buildNextBlock","createDeclarationIntent","createProducerChainStakeIntentBlock","prevBlock","producerAccount","range","producerDeclarationPayload","createDeclarationIntent","address","buildNextBlock","GenericHost","services","start","Promise","resolve","console","log","stop","DefaultServiceProvider","_services","services","getService","serviceIdentifier","ServiceLifetime","Singleton","Transient","assertEx","isString","HDWallet","DEFAULT_WALLET_PATH","generateXyoBaseWalletFromPhrase","HDNodeWallet","Mnemonic","DEFAULT_ACTOR_ACCOUNT_PATH","api","bridge","finalizer","mempool","producer","rewardRedemption","BUILT_IN_DEV_MNEMONIC","INSECURE_GENESIS_REWARD_MNEMONIC","GENESIS_REWARD_AMOUNT","ATTO_XL1_PER_XL1","ROOT_WALLET_RUNTIME_ID","SHARED_ACCOUNT_REPORT_COUNT","ACTOR_LABELS","activeWalletReport","getAccountLabel","actorName","clearResolvedWalletReport","undefined","resolveActorAccountPath","actorConfig","accountPath","isAbsoluteAccountPath","startsWith","expandAccountPath","basePath","DEFAULT_WALLET_PATH","deriveWalletAtPath","mnemonic","seed","Mnemonic","fromPhrase","computeSeed","rootNode","HDNodeWallet","fromSeed","derivedNode","derivePath","HDWallet","createFromNode","baseWallet","generateXyoBaseWalletFromPhrase","getBuiltInDevMnemonic","getInsecureGenesisRewardMnemonic","resolveRootWallet","configuration","isConfigured","isBuiltInDevMnemonic","mnemonicKind","resolveWalletMetadata","account","address","derivationPath","label","privateKey","usesBuiltInDevMnemonic","resolveActorWallet","root","ActorMnemonicNotAllowedError","Error","actors","join","name","assertNoActorMnemonics","offenders","filter","actor","map","length","DerivationPathCollisionError","collisions","lines","Object","entries","path","detectDerivationPathCollisions","requestedActors","actorConfigMap","Map","bucketsByPath","get","fullPath","bucket","push","set","keys","resolveWalletReport","resolvedActors","Promise","all","labelMap","labels","sharedAccounts","Array","from","_","index","sharedIndex","buildInsecureGenesisRewardAccounts","accounts","initializeResolvedWalletReport","getResolvedWalletReport","formatSharedAccount","showPrivateKey","formatGenesisRewardAccount","balance","toString","formatWalletReport","report","sections","showSecrets","formatInsecureGenesisRewardWarning","resolveGenesisRewardAddress","config","chain","genesisRewardAddress","wallet","resolveWalletForActor","resolvedAccountPath","initActorSeedPhrase","context","bios","logger","config","walletKind","name","report","getResolvedWalletReport","isString","root","mnemonic","fallback","getBuiltInDevMnemonic","debug","assertEx","assertEx","asAttachableArchivistInstance","asAttachableModuleInstance","Mutex","initMutex","Mutex","bridgedModuleDictionary","initBridgedModule","bridge","moduleName","runExclusive","existing","address","mod","assertEx","resolve","moduleInstance","asAttachableModuleInstance","moduleMap","undefined","initBridgedArchivistModule","asAttachableArchivistInstance","RuntimeStatusMonitor","initStatusReporter","logger","statusReporter","RuntimeStatusMonitor","onGlobalTransition","to","log","error","process","exit","isDefined","actorAccountSingletons","initActorWallet","context","actorName","config","name","isDefined","accountPath","undefined","account","resolveWalletForActor","logger","debug","address","AbstractCreatable","creatable","Orchestrator","AbstractCreatable","actors","running","shuttingDown","readyState","length","some","a","isLocalActor","every","isReady","isShuttingDown","registerActor","actor","push","start","runReadyHandler","catch","err","logger","error","name","formatError","startHandler","warn","log","startResults","Promise","allSettled","map","startFailures","flatMap","r","i","status","reason","f","Error","stopHandler","stop","whenReady","timeoutMs","localActors","filter","undefined","all","timer","timeout","_","reject","setTimeout","race","clearTimeout","ActorV3","message","stack","String","assertEx","AbstractCreatableProvider","creatableProvider","RejectedTransactionsArchivistProviderMoniker","SimpleRejectedTransactionsArchivistProvider","AbstractCreatableProvider","defaultMoniker","dependencies","monikers","moniker","archivist","params","paramsHandler","assertEx","basicRemoteRunnerLocator","sdkBasicRemoteRunnerLocator","basicRemoteRunnerLocator","name","remoteConfig","signerTransport","dataLakeEndpoint","validators","sdkBasicRemoteRunnerLocator","basicRemoteViewerLocator","sdkBasicRemoteViewerLocator","basicRemoteViewerLocator","name","remoteConfig","dataLakeEndpoint","validators","sdkBasicRemoteViewerLocator","assertEx","commonLocatorFromConfig","remoteLocatorFromConfig","rootLocatorFromConfig","context","validateDepsOnRegister","config","commonLocatorFromConfig","locator","assertEx","remote","rpc","remoteLocatorFromConfig","undefined","freeze"]}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -333,7 +333,7 @@ var DEFAULT_FIXED_FEE = toHex(XL1(1000n) * AttoXL1ConvertFactor.xl1);
|
|
|
333
333
|
var DEFAULT_VARIABLE_FEE_BASIS_POINTS = 300;
|
|
334
334
|
var DEFAULT_HARDHAT_BRIDGE_CONTRACT = toAddress("2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6");
|
|
335
335
|
var DEFAULT_HARDHAT_CHAIN_ID = toHex("7A69");
|
|
336
|
-
var DEFAULT_HARDHAT_REMOTE_CHAIN_WALLET_PRIVATE_KEY = toHex("
|
|
336
|
+
var DEFAULT_HARDHAT_REMOTE_CHAIN_WALLET_PRIVATE_KEY = toHex("0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d");
|
|
337
337
|
var DEFAULT_HARDHAT_TOKEN_CONTRACT = toAddress("5FbDB2315678afecb367f032d93F642f64180aa3");
|
|
338
338
|
var DEFAULT_MAX_BRIDGE_AMOUNT = toHex(XL1(1000000n) * AttoXL1ConvertFactor.xl1);
|
|
339
339
|
var DEFAULT_MIN_BRIDGE_AMOUNT = toHex(XL1(1500n) * AttoXL1ConvertFactor.xl1);
|