@xyo-network/chain-orchestration 1.23.0 → 1.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,29 +1,40 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __decorateClass = (decorators, target, key, kind) => {
5
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
6
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
7
+ if (decorator = decorators[i])
8
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9
+ if (kind && result) __defProp(target, key, result);
10
+ return result;
11
+ };
12
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
3
13
 
4
14
  // src/shared/actor/v3/ActorV3.ts
5
- import { AbstractCreatable, assertEx, delay, IdLogger } from "@xylabs/sdk-js";
15
+ import {
16
+ AbstractCreatable,
17
+ assertEx,
18
+ delay,
19
+ IdLogger
20
+ } from "@xylabs/sdk-js";
6
21
  import { Semaphore } from "async-mutex";
7
22
  import z from "zod";
8
- var noopCounter = {
9
- add: /* @__PURE__ */ __name(() => {
10
- }, "add")
11
- };
12
- var noopUpDownCounter = {
13
- add: /* @__PURE__ */ __name(() => {
14
- }, "add")
15
- };
16
- var noopGauge = {
17
- record: /* @__PURE__ */ __name(() => {
18
- }, "record")
19
- };
20
- var noopHistogram = {
21
- record: /* @__PURE__ */ __name(() => {
22
- }, "record")
23
- };
23
+ var noopCounter = { add: () => {
24
+ } };
25
+ var noopUpDownCounter = { add: () => {
26
+ } };
27
+ var noopGauge = { record: () => {
28
+ } };
29
+ var noopHistogram = { record: () => {
30
+ } };
24
31
  var CreatableNameZod = z.custom((val) => typeof val === "string" && val.length > 0);
25
- var StatusReporterInstanceZod = z.custom((val) => val !== null && typeof val === "object" && "report" in val);
26
- var AccountInstanceZod = z.custom((val) => val !== null && typeof val === "object" && "address" in val);
32
+ var StatusReporterInstanceZod = z.custom(
33
+ (val) => val !== null && typeof val === "object" && "report" in val
34
+ );
35
+ var AccountInstanceZod = z.custom(
36
+ (val) => val !== null && typeof val === "object" && "address" in val
37
+ );
27
38
  var ActorParamsV3Zod = z.object({
28
39
  account: AccountInstanceZod,
29
40
  locator: z.unknown(),
@@ -43,11 +54,7 @@ function createDeferred() {
43
54
  reject
44
55
  };
45
56
  }
46
- __name(createDeferred, "createDeferred");
47
57
  var ActorV3 = class extends AbstractCreatable {
48
- static {
49
- __name(this, "ActorV3");
50
- }
51
58
  _intervals = /* @__PURE__ */ new Map();
52
59
  _semaphores = /* @__PURE__ */ new Map();
53
60
  _timeouts = /* @__PURE__ */ new Map();
@@ -56,7 +63,10 @@ var ActorV3 = class extends AbstractCreatable {
56
63
  _readyError;
57
64
  _readyState = "pending";
58
65
  get logger() {
59
- this._logger = new IdLogger(assertEx(this.context.logger, () => `Logger is required in context for actor ${this.name}.`), () => this.name);
66
+ this._logger = new IdLogger(
67
+ assertEx(this.context.logger, () => `Logger is required in context for actor ${this.name}.`),
68
+ () => this.name
69
+ );
60
70
  return this._logger;
61
71
  }
62
72
  get readyError() {
@@ -75,10 +85,9 @@ var ActorV3 = class extends AbstractCreatable {
75
85
  return this.params.locator;
76
86
  }
77
87
  static async paramsHandler(params) {
78
- const baseParams = await super.paramsHandler({
79
- ...params,
80
- name: params.name ?? "UnknownActor"
81
- });
88
+ const baseParams = await super.paramsHandler(
89
+ { ...params, name: params.name ?? "UnknownActor" }
90
+ );
82
91
  const account = assertEx(params.account, () => `params.account is required for actor ${baseParams.name}.`);
83
92
  const locator = assertEx(params.locator, () => `params.locator is required for actor ${baseParams.name}.`);
84
93
  return {
@@ -88,8 +97,8 @@ var ActorV3 = class extends AbstractCreatable {
88
97
  };
89
98
  }
90
99
  /**
91
- * The timer runs until the actor is deactivated (or you manually stop it).
92
- */
100
+ * The timer runs until the actor is deactivated (or you manually stop it).
101
+ */
93
102
  registerTimer(timerName, callback, dueTimeMs, periodMs) {
94
103
  if (this.status !== "starting") {
95
104
  this.logger?.warn(`Cannot register timer '${timerName}' because actor is not starting.`);
@@ -134,10 +143,10 @@ var ActorV3 = class extends AbstractCreatable {
134
143
  this.logger?.debug(`Timer '${this.name}:${timerName}' registered: first call after ${dueTimeMs}ms, recurring every ${periodMs}ms.`);
135
144
  }
136
145
  /**
137
- * Invoked by the Orchestrator after `start()` to run the warm-pass.
138
- * Idempotent: returns immediately if already invoked.
139
- * Throws if `readyHandler` throws; resolves once `readyHandler` resolves.
140
- */
146
+ * Invoked by the Orchestrator after `start()` to run the warm-pass.
147
+ * Idempotent: returns immediately if already invoked.
148
+ * Throws if `readyHandler` throws; resolves once `readyHandler` resolves.
149
+ */
141
150
  async runReadyHandler() {
142
151
  if (this._readyState !== "pending") return;
143
152
  try {
@@ -155,15 +164,15 @@ var ActorV3 = class extends AbstractCreatable {
155
164
  async stopHandler() {
156
165
  await super.stopHandler();
157
166
  this.logger?.debug("Stopping all timers...");
158
- await Promise.all([
159
- ...this._semaphores.values()
160
- ].map(async (semaphore) => {
161
- while (semaphore.isLocked()) {
162
- this.logger?.debug("Waiting for running timer task to complete...");
163
- await delay(500);
164
- }
165
- await semaphore.acquire();
166
- }));
167
+ await Promise.all(
168
+ [...this._semaphores.values()].map(async (semaphore) => {
169
+ while (semaphore.isLocked()) {
170
+ this.logger?.debug("Waiting for running timer task to complete...");
171
+ await delay(500);
172
+ }
173
+ await semaphore.acquire();
174
+ })
175
+ );
167
176
  this._semaphores.clear();
168
177
  for (const [, timeoutRef] of this._timeouts.entries()) {
169
178
  clearTimeout(timeoutRef);
@@ -187,58 +196,44 @@ var ActorV3 = class extends AbstractCreatable {
187
196
  }, timeoutMs);
188
197
  });
189
198
  try {
190
- await Promise.race([
191
- this._readyDeferred.promise,
192
- timeout
193
- ]);
199
+ await Promise.race([this._readyDeferred.promise, timeout]);
194
200
  } finally {
195
201
  if (timer) clearTimeout(timer);
196
202
  }
197
203
  }
198
204
  /**
199
- * Create a `Counter` instrument bound to this actor's meter, or a no-op
200
- * stub if telemetry is not wired. Always returns a non-undefined value so
201
- * call sites can drop the optional-chain on `.add()`.
202
- *
203
- * TODO: in a future pass, consider folding these single-instrument helpers
204
- * into a declarative `createActorMeters({ counters: {...}, gauges: {...} })`
205
- * spec API for actors with many instruments.
206
- */
205
+ * Create a `Counter` instrument bound to this actor's meter, or a no-op
206
+ * stub if telemetry is not wired. Always returns a non-undefined value so
207
+ * call sites can drop the optional-chain on `.add()`.
208
+ *
209
+ * TODO: in a future pass, consider folding these single-instrument helpers
210
+ * into a declarative `createActorMeters({ counters: {...}, gauges: {...} })`
211
+ * spec API for actors with many instruments.
212
+ */
207
213
  counter(name, description) {
208
- return this.meter?.createCounter(name, {
209
- description
210
- }) ?? noopCounter;
214
+ return this.meter?.createCounter(name, { description }) ?? noopCounter;
211
215
  }
212
216
  /** Create a synchronous `Gauge` instrument, or a no-op stub if telemetry is not wired. */
213
217
  gauge(name, description) {
214
- return this.meter?.createGauge(name, {
215
- description
216
- }) ?? noopGauge;
218
+ return this.meter?.createGauge(name, { description }) ?? noopGauge;
217
219
  }
218
220
  /** Create a `Histogram` instrument, or a no-op stub if telemetry is not wired. */
219
221
  histogram(name, description) {
220
- return this.meter?.createHistogram(name, {
221
- description
222
- }) ?? noopHistogram;
222
+ return this.meter?.createHistogram(name, { description }) ?? noopHistogram;
223
223
  }
224
224
  /**
225
- * Override in subclasses to prove the actor can do useful work.
226
- * Default: no-op (the actor declares itself ready as soon as `start()` returns).
227
- */
225
+ * Override in subclasses to prove the actor can do useful work.
226
+ * Default: no-op (the actor declares itself ready as soon as `start()` returns).
227
+ */
228
228
  // eslint-disable-next-line @typescript-eslint/no-empty-function
229
229
  async readyHandler() {
230
230
  }
231
231
  /** Create an `UpDownCounter` instrument, or a no-op stub if telemetry is not wired. */
232
232
  upDownCounter(name, description) {
233
- return this.meter?.createUpDownCounter(name, {
234
- description
235
- }) ?? noopUpDownCounter;
233
+ return this.meter?.createUpDownCounter(name, { description }) ?? noopUpDownCounter;
236
234
  }
237
235
  };
238
236
  var Actor = class extends ActorV3 {
239
- static {
240
- __name(this, "Actor");
241
- }
242
237
  };
243
238
 
244
239
  // src/shared/buildTelemetryConfig.ts
@@ -246,70 +241,61 @@ function buildTelemetryConfig(config, serviceName, serviceVersion, defaultMetric
246
241
  const { otlpEndpoint } = config.telemetry?.otel ?? {};
247
242
  const { path: endpoint = "/metrics", port = defaultMetricsScrapePort } = config.telemetry?.metrics?.scrape ?? {};
248
243
  const telemetryConfig = {
249
- attributes: {
250
- serviceName,
251
- serviceVersion
252
- },
244
+ attributes: { serviceName, serviceVersion },
253
245
  otlpEndpoint,
254
- metricsConfig: {
255
- endpoint,
256
- port
257
- }
246
+ metricsConfig: { endpoint, port }
258
247
  };
259
248
  return telemetryConfig;
260
249
  }
261
- __name(buildTelemetryConfig, "buildTelemetryConfig");
262
250
 
263
251
  // src/shared/config/actors/Api.ts
264
- import { zodAsFactory, zodIsFactory, zodToFactory } from "@xylabs/sdk-js";
252
+ import {
253
+ zodAsFactory,
254
+ zodIsFactory,
255
+ zodToFactory
256
+ } from "@xylabs/sdk-js";
265
257
  import { BaseConfigContextZod, HostActorConfigZod } from "@xyo-network/xl1-sdk";
266
258
  import { globalRegistry, z as z2 } from "zod";
267
259
  var ApiConfigZod = HostActorConfigZod.extend(z2.object({
268
- initRewardsCache: z2.union([
269
- z2.number(),
270
- z2.string(),
271
- z2.boolean()
272
- ]).transform((v) => v !== "0" && v !== "false" && v !== false && v != 0).default(true).register(globalRegistry, {
260
+ initRewardsCache: z2.union([z2.number(), z2.string(), z2.boolean()]).transform(
261
+ (v) => v !== "0" && v !== "false" && v !== false && v != 0
262
+ ).default(true).register(globalRegistry, {
273
263
  description: "Whether to initialize the rewards cache on startup",
274
264
  title: "api.initRewardsCache",
275
265
  type: "boolean"
276
266
  }),
277
267
  /**
278
- * When `true`, the API actor runs in stateless mode: it holds no local
279
- * backing-store ownership, never loads the local LMDB/MongoDB node, and
280
- * federates every JSON-RPC request to upstream owner-actors via `JsonRpc*`
281
- * providers. Multiple stateless API instances can run behind a load
282
- * balancer for horizontal scaling. Requires `remote.rpc` to point at the
283
- * upstream API/Finalizer/Mempool/Indexer surfaces.
284
- */
285
- stateless: z2.union([
286
- z2.number(),
287
- z2.string(),
288
- z2.boolean()
289
- ]).transform((v) => v === "1" || v === "true" || v === true || v == 1).default(false).register(globalRegistry, {
268
+ * When `true`, the API actor runs in stateless mode: it holds no local
269
+ * backing-store ownership, never loads the local LMDB/MongoDB node, and
270
+ * federates every JSON-RPC request to upstream owner-actors via `JsonRpc*`
271
+ * providers. Multiple stateless API instances can run behind a load
272
+ * balancer for horizontal scaling. Requires `remote.rpc` to point at the
273
+ * upstream API/Finalizer/Mempool/Indexer surfaces.
274
+ */
275
+ stateless: z2.union([z2.number(), z2.string(), z2.boolean()]).transform(
276
+ (v) => v === "1" || v === "true" || v === true || v == 1
277
+ ).default(false).register(globalRegistry, {
290
278
  description: "Run the API actor as a stateless federation node (availableBackings: [network])",
291
279
  title: "api.stateless",
292
280
  type: "boolean"
293
281
  }),
294
282
  /**
295
- * Back-compat for the surface-aware route split. When `true`, `POST /rpc`
296
- * serves the full `XyoConnection` (both node-surface and indexed-surface
297
- * methods), preserving pre-Phase-7 behavior for clients that haven't yet
298
- * migrated to `POST /rpc/indexed`. When `false`, `/rpc` is strictly
299
- * node-surface only and indexed methods are 404 at `/rpc`.
300
- *
301
- * `/rpc/indexed` mounts independently of this flag whenever the locator's
302
- * connection has any indexed branch.
303
- *
304
- * Default `true` for the first release that includes Phase 7 — flip to
305
- * `false` per environment once external clients (explorers, wallets, dApps)
306
- * have moved their indexed-method calls to `/rpc/indexed`.
307
- */
308
- legacyMixedRpc: z2.union([
309
- z2.number(),
310
- z2.string(),
311
- z2.boolean()
312
- ]).transform((v) => v !== "0" && v !== "false" && v !== false && v != 0).default(true).register(globalRegistry, {
283
+ * Back-compat for the surface-aware route split. When `true`, `POST /rpc`
284
+ * serves the full `XyoConnection` (both node-surface and indexed-surface
285
+ * methods), preserving pre-Phase-7 behavior for clients that haven't yet
286
+ * migrated to `POST /rpc/indexed`. When `false`, `/rpc` is strictly
287
+ * node-surface only and indexed methods are 404 at `/rpc`.
288
+ *
289
+ * `/rpc/indexed` mounts independently of this flag whenever the locator's
290
+ * connection has any indexed branch.
291
+ *
292
+ * Default `true` for the first release that includes Phase 7 — flip to
293
+ * `false` per environment once external clients (explorers, wallets, dApps)
294
+ * have moved their indexed-method calls to `/rpc/indexed`.
295
+ */
296
+ legacyMixedRpc: z2.union([z2.number(), z2.string(), z2.boolean()]).transform(
297
+ (v) => v !== "0" && v !== "false" && v !== false && v != 0
298
+ ).default(true).register(globalRegistry, {
313
299
  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.",
314
300
  title: "api.legacyMixedRpc",
315
301
  type: "boolean"
@@ -318,16 +304,27 @@ var ApiConfigZod = HostActorConfigZod.extend(z2.object({
318
304
  var isApiConfig = zodIsFactory(ApiConfigZod);
319
305
  var asApiConfig = zodAsFactory(ApiConfigZod, "asApiConfig");
320
306
  var toApiConfig = zodToFactory(ApiConfigZod, "toApiConfig");
321
- var ApiConfigContext = BaseConfigContextZod.extend({
322
- config: ApiConfigZod
323
- });
307
+ var ApiConfigContext = BaseConfigContextZod.extend({ config: ApiConfigZod });
324
308
  var isApiConfigContext = zodIsFactory(ApiConfigContext);
325
309
  var asApiConfigContext = zodAsFactory(ApiConfigContext, "asApiConfigContext");
326
310
  var toApiConfigContext = zodToFactory(ApiConfigContext, "toApiConfigContext");
327
311
 
328
312
  // src/shared/config/actors/Bridge.ts
329
- import { AddressZod, HexZod, toAddress, toHex, zodAsFactory as zodAsFactory2, zodIsFactory as zodIsFactory2, zodToFactory as zodToFactory2 } from "@xylabs/sdk-js";
330
- import { AttoXL1ConvertFactor, BaseConfigContextZod as BaseConfigContextZod2, HostActorConfigZod as HostActorConfigZod2, XL1 } from "@xyo-network/xl1-sdk";
313
+ import {
314
+ AddressZod,
315
+ HexZod,
316
+ toAddress,
317
+ toHex,
318
+ zodAsFactory as zodAsFactory2,
319
+ zodIsFactory as zodIsFactory2,
320
+ zodToFactory as zodToFactory2
321
+ } from "@xylabs/sdk-js";
322
+ import {
323
+ AttoXL1ConvertFactor,
324
+ BaseConfigContextZod as BaseConfigContextZod2,
325
+ HostActorConfigZod as HostActorConfigZod2,
326
+ XL1
327
+ } from "@xyo-network/xl1-sdk";
331
328
  import { globalRegistry as globalRegistry2, z as z3 } from "zod";
332
329
  var DEFAULT_FIXED_FEE = toHex(XL1(1000n) * AttoXL1ConvertFactor.xl1);
333
330
  var DEFAULT_VARIABLE_FEE_BASIS_POINTS = 300;
@@ -449,16 +446,23 @@ var BridgeSettingsZod = BridgeConfigZod.pick({
449
446
  var isBridgeConfig = zodIsFactory2(BridgeConfigZod);
450
447
  var asBridgeConfig = zodAsFactory2(BridgeConfigZod, "asBridgeConfig");
451
448
  var toBridgeConfig = zodToFactory2(BridgeConfigZod, "toBridgeConfig");
452
- var BridgeConfigContext = BaseConfigContextZod2.extend({
453
- config: BridgeConfigZod
454
- });
449
+ var BridgeConfigContext = BaseConfigContextZod2.extend({ config: BridgeConfigZod });
455
450
  var isBridgeConfigContext = zodIsFactory2(BridgeConfigContext);
456
451
  var asBridgeConfigContext = zodAsFactory2(BridgeConfigContext, "asBridgeConfigContext");
457
452
  var toBridgeConfigContext = zodToFactory2(BridgeConfigContext, "toBridgeConfigContext");
458
453
 
459
454
  // src/shared/config/actors/Finalizer.ts
460
- import { AddressZod as AddressZod2, zodAsFactory as zodAsFactory3, zodIsFactory as zodIsFactory3, zodToFactory as zodToFactory3 } from "@xylabs/sdk-js";
461
- import { BaseConfigContextZod as BaseConfigContextZod3, DEFAULT_MIN_CANDIDATES, HostActorConfigZod as HostActorConfigZod3 } from "@xyo-network/xl1-sdk";
455
+ import {
456
+ AddressZod as AddressZod2,
457
+ zodAsFactory as zodAsFactory3,
458
+ zodIsFactory as zodIsFactory3,
459
+ zodToFactory as zodToFactory3
460
+ } from "@xylabs/sdk-js";
461
+ import {
462
+ BaseConfigContextZod as BaseConfigContextZod3,
463
+ DEFAULT_MIN_CANDIDATES,
464
+ HostActorConfigZod as HostActorConfigZod3
465
+ } from "@xyo-network/xl1-sdk";
462
466
  import { z as z4 } from "zod";
463
467
  var FinalizerConfigZod = HostActorConfigZod3.extend({
464
468
  allowedProducers: z4.array(AddressZod2).optional(),
@@ -471,15 +475,17 @@ var FinalizerConfigZod = HostActorConfigZod3.extend({
471
475
  var isFinalizerConfig = zodIsFactory3(FinalizerConfigZod);
472
476
  var asFinalizerConfig = zodAsFactory3(FinalizerConfigZod, "asFinalizerConfig");
473
477
  var toFinalizerConfig = zodToFactory3(FinalizerConfigZod, "toFinalizerConfig");
474
- var FinalizerConfigContext = BaseConfigContextZod3.extend({
475
- config: FinalizerConfigZod
476
- });
478
+ var FinalizerConfigContext = BaseConfigContextZod3.extend({ config: FinalizerConfigZod });
477
479
  var isFinalizerConfigContext = zodIsFactory3(FinalizerConfigContext);
478
480
  var asFinalizerConfigContext = zodAsFactory3(FinalizerConfigContext, "asFinalizerConfigContext");
479
481
  var toFinalizerConfigContext = zodToFactory3(FinalizerConfigContext, "toFinalizerConfigContext");
480
482
 
481
483
  // src/shared/config/actors/Mempool.ts
482
- import { zodAsFactory as zodAsFactory4, zodIsFactory as zodIsFactory4, zodToFactory as zodToFactory4 } from "@xylabs/sdk-js";
484
+ import {
485
+ zodAsFactory as zodAsFactory4,
486
+ zodIsFactory as zodIsFactory4,
487
+ zodToFactory as zodToFactory4
488
+ } from "@xylabs/sdk-js";
483
489
  import { BaseConfigContextZod as BaseConfigContextZod4, HostActorConfigZod as HostActorConfigZod4 } from "@xyo-network/xl1-sdk";
484
490
  import { globalRegistry as globalRegistry3, z as z5 } from "zod";
485
491
  var DEFAULT_MEMPOOL_BLOCK_PRUNE_INTERVAL = 1e3;
@@ -487,24 +493,11 @@ var DEFAULT_MEMPOOL_TRANSACTION_PRUNE_INTERVAL = 1e3;
487
493
  var DEFAULT_MEMPOOL_DEMOTION_THRESHOLD = 3;
488
494
  var DEFAULT_MEMPOOL_MAX_PENDING_TRANSACTIONS = 0;
489
495
  var MempoolConfigZod = HostActorConfigZod4.extend({
490
- enabled: z5.union([
491
- z5.string(),
492
- z5.boolean()
493
- ]).default("false").transform((val, ctx) => {
496
+ enabled: z5.union([z5.string(), z5.boolean()]).default("false").transform((val, ctx) => {
494
497
  if (typeof val === "boolean") return val;
495
498
  const normalized = val.toLowerCase().trim();
496
- if ([
497
- "true",
498
- "1",
499
- "yes",
500
- "on"
501
- ].includes(normalized)) return true;
502
- if ([
503
- "false",
504
- "0",
505
- "no",
506
- "off"
507
- ].includes(normalized)) return false;
499
+ if (["true", "1", "yes", "on"].includes(normalized)) return true;
500
+ if (["false", "0", "no", "off"].includes(normalized)) return false;
508
501
  ctx.addIssue({
509
502
  code: "invalid_type",
510
503
  expected: "boolean",
@@ -541,15 +534,18 @@ var MempoolConfigZod = HostActorConfigZod4.extend({
541
534
  var isMempoolConfig = zodIsFactory4(MempoolConfigZod);
542
535
  var asMempoolConfig = zodAsFactory4(MempoolConfigZod, "asMempoolConfig");
543
536
  var toMempoolConfig = zodToFactory4(MempoolConfigZod, "toMempoolConfig");
544
- var MempoolConfigContext = BaseConfigContextZod4.extend({
545
- config: MempoolConfigZod
546
- });
537
+ var MempoolConfigContext = BaseConfigContextZod4.extend({ config: MempoolConfigZod });
547
538
  var isMempoolConfigContext = zodIsFactory4(MempoolConfigContext);
548
539
  var asMempoolConfigContext = zodAsFactory4(MempoolConfigContext, "asMempoolConfigContext");
549
540
  var toMempoolConfigContext = zodToFactory4(MempoolConfigContext, "toMempoolConfigContext");
550
541
 
551
542
  // src/shared/config/actors/Producer.ts
552
- import { AddressZod as AddressZod3, zodAsFactory as zodAsFactory5, zodIsFactory as zodIsFactory5, zodToFactory as zodToFactory5 } from "@xylabs/sdk-js";
543
+ import {
544
+ AddressZod as AddressZod3,
545
+ zodAsFactory as zodAsFactory5,
546
+ zodIsFactory as zodIsFactory5,
547
+ zodToFactory as zodToFactory5
548
+ } from "@xylabs/sdk-js";
553
549
  import { ActorConfigZod, BaseConfigContextZod as BaseConfigContextZod5 } from "@xyo-network/xl1-sdk";
554
550
  import { globalRegistry as globalRegistry4, z as z6 } from "zod";
555
551
  var DEFAULT_BLOCK_PRODUCTION_CHECK_INTERVAL = 1e4;
@@ -590,23 +586,23 @@ var ProducerConfigZod = ActorConfigZod.extend(z6.object({
590
586
  var isProducerConfig = zodIsFactory5(ProducerConfigZod);
591
587
  var asProducerConfig = zodAsFactory5(ProducerConfigZod, "asProducerConfig");
592
588
  var toProducerConfig = zodToFactory5(ProducerConfigZod, "toProducerConfig");
593
- var ProducerConfigContext = BaseConfigContextZod5.extend({
594
- config: ProducerConfigZod
595
- });
589
+ var ProducerConfigContext = BaseConfigContextZod5.extend({ config: ProducerConfigZod });
596
590
  var isProducerConfigContext = zodIsFactory5(ProducerConfigContext);
597
591
  var asProducerConfigContext = zodAsFactory5(ProducerConfigContext, "asProducerConfigContext");
598
592
  var toProducerConfigContext = zodToFactory5(ProducerConfigContext, "toProducerConfigContext");
599
593
 
600
594
  // src/shared/config/actors/RewardRedemption.ts
601
- import { zodAsFactory as zodAsFactory6, zodIsFactory as zodIsFactory6, zodToFactory as zodToFactory6 } from "@xylabs/sdk-js";
595
+ import {
596
+ zodAsFactory as zodAsFactory6,
597
+ zodIsFactory as zodIsFactory6,
598
+ zodToFactory as zodToFactory6
599
+ } from "@xylabs/sdk-js";
602
600
  import { BaseConfigContextZod as BaseConfigContextZod6, HostActorConfigZod as HostActorConfigZod5 } from "@xyo-network/xl1-sdk";
603
601
  var RewardRedemptionConfigZod = HostActorConfigZod5.extend({});
604
602
  var isRewardRedemptionConfig = zodIsFactory6(RewardRedemptionConfigZod);
605
603
  var asRewardRedemptionConfig = zodAsFactory6(RewardRedemptionConfigZod, "asRewardRedemptionConfig");
606
604
  var toRewardRedemptionConfig = zodToFactory6(RewardRedemptionConfigZod, "toRewardRedemptionConfig");
607
- var RewardRedemptionConfigContext = BaseConfigContextZod6.extend({
608
- config: RewardRedemptionConfigZod
609
- });
605
+ var RewardRedemptionConfigContext = BaseConfigContextZod6.extend({ config: RewardRedemptionConfigZod });
610
606
  var isRewardRedemptionConfigContext = zodIsFactory6(RewardRedemptionConfigContext);
611
607
  var asRewardRedemptionConfigContext = zodAsFactory6(RewardRedemptionConfigContext, "asRewardRedemptionConfigContext");
612
608
  var toRewardRedemptionConfigContext = zodToFactory6(RewardRedemptionConfigContext, "toRewardRedemptionConfigContext");
@@ -621,26 +617,27 @@ function mergeConfig({ actors, ...baseConfig }) {
621
617
  })
622
618
  };
623
619
  }
624
- __name(mergeConfig, "mergeConfig");
625
620
 
626
621
  // src/shared/createDeclarationIntentBlock.ts
627
622
  import { buildNextBlock } from "@xyo-network/chain-sdk";
628
623
  import { createDeclarationIntent } from "@xyo-network/xl1-sdk";
629
624
  async function createProducerChainStakeIntentBlock(prevBlock, producerAccount, range) {
630
- const producerDeclarationPayload = createDeclarationIntent(producerAccount.address, "producer", range[0], range[1]);
631
- return await buildNextBlock(prevBlock, [], [
632
- producerDeclarationPayload
633
- ], [
634
- producerAccount
635
- ]);
625
+ const producerDeclarationPayload = createDeclarationIntent(
626
+ producerAccount.address,
627
+ "producer",
628
+ range[0],
629
+ range[1]
630
+ );
631
+ return await buildNextBlock(
632
+ prevBlock,
633
+ [],
634
+ [producerDeclarationPayload],
635
+ [producerAccount]
636
+ );
636
637
  }
637
- __name(createProducerChainStakeIntentBlock, "createProducerChainStakeIntentBlock");
638
638
 
639
639
  // src/shared/host/implementation/DefaultHost.ts
640
640
  var GenericHost = class {
641
- static {
642
- __name(this, "GenericHost");
643
- }
644
641
  services;
645
642
  constructor(services) {
646
643
  this.services = services;
@@ -657,9 +654,6 @@ var GenericHost = class {
657
654
 
658
655
  // src/shared/host/implementation/DefaultServiceProvider.ts
659
656
  var DefaultServiceProvider = class {
660
- static {
661
- __name(this, "DefaultServiceProvider");
662
- }
663
657
  _services;
664
658
  constructor(services) {
665
659
  this._services = services;
@@ -709,24 +703,19 @@ var activeWalletReport;
709
703
  function getAccountLabel(actorName) {
710
704
  return ACTOR_LABELS[actorName] ?? actorName;
711
705
  }
712
- __name(getAccountLabel, "getAccountLabel");
713
706
  function clearResolvedWalletReport() {
714
707
  activeWalletReport = void 0;
715
708
  }
716
- __name(clearResolvedWalletReport, "clearResolvedWalletReport");
717
709
  function resolveActorAccountPath(actorName, actorConfig) {
718
710
  if (actorConfig?.accountPath !== void 0) return actorConfig.accountPath;
719
711
  return DEFAULT_ACTOR_ACCOUNT_PATH[actorName] ?? "0";
720
712
  }
721
- __name(resolveActorAccountPath, "resolveActorAccountPath");
722
713
  function isAbsoluteAccountPath(accountPath) {
723
714
  return accountPath.startsWith("m/");
724
715
  }
725
- __name(isAbsoluteAccountPath, "isAbsoluteAccountPath");
726
716
  function expandAccountPath(accountPath, basePath = DEFAULT_WALLET_PATH) {
727
717
  return isAbsoluteAccountPath(accountPath) ? accountPath : `${basePath}/${accountPath}`;
728
718
  }
729
- __name(expandAccountPath, "expandAccountPath");
730
719
  async function deriveWalletAtPath(mnemonic, accountPath) {
731
720
  if (isAbsoluteAccountPath(accountPath)) {
732
721
  const seed = Mnemonic.fromPhrase(mnemonic).computeSeed();
@@ -737,15 +726,12 @@ async function deriveWalletAtPath(mnemonic, accountPath) {
737
726
  const baseWallet = await generateXyoBaseWalletFromPhrase(mnemonic);
738
727
  return await baseWallet.derivePath(accountPath);
739
728
  }
740
- __name(deriveWalletAtPath, "deriveWalletAtPath");
741
729
  function getBuiltInDevMnemonic() {
742
730
  return BUILT_IN_DEV_MNEMONIC;
743
731
  }
744
- __name(getBuiltInDevMnemonic, "getBuiltInDevMnemonic");
745
732
  function getInsecureGenesisRewardMnemonic() {
746
733
  return INSECURE_GENESIS_REWARD_MNEMONIC;
747
734
  }
748
- __name(getInsecureGenesisRewardMnemonic, "getInsecureGenesisRewardMnemonic");
749
735
  function resolveRootWallet(configuration) {
750
736
  const isConfigured = configuration.mnemonic !== void 0;
751
737
  const mnemonic = configuration.mnemonic ?? BUILT_IN_DEV_MNEMONIC;
@@ -758,8 +744,12 @@ function resolveRootWallet(configuration) {
758
744
  mnemonicKind: isBuiltInDevMnemonic ? "built-in-dev" : "configured-root"
759
745
  };
760
746
  }
761
- __name(resolveRootWallet, "resolveRootWallet");
762
- async function resolveWalletMetadata({ accountPath, actorName, mnemonic, mnemonicKind }) {
747
+ async function resolveWalletMetadata({
748
+ accountPath,
749
+ actorName,
750
+ mnemonic,
751
+ mnemonicKind
752
+ }) {
763
753
  const account = await deriveWalletAtPath(mnemonic, accountPath);
764
754
  return {
765
755
  accountPath,
@@ -773,7 +763,6 @@ async function resolveWalletMetadata({ accountPath, actorName, mnemonic, mnemoni
773
763
  usesBuiltInDevMnemonic: mnemonic === BUILT_IN_DEV_MNEMONIC
774
764
  };
775
765
  }
776
- __name(resolveWalletMetadata, "resolveWalletMetadata");
777
766
  async function resolveActorWallet(actorName, actorConfig, root) {
778
767
  return await resolveWalletMetadata({
779
768
  accountPath: resolveActorAccountPath(actorName, actorConfig),
@@ -782,11 +771,7 @@ async function resolveActorWallet(actorName, actorConfig, root) {
782
771
  mnemonicKind: root.mnemonicKind
783
772
  });
784
773
  }
785
- __name(resolveActorWallet, "resolveActorWallet");
786
774
  var ActorMnemonicNotAllowedError = class extends Error {
787
- static {
788
- __name(this, "ActorMnemonicNotAllowedError");
789
- }
790
775
  actors;
791
776
  constructor(actors) {
792
777
  super([
@@ -801,14 +786,12 @@ function assertNoActorMnemonics(configuration) {
801
786
  const offenders = configuration.actors.filter((actor) => typeof actor.mnemonic === "string").map((actor) => actor.name);
802
787
  if (offenders.length > 0) throw new ActorMnemonicNotAllowedError(offenders);
803
788
  }
804
- __name(assertNoActorMnemonics, "assertNoActorMnemonics");
805
789
  var DerivationPathCollisionError = class extends Error {
806
- static {
807
- __name(this, "DerivationPathCollisionError");
808
- }
809
790
  collisions;
810
791
  constructor(collisions) {
811
- const lines = Object.entries(collisions).map(([path, actors]) => ` - ${actors.join(", ")} \u2192 ${path}`);
792
+ const lines = Object.entries(collisions).map(
793
+ ([path, actors]) => ` - ${actors.join(", ")} \u2192 ${path}`
794
+ );
812
795
  super([
813
796
  "Two or more actors resolve to the same wallet derivation path:",
814
797
  ...lines,
@@ -819,10 +802,7 @@ var DerivationPathCollisionError = class extends Error {
819
802
  }
820
803
  };
821
804
  function detectDerivationPathCollisions(requestedActors, configuration) {
822
- const actorConfigMap = new Map(configuration.actors.map((actor) => [
823
- actor.name,
824
- actor
825
- ]));
805
+ const actorConfigMap = new Map(configuration.actors.map((actor) => [actor.name, actor]));
826
806
  const bucketsByPath = /* @__PURE__ */ new Map();
827
807
  for (const actorName of requestedActors) {
828
808
  const accountPath = resolveActorAccountPath(actorName, actorConfigMap.get(actorName));
@@ -838,71 +818,57 @@ function detectDerivationPathCollisions(requestedActors, configuration) {
838
818
  if (Object.keys(collisions).length === 0) return void 0;
839
819
  return new DerivationPathCollisionError(collisions);
840
820
  }
841
- __name(detectDerivationPathCollisions, "detectDerivationPathCollisions");
842
821
  async function resolveWalletReport(requestedActors, configuration) {
843
822
  const root = resolveRootWallet(configuration);
844
- const actorConfigMap = new Map(configuration.actors.map((actor) => [
845
- actor.name,
846
- actor
847
- ]));
848
- const resolvedActors = await Promise.all(requestedActors.map(async (actorName) => await resolveActorWallet(actorName, actorConfigMap.get(actorName), root)));
823
+ const actorConfigMap = new Map(configuration.actors.map((actor) => [actor.name, actor]));
824
+ const resolvedActors = await Promise.all(
825
+ requestedActors.map(async (actorName) => await resolveActorWallet(actorName, actorConfigMap.get(actorName), root))
826
+ );
849
827
  const labelMap = /* @__PURE__ */ new Map();
850
828
  for (const actor of resolvedActors) {
851
829
  const labels = labelMap.get(actor.derivationPath) ?? [];
852
830
  labels.push(actor.label);
853
831
  labelMap.set(actor.derivationPath, labels);
854
832
  }
855
- const sharedAccounts = await Promise.all(Array.from({
856
- length: SHARED_ACCOUNT_REPORT_COUNT
857
- }, (_, index) => index).map(async (sharedIndex) => {
858
- const account = await resolveWalletMetadata({
859
- accountPath: `${sharedIndex}`,
860
- actorName: ROOT_WALLET_RUNTIME_ID,
861
- mnemonic: root.mnemonic,
862
- mnemonicKind: root.mnemonicKind
863
- });
864
- const labels = labelMap.get(account.derivationPath);
865
- return {
866
- ...account,
867
- label: labels?.join(", ") ?? `shared[${sharedIndex}]`
868
- };
869
- }));
833
+ const sharedAccounts = await Promise.all(
834
+ Array.from({ length: SHARED_ACCOUNT_REPORT_COUNT }, (_, index) => index).map(async (sharedIndex) => {
835
+ const account = await resolveWalletMetadata({
836
+ accountPath: `${sharedIndex}`,
837
+ actorName: ROOT_WALLET_RUNTIME_ID,
838
+ mnemonic: root.mnemonic,
839
+ mnemonicKind: root.mnemonicKind
840
+ });
841
+ const labels = labelMap.get(account.derivationPath);
842
+ return { ...account, label: labels?.join(", ") ?? `shared[${sharedIndex}]` };
843
+ })
844
+ );
870
845
  return {
871
- requestedActors: [
872
- ...requestedActors
873
- ],
846
+ requestedActors: [...requestedActors],
874
847
  root,
875
848
  sharedAccounts
876
849
  };
877
850
  }
878
- __name(resolveWalletReport, "resolveWalletReport");
879
851
  async function buildInsecureGenesisRewardAccounts() {
880
- const accounts = await Promise.all(Array.from({
881
- length: SHARED_ACCOUNT_REPORT_COUNT
882
- }, (_, index) => index).map(async (sharedIndex) => {
883
- const account = await resolveWalletMetadata({
884
- accountPath: `${sharedIndex}`,
885
- actorName: "genesisReward",
886
- mnemonic: INSECURE_GENESIS_REWARD_MNEMONIC,
887
- mnemonicKind: "insecure-genesis-reward"
888
- });
889
- return {
890
- ...account,
891
- label: sharedIndex === 0 ? "genesisRewardAddress" : `genesisReward[${sharedIndex}]`
892
- };
893
- }));
852
+ const accounts = await Promise.all(
853
+ Array.from({ length: SHARED_ACCOUNT_REPORT_COUNT }, (_, index) => index).map(async (sharedIndex) => {
854
+ const account = await resolveWalletMetadata({
855
+ accountPath: `${sharedIndex}`,
856
+ actorName: "genesisReward",
857
+ mnemonic: INSECURE_GENESIS_REWARD_MNEMONIC,
858
+ mnemonicKind: "insecure-genesis-reward"
859
+ });
860
+ return { ...account, label: sharedIndex === 0 ? "genesisRewardAddress" : `genesisReward[${sharedIndex}]` };
861
+ })
862
+ );
894
863
  return accounts;
895
864
  }
896
- __name(buildInsecureGenesisRewardAccounts, "buildInsecureGenesisRewardAccounts");
897
865
  async function initializeResolvedWalletReport(requestedActors, configuration) {
898
866
  activeWalletReport = await resolveWalletReport(requestedActors, configuration);
899
867
  return activeWalletReport;
900
868
  }
901
- __name(initializeResolvedWalletReport, "initializeResolvedWalletReport");
902
869
  function getResolvedWalletReport() {
903
870
  return activeWalletReport;
904
871
  }
905
- __name(getResolvedWalletReport, "getResolvedWalletReport");
906
872
  function formatSharedAccount(account, showPrivateKey) {
907
873
  const lines = [
908
874
  `[${account.accountPath}] ${account.label}`,
@@ -913,7 +879,6 @@ function formatSharedAccount(account, showPrivateKey) {
913
879
  if (showPrivateKey) lines.push(`privateKey: ${account.privateKey ?? "unavailable"}`);
914
880
  return lines.join("\n");
915
881
  }
916
- __name(formatSharedAccount, "formatSharedAccount");
917
882
  function formatGenesisRewardAccount(account) {
918
883
  const balance = account.accountPath === "0" ? GENESIS_REWARD_AMOUNT / ATTO_XL1_PER_XL1 : 0n;
919
884
  return [
@@ -924,7 +889,6 @@ function formatGenesisRewardAccount(account) {
924
889
  `balance: ${balance.toString()} XL1`
925
890
  ].join("\n");
926
891
  }
927
- __name(formatGenesisRewardAccount, "formatGenesisRewardAccount");
928
892
  function formatWalletReport(report) {
929
893
  const sections = [];
930
894
  const showSecrets = report.root.isBuiltInDevMnemonic;
@@ -949,7 +913,6 @@ function formatWalletReport(report) {
949
913
  ].join("\n"));
950
914
  return sections.join("\n\n");
951
915
  }
952
- __name(formatWalletReport, "formatWalletReport");
953
916
  function formatInsecureGenesisRewardWarning(accounts) {
954
917
  return [
955
918
  "INSECURE GENESIS REWARD WALLET WARNING",
@@ -968,21 +931,18 @@ function formatInsecureGenesisRewardWarning(accounts) {
968
931
  accounts.map((account) => formatGenesisRewardAccount(account)).join("\n\n")
969
932
  ].join("\n");
970
933
  }
971
- __name(formatInsecureGenesisRewardWarning, "formatInsecureGenesisRewardWarning");
972
934
  async function resolveGenesisRewardAddress(config) {
973
935
  if (config.chain.genesisRewardAddress) return config.chain.genesisRewardAddress;
974
936
  const wallet = await generateXyoBaseWalletFromPhrase(INSECURE_GENESIS_REWARD_MNEMONIC);
975
937
  const account = await wallet.derivePath("0");
976
938
  return account.address;
977
939
  }
978
- __name(resolveGenesisRewardAddress, "resolveGenesisRewardAddress");
979
940
  async function resolveWalletForActor(actorName, accountPath) {
980
941
  const report = activeWalletReport;
981
942
  const mnemonic = report?.root.mnemonic ?? BUILT_IN_DEV_MNEMONIC;
982
943
  const resolvedAccountPath = accountPath ?? resolveActorAccountPath(actorName);
983
944
  return await deriveWalletAtPath(mnemonic, resolvedAccountPath);
984
945
  }
985
- __name(resolveWalletForActor, "resolveWalletForActor");
986
946
 
987
947
  // src/shared/init/initActorSeedPhrase.ts
988
948
  async function initActorSeedPhrase(context, bios) {
@@ -995,7 +955,6 @@ async function initActorSeedPhrase(context, bios) {
995
955
  logger?.debug(`[${walletKind}] Falling back to built-in development mnemonic`);
996
956
  return assertEx2(fallback, () => "Unable to resolve mnemonic");
997
957
  }
998
- __name(initActorSeedPhrase, "initActorSeedPhrase");
999
958
 
1000
959
  // src/shared/init/initBridgedModule.ts
1001
960
  import { assertEx as assertEx3 } from "@xylabs/sdk-js";
@@ -1018,33 +977,26 @@ async function initBridgedModule({ bridge, moduleName }) {
1018
977
  return moduleInstance;
1019
978
  });
1020
979
  }
1021
- __name(initBridgedModule, "initBridgedModule");
1022
980
  async function initBridgedArchivistModule({ bridge, moduleName }) {
1023
- return assertEx3(asAttachableArchivistInstance(await initBridgedModule({
1024
- bridge,
1025
- moduleName
1026
- })), () => `Could not convert ${moduleName} to attachable archivist instance`);
981
+ return assertEx3(
982
+ asAttachableArchivistInstance(await initBridgedModule({ bridge, moduleName })),
983
+ () => `Could not convert ${moduleName} to attachable archivist instance`
984
+ );
1027
985
  }
1028
- __name(initBridgedArchivistModule, "initBridgedArchivistModule");
1029
986
 
1030
987
  // src/shared/init/initStatusReporter.ts
1031
988
  import { RuntimeStatusMonitor } from "@xyo-network/xl1-sdk";
1032
989
  function initStatusReporter({ logger }) {
1033
990
  const statusReporter = new RuntimeStatusMonitor(logger);
1034
- statusReporter.onGlobalTransition({
1035
- to: "started"
1036
- }, () => {
991
+ statusReporter.onGlobalTransition({ to: "started" }, () => {
1037
992
  logger.log("All services started.");
1038
993
  });
1039
- statusReporter.onGlobalTransition({
1040
- to: "error"
1041
- }, () => {
994
+ statusReporter.onGlobalTransition({ to: "error" }, () => {
1042
995
  logger.error("Producer encountered an unhandled error!");
1043
996
  process.exit(1);
1044
997
  });
1045
998
  return statusReporter;
1046
999
  }
1047
- __name(initStatusReporter, "initStatusReporter");
1048
1000
 
1049
1001
  // src/shared/init/initWallet.ts
1050
1002
  import { isDefined } from "@xylabs/sdk-js";
@@ -1058,21 +1010,10 @@ async function initActorWallet(context) {
1058
1010
  actorAccountSingletons[actorName] = account;
1059
1011
  return actorAccountSingletons[actorName];
1060
1012
  }
1061
- __name(initActorWallet, "initActorWallet");
1062
1013
 
1063
1014
  // src/shared/orchestrator/Orchestrator.ts
1064
1015
  import { AbstractCreatable as AbstractCreatable2, creatable } from "@xylabs/sdk-js";
1065
- function _ts_decorate(decorators, target, key, desc) {
1066
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1067
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1068
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1069
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1070
- }
1071
- __name(_ts_decorate, "_ts_decorate");
1072
1016
  var Orchestrator = class extends AbstractCreatable2 {
1073
- static {
1074
- __name(this, "Orchestrator");
1075
- }
1076
1017
  actors = [];
1077
1018
  running = false;
1078
1019
  shuttingDown = false;
@@ -1089,9 +1030,9 @@ var Orchestrator = class extends AbstractCreatable2 {
1089
1030
  return this.shuttingDown;
1090
1031
  }
1091
1032
  /**
1092
- * Registers an actor.
1093
- * (We won't activate the actor until `start()` is called.)
1094
- */
1033
+ * Registers an actor.
1034
+ * (We won't activate the actor until `start()` is called.)
1035
+ */
1095
1036
  async registerActor(actor) {
1096
1037
  this.actors.push(actor);
1097
1038
  if (this.running) {
@@ -1104,9 +1045,9 @@ var Orchestrator = class extends AbstractCreatable2 {
1104
1045
  }
1105
1046
  }
1106
1047
  /**
1107
- * Starts the orchestrator: activates all actors in parallel and kicks off their warm-pass.
1108
- * `whenReady()` resolves once every actor's `readyHandler` has succeeded.
1109
- */
1048
+ * Starts the orchestrator: activates all actors in parallel and kicks off their warm-pass.
1049
+ * `whenReady()` resolves once every actor's `readyHandler` has succeeded.
1050
+ */
1110
1051
  async startHandler() {
1111
1052
  await super.startHandler();
1112
1053
  if (this.running) {
@@ -1116,12 +1057,7 @@ var Orchestrator = class extends AbstractCreatable2 {
1116
1057
  this.logger?.log(`[Orchestrator] Starting ${this.actors.length} actor(s) in parallel...`);
1117
1058
  this.running = true;
1118
1059
  const startResults = await Promise.allSettled(this.actors.map((a) => a.start()));
1119
- const startFailures = startResults.flatMap((r, i) => r.status === "rejected" ? [
1120
- {
1121
- actor: this.actors[i],
1122
- reason: r.reason
1123
- }
1124
- ] : []);
1060
+ const startFailures = startResults.flatMap((r, i) => r.status === "rejected" ? [{ actor: this.actors[i], reason: r.reason }] : []);
1125
1061
  if (startFailures.length > 0) {
1126
1062
  for (const f of startFailures) this.logger?.error(`[Orchestrator] Actor [${f.actor?.name ?? "?"}] failed to start: ${formatError(f.reason)}`);
1127
1063
  throw new Error(`[Orchestrator] ${startFailures.length} actor(s) failed to start`);
@@ -1135,8 +1071,8 @@ var Orchestrator = class extends AbstractCreatable2 {
1135
1071
  }
1136
1072
  }
1137
1073
  /**
1138
- * Stops the orchestrator: deactivates all actors.
1139
- */
1074
+ * Stops the orchestrator: deactivates all actors.
1075
+ */
1140
1076
  async stopHandler() {
1141
1077
  await super.stopHandler();
1142
1078
  if (!this.running) {
@@ -1151,9 +1087,9 @@ var Orchestrator = class extends AbstractCreatable2 {
1151
1087
  this.logger?.log("[Orchestrator] Stopped.");
1152
1088
  }
1153
1089
  /**
1154
- * Resolves once every actor reports ready. Rejects if any actor's `readyHandler` throws,
1155
- * or after `timeoutMs` if provided.
1156
- */
1090
+ * Resolves once every actor reports ready. Rejects if any actor's `readyHandler` throws,
1091
+ * or after `timeoutMs` if provided.
1092
+ */
1157
1093
  async whenReady(timeoutMs) {
1158
1094
  const localActors = this.actors.filter(isLocalActor);
1159
1095
  if (localActors.length === 0) return;
@@ -1168,50 +1104,30 @@ var Orchestrator = class extends AbstractCreatable2 {
1168
1104
  }, timeoutMs);
1169
1105
  });
1170
1106
  try {
1171
- await Promise.race([
1172
- Promise.all(localActors.map((a) => a.whenReady())),
1173
- timeout
1174
- ]);
1107
+ await Promise.race([Promise.all(localActors.map((a) => a.whenReady())), timeout]);
1175
1108
  } finally {
1176
1109
  if (timer) clearTimeout(timer);
1177
1110
  }
1178
1111
  }
1179
1112
  };
1180
- Orchestrator = _ts_decorate([
1113
+ Orchestrator = __decorateClass([
1181
1114
  creatable()
1182
1115
  ], Orchestrator);
1183
1116
  function isLocalActor(actor) {
1184
1117
  return actor instanceof ActorV3;
1185
1118
  }
1186
- __name(isLocalActor, "isLocalActor");
1187
1119
  function formatError(err) {
1188
1120
  if (err instanceof Error) return `${err.message}${err.stack ? `
1189
1121
  ${err.stack}` : ""}`;
1190
1122
  return String(err);
1191
1123
  }
1192
- __name(formatError, "formatError");
1193
1124
 
1194
1125
  // src/shared/provider/SimpleRejectedTransactionsArchivistProvider.ts
1195
1126
  import { assertEx as assertEx4 } from "@xylabs/sdk-js";
1196
1127
  import { AbstractCreatableProvider, creatableProvider } from "@xyo-network/xl1-sdk";
1197
- function _ts_decorate2(decorators, target, key, desc) {
1198
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1199
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1200
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1201
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1202
- }
1203
- __name(_ts_decorate2, "_ts_decorate");
1204
1128
  var RejectedTransactionsArchivistProviderMoniker = "RejectedTransactionsArchivistProvider";
1205
- var SimpleRejectedTransactionsArchivistProvider = class _SimpleRejectedTransactionsArchivistProvider extends AbstractCreatableProvider {
1206
- static {
1207
- __name(this, "SimpleRejectedTransactionsArchivistProvider");
1208
- }
1209
- static defaultMoniker = RejectedTransactionsArchivistProviderMoniker;
1210
- static dependencies = [];
1211
- static monikers = [
1212
- RejectedTransactionsArchivistProviderMoniker
1213
- ];
1214
- moniker = _SimpleRejectedTransactionsArchivistProvider.defaultMoniker;
1129
+ var SimpleRejectedTransactionsArchivistProvider = class extends AbstractCreatableProvider {
1130
+ moniker = SimpleRejectedTransactionsArchivistProvider.defaultMoniker;
1215
1131
  get archivist() {
1216
1132
  return this.params.archivist;
1217
1133
  }
@@ -1222,27 +1138,24 @@ var SimpleRejectedTransactionsArchivistProvider = class _SimpleRejectedTransacti
1222
1138
  };
1223
1139
  }
1224
1140
  };
1225
- SimpleRejectedTransactionsArchivistProvider = _ts_decorate2([
1141
+ __publicField(SimpleRejectedTransactionsArchivistProvider, "defaultMoniker", RejectedTransactionsArchivistProviderMoniker);
1142
+ __publicField(SimpleRejectedTransactionsArchivistProvider, "dependencies", []);
1143
+ __publicField(SimpleRejectedTransactionsArchivistProvider, "monikers", [RejectedTransactionsArchivistProviderMoniker]);
1144
+ SimpleRejectedTransactionsArchivistProvider = __decorateClass([
1226
1145
  creatableProvider()
1227
1146
  ], SimpleRejectedTransactionsArchivistProvider);
1228
1147
 
1229
1148
  // src/neutral/config/locators/basicRemoteRunnerLocator.ts
1230
1149
  import { basicRemoteRunnerLocator as sdkBasicRemoteRunnerLocator } from "@xyo-network/xl1-sdk";
1231
1150
  function basicRemoteRunnerLocator(name, remoteConfig, signerTransport, dataLakeEndpoint, validators) {
1232
- return sdkBasicRemoteRunnerLocator(name, remoteConfig, signerTransport, dataLakeEndpoint, {
1233
- validators
1234
- });
1151
+ return sdkBasicRemoteRunnerLocator(name, remoteConfig, signerTransport, dataLakeEndpoint, { validators });
1235
1152
  }
1236
- __name(basicRemoteRunnerLocator, "basicRemoteRunnerLocator");
1237
1153
 
1238
1154
  // src/neutral/config/locators/basicRemoteViewerLocator.ts
1239
1155
  import { basicRemoteViewerLocator as sdkBasicRemoteViewerLocator } from "@xyo-network/xl1-sdk";
1240
1156
  function basicRemoteViewerLocator(name, remoteConfig, dataLakeEndpoint, validators) {
1241
- return sdkBasicRemoteViewerLocator(name, remoteConfig, dataLakeEndpoint, {
1242
- validators
1243
- });
1157
+ return sdkBasicRemoteViewerLocator(name, remoteConfig, dataLakeEndpoint, { validators });
1244
1158
  }
1245
- __name(basicRemoteViewerLocator, "basicRemoteViewerLocator");
1246
1159
 
1247
1160
  // src/neutral/config/locators/rootLocatorFromConfig.ts
1248
1161
  import { assertEx as assertEx5 } from "@xylabs/sdk-js";
@@ -1250,11 +1163,13 @@ import { commonLocatorFromConfig, remoteLocatorFromConfig } from "@xyo-network/x
1250
1163
  async function rootLocatorFromConfig(context, validateDepsOnRegister = false) {
1251
1164
  const { config } = context;
1252
1165
  await commonLocatorFromConfig(context, validateDepsOnRegister);
1253
- const locator = assertEx5(await (config.remote.rpc ? remoteLocatorFromConfig(context, validateDepsOnRegister) : void 0), () => "Root locator could not be created from config. No supported configuration found.");
1166
+ const locator = assertEx5(
1167
+ await (config.remote.rpc ? remoteLocatorFromConfig(context, validateDepsOnRegister) : void 0),
1168
+ () => "Root locator could not be created from config. No supported configuration found."
1169
+ );
1254
1170
  locator.freeze();
1255
1171
  return locator;
1256
1172
  }
1257
- __name(rootLocatorFromConfig, "rootLocatorFromConfig");
1258
1173
  export {
1259
1174
  Actor,
1260
1175
  ActorMnemonicNotAllowedError,
@@ -1358,4 +1273,4 @@ export {
1358
1273
  toRewardRedemptionConfig,
1359
1274
  toRewardRedemptionConfigContext
1360
1275
  };
1361
- //# sourceMappingURL=index.mjs.map
1276
+ //# sourceMappingURL=index.mjs.map