@xyo-network/chain-orchestration 1.17.2 → 1.17.6

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.
Files changed (170) hide show
  1. package/dist/neutral/ChainInitializableParams.d.ts +11 -0
  2. package/dist/neutral/ChainInitializableParams.d.ts.map +1 -0
  3. package/dist/neutral/actor/Actor.d.ts.map +1 -1
  4. package/dist/neutral/actor/BalanceActor.d.ts +14 -0
  5. package/dist/neutral/actor/BalanceActor.d.ts.map +1 -0
  6. package/dist/neutral/actor/ValidatorActor.d.ts +23 -0
  7. package/dist/neutral/actor/ValidatorActor.d.ts.map +1 -0
  8. package/dist/neutral/actor/index.d.ts +2 -0
  9. package/dist/neutral/actor/index.d.ts.map +1 -1
  10. package/dist/neutral/archivists/ChainFinalized/archivist.d.ts +4 -0
  11. package/dist/neutral/archivists/ChainFinalized/archivist.d.ts.map +1 -0
  12. package/dist/neutral/archivists/ChainFinalized/index.d.ts +2 -0
  13. package/dist/neutral/archivists/ChainFinalized/index.d.ts.map +1 -0
  14. package/dist/neutral/archivists/ChainFinalized/local.d.ts +7 -0
  15. package/dist/neutral/archivists/ChainFinalized/local.d.ts.map +1 -0
  16. package/dist/neutral/archivists/PendingBlocks/archivist.d.ts +4 -0
  17. package/dist/neutral/archivists/PendingBlocks/archivist.d.ts.map +1 -0
  18. package/dist/neutral/archivists/PendingBlocks/index.d.ts +2 -0
  19. package/dist/neutral/archivists/PendingBlocks/index.d.ts.map +1 -0
  20. package/dist/neutral/archivists/PendingBlocks/local.d.ts +7 -0
  21. package/dist/neutral/archivists/PendingBlocks/local.d.ts.map +1 -0
  22. package/dist/neutral/archivists/PendingTransactions/archivist.d.ts +4 -0
  23. package/dist/neutral/archivists/PendingTransactions/archivist.d.ts.map +1 -0
  24. package/dist/neutral/archivists/PendingTransactions/index.d.ts +2 -0
  25. package/dist/neutral/archivists/PendingTransactions/index.d.ts.map +1 -0
  26. package/dist/neutral/archivists/PendingTransactions/local.d.ts +7 -0
  27. package/dist/neutral/archivists/PendingTransactions/local.d.ts.map +1 -0
  28. package/dist/neutral/archivists/RejectedTransactions/archivist.d.ts +4 -0
  29. package/dist/neutral/archivists/RejectedTransactions/archivist.d.ts.map +1 -0
  30. package/dist/neutral/archivists/RejectedTransactions/index.d.ts +2 -0
  31. package/dist/neutral/archivists/RejectedTransactions/index.d.ts.map +1 -0
  32. package/dist/neutral/archivists/RejectedTransactions/local.d.ts +4 -0
  33. package/dist/neutral/archivists/RejectedTransactions/local.d.ts.map +1 -0
  34. package/dist/neutral/archivists/StakeIntentState/archivist.d.ts +5 -0
  35. package/dist/neutral/archivists/StakeIntentState/archivist.d.ts.map +1 -0
  36. package/dist/neutral/archivists/StakeIntentState/index.d.ts +2 -0
  37. package/dist/neutral/archivists/StakeIntentState/index.d.ts.map +1 -0
  38. package/dist/neutral/archivists/StakeIntentState/local.d.ts +7 -0
  39. package/dist/neutral/archivists/StakeIntentState/local.d.ts.map +1 -0
  40. package/dist/neutral/archivists/index.d.ts +6 -0
  41. package/dist/neutral/archivists/index.d.ts.map +1 -0
  42. package/dist/neutral/archivists/lib/index.d.ts +2 -0
  43. package/dist/neutral/archivists/lib/index.d.ts.map +1 -0
  44. package/dist/neutral/archivists/lib/localPersistentArchivist.d.ts +21 -0
  45. package/dist/neutral/archivists/lib/localPersistentArchivist.d.ts.map +1 -0
  46. package/dist/neutral/buildTelemetryConfig.d.ts +13 -0
  47. package/dist/neutral/buildTelemetryConfig.d.ts.map +1 -0
  48. package/dist/neutral/health/index.d.ts +2 -0
  49. package/dist/neutral/health/index.d.ts.map +1 -0
  50. package/dist/neutral/health/initHealthEndpoints.d.ts +11 -0
  51. package/dist/neutral/health/initHealthEndpoints.d.ts.map +1 -0
  52. package/dist/neutral/host/implementation/DefaultHost.d.ts +12 -0
  53. package/dist/neutral/host/implementation/DefaultHost.d.ts.map +1 -0
  54. package/dist/neutral/host/implementation/DefaultServiceCollection.d.ts +24 -0
  55. package/dist/neutral/host/implementation/DefaultServiceCollection.d.ts.map +1 -0
  56. package/dist/neutral/host/implementation/DefaultServiceProvider.d.ts +7 -0
  57. package/dist/neutral/host/implementation/DefaultServiceProvider.d.ts.map +1 -0
  58. package/dist/neutral/host/implementation/index.d.ts +3 -0
  59. package/dist/neutral/host/implementation/index.d.ts.map +1 -0
  60. package/dist/neutral/host/index.d.ts +3 -0
  61. package/dist/neutral/host/index.d.ts.map +1 -0
  62. package/dist/neutral/host/model/Host.d.ts +19 -0
  63. package/dist/neutral/host/model/Host.d.ts.map +1 -0
  64. package/dist/neutral/host/model/ServiceCollection.d.ts +20 -0
  65. package/dist/neutral/host/model/ServiceCollection.d.ts.map +1 -0
  66. package/dist/neutral/host/model/ServiceProvider.d.ts +4 -0
  67. package/dist/neutral/host/model/ServiceProvider.d.ts.map +1 -0
  68. package/dist/neutral/host/model/index.d.ts +4 -0
  69. package/dist/neutral/host/model/index.d.ts.map +1 -0
  70. package/dist/neutral/index.d.ts +7 -2
  71. package/dist/neutral/index.d.ts.map +1 -1
  72. package/dist/neutral/index.mjs +701 -626
  73. package/dist/neutral/index.mjs.map +1 -1
  74. package/dist/neutral/init/index.d.ts +1 -2
  75. package/dist/neutral/init/index.d.ts.map +1 -1
  76. package/dist/neutral/init/initChainStakeViewer.d.ts +4 -1
  77. package/dist/neutral/init/initChainStakeViewer.d.ts.map +1 -1
  78. package/dist/neutral/init/initServerNode.d.ts +4 -2
  79. package/dist/neutral/init/initServerNode.d.ts.map +1 -1
  80. package/dist/neutral/init/initStatusReporter.d.ts +6 -0
  81. package/dist/neutral/init/initStatusReporter.d.ts.map +1 -0
  82. package/dist/neutral/manifest/getLocator.d.ts +1 -1
  83. package/dist/neutral/manifest/getLocator.d.ts.map +1 -1
  84. package/dist/neutral/manifest/loadNode.d.ts.map +1 -1
  85. package/dist/neutral/manifest/public/index.d.ts +5 -2
  86. package/dist/neutral/manifest/public/index.d.ts.map +1 -1
  87. package/dist/neutral/orchestrator/Orchestrator.d.ts +0 -2
  88. package/dist/neutral/orchestrator/Orchestrator.d.ts.map +1 -1
  89. package/dist/neutral/status/RuntimeStatusMonitor.d.ts +31 -0
  90. package/dist/neutral/status/RuntimeStatusMonitor.d.ts.map +1 -0
  91. package/dist/neutral/status/ServiceStatus.d.ts +8 -0
  92. package/dist/neutral/status/ServiceStatus.d.ts.map +1 -0
  93. package/dist/neutral/status/index.d.ts +3 -0
  94. package/dist/neutral/status/index.d.ts.map +1 -0
  95. package/package.json +16 -18
  96. package/src/ChainInitializableParams.ts +12 -0
  97. package/src/actor/Actor.ts +0 -1
  98. package/src/actor/BalanceActor.ts +36 -0
  99. package/src/actor/ValidatorActor.ts +126 -0
  100. package/src/actor/index.ts +2 -0
  101. package/src/archivists/ChainFinalized/archivist.ts +21 -0
  102. package/src/archivists/ChainFinalized/index.ts +1 -0
  103. package/src/archivists/ChainFinalized/local.ts +18 -0
  104. package/src/archivists/PendingBlocks/archivist.ts +21 -0
  105. package/src/archivists/PendingBlocks/index.ts +1 -0
  106. package/src/archivists/PendingBlocks/local.ts +18 -0
  107. package/src/archivists/PendingTransactions/archivist.ts +21 -0
  108. package/src/archivists/PendingTransactions/index.ts +1 -0
  109. package/src/archivists/PendingTransactions/local.ts +18 -0
  110. package/src/archivists/RejectedTransactions/archivist.ts +21 -0
  111. package/src/archivists/RejectedTransactions/index.ts +1 -0
  112. package/src/archivists/RejectedTransactions/local.ts +20 -0
  113. package/src/archivists/StakeIntentState/archivist.ts +24 -0
  114. package/src/archivists/StakeIntentState/index.ts +1 -0
  115. package/src/archivists/StakeIntentState/local.ts +19 -0
  116. package/src/archivists/index.ts +5 -0
  117. package/src/archivists/lib/index.ts +1 -0
  118. package/src/archivists/lib/localPersistentArchivist.ts +63 -0
  119. package/src/buildTelemetryConfig.ts +15 -0
  120. package/src/health/index.ts +1 -0
  121. package/src/health/initHealthEndpoints.ts +71 -0
  122. package/src/host/implementation/DefaultHost.ts +25 -0
  123. package/src/host/implementation/DefaultServiceCollection.ts +60 -0
  124. package/src/host/implementation/DefaultServiceProvider.ts +12 -0
  125. package/src/host/implementation/index.ts +2 -0
  126. package/src/host/index.ts +2 -0
  127. package/src/host/model/Host.ts +21 -0
  128. package/src/host/model/ServiceCollection.ts +22 -0
  129. package/src/host/model/ServiceProvider.ts +3 -0
  130. package/src/host/model/index.ts +3 -0
  131. package/src/index.ts +7 -2
  132. package/src/init/index.ts +1 -2
  133. package/src/init/initChainStakeViewer.ts +1 -1
  134. package/src/init/initServerNode.ts +26 -12
  135. package/src/init/initStatusReporter.ts +16 -0
  136. package/src/manifest/getLocator.ts +2 -33
  137. package/src/manifest/loadNode.ts +1 -3
  138. package/src/manifest/public/{WithoutMempool/Pending.json → Chain.json} +18 -18
  139. package/src/manifest/public/{WithMempool/Pending.json → Pending.json} +2 -2
  140. package/src/manifest/public/index.ts +20 -2
  141. package/src/orchestrator/Orchestrator.ts +0 -2
  142. package/src/status/RuntimeStatusMonitor.ts +117 -0
  143. package/src/status/ServiceStatus.ts +20 -0
  144. package/src/status/index.ts +2 -0
  145. package/dist/neutral/archivist/index.d.ts +0 -3
  146. package/dist/neutral/archivist/index.d.ts.map +0 -1
  147. package/dist/neutral/archivist/initArchivistSync.d.ts +0 -6
  148. package/dist/neutral/archivist/initArchivistSync.d.ts.map +0 -1
  149. package/dist/neutral/archivist/wrapWithReadCachingArchivist.d.ts +0 -5
  150. package/dist/neutral/archivist/wrapWithReadCachingArchivist.d.ts.map +0 -1
  151. package/dist/neutral/bridge.d.ts +0 -3
  152. package/dist/neutral/bridge.d.ts.map +0 -1
  153. package/dist/neutral/init/initPendingBlockArchivist.d.ts +0 -4
  154. package/dist/neutral/init/initPendingBlockArchivist.d.ts.map +0 -1
  155. package/dist/neutral/init/initPendingTransactionArchivist.d.ts +0 -4
  156. package/dist/neutral/init/initPendingTransactionArchivist.d.ts.map +0 -1
  157. package/dist/neutral/manifest/public/WithMempool/index.d.ts +0 -6
  158. package/dist/neutral/manifest/public/WithMempool/index.d.ts.map +0 -1
  159. package/dist/neutral/manifest/public/WithoutMempool/index.d.ts +0 -6
  160. package/dist/neutral/manifest/public/WithoutMempool/index.d.ts.map +0 -1
  161. package/src/archivist/index.ts +0 -2
  162. package/src/archivist/initArchivistSync.ts +0 -61
  163. package/src/archivist/wrapWithReadCachingArchivist.ts +0 -56
  164. package/src/bridge.ts +0 -25
  165. package/src/init/initPendingBlockArchivist.ts +0 -31
  166. package/src/init/initPendingTransactionArchivist.ts +0 -31
  167. package/src/manifest/public/WithMempool/Chain.json +0 -175
  168. package/src/manifest/public/WithMempool/index.ts +0 -20
  169. package/src/manifest/public/WithoutMempool/Chain.json +0 -97
  170. package/src/manifest/public/WithoutMempool/index.ts +0 -20
@@ -7,7 +7,7 @@ import type { ConfigContext } from '../ConfigContext.ts';
7
7
  * operation of the node (entirely in memory)
8
8
  * @returns A locator with the necessary modules registered
9
9
  */
10
- export declare const getLocator: ({ config, logger, balancesSummaryMap, transfersSummaryMap, }: ConfigContext<{
10
+ export declare const getLocator: ({ config, logger }: ConfigContext<{
11
11
  balancesSummaryMap: MapType<string, WithStorageMeta<BalancesStepSummary>>;
12
12
  transfersSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>;
13
13
  }>) => Promise<ModuleFactoryLocator>;
@@ -1 +1 @@
1
- {"version":3,"file":"getLocator.d.ts","sourceRoot":"","sources":["../../../src/manifest/getLocator.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAE1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAGjE,OAAO,KAAK,EACV,mBAAmB,EAAE,OAAO,EAAE,oBAAoB,EACnD,MAAM,+BAA+B,CAAA;AAItC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAExD;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,8DAE9B,aAAa,CAAC;IACf,kBAAkB,EAAE,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,mBAAmB,CAAC,CAAC,CAAA;IACzE,mBAAmB,EAAE,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAC,CAAA;CAC5E,CAAC,kCAgED,CAAA"}
1
+ {"version":3,"file":"getLocator.d.ts","sourceRoot":"","sources":["../../../src/manifest/getLocator.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAE1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAEjE,OAAO,KAAK,EACV,mBAAmB,EAAE,OAAO,EAAE,oBAAoB,EACnD,MAAM,+BAA+B,CAAA;AAGtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAExD;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,oBAAmB,aAAa,CAAC;IAChE,kBAAkB,EAAE,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,mBAAmB,CAAC,CAAC,CAAA;IACzE,mBAAmB,EAAE,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAC,CAAA;CAC5E,CAAC,kCA2CD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"loadNode.d.ts","sourceRoot":"","sources":["../../../src/manifest/loadNode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EACV,mBAAmB,EAAE,OAAO,EAAE,oBAAoB,EACnD,MAAM,+BAA+B,CAAA;AAEtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAMxD;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAU,8DAE5B,aAAa,CAAC;IACf,kBAAkB,EAAE,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,mBAAmB,CAAC,CAAC,CAAA;IACzE,mBAAmB,EAAE,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAC,CAAA;IAC3E,MAAM,EAAE,cAAc,CAAA;CACvB,CAAC,uKAaD,CAAA"}
1
+ {"version":3,"file":"loadNode.d.ts","sourceRoot":"","sources":["../../../src/manifest/loadNode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EACV,mBAAmB,EAAE,OAAO,EAAE,oBAAoB,EACnD,MAAM,+BAA+B,CAAA;AAEtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAMxD;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAU,8DAE5B,aAAa,CAAC;IACf,kBAAkB,EAAE,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,mBAAmB,CAAC,CAAC,CAAA;IACzE,mBAAmB,EAAE,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAC,CAAA;IAC3E,MAAM,EAAE,cAAc,CAAA;CACvB,CAAC,uKAWD,CAAA"}
@@ -1,3 +1,6 @@
1
- export * from './WithMempool/index.ts';
2
- export * from './WithoutMempool/index.ts';
1
+ import type { ModuleManifest } from '@xyo-network/manifest-model';
2
+ /**
3
+ * Public Child Manifests
4
+ */
5
+ export declare const PublicChildManifests: ModuleManifest[];
3
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/manifest/public/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/manifest/public/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAA0B,MAAM,6BAA6B,CAAA;AAazF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,cAAc,EAGhD,CAAA"}
@@ -3,8 +3,6 @@ import { AbstractCreatable } from '@xylabs/sdk-js';
3
3
  import type { ActorInstance } from '../actor/index.ts';
4
4
  export interface OrchestratorInstance extends CreatableInstance {
5
5
  registerActor(actor: ActorInstance): Promise<void>;
6
- start(): Promise<boolean>;
7
- stop(): Promise<boolean>;
8
6
  }
9
7
  export declare class Orchestrator extends AbstractCreatable implements OrchestratorInstance {
10
8
  protected actors: ActorInstance[];
@@ -1 +1 @@
1
- {"version":3,"file":"Orchestrator.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/Orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAa,MAAM,gBAAgB,CAAA;AAE7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEtD,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClD,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;IACzB,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;CACzB;AAED,qBACa,YAAa,SAAQ,iBAAkB,YAAW,oBAAoB;IACjF,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,CAAK;IACtC,SAAS,CAAC,eAAe,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAO;IACvD,SAAS,CAAC,OAAO,UAAQ;IAEzB;;;OAGG;IACG,aAAa,CAAC,KAAK,EAAE,aAAa;IAQxC;;OAEG;IACY,YAAY;IAkB3B;;OAEG;IACY,WAAW;CAe3B"}
1
+ {"version":3,"file":"Orchestrator.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/Orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAa,MAAM,gBAAgB,CAAA;AAE7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEtD,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACnD;AAED,qBACa,YAAa,SAAQ,iBAAkB,YAAW,oBAAoB;IACjF,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,CAAK;IACtC,SAAS,CAAC,eAAe,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAO;IACvD,SAAS,CAAC,OAAO,UAAQ;IAEzB;;;OAGG;IACG,aAAa,CAAC,KAAK,EAAE,aAAa;IAQxC;;OAEG;IACY,YAAY;IAkB3B;;OAEG;IACY,WAAW;CAe3B"}
@@ -0,0 +1,31 @@
1
+ import type { CreatableName, CreatableStatus } from '@xylabs/sdk-js';
2
+ import { LoggerStatusReporter } from './ServiceStatus.ts';
3
+ export type GlobalTransitionHandler = {
4
+ from?: CreatableStatus;
5
+ handler: (from: CreatableStatus, to: CreatableStatus) => void;
6
+ to?: CreatableStatus;
7
+ };
8
+ export type TransitionHandler = GlobalTransitionHandler & {
9
+ name?: string;
10
+ };
11
+ export declare class RuntimeStatusMonitor extends LoggerStatusReporter {
12
+ private globalTransitions;
13
+ private transitions;
14
+ getGlobalStatus(): CreatableStatus;
15
+ getStatus(name: CreatableName): CreatableStatus | undefined;
16
+ onGlobalTransition(match: {
17
+ from?: CreatableStatus;
18
+ to?: CreatableStatus;
19
+ }, handler: (from: CreatableStatus, to: CreatableStatus) => void): void;
20
+ /**
21
+ * Register a callback to be called on a specific transition.
22
+ */
23
+ onTransition(match: {
24
+ from?: CreatableStatus;
25
+ name: string;
26
+ to?: CreatableStatus;
27
+ }, handler: (from: CreatableStatus, to: CreatableStatus) => void): void;
28
+ report(name: CreatableName, status: CreatableStatus, progress?: number | Error): void;
29
+ private runTransitions;
30
+ }
31
+ //# sourceMappingURL=RuntimeStatusMonitor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuntimeStatusMonitor.d.ts","sourceRoot":"","sources":["../../../src/status/RuntimeStatusMonitor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AA8CzD,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,CAAC,EAAE,eAAe,CAAA;IACtB,OAAO,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,EAAE,EAAE,eAAe,KAAK,IAAI,CAAA;IAC7D,EAAE,CAAC,EAAE,eAAe,CAAA;CACrB,CAAA;AACD,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG;IACxD,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,qBAAa,oBAAqB,SAAQ,oBAAoB;IAC5D,OAAO,CAAC,iBAAiB,CAAgC;IACzD,OAAO,CAAC,WAAW,CAA0B;IAE7C,eAAe,IAAI,eAAe;IAMlC,SAAS,CAAC,IAAI,EAAE,aAAa,GAAG,eAAe,GAAG,SAAS;IAI3D,kBAAkB,CAAC,KAAK,EAAE;QAAE,IAAI,CAAC,EAAE,eAAe,CAAC;QAAC,EAAE,CAAC,EAAE,eAAe,CAAA;KAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,EAAE,EAAE,eAAe,KAAK,IAAI;IAIzI;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE;QAAE,IAAI,CAAC,EAAE,eAAe,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,eAAe,CAAA;KAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,EAAE,EAAE,eAAe,KAAK,IAAI;IAIxI,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI;IAkB9F,OAAO,CAAC,cAAc;CAgBvB"}
@@ -0,0 +1,8 @@
1
+ import type { CreatableName, CreatableStatus, CreatableStatusReporter, Logger } from '@xylabs/sdk-js';
2
+ export declare class LoggerStatusReporter implements CreatableStatusReporter {
3
+ protected logger: Logger;
4
+ protected statusMap: Record<CreatableName, CreatableStatus>;
5
+ constructor(logger: Logger);
6
+ report(name: CreatableName, status: CreatableStatus, progress?: number | Error): void;
7
+ }
8
+ //# sourceMappingURL=ServiceStatus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServiceStatus.d.ts","sourceRoot":"","sources":["../../../src/status/ServiceStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,EAChE,MAAM,gBAAgB,CAAA;AAEvB,qBAAa,oBAAqB,YAAW,uBAAuB;IAClE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAA;IAExB,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,aAAa,EAAE,eAAe,CAAC,CAAK;gBAEpD,MAAM,EAAE,MAAM;IAI1B,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI;CAMtF"}
@@ -0,0 +1,3 @@
1
+ export * from './RuntimeStatusMonitor.ts';
2
+ export * from './ServiceStatus.ts';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/status/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,oBAAoB,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json.schemastore.org/package.json",
3
3
  "name": "@xyo-network/chain-orchestration",
4
- "version": "1.17.2",
4
+ "version": "1.17.6",
5
5
  "description": "XYO Layer One SDK Orchestration",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
@@ -40,39 +40,37 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "@opentelemetry/api": "~1.9.0",
43
- "@xylabs/mongo": "~5.0.50",
44
- "@xylabs/sdk-js": "~5.0.50",
43
+ "@xylabs/mongo": "~5.0.51",
44
+ "@xylabs/sdk-js": "~5.0.51",
45
+ "@xyo-network/archivist-lmdb": "~5.2.17",
45
46
  "@xyo-network/archivist-memory": "~5.2.17",
46
47
  "@xyo-network/archivist-model": "~5.2.17",
47
48
  "@xyo-network/archivist-mongodb": "~5.2.17",
48
49
  "@xyo-network/archivist-view": "~5.2.17",
49
50
  "@xyo-network/bios": "~7.2.0",
50
- "@xyo-network/bridge-http": "~5.2.17",
51
51
  "@xyo-network/bridge-model": "~5.2.17",
52
- "@xyo-network/chain-modules": "~1.17.2",
53
- "@xyo-network/chain-protocol": "~1.17.2",
54
- "@xyo-network/chain-sdk": "~1.17.2",
55
- "@xyo-network/chain-services": "~1.17.2",
56
- "@xyo-network/chain-telemetry": "~1.17.2",
57
- "@xyo-network/diviner-model": "~5.2.17",
52
+ "@xyo-network/chain-protocol": "~1.17.6",
53
+ "@xyo-network/chain-sdk": "workspace:~",
54
+ "@xyo-network/chain-services": "workspace:~",
55
+ "@xyo-network/chain-telemetry": "workspace:~",
56
+ "@xyo-network/chain-utils": "workspace:~",
58
57
  "@xyo-network/manifest-wrapper": "~5.2.17",
59
58
  "@xyo-network/module-abstract": "~5.2.17",
60
59
  "@xyo-network/module-factory-locator": "~5.2.17",
61
60
  "@xyo-network/module-model": "~5.2.17",
62
- "@xyo-network/node-memory": "~5.2.17",
61
+ "@xyo-network/payload-builder": "~5.2.17",
63
62
  "@xyo-network/sentinel-memory": "~5.2.17",
64
- "@xyo-network/sentinel-model": "~5.2.17",
65
63
  "@xyo-network/typechain": "~4.0.11",
66
64
  "@xyo-network/wallet": "~5.2.17",
67
- "@xyo-network/xl1-protocol": "~1.14.16",
68
- "@xyo-network/xl1-protocol-sdk": "~1.17.2",
65
+ "@xyo-network/xl1-protocol": "~1.14.17",
66
+ "@xyo-network/xl1-protocol-sdk": "~1.17.6",
69
67
  "async-mutex": "~0.5.0",
70
68
  "ethers": "^6.16.0"
71
69
  },
72
70
  "devDependencies": {
73
- "@types/node": "~24.10.1",
74
- "@xylabs/sdk-js": "~5.0.50",
75
- "@xylabs/telemetry": "~5.0.50",
71
+ "@types/node": "~24.10.3",
72
+ "@xylabs/sdk-js": "~5.0.51",
73
+ "@xylabs/telemetry": "~5.0.51",
76
74
  "@xylabs/ts-scripts-yarn3": "~7.2.8",
77
75
  "@xylabs/tsconfig": "~7.2.8",
78
76
  "@xyo-network/account-model": "~5.2.17",
@@ -92,4 +90,4 @@
92
90
  "publishConfig": {
93
91
  "access": "restricted"
94
92
  }
95
- }
93
+ }
@@ -0,0 +1,12 @@
1
+ import type { MeterProvider, TracerProvider } from '@opentelemetry/api'
2
+ import type { InitializableParams } from '@xyo-network/xl1-protocol'
3
+ import type { Config } from '@xyo-network/xl1-protocol-sdk'
4
+
5
+ import type { RuntimeStatusMonitor } from './status/index.ts'
6
+
7
+ export type ChainInitializableParams = InitializableParams<{
8
+ config: Config
9
+ meterProvider: MeterProvider
10
+ statusReporter: RuntimeStatusMonitor
11
+ traceProvider: TracerProvider
12
+ }>
@@ -5,7 +5,6 @@ import {
5
5
  AbstractCreatable,
6
6
  Base, creatable, delay, IdLogger,
7
7
  } from '@xylabs/sdk-js'
8
- import { span, spanRootAsync } from '@xylabs/telemetry'
9
8
  import type { Config } from '@xyo-network/xl1-protocol-sdk'
10
9
  import { Semaphore } from 'async-mutex'
11
10
 
@@ -0,0 +1,36 @@
1
+ import { assertEx } from '@xylabs/sdk-js'
2
+ import type { ChainServiceCollectionV2, Config } from '@xyo-network/xl1-protocol-sdk'
3
+ import { Mutex } from 'async-mutex'
4
+
5
+ import { Actor, type ActorParams } from './Actor.ts'
6
+
7
+ export type BalanceActorParams = ActorParams<
8
+ Pick<ChainServiceCollectionV2, 'balance' | 'blockViewer'>
9
+ & { config: Config }>
10
+
11
+ export class BalanceActor extends Actor<BalanceActorParams> {
12
+ protected _updateMutex = new Mutex()
13
+
14
+ protected get balanceService() {
15
+ return assertEx(this.params.balance, () => 'balanceService not set')
16
+ }
17
+
18
+ protected get blockViewer() {
19
+ return assertEx(this.params.blockViewer, () => 'blockViewer not set')
20
+ }
21
+
22
+ override async startHandler(): Promise<void> {
23
+ await super.startHandler()
24
+ this.registerTimer('BalanceTimer', async () => {
25
+ await this.updateBalance()
26
+ }, 1000, 10_000/* 1000 */)
27
+ }
28
+
29
+ protected async updateBalance(): Promise<void> {
30
+ if (this._updateMutex.isLocked()) return
31
+ await this._updateMutex.runExclusive(async () => {
32
+ const head = await this.blockViewer.currentBlockHash()
33
+ await this.balanceService.accountBalances([], head)
34
+ })
35
+ }
36
+ }
@@ -0,0 +1,126 @@
1
+ import type { Hash } from '@xylabs/sdk-js'
2
+ import { assertEx, creatable } from '@xylabs/sdk-js'
3
+ import { ArchivistInstance } from '@xyo-network/archivist-model'
4
+ import { processPendingBlocks } from '@xyo-network/chain-sdk'
5
+ import { PayloadBuilder } from '@xyo-network/payload-builder'
6
+ import type { BlockBoundWitness } from '@xyo-network/xl1-protocol'
7
+ import type { ChainServiceCollectionV2, Config } from '@xyo-network/xl1-protocol-sdk'
8
+
9
+ import { Actor, ActorParams } from './Actor.ts'
10
+
11
+ export type ValidatorActorParams = ActorParams<
12
+ Pick<ChainServiceCollectionV2,
13
+ 'account'
14
+ | 'balance'
15
+ | 'blockViewer'
16
+ | 'chainStakeViewer'
17
+ | 'mempoolViewer'
18
+ // | 'chainSubmissionsArchivistWrite'
19
+ // | 'pendingBundledTransactionsArchivistWrite'
20
+ // | 'stakeIntent'
21
+ > & {
22
+ config: Config
23
+ pendingBlocksArchivist: ArchivistInstance
24
+ }>
25
+
26
+ @creatable()
27
+ export class ValidatorActor extends Actor<ValidatorActorParams> {
28
+ protected _lastValidatedBlock: BlockBoundWitness | undefined
29
+ protected _lastValidatedBlockHash: Hash | undefined
30
+
31
+ protected get account() {
32
+ return assertEx(this.params.account, () => 'account not set')
33
+ }
34
+
35
+ protected get balanceService() {
36
+ return assertEx(this.params.balance, () => 'balanceService not set')
37
+ }
38
+
39
+ protected get blockViewer() {
40
+ return assertEx(this.params.blockViewer, () => 'blockViewer not set')
41
+ }
42
+
43
+ protected get chainStakeViewer() {
44
+ return assertEx(this.params.chainStakeViewer, () => 'chainStakeViewer not set')
45
+ }
46
+
47
+ protected get mempoolViewer() {
48
+ return assertEx(this.params.mempoolViewer, () => 'mempoolViewer not set')
49
+ }
50
+
51
+ protected get pendingBlocksArchivist() {
52
+ return assertEx(this.params.pendingBlocksArchivist, () => 'pendingBlocksArchivist not set')
53
+ }
54
+
55
+ // protected get chainSubmissionsArchivistWrite() {
56
+ // return assertEx(this.params.chainSubmissionsArchivistWrite, () => 'chainSubmissionsArchivistWrite not set')
57
+ // }
58
+
59
+ // protected get pendingBundledTransactionsArchivistWrite() {
60
+ // return assertEx(this.params.pendingBundledTransactionsArchivistWrite, () => 'pendingBundledTransactionsArchivistWrite not set')
61
+ // }
62
+
63
+ // protected get stakeIntentService() {
64
+ // return assertEx(this.params.stakeIntent, () => 'stakeIntentService not set')
65
+ // }
66
+
67
+ // protected get validator() {
68
+ // return assertEx(this.params.validator, () => 'validator not set')
69
+ // }
70
+
71
+ override async startHandler(): Promise<void> {
72
+ await super.startHandler()
73
+ // Register a timer to check if we should produce a block
74
+ // this.registerTimer('BlockProductionTimer', async () => {
75
+ // await this.spanAsync('produceBlock', async () => {
76
+ // // Get the updated head
77
+ // const block = (await this.blockViewer.currentBlock())[0]
78
+ // if (isUndefined(block)) return
79
+ // // Check if we've already validated this head
80
+ // const hash = await PayloadBuilder.hash(block)
81
+ // // If our last validated block was this head, skip validation
82
+ // if (isDefined(this._lastValidatedBlock) && this._lastValidatedBlockHash === hash) {
83
+ // this.logger?.log('Block already validated:', `0x${toHex(block.block)}`)
84
+ // } else {
85
+ // this.logger?.log('Validating block:', `0x${toHex(block.block)}`)
86
+ // const valid = await this.validateBlock(block)
87
+ // if (valid) {
88
+ // this.logger?.log('Validated block:', `0x${toHex(block.block)}`)
89
+ // } else {
90
+ // this.logger?.log('Invalid block:', `0x${toHex(block.block)}`)
91
+ // await this.slashInvalidBlock(block)
92
+ // }
93
+ // }
94
+ // })
95
+ // }, 2000, 1500/* 500 */)
96
+
97
+ this.registerTimer('ValidatorActor', async () => {
98
+ await this.spanAsync('processPendingBlocks', async () => {
99
+ console.log('ValidatorActor: Processing pending blocks...')
100
+ await processPendingBlocks({
101
+ logger: this.logger,
102
+ mempoolViewer: this.mempoolViewer,
103
+ blockViewer: this.blockViewer,
104
+ chainArchivist: this.pendingBlocksArchivist,
105
+ })
106
+ })
107
+ }, 2000, 1500/* 500 */)
108
+ }
109
+
110
+ protected async slashInvalidBlock(_block: BlockBoundWitness): Promise<boolean> {
111
+ // TODO: Handle slashing logic
112
+ const slashed = await Promise.resolve(true)
113
+ return slashed
114
+ }
115
+
116
+ protected async validateBlock(block: BlockBoundWitness): Promise<boolean> {
117
+ // TODO: Validate using validation logic
118
+ const valid = await Promise.resolve(true)
119
+ // Store the last validated block and its hash
120
+ this._lastValidatedBlock = block
121
+ this._lastValidatedBlockHash = await PayloadBuilder.hash(block)
122
+
123
+ // Return the validation result
124
+ return valid
125
+ }
126
+ }
@@ -1 +1,3 @@
1
1
  export * from './Actor.ts'
2
+ export * from './BalanceActor.ts'
3
+ export * from './ValidatorActor.ts'
@@ -0,0 +1,21 @@
1
+ import type { ArchivistInstance } from '@xyo-network/archivist-model'
2
+ import { startupSpanAsync } from '@xyo-network/chain-utils'
3
+ import { timeBudget } from '@xyo-network/xl1-protocol-sdk'
4
+ import { Mutex } from 'async-mutex'
5
+
6
+ import type { ChainInitializableParams } from '../../ChainInitializableParams.ts'
7
+ import { initLocalChainFinalizedArchivist } from './local.ts'
8
+
9
+ const mutex = new Mutex()
10
+ let singleton: ArchivistInstance | undefined
11
+
12
+ export async function initChainFinalizedArchivist({ config, logger }: ChainInitializableParams) {
13
+ return await mutex.runExclusive(async () => {
14
+ if (singleton) return singleton
15
+ return await timeBudget('initChainFinalizedArchivist', logger, async () => {
16
+ const local = await startupSpanAsync('ChainFinalizedArchivist:initLocal', () => initLocalChainFinalizedArchivist({ config, logger }))
17
+ singleton = local
18
+ return singleton
19
+ }, 2000, true)
20
+ })
21
+ }
@@ -0,0 +1 @@
1
+ export * from './archivist.ts'
@@ -0,0 +1,18 @@
1
+ import type { ArchivistInstance } from '@xyo-network/archivist-model'
2
+ import type { Initializable } from '@xyo-network/xl1-protocol'
3
+ import type { Config } from '@xyo-network/xl1-protocol-sdk'
4
+ import { Mutex } from 'async-mutex'
5
+
6
+ import { getLocalPersistentArchivist } from '../lib/index.ts'
7
+
8
+ const mutex = new Mutex()
9
+ let singleton: ArchivistInstance | undefined
10
+
11
+ export const initLocalChainFinalizedArchivist: Initializable<{ config: Config }, ArchivistInstance> = async ({ config }): Promise<ArchivistInstance> => {
12
+ return await mutex.runExclusive(async () => {
13
+ if (singleton) return singleton
14
+ const { root } = config.storage
15
+ singleton = await getLocalPersistentArchivist('local-finalized-chain', 'chain', 'finalized', root)
16
+ return singleton
17
+ })
18
+ }
@@ -0,0 +1,21 @@
1
+ import type { ArchivistInstance } from '@xyo-network/archivist-model'
2
+ import { startupSpanAsync } from '@xyo-network/chain-utils'
3
+ import { timeBudget } from '@xyo-network/xl1-protocol-sdk'
4
+ import { Mutex } from 'async-mutex'
5
+
6
+ import type { ChainInitializableParams } from '../../ChainInitializableParams.ts'
7
+ import { initLocalPendingBlocksArchivist } from './local.ts'
8
+
9
+ const mutex = new Mutex()
10
+ let singleton: ArchivistInstance | undefined
11
+
12
+ export async function initPendingBlocksArchivist({ config, logger }: ChainInitializableParams) {
13
+ return await mutex.runExclusive(async () => {
14
+ if (singleton) return singleton
15
+ return await timeBudget('initPendingBlocksArchivist', logger, async () => {
16
+ const local = await startupSpanAsync('PendingBlocksArchivist:initLocal', () => initLocalPendingBlocksArchivist({ config, logger }))
17
+ singleton = local
18
+ return singleton
19
+ }, 2000, true)
20
+ })
21
+ }
@@ -0,0 +1 @@
1
+ export * from './archivist.ts'
@@ -0,0 +1,18 @@
1
+ import type { ArchivistInstance } from '@xyo-network/archivist-model'
2
+ import type { Initializable } from '@xyo-network/xl1-protocol'
3
+ import type { Config } from '@xyo-network/xl1-protocol-sdk'
4
+ import { Mutex } from 'async-mutex'
5
+
6
+ import { getLocalPersistentArchivist } from '../lib/index.ts'
7
+
8
+ const mutex = new Mutex()
9
+ let singleton: ArchivistInstance | undefined
10
+
11
+ export const initLocalPendingBlocksArchivist: Initializable<{ config: Config }, ArchivistInstance> = async ({ config }): Promise<ArchivistInstance> => {
12
+ return await mutex.runExclusive(async () => {
13
+ if (singleton) return singleton
14
+ const { root } = config.storage
15
+ singleton = await getLocalPersistentArchivist('local-pending-blocks', 'chain', 'pending_block_bundles', root)
16
+ return singleton
17
+ })
18
+ }
@@ -0,0 +1,21 @@
1
+ import type { ArchivistInstance } from '@xyo-network/archivist-model'
2
+ import { startupSpanAsync } from '@xyo-network/chain-utils'
3
+ import { timeBudget } from '@xyo-network/xl1-protocol-sdk'
4
+ import { Mutex } from 'async-mutex'
5
+
6
+ import type { ChainInitializableParams } from '../../ChainInitializableParams.ts'
7
+ import { initLocalPendingTransactionsArchivist } from './local.ts'
8
+
9
+ const mutex = new Mutex()
10
+ let singleton: ArchivistInstance | undefined
11
+
12
+ export async function initPendingTransactionsArchivist({ config, logger }: ChainInitializableParams) {
13
+ return await mutex.runExclusive(async () => {
14
+ if (singleton) return singleton
15
+ return await timeBudget('initPendingTransactionsArchivist', logger, async () => {
16
+ const local = await startupSpanAsync('PendingTransactionsArchivist:initLocal', () => initLocalPendingTransactionsArchivist({ config, logger }))
17
+ singleton = local
18
+ return singleton
19
+ }, 2000, true)
20
+ })
21
+ }
@@ -0,0 +1 @@
1
+ export * from './archivist.ts'
@@ -0,0 +1,18 @@
1
+ import type { ArchivistInstance } from '@xyo-network/archivist-model'
2
+ import type { Initializable } from '@xyo-network/xl1-protocol'
3
+ import type { Config } from '@xyo-network/xl1-protocol-sdk'
4
+ import { Mutex } from 'async-mutex'
5
+
6
+ import { getLocalPersistentArchivist } from '../lib/index.ts'
7
+
8
+ const mutex = new Mutex()
9
+ let singleton: ArchivistInstance | undefined
10
+
11
+ export const initLocalPendingTransactionsArchivist: Initializable<{ config: Config }, ArchivistInstance> = async ({ config }): Promise<ArchivistInstance> => {
12
+ return await mutex.runExclusive(async () => {
13
+ if (singleton) return singleton
14
+ const { root } = config.storage
15
+ singleton = await getLocalPersistentArchivist('local-pending-transactions', 'chain', 'pending_transaction_bundles', root)
16
+ return singleton
17
+ })
18
+ }
@@ -0,0 +1,21 @@
1
+ import type { ArchivistInstance } from '@xyo-network/archivist-model'
2
+ import { startupSpanAsync } from '@xyo-network/chain-utils'
3
+ import type { InitializableParams } from '@xyo-network/xl1-protocol'
4
+ import { timeBudget } from '@xyo-network/xl1-protocol-sdk'
5
+ import { Mutex } from 'async-mutex'
6
+
7
+ import { initLocalRejectedTransactionsArchivist } from './local.ts'
8
+
9
+ const mutex = new Mutex()
10
+ let singleton: ArchivistInstance | undefined
11
+
12
+ export async function initRejectedTransactionsArchivist(params: InitializableParams) {
13
+ return await mutex.runExclusive(async () => {
14
+ if (singleton) return singleton
15
+ return await timeBudget('initRejectedTransactionsArchivist', params.logger, async () => {
16
+ const local = await startupSpanAsync('RejectedTransactionsArchivist:initLocal', () => initLocalRejectedTransactionsArchivist(params))
17
+ singleton = local
18
+ return singleton
19
+ }, 2000, true)
20
+ })
21
+ }
@@ -0,0 +1 @@
1
+ export * from './archivist.ts'
@@ -0,0 +1,20 @@
1
+ import { MemoryArchivist, MemoryArchivistConfigSchema } from '@xyo-network/archivist-memory'
2
+ import type { ArchivistInstance } from '@xyo-network/archivist-model'
3
+ import type { Initializable } from '@xyo-network/xl1-protocol'
4
+ import { Mutex } from 'async-mutex'
5
+
6
+ const mutex = new Mutex()
7
+ let singleton: ArchivistInstance | undefined
8
+
9
+ export const initLocalRejectedTransactionsArchivist: Initializable<{}, ArchivistInstance> = async (): Promise<ArchivistInstance> => {
10
+ return await mutex.runExclusive(async () => {
11
+ if (singleton) return singleton
12
+ singleton = await MemoryArchivist.create({
13
+ account: 'random',
14
+ config: {
15
+ schema: MemoryArchivistConfigSchema, max: 1000, name: 'localRejectedTransactions',
16
+ },
17
+ })
18
+ return singleton
19
+ })
20
+ }
@@ -0,0 +1,24 @@
1
+ import { assertEx } from '@xylabs/sdk-js'
2
+ import type { ArchivistInstance } from '@xyo-network/archivist-model'
3
+ import { startupSpanAsync } from '@xyo-network/chain-utils'
4
+ import type { Initializable } from '@xyo-network/xl1-protocol'
5
+ import { timeBudget } from '@xyo-network/xl1-protocol-sdk'
6
+ import { Mutex } from 'async-mutex'
7
+
8
+ import type { ChainInitializableParams } from '../../ChainInitializableParams.ts'
9
+ import { initLocalStakeIntentStateArchivist } from './local.ts'
10
+
11
+ const mutex = new Mutex()
12
+ let singleton: ArchivistInstance | undefined
13
+
14
+ export const initStakeIntentStateArchivist: Initializable<ChainInitializableParams, ArchivistInstance>
15
+ = async (params: ChainInitializableParams): Promise<ArchivistInstance> => {
16
+ return await mutex.runExclusive(async () => {
17
+ if (singleton) return singleton
18
+ return await timeBudget('initStakeIntentStateArchivist', params.logger, async () => {
19
+ const local = await startupSpanAsync('StakeIntentStateArchivist:initLocal', () => initLocalStakeIntentStateArchivist(params))
20
+ singleton = local
21
+ return assertEx(singleton, () => 'StakeIntentStateArchivist is undefined')
22
+ }, 2000, true)
23
+ })
24
+ }
@@ -0,0 +1 @@
1
+ export * from './archivist.ts'
@@ -0,0 +1,19 @@
1
+ import { assertEx } from '@xylabs/sdk-js'
2
+ import type { ArchivistInstance } from '@xyo-network/archivist-model'
3
+ import type { Initializable } from '@xyo-network/xl1-protocol'
4
+ import type { Config } from '@xyo-network/xl1-protocol-sdk'
5
+ import { Mutex } from 'async-mutex'
6
+
7
+ import { getLocalPersistentArchivist } from '../lib/index.ts'
8
+
9
+ const mutex = new Mutex()
10
+ let singleton: ArchivistInstance | undefined
11
+
12
+ export const initLocalStakeIntentStateArchivist: Initializable<{ config: Config }, ArchivistInstance> = async ({ config }): Promise<ArchivistInstance> => {
13
+ return await mutex.runExclusive(async () => {
14
+ if (singleton) return singleton
15
+ const { root } = config.storage
16
+ singleton = await getLocalPersistentArchivist('local-stake-intent-state', 'stakeIntent', 'state', root)
17
+ return assertEx(singleton, () => new Error('Failed to initialize stake intent state archivist'))
18
+ })
19
+ }
@@ -0,0 +1,5 @@
1
+ export * from './ChainFinalized/index.ts'
2
+ export * from './PendingBlocks/index.ts'
3
+ export * from './PendingTransactions/index.ts'
4
+ export * from './RejectedTransactions/index.ts'
5
+ export * from './StakeIntentState/index.ts'
@@ -0,0 +1 @@
1
+ export * from './localPersistentArchivist.ts'