import type { Horizon, LogLevel } from './common.js' import type { BigNumberish } from 'ethers' export type DeliveryMode = 'realtime' | 'redrive' | 'backfill' export type BackfillRequest> = { jobId: string indexerId: string logLevel: LogLevel context: T } export type EvmIngestedBlock = { // Normalized Data from RPC nodes number: number hash: string parentHash: string nonce: string sha3Uncles?: string stateRoot?: string receiptsRoot?: string logsBloom?: string miner?: string extraData: string size: number gasLimit: string gasUsed: string baseFeePerGas: string timestamp: number transactions: string[] uncles?: string[] // Additional Flair-specific data chainId: number blockForkIndex: number ingestionReceivedAt: number delivery: DeliveryMode } export type IngestedBlock = EvmIngestedBlock // @deprecated export type EvmIngestedTransaction = { // Normalized data from RPC nodes blockNumber: number blockHash: string hash: string to?: string from?: string nonce?: number gasLimit?: string gasPrice?: string maxFeePerGas?: string maxPriorityFeePerGas?: string data?: string value?: string type?: number accessList?: any[] status?: boolean revertReason?: string // Augmented data from RPC nodes blockTimestamp: number gasUsed?: BigNumberish effectiveGasPrice?: BigNumberish deployedContractAddress?: string events?: EvmInlineEvent[] traces?: EvmInlineTrace[] // Additional Flair-specific data chainId: number blockForkIndex: number indexerId?: string filterGroupId?: string createdAt?: number ingestionReceivedAt: number } export type IngestedTransaction = EvmIngestedTransaction // @deprecated export type EvmIngestedEvent = { // Normalized Data from RPC nodes blockNumber: `0x${string}` blockHash: string address: string data?: string logIndex: number topics?: string[] transactionHash: string transactionIndex: number // Augmented data from RPC nodes blockTimestamp: number // Additional Flair-specific data chainId: number blockForkIndex: number localIndex: number ingestionReceivedAt: number receivingEndpoint?: string delivery: DeliveryMode } export type IngestedEvent = EvmIngestedEvent // @deprecated export type EvmParsedCall< INPUT = Record | any[], OUTPUT = Record | any[], > = { name: string sighash: string input: INPUT output?: OUTPUT } export type EvmInlineEvent> = { address: string logIndex: number topics?: string[] data?: string eventName?: string args?: TArgs } export type EvmTraceType = 'call' | 'create' | 'suicide' | 'reward' export type EvmTraceCallType = 'call' | 'create' | 'delegatecall' | 'staticcall' export type EvmInlineTrace = { action: { from: string callType: EvmTraceCallType gas: string input: string to: string value: string parsed?: EvmParsedCall } result: { gasUsed: string output: string } subtraces: number traceAddress: number[] type: EvmTraceType parsed?: EvmParsedCall } export type EvmBlockReorg = { indexerId: string chainId: number forkIndex: number newBlock: EvmIngestedBlock detectedAt: number } export type BlockReorg = EvmBlockReorg // @deprecated export type BlockHandlerInput> = { block: EvmIngestedBlock horizon: Horizon backfill?: BackfillRequest } export type TransactionHandlerInput> = { transaction: EvmIngestedTransaction horizon: Horizon backfill?: BackfillRequest } export type EventHandlerInput< ArgsType = Record, ContextType = Record, > = { chainId: number blockNumber: number blockTimestamp: number txHash: string txIndex: number log: EvmIngestedEvent horizon: Horizon parsed?: { name: string topic: string args: ArgsType } abi?: Record backfill?: BackfillRequest } export type ReorgHandlerInput> = { reorg: EvmBlockReorg horizon: Horizon backfill?: BackfillRequest } export type BlockProcessorHandlerObject = { processBlock: ( input: BlockHandlerInput, ) => Promise } export type TransactionProcessorHandlerObject = { processTransaction: ( input: TransactionHandlerInput, ) => Promise } export type EventProcessorHandlerObject = { processEvent: ( input: EventHandlerInput, ) => Promise } export type ReorgProcessorHandlerObject = { processReorg: ( input: ReorgHandlerInput, ) => Promise } export type EnricherHandlerInput< TData = Record, TParams = Record, > = { data?: TData parameters?: TParams } export type EnricherHandlerObject = { handleInput: | (( input: EnricherHandlerInput, ) => Promise) | (( input: EnricherHandlerInput, callback: (result: undefined, error?: Error) => void, ) => void) }