@xyo-network/chain-orchestration 1.18.0 → 1.18.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.
- package/dist/neutral/ChainInitializableParams.d.ts +1 -1
- package/dist/neutral/ChainInitializableParams.d.ts.map +1 -1
- package/dist/neutral/ConfigContext.d.ts +1 -1
- package/dist/neutral/ConfigContext.d.ts.map +1 -1
- package/dist/neutral/actor/BalanceActor.d.ts +3 -4
- package/dist/neutral/actor/BalanceActor.d.ts.map +1 -1
- package/dist/neutral/actor/ValidatorActor.d.ts +3 -4
- package/dist/neutral/actor/ValidatorActor.d.ts.map +1 -1
- package/dist/neutral/actor/index.d.ts +0 -1
- package/dist/neutral/actor/index.d.ts.map +1 -1
- package/dist/neutral/archivists/ChainFinalized/local.d.ts +1 -2
- package/dist/neutral/archivists/ChainFinalized/local.d.ts.map +1 -1
- package/dist/neutral/archivists/PendingBlocks/local.d.ts +1 -2
- package/dist/neutral/archivists/PendingBlocks/local.d.ts.map +1 -1
- package/dist/neutral/archivists/RejectedTransactions/archivist.d.ts +1 -1
- package/dist/neutral/archivists/RejectedTransactions/archivist.d.ts.map +1 -1
- package/dist/neutral/archivists/RejectedTransactions/local.d.ts +1 -1
- package/dist/neutral/archivists/RejectedTransactions/local.d.ts.map +1 -1
- package/dist/neutral/archivists/StakeIntentState/archivist.d.ts +1 -1
- package/dist/neutral/archivists/StakeIntentState/archivist.d.ts.map +1 -1
- package/dist/neutral/archivists/StakeIntentState/local.d.ts +1 -1
- package/dist/neutral/archivists/StakeIntentState/local.d.ts.map +1 -1
- package/dist/neutral/buildTelemetryConfig.d.ts +2 -2
- package/dist/neutral/buildTelemetryConfig.d.ts.map +1 -1
- package/dist/neutral/createDeclarationIntentBlock.d.ts +23 -15
- package/dist/neutral/createDeclarationIntentBlock.d.ts.map +1 -1
- package/dist/neutral/evm/initChainId.d.ts +1 -1
- package/dist/neutral/evm/initChainId.d.ts.map +1 -1
- package/dist/neutral/evm/initEvmProvider.d.ts +1 -1
- package/dist/neutral/evm/initEvmProvider.d.ts.map +1 -1
- package/dist/neutral/evm/initInfuraProvider.d.ts +1 -1
- package/dist/neutral/evm/initInfuraProvider.d.ts.map +1 -1
- package/dist/neutral/evm/initJsonRpcProvider.d.ts +1 -1
- package/dist/neutral/evm/initJsonRpcProvider.d.ts.map +1 -1
- package/dist/neutral/health/initHealthEndpoints.d.ts +1 -2
- package/dist/neutral/health/initHealthEndpoints.d.ts.map +1 -1
- package/dist/neutral/index.mjs +128 -234
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/init/index.d.ts +1 -1
- package/dist/neutral/init/index.d.ts.map +1 -1
- package/dist/neutral/init/initBalanceSummaryMap.d.ts +1 -1
- package/dist/neutral/init/initBalanceSummaryMap.d.ts.map +1 -1
- package/dist/neutral/init/initBridgedModule.d.ts +1 -1
- package/dist/neutral/init/initBridgedModule.d.ts.map +1 -1
- package/dist/neutral/init/initChainStakeViewer.d.ts +1 -1
- package/dist/neutral/init/initChainStakeViewer.d.ts.map +1 -1
- package/dist/neutral/init/initFinalizedArchivist.d.ts +1 -1
- package/dist/neutral/init/initFinalizedArchivist.d.ts.map +1 -1
- package/dist/neutral/init/initProducerAccount.d.ts +1 -2
- package/dist/neutral/init/initProducerAccount.d.ts.map +1 -1
- package/dist/neutral/init/initServerNode.d.ts +1 -1
- package/dist/neutral/init/initServerNode.d.ts.map +1 -1
- package/dist/neutral/init/initStatusReporter.d.ts +1 -1
- package/dist/neutral/init/initStatusReporter.d.ts.map +1 -1
- package/dist/neutral/init/initTransferSummaryMap.d.ts +1 -1
- package/dist/neutral/init/initTransferSummaryMap.d.ts.map +1 -1
- package/dist/neutral/init/initWallet.d.ts +6 -0
- package/dist/neutral/init/initWallet.d.ts.map +1 -0
- package/dist/neutral/manifest/getLocator.d.ts +1 -1
- package/dist/neutral/manifest/getLocator.d.ts.map +1 -1
- package/dist/neutral/manifest/loadNode.d.ts +1 -1
- package/dist/neutral/manifest/loadNode.d.ts.map +1 -1
- package/dist/neutral/orchestrator/Orchestrator.d.ts +1 -1
- package/dist/neutral/orchestrator/Orchestrator.d.ts.map +1 -1
- package/package.json +34 -35
- package/src/ChainInitializableParams.ts +1 -1
- package/src/ConfigContext.ts +1 -1
- package/src/actor/BalanceActor.ts +4 -3
- package/src/actor/ValidatorActor.ts +7 -7
- package/src/actor/index.ts +0 -1
- package/src/archivists/ChainFinalized/archivist.ts +1 -1
- package/src/archivists/ChainFinalized/local.ts +1 -2
- package/src/archivists/PendingBlocks/archivist.ts +1 -1
- package/src/archivists/PendingBlocks/local.ts +1 -2
- package/src/archivists/RejectedTransactions/archivist.ts +2 -2
- package/src/archivists/RejectedTransactions/local.ts +1 -1
- package/src/archivists/StakeIntentState/archivist.ts +2 -2
- package/src/archivists/StakeIntentState/local.ts +1 -1
- package/src/buildTelemetryConfig.ts +4 -9
- package/src/createDeclarationIntentBlock.ts +2 -2
- package/src/evm/initChainId.ts +1 -1
- package/src/evm/initEvmProvider.ts +1 -1
- package/src/evm/initInfuraProvider.ts +1 -1
- package/src/evm/initJsonRpcProvider.ts +1 -1
- package/src/health/initHealthEndpoints.ts +3 -2
- package/src/init/index.ts +1 -1
- package/src/init/initBalanceSummaryMap.ts +2 -2
- package/src/init/initBridgedModule.ts +1 -1
- package/src/init/initChainStakeViewer.ts +5 -5
- package/src/init/initFinalizedArchivist.ts +1 -1
- package/src/init/initProducerAccount.ts +4 -3
- package/src/init/initServerNode.ts +1 -1
- package/src/init/initStatusReporter.ts +1 -1
- package/src/init/initTransferSummaryMap.ts +2 -2
- package/src/init/initWallet.ts +36 -0
- package/src/manifest/getLocator.ts +4 -3
- package/src/manifest/loadNode.ts +1 -1
- package/src/manifest/public/Pending.json +6 -1
- package/src/orchestrator/Orchestrator.ts +1 -2
- package/dist/neutral/actor/Actor.d.ts +0 -248
- package/dist/neutral/actor/Actor.d.ts.map +0 -1
- package/dist/neutral/init/initServerWallet.d.ts +0 -3
- package/dist/neutral/init/initServerWallet.d.ts.map +0 -1
- package/src/actor/Actor.ts +0 -199
- package/src/init/initServerWallet.ts +0 -17
package/dist/neutral/index.mjs
CHANGED
|
@@ -1,158 +1,9 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
-
// src/actor/Actor.ts
|
|
5
|
-
import { AbstractCreatable, assertEx, Base, creatable, delay, IdLogger } from "@xylabs/sdk-js";
|
|
6
|
-
import { getDefaultConfig, ProviderFactoryLocator } from "@xyo-network/xl1-protocol-sdk";
|
|
7
|
-
import { Semaphore } from "async-mutex";
|
|
8
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
9
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11
|
-
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;
|
|
12
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13
|
-
}
|
|
14
|
-
__name(_ts_decorate, "_ts_decorate");
|
|
15
|
-
var Actor = class extends AbstractCreatable {
|
|
16
|
-
static {
|
|
17
|
-
__name(this, "Actor");
|
|
18
|
-
}
|
|
19
|
-
_intervals = /* @__PURE__ */ new Map();
|
|
20
|
-
_semaphores = /* @__PURE__ */ new Map();
|
|
21
|
-
_timeouts = /* @__PURE__ */ new Map();
|
|
22
|
-
_active = false;
|
|
23
|
-
get displayName() {
|
|
24
|
-
return this.params.displayName;
|
|
25
|
-
}
|
|
26
|
-
get id() {
|
|
27
|
-
return this.params.id;
|
|
28
|
-
}
|
|
29
|
-
get account() {
|
|
30
|
-
return this.params.account;
|
|
31
|
-
}
|
|
32
|
-
get config() {
|
|
33
|
-
return this.context.config;
|
|
34
|
-
}
|
|
35
|
-
get context() {
|
|
36
|
-
return this.params.context;
|
|
37
|
-
}
|
|
38
|
-
get locator() {
|
|
39
|
-
return this.context.locator;
|
|
40
|
-
}
|
|
41
|
-
get logPrefix() {
|
|
42
|
-
return `[${this.displayName} (${this.id})] `;
|
|
43
|
-
}
|
|
44
|
-
static async paramsHandler(params) {
|
|
45
|
-
const baseParams = await super.paramsHandler(params);
|
|
46
|
-
const id = params?.id ?? baseParams.name;
|
|
47
|
-
const displayName = params?.displayName ?? baseParams.name;
|
|
48
|
-
const account = assertEx(params?.account, () => `Account is required for actor ${id}.`);
|
|
49
|
-
const logger = baseParams.logger ?? new IdLogger(Base.defaultLogger ?? console, () => `[${displayName} (${id})] `);
|
|
50
|
-
const singletons = params?.context?.singletons ?? {};
|
|
51
|
-
const config = params?.context?.config ?? getDefaultConfig();
|
|
52
|
-
const context = params?.context ?? {
|
|
53
|
-
config,
|
|
54
|
-
locator: new ProviderFactoryLocator({
|
|
55
|
-
config,
|
|
56
|
-
logger,
|
|
57
|
-
singletons
|
|
58
|
-
})
|
|
59
|
-
};
|
|
60
|
-
return {
|
|
61
|
-
...baseParams,
|
|
62
|
-
account,
|
|
63
|
-
context,
|
|
64
|
-
displayName,
|
|
65
|
-
id,
|
|
66
|
-
logger
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* The timer runs until the actor is deactivated (or you manually stop it).
|
|
71
|
-
*/
|
|
72
|
-
registerTimer(timerName, callback, dueTimeMs, periodMs) {
|
|
73
|
-
if (!this._active) {
|
|
74
|
-
this.logger?.warn(`Cannot register timer '${timerName}' because actor is not active.`);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
let running = false;
|
|
78
|
-
this._semaphores.set(timerName, new Semaphore(1));
|
|
79
|
-
const timeoutId = setTimeout(() => {
|
|
80
|
-
const intervalId = setInterval(() => {
|
|
81
|
-
const semaphore = this._semaphores.get(timerName);
|
|
82
|
-
if (!this._active || !this._intervals.has(timerName) || !semaphore || running) return;
|
|
83
|
-
if (semaphore.isLocked()) {
|
|
84
|
-
this.logger?.warn(`Skipping timer '${this.name}:${timerName}' execution because previous execution is still running.`);
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
semaphore.acquire().then(([, release]) => {
|
|
88
|
-
const startTime = Date.now();
|
|
89
|
-
running = true;
|
|
90
|
-
callback().then(() => {
|
|
91
|
-
const duration = Date.now() - startTime;
|
|
92
|
-
if (duration > periodMs) {
|
|
93
|
-
this.logger?.warn(`Timer '${this.name}:${timerName}' execution took longer (${duration}ms) than the period (${periodMs}ms).`);
|
|
94
|
-
} else if (duration > 5e3) {
|
|
95
|
-
this.logger?.warn(`Timer '${this.name}:${timerName}' execution took longer (${duration}ms) than 5000ms.`);
|
|
96
|
-
}
|
|
97
|
-
}).catch((error) => {
|
|
98
|
-
this.logger?.error(`Error in timer '${this.name}:${timerName}': ${error}`);
|
|
99
|
-
this.logger?.error(error.stack);
|
|
100
|
-
}).finally(() => {
|
|
101
|
-
release();
|
|
102
|
-
running = false;
|
|
103
|
-
});
|
|
104
|
-
}).catch((error) => {
|
|
105
|
-
this.logger?.error(`Error acquiring semaphore for timer '${this.name}:${timerName}': ${error}`);
|
|
106
|
-
});
|
|
107
|
-
}, periodMs);
|
|
108
|
-
this._intervals.set(timerName, intervalId);
|
|
109
|
-
}, dueTimeMs);
|
|
110
|
-
this._timeouts.set(timerName, timeoutId);
|
|
111
|
-
this.logger?.log(`Timer '${this.name}:${timerName}' registered: first call after ${dueTimeMs}ms, recurring every ${periodMs}ms.`);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Called by the Orchestrator when the actor is activated.
|
|
115
|
-
*/
|
|
116
|
-
async startHandler() {
|
|
117
|
-
await super.startHandler();
|
|
118
|
-
this._active = true;
|
|
119
|
-
this.logger?.log("Started.");
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Called by the Orchestrator when the actor is deactivated.
|
|
123
|
-
* Stop all running timers.
|
|
124
|
-
*/
|
|
125
|
-
async stopHandler() {
|
|
126
|
-
await super.stopHandler();
|
|
127
|
-
this._active = false;
|
|
128
|
-
this.logger?.log("Stopping all timers...");
|
|
129
|
-
await Promise.all([
|
|
130
|
-
...this._semaphores.values()
|
|
131
|
-
].map(async (semaphore) => {
|
|
132
|
-
while (semaphore.isLocked()) {
|
|
133
|
-
this.logger?.log("Waiting for running timer task to complete...");
|
|
134
|
-
await delay(500);
|
|
135
|
-
}
|
|
136
|
-
await semaphore.acquire();
|
|
137
|
-
}));
|
|
138
|
-
this._semaphores.clear();
|
|
139
|
-
for (const [, timeoutRef] of this._timeouts.entries()) {
|
|
140
|
-
clearTimeout(timeoutRef);
|
|
141
|
-
}
|
|
142
|
-
this._timeouts.clear();
|
|
143
|
-
for (const [, intervalRef] of this._intervals.entries()) {
|
|
144
|
-
clearInterval(intervalRef);
|
|
145
|
-
}
|
|
146
|
-
this._intervals.clear();
|
|
147
|
-
this.logger?.log("Stopped.");
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
Actor = _ts_decorate([
|
|
151
|
-
creatable()
|
|
152
|
-
], Actor);
|
|
153
|
-
|
|
154
4
|
// src/actor/BalanceActor.ts
|
|
155
|
-
import { assertEx
|
|
5
|
+
import { assertEx } from "@xylabs/sdk-js";
|
|
6
|
+
import { Actor } from "@xyo-network/xl1-sdk";
|
|
156
7
|
import { Mutex } from "async-mutex";
|
|
157
8
|
var BalanceActor = class extends Actor {
|
|
158
9
|
static {
|
|
@@ -160,10 +11,10 @@ var BalanceActor = class extends Actor {
|
|
|
160
11
|
}
|
|
161
12
|
_updateMutex = new Mutex();
|
|
162
13
|
get balanceService() {
|
|
163
|
-
return
|
|
14
|
+
return assertEx(this.params.balance, () => "balanceService not set");
|
|
164
15
|
}
|
|
165
16
|
get blockViewer() {
|
|
166
|
-
return
|
|
17
|
+
return assertEx(this.params.blockViewer, () => "blockViewer not set");
|
|
167
18
|
}
|
|
168
19
|
async startHandler() {
|
|
169
20
|
await super.startHandler();
|
|
@@ -189,18 +40,18 @@ var BalanceActor = class extends Actor {
|
|
|
189
40
|
};
|
|
190
41
|
|
|
191
42
|
// src/actor/ValidatorActor.ts
|
|
192
|
-
import { assertEx as
|
|
43
|
+
import { assertEx as assertEx2, creatable } from "@xylabs/sdk-js";
|
|
193
44
|
import { processPendingBlocks } from "@xyo-network/chain-sdk";
|
|
194
45
|
import { PayloadBuilder } from "@xyo-network/payload-builder";
|
|
195
|
-
import { BlockViewerMoniker, MempoolViewerMoniker } from "@xyo-network/xl1-
|
|
196
|
-
function
|
|
46
|
+
import { Actor as Actor2, BlockViewerMoniker, MempoolViewerMoniker } from "@xyo-network/xl1-sdk";
|
|
47
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
197
48
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
198
49
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
199
50
|
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;
|
|
200
51
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
201
52
|
}
|
|
202
|
-
__name(
|
|
203
|
-
var ValidatorActor = class extends
|
|
53
|
+
__name(_ts_decorate, "_ts_decorate");
|
|
54
|
+
var ValidatorActor = class extends Actor2 {
|
|
204
55
|
static {
|
|
205
56
|
__name(this, "ValidatorActor");
|
|
206
57
|
}
|
|
@@ -212,15 +63,15 @@ var ValidatorActor = class extends Actor {
|
|
|
212
63
|
return this._blockViewer;
|
|
213
64
|
}
|
|
214
65
|
get finalizedArchivist() {
|
|
215
|
-
return
|
|
66
|
+
return assertEx2(this.params.finalizedArchivist, () => "finalizedArchivist not set");
|
|
216
67
|
}
|
|
217
68
|
get mempoolViewer() {
|
|
218
69
|
return this._mempoolViewer;
|
|
219
70
|
}
|
|
220
71
|
async createHandler() {
|
|
221
72
|
await super.createHandler();
|
|
222
|
-
this._blockViewer =
|
|
223
|
-
this._mempoolViewer =
|
|
73
|
+
this._blockViewer = assertEx2(this.params.blockViewer ?? await this.locator?.getInstance(BlockViewerMoniker), () => "Unable to locate a BlockViewer");
|
|
74
|
+
this._mempoolViewer = assertEx2(this.params.mempoolViewer ?? await this.locator?.getInstance(MempoolViewerMoniker), () => "Unable to locate a MempoolViewer");
|
|
224
75
|
}
|
|
225
76
|
async startHandler() {
|
|
226
77
|
await super.startHandler();
|
|
@@ -236,6 +87,8 @@ var ValidatorActor = class extends Actor {
|
|
|
236
87
|
blockViewer: this.blockViewer,
|
|
237
88
|
finalizedArchivist: this.finalizedArchivist
|
|
238
89
|
});
|
|
90
|
+
}, {
|
|
91
|
+
timeBudgetLimit: 2e3
|
|
239
92
|
});
|
|
240
93
|
},
|
|
241
94
|
2e3,
|
|
@@ -254,13 +107,13 @@ var ValidatorActor = class extends Actor {
|
|
|
254
107
|
return valid;
|
|
255
108
|
}
|
|
256
109
|
};
|
|
257
|
-
ValidatorActor =
|
|
258
|
-
|
|
110
|
+
ValidatorActor = _ts_decorate([
|
|
111
|
+
creatable()
|
|
259
112
|
], ValidatorActor);
|
|
260
113
|
|
|
261
114
|
// src/archivists/ChainFinalized/archivist.ts
|
|
262
115
|
import { startupSpanAsync } from "@xyo-network/chain-utils";
|
|
263
|
-
import { timeBudget } from "@xyo-network/xl1-
|
|
116
|
+
import { timeBudget } from "@xyo-network/xl1-sdk";
|
|
264
117
|
import { Mutex as Mutex3 } from "async-mutex";
|
|
265
118
|
|
|
266
119
|
// src/archivists/ChainFinalized/local.ts
|
|
@@ -320,7 +173,7 @@ __name(initChainFinalizedArchivist, "initChainFinalizedArchivist");
|
|
|
320
173
|
|
|
321
174
|
// src/archivists/PendingBlocks/archivist.ts
|
|
322
175
|
import { startupSpanAsync as startupSpanAsync2 } from "@xyo-network/chain-utils";
|
|
323
|
-
import { timeBudget as timeBudget2 } from "@xyo-network/xl1-
|
|
176
|
+
import { timeBudget as timeBudget2 } from "@xyo-network/xl1-sdk";
|
|
324
177
|
import { Mutex as Mutex5 } from "async-mutex";
|
|
325
178
|
|
|
326
179
|
// src/archivists/PendingBlocks/local.ts
|
|
@@ -353,7 +206,7 @@ __name(initPendingBlocksArchivist, "initPendingBlocksArchivist");
|
|
|
353
206
|
|
|
354
207
|
// src/archivists/RejectedTransactions/archivist.ts
|
|
355
208
|
import { startupSpanAsync as startupSpanAsync3 } from "@xyo-network/chain-utils";
|
|
356
|
-
import { timeBudget as timeBudget3 } from "@xyo-network/xl1-
|
|
209
|
+
import { timeBudget as timeBudget3 } from "@xyo-network/xl1-sdk";
|
|
357
210
|
import { Mutex as Mutex7 } from "async-mutex";
|
|
358
211
|
|
|
359
212
|
// src/archivists/RejectedTransactions/local.ts
|
|
@@ -392,13 +245,13 @@ async function initRejectedTransactionsArchivist(params) {
|
|
|
392
245
|
__name(initRejectedTransactionsArchivist, "initRejectedTransactionsArchivist");
|
|
393
246
|
|
|
394
247
|
// src/archivists/StakeIntentState/archivist.ts
|
|
395
|
-
import { assertEx as
|
|
248
|
+
import { assertEx as assertEx4 } from "@xylabs/sdk-js";
|
|
396
249
|
import { startupSpanAsync as startupSpanAsync4 } from "@xyo-network/chain-utils";
|
|
397
|
-
import { timeBudget as timeBudget4 } from "@xyo-network/xl1-
|
|
250
|
+
import { timeBudget as timeBudget4 } from "@xyo-network/xl1-sdk";
|
|
398
251
|
import { Mutex as Mutex9 } from "async-mutex";
|
|
399
252
|
|
|
400
253
|
// src/archivists/StakeIntentState/local.ts
|
|
401
|
-
import { assertEx as
|
|
254
|
+
import { assertEx as assertEx3 } from "@xylabs/sdk-js";
|
|
402
255
|
import { Mutex as Mutex8 } from "async-mutex";
|
|
403
256
|
var mutex7 = new Mutex8();
|
|
404
257
|
var singleton7;
|
|
@@ -407,7 +260,7 @@ var initLocalStakeIntentStateArchivist = /* @__PURE__ */ __name(async ({ config
|
|
|
407
260
|
if (singleton7) return singleton7;
|
|
408
261
|
const { root } = config.storage;
|
|
409
262
|
singleton7 = await getLocalPersistentArchivist("local-stake-intent-state", "stakeIntent", "state", root);
|
|
410
|
-
return
|
|
263
|
+
return assertEx3(singleton7, () => new Error("Failed to initialize stake intent state archivist"));
|
|
411
264
|
});
|
|
412
265
|
}, "initLocalStakeIntentStateArchivist");
|
|
413
266
|
|
|
@@ -420,15 +273,15 @@ var initStakeIntentStateArchivist = /* @__PURE__ */ __name(async (context) => {
|
|
|
420
273
|
return await timeBudget4("initStakeIntentStateArchivist", context.logger, async () => {
|
|
421
274
|
const local = await startupSpanAsync4("StakeIntentStateArchivist:initLocal", () => initLocalStakeIntentStateArchivist(context));
|
|
422
275
|
singleton8 = local;
|
|
423
|
-
return
|
|
276
|
+
return assertEx4(singleton8, () => "StakeIntentStateArchivist is undefined");
|
|
424
277
|
}, 2e3, true);
|
|
425
278
|
});
|
|
426
279
|
}, "initStakeIntentStateArchivist");
|
|
427
280
|
|
|
428
281
|
// src/buildTelemetryConfig.ts
|
|
429
|
-
function buildTelemetryConfig(config, serviceName, serviceVersion) {
|
|
282
|
+
function buildTelemetryConfig(config, serviceName, serviceVersion, defaultMetricsScrapePort = 9464) {
|
|
430
283
|
const { otlpEndpoint } = config.telemetry?.otel ?? {};
|
|
431
|
-
const { path: endpoint = "/metrics", port =
|
|
284
|
+
const { path: endpoint = "/metrics", port = defaultMetricsScrapePort } = config.telemetry?.metrics?.scrape ?? {};
|
|
432
285
|
const telemetryConfig = {
|
|
433
286
|
attributes: {
|
|
434
287
|
serviceName,
|
|
@@ -446,7 +299,7 @@ __name(buildTelemetryConfig, "buildTelemetryConfig");
|
|
|
446
299
|
|
|
447
300
|
// src/createDeclarationIntentBlock.ts
|
|
448
301
|
import { buildNextBlock } from "@xyo-network/chain-sdk";
|
|
449
|
-
import { createDeclarationIntent } from "@xyo-network/xl1-
|
|
302
|
+
import { createDeclarationIntent } from "@xyo-network/xl1-sdk";
|
|
450
303
|
async function createProducerChainStakeIntentBlock(prevBlock, producerAccount, range) {
|
|
451
304
|
const producerDeclarationPayload = createDeclarationIntent(producerAccount.address, "producer", range[0], range[1]);
|
|
452
305
|
return await buildNextBlock(prevBlock, [], [
|
|
@@ -458,19 +311,19 @@ async function createProducerChainStakeIntentBlock(prevBlock, producerAccount, r
|
|
|
458
311
|
__name(createProducerChainStakeIntentBlock, "createProducerChainStakeIntentBlock");
|
|
459
312
|
|
|
460
313
|
// src/evm/initEvmProvider.ts
|
|
461
|
-
import { assertEx as
|
|
314
|
+
import { assertEx as assertEx8 } from "@xylabs/sdk-js";
|
|
462
315
|
|
|
463
316
|
// src/evm/initInfuraProvider.ts
|
|
464
|
-
import { assertEx as
|
|
317
|
+
import { assertEx as assertEx6, isDefined as isDefined2 } from "@xylabs/sdk-js";
|
|
465
318
|
import { InfuraProvider } from "ethers/providers";
|
|
466
319
|
|
|
467
320
|
// src/evm/initChainId.ts
|
|
468
|
-
import { assertEx as
|
|
321
|
+
import { assertEx as assertEx5, hexFrom, isDefined, isHex } from "@xylabs/sdk-js";
|
|
469
322
|
var canUseChainId = /* @__PURE__ */ __name((config) => {
|
|
470
323
|
return isDefined(config.evm.chainId);
|
|
471
324
|
}, "canUseChainId");
|
|
472
325
|
var getChainId = /* @__PURE__ */ __name((config) => {
|
|
473
|
-
const chainId =
|
|
326
|
+
const chainId = assertEx5(config.evm.chainId, () => "Missing config.evm.chainId");
|
|
474
327
|
if (isHex(chainId, {
|
|
475
328
|
prefix: true
|
|
476
329
|
})) {
|
|
@@ -495,8 +348,8 @@ var canUseInfuraProvider = /* @__PURE__ */ __name((config) => {
|
|
|
495
348
|
return canUseChainId(config) && isDefined2(config.evm?.infura?.projectId) && isDefined2(config.evm?.infura?.projectSecret);
|
|
496
349
|
}, "canUseInfuraProvider");
|
|
497
350
|
var getInfuraProviderConfig = /* @__PURE__ */ __name((config) => {
|
|
498
|
-
const projectId =
|
|
499
|
-
const projectSecret =
|
|
351
|
+
const projectId = assertEx6(config.evm?.infura?.projectId, () => "Missing config.evm.infura.projectId");
|
|
352
|
+
const projectSecret = assertEx6(config.evm?.infura?.projectSecret, () => "Missing config.evm.infura.projectSecret");
|
|
500
353
|
return [
|
|
501
354
|
getChainId(config),
|
|
502
355
|
projectId,
|
|
@@ -505,7 +358,7 @@ var getInfuraProviderConfig = /* @__PURE__ */ __name((config) => {
|
|
|
505
358
|
}, "getInfuraProviderConfig");
|
|
506
359
|
|
|
507
360
|
// src/evm/initJsonRpcProvider.ts
|
|
508
|
-
import { assertEx as
|
|
361
|
+
import { assertEx as assertEx7, isDefined as isDefined3 } from "@xylabs/sdk-js";
|
|
509
362
|
import { JsonRpcProvider } from "ethers/providers";
|
|
510
363
|
var initJsonRpcProvider = /* @__PURE__ */ __name((config) => {
|
|
511
364
|
const providerConfig = getJsonRpcProviderConfig(config);
|
|
@@ -515,7 +368,7 @@ var canUseJsonRpcProvider = /* @__PURE__ */ __name((config) => {
|
|
|
515
368
|
return canUseChainId(config) && isDefined3(config.evm.jsonRpc?.url);
|
|
516
369
|
}, "canUseJsonRpcProvider");
|
|
517
370
|
var getJsonRpcProviderConfig = /* @__PURE__ */ __name((config) => {
|
|
518
|
-
const jsonRpcUrl =
|
|
371
|
+
const jsonRpcUrl = assertEx7(config.evm.jsonRpc?.url, () => "Missing config.evm.jsonRpc.url");
|
|
519
372
|
return [
|
|
520
373
|
jsonRpcUrl,
|
|
521
374
|
getChainId(config)
|
|
@@ -531,7 +384,7 @@ var initEvmProvider = /* @__PURE__ */ __name(async ({ config }) => {
|
|
|
531
384
|
} else if (canUseJsonRpcProvider(config)) {
|
|
532
385
|
provider = initJsonRpcProvider(config);
|
|
533
386
|
}
|
|
534
|
-
return
|
|
387
|
+
return assertEx8(await provider, () => "No provider available");
|
|
535
388
|
}, "initEvmProvider");
|
|
536
389
|
var canUseEvmProvider = /* @__PURE__ */ __name(({ config }) => {
|
|
537
390
|
return canUseInfuraProvider(config) || canUseJsonRpcProvider(config);
|
|
@@ -634,9 +487,9 @@ var ServiceLifetime = {
|
|
|
634
487
|
|
|
635
488
|
// src/init/initBalanceSummaryMap.ts
|
|
636
489
|
import { BaseMongoSdk } from "@xylabs/mongo";
|
|
637
|
-
import { assertEx as
|
|
490
|
+
import { assertEx as assertEx9 } from "@xylabs/sdk-js";
|
|
638
491
|
import { MongoMap } from "@xyo-network/chain-protocol";
|
|
639
|
-
import { hasMongoConfig, MemoryMap } from "@xyo-network/xl1-
|
|
492
|
+
import { hasMongoConfig, MemoryMap } from "@xyo-network/xl1-sdk";
|
|
640
493
|
async function initBalanceSummaryMap({ config, logger }) {
|
|
641
494
|
const mongoConfig = config.storage?.mongo;
|
|
642
495
|
if (hasMongoConfig(mongoConfig)) {
|
|
@@ -659,7 +512,7 @@ async function initBalanceSummaryMap({ config, logger }) {
|
|
|
659
512
|
maxEntries: 5e3
|
|
660
513
|
}
|
|
661
514
|
});
|
|
662
|
-
|
|
515
|
+
assertEx9(await result.start(), () => "Failed to start transfer summary map");
|
|
663
516
|
return result;
|
|
664
517
|
} else {
|
|
665
518
|
logger?.warn("[API] Mongo configuration not found. Using MemoryMap for BalanceSummaryMap.");
|
|
@@ -669,7 +522,7 @@ async function initBalanceSummaryMap({ config, logger }) {
|
|
|
669
522
|
__name(initBalanceSummaryMap, "initBalanceSummaryMap");
|
|
670
523
|
|
|
671
524
|
// src/init/initBridgedModule.ts
|
|
672
|
-
import { assertEx as
|
|
525
|
+
import { assertEx as assertEx10 } from "@xylabs/sdk-js";
|
|
673
526
|
import { asAttachableArchivistInstance } from "@xyo-network/archivist-model";
|
|
674
527
|
import { asAttachableModuleInstance } from "@xyo-network/module-model";
|
|
675
528
|
import { Mutex as Mutex10 } from "async-mutex";
|
|
@@ -679,8 +532,8 @@ var initBridgedModule = /* @__PURE__ */ __name(async ({ bridge, moduleName }) =>
|
|
|
679
532
|
return await initMutex.runExclusive(async () => {
|
|
680
533
|
const existing = bridgedModuleDictionary?.[bridge.address]?.[moduleName];
|
|
681
534
|
if (existing) return existing;
|
|
682
|
-
const mod =
|
|
683
|
-
const moduleInstance =
|
|
535
|
+
const mod = assertEx10(await bridge.resolve(moduleName), () => `Could not resolve ${moduleName}`);
|
|
536
|
+
const moduleInstance = assertEx10(asAttachableModuleInstance(mod), () => `Could not convert ${moduleName} to attachable module instance`);
|
|
684
537
|
let moduleMap = bridgedModuleDictionary[bridge.address];
|
|
685
538
|
if (moduleMap === void 0) {
|
|
686
539
|
moduleMap = {};
|
|
@@ -691,37 +544,37 @@ var initBridgedModule = /* @__PURE__ */ __name(async ({ bridge, moduleName }) =>
|
|
|
691
544
|
});
|
|
692
545
|
}, "initBridgedModule");
|
|
693
546
|
var initBridgedArchivistModule = /* @__PURE__ */ __name(async ({ bridge, moduleName }) => {
|
|
694
|
-
return
|
|
547
|
+
return assertEx10(asAttachableArchivistInstance(await initBridgedModule({
|
|
695
548
|
bridge,
|
|
696
549
|
moduleName
|
|
697
550
|
})), () => `Could not convert ${moduleName} to attachable archivist instance`);
|
|
698
551
|
}, "initBridgedArchivistModule");
|
|
699
552
|
|
|
700
553
|
// src/init/initChainStakeViewer.ts
|
|
701
|
-
import { asAddress, assertEx as
|
|
554
|
+
import { asAddress, assertEx as assertEx11, toAddress, toEthAddress } from "@xylabs/sdk-js";
|
|
702
555
|
import { EthereumChainStakeEventsViewer, EthereumChainStakeViewer } from "@xyo-network/chain-sdk";
|
|
703
|
-
import {
|
|
704
|
-
import { SimpleStakeViewer } from "@xyo-network/xl1-
|
|
556
|
+
import { IStakedXyoChain__factory } from "@xyo-network/typechain";
|
|
557
|
+
import { SimpleStakeViewer } from "@xyo-network/xl1-sdk";
|
|
705
558
|
async function initEvmChainStakeViewer(context, config, logger) {
|
|
706
559
|
const provider2 = await initEvmProvider({
|
|
707
560
|
config,
|
|
708
561
|
logger
|
|
709
562
|
});
|
|
710
|
-
const contractAddress =
|
|
711
|
-
const contract =
|
|
563
|
+
const contractAddress = assertEx11(config.chain.id, () => "Missing config.evm.chainId");
|
|
564
|
+
const contract = IStakedXyoChain__factory.connect(toEthAddress(contractAddress), provider2);
|
|
712
565
|
const stakeEventsViewer = await EthereumChainStakeEventsViewer.create({
|
|
713
566
|
contract,
|
|
714
567
|
logger,
|
|
715
568
|
context
|
|
716
569
|
});
|
|
717
|
-
|
|
570
|
+
assertEx11(await stakeEventsViewer.start(), () => "Failed to start EthereumChainStakeEvents reader");
|
|
718
571
|
const stakeChainViewer = await EthereumChainStakeViewer.create({
|
|
719
572
|
contract,
|
|
720
573
|
stakeEventsViewer,
|
|
721
574
|
logger,
|
|
722
575
|
context
|
|
723
576
|
});
|
|
724
|
-
|
|
577
|
+
assertEx11(await stakeChainViewer.start(), () => "Failed to start EthereumChainStake viewer");
|
|
725
578
|
return stakeChainViewer;
|
|
726
579
|
}
|
|
727
580
|
__name(initEvmChainStakeViewer, "initEvmChainStakeViewer");
|
|
@@ -732,7 +585,7 @@ async function initSimpleStakeViewer(context, config, logger) {
|
|
|
732
585
|
logger,
|
|
733
586
|
positions: []
|
|
734
587
|
});
|
|
735
|
-
|
|
588
|
+
assertEx11(await stakeViewer.start(), () => "Failed to start SimpleChainStake viewer");
|
|
736
589
|
return stakeViewer;
|
|
737
590
|
}
|
|
738
591
|
__name(initSimpleStakeViewer, "initSimpleStakeViewer");
|
|
@@ -769,7 +622,7 @@ __name(initFinalizedArchivist, "initFinalizedArchivist");
|
|
|
769
622
|
// src/init/initProducerAccount.ts
|
|
770
623
|
import { isUndefined } from "@xylabs/sdk-js";
|
|
771
624
|
import { HDWallet } from "@xyo-network/wallet";
|
|
772
|
-
import { ADDRESS_INDEX, generateXyoBaseWalletFromPhrase } from "@xyo-network/xl1-
|
|
625
|
+
import { ADDRESS_INDEX, generateXyoBaseWalletFromPhrase } from "@xyo-network/xl1-sdk";
|
|
773
626
|
var accountServiceSingleton;
|
|
774
627
|
var initProducerAccount = /* @__PURE__ */ __name(async ({ config, logger }) => {
|
|
775
628
|
if (accountServiceSingleton) return accountServiceSingleton;
|
|
@@ -791,7 +644,7 @@ ${randomMnemonic}
|
|
|
791
644
|
}, "initProducerAccount");
|
|
792
645
|
|
|
793
646
|
// src/init/initSeedPhrase.ts
|
|
794
|
-
import { assertEx as
|
|
647
|
+
import { assertEx as assertEx12, isString } from "@xylabs/sdk-js";
|
|
795
648
|
import { HDWallet as HDWallet2 } from "@xyo-network/wallet";
|
|
796
649
|
async function initSeedPhrase({ config, logger, bios }) {
|
|
797
650
|
const storedSeedPhrase = await bios.seedPhraseStore.get("os");
|
|
@@ -811,24 +664,24 @@ async function initSeedPhrase({ config, logger, bios }) {
|
|
|
811
664
|
}
|
|
812
665
|
await bios.seedPhraseStore.set("os", seedPhrase);
|
|
813
666
|
}
|
|
814
|
-
return
|
|
667
|
+
return assertEx12(await bios.seedPhraseStore.get("os"), () => "Unable to acquire mnemonic from bios");
|
|
815
668
|
}
|
|
816
669
|
__name(initSeedPhrase, "initSeedPhrase");
|
|
817
670
|
|
|
818
671
|
// src/init/initServerNode.ts
|
|
819
|
-
import { assertEx as
|
|
672
|
+
import { assertEx as assertEx13 } from "@xylabs/sdk-js";
|
|
820
673
|
import { asArchivistInstance } from "@xyo-network/archivist-model";
|
|
821
674
|
|
|
822
675
|
// src/manifest/getLocator.ts
|
|
823
676
|
import { isDefined as isDefined5 } from "@xylabs/sdk-js";
|
|
824
677
|
import { MemoryArchivist as MemoryArchivist2 } from "@xyo-network/archivist-memory";
|
|
825
|
-
import { MongoDBArchivistV2 as MongoDBArchivistV22 } from "@xyo-network/archivist-mongodb";
|
|
678
|
+
import { MongoDBArchivistV2 as MongoDBArchivistV22, MongoDBArchivistV2Deletable } from "@xyo-network/archivist-mongodb";
|
|
826
679
|
import { ViewArchivist } from "@xyo-network/archivist-view";
|
|
827
680
|
import { initTelemetry } from "@xyo-network/chain-telemetry";
|
|
828
681
|
import { AbstractModule, LoggerModuleStatusReporter } from "@xyo-network/module-abstract";
|
|
829
682
|
import { ModuleFactoryLocator } from "@xyo-network/module-factory-locator";
|
|
830
683
|
import { MemorySentinel } from "@xyo-network/sentinel-memory";
|
|
831
|
-
import { hasMongoConfig as hasMongoConfig2 } from "@xyo-network/xl1-
|
|
684
|
+
import { hasMongoConfig as hasMongoConfig2 } from "@xyo-network/xl1-sdk";
|
|
832
685
|
var getLocator = /* @__PURE__ */ __name(async ({ config, logger }) => {
|
|
833
686
|
const { otlpEndpoint } = config.telemetry?.otel ?? {};
|
|
834
687
|
const { path: endpoint = "/metrics", port = 9465 } = config.telemetry?.metrics?.scrape ?? {};
|
|
@@ -863,6 +716,9 @@ var getLocator = /* @__PURE__ */ __name(async ({ config, logger }) => {
|
|
|
863
716
|
traceProvider
|
|
864
717
|
};
|
|
865
718
|
locator.register(MongoDBArchivistV22.factory(params), void 0, true);
|
|
719
|
+
locator.register(MongoDBArchivistV2Deletable.factory(params), {
|
|
720
|
+
"network.xyo.storage.capabilities.delete": "enabled"
|
|
721
|
+
}, false);
|
|
866
722
|
}
|
|
867
723
|
locator.register(MemoryArchivist2.factory({
|
|
868
724
|
traceProvider,
|
|
@@ -983,6 +839,7 @@ var Pending_default = {
|
|
|
983
839
|
maxEntries: 5e3
|
|
984
840
|
},
|
|
985
841
|
labels: {
|
|
842
|
+
"network.xyo.storage.capabilities.delete": "enabled",
|
|
986
843
|
"network.xyo.storage.class": "mongodb"
|
|
987
844
|
},
|
|
988
845
|
payloadSdkConfig: {
|
|
@@ -999,6 +856,10 @@ var Pending_default = {
|
|
|
999
856
|
enabled: true,
|
|
1000
857
|
maxEntries: 5e3
|
|
1001
858
|
},
|
|
859
|
+
labels: {
|
|
860
|
+
"network.xyo.storage.capabilities.delete": "enabled",
|
|
861
|
+
"network.xyo.storage.class": "mongodb"
|
|
862
|
+
},
|
|
1002
863
|
payloadSdkConfig: {
|
|
1003
864
|
collection: "pending_block_bundles"
|
|
1004
865
|
},
|
|
@@ -1044,7 +905,7 @@ async function writableChainArchivistFromNode(node) {
|
|
|
1044
905
|
}
|
|
1045
906
|
__name(writableChainArchivistFromNode, "writableChainArchivistFromNode");
|
|
1046
907
|
async function readonlyChainArchivistFromNode(node) {
|
|
1047
|
-
return
|
|
908
|
+
return assertEx13(asArchivistInstance(await node.resolve("Chain:Validated"), {
|
|
1048
909
|
required: true
|
|
1049
910
|
}));
|
|
1050
911
|
}
|
|
@@ -1069,7 +930,7 @@ async function initServerNode({ wallet, logger, config, node: providedNode, tran
|
|
|
1069
930
|
transfersSummaryMap,
|
|
1070
931
|
balancesSummaryMap
|
|
1071
932
|
});
|
|
1072
|
-
|
|
933
|
+
assertEx13(await node.start(), () => "Failed to start node");
|
|
1073
934
|
const writableChainArchivist = await writableChainArchivistFromNode(node);
|
|
1074
935
|
const readonlyChainArchivist = await readonlyChainArchivistFromNode(node);
|
|
1075
936
|
const pendingTransactionsArchivist = await pendingTransactionsArchivistFromNode(node);
|
|
@@ -1084,24 +945,8 @@ async function initServerNode({ wallet, logger, config, node: providedNode, tran
|
|
|
1084
945
|
}
|
|
1085
946
|
__name(initServerNode, "initServerNode");
|
|
1086
947
|
|
|
1087
|
-
// src/init/initServerWallet.ts
|
|
1088
|
-
import { isDefined as isDefined6 } from "@xylabs/sdk-js";
|
|
1089
|
-
import { boot } from "@xyo-network/bios";
|
|
1090
|
-
import { HDWallet as HDWallet3 } from "@xyo-network/wallet";
|
|
1091
|
-
async function initServerWallet({ config, logger }) {
|
|
1092
|
-
const { mnemonic } = config.api;
|
|
1093
|
-
const bios = await boot();
|
|
1094
|
-
const seedPhrase = isDefined6(mnemonic) ? mnemonic : await initSeedPhrase({
|
|
1095
|
-
bios,
|
|
1096
|
-
config,
|
|
1097
|
-
logger
|
|
1098
|
-
});
|
|
1099
|
-
return await HDWallet3.fromPhrase(seedPhrase);
|
|
1100
|
-
}
|
|
1101
|
-
__name(initServerWallet, "initServerWallet");
|
|
1102
|
-
|
|
1103
948
|
// src/init/initStatusReporter.ts
|
|
1104
|
-
import { RuntimeStatusMonitor } from "@xyo-network/xl1-
|
|
949
|
+
import { RuntimeStatusMonitor } from "@xyo-network/xl1-sdk";
|
|
1105
950
|
function initStatusReporter({ logger }) {
|
|
1106
951
|
const statusReporter = new RuntimeStatusMonitor(logger);
|
|
1107
952
|
statusReporter.onGlobalTransition({
|
|
@@ -1121,9 +966,9 @@ __name(initStatusReporter, "initStatusReporter");
|
|
|
1121
966
|
|
|
1122
967
|
// src/init/initTransferSummaryMap.ts
|
|
1123
968
|
import { BaseMongoSdk as BaseMongoSdk2 } from "@xylabs/mongo";
|
|
1124
|
-
import { assertEx as
|
|
969
|
+
import { assertEx as assertEx14 } from "@xylabs/sdk-js";
|
|
1125
970
|
import { MongoMap as MongoMap2 } from "@xyo-network/chain-protocol";
|
|
1126
|
-
import { hasMongoConfig as hasMongoConfig3, MemoryMap as MemoryMap2 } from "@xyo-network/xl1-
|
|
971
|
+
import { hasMongoConfig as hasMongoConfig3, MemoryMap as MemoryMap2 } from "@xyo-network/xl1-sdk";
|
|
1127
972
|
async function initTransferSummaryMap({ config, logger }) {
|
|
1128
973
|
const mongoConfig = config.storage?.mongo;
|
|
1129
974
|
if (hasMongoConfig3(mongoConfig)) {
|
|
@@ -1146,7 +991,7 @@ async function initTransferSummaryMap({ config, logger }) {
|
|
|
1146
991
|
maxEntries: 5e3
|
|
1147
992
|
}
|
|
1148
993
|
});
|
|
1149
|
-
|
|
994
|
+
assertEx14(await result.start(), () => "Failed to start transfer summary map");
|
|
1150
995
|
return result;
|
|
1151
996
|
} else {
|
|
1152
997
|
logger?.warn("[API] Mongo configuration not found. Using MemoryMap for TransferSummaryMap.");
|
|
@@ -1155,16 +1000,63 @@ async function initTransferSummaryMap({ config, logger }) {
|
|
|
1155
1000
|
}
|
|
1156
1001
|
__name(initTransferSummaryMap, "initTransferSummaryMap");
|
|
1157
1002
|
|
|
1003
|
+
// src/init/initWallet.ts
|
|
1004
|
+
import { isDefined as isDefined6 } from "@xylabs/sdk-js";
|
|
1005
|
+
import { boot } from "@xyo-network/bios";
|
|
1006
|
+
import { HDWallet as HDWallet3 } from "@xyo-network/wallet";
|
|
1007
|
+
async function initWallet({ config, logger }, mnemonic) {
|
|
1008
|
+
const bios = await boot();
|
|
1009
|
+
const seedPhrase = isDefined6(mnemonic) ? mnemonic : await initSeedPhrase({
|
|
1010
|
+
bios,
|
|
1011
|
+
config,
|
|
1012
|
+
logger
|
|
1013
|
+
});
|
|
1014
|
+
return await HDWallet3.fromPhrase(seedPhrase);
|
|
1015
|
+
}
|
|
1016
|
+
__name(initWallet, "initWallet");
|
|
1017
|
+
async function initApiWallet({ config, logger }) {
|
|
1018
|
+
const { mnemonic } = config.api;
|
|
1019
|
+
return await initWallet({
|
|
1020
|
+
config,
|
|
1021
|
+
logger
|
|
1022
|
+
}, mnemonic);
|
|
1023
|
+
}
|
|
1024
|
+
__name(initApiWallet, "initApiWallet");
|
|
1025
|
+
async function initMempoolWallet({ config, logger }) {
|
|
1026
|
+
const { mnemonic } = config.mempool;
|
|
1027
|
+
return await initWallet({
|
|
1028
|
+
config,
|
|
1029
|
+
logger
|
|
1030
|
+
}, mnemonic);
|
|
1031
|
+
}
|
|
1032
|
+
__name(initMempoolWallet, "initMempoolWallet");
|
|
1033
|
+
async function initProducerWallet({ config, logger }) {
|
|
1034
|
+
const { mnemonic } = config.producer;
|
|
1035
|
+
return await initWallet({
|
|
1036
|
+
config,
|
|
1037
|
+
logger
|
|
1038
|
+
}, mnemonic);
|
|
1039
|
+
}
|
|
1040
|
+
__name(initProducerWallet, "initProducerWallet");
|
|
1041
|
+
async function initRewardsRedemptionApiWallet({ config, logger }) {
|
|
1042
|
+
const { mnemonic } = config.rewardRedemptionApi;
|
|
1043
|
+
return await initWallet({
|
|
1044
|
+
config,
|
|
1045
|
+
logger
|
|
1046
|
+
}, mnemonic);
|
|
1047
|
+
}
|
|
1048
|
+
__name(initRewardsRedemptionApiWallet, "initRewardsRedemptionApiWallet");
|
|
1049
|
+
|
|
1158
1050
|
// src/orchestrator/Orchestrator.ts
|
|
1159
|
-
import { AbstractCreatable
|
|
1160
|
-
function
|
|
1051
|
+
import { AbstractCreatable, creatable as creatable2 } from "@xylabs/sdk-js";
|
|
1052
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
1161
1053
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1162
1054
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1163
1055
|
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;
|
|
1164
1056
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1165
1057
|
}
|
|
1166
|
-
__name(
|
|
1167
|
-
var Orchestrator = class extends
|
|
1058
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
1059
|
+
var Orchestrator = class extends AbstractCreatable {
|
|
1168
1060
|
static {
|
|
1169
1061
|
__name(this, "Orchestrator");
|
|
1170
1062
|
}
|
|
@@ -1216,11 +1108,10 @@ var Orchestrator = class extends AbstractCreatable2 {
|
|
|
1216
1108
|
this.logger?.log("[Orchestrator] Stopped...");
|
|
1217
1109
|
}
|
|
1218
1110
|
};
|
|
1219
|
-
Orchestrator =
|
|
1220
|
-
|
|
1111
|
+
Orchestrator = _ts_decorate2([
|
|
1112
|
+
creatable2()
|
|
1221
1113
|
], Orchestrator);
|
|
1222
1114
|
export {
|
|
1223
|
-
Actor,
|
|
1224
1115
|
BalanceActor,
|
|
1225
1116
|
DefaultServiceProvider,
|
|
1226
1117
|
GenericHost,
|
|
@@ -1234,6 +1125,7 @@ export {
|
|
|
1234
1125
|
canUseEvmProvider,
|
|
1235
1126
|
createProducerChainStakeIntentBlock,
|
|
1236
1127
|
getLocator,
|
|
1128
|
+
initApiWallet,
|
|
1237
1129
|
initBalanceSummaryMap,
|
|
1238
1130
|
initBridgedArchivistModule,
|
|
1239
1131
|
initBridgedModule,
|
|
@@ -1242,12 +1134,14 @@ export {
|
|
|
1242
1134
|
initEvmProvider,
|
|
1243
1135
|
initFinalizedArchivist,
|
|
1244
1136
|
initHealthEndpoints,
|
|
1137
|
+
initMempoolWallet,
|
|
1245
1138
|
initPendingBlocksArchivist,
|
|
1246
1139
|
initProducerAccount,
|
|
1140
|
+
initProducerWallet,
|
|
1247
1141
|
initRejectedTransactionsArchivist,
|
|
1142
|
+
initRewardsRedemptionApiWallet,
|
|
1248
1143
|
initSeedPhrase,
|
|
1249
1144
|
initServerNode,
|
|
1250
|
-
initServerWallet,
|
|
1251
1145
|
initSimpleStakeViewer,
|
|
1252
1146
|
initStakeIntentStateArchivist,
|
|
1253
1147
|
initStakeViewer,
|