@xyo-network/chain-orchestration 1.19.13 → 1.19.15
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 -0
- package/dist/neutral/ChainInitializableParams.d.ts.map +1 -1
- package/dist/neutral/actor/ValidatorActor.d.ts +2 -2
- package/dist/neutral/actor/ValidatorActor.d.ts.map +1 -1
- package/dist/neutral/archivists/ChainFinalized/archivist.d.ts.map +1 -1
- package/dist/neutral/archivists/ChainFinalized/local.d.ts +2 -2
- package/dist/neutral/archivists/ChainFinalized/local.d.ts.map +1 -1
- package/dist/neutral/archivists/PendingBlocks/archivist.d.ts +2 -2
- package/dist/neutral/archivists/PendingBlocks/archivist.d.ts.map +1 -1
- package/dist/neutral/archivists/PendingBlocks/local.d.ts +2 -4
- package/dist/neutral/archivists/PendingBlocks/local.d.ts.map +1 -1
- package/dist/neutral/archivists/RejectedTransactions/archivist.d.ts +2 -2
- package/dist/neutral/archivists/RejectedTransactions/archivist.d.ts.map +1 -1
- package/dist/neutral/archivists/RejectedTransactions/local.d.ts +1 -2
- package/dist/neutral/archivists/RejectedTransactions/local.d.ts.map +1 -1
- package/dist/neutral/archivists/StakeIntentState/archivist.d.ts +2 -3
- package/dist/neutral/archivists/StakeIntentState/archivist.d.ts.map +1 -1
- package/dist/neutral/archivists/StakeIntentState/local.d.ts +2 -3
- package/dist/neutral/archivists/StakeIntentState/local.d.ts.map +1 -1
- package/dist/neutral/config/actors/Api.d.ts +890 -0
- package/dist/neutral/config/actors/Api.d.ts.map +1 -0
- package/dist/neutral/config/actors/Bridge.d.ts +1213 -0
- package/dist/neutral/config/actors/Bridge.d.ts.map +1 -0
- package/dist/neutral/config/actors/Mempool.d.ts +890 -0
- package/dist/neutral/config/actors/Mempool.d.ts.map +1 -0
- package/dist/neutral/config/actors/Producer.d.ts +962 -0
- package/dist/neutral/config/actors/Producer.d.ts.map +1 -0
- package/dist/neutral/config/actors/RewardRedemption.d.ts +878 -0
- package/dist/neutral/config/actors/RewardRedemption.d.ts.map +1 -0
- package/dist/neutral/config/actors/index.d.ts +7 -0
- package/dist/neutral/config/actors/index.d.ts.map +1 -0
- package/dist/neutral/config/index.d.ts +5 -0
- package/dist/neutral/config/index.d.ts.map +1 -0
- package/dist/neutral/config/locators/actors/apiLocatorFromConfig.d.ts +5 -0
- package/dist/neutral/config/locators/actors/apiLocatorFromConfig.d.ts.map +1 -0
- package/dist/neutral/config/locators/actors/bridgeLocatorFromConfig.d.ts +5 -0
- package/dist/neutral/config/locators/actors/bridgeLocatorFromConfig.d.ts.map +1 -0
- package/dist/neutral/config/locators/actors/index.d.ts +7 -0
- package/dist/neutral/config/locators/actors/index.d.ts.map +1 -0
- package/dist/neutral/config/locators/actors/mempoolLocatorFromConfig.d.ts +5 -0
- package/dist/neutral/config/locators/actors/mempoolLocatorFromConfig.d.ts.map +1 -0
- package/dist/neutral/config/locators/actors/producerLocatorFromConfig.d.ts +4 -0
- package/dist/neutral/config/locators/actors/producerLocatorFromConfig.d.ts.map +1 -0
- package/dist/neutral/config/locators/actors/rewardRedemptionLocatorFromConfig.d.ts +5 -0
- package/dist/neutral/config/locators/actors/rewardRedemptionLocatorFromConfig.d.ts.map +1 -0
- package/dist/neutral/config/locators/actors/validatorLocatorFromConfig.d.ts +4 -0
- package/dist/neutral/config/locators/actors/validatorLocatorFromConfig.d.ts.map +1 -0
- package/dist/neutral/config/locators/contextFromConfigWithoutLocator.d.ts +4 -0
- package/dist/neutral/config/locators/contextFromConfigWithoutLocator.d.ts.map +1 -0
- package/dist/neutral/config/locators/index.d.ts +8 -0
- package/dist/neutral/config/locators/index.d.ts.map +1 -0
- package/dist/neutral/config/locators/localLocatorFromConfig.d.ts +3 -0
- package/dist/neutral/config/locators/localLocatorFromConfig.d.ts.map +1 -0
- package/dist/neutral/config/locators/locatorsFromConfig.d.ts +3 -0
- package/dist/neutral/config/locators/locatorsFromConfig.d.ts.map +1 -0
- package/dist/neutral/config/locators/remoteLocatorFromConfig.d.ts +3 -0
- package/dist/neutral/config/locators/remoteLocatorFromConfig.d.ts.map +1 -0
- package/dist/neutral/config/locators/rootLocatorFromConfig.d.ts +3 -0
- package/dist/neutral/config/locators/rootLocatorFromConfig.d.ts.map +1 -0
- package/dist/neutral/config/locators/telemetryContextFromConfig.d.ts +3 -0
- package/dist/neutral/config/locators/telemetryContextFromConfig.d.ts.map +1 -0
- package/dist/neutral/config/mergeConfig.d.ts +67 -0
- package/dist/neutral/config/mergeConfig.d.ts.map +1 -0
- package/dist/neutral/config/tryParseConfig.d.ts +133 -0
- package/dist/neutral/config/tryParseConfig.d.ts.map +1 -0
- package/dist/neutral/evm/initChainId.d.ts +3 -3
- package/dist/neutral/evm/initChainId.d.ts.map +1 -1
- package/dist/neutral/evm/initEvmProvider.d.ts +3 -9
- package/dist/neutral/evm/initEvmProvider.d.ts.map +1 -1
- package/dist/neutral/evm/initInfuraProvider.d.ts +4 -4
- package/dist/neutral/evm/initInfuraProvider.d.ts.map +1 -1
- package/dist/neutral/evm/initJsonRpcProvider.d.ts +4 -4
- package/dist/neutral/evm/initJsonRpcProvider.d.ts.map +1 -1
- package/dist/neutral/health/initHealthEndpoints.d.ts +4 -8
- package/dist/neutral/health/initHealthEndpoints.d.ts.map +1 -1
- package/dist/neutral/index.d.ts +1 -0
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +1019 -343
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/init/index.d.ts +2 -2
- package/dist/neutral/init/index.d.ts.map +1 -1
- package/dist/neutral/init/initActorAccount.d.ts +4 -0
- package/dist/neutral/init/initActorAccount.d.ts.map +1 -0
- package/dist/neutral/init/initActorSeedPhrase.d.ts +4 -0
- package/dist/neutral/init/initActorSeedPhrase.d.ts.map +1 -0
- package/dist/neutral/init/initBalanceSummaryMap.d.ts +2 -3
- package/dist/neutral/init/initBalanceSummaryMap.d.ts.map +1 -1
- package/dist/neutral/init/initBridgedModule.d.ts +4 -7
- package/dist/neutral/init/initBridgedModule.d.ts.map +1 -1
- package/dist/neutral/init/initEvmProvidersIfAvailable.d.ts.map +1 -1
- package/dist/neutral/init/initFinalizationArchivistIfNeeded.d.ts +2 -2
- package/dist/neutral/init/initFinalizationArchivistIfNeeded.d.ts.map +1 -1
- package/dist/neutral/init/initServerNode.d.ts +2 -9
- package/dist/neutral/init/initServerNode.d.ts.map +1 -1
- package/dist/neutral/init/initTransferSummaryMap.d.ts +2 -3
- package/dist/neutral/init/initTransferSummaryMap.d.ts.map +1 -1
- package/dist/neutral/init/initWallet.d.ts +2 -7
- package/dist/neutral/init/initWallet.d.ts.map +1 -1
- package/dist/neutral/manifest/getLocator.d.ts +2 -7
- package/dist/neutral/manifest/getLocator.d.ts.map +1 -1
- package/dist/neutral/manifest/loadNode.d.ts +2 -8
- package/dist/neutral/manifest/loadNode.d.ts.map +1 -1
- package/dist/neutral/orchestrator/Orchestrator.d.ts +4 -4
- package/dist/neutral/orchestrator/Orchestrator.d.ts.map +1 -1
- package/package.json +51 -31
- package/src/ChainInitializableParams.ts +1 -0
- package/src/actor/ValidatorActor.ts +3 -2
- package/src/archivists/ChainFinalized/archivist.ts +1 -1
- package/src/archivists/ChainFinalized/local.ts +2 -2
- package/src/archivists/PendingBlocks/archivist.ts +3 -3
- package/src/archivists/PendingBlocks/local.ts +2 -2
- package/src/archivists/RejectedTransactions/archivist.ts +5 -5
- package/src/archivists/RejectedTransactions/local.ts +1 -2
- package/src/archivists/StakeIntentState/archivist.ts +12 -15
- package/src/archivists/StakeIntentState/local.ts +2 -4
- package/src/config/actors/Api.ts +29 -0
- package/src/config/actors/Bridge.ts +133 -0
- package/src/config/actors/Mempool.ts +39 -0
- package/src/config/actors/Producer.ts +56 -0
- package/src/config/actors/RewardRedemption.ts +21 -0
- package/src/config/actors/index.ts +6 -0
- package/src/config/index.ts +4 -0
- package/src/config/locators/actors/apiLocatorFromConfig.ts +25 -0
- package/src/config/locators/actors/bridgeLocatorFromConfig.ts +71 -0
- package/src/config/locators/actors/index.ts +6 -0
- package/src/config/locators/actors/mempoolLocatorFromConfig.ts +21 -0
- package/src/config/locators/actors/producerLocatorFromConfig.ts +66 -0
- package/src/config/locators/actors/rewardRedemptionLocatorFromConfig.ts +21 -0
- package/src/config/locators/actors/validatorLocatorFromConfig.ts +15 -0
- package/src/config/locators/contextFromConfigWithoutLocator.ts +25 -0
- package/src/config/locators/index.ts +7 -0
- package/src/config/locators/localLocatorFromConfig.ts +56 -0
- package/src/config/locators/locatorsFromConfig.ts +67 -0
- package/src/config/locators/remoteLocatorFromConfig.ts +48 -0
- package/src/config/locators/rootLocatorFromConfig.ts +47 -0
- package/src/config/locators/telemetryContextFromConfig.ts +15 -0
- package/src/config/mergeConfig.ts +11 -0
- package/src/config/tryParseConfig.ts +36 -0
- package/src/evm/initChainId.ts +3 -3
- package/src/evm/initEvmProvider.ts +8 -9
- package/src/evm/initInfuraProvider.ts +9 -7
- package/src/evm/initJsonRpcProvider.ts +9 -7
- package/src/health/initHealthEndpoints.ts +15 -18
- package/src/index.ts +1 -0
- package/src/init/index.ts +2 -2
- package/src/init/initActorAccount.ts +28 -0
- package/src/init/{initSeedPhrase.ts → initActorSeedPhrase.ts} +10 -10
- package/src/init/initBalanceSummaryMap.ts +4 -4
- package/src/init/initBridgedModule.ts +6 -8
- package/src/init/initEvmProvidersIfAvailable.ts +6 -5
- package/src/init/initFinalizationArchivistIfNeeded.ts +8 -5
- package/src/init/initServerNode.ts +7 -16
- package/src/init/initTransferSummaryMap.ts +4 -4
- package/src/init/initWallet.ts +33 -35
- package/src/manifest/getLocator.ts +4 -10
- package/src/manifest/loadNode.ts +6 -15
- package/src/orchestrator/Orchestrator.ts +4 -6
- package/dist/neutral/ConfigContext.d.ts +0 -8
- package/dist/neutral/ConfigContext.d.ts.map +0 -1
- package/dist/neutral/init/initProducerAccount.d.ts +0 -6
- package/dist/neutral/init/initProducerAccount.d.ts.map +0 -1
- package/dist/neutral/init/initSeedPhrase.d.ts +0 -6
- package/dist/neutral/init/initSeedPhrase.d.ts.map +0 -1
- package/src/ConfigContext.ts +0 -9
- package/src/init/initProducerAccount.ts +0 -30
package/src/init/initWallet.ts
CHANGED
|
@@ -1,46 +1,44 @@
|
|
|
1
1
|
import { isDefined } from '@xylabs/sdk-js'
|
|
2
2
|
import { boot } from '@xyo-network/bios'
|
|
3
3
|
import { HDWallet } from '@xyo-network/wallet'
|
|
4
|
+
import type { ActorConfigContext } from '@xyo-network/xl1-sdk'
|
|
4
5
|
|
|
5
|
-
import
|
|
6
|
-
import { initSeedPhrase } from './initSeedPhrase.ts'
|
|
6
|
+
import { initActorSeedPhrase } from './initActorSeedPhrase.ts'
|
|
7
7
|
|
|
8
|
-
async function
|
|
8
|
+
export async function initActorWallet(context: ActorConfigContext, mnemonic?: string) {
|
|
9
9
|
const bios = await boot()
|
|
10
10
|
const seedPhrase = isDefined(mnemonic)
|
|
11
11
|
? mnemonic
|
|
12
|
-
: await
|
|
13
|
-
bios, config, logger,
|
|
14
|
-
})
|
|
12
|
+
: await initActorSeedPhrase(context, bios)
|
|
15
13
|
return await HDWallet.fromPhrase(seedPhrase)
|
|
16
14
|
}
|
|
17
15
|
|
|
18
|
-
export async function initApiWallet({ config, logger }: ConfigContext) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export async function initBridgeWallet({ config, logger }: ConfigContext) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export async function initMempoolWallet({ config, logger }: ConfigContext) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export async function initProducerWallet({ config, logger }: ConfigContext) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export async function initRewardsRedemptionApiWallet({ config, logger }: ConfigContext) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export async function initValidatorWallet({ config, logger }: ConfigContext) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
16
|
+
// export async function initApiWallet({ config, logger }: ConfigContext) {
|
|
17
|
+
// const { mnemonic } = config.actors.api
|
|
18
|
+
// return await initWallet({ config, logger }, mnemonic)
|
|
19
|
+
// }
|
|
20
|
+
|
|
21
|
+
// export async function initBridgeWallet({ config, logger }: ConfigContext) {
|
|
22
|
+
// const { mnemonic } = config.actors.bridge
|
|
23
|
+
// return await initWallet({ config, logger }, mnemonic)
|
|
24
|
+
// }
|
|
25
|
+
|
|
26
|
+
// export async function initMempoolWallet({ config, logger }: ConfigContext) {
|
|
27
|
+
// const { mnemonic } = config.actors.mempool
|
|
28
|
+
// return await initWallet({ config, logger }, mnemonic)
|
|
29
|
+
// }
|
|
30
|
+
|
|
31
|
+
// export async function initProducerWallet({ config, logger }: ConfigContext) {
|
|
32
|
+
// const { mnemonic } = config.actors.producer
|
|
33
|
+
// return await initWallet({ config, logger }, mnemonic)
|
|
34
|
+
// }
|
|
35
|
+
|
|
36
|
+
// export async function initRewardsRedemptionApiWallet({ config, logger }: ConfigContext) {
|
|
37
|
+
// const { mnemonic } = config.actors.rewardRedemption
|
|
38
|
+
// return await initWallet({ config, logger }, mnemonic)
|
|
39
|
+
// }
|
|
40
|
+
|
|
41
|
+
// export async function initValidatorWallet({ config, logger }: ConfigContext) {
|
|
42
|
+
// const { mnemonic } = config.actors.mempool
|
|
43
|
+
// return await initWallet({ config, logger }, mnemonic)
|
|
44
|
+
// }
|
|
@@ -7,24 +7,18 @@ import { initTelemetry } from '@xyo-network/chain-telemetry'
|
|
|
7
7
|
import { AbstractModule, LoggerModuleStatusReporter } from '@xyo-network/module-abstract'
|
|
8
8
|
import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
|
|
9
9
|
import type { MongoDBModuleParamsV2 } from '@xyo-network/module-model-mongodb'
|
|
10
|
-
import type { WithStorageMeta } from '@xyo-network/payload-model'
|
|
11
10
|
import { MemorySentinel } from '@xyo-network/sentinel-memory'
|
|
12
|
-
import type {
|
|
13
|
-
BalancesStepSummary, MapType, TransfersStepSummary,
|
|
14
|
-
} from '@xyo-network/xl1-sdk'
|
|
11
|
+
import type { BaseConfigContext } from '@xyo-network/xl1-sdk'
|
|
15
12
|
import { hasMongoConfig } from '@xyo-network/xl1-sdk'
|
|
16
13
|
|
|
17
|
-
import type { ConfigContext } from '../ConfigContext.ts'
|
|
18
|
-
|
|
19
14
|
/**
|
|
20
15
|
* Used for retrieving a locator with the necessary modules registered for testing
|
|
21
16
|
* operation of the node (entirely in memory)
|
|
22
17
|
* @returns A locator with the necessary modules registered
|
|
23
18
|
*/
|
|
24
|
-
export const getLocator = async (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}>) => {
|
|
19
|
+
export const getLocator = async (
|
|
20
|
+
{ logger, config }: BaseConfigContext,
|
|
21
|
+
) => {
|
|
28
22
|
const { otlpEndpoint } = config.telemetry?.otel ?? {}
|
|
29
23
|
const { path: endpoint = '/metrics', port: port = 9465 } = config.telemetry?.metrics?.scrape ?? {}
|
|
30
24
|
const { traceProvider, meterProvider } = await initTelemetry({
|
package/src/manifest/loadNode.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { ManifestWrapper } from '@xyo-network/manifest-wrapper'
|
|
2
|
-
import type { WithStorageMeta } from '@xyo-network/payload-model'
|
|
3
2
|
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
4
|
-
import type {
|
|
5
|
-
BalancesStepSummary, MapType, TransfersStepSummary,
|
|
6
|
-
} from '@xyo-network/xl1-sdk'
|
|
3
|
+
import type { BaseConfigContext } from '@xyo-network/xl1-sdk'
|
|
7
4
|
|
|
8
|
-
import type { ConfigContext } from '../ConfigContext.ts'
|
|
9
5
|
import { getLocator } from './getLocator.ts'
|
|
10
6
|
import { NodeManifest } from './nodeManifest.ts'
|
|
11
7
|
import { PrivateChildManifests } from './private/index.ts'
|
|
@@ -15,16 +11,11 @@ import { PublicChildManifests } from './public/index.ts'
|
|
|
15
11
|
* Creates a node with the xyo-chain modules registered
|
|
16
12
|
* @returns A node with the xyo-chain modules registered
|
|
17
13
|
*/
|
|
18
|
-
export const loadNode = async (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
wallet: WalletInstance
|
|
24
|
-
}>) => {
|
|
25
|
-
const locator = await getLocator({
|
|
26
|
-
config, balancesSummaryMap, transfersSummaryMap,
|
|
27
|
-
})
|
|
14
|
+
export const loadNode = async (
|
|
15
|
+
context: BaseConfigContext,
|
|
16
|
+
wallet: WalletInstance,
|
|
17
|
+
) => {
|
|
18
|
+
const locator = await getLocator(context)
|
|
28
19
|
const wrapper = new ManifestWrapper(NodeManifest, wallet, locator, PublicChildManifests, PrivateChildManifests)
|
|
29
20
|
const [node, ...childNodes] = await wrapper.loadNodes()
|
|
30
21
|
if (childNodes?.length > 0) {
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import type { CreatableInstance } from '@xylabs/sdk-js'
|
|
2
2
|
import { AbstractCreatable, creatable } from '@xylabs/sdk-js'
|
|
3
|
-
import {
|
|
4
|
-
ActorInstance, ActorInstanceV2, ActorInstanceV3,
|
|
5
|
-
} from '@xyo-network/xl1-sdk'
|
|
3
|
+
import { ActorInstanceV3 } from '@xyo-network/xl1-sdk'
|
|
6
4
|
|
|
7
5
|
export interface OrchestratorInstance extends CreatableInstance {
|
|
8
|
-
registerActor(actor:
|
|
6
|
+
registerActor(actor: ActorInstanceV3): Promise<void>
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
@creatable()
|
|
12
10
|
export class Orchestrator extends AbstractCreatable implements OrchestratorInstance {
|
|
13
|
-
protected actors: (
|
|
11
|
+
protected actors: (ActorInstanceV3)[] = []
|
|
14
12
|
protected keepAliveHandle: NodeJS.Timeout | null = null
|
|
15
13
|
protected running = false
|
|
16
14
|
|
|
@@ -18,7 +16,7 @@ export class Orchestrator extends AbstractCreatable implements OrchestratorInsta
|
|
|
18
16
|
* Registers an actor.
|
|
19
17
|
* (We won't activate the actor until `start()` is called.)
|
|
20
18
|
*/
|
|
21
|
-
async registerActor(actor:
|
|
19
|
+
async registerActor(actor: ActorInstanceV3) {
|
|
22
20
|
if (this.running) {
|
|
23
21
|
// If the orchestrator is already running, activate the actor immediately
|
|
24
22
|
await actor.start()
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { EmptyObject, Logger } from '@xylabs/sdk-js';
|
|
2
|
-
import type { Config } from '@xyo-network/xl1-sdk';
|
|
3
|
-
export interface ConfigContextFields {
|
|
4
|
-
config: Config;
|
|
5
|
-
logger?: Logger;
|
|
6
|
-
}
|
|
7
|
-
export type ConfigContext<T extends EmptyObject | void = void> = T extends void ? ConfigContextFields : ConfigContextFields & T;
|
|
8
|
-
//# sourceMappingURL=ConfigContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigContext.d.ts","sourceRoot":"","sources":["../../src/ConfigContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,WAAW,GAAG,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,IAAI,GAAG,mBAAmB,GAAG,mBAAmB,GAAG,CAAC,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { WalletInstance } from '@xyo-network/wallet-model';
|
|
2
|
-
import type { Config, Initializable, InitializableParams } from '@xyo-network/xl1-sdk';
|
|
3
|
-
export declare const initProducerAccount: Initializable<InitializableParams<{
|
|
4
|
-
config: Config;
|
|
5
|
-
}>, WalletInstance>;
|
|
6
|
-
//# sourceMappingURL=initProducerAccount.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initProducerAccount.d.ts","sourceRoot":"","sources":["../../../src/init/initProducerAccount.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EACV,MAAM,EAAE,aAAa,EAAE,mBAAmB,EAC3C,MAAM,sBAAsB,CAAA;AAK7B,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,mBAAmB,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,cAAc,CAkBpG,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { BiosExternalInterface } from '@xyo-network/bios-model';
|
|
2
|
-
import type { ConfigContext } from '../ConfigContext.ts';
|
|
3
|
-
export declare function initSeedPhrase({ config, logger, bios, }: ConfigContext<{
|
|
4
|
-
bios: BiosExternalInterface;
|
|
5
|
-
}>): Promise<string>;
|
|
6
|
-
//# sourceMappingURL=initSeedPhrase.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initSeedPhrase.d.ts","sourceRoot":"","sources":["../../../src/init/initSeedPhrase.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAGpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGxD,wBAAsB,cAAc,CAAC,EACnC,MAAM,EAAE,MAAM,EAAE,IAAI,GACrB,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,qBAAqB,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBlE"}
|
package/src/ConfigContext.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { EmptyObject, Logger } from '@xylabs/sdk-js'
|
|
2
|
-
import type { Config } from '@xyo-network/xl1-sdk'
|
|
3
|
-
|
|
4
|
-
export interface ConfigContextFields {
|
|
5
|
-
config: Config
|
|
6
|
-
logger?: Logger
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type ConfigContext<T extends EmptyObject | void = void> = T extends void ? ConfigContextFields : ConfigContextFields & T
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Promisable } from '@xylabs/sdk-js'
|
|
2
|
-
import { isUndefined } from '@xylabs/sdk-js'
|
|
3
|
-
import { HDWallet } from '@xyo-network/wallet'
|
|
4
|
-
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
5
|
-
import type {
|
|
6
|
-
Config, Initializable, InitializableParams,
|
|
7
|
-
} from '@xyo-network/xl1-sdk'
|
|
8
|
-
import { ADDRESS_INDEX, generateXyoBaseWalletFromPhrase } from '@xyo-network/xl1-sdk'
|
|
9
|
-
|
|
10
|
-
let accountServiceSingleton: Promisable<WalletInstance> | undefined
|
|
11
|
-
|
|
12
|
-
export const initProducerAccount: Initializable<InitializableParams<{ config: Config }>, WalletInstance>
|
|
13
|
-
= async ({ config, logger }): Promise<WalletInstance> => {
|
|
14
|
-
if (accountServiceSingleton) return accountServiceSingleton
|
|
15
|
-
let walletPhrase = config.actors.producer.mnemonic
|
|
16
|
-
if (isUndefined(walletPhrase)) {
|
|
17
|
-
logger?.warn('[Producer] No wallet mnemonic specified!')
|
|
18
|
-
const randomMnemonic = HDWallet.generateMnemonic()
|
|
19
|
-
logger?.warn(`[Producer] Using randomly generated mnemonic:
|
|
20
|
-
|
|
21
|
-
${randomMnemonic}
|
|
22
|
-
|
|
23
|
-
`)
|
|
24
|
-
walletPhrase = randomMnemonic
|
|
25
|
-
}
|
|
26
|
-
const wallet = await generateXyoBaseWalletFromPhrase(walletPhrase)
|
|
27
|
-
const account = await wallet.derivePath(ADDRESS_INDEX.XYO)
|
|
28
|
-
accountServiceSingleton = account
|
|
29
|
-
return accountServiceSingleton
|
|
30
|
-
}
|