import { Data_SolBlock, Data_SolInstruction, HandleInterval, ProcessResult } from '@sentio/protos';
import { SolanaContext } from './solana-context.js';
import { Instruction } from '@coral-xyz/anchor';
import { SolanaBindOptions, SolanaFetchConfig } from './solana-options.js';
import { ListStateStorage } from '@sentio/runtime';
import { Labels, PromiseOrVoid } from '../core/index.js';
import { SolanaChainId } from '@sentio/chain';
import { HandlerOptions } from '../core/handler-options.js';
import { BlockResponse } from '@solana/web3.js';
type IndexConfigure = {
    startSlot: bigint;
    endSlot?: bigint;
};
export interface InstructionCoder {
    decode(ix: Buffer | string, encoding?: 'hex' | 'base58'): Instruction | null;
}
export type SolanaInstructionHandler = (instruction: Instruction, ctx: SolanaContext, accounts?: string[]) => void;
export interface InstructionHandlerEntry {
    handler: SolanaInstructionHandler;
    handlerOptions?: HandlerOptions<SolanaFetchConfig, Instruction>;
}
export type SolanaBlockHandler<T> = (block: T, ctx: SolanaContext) => PromiseOrVoid;
export interface SolanaBlockHandlerEntry<T> {
    handler: SolanaBlockHandler<T>;
    timeIntervalInMinutes?: HandleInterval;
    slotInterval?: HandleInterval;
    handlerName: string;
}
export declare class SolanaProcessorState extends ListStateStorage<SolanaBaseProcessor> {
    static INSTANCE: SolanaProcessorState;
}
export declare class SolanaBaseProcessor {
    instructionHandlerMap: Map<string, InstructionHandlerEntry>;
    blockHandlers: SolanaBlockHandlerEntry<any>[];
    address: string;
    endpoint: string;
    contractName: string;
    baseLabels?: Labels;
    network: SolanaChainId;
    processInnerInstruction: boolean;
    config: IndexConfigure;
    instructionCoder: InstructionCoder;
    decodeInstruction(rawInstruction: string): Instruction | null;
    fromParsedInstruction: (instruction: {
        type: string;
        info: any;
    }) => Instruction | null;
    constructor(options: SolanaBindOptions);
    onInstruction(instructionName: string, handler: SolanaInstructionHandler, handlerOptions?: HandlerOptions<SolanaFetchConfig, Instruction>): this;
    onTimeInterval(handler: SolanaBlockHandler<BlockResponse>, timeIntervalInMinutes?: number, backfillTimeIntervalInMinutes?: number): this;
    onBlockInterval(handler: SolanaBlockHandler<BlockResponse>, blockInterval?: number, backfillBlockInterval?: number): this;
    onInterval<T>(handler: SolanaBlockHandler<T>, timeInterval: HandleInterval | undefined, slotInterval: HandleInterval | undefined): this;
    getParsedInstruction(ins: string | {
        type: string;
        info: any;
    }): Instruction | null;
    getInstructionHandler(parsedInstruction: Instruction): InstructionHandlerEntry | undefined;
    handleInstruction(parsedInstruction: Instruction, accounts: string[], handlerEntry: InstructionHandlerEntry, data: Data_SolInstruction): Promise<ProcessResult>;
    handleBlock(rawBlock: Data_SolBlock, handlerEntry: SolanaBlockHandlerEntry<BlockResponse>): Promise<ProcessResult>;
    getPartitionKey(parsedInstruction: Instruction, handlerEntry: InstructionHandlerEntry): Promise<string | undefined>;
    startSlot(startSlot: bigint | number): this;
    endBlock(endBlock: bigint | number): this;
}
export declare class SolanaGlobalProcessor extends SolanaBaseProcessor {
    static bind(options: Omit<SolanaBindOptions, 'address'>): SolanaGlobalProcessor;
    constructor(options: SolanaBindOptions);
}
export {};
//# sourceMappingURL=solana-processor.d.ts.map