@xyo-network/xl1-cli-lib 1.11.0 → 1.12.1
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/node/index.mjs +446 -465
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/optionsFromGlobalZodRegistry.d.ts +3 -0
- package/dist/node/optionsFromGlobalZodRegistry.d.ts.map +1 -0
- package/dist/node/orchestration/actor/implementation/ChainHeadUpdateActor.d.ts +1 -1
- package/dist/node/orchestration/actor/implementation/ChainHeadUpdateActor.d.ts.map +1 -1
- package/dist/node/orchestration/actor/implementation/ProducerActor.d.ts +10 -6
- package/dist/node/orchestration/actor/implementation/ProducerActor.d.ts.map +1 -1
- package/dist/node/orchestration/actor/implementation/ValidatorActor.d.ts +5 -1
- package/dist/node/orchestration/actor/implementation/ValidatorActor.d.ts.map +1 -1
- package/dist/node/orchestration/archivists/ChainFinalized/archivist.d.ts.map +1 -1
- package/dist/node/orchestration/archivists/PendingTransactions/archivist.d.ts.map +1 -1
- package/dist/node/orchestration/initServices.d.ts.map +1 -1
- package/dist/node/orchestration/map/BalanceSummary/initBalanceSummaryMap.d.ts +1 -1
- package/dist/node/orchestration/map/BalanceSummary/initBalanceSummaryMap.d.ts.map +1 -1
- package/dist/node/orchestration/map/BalanceSummary/local.d.ts +1 -1
- package/dist/node/orchestration/map/BalanceSummary/local.d.ts.map +1 -1
- package/dist/node/orchestration/map/driver/lmdb/SynchronousLmdbMap.d.ts +1 -1
- package/dist/node/orchestration/map/driver/lmdb/SynchronousLmdbMap.d.ts.map +1 -1
- package/dist/node/orchestration/map/localPersistentMap.d.ts +1 -1
- package/dist/node/orchestration/map/localPersistentMap.d.ts.map +1 -1
- package/dist/node/orchestration/repository/lib/repositoryFromArchivist.d.ts +5 -2
- package/dist/node/orchestration/repository/lib/repositoryFromArchivist.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/balance.d.ts +1 -1
- package/dist/node/orchestration/services/implementation/balance.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/chain/evm.d.ts +2 -2
- package/dist/node/orchestration/services/implementation/chain/evm.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/chain/index.d.ts +1 -1
- package/dist/node/orchestration/services/implementation/chain/index.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/iterator.d.ts +1 -1
- package/dist/node/orchestration/services/implementation/iterator.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/pendingTransactions.d.ts +1 -1
- package/dist/node/orchestration/services/implementation/pendingTransactions.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/producer.d.ts +1 -1
- package/dist/node/orchestration/services/implementation/producer.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/reward.d.ts +1 -1
- package/dist/node/orchestration/services/implementation/reward.d.ts.map +1 -1
- package/dist/node/orchestration/services/implementation/validator.d.ts +1 -1
- package/dist/node/orchestration/services/implementation/validator.d.ts.map +1 -1
- package/dist/node/runCLI.d.ts.map +1 -1
- package/dist/node/xl1.mjs +441 -463
- package/dist/node/xl1.mjs.map +1 -1
- package/package.json +33 -40
- package/src/optionsFromGlobalZodRegistry.ts +19 -0
- package/src/orchestration/actor/implementation/ChainHeadUpdateActor.ts +1 -1
- package/src/orchestration/actor/implementation/ProducerActor.ts +1 -2
- package/src/orchestration/archivists/ChainFinalized/archivist.ts +1 -2
- package/src/orchestration/archivists/ChainFinalized/remote.ts +1 -1
- package/src/orchestration/archivists/ChainSubmissions/archivist.ts +1 -1
- package/src/orchestration/archivists/ChainSubmissions/remote.ts +1 -1
- package/src/orchestration/archivists/PendingTransactions/archivist.ts +1 -2
- package/src/orchestration/archivists/PendingTransactions/remote.ts +1 -1
- package/src/orchestration/archivists/RejectedTransactions/archivist.ts +1 -1
- package/src/orchestration/archivists/StakeIntentState/archivist.ts +1 -1
- package/src/orchestration/initServices.ts +4 -5
- package/src/orchestration/map/BalanceSummary/initBalanceSummaryMap.ts +2 -2
- package/src/orchestration/map/BalanceSummary/local.ts +1 -1
- package/src/orchestration/map/driver/lmdb/SynchronousLmdbMap.ts +1 -1
- package/src/orchestration/map/localPersistentMap.ts +1 -1
- package/src/orchestration/services/implementation/balance.ts +2 -2
- package/src/orchestration/services/implementation/chain/evm.ts +2 -2
- package/src/orchestration/services/implementation/chain/index.ts +2 -2
- package/src/orchestration/services/implementation/head.ts +1 -1
- package/src/orchestration/services/implementation/iterator.ts +2 -2
- package/src/orchestration/services/implementation/pendingTransactions.ts +2 -2
- package/src/orchestration/services/implementation/producer.ts +2 -2
- package/src/orchestration/services/implementation/reward.ts +2 -2
- package/src/orchestration/services/implementation/validator.ts +1 -1
- package/src/runCLI.ts +6 -8
- package/src/spec/BootstrapChain.spec.ts +4 -4
- package/dist/node/optionsFromZodSchema.d.ts +0 -4
- package/dist/node/optionsFromZodSchema.d.ts.map +0 -1
- package/src/optionsFromZodSchema.ts +0 -69
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/xl1-cli-lib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.1",
|
|
4
4
|
"description": "XYO Layer One CLI Library",
|
|
5
5
|
"homepage": "https://xylabs.com",
|
|
6
6
|
"bugs": {
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
"node": {
|
|
25
|
+
"types": "./dist/node/index.d.ts",
|
|
26
|
+
"source": "./src/index.ts",
|
|
27
|
+
"import": "./dist/node/index.mjs"
|
|
28
|
+
}
|
|
27
29
|
},
|
|
28
30
|
"./package.json": "./package.json",
|
|
29
31
|
"./README.md": "./README.md"
|
|
30
32
|
},
|
|
31
33
|
"module": "./dist/node/index.mjs",
|
|
32
|
-
"source": "./src/index.ts",
|
|
33
|
-
"types": "./dist/node/index.d.ts",
|
|
34
34
|
"files": [
|
|
35
35
|
"dist",
|
|
36
36
|
"src"
|
|
@@ -41,48 +41,41 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@opentelemetry/api": "~1.9.0",
|
|
44
|
-
"@xylabs/array": "~5.0.
|
|
45
|
-
"@xylabs/assert": "~5.0.
|
|
46
|
-
"@xylabs/base": "~5.0.
|
|
47
|
-
"@xylabs/creatable": "~5.0.
|
|
48
|
-
"@xylabs/delay": "~5.0.
|
|
49
|
-
"@xylabs/forget": "~5.0.
|
|
50
|
-
"@xylabs/hex": "~5.0.
|
|
51
|
-
"@xylabs/logger": "~5.0.
|
|
52
|
-
"@xylabs/object": "~5.0.
|
|
53
|
-
"@xylabs/promise": "~5.0.
|
|
54
|
-
"@xylabs/telemetry": "~5.0.
|
|
55
|
-
"@xylabs/typeof": "~5.0.
|
|
56
|
-
"@xyo-network/archivist-lmdb": "~5.0.
|
|
57
|
-
"@xyo-network/archivist-memory": "~5.0.
|
|
58
|
-
"@xyo-network/archivist-model": "~5.0.
|
|
59
|
-
"@xyo-network/chain-api": "~1.
|
|
60
|
-
"@xyo-network/chain-
|
|
61
|
-
"@xyo-network/
|
|
62
|
-
"@xyo-network/
|
|
63
|
-
"@xyo-network/
|
|
64
|
-
"@xyo-network/
|
|
65
|
-
"@xyo-network/
|
|
66
|
-
"@xyo-network/
|
|
67
|
-
"@xyo-network/payload-builder": "~5.0.2",
|
|
68
|
-
"@xyo-network/payload-model": "~5.0.2",
|
|
69
|
-
"@xyo-network/wallet": "~5.0.2",
|
|
70
|
-
"@xyo-network/wallet-model": "~5.0.2",
|
|
71
|
-
"@xyo-network/xl1-protocol": "~1.10.3",
|
|
72
|
-
"@xyo-network/xl1-protocol-sdk": "~1.11.0",
|
|
44
|
+
"@xylabs/array": "~5.0.8",
|
|
45
|
+
"@xylabs/assert": "~5.0.8",
|
|
46
|
+
"@xylabs/base": "~5.0.8",
|
|
47
|
+
"@xylabs/creatable": "~5.0.8",
|
|
48
|
+
"@xylabs/delay": "~5.0.8",
|
|
49
|
+
"@xylabs/forget": "~5.0.8",
|
|
50
|
+
"@xylabs/hex": "~5.0.8",
|
|
51
|
+
"@xylabs/logger": "~5.0.8",
|
|
52
|
+
"@xylabs/object": "~5.0.8",
|
|
53
|
+
"@xylabs/promise": "~5.0.8",
|
|
54
|
+
"@xylabs/telemetry": "~5.0.8",
|
|
55
|
+
"@xylabs/typeof": "~5.0.8",
|
|
56
|
+
"@xyo-network/archivist-lmdb": "~5.0.5",
|
|
57
|
+
"@xyo-network/archivist-memory": "~5.0.5",
|
|
58
|
+
"@xyo-network/archivist-model": "~5.0.5",
|
|
59
|
+
"@xyo-network/chain-api": "~1.12.1",
|
|
60
|
+
"@xyo-network/chain-sdk": "~1.12.1",
|
|
61
|
+
"@xyo-network/payload-builder": "~5.0.5",
|
|
62
|
+
"@xyo-network/payload-model": "~5.0.5",
|
|
63
|
+
"@xyo-network/wallet": "~5.0.5",
|
|
64
|
+
"@xyo-network/wallet-model": "~5.0.5",
|
|
65
|
+
"@xyo-network/xl1-protocol": "~1.10.13",
|
|
66
|
+
"@xyo-network/xl1-protocol-sdk": "~1.12.1",
|
|
73
67
|
"async-mutex": "~0.5.0",
|
|
74
68
|
"cosmiconfig": "~9.0.0",
|
|
75
69
|
"dotenv": "~17.2.1",
|
|
76
70
|
"ethers": "~6.15.0",
|
|
77
71
|
"lmdb": "~3.4.2",
|
|
78
72
|
"yargs": "~18.0.0",
|
|
79
|
-
"zod": "~
|
|
73
|
+
"zod": "~4.0.17"
|
|
80
74
|
},
|
|
81
75
|
"devDependencies": {
|
|
82
|
-
"@xylabs/ts-scripts-yarn3": "~7.1.
|
|
83
|
-
"@xylabs/tsconfig": "~7.1.
|
|
84
|
-
"@xylabs/vitest-extended": "~5.0.
|
|
85
|
-
"@xyo-network/chain-sdk": "~1.11.0",
|
|
76
|
+
"@xylabs/ts-scripts-yarn3": "~7.1.2",
|
|
77
|
+
"@xylabs/tsconfig": "~7.1.2",
|
|
78
|
+
"@xylabs/vitest-extended": "~5.0.8",
|
|
86
79
|
"nodemon": "~3.1.10",
|
|
87
80
|
"rimraf": "~6.0.1",
|
|
88
81
|
"tslib": "~2.8.1",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { UsageMeta } from '@xyo-network/xl1-protocol-sdk'
|
|
2
|
+
import { isUsageMeta } from '@xyo-network/xl1-protocol-sdk'
|
|
3
|
+
import type { Options } from 'yargs'
|
|
4
|
+
import { globalRegistry } from 'zod'
|
|
5
|
+
|
|
6
|
+
const usageMetaToOptions = (meta: UsageMeta): Options => {
|
|
7
|
+
return meta
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const optionsFromGlobalZodRegistry = (): Record<string, Options> => {
|
|
11
|
+
const opts: Record<string, Options> = {}
|
|
12
|
+
for (const schema of globalRegistry._map.values()) {
|
|
13
|
+
if (isUsageMeta(schema)) {
|
|
14
|
+
if (schema.hidden) continue // skip hidden options
|
|
15
|
+
opts[schema.title] = usageMetaToOptions(schema)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return opts
|
|
19
|
+
}
|
|
@@ -3,7 +3,7 @@ import { assertEx } from '@xylabs/assert'
|
|
|
3
3
|
import type { BaseParams } from '@xylabs/base'
|
|
4
4
|
import { toHex } from '@xylabs/hex'
|
|
5
5
|
import type { Promisable } from '@xylabs/promise'
|
|
6
|
-
import { findMostRecentBlock, sortBlocks } from '@xyo-network/chain-
|
|
6
|
+
import { findMostRecentBlock, sortBlocks } from '@xyo-network/chain-sdk'
|
|
7
7
|
import type { Payload } from '@xyo-network/payload-model'
|
|
8
8
|
import type { BlockBoundWitness } from '@xyo-network/xl1-protocol'
|
|
9
9
|
import { asBlockBoundWitness } from '@xyo-network/xl1-protocol'
|
|
@@ -3,8 +3,7 @@ import type { BaseParams } from '@xylabs/base'
|
|
|
3
3
|
import { toHex } from '@xylabs/hex'
|
|
4
4
|
import type { Promisable } from '@xylabs/promise'
|
|
5
5
|
import { isDefined, isUndefined } from '@xylabs/typeof'
|
|
6
|
-
import { createDeclarationIntent } from '@xyo-network/chain-
|
|
7
|
-
import { BaseBlockProducerService } from '@xyo-network/chain-services'
|
|
6
|
+
import { BaseBlockProducerService, createDeclarationIntent } from '@xyo-network/chain-sdk'
|
|
8
7
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
9
8
|
import type { PayloadBundle } from '@xyo-network/payload-model'
|
|
10
9
|
import { PayloadBundleSchema } from '@xyo-network/payload-model'
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
2
|
-
import { initArchivistSync } from '@xyo-network/chain-
|
|
3
|
-
import { startupSpanAsync } from '@xyo-network/chain-utils'
|
|
2
|
+
import { initArchivistSync, startupSpanAsync } from '@xyo-network/chain-sdk'
|
|
4
3
|
import { Mutex } from 'async-mutex'
|
|
5
4
|
|
|
6
5
|
import type { ChainInitializableParams } from '../../ChainInitializableParams.ts'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
2
|
import type { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
3
|
-
import { initBridge, initBridgedArchivistModule } from '@xyo-network/chain-
|
|
3
|
+
import { initBridge, initBridgedArchivistModule } from '@xyo-network/chain-sdk'
|
|
4
4
|
import type { Initializable } from '@xyo-network/xl1-protocol'
|
|
5
5
|
import { type Config, getUrl } from '@xyo-network/xl1-protocol-sdk'
|
|
6
6
|
import { Mutex } from 'async-mutex'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
2
|
import type { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
3
|
-
import { startupSpanAsync } from '@xyo-network/chain-
|
|
3
|
+
import { startupSpanAsync } from '@xyo-network/chain-sdk'
|
|
4
4
|
import type { Initializable } from '@xyo-network/xl1-protocol'
|
|
5
5
|
import type { Config } from '@xyo-network/xl1-protocol-sdk'
|
|
6
6
|
import { Mutex } from 'async-mutex'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
2
|
import type { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
3
|
-
import { initBridge, initBridgedArchivistModule } from '@xyo-network/chain-
|
|
3
|
+
import { initBridge, initBridgedArchivistModule } from '@xyo-network/chain-sdk'
|
|
4
4
|
import type { Initializable } from '@xyo-network/xl1-protocol'
|
|
5
5
|
import { type Config, getUrl } from '@xyo-network/xl1-protocol-sdk'
|
|
6
6
|
import { Mutex } from 'async-mutex'
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
2
|
-
import { initArchivistSync } from '@xyo-network/chain-
|
|
3
|
-
import { startupSpanAsync } from '@xyo-network/chain-utils'
|
|
2
|
+
import { initArchivistSync, startupSpanAsync } from '@xyo-network/chain-sdk'
|
|
4
3
|
import type { Config } from '@xyo-network/xl1-protocol-sdk'
|
|
5
4
|
import { Mutex } from 'async-mutex'
|
|
6
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
2
|
import type { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
3
|
-
import { initBridge, initBridgedArchivistModule } from '@xyo-network/chain-
|
|
3
|
+
import { initBridge, initBridgedArchivistModule } from '@xyo-network/chain-sdk'
|
|
4
4
|
import type { Initializable } from '@xyo-network/xl1-protocol'
|
|
5
5
|
import { type Config, getUrl } from '@xyo-network/xl1-protocol-sdk'
|
|
6
6
|
import { Mutex } from 'async-mutex'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
2
|
-
import { startupSpanAsync } from '@xyo-network/chain-
|
|
2
|
+
import { startupSpanAsync } from '@xyo-network/chain-sdk'
|
|
3
3
|
import type { InitializableParams } from '@xyo-network/xl1-protocol'
|
|
4
4
|
import { Mutex } from 'async-mutex'
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
2
|
import type { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
3
|
-
import { startupSpanAsync } from '@xyo-network/chain-
|
|
3
|
+
import { startupSpanAsync } from '@xyo-network/chain-sdk'
|
|
4
4
|
import type { Initializable } from '@xyo-network/xl1-protocol'
|
|
5
5
|
import { Mutex } from 'async-mutex'
|
|
6
6
|
|
|
@@ -3,11 +3,10 @@ import type { CreatableName } from '@xylabs/creatable'
|
|
|
3
3
|
import { asAddress } from '@xylabs/hex'
|
|
4
4
|
import type { Logger } from '@xylabs/logger'
|
|
5
5
|
import { isDefined } from '@xylabs/typeof'
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import { validateHydratedBlockState } from '@xyo-network/chain-validation'
|
|
6
|
+
import type { BaseBlockProducerServiceParams, XyoValidatorParams } from '@xyo-network/chain-sdk'
|
|
7
|
+
import {
|
|
8
|
+
balanceSummaryRepositoryFromMap, initTelemetry, startupSpanAsync, validateHydratedBlockState,
|
|
9
|
+
} from '@xyo-network/chain-sdk'
|
|
11
10
|
import type { ChainServiceCollectionV2, Config } from '@xyo-network/xl1-protocol-sdk'
|
|
12
11
|
|
|
13
12
|
import {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Hash } from '@xylabs/hex'
|
|
2
2
|
import { isDefined } from '@xylabs/typeof'
|
|
3
|
-
import type { MapType } from '@xyo-network/chain-
|
|
4
|
-
import { startupSpanAsync } from '@xyo-network/chain-
|
|
3
|
+
import type { MapType } from '@xyo-network/chain-sdk'
|
|
4
|
+
import { startupSpanAsync } from '@xyo-network/chain-sdk'
|
|
5
5
|
import type { WithStorageMeta } from '@xyo-network/payload-model'
|
|
6
6
|
import type { BalancesStepSummary } from '@xyo-network/xl1-protocol-sdk'
|
|
7
7
|
import { Mutex } from 'async-mutex'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Hash } from '@xylabs/hex'
|
|
2
2
|
import { isDefined } from '@xylabs/typeof'
|
|
3
|
-
import type { MapType } from '@xyo-network/chain-
|
|
3
|
+
import type { MapType } from '@xyo-network/chain-sdk'
|
|
4
4
|
import type { WithStorageMeta } from '@xyo-network/payload-model'
|
|
5
5
|
import type { BalancesStepSummary } from '@xyo-network/xl1-protocol-sdk'
|
|
6
6
|
import { Mutex } from 'async-mutex'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { rm } from 'node:fs/promises'
|
|
2
2
|
import Path from 'node:path'
|
|
3
3
|
|
|
4
|
-
import type { MapType } from '@xyo-network/chain-
|
|
4
|
+
import type { MapType } from '@xyo-network/chain-sdk'
|
|
5
5
|
|
|
6
6
|
import type { StoreKind } from '../store/index.ts'
|
|
7
7
|
import { getStoreDirectory } from '../store/index.ts'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Promisable } from '@xylabs/promise'
|
|
2
|
-
import type { BaseAccountBalanceServiceParams } from '@xyo-network/chain-
|
|
3
|
-
import { BaseAccountBalanceService } from '@xyo-network/chain-
|
|
2
|
+
import type { BaseAccountBalanceServiceParams } from '@xyo-network/chain-sdk'
|
|
3
|
+
import { BaseAccountBalanceService } from '@xyo-network/chain-sdk'
|
|
4
4
|
import type { AccountBalanceServiceV2, Initializable } from '@xyo-network/xl1-protocol'
|
|
5
5
|
|
|
6
6
|
let balanceServiceSingleton: Promisable<AccountBalanceServiceV2> | undefined
|
|
@@ -3,8 +3,8 @@ import type { Address } from '@xylabs/hex'
|
|
|
3
3
|
import { asAddress, ZERO_ADDRESS } from '@xylabs/hex'
|
|
4
4
|
import type { Promisable } from '@xylabs/promise'
|
|
5
5
|
import { isDefined } from '@xylabs/typeof'
|
|
6
|
-
import type { BaseAccountableServiceParams } from '@xyo-network/chain-
|
|
7
|
-
import { EvmChainService } from '@xyo-network/chain-
|
|
6
|
+
import type { BaseAccountableServiceParams } from '@xyo-network/chain-sdk'
|
|
7
|
+
import { EvmChainService } from '@xyo-network/chain-sdk'
|
|
8
8
|
import type { Initializable } from '@xyo-network/xl1-protocol'
|
|
9
9
|
import type { Config } from '@xyo-network/xl1-protocol-sdk'
|
|
10
10
|
import type { ContractRunner } from 'ethers'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CreatableName } from '@xylabs/creatable'
|
|
2
2
|
import type { Promisable } from '@xylabs/promise'
|
|
3
|
-
import type { BaseAccountableServiceParams } from '@xyo-network/chain-
|
|
4
|
-
import { MemoryChainService } from '@xyo-network/chain-
|
|
3
|
+
import type { BaseAccountableServiceParams } from '@xyo-network/chain-sdk'
|
|
4
|
+
import { MemoryChainService } from '@xyo-network/chain-sdk'
|
|
5
5
|
import type { ChainService, Initializable } from '@xyo-network/xl1-protocol'
|
|
6
6
|
|
|
7
7
|
import { canUseEvmContractChainService, initEvmContractChainService } from './evm.ts'
|
|
@@ -2,7 +2,7 @@ import { delay } from '@xylabs/delay'
|
|
|
2
2
|
import { ZERO_ADDRESS } from '@xylabs/hex'
|
|
3
3
|
import type { Promisable } from '@xylabs/promise'
|
|
4
4
|
import type { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
5
|
-
import { createGenesisBlock, findMostRecentBlock } from '@xyo-network/chain-
|
|
5
|
+
import { createGenesisBlock, findMostRecentBlock } from '@xyo-network/chain-sdk'
|
|
6
6
|
import type { WithStorageMeta } from '@xyo-network/payload-model'
|
|
7
7
|
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
8
8
|
import type { BlockBoundWitness, Initializable } from '@xyo-network/xl1-protocol'
|
|
@@ -2,11 +2,11 @@ import type {
|
|
|
2
2
|
BaseElectionServicesParams,
|
|
3
3
|
XyoChainIteratorParams,
|
|
4
4
|
XyoStakeIntentServiceParams,
|
|
5
|
-
} from '@xyo-network/chain-
|
|
5
|
+
} from '@xyo-network/chain-sdk'
|
|
6
6
|
import {
|
|
7
7
|
BaseElectionService, ChainBlockNumberIterationService,
|
|
8
8
|
XyoStakeIntentService,
|
|
9
|
-
} from '@xyo-network/chain-
|
|
9
|
+
} from '@xyo-network/chain-sdk'
|
|
10
10
|
import type {
|
|
11
11
|
ElectionService, EventingChainBlockNumberIteratorService, Initializable, StakeIntentService,
|
|
12
12
|
} from '@xyo-network/xl1-protocol'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Promisable } from '@xylabs/promise'
|
|
2
|
-
import type { BasePendingTransactionsServiceParams } from '@xyo-network/chain-
|
|
3
|
-
import { BasePendingTransactionsService } from '@xyo-network/chain-
|
|
2
|
+
import type { BasePendingTransactionsServiceParams } from '@xyo-network/chain-sdk'
|
|
3
|
+
import { BasePendingTransactionsService } from '@xyo-network/chain-sdk'
|
|
4
4
|
import type { Initializable, PendingTransactionsService } from '@xyo-network/xl1-protocol'
|
|
5
5
|
|
|
6
6
|
let serviceSingleton: Promisable<PendingTransactionsService> | undefined
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Promisable } from '@xylabs/promise'
|
|
2
|
-
import type { BaseBlockProducerServiceParams } from '@xyo-network/chain-
|
|
3
|
-
import { BaseBlockProducerService } from '@xyo-network/chain-
|
|
2
|
+
import type { BaseBlockProducerServiceParams } from '@xyo-network/chain-sdk'
|
|
3
|
+
import { BaseBlockProducerService } from '@xyo-network/chain-sdk'
|
|
4
4
|
import type { BlockProducerService, Initializable } from '@xyo-network/xl1-protocol'
|
|
5
5
|
|
|
6
6
|
let serviceSingleton: Promisable<BlockProducerService> | undefined
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import type { BaseBlockRewardServiceParams, EvmBlockRewardServiceParams } from '@xyo-network/chain-
|
|
3
|
-
import { EvmBlockRewardService, MemoryBlockRewardService } from '@xyo-network/chain-
|
|
2
|
+
import type { BaseBlockRewardServiceParams, EvmBlockRewardServiceParams } from '@xyo-network/chain-sdk'
|
|
3
|
+
import { EvmBlockRewardService, MemoryBlockRewardService } from '@xyo-network/chain-sdk'
|
|
4
4
|
import type { BlockRewardService, Initializable } from '@xyo-network/xl1-protocol'
|
|
5
5
|
import type { Config } from '@xyo-network/xl1-protocol-sdk'
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Promisable } from '@xylabs/promise'
|
|
2
|
-
import type { BaseBlockProducerServiceParams } from '@xyo-network/chain-
|
|
2
|
+
import type { BaseBlockProducerServiceParams } from '@xyo-network/chain-sdk'
|
|
3
3
|
import type { BlockProducerService, Initializable } from '@xyo-network/xl1-protocol'
|
|
4
4
|
|
|
5
5
|
import { initBlockProducer } from './producer.ts'
|
package/src/runCLI.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Logger } from '@xylabs/logger'
|
|
2
2
|
import { deepMerge } from '@xylabs/object'
|
|
3
3
|
import { isDefined } from '@xylabs/typeof'
|
|
4
|
-
import { type Config,
|
|
4
|
+
import { type Config, ConfigZod } from '@xyo-network/xl1-protocol-sdk'
|
|
5
5
|
import type { Argv } from 'yargs'
|
|
6
6
|
import yargs from 'yargs'
|
|
7
7
|
import { hideBin } from 'yargs/helpers'
|
|
@@ -10,7 +10,7 @@ import { ZodError } from 'zod'
|
|
|
10
10
|
import { runApi, runProducer } from './commands/index.ts'
|
|
11
11
|
import { XL1LogoColorizedAscii } from './images.ts'
|
|
12
12
|
import { initLogger } from './initLogger.ts'
|
|
13
|
-
import {
|
|
13
|
+
import { optionsFromGlobalZodRegistry } from './optionsFromGlobalZodRegistry.ts'
|
|
14
14
|
import { Orchestrator } from './orchestration/index.ts'
|
|
15
15
|
import { tryParseConfig } from './tryParseConfig.ts'
|
|
16
16
|
import { waitForHostPort } from './waitForHostPort.ts'
|
|
@@ -70,7 +70,6 @@ $0 <command> [options]`)
|
|
|
70
70
|
})
|
|
71
71
|
.env('XL1')
|
|
72
72
|
.scriptName('xl1')
|
|
73
|
-
.version(version)
|
|
74
73
|
.middleware((argv) => {
|
|
75
74
|
try {
|
|
76
75
|
// Parse the various config sources
|
|
@@ -84,17 +83,15 @@ $0 <command> [options]`)
|
|
|
84
83
|
// the parser without the defaults to achieve this.
|
|
85
84
|
const mergedConfig = deepMerge(parsedConfigArgs, parsedConfigFile)
|
|
86
85
|
// Validate the merged configuration
|
|
87
|
-
config =
|
|
86
|
+
config = ConfigZod.parse(mergedConfig)
|
|
88
87
|
} catch (err) {
|
|
89
88
|
if (err instanceof ZodError) {
|
|
90
|
-
|
|
91
|
-
console.error(`${issue.path.join('.')} → ${issue.message}`)
|
|
92
|
-
}
|
|
89
|
+
console.error(`${err.message}`)
|
|
93
90
|
}
|
|
94
91
|
throw new Error('Invalid configuration')
|
|
95
92
|
}
|
|
96
93
|
})
|
|
97
|
-
.options(
|
|
94
|
+
.options(optionsFromGlobalZodRegistry())
|
|
98
95
|
// .commandDir('./command/commands', opts) // Not yet supported for ESM
|
|
99
96
|
.wrap(y.terminalWidth())
|
|
100
97
|
.command('api', 'Run a XL1 API Node', (yargs) => {
|
|
@@ -119,6 +116,7 @@ $0 <command> [options]`)
|
|
|
119
116
|
})
|
|
120
117
|
.help()
|
|
121
118
|
.alias('help', 'h')
|
|
119
|
+
.version(version)
|
|
122
120
|
.argv
|
|
123
121
|
|
|
124
122
|
await argv
|
|
@@ -9,13 +9,13 @@ import { asAddress, hexFromBigInt } from '@xylabs/hex'
|
|
|
9
9
|
import {
|
|
10
10
|
approveTestStakeChainAddress,
|
|
11
11
|
createTestChainContract, createTestErc20, createTestGenesisBlock,
|
|
12
|
+
EvmChainService,
|
|
12
13
|
startGanache, stopGanache, transferTestTokens,
|
|
13
14
|
} from '@xyo-network/chain-sdk'
|
|
14
|
-
import { EvmChainService } from '@xyo-network/chain-services'
|
|
15
15
|
import { HDWallet } from '@xyo-network/wallet'
|
|
16
16
|
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
17
17
|
import type { ChainServiceCollectionV2 } from '@xyo-network/xl1-protocol-sdk'
|
|
18
|
-
import {
|
|
18
|
+
import { ConfigZod, flattenHydratedBlock } from '@xyo-network/xl1-protocol-sdk'
|
|
19
19
|
import type { ContractRunner } from 'ethers'
|
|
20
20
|
import { getAddress } from 'ethers/address'
|
|
21
21
|
import { JsonRpcProvider } from 'ethers/providers'
|
|
@@ -81,12 +81,12 @@ describe.sequential.skip('MultiProducer Network', () => {
|
|
|
81
81
|
await fundAndStakeBlockProducerAccount(blockProducerAccount)
|
|
82
82
|
}
|
|
83
83
|
} else if (bootstrapMultiProducer) {
|
|
84
|
-
services = await initServices({ config:
|
|
84
|
+
services = await initServices({ config: ConfigZod.parse({}), logger: console })
|
|
85
85
|
blockProducerAccounts = await Promise.all(multiProducerSeedPhrases.map(async (phrase) => {
|
|
86
86
|
return await HDWallet.fromPhrase(phrase, "m/44'/60'/0'/0")
|
|
87
87
|
}))
|
|
88
88
|
} else {
|
|
89
|
-
services = await initServices({ config:
|
|
89
|
+
services = await initServices({ config: ConfigZod.parse({}), logger: console })
|
|
90
90
|
const { account } = services
|
|
91
91
|
blockProducerAccounts = [account]
|
|
92
92
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"optionsFromZodSchema.d.ts","sourceRoot":"","sources":["../../src/optionsFromZodSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AA2DrC,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,KACjC,MAAM,CAAC,MAAM,EAAE,OAAO,CAMxB,CAAA"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { Options } from 'yargs'
|
|
2
|
-
import type { ZodTypeAny } from 'zod'
|
|
3
|
-
import {
|
|
4
|
-
ZodBoolean, ZodDefault, ZodEnum, ZodNumber, ZodObject, ZodOptional,
|
|
5
|
-
} from 'zod'
|
|
6
|
-
|
|
7
|
-
const collectOptions = (
|
|
8
|
-
zodType: ZodTypeAny,
|
|
9
|
-
path: string[] = [],
|
|
10
|
-
out: Record<string, Options> = {},
|
|
11
|
-
): Record<string, Options> => {
|
|
12
|
-
// Handle objects by descending into their shape
|
|
13
|
-
if (zodType instanceof ZodObject) {
|
|
14
|
-
const shape = (zodType as ZodObject<{}>).shape
|
|
15
|
-
for (const [k, v] of Object.entries(shape)) {
|
|
16
|
-
collectOptions(v as ZodTypeAny, [...path, k], out)
|
|
17
|
-
}
|
|
18
|
-
return out
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Handle defaults and optionals by descending into the inner type
|
|
22
|
-
// TODO: Less brittle
|
|
23
|
-
const def = zodType._def
|
|
24
|
-
if (def?.innerType instanceof ZodObject) {
|
|
25
|
-
const shape = def.innerType.shape
|
|
26
|
-
for (const [k, v] of Object.entries(shape)) {
|
|
27
|
-
collectOptions(v as ZodTypeAny, [...path, k], out)
|
|
28
|
-
}
|
|
29
|
-
return out
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Construct the Yargs Options
|
|
33
|
-
const options: Options = {}
|
|
34
|
-
|
|
35
|
-
// Assign the description
|
|
36
|
-
options.describe = def.description
|
|
37
|
-
|
|
38
|
-
// Assign the default value
|
|
39
|
-
options.default = typeof def.defaultValue === 'function'
|
|
40
|
-
? def.defaultValue()
|
|
41
|
-
: def.defaultValue
|
|
42
|
-
|
|
43
|
-
// Assign the type
|
|
44
|
-
let type: 'string' | 'number' | 'boolean' = 'string'
|
|
45
|
-
const typeName = def.typeName === ZodDefault.name || def.typeName === ZodOptional.name
|
|
46
|
-
? def.innerType._def.typeName
|
|
47
|
-
: def.typeName
|
|
48
|
-
if (typeName === ZodBoolean.name) type = 'boolean'
|
|
49
|
-
if (typeName === ZodNumber.name || def.coerce) type = 'number'
|
|
50
|
-
if (typeName === ZodEnum.name) {
|
|
51
|
-
options.choices = Object.values(def.innerType.enum)
|
|
52
|
-
}
|
|
53
|
-
options.type = type
|
|
54
|
-
|
|
55
|
-
// Build argument path e.g. "db.host" or "producer.port"
|
|
56
|
-
const key = path.join('.')
|
|
57
|
-
out[key] = options
|
|
58
|
-
return out
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export const optionsFromZodSchema = (
|
|
62
|
-
schema: Record<string, ZodTypeAny>,
|
|
63
|
-
): Record<string, Options> => {
|
|
64
|
-
const opts: Record<string, Options> = {}
|
|
65
|
-
for (const [rootKey, zodType] of Object.entries(schema)) {
|
|
66
|
-
collectOptions(zodType, [rootKey], opts)
|
|
67
|
-
}
|
|
68
|
-
return opts
|
|
69
|
-
}
|