import { ChainType, BlockNumber } from '@/domain/value-objects'; export const BLOCK_CHECKPOINT_REPOSITORY = Symbol('BLOCK_CHECKPOINT_REPOSITORY'); export interface BlockCheckpointData { chainType: string; lastScannedBlock: bigint; lastScannedAt: Date; isHealthy: boolean; lastError?: string; } export interface IBlockCheckpointRepository { /** * 获取最后扫描的区块 */ getLastScannedBlock(chainType: ChainType): Promise; /** * 更新扫描进度 */ updateCheckpoint(chainType: ChainType, blockNumber: BlockNumber): Promise; /** * 记录扫描错误 */ recordError(chainType: ChainType, error: string): Promise; /** * 标记为健康 */ markHealthy(chainType: ChainType): Promise; /** * 获取检查点状态 */ getCheckpoint(chainType: ChainType): Promise; /** * 初始化检查点(如果不存在) */ initializeIfNotExists(chainType: ChainType, startBlock: BlockNumber): Promise; }