@xyo-network/chain-orchestration 1.16.22 → 1.16.24
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/ConfigContext.d.ts +8 -0
- package/dist/neutral/ConfigContext.d.ts.map +1 -0
- package/dist/neutral/index.d.ts +3 -3
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +688 -21
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/init/index.d.ts +9 -0
- package/dist/neutral/init/index.d.ts.map +1 -0
- package/dist/neutral/init/initBalanceSummaryMap.d.ts +5 -0
- package/dist/neutral/init/initBalanceSummaryMap.d.ts.map +1 -0
- package/dist/neutral/init/initBridgedModule.d.ts.map +1 -0
- package/dist/neutral/init/initChainStakeViewer.d.ts.map +1 -0
- package/dist/neutral/init/initProducerAccount.d.ts.map +1 -0
- package/dist/neutral/init/initSeedPhrase.d.ts +6 -0
- package/dist/neutral/init/initSeedPhrase.d.ts.map +1 -0
- package/dist/neutral/init/initServerNode.d.ts +16 -0
- package/dist/neutral/init/initServerNode.d.ts.map +1 -0
- package/dist/neutral/init/initServerWallet.d.ts +3 -0
- package/dist/neutral/init/initServerWallet.d.ts.map +1 -0
- package/dist/neutral/init/initTransferSummaryMap.d.ts +5 -0
- package/dist/neutral/init/initTransferSummaryMap.d.ts.map +1 -0
- package/dist/neutral/manifest/getLocator.d.ts +14 -0
- package/dist/neutral/manifest/getLocator.d.ts.map +1 -0
- package/dist/neutral/manifest/index.d.ts +6 -0
- package/dist/neutral/manifest/index.d.ts.map +1 -0
- package/dist/neutral/manifest/loadNode.d.ts +14 -0
- package/dist/neutral/manifest/loadNode.d.ts.map +1 -0
- package/dist/neutral/manifest/nodeManifest.d.ts +6 -0
- package/dist/neutral/manifest/nodeManifest.d.ts.map +1 -0
- package/dist/neutral/manifest/private/index.d.ts +5 -0
- package/dist/neutral/manifest/private/index.d.ts.map +1 -0
- package/dist/neutral/manifest/public/WithMempool/index.d.ts +6 -0
- package/dist/neutral/manifest/public/WithMempool/index.d.ts.map +1 -0
- package/dist/neutral/manifest/public/WithoutMempool/index.d.ts +6 -0
- package/dist/neutral/manifest/public/WithoutMempool/index.d.ts.map +1 -0
- package/dist/neutral/manifest/public/index.d.ts +3 -0
- package/dist/neutral/manifest/public/index.d.ts.map +1 -0
- package/package.json +24 -7
- package/src/ConfigContext.ts +9 -0
- package/src/index.ts +3 -3
- package/src/init/index.ts +8 -0
- package/src/init/initBalanceSummaryMap.ts +33 -0
- package/src/{initChainStakeViewer.ts → init/initChainStakeViewer.ts} +6 -3
- package/src/init/initSeedPhrase.ts +29 -0
- package/src/init/initServerNode.ts +45 -0
- package/src/init/initServerWallet.ts +17 -0
- package/src/init/initTransferSummaryMap.ts +33 -0
- package/src/manifest/getLocator.ts +101 -0
- package/src/manifest/index.ts +5 -0
- package/src/manifest/loadNode.ts +37 -0
- package/src/manifest/node.json +17 -0
- package/src/manifest/nodeManifest.ts +8 -0
- package/src/manifest/private/index.ts +4 -0
- package/src/manifest/public/WithMempool/Chain.json +175 -0
- package/src/manifest/public/WithMempool/Pending.json +35 -0
- package/src/manifest/public/WithMempool/index.ts +20 -0
- package/src/manifest/public/WithoutMempool/Chain.json +97 -0
- package/src/manifest/public/WithoutMempool/Pending.json +35 -0
- package/src/manifest/public/WithoutMempool/index.ts +20 -0
- package/src/manifest/public/index.ts +2 -0
- package/dist/neutral/initBridgedModule.d.ts.map +0 -1
- package/dist/neutral/initChainStakeViewer.d.ts.map +0 -1
- package/dist/neutral/initProducerAccount.d.ts.map +0 -1
- /package/dist/neutral/{initBridgedModule.d.ts → init/initBridgedModule.d.ts} +0 -0
- /package/dist/neutral/{initChainStakeViewer.d.ts → init/initChainStakeViewer.d.ts} +0 -0
- /package/dist/neutral/{initProducerAccount.d.ts → init/initProducerAccount.d.ts} +0 -0
- /package/src/{initBridgedModule.ts → init/initBridgedModule.ts} +0 -0
- /package/src/{initProducerAccount.ts → init/initProducerAccount.ts} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
asAddress,
|
|
3
|
+
assertEx, type Logger, toAddress, toEthAddress,
|
|
3
4
|
} from '@xylabs/sdk-js'
|
|
4
5
|
import { EthereumChainStakeEvents, EthereumChainStakeViewer } from '@xyo-network/chain-sdk'
|
|
5
6
|
import { StakedXyoChainV2__factory } from '@xyo-network/typechain'
|
|
@@ -8,7 +9,7 @@ import {
|
|
|
8
9
|
type Config, SimpleChainStakeViewer, type StakeViewer,
|
|
9
10
|
} from '@xyo-network/xl1-protocol-sdk'
|
|
10
11
|
|
|
11
|
-
import { canUseEvmProvider, initEvmProvider } from '
|
|
12
|
+
import { canUseEvmProvider, initEvmProvider } from '../evm/index.ts'
|
|
12
13
|
|
|
13
14
|
export async function initEvmChainStakeViewer(config: Config, logger?: Logger): Promise<StakeViewer> {
|
|
14
15
|
const provider = await initEvmProvider({ config, logger })
|
|
@@ -24,7 +25,9 @@ export async function initEvmChainStakeViewer(config: Config, logger?: Logger):
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export async function initSimpleStakeViewer(config: Config, logger?: Logger): Promise<StakeViewer> {
|
|
27
|
-
const stakeChainViewer = await SimpleChainStakeViewer.create({
|
|
28
|
+
const stakeChainViewer = await SimpleChainStakeViewer.create({
|
|
29
|
+
chainId: asAddress(toAddress(1n), true), logger, positions: [],
|
|
30
|
+
})
|
|
28
31
|
assertEx(await stakeChainViewer.start(), () => 'Failed to start SimpleChainStake viewer')
|
|
29
32
|
return stakeChainViewer
|
|
30
33
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { assertEx, isString } from '@xylabs/sdk-js'
|
|
2
|
+
import type { BiosExternalInterface } from '@xyo-network/bios-model'
|
|
3
|
+
import { HDWallet } from '@xyo-network/wallet'
|
|
4
|
+
|
|
5
|
+
import type { ConfigContext } from '../ConfigContext.ts'
|
|
6
|
+
|
|
7
|
+
// TODO: Make nodejs version of bios support round tripping mnemonic between boots
|
|
8
|
+
export async function initSeedPhrase({
|
|
9
|
+
config, logger, bios,
|
|
10
|
+
}: ConfigContext<{ bios: BiosExternalInterface }>): Promise<string> {
|
|
11
|
+
const storedSeedPhrase = await bios.seedPhraseStore.get('os')
|
|
12
|
+
logger?.debug(`[API] Stored mnemonic: ${storedSeedPhrase}`)
|
|
13
|
+
const { mnemonic } = config.api
|
|
14
|
+
if (isString(storedSeedPhrase) && isString(mnemonic)) {
|
|
15
|
+
logger?.warn('[API] Stored mnemonic does not match supplied. Updating stored mnemonic to supplied.')
|
|
16
|
+
await bios.seedPhraseStore.set('os', mnemonic)
|
|
17
|
+
} else {
|
|
18
|
+
let seedPhrase: string
|
|
19
|
+
if (isString(mnemonic)) {
|
|
20
|
+
seedPhrase = mnemonic
|
|
21
|
+
} else {
|
|
22
|
+
seedPhrase = HDWallet.generateMnemonic()
|
|
23
|
+
logger?.log('[API] No mnemonic provided, using random mnemonic. This is not recommended for production use.')
|
|
24
|
+
logger?.log(`[API] Mnemonic: ${seedPhrase}`)
|
|
25
|
+
}
|
|
26
|
+
await bios.seedPhraseStore.set('os', seedPhrase)
|
|
27
|
+
}
|
|
28
|
+
return assertEx(await bios.seedPhraseStore.get('os'), () => 'Unable to acquire mnemonic from bios')
|
|
29
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { assertEx } from '@xylabs/sdk-js'
|
|
2
|
+
import { asArchivistInstance } from '@xyo-network/archivist-model'
|
|
3
|
+
import type { NodeInstance } from '@xyo-network/node-model'
|
|
4
|
+
import type { WithStorageMeta } from '@xyo-network/payload-model'
|
|
5
|
+
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
6
|
+
import type {
|
|
7
|
+
BalancesStepSummary, MapType, TransfersStepSummary,
|
|
8
|
+
} from '@xyo-network/xl1-protocol-sdk'
|
|
9
|
+
|
|
10
|
+
import type { ConfigContext } from '../ConfigContext.ts'
|
|
11
|
+
import { loadNode } from '../manifest/index.ts'
|
|
12
|
+
|
|
13
|
+
async function chainArchivistFromNode(node: NodeInstance) {
|
|
14
|
+
const chainArchivist = assertEx(asArchivistInstance(
|
|
15
|
+
await node.resolve('Chain:Validated'),
|
|
16
|
+
{ required: true },
|
|
17
|
+
), () => 'FinalizedArchivist not found in node')
|
|
18
|
+
return chainArchivist
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function pendingArchivistFromNode(node: NodeInstance) {
|
|
22
|
+
const pendingArchivist = assertEx(asArchivistInstance(
|
|
23
|
+
await node.resolve('XYOChain:Pending:PendingTransactions'),
|
|
24
|
+
{ required: true },
|
|
25
|
+
), () => 'PendingArchivist not found in node')
|
|
26
|
+
return pendingArchivist
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function initServerNode({
|
|
30
|
+
wallet, logger, config, node: providedNode, transferSummaryMap, balanceSummaryMap,
|
|
31
|
+
}: ConfigContext<{
|
|
32
|
+
balanceSummaryMap: MapType<string, WithStorageMeta<BalancesStepSummary>>
|
|
33
|
+
node?: NodeInstance
|
|
34
|
+
transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>
|
|
35
|
+
wallet: WalletInstance
|
|
36
|
+
}>) {
|
|
37
|
+
const node: NodeInstance = providedNode ?? await loadNode({
|
|
38
|
+
wallet, logger, config, transferSummaryMap, balanceSummaryMap,
|
|
39
|
+
})
|
|
40
|
+
const chainArchivist = await chainArchivistFromNode(node)
|
|
41
|
+
const pendingArchivist = await pendingArchivistFromNode(node)
|
|
42
|
+
return {
|
|
43
|
+
node, chainArchivist, pendingArchivist,
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { isDefined } from '@xylabs/sdk-js'
|
|
2
|
+
import { boot } from '@xyo-network/bios'
|
|
3
|
+
import { HDWallet } from '@xyo-network/wallet'
|
|
4
|
+
|
|
5
|
+
import type { ConfigContext } from '../ConfigContext.ts'
|
|
6
|
+
import { initSeedPhrase } from './initSeedPhrase.ts'
|
|
7
|
+
|
|
8
|
+
export async function initServerWallet({ config, logger }: ConfigContext) {
|
|
9
|
+
const { mnemonic } = config.api
|
|
10
|
+
const bios = await boot()
|
|
11
|
+
const seedPhrase = isDefined(mnemonic)
|
|
12
|
+
? mnemonic
|
|
13
|
+
: await initSeedPhrase({
|
|
14
|
+
bios, config, logger,
|
|
15
|
+
})
|
|
16
|
+
return await HDWallet.fromPhrase(seedPhrase)
|
|
17
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BaseMongoSdk, type BaseMongoSdkPrivateConfig } from '@xylabs/mongo'
|
|
2
|
+
import type { Hash } from '@xylabs/sdk-js'
|
|
3
|
+
import { assertEx } from '@xylabs/sdk-js'
|
|
4
|
+
import { MongoMap } from '@xyo-network/chain-protocol'
|
|
5
|
+
import type { WithStorageMeta } from '@xyo-network/payload-model'
|
|
6
|
+
import type { MapType, TransfersStepSummary } from '@xyo-network/xl1-protocol-sdk'
|
|
7
|
+
import { hasMongoConfig, MemoryMap } from '@xyo-network/xl1-protocol-sdk'
|
|
8
|
+
|
|
9
|
+
import type { ConfigContext } from '../ConfigContext.ts'
|
|
10
|
+
|
|
11
|
+
export async function initTransferSummaryMap({ config, logger }: ConfigContext): Promise<MapType<string, WithStorageMeta<TransfersStepSummary>>> {
|
|
12
|
+
const mongoConfig = config.storage?.mongo
|
|
13
|
+
if (hasMongoConfig(mongoConfig)) {
|
|
14
|
+
// Create the MongoDB SDK from the configuration
|
|
15
|
+
const {
|
|
16
|
+
connectionString: dbConnectionString, database: dbName, domain: dbDomain, password: dbPassword, username: dbUserName,
|
|
17
|
+
} = mongoConfig
|
|
18
|
+
const payloadSdkConfig: BaseMongoSdkPrivateConfig = {
|
|
19
|
+
dbConnectionString, dbDomain, dbName, dbPassword, dbUserName,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const sdkTransferSummaryMap = new BaseMongoSdk<WithStorageMeta<TransfersStepSummary>>({ ...payloadSdkConfig, collection: 'transfer_summary_map' })
|
|
23
|
+
const result = await MongoMap.create<MongoMap<Hash, WithStorageMeta<TransfersStepSummary>>>({
|
|
24
|
+
sdk: sdkTransferSummaryMap,
|
|
25
|
+
getCache: { enabled: true, maxEntries: 5000 },
|
|
26
|
+
})
|
|
27
|
+
assertEx(await result.start(), () => 'Failed to start transfer summary map')
|
|
28
|
+
return result
|
|
29
|
+
} else {
|
|
30
|
+
logger?.warn('[API] Mongo configuration not found. Using MemoryMap for TransferSummaryMap.')
|
|
31
|
+
return new MemoryMap<string, WithStorageMeta<TransfersStepSummary>>()
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { type BaseMongoSdkPrivateConfig } from '@xylabs/mongo'
|
|
2
|
+
import {
|
|
3
|
+
asAddress, assertEx, isDefined,
|
|
4
|
+
ZERO_ADDRESS,
|
|
5
|
+
} from '@xylabs/sdk-js'
|
|
6
|
+
import { MemoryArchivist } from '@xyo-network/archivist-memory'
|
|
7
|
+
import { MongoDBArchivistV2 } from '@xyo-network/archivist-mongodb'
|
|
8
|
+
import { ViewArchivist } from '@xyo-network/archivist-view'
|
|
9
|
+
import {
|
|
10
|
+
AddressBalanceDivinerV2, AddressTransferDiviner, ArchivistSyncDiviner, HeadValidationDiviner,
|
|
11
|
+
} from '@xyo-network/chain-modules'
|
|
12
|
+
import { initTelemetry } from '@xyo-network/chain-telemetry'
|
|
13
|
+
import { AbstractModule, LoggerModuleStatusReporter } from '@xyo-network/module-abstract'
|
|
14
|
+
import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
|
|
15
|
+
import type { MongoDBModuleParamsV2 } from '@xyo-network/module-model-mongodb'
|
|
16
|
+
import type { WithStorageMeta } from '@xyo-network/payload-model'
|
|
17
|
+
import { MemorySentinel } from '@xyo-network/sentinel-memory'
|
|
18
|
+
import { StepSizes } from '@xyo-network/xl1-protocol'
|
|
19
|
+
import type {
|
|
20
|
+
BalancesStepSummary, MapType, TransfersStepSummary,
|
|
21
|
+
} from '@xyo-network/xl1-protocol-sdk'
|
|
22
|
+
import { hasMongoConfig } from '@xyo-network/xl1-protocol-sdk'
|
|
23
|
+
import { Semaphore } from 'async-mutex'
|
|
24
|
+
|
|
25
|
+
import type { ConfigContext } from '../ConfigContext.ts'
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Used for retrieving a locator with the necessary modules registered for testing
|
|
29
|
+
* operation of the node (entirely in memory)
|
|
30
|
+
* @returns A locator with the necessary modules registered
|
|
31
|
+
*/
|
|
32
|
+
export const getLocator = async ({
|
|
33
|
+
config, logger, balanceSummaryMap, transferSummaryMap,
|
|
34
|
+
}: ConfigContext<{
|
|
35
|
+
balanceSummaryMap: MapType<string, WithStorageMeta<BalancesStepSummary>>
|
|
36
|
+
transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>
|
|
37
|
+
}>) => {
|
|
38
|
+
const { otlpEndpoint } = config.telemetry?.otel ?? {}
|
|
39
|
+
const { path: endpoint = '/metrics', port: port = 9465 } = config.telemetry?.metrics?.scrape ?? {}
|
|
40
|
+
const { traceProvider, meterProvider } = await initTelemetry({
|
|
41
|
+
attributes: {
|
|
42
|
+
serviceName: 'xl1-api',
|
|
43
|
+
serviceVersion: '1.0.0',
|
|
44
|
+
},
|
|
45
|
+
otlpEndpoint,
|
|
46
|
+
metricsConfig: { endpoint, port },
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
if (isDefined(logger)) AbstractModule.defaultLogger = logger
|
|
50
|
+
const statusReporter = logger ? new LoggerModuleStatusReporter(logger) : undefined
|
|
51
|
+
|
|
52
|
+
const locator = new ModuleFactoryLocator()
|
|
53
|
+
// If there's a MongoDB configuration
|
|
54
|
+
const mongoConfig = config.storage?.mongo
|
|
55
|
+
if (hasMongoConfig(mongoConfig)) {
|
|
56
|
+
// Create the MongoDB SDK from the configuration
|
|
57
|
+
const {
|
|
58
|
+
connectionString: dbConnectionString, database: dbName, domain: dbDomain, password: dbPassword, username: dbUserName,
|
|
59
|
+
} = mongoConfig
|
|
60
|
+
const payloadSdkConfig: BaseMongoSdkPrivateConfig = {
|
|
61
|
+
dbConnectionString, dbDomain, dbName, dbPassword, dbUserName,
|
|
62
|
+
}
|
|
63
|
+
const params: Partial<MongoDBModuleParamsV2> = {
|
|
64
|
+
meterProvider, payloadSdkConfig, statusReporter, traceProvider,
|
|
65
|
+
}
|
|
66
|
+
// Register the MongoDB Archivist as the default
|
|
67
|
+
locator.register(MongoDBArchivistV2.factory(params), undefined, true)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
locator.register(AddressBalanceDivinerV2.factory<AddressBalanceDivinerV2>({
|
|
71
|
+
traceProvider, meterProvider, statusReporter, summaryMap: balanceSummaryMap, stepSemaphores: StepSizes.map(() => new Semaphore(20)),
|
|
72
|
+
}))
|
|
73
|
+
|
|
74
|
+
locator.register(AddressTransferDiviner.factory<AddressTransferDiviner>({
|
|
75
|
+
traceProvider, meterProvider, statusReporter, summaryMap: transferSummaryMap, stepSemaphores: StepSizes.map(() => new Semaphore(20)),
|
|
76
|
+
}))
|
|
77
|
+
|
|
78
|
+
const chainId = isDefined(config.chain.id)
|
|
79
|
+
? assertEx(asAddress(config.chain.id), () => 'chain.id must be an Address')
|
|
80
|
+
: ZERO_ADDRESS
|
|
81
|
+
locator.register(HeadValidationDiviner.factory<HeadValidationDiviner>({
|
|
82
|
+
traceProvider,
|
|
83
|
+
meterProvider,
|
|
84
|
+
statusReporter,
|
|
85
|
+
chainId,
|
|
86
|
+
allowedProducers: config.producer.allowlist,
|
|
87
|
+
}))
|
|
88
|
+
locator.register(MemoryArchivist.factory({
|
|
89
|
+
traceProvider, meterProvider, statusReporter,
|
|
90
|
+
}))
|
|
91
|
+
locator.register(MemorySentinel.factory({
|
|
92
|
+
traceProvider, meterProvider, statusReporter,
|
|
93
|
+
}))
|
|
94
|
+
locator.register(ViewArchivist.factory({
|
|
95
|
+
traceProvider, meterProvider, statusReporter,
|
|
96
|
+
}))
|
|
97
|
+
locator.register(ArchivistSyncDiviner.factory({
|
|
98
|
+
traceProvider, meterProvider, statusReporter,
|
|
99
|
+
}))
|
|
100
|
+
return locator
|
|
101
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ManifestWrapper } from '@xyo-network/manifest-wrapper'
|
|
2
|
+
import type { WithStorageMeta } from '@xyo-network/payload-model'
|
|
3
|
+
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
4
|
+
import type {
|
|
5
|
+
BalancesStepSummary, MapType, TransfersStepSummary,
|
|
6
|
+
} from '@xyo-network/xl1-protocol-sdk'
|
|
7
|
+
|
|
8
|
+
import type { ConfigContext } from '../ConfigContext.ts'
|
|
9
|
+
import { getLocator } from './getLocator.ts'
|
|
10
|
+
import { NodeManifest } from './nodeManifest.ts'
|
|
11
|
+
import { PrivateChildManifests } from './private/index.ts'
|
|
12
|
+
import { PublicChildManifestsWithMempool, PublicChildManifestsWithoutMempool } from './public/index.ts'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Creates a node with the xyo-chain modules registered
|
|
16
|
+
* @returns A node with the xyo-chain modules registered
|
|
17
|
+
*/
|
|
18
|
+
export const loadNode = async ({
|
|
19
|
+
wallet, config, balanceSummaryMap, transferSummaryMap,
|
|
20
|
+
}: ConfigContext<{
|
|
21
|
+
balanceSummaryMap: MapType<string, WithStorageMeta<BalancesStepSummary>>
|
|
22
|
+
transferSummaryMap: MapType<string, WithStorageMeta<TransfersStepSummary>>
|
|
23
|
+
wallet: WalletInstance
|
|
24
|
+
}>) => {
|
|
25
|
+
const { enabled: mempoolEnabled } = config.mempool
|
|
26
|
+
const PublicChildManifests = mempoolEnabled ? PublicChildManifestsWithoutMempool : PublicChildManifestsWithMempool
|
|
27
|
+
const locator = await getLocator({
|
|
28
|
+
config, balanceSummaryMap, transferSummaryMap,
|
|
29
|
+
})
|
|
30
|
+
const wrapper = new ManifestWrapper(NodeManifest, wallet, locator, PublicChildManifests, PrivateChildManifests)
|
|
31
|
+
const [node, ...childNodes] = await wrapper.loadNodes()
|
|
32
|
+
if (childNodes?.length > 0) {
|
|
33
|
+
await Promise.all(childNodes.map(childNode => node.register(childNode)))
|
|
34
|
+
await Promise.all(childNodes.map(childNode => node.attach(childNode.address, true)))
|
|
35
|
+
}
|
|
36
|
+
return node
|
|
37
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json",
|
|
3
|
+
"nodes": [
|
|
4
|
+
{
|
|
5
|
+
"config": {
|
|
6
|
+
"accountPath": "44'/60'/1",
|
|
7
|
+
"name": "XYOChain",
|
|
8
|
+
"schema": "network.xyo.node.config"
|
|
9
|
+
},
|
|
10
|
+
"modules": {
|
|
11
|
+
"private": [],
|
|
12
|
+
"public": []
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"schema": "network.xyo.manifest"
|
|
17
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json",
|
|
3
|
+
"nodes": [
|
|
4
|
+
{
|
|
5
|
+
"config": {
|
|
6
|
+
"accountPath": "1",
|
|
7
|
+
"name": "Chain",
|
|
8
|
+
"schema": "network.xyo.node.config"
|
|
9
|
+
},
|
|
10
|
+
"modules": {
|
|
11
|
+
"private": [
|
|
12
|
+
{
|
|
13
|
+
"config": {
|
|
14
|
+
"accountPath": "1/1'/1'",
|
|
15
|
+
"name": "Validated",
|
|
16
|
+
"getCache": {
|
|
17
|
+
"enabled": true,
|
|
18
|
+
"maxEntries": 5000
|
|
19
|
+
},
|
|
20
|
+
"payloadSdkConfig": {
|
|
21
|
+
"collection": "chain_validated"
|
|
22
|
+
},
|
|
23
|
+
"schema": "network.xyo.archivist.config"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"config": {
|
|
28
|
+
"accountPath": "1/1'/2'",
|
|
29
|
+
"schema": "network.xyo.diviner.chain.head.validation.config",
|
|
30
|
+
"eventSubscriptions": [
|
|
31
|
+
{
|
|
32
|
+
"sourceEvent": "inserted",
|
|
33
|
+
"sourceModule": "Submissions",
|
|
34
|
+
"targetModuleFunction": "divine"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"inArchivist": "Submissions",
|
|
38
|
+
"outArchivist": "Validated",
|
|
39
|
+
"name": "HeadValidationDiviner"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"config": {
|
|
44
|
+
"accountPath": "1/1'/3'",
|
|
45
|
+
"automations": [
|
|
46
|
+
{
|
|
47
|
+
"frequency": 1000,
|
|
48
|
+
"frequencyUnits": "millis",
|
|
49
|
+
"schema": "network.xyo.automation.interval",
|
|
50
|
+
"type": "interval"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"name": "ChainValidationSentinel",
|
|
54
|
+
"schema": "network.xyo.sentinel.config",
|
|
55
|
+
"synchronous": true,
|
|
56
|
+
"tasks": [
|
|
57
|
+
{
|
|
58
|
+
"mod": "HeadValidationDiviner",
|
|
59
|
+
"endPoint": "divine"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"config": {
|
|
66
|
+
"accountPath": "1/1'/4'",
|
|
67
|
+
"automations": [
|
|
68
|
+
{
|
|
69
|
+
"frequency": 10000,
|
|
70
|
+
"frequencyUnits": "millis",
|
|
71
|
+
"schema": "network.xyo.automation.interval",
|
|
72
|
+
"type": "interval"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"name": "AddressBalancePollingSentinel",
|
|
76
|
+
"schema": "network.xyo.sentinel.config",
|
|
77
|
+
"synchronous": true,
|
|
78
|
+
"tasks": [
|
|
79
|
+
{
|
|
80
|
+
"mod": "AddressBalanceDiviner",
|
|
81
|
+
"endPoint": "divine"
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"config": {
|
|
88
|
+
"accountPath": "1/1'/5'",
|
|
89
|
+
"automations": [
|
|
90
|
+
{
|
|
91
|
+
"frequency": 10000,
|
|
92
|
+
"frequencyUnits": "millis",
|
|
93
|
+
"schema": "network.xyo.automation.interval",
|
|
94
|
+
"type": "interval"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"name": "AddressTransferPollingSentinel",
|
|
98
|
+
"schema": "network.xyo.sentinel.config",
|
|
99
|
+
"synchronous": true,
|
|
100
|
+
"tasks": [
|
|
101
|
+
{
|
|
102
|
+
"mod": "AddressTransferDiviner",
|
|
103
|
+
"endPoint": "divine"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"public": [
|
|
110
|
+
{
|
|
111
|
+
"config": {
|
|
112
|
+
"accountPath": "1/1/1",
|
|
113
|
+
"name": "Submissions",
|
|
114
|
+
"getCache": {
|
|
115
|
+
"enabled": true,
|
|
116
|
+
"maxEntries": 5000
|
|
117
|
+
},
|
|
118
|
+
"payloadSdkConfig": {
|
|
119
|
+
"collection": "chain_submissions"
|
|
120
|
+
},
|
|
121
|
+
"schema": "network.xyo.archivist.config"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"config": {
|
|
126
|
+
"accountPath": "1/1/2",
|
|
127
|
+
"name": "Finalized",
|
|
128
|
+
"allowedQueries": [
|
|
129
|
+
"network.xyo.query.archivist.get",
|
|
130
|
+
"network.xyo.query.archivist.next"
|
|
131
|
+
],
|
|
132
|
+
"getCache": {
|
|
133
|
+
"enabled": true,
|
|
134
|
+
"maxEntries": 50000
|
|
135
|
+
},
|
|
136
|
+
"originArchivist": "Validated",
|
|
137
|
+
"schema": "network.xyo.archivist.view.config"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"config": {
|
|
142
|
+
"accountPath": "1/1/3'",
|
|
143
|
+
"name": "AddressBalanceDiviner",
|
|
144
|
+
"schema": "network.xyo.diviner.chain.address.balance.config",
|
|
145
|
+
"map": {
|
|
146
|
+
"lmdb": {
|
|
147
|
+
"dbName": "summaries",
|
|
148
|
+
"storeName": "address_balance",
|
|
149
|
+
"location": ".store"
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"archivist": "Validated"
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"config": {
|
|
157
|
+
"accountPath": "1/1/4'",
|
|
158
|
+
"name": "AddressTransferDiviner",
|
|
159
|
+
"schema": "network.xyo.diviner.chain.address.transfer.config",
|
|
160
|
+
"map": {
|
|
161
|
+
"lmdb": {
|
|
162
|
+
"dbName": "summaries",
|
|
163
|
+
"storeName": "address_transfer",
|
|
164
|
+
"location": ".store"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"archivist": "Validated"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
"schema": "network.xyo.manifest"
|
|
175
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json",
|
|
3
|
+
"nodes": [
|
|
4
|
+
{
|
|
5
|
+
"config": {
|
|
6
|
+
"accountPath": "2",
|
|
7
|
+
"name": "Pending",
|
|
8
|
+
"schema": "network.xyo.node.config"
|
|
9
|
+
},
|
|
10
|
+
"modules": {
|
|
11
|
+
"private": [],
|
|
12
|
+
"public": [
|
|
13
|
+
{
|
|
14
|
+
"config": {
|
|
15
|
+
"accountPath": "2/1/1",
|
|
16
|
+
"name": "PendingTransactions",
|
|
17
|
+
"getCache": {
|
|
18
|
+
"enabled": true,
|
|
19
|
+
"maxEntries": 5000
|
|
20
|
+
},
|
|
21
|
+
"labels": {
|
|
22
|
+
"network.xyo.storage.class": "mongodb"
|
|
23
|
+
},
|
|
24
|
+
"payloadSdkConfig": {
|
|
25
|
+
"collection": "pending_bundles"
|
|
26
|
+
},
|
|
27
|
+
"schema": "network.xyo.archivist.config"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"schema": "network.xyo.manifest"
|
|
35
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ModuleManifest, PackageManifestPayload } from '@xyo-network/manifest-model'
|
|
2
|
+
|
|
3
|
+
import Chain from './Chain.json' with { type: 'json' }
|
|
4
|
+
import Pending from './Pending.json' with { type: 'json' }
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Chain Node Manifest
|
|
8
|
+
*/
|
|
9
|
+
const ChainNodeManifest = Chain as PackageManifestPayload
|
|
10
|
+
/**
|
|
11
|
+
* Pending Node Manifest
|
|
12
|
+
*/
|
|
13
|
+
const PendingNodeManifest = Pending as PackageManifestPayload
|
|
14
|
+
/**
|
|
15
|
+
* Public Child Manifests
|
|
16
|
+
*/
|
|
17
|
+
export const PublicChildManifestsWithMempool: ModuleManifest[] = [
|
|
18
|
+
...ChainNodeManifest.nodes,
|
|
19
|
+
...PendingNodeManifest.nodes,
|
|
20
|
+
]
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json",
|
|
3
|
+
"nodes": [
|
|
4
|
+
{
|
|
5
|
+
"config": {
|
|
6
|
+
"accountPath": "1",
|
|
7
|
+
"name": "Chain",
|
|
8
|
+
"schema": "network.xyo.node.config"
|
|
9
|
+
},
|
|
10
|
+
"modules": {
|
|
11
|
+
"private": [
|
|
12
|
+
{
|
|
13
|
+
"config": {
|
|
14
|
+
"accountPath": "1/1'/1'",
|
|
15
|
+
"name": "Validated",
|
|
16
|
+
"allowedQueries": [
|
|
17
|
+
"network.xyo.query.archivist.get",
|
|
18
|
+
"network.xyo.query.archivist.next"
|
|
19
|
+
],
|
|
20
|
+
"getCache": {
|
|
21
|
+
"enabled": true,
|
|
22
|
+
"maxEntries": 5000
|
|
23
|
+
},
|
|
24
|
+
"payloadSdkConfig": {
|
|
25
|
+
"collection": "chain_validated"
|
|
26
|
+
},
|
|
27
|
+
"schema": "network.xyo.archivist.config"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"public": [
|
|
32
|
+
{
|
|
33
|
+
"config": {
|
|
34
|
+
"accountPath": "1/1/1",
|
|
35
|
+
"name": "Submissions",
|
|
36
|
+
"getCache": {
|
|
37
|
+
"enabled": true,
|
|
38
|
+
"maxEntries": 5000
|
|
39
|
+
},
|
|
40
|
+
"payloadSdkConfig": {
|
|
41
|
+
"collection": "chain_submissions"
|
|
42
|
+
},
|
|
43
|
+
"schema": "network.xyo.archivist.config"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"config": {
|
|
48
|
+
"accountPath": "1/1/2",
|
|
49
|
+
"name": "Finalized",
|
|
50
|
+
"allowedQueries": [
|
|
51
|
+
"network.xyo.query.archivist.get",
|
|
52
|
+
"network.xyo.query.archivist.next"
|
|
53
|
+
],
|
|
54
|
+
"getCache": {
|
|
55
|
+
"enabled": true,
|
|
56
|
+
"maxEntries": 50000
|
|
57
|
+
},
|
|
58
|
+
"originArchivist": "Validated",
|
|
59
|
+
"schema": "network.xyo.archivist.view.config"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"config": {
|
|
64
|
+
"accountPath": "1/1/3'",
|
|
65
|
+
"name": "AddressBalanceDiviner",
|
|
66
|
+
"schema": "network.xyo.diviner.chain.address.balance.config",
|
|
67
|
+
"map": {
|
|
68
|
+
"lmdb": {
|
|
69
|
+
"dbName": "summaries",
|
|
70
|
+
"storeName": "address_balance",
|
|
71
|
+
"location": ".store"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"archivist": "Validated"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"config": {
|
|
79
|
+
"accountPath": "1/1/4'",
|
|
80
|
+
"name": "AddressTransferDiviner",
|
|
81
|
+
"schema": "network.xyo.diviner.chain.address.transfer.config",
|
|
82
|
+
"map": {
|
|
83
|
+
"lmdb": {
|
|
84
|
+
"dbName": "summaries",
|
|
85
|
+
"storeName": "address_transfer",
|
|
86
|
+
"location": ".store"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"archivist": "Validated"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"schema": "network.xyo.manifest"
|
|
97
|
+
}
|