import { BaseCustomDataSource, BaseDataSource, IProjectNetworkConfig } from '@subql/types-core'; import { DatasourceParams, Header, IBaseIndexerWorker, IBlock, ISubqueryProject } from './indexer'; export interface ICoreBlockchainService = ISubqueryProject> { packageVersion: string; onProjectChange(project: SubQueryProject): Promise | void; getBlockTimestamp(height: number): Promise; getHeaderForHeight(height: number): Promise
; } export interface IBlockchainService = ISubqueryProject, SafeAPI = any, LightBlock = any, FullBlock = any, Worker extends IBaseIndexerWorker = IBaseIndexerWorker> extends ICoreBlockchainService { blockHandlerKind: string; fetchBlocks(blockNums: number[]): Promise[] | IBlock[]>; fetchBlockWorker(worker: Worker, blockNum: number, context: { workers: Worker[]; }): Promise
; getBlockSize(block: IBlock): number; /** * The finalized header. If the chain doesn't have concrete finalization this could be a probabilistic finalization * */ getFinalizedHeader(): Promise
; /** * Gets the latest height of the chain, this should be unfinalized. * Or if the chain has instant finalization this would be the same as the finalized height. * */ getBestHeight(): Promise; /** * The chain interval in milliseconds, if it is not consistent then provide a best estimate * */ getChainInterval(): Promise; getHeaderForHash(hash: string): Promise
; /** * Applies and validates parameters to a template DS * */ updateDynamicDs(params: DatasourceParams, template: DS | CDS): Promise; isCustomDs: (x: DS | CDS) => x is CDS; isRuntimeDs: (x: DS | CDS) => x is DS; /** * Gets an API instance to a specific height so any state queries return data as represented at that height. * */ getSafeApi(block: LightBlock | FullBlock): Promise; }