@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
85 lines • 3.33 kB
TypeScript
import { Registry } from "prom-client";
import { PrivateKey } from "@libp2p/interface";
import { BeaconApiMethods } from "@lodestar/api/beacon/server";
import { BeaconConfig } from "@lodestar/config";
import type { LoggerNode } from "@lodestar/logger/node";
import { BeaconStateAllForks } from "@lodestar/state-transition";
import { phase0 } from "@lodestar/types";
import { ProcessShutdownCallback } from "@lodestar/validator";
import { BeaconRestApiServer } from "../api/index.js";
import { IBeaconChain } from "../chain/index.js";
import { ValidatorMonitor } from "../chain/validatorMonitor.js";
import { IBeaconDb } from "../db/index.js";
import { HttpMetricsServer, Metrics } from "../metrics/index.js";
import { MonitoringService } from "../monitoring/index.js";
import { Network } from "../network/index.js";
import { BackfillSync } from "../sync/backfill/index.js";
import { IBeaconSync } from "../sync/index.js";
import { IBeaconNodeOptions } from "./options.js";
export * from "./options.js";
export type BeaconNodeModules = {
opts: IBeaconNodeOptions;
config: BeaconConfig;
db: IBeaconDb;
metrics: Metrics | null;
validatorMonitor: ValidatorMonitor | null;
network: Network;
chain: IBeaconChain;
api: BeaconApiMethods;
sync: IBeaconSync;
backfillSync: BackfillSync | null;
metricsServer: HttpMetricsServer | null;
monitoring: MonitoringService | null;
restApi?: BeaconRestApiServer;
controller?: AbortController;
};
export type BeaconNodeInitModules = {
opts: IBeaconNodeOptions;
config: BeaconConfig;
db: IBeaconDb;
logger: LoggerNode;
processShutdownCallback: ProcessShutdownCallback;
privateKey: PrivateKey;
dataDir: string;
peerStoreDir?: string;
anchorState: BeaconStateAllForks;
wsCheckpoint?: phase0.Checkpoint;
metricsRegistries?: Registry[];
};
export declare enum BeaconNodeStatus {
started = "started",
closing = "closing",
closed = "closed"
}
/**
* The main Beacon Node class. Contains various components for getting and processing data from the
* Ethereum Consensus ecosystem as well as systems for getting beacon node metadata.
*/
export declare class BeaconNode {
opts: IBeaconNodeOptions;
config: BeaconConfig;
db: IBeaconDb;
metrics: Metrics | null;
metricsServer: HttpMetricsServer | null;
monitoring: MonitoringService | null;
validatorMonitor: ValidatorMonitor | null;
network: Network;
chain: IBeaconChain;
api: BeaconApiMethods;
restApi?: BeaconRestApiServer;
sync: IBeaconSync;
backfillSync: BackfillSync | null;
status: BeaconNodeStatus;
private controller?;
constructor({ opts, config, db, metrics, metricsServer, monitoring, validatorMonitor, network, chain, api, restApi, sync, backfillSync, controller, }: BeaconNodeModules);
/**
* Initialize a beacon node. Initializes and `start`s the varied sub-component services of the
* beacon node
*/
static init<T extends BeaconNode = BeaconNode>({ opts, config, db, logger, processShutdownCallback, privateKey, dataDir, peerStoreDir, anchorState, wsCheckpoint, metricsRegistries, }: BeaconNodeInitModules): Promise<T>;
/**
* Stop beacon node and its sub-components.
*/
close(): Promise<void>;
}
//# sourceMappingURL=nodejs.d.ts.map