@xyo-network/xl1-cli-lib
v1.19.6
Published
XYO Layer One CLI Library
Keywords
Readme
@xyo-network/xl1-cli-lib
XYO Layer One CLI Library
Reference
@xyo-network/xl1-cli-lib
Classes
- BalanceActor
- ChainHeadUpdateActor
- ProducerActor
- ValidatorActor
- Actor
- Orchestrator
- RuntimeStatusMonitor
- LoggerStatusReporter
Interfaces
Type Aliases
- BalanceActorParams
- ChainHeadUpdateActorParams
- ProducerActorParams
- ValidatorActorParams
- ActorParams
- GlobalTransitionHandler
- TransitionHandler
Variables
- initHealthEndpoints
- initAccount
- initBalanceService
- initChainService
- initHead
- initChainIterator
- initStakeIntentService
- initElectionService
- initPendingTransactions
- initBlockProducer
- initBlockRewardService
- initTimeService
- initTransferService
- initValidator
Functions
classes
Actor
Extends
Base<TParams>
Extended by
Type Parameters
TParams
TParams extends ActorParams = ActorParams
Implements
Constructors
Constructor
new Actor<TParams>(
id,
displayName,
params): Actor<TParams>;Parameters
id
string
displayName
string = 'Actor'
params
TParams
Returns
Actor<TParams>
Overrides
Base<TParams>.constructorProperties
_intervals
protected readonly _intervals: Map<string, Timeout>;_semaphores
protected readonly _semaphores: Map<string, Semaphore>;_timeouts
protected readonly _timeouts: Map<string, Timeout>;Accessors
displayName
Get Signature
get displayName(): string;Returns
string
id
Get Signature
get id(): string;Returns
string
name
Get Signature
get name(): string;Returns
string
logPrefix
Get Signature
get protected logPrefix(): string;Returns
string
Methods
registerTimer()
registerTimer(
timerName,
callback,
dueTimeMs,
periodMs): void;The timer runs until the actor is deactivated (or you manually stop it).
Parameters
timerName
string
callback
() => Promise<void>
dueTimeMs
number
periodMs
number
Returns
void
span()
span<T>(name, fn): T;Type Parameters
T
T
Parameters
name
string
fn
() => T
Returns
T
spanAsync()
spanAsync<T>(name, fn): Promise<T>;Type Parameters
T
T
Parameters
name
string
fn
() => Promise<T>
Returns
Promise<T>
start()
start(): Promise<void>;Called by the Orchestrator when the actor is activated.
Returns
Promise<void>
Implementation of
stop()
stop(): Promise<void>;Called by the Orchestrator when the actor is deactivated. Stop all running timers.
Returns
Promise<void>
Implementation of
BalanceActor
Extends
Constructors
Constructor
protected new BalanceActor(params): BalanceActor;Parameters
params
Returns
BalanceActor
Overrides
Properties
_updateMutex
protected _updateMutex: Mutex;_intervals
protected readonly _intervals: Map<string, Timeout>;Inherited from
_semaphores
protected readonly _semaphores: Map<string, Semaphore>;Inherited from
_timeouts
protected readonly _timeouts: Map<string, Timeout>;Inherited from
Accessors
balanceService
Get Signature
get protected balanceService(): AccountBalanceService;Returns
AccountBalanceService
chainIterator
Get Signature
get protected chainIterator(): EventingChainBlockNumberIteratorService;Returns
EventingChainBlockNumberIteratorService
displayName
Get Signature
get displayName(): string;Returns
string
Inherited from
id
Get Signature
get id(): string;Returns
string
Inherited from
name
Get Signature
get name(): string;Returns
string
Inherited from
logPrefix
Get Signature
get protected logPrefix(): string;Returns
string
Inherited from
Methods
create()
static create(params): Promisable<BalanceActor>;Parameters
params
Returns
Promisable<BalanceActor>
start()
start(): Promise<void>;Called by the Orchestrator when the actor is activated.
Returns
Promise<void>
Overrides
updateBalance()
protected updateBalance(): Promise<void>;Returns
Promise<void>
registerTimer()
registerTimer(
timerName,
callback,
dueTimeMs,
periodMs): void;The timer runs until the actor is deactivated (or you manually stop it).
Parameters
timerName
string
callback
() => Promise<void>
dueTimeMs
number
periodMs
number
Returns
void
Inherited from
span()
span<T>(name, fn): T;Type Parameters
T
T
Parameters
name
string
fn
() => T
Returns
T
Inherited from
spanAsync()
spanAsync<T>(name, fn): Promise<T>;Type Parameters
T
T
Parameters
name
string
fn
() => Promise<T>
Returns
Promise<T>
Inherited from
stop()
stop(): Promise<void>;Called by the Orchestrator when the actor is deactivated. Stop all running timers.
Returns
Promise<void>
Inherited from
ChainHeadUpdateActor
Extends
Constructors
Constructor
protected new ChainHeadUpdateActor(params): ChainHeadUpdateActor;Parameters
params
Returns
ChainHeadUpdateActor
Overrides
Properties
_intervals
protected readonly _intervals: Map<string, Timeout>;Inherited from
_semaphores
protected readonly _semaphores: Map<string, Semaphore>;Inherited from
_timeouts
protected readonly _timeouts: Map<string, Timeout>;Inherited from
Accessors
chainFinalizedArchivist
Get Signature
get protected chainFinalizedArchivist(): ArchivistInstance<ArchivistParams<AnyConfigSchema<ArchivistConfig>>, ArchivistModuleEventData, Payload>;Returns
ArchivistInstance<ArchivistParams<AnyConfigSchema<ArchivistConfig>>, ArchivistModuleEventData, Payload>
chainIterator
Get Signature
get protected chainIterator(): EventingChainBlockNumberIteratorService;Returns
EventingChainBlockNumberIteratorService
displayName
Get Signature
get displayName(): string;Returns
string
Inherited from
id
Get Signature
get id(): string;Returns
string
Inherited from
name
Get Signature
get name(): string;Returns
string
Inherited from
logPrefix
Get Signature
get protected logPrefix(): string;Returns
string
Inherited from
Methods
create()
static create(params): Promisable<ChainHeadUpdateActor>;Parameters
params
Returns
Promisable<ChainHeadUpdateActor>
start()
start(): Promise<void>;Called by the Orchestrator when the actor is activated.
Returns
Promise<void>
Overrides
registerTimer()
registerTimer(
timerName,
callback,
dueTimeMs,
periodMs): void;The timer runs until the actor is deactivated (or you manually stop it).
Parameters
timerName
string
callback
() => Promise<void>
dueTimeMs
number
periodMs
number
Returns
void
Inherited from
span()
span<T>(name, fn): T;Type Parameters
T
T
Parameters
name
string
fn
() => T
Returns
T
Inherited from
spanAsync()
spanAsync<T>(name, fn): Promise<T>;Type Parameters
T
T
Parameters
name
string
fn
() => Promise<T>
Returns
Promise<T>
Inherited from
stop()
stop(): Promise<void>;Called by the Orchestrator when the actor is deactivated. Stop all running timers.
Returns
Promise<void>
Inherited from
LoggerStatusReporter
Extended by
Implements
CreatableStatusReporter
Constructors
Constructor
new LoggerStatusReporter(logger): LoggerStatusReporter;Parameters
logger
Logger
Returns
LoggerStatusReporter
Properties
logger
protected logger: Logger;statusMap
protected statusMap: Record<CreatableName, CreatableStatus> = {};Methods
report()
report(
name,
status,
progress?): void;Parameters
name
CreatableName
status
CreatableStatus
progress?
number | Error
Returns
void
Implementation of
CreatableStatusReporter.reportOrchestrator
Implements
Constructors
Constructor
new Orchestrator(logger?): Orchestrator;Parameters
logger?
Logger
Returns
Orchestrator
Properties
actors
protected actors: IActor[] = [];keepAliveHandle
protected keepAliveHandle: Timeout | null = null;logger?
protected readonly optional logger: Logger;running
protected running: boolean = false;Methods
registerActor()
registerActor(actor): Promise<void>;Registers an actor.
(We won't activate the actor until start() is called.)
Parameters
actor
Returns
Promise<void>
start()
start(): Promise<void>;Starts the orchestrator: activates all actors.
Returns
Promise<void>
Implementation of
stop()
stop(): Promise<void>;Stops the orchestrator: deactivates all actors.
Returns
Promise<void>
Implementation of
ProducerActor
Extends
Constructors
Constructor
protected new ProducerActor(params): ProducerActor;Parameters
params
Returns
ProducerActor
Overrides
Properties
_lastProducedBlock
protected _lastProducedBlock: HydratedBlock | undefined;_lastRedeclarationIntent
protected _lastRedeclarationIntent: ChainStakeIntent | undefined;_intervals
protected readonly _intervals: Map<string, Timeout>;Inherited from
_semaphores
protected readonly _semaphores: Map<string, Semaphore>;Inherited from
_timeouts
protected readonly _timeouts: Map<string, Timeout>;Inherited from
Accessors
account
Get Signature
get protected account(): WalletInstance;Returns
WalletInstance
balanceService
Get Signature
get protected balanceService(): AccountBalanceService;Returns
AccountBalanceService
chainIterator
Get Signature
get protected chainIterator(): EventingChainBlockNumberIteratorService;Returns
EventingChainBlockNumberIteratorService
chainStakeViewer
Get Signature
get protected chainStakeViewer(): ChainStakeViewer;Returns
ChainStakeViewer
chainSubmissionsArchivistWrite
Get Signature
get protected chainSubmissionsArchivistWrite(): WriteArchivist<Payload, Payload, Payload, Hash>;Returns
WriteArchivist<Payload, Payload, Payload, Hash>
pendingBundledTransactionsArchivistWrite
Get Signature
get protected pendingBundledTransactionsArchivistWrite(): ArchivistInstance<ArchivistParams<AnyConfigSchema<ArchivistConfig>>, ArchivistModuleEventData, Payload>;Returns
ArchivistInstance<ArchivistParams<AnyConfigSchema<ArchivistConfig>>, ArchivistModuleEventData, Payload>
producer
Get Signature
get protected producer(): BlockProducerService;Returns
BlockProducerService
stakeIntentService
Get Signature
get protected stakeIntentService(): StakeIntentService;Returns
StakeIntentService
displayName
Get Signature
get displayName(): string;Returns
string
Inherited from
id
Get Signature
get id(): string;Returns
string
Inherited from
name
Get Signature
get name(): string;Returns
string
Inherited from
logPrefix
Get Signature
get protected logPrefix(): string;Returns
string
Inherited from
Methods
create()
static create(params): Promisable<ProducerActor>;Parameters
params
Returns
Promisable<ProducerActor>
start()
start(): Promise<void>;Called by the Orchestrator when the actor is activated.
Returns
Promise<void>
Overrides
calculateBlocksUntilProducerDeclarationExpiration()
protected calculateBlocksUntilProducerDeclarationExpiration(currentBlock): Promise<number>;Parameters
currentBlock
number
Returns
Promise<number>
produceBlock()
protected produceBlock(): Promise<void>;Returns
Promise<void>
redeclareIntent()
protected redeclareIntent(): Promise<void>;Returns
Promise<void>
submitRedeclarationIntent()
protected submitRedeclarationIntent(currentBlock, redeclarationIntent): Promise<void>;Parameters
currentBlock
number
redeclarationIntent
ChainStakeIntent
Returns
Promise<void>
validateCurrentBalance()
protected validateCurrentBalance(): Promise<boolean>;Returns
Promise<boolean>
validateCurrentStake()
protected validateCurrentStake(): Promise<boolean>;Returns
Promise<boolean>
registerTimer()
registerTimer(
timerName,
callback,
dueTimeMs,
periodMs): void;The timer runs until the actor is deactivated (or you manually stop it).
Parameters
timerName
string
callback
() => Promise<void>
dueTimeMs
number
periodMs
number
Returns
void
Inherited from
span()
span<T>(name, fn): T;Type Parameters
T
T
Parameters
name
string
fn
() => T
Returns
T
Inherited from
spanAsync()
spanAsync<T>(name, fn): Promise<T>;Type Parameters
T
T
Parameters
name
string
fn
() => Promise<T>
Returns
Promise<T>
Inherited from
stop()
stop(): Promise<void>;Called by the Orchestrator when the actor is deactivated. Stop all running timers.
Returns
Promise<void>
Inherited from
RuntimeStatusMonitor
Extends
Constructors
Constructor
new RuntimeStatusMonitor(logger): RuntimeStatusMonitor;Parameters
logger
Logger
Returns
RuntimeStatusMonitor
Inherited from
LoggerStatusReporter.constructor
Properties
logger
protected logger: Logger;Inherited from
statusMap
protected statusMap: Record<CreatableName, CreatableStatus> = {};Inherited from
LoggerStatusReporter.statusMap
Methods
getGlobalStatus()
getGlobalStatus(): CreatableStatus;Returns
CreatableStatus
getStatus()
getStatus(name): CreatableStatus | undefined;Parameters
name
CreatableName
Returns
CreatableStatus | undefined
onGlobalTransition()
onGlobalTransition(match, handler): void;Parameters
match
from?
CreatableStatus
to?
CreatableStatus
handler
(from, to) => void
Returns
void
onTransition()
onTransition(match, handler): void;Register a callback to be called on a specific transition.
Parameters
match
from?
CreatableStatus
name
string
to?
CreatableStatus
handler
(from, to) => void
Returns
void
report()
report(
name,
status,
progress?): void;Parameters
name
CreatableName
status
CreatableStatus
progress?
number | Error
Returns
void
Overrides
ValidatorActor
Extends
Constructors
Constructor
protected new ValidatorActor(params): ValidatorActor;Parameters
params
Returns
ValidatorActor
Overrides
Properties
_lastValidatedBlock
protected _lastValidatedBlock: BlockBoundWitness | undefined;_lastValidatedBlockHash
protected _lastValidatedBlockHash: Hash | undefined;_intervals
protected readonly _intervals: Map<string, Timeout>;Inherited from
_semaphores
protected readonly _semaphores: Map<string, Semaphore>;Inherited from
_timeouts
protected readonly _timeouts: Map<string, Timeout>;Inherited from
Accessors
account
Get Signature
get protected account(): WalletInstance;Returns
WalletInstance
balanceService
Get Signature
get protected balanceService(): AccountBalanceService;Returns
AccountBalanceService
chainIterator
Get Signature
get protected chainIterator(): EventingChainBlockNumberIteratorService;Returns
EventingChainBlockNumberIteratorService
chainStakeViewer
Get Signature
get protected chainStakeViewer(): ChainStakeViewer;Returns
ChainStakeViewer
chainSubmissionsArchivistWrite
Get Signature
get protected chainSubmissionsArchivistWrite(): WriteArchivist<Payload, Payload, Payload, Hash>;Returns
WriteArchivist<Payload, Payload, Payload, Hash>
pendingBundledTransactionsArchivistWrite
Get Signature
get protected pendingBundledTransactionsArchivistWrite(): ArchivistInstance<ArchivistParams<AnyConfigSchema<ArchivistConfig>>, ArchivistModuleEventData, Payload>;Returns
ArchivistInstance<ArchivistParams<AnyConfigSchema<ArchivistConfig>>, ArchivistModuleEventData, Payload>
stakeIntentService
Get Signature
get protected stakeIntentService(): StakeIntentService;Returns
StakeIntentService
displayName
Get Signature
get displayName(): string;Returns
string
Inherited from
id
Get Signature
get id(): string;Returns
string
Inherited from
name
Get Signature
get name(): string;Returns
string
Inherited from
logPrefix
Get Signature
get protected logPrefix(): string;Returns
string
Inherited from
Methods
create()
static create(params): Promisable<ValidatorActor>;Parameters
params
Returns
Promisable<ValidatorActor>
start()
start(): Promise<void>;Called by the Orchestrator when the actor is activated.
Returns
Promise<void>
Overrides
slashInvalidBlock()
protected slashInvalidBlock(_block): Promise<boolean>;Parameters
_block
BlockBoundWitness
Returns
Promise<boolean>
validateBlock()
protected validateBlock(block): Promise<boolean>;Parameters
block
BlockBoundWitness
Returns
Promise<boolean>
registerTimer()
registerTimer(
timerName,
callback,
dueTimeMs,
periodMs): void;The timer runs until the actor is deactivated (or you manually stop it).
Parameters
timerName
string
callback
() => Promise<void>
dueTimeMs
number
periodMs
number
Returns
void
Inherited from
span()
span<T>(name, fn): T;Type Parameters
T
T
Parameters
name
string
fn
() => T
Returns
T
Inherited from
spanAsync()
spanAsync<T>(name, fn): Promise<T>;Type Parameters
T
T
Parameters
name
string
fn
() => Promise<T>
Returns
Promise<T>
Inherited from
stop()
stop(): Promise<void>;Called by the Orchestrator when the actor is deactivated. Stop all running timers.
Returns
Promise<void>
Inherited from
functions
canUseEvmProvider
function canUseEvmProvider(__namedParameters): boolean;Parameters
__namedParameters
config
Pick<Config, "evm">
Returns
boolean
initEvmProvider
function initEvmProvider(__namedParameters): Promise<Provider>;Parameters
__namedParameters
config
Pick<Config, "evm">
logger?
Logger
Returns
Promise<Provider>
initServices
function initServices(context): Promise<ChainServiceCollectionV2>;Parameters
context
InitServicesContext
Returns
Promise<ChainServiceCollectionV2>
runCLI
function runCLI(): Promise<void>;Returns
Promise<void>
start
function start(): Promise<void>;Returns
Promise<void>
interfaces
IActor
Methods
start()
start(): Promise<void>;Returns
Promise<void>
stop()
stop(): Promise<void>;Returns
Promise<void>
IOrchestrator
Methods
start()
start(): Promise<void>;Returns
Promise<void>
stop()
stop(): Promise<void>;Returns
Promise<void>
type-aliases
ActorParams
type ActorParams<T> = BaseParams<object & T extends void ? EmptyObject : T>;Type Parameters
T
T extends EmptyObject | void = void
BalanceActorParams
type BalanceActorParams = ActorParams<Pick<ChainServiceCollectionV2, "balance" | "chainIterator"> & object>;ChainHeadUpdateActorParams
type ChainHeadUpdateActorParams = ActorParams<Pick<ChainServiceCollectionV2, "chainIterator" | "chainArchivist"> & object>;GlobalTransitionHandler
type GlobalTransitionHandler = object;Properties
from?
optional from: CreatableStatus;handler()
handler: (from, to) => void;Parameters
from
CreatableStatus
to
CreatableStatus
Returns
void
to?
optional to: CreatableStatus;ProducerActorParams
type ProducerActorParams = ActorParams<Pick<ChainServiceCollectionV2,
| "account"
| "balance"
| "chainIterator"
| "chainStakeViewer"
| "chainSubmissionsArchivistWrite"
| "pendingBundledTransactionsArchivistWrite"
| "producer"
| "stakeIntent"> & object>;TransitionHandler
type TransitionHandler = GlobalTransitionHandler & object;Type Declaration
name?
optional name: string;ValidatorActorParams
type ValidatorActorParams = ActorParams<Pick<ChainServiceCollectionV2,
| "account"
| "balance"
| "chainIterator"
| "chainStakeViewer"
| "chainSubmissionsArchivistWrite"
| "pendingBundledTransactionsArchivistWrite"
| "stakeIntent"> & object>;variables
initAccount
const initAccount: Initializable<InitializableParams<{
config: Config;
}>, WalletInstance>;initBalanceService
const initBalanceService: Initializable<BaseAccountBalanceServiceParams, AccountBalanceService>;initBlockProducer
const initBlockProducer: Initializable<BaseBlockProducerServiceParams, BlockProducerService>;initBlockRewardService
const initBlockRewardService: Initializable<
| BaseBlockRewardServiceParams<Pick<Config, "evm">>
| EvmBlockRewardServiceParams, BlockRewardService>;initChainIterator
const initChainIterator: Initializable<XyoChainIteratorParams, EventingChainBlockNumberIteratorService>;initChainService
const initChainService: Initializable<BaseAccountableServiceParams<Pick<Config, "chain" | "evm" | "producer">>, ChainService>;initElectionService
const initElectionService: Initializable<BaseElectionServicesParams, ElectionService>;initHead
const initHead: Initializable<{
account: WalletInstance;
chainArchivist: ArchivistInstance;
chainService: ChainService;
chainSubmissionsArchivistWrite: ArchivistInstance;
}, WithStorageMeta<BlockBoundWitness>>;initHealthEndpoints
const initHealthEndpoints: Initializable<{
config: Config;
logger: Logger;
statusReporter: RuntimeStatusMonitor;
}, Server | undefined>;initPendingTransactions
const initPendingTransactions: Initializable<BasePendingTransactionsServiceParams, PendingTransactionsService>;initStakeIntentService
const initStakeIntentService: Initializable<XyoStakeIntentServiceParams, StakeIntentService>;initTimeService
const initTimeService: Initializable<BaseTimeServiceParams<Pick<Config, "evm">>, TimeSyncViewer>;initTransferService
const initTransferService: Initializable<BaseAccountTransferServiceParams, AccountTransfersService>;initValidator
const initValidator: Initializable<BaseBlockProducerServiceParams, BlockProducerService>;Maintainers
License
See the LICENSE file for license details

