@xyo-network/chain-mempool 1.20.15 → 1.20.17
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/README.md +9 -81
- package/package.json +138 -39
- package/src/MempoolActor.ts +0 -91
- package/src/index.ts +0 -2
- package/src/runMempool.ts +0 -35
package/README.md
CHANGED
|
@@ -1,96 +1,24 @@
|
|
|
1
1
|
# @xyo-network/chain-mempool
|
|
2
2
|
|
|
3
|
-
[![
|
|
3
|
+
[![npm][npm-badge]][npm-link]
|
|
4
|
+
[![license][license-badge]][license-link]
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
[![npm-downloads-badge][]][npm-link]
|
|
7
|
-
[![jsdelivr-badge][]][jsdelivr-link]
|
|
8
|
-
[![npm-license-badge][]](LICENSE)
|
|
9
|
-
[![socket-badge][]][socket-link]
|
|
6
|
+
> XYO Layer One API
|
|
10
7
|
|
|
11
|
-
|
|
8
|
+
## Install
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## Reference
|
|
16
|
-
|
|
17
|
-
**@xyo-network/chain-mempool**
|
|
18
|
-
|
|
19
|
-
***
|
|
20
|
-
|
|
21
|
-
## Functions
|
|
22
|
-
|
|
23
|
-
- [getApp](#functions/getApp)
|
|
24
|
-
- [getServer](#functions/getServer)
|
|
25
|
-
|
|
26
|
-
### functions
|
|
27
|
-
|
|
28
|
-
### <a id="getApp"></a>getApp
|
|
29
|
-
|
|
30
|
-
[**@xyo-network/chain-mempool**](#../README)
|
|
31
|
-
|
|
32
|
-
***
|
|
33
|
-
|
|
34
|
-
```ts
|
|
35
|
-
function getApp(node): Express;
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Parameters
|
|
39
|
-
|
|
40
|
-
### node
|
|
41
|
-
|
|
42
|
-
`NodeInstance`
|
|
43
|
-
|
|
44
|
-
## Returns
|
|
45
|
-
|
|
46
|
-
`Express`
|
|
47
|
-
|
|
48
|
-
### <a id="getServer"></a>getServer
|
|
49
|
-
|
|
50
|
-
[**@xyo-network/chain-mempool**](#../README)
|
|
51
|
-
|
|
52
|
-
***
|
|
53
|
-
|
|
54
|
-
```ts
|
|
55
|
-
function getServer(context): Promise<Server<typeof IncomingMessage, typeof ServerResponse>>;
|
|
10
|
+
```sh
|
|
11
|
+
{{pm}} add {{name}}
|
|
56
12
|
```
|
|
57
13
|
|
|
58
|
-
## Parameters
|
|
59
|
-
|
|
60
|
-
### context
|
|
61
|
-
|
|
62
|
-
`GetServerContext`
|
|
63
|
-
|
|
64
|
-
## Returns
|
|
65
|
-
|
|
66
|
-
`Promise`\<`Server`\<*typeof* `IncomingMessage`, *typeof* `ServerResponse`\>\>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## Maintainers
|
|
70
|
-
|
|
71
|
-
- [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
|
|
72
|
-
- [Matt Jones](https://github.com/jonesmac)
|
|
73
|
-
- [Joel Carter](https://github.com/JoelBCarter)
|
|
74
|
-
- [Jordan Trouw](https://github.com/jordantrouw)
|
|
75
14
|
|
|
76
15
|
## License
|
|
77
16
|
|
|
78
|
-
|
|
17
|
+
See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
|
|
79
18
|
|
|
80
|
-
## Credits
|
|
81
19
|
|
|
82
|
-
[Made with 🔥 and ❄️ by XYO](https://xyo.network)
|
|
83
|
-
|
|
84
|
-
[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png
|
|
85
20
|
|
|
86
21
|
[npm-badge]: https://img.shields.io/npm/v/@xyo-network/chain-mempool.svg
|
|
87
22
|
[npm-link]: https://www.npmjs.com/package/@xyo-network/chain-mempool
|
|
88
|
-
|
|
89
|
-
[
|
|
90
|
-
[npm-license-badge]: https://img.shields.io/npm/l/@xyo-network/chain-mempool
|
|
91
|
-
|
|
92
|
-
[jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xyo-network/chain-mempool/badge
|
|
93
|
-
[jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xyo-network/chain-mempool
|
|
94
|
-
|
|
95
|
-
[socket-badge]: https://socket.dev/api/badge/npm/package/@xyo-network/chain-mempool
|
|
96
|
-
[socket-link]: https://socket.dev/npm/package/@xyo-network/chain-mempool
|
|
23
|
+
[license-badge]: https://img.shields.io/npm/l/@xyo-network/chain-mempool.svg
|
|
24
|
+
[license-link]: https://github.com/xylabs/sdk-js/blob/main/LICENSE
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/chain-mempool",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.17",
|
|
4
4
|
"description": "XYO Layer One API",
|
|
5
5
|
"homepage": "https://xylabs.com",
|
|
6
6
|
"bugs": {
|
|
@@ -22,70 +22,169 @@
|
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
24
|
"types": "./dist/node/index.d.ts",
|
|
25
|
-
"source": "./src/index.ts",
|
|
26
25
|
"default": "./dist/node/index.mjs"
|
|
27
26
|
},
|
|
28
27
|
"./package.json": "./package.json",
|
|
29
28
|
"./README.md": "./README.md"
|
|
30
29
|
},
|
|
31
30
|
"module": "./dist/node/index.mjs",
|
|
32
|
-
"source": "./src/index.ts",
|
|
33
31
|
"types": "./dist/node/index.d.ts",
|
|
34
32
|
"files": [
|
|
35
33
|
"dist",
|
|
36
|
-
"src",
|
|
37
34
|
"!**/*.bench.*",
|
|
38
35
|
"!**/*.spec.*",
|
|
39
|
-
"!**/*.test.*"
|
|
36
|
+
"!**/*.test.*",
|
|
37
|
+
"README.md"
|
|
40
38
|
],
|
|
41
|
-
"scripts": {
|
|
42
|
-
"build-tests": "tsc --noEmit --lib dom,esnext",
|
|
43
|
-
"deploy": "echo Deploy not allowed!",
|
|
44
|
-
"deploy3": "echo Deploy3 not allowed!",
|
|
45
|
-
"start": "nodemon",
|
|
46
|
-
"start-esm": "node ./dist/node/index.mjs",
|
|
47
|
-
"test": "vitest run",
|
|
48
|
-
"test:ci": "vitest run",
|
|
49
|
-
"types": "tsc --noEmit -p tsconfig.test.json"
|
|
50
|
-
},
|
|
51
39
|
"dependencies": {
|
|
52
|
-
"@xyo-network/
|
|
53
|
-
"async-mutex": "^0.5.0"
|
|
40
|
+
"@xyo-network/xl1-sdk": "~1.26.20",
|
|
41
|
+
"async-mutex": "^0.5.0",
|
|
42
|
+
"@xyo-network/chain-orchestration": "~1.20.17"
|
|
54
43
|
},
|
|
55
44
|
"devDependencies": {
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"@xylabs/
|
|
59
|
-
"@xylabs/
|
|
60
|
-
"@xylabs/
|
|
61
|
-
"@xylabs/
|
|
62
|
-
"@
|
|
63
|
-
"@
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
45
|
+
"@opentelemetry/api": "^1",
|
|
46
|
+
"@types/node": "~25.5.2",
|
|
47
|
+
"@xylabs/express": "^5.0.95",
|
|
48
|
+
"@xylabs/mongo": "~5.0.95",
|
|
49
|
+
"@xylabs/sdk-js": "~5.0.95",
|
|
50
|
+
"@xylabs/ts-scripts-common": "~7.9.6",
|
|
51
|
+
"@xylabs/ts-scripts-pnpm": "~7.9.6",
|
|
52
|
+
"@xylabs/tsconfig": "~7.9.6",
|
|
53
|
+
"@xyo-network/account": "~5.3.30",
|
|
54
|
+
"@xyo-network/account-model": "~5.3",
|
|
55
|
+
"@xyo-network/api-models": "~5.3.30",
|
|
56
|
+
"@xyo-network/archivist-abstract": "~5.3",
|
|
57
|
+
"@xyo-network/archivist-generic": "~5.3.30",
|
|
58
|
+
"@xyo-network/archivist-memory": "~5.3.30",
|
|
59
|
+
"@xyo-network/archivist-model": "~5.3",
|
|
60
|
+
"@xyo-network/archivist-view": "~5.3.30",
|
|
61
|
+
"@xyo-network/archivist-wrapper": "~5.3",
|
|
62
|
+
"@xyo-network/boundwitness-builder": "~5.3.30",
|
|
63
|
+
"@xyo-network/boundwitness-validator": "~5.3",
|
|
64
|
+
"@xyo-network/bridge-abstract": "~5.3.30",
|
|
65
|
+
"@xyo-network/bridge-model": "~5.3.30",
|
|
66
|
+
"@xyo-network/config-payload-plugin": "~5.3.30",
|
|
67
|
+
"@xyo-network/data": "~5.3.30",
|
|
68
|
+
"@xyo-network/diviner-abstract": "~5.3",
|
|
69
|
+
"@xyo-network/diviner-boundwitness-memory": "~5.3.30",
|
|
70
|
+
"@xyo-network/diviner-identity": "~5.3.30",
|
|
71
|
+
"@xyo-network/diviner-model": "~5.3.30",
|
|
72
|
+
"@xyo-network/diviner-payload-generic": "~5.3.30",
|
|
73
|
+
"@xyo-network/diviner-payload-model": "~5.3.30",
|
|
74
|
+
"@xyo-network/diviner-wrapper": "~5.3",
|
|
75
|
+
"@xyo-network/dns": "~5.3.30",
|
|
76
|
+
"@xyo-network/domain-payload-plugin": "~5.3.30",
|
|
77
|
+
"@xyo-network/elliptic": "~5.3.30",
|
|
78
|
+
"@xyo-network/hash": "~5.3",
|
|
79
|
+
"@xyo-network/huri": "~5.3.30",
|
|
80
|
+
"@xyo-network/manifest-model": "~5.3",
|
|
81
|
+
"@xyo-network/module-abstract": "~5.3",
|
|
82
|
+
"@xyo-network/module-model": "~5.3",
|
|
83
|
+
"@xyo-network/module-model-mongodb": "~5.3",
|
|
84
|
+
"@xyo-network/module-resolver": "~5.3.30",
|
|
85
|
+
"@xyo-network/module-wrapper": "~5.3",
|
|
86
|
+
"@xyo-network/network": "~5.3.30",
|
|
87
|
+
"@xyo-network/node-abstract": "~5.3.30",
|
|
88
|
+
"@xyo-network/node-memory": "~5.3.30",
|
|
89
|
+
"@xyo-network/node-model": "~5.3.30",
|
|
90
|
+
"@xyo-network/node-view": "~5.3.30",
|
|
91
|
+
"@xyo-network/node-wrapper": "~5.3",
|
|
92
|
+
"@xyo-network/payload-builder": "~5.3",
|
|
93
|
+
"@xyo-network/payload-model": "~5.3.30",
|
|
94
|
+
"@xyo-network/payload-validator": "~5.3",
|
|
95
|
+
"@xyo-network/previous-hash-store-model": "~5.3.30",
|
|
96
|
+
"@xyo-network/sdk-js": "~5.3.30",
|
|
97
|
+
"@xyo-network/sentinel-abstract": "~5.3.30",
|
|
98
|
+
"@xyo-network/sentinel-memory": "~5.3.30",
|
|
99
|
+
"@xyo-network/sentinel-model": "~5.3.30",
|
|
100
|
+
"@xyo-network/wallet-model": "~5.3.30",
|
|
101
|
+
"@xyo-network/wasm": "~5.3.30",
|
|
102
|
+
"@xyo-network/witness-adhoc": "~5.3.30",
|
|
103
|
+
"@xyo-network/witness-model": "~5.3.30",
|
|
104
|
+
"ajv": "^8",
|
|
105
|
+
"axios": "^1.15.0",
|
|
106
|
+
"dotenv": "~17.4.1",
|
|
107
|
+
"esbuild": ">=0.18",
|
|
67
108
|
"ethers": "^6.16.0",
|
|
109
|
+
"lmdb": "^3",
|
|
68
110
|
"mongodb": "~7.1.1",
|
|
69
111
|
"nodemon": "~3.1.14",
|
|
112
|
+
"pako": "~2.1.0",
|
|
70
113
|
"tslib": "~2.8.1",
|
|
71
114
|
"typescript": "~5.9.3",
|
|
72
|
-
"
|
|
73
|
-
"
|
|
115
|
+
"vite": "^8.0.8",
|
|
116
|
+
"vitest": "^4.1.4",
|
|
117
|
+
"zod": "^4.3.6",
|
|
118
|
+
"@xyo-network/chain-services": "~1.20.17",
|
|
119
|
+
"@xyo-network/chain-telemetry": "~1.20.17"
|
|
74
120
|
},
|
|
75
121
|
"peerDependencies": {
|
|
76
|
-
"@xylabs/
|
|
77
|
-
"@
|
|
78
|
-
"@xyo-network/
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
122
|
+
"@xylabs/express": "^5.0.95",
|
|
123
|
+
"@xylabs/sdk-js": "~5.0.93",
|
|
124
|
+
"@xyo-network/account": "~5.3.30",
|
|
125
|
+
"@xyo-network/account-model": "~5.3",
|
|
126
|
+
"@xyo-network/api-models": "~5.3.30",
|
|
127
|
+
"@xyo-network/archivist-abstract": "~5.3",
|
|
128
|
+
"@xyo-network/archivist-generic": "~5.3.30",
|
|
129
|
+
"@xyo-network/archivist-memory": "~5.3.30",
|
|
130
|
+
"@xyo-network/archivist-model": "~5.3",
|
|
131
|
+
"@xyo-network/archivist-view": "~5.3.30",
|
|
132
|
+
"@xyo-network/boundwitness-builder": "~5.3.30",
|
|
133
|
+
"@xyo-network/boundwitness-validator": "~5.3",
|
|
134
|
+
"@xyo-network/bridge-abstract": "~5.3.30",
|
|
135
|
+
"@xyo-network/bridge-model": "~5.3.30",
|
|
136
|
+
"@xyo-network/config-payload-plugin": "~5.3.30",
|
|
137
|
+
"@xyo-network/data": "~5.3.30",
|
|
138
|
+
"@xyo-network/diviner-boundwitness-memory": "~5.3.30",
|
|
139
|
+
"@xyo-network/diviner-identity": "~5.3.30",
|
|
140
|
+
"@xyo-network/diviner-model": "~5.3.30",
|
|
141
|
+
"@xyo-network/diviner-payload-generic": "~5.3.30",
|
|
142
|
+
"@xyo-network/diviner-payload-model": "~5.3.30",
|
|
143
|
+
"@xyo-network/dns": "~5.3.30",
|
|
144
|
+
"@xyo-network/domain-payload-plugin": "~5.3.30",
|
|
145
|
+
"@xyo-network/elliptic": "~5.3.30",
|
|
146
|
+
"@xyo-network/hash": "~5.3",
|
|
147
|
+
"@xyo-network/huri": "~5.3.30",
|
|
148
|
+
"@xyo-network/manifest-model": "~5.3",
|
|
149
|
+
"@xyo-network/module-abstract": "~5.3",
|
|
150
|
+
"@xyo-network/module-model": "~5.3",
|
|
151
|
+
"@xyo-network/module-model-mongodb": "~5.3",
|
|
152
|
+
"@xyo-network/module-resolver": "~5.3.30",
|
|
153
|
+
"@xyo-network/network": "~5.3.30",
|
|
154
|
+
"@xyo-network/node-abstract": "~5.3.30",
|
|
155
|
+
"@xyo-network/node-memory": "~5.3.30",
|
|
156
|
+
"@xyo-network/node-model": "~5.3.30",
|
|
157
|
+
"@xyo-network/node-view": "~5.3.30",
|
|
158
|
+
"@xyo-network/payload-builder": "~5.3",
|
|
159
|
+
"@xyo-network/payload-model": "~5.3.30",
|
|
160
|
+
"@xyo-network/payload-validator": "~5.3",
|
|
161
|
+
"@xyo-network/previous-hash-store-model": "~5.3.30",
|
|
162
|
+
"@xyo-network/sentinel-abstract": "~5.3.30",
|
|
163
|
+
"@xyo-network/sentinel-memory": "~5.3.30",
|
|
164
|
+
"@xyo-network/sentinel-model": "~5.3.30",
|
|
165
|
+
"@xyo-network/wallet-model": "~5.3.30",
|
|
166
|
+
"@xyo-network/wasm": "~5.3.30",
|
|
167
|
+
"@xyo-network/witness-adhoc": "~5.3.30",
|
|
168
|
+
"@xyo-network/witness-model": "~5.3.30",
|
|
169
|
+
"pako": "~2.1.0",
|
|
170
|
+
"@xyo-network/chain-services": "~1.20.17",
|
|
171
|
+
"@xyo-network/chain-telemetry": "~1.20.17"
|
|
83
172
|
},
|
|
84
173
|
"engines": {
|
|
85
|
-
"node": ">=
|
|
174
|
+
"node": ">=24"
|
|
86
175
|
},
|
|
87
176
|
"engineStrict": true,
|
|
88
177
|
"publishConfig": {
|
|
89
178
|
"access": "restricted"
|
|
179
|
+
},
|
|
180
|
+
"scripts": {
|
|
181
|
+
"build-tests": "tsc --noEmit --lib dom,esnext",
|
|
182
|
+
"deploy": "echo Deploy not allowed!",
|
|
183
|
+
"deploy3": "echo Deploy3 not allowed!",
|
|
184
|
+
"start": "nodemon",
|
|
185
|
+
"start-esm": "node ./dist/node/index.mjs",
|
|
186
|
+
"test": "vitest run",
|
|
187
|
+
"test:ci": "vitest run",
|
|
188
|
+
"types": "tsc --noEmit -p tsconfig.test.json"
|
|
90
189
|
}
|
|
91
|
-
}
|
|
190
|
+
}
|
package/src/MempoolActor.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { creatable } from '@xylabs/sdk-js'
|
|
2
|
-
import { MempoolConfig } from '@xyo-network/chain-orchestration'
|
|
3
|
-
import {
|
|
4
|
-
ActorParamsV3,
|
|
5
|
-
ActorV3,
|
|
6
|
-
MempoolRunner,
|
|
7
|
-
MempoolRunnerMoniker,
|
|
8
|
-
} from '@xyo-network/xl1-sdk'
|
|
9
|
-
import { Mutex } from 'async-mutex'
|
|
10
|
-
|
|
11
|
-
export type MempoolActorParams = ActorParamsV3<{
|
|
12
|
-
config: MempoolConfig
|
|
13
|
-
}>
|
|
14
|
-
|
|
15
|
-
@creatable()
|
|
16
|
-
export class MempoolActor extends ActorV3<MempoolActorParams> {
|
|
17
|
-
protected _mempoolRunner!: MempoolRunner
|
|
18
|
-
|
|
19
|
-
private _blockTimerId: ReturnType<typeof setInterval> | null = null
|
|
20
|
-
private _blockTimerMutex = new Mutex()
|
|
21
|
-
|
|
22
|
-
private _transactionTimerId: ReturnType<typeof setInterval> | null = null
|
|
23
|
-
private _transactionTimerMutex = new Mutex()
|
|
24
|
-
|
|
25
|
-
protected get mempoolRunner() {
|
|
26
|
-
return this._mempoolRunner
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
override async createHandler() {
|
|
30
|
-
await super.createHandler()
|
|
31
|
-
this._mempoolRunner = await this.locator.getInstance(MempoolRunnerMoniker)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
override async startHandler() {
|
|
35
|
-
await super.startHandler()
|
|
36
|
-
this.restartTransactionTimer()
|
|
37
|
-
this.restartBlockTimer()
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
override async stopHandler() {
|
|
41
|
-
await super.stopHandler()
|
|
42
|
-
this.stopTransactionTimer()
|
|
43
|
-
this.stopBlockTimer()
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
private restartBlockTimer() {
|
|
47
|
-
this.stopBlockTimer()
|
|
48
|
-
this._blockTimerId = setInterval(() => {
|
|
49
|
-
if (this._blockTimerMutex.isLocked()) {
|
|
50
|
-
return
|
|
51
|
-
}
|
|
52
|
-
void this._blockTimerMutex.runExclusive(async () => {
|
|
53
|
-
try {
|
|
54
|
-
await this.mempoolRunner.prunePendingBlocks({ batchSize: 50 })
|
|
55
|
-
} catch (error) {
|
|
56
|
-
this.logger?.error(`[MempoolActor] Error pruning pending blocks: ${(error as Error).message}`)
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
}, 1000)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
private restartTransactionTimer() {
|
|
63
|
-
this.stopTransactionTimer()
|
|
64
|
-
this._transactionTimerId = setInterval(() => {
|
|
65
|
-
if (this._transactionTimerMutex.isLocked()) {
|
|
66
|
-
return
|
|
67
|
-
}
|
|
68
|
-
void this._transactionTimerMutex.runExclusive(async () => {
|
|
69
|
-
try {
|
|
70
|
-
await this.mempoolRunner.prunePendingTransactions({ batchSize: 50 })
|
|
71
|
-
} catch (error) {
|
|
72
|
-
this.logger?.error(`[MempoolActor] Error pruning pending transactions: ${(error as Error).message}`)
|
|
73
|
-
}
|
|
74
|
-
})
|
|
75
|
-
}, 1000)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
private stopBlockTimer() {
|
|
79
|
-
if (this._blockTimerId !== null) {
|
|
80
|
-
clearInterval(this._blockTimerId)
|
|
81
|
-
}
|
|
82
|
-
this._blockTimerId = null
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
private stopTransactionTimer() {
|
|
86
|
-
if (this._transactionTimerId !== null) {
|
|
87
|
-
clearInterval(this._transactionTimerId)
|
|
88
|
-
}
|
|
89
|
-
this._transactionTimerId = null
|
|
90
|
-
}
|
|
91
|
-
}
|
package/src/index.ts
DELETED
package/src/runMempool.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { exists } from '@xylabs/sdk-js'
|
|
2
|
-
import type { MempoolConfig, OrchestratorInstance } from '@xyo-network/chain-orchestration'
|
|
3
|
-
import { initActorWallet } from '@xyo-network/chain-orchestration'
|
|
4
|
-
import type { ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk'
|
|
5
|
-
|
|
6
|
-
import { MempoolActor } from './MempoolActor.ts'
|
|
7
|
-
|
|
8
|
-
export const getMempoolActor = async (
|
|
9
|
-
config: MempoolConfig,
|
|
10
|
-
locator: ProviderFactoryLocatorInstance,
|
|
11
|
-
) => {
|
|
12
|
-
const account = await initActorWallet({
|
|
13
|
-
config, logger: locator.context.logger, caches: {}, singletons: {},
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
return await MempoolActor.create({
|
|
17
|
-
account, config, locator,
|
|
18
|
-
})
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const runMempool = async (
|
|
22
|
-
config: MempoolConfig,
|
|
23
|
-
orchestrator: OrchestratorInstance,
|
|
24
|
-
locator: ProviderFactoryLocatorInstance,
|
|
25
|
-
) => {
|
|
26
|
-
const mempool = await getMempoolActor(config, locator)
|
|
27
|
-
const actors = [mempool].filter(exists)
|
|
28
|
-
|
|
29
|
-
for (const actor of actors) {
|
|
30
|
-
// Register the actor with the orchestrator
|
|
31
|
-
await orchestrator.registerActor(actor)
|
|
32
|
-
}
|
|
33
|
-
// Start the orchestrator => automatically activates the actor
|
|
34
|
-
await orchestrator.start()
|
|
35
|
-
}
|