import { MoveCoder } from './index.js';
import { EntryFunctionPayloadResponse, Event, MoveResource, UserTransactionResponse } from '@aptos-labs/ts-sdk';
import { AptosBindOptions, AptosNetwork } from './network.js';
import { AptosContext, AptosResourcesContext, AptosTransactionContext } from './context.js';
import { ListStateStorage } from '@sentio/runtime';
import { HandleInterval, MoveAccountFetchConfig, MoveFetchConfig } from '@sentio/protos';
import { CallHandler, EventFilter, EventHandler, FunctionNameAndCallFilter, ResourceChangeHandler, ResourceIntervalHandler, TransactionIntervalHandler } from '../move/index.js';
import { Labels, PromiseOrVoid } from '../core/index.js';
import { TypeDescriptor } from '@typemove/move';
import { ResourceChange } from '@typemove/aptos';
/** Extracts the data type T from a TypeDescriptor<T>; falls back to `unknown` for raw strings. */
type ExtractDescriptorType<D> = D extends TypeDescriptor<infer T> ? T : unknown;
import { GeneralTransactionResponse, HandlerOptions } from './models.js';
import { AptCall, AptEvent, AptResource } from './data.js';
export declare const DEFAULT_RESOURCE_FETCH_CONFIG: MoveAccountFetchConfig;
type IndexConfigure = {
    address: string;
    network: AptosNetwork;
    startVersion: bigint;
    endVersion?: bigint;
    baseLabels?: Labels;
};
export declare class AptosProcessorState extends ListStateStorage<AptosTransactionProcessor<any, any>> {
    static INSTANCE: AptosProcessorState;
}
export declare class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT extends AptosTransactionContext<T>> {
    readonly moduleName: string;
    config: IndexConfigure;
    eventHandlers: EventHandler<AptEvent>[];
    callHandlers: CallHandler<AptCall>[];
    resourceChangeHandlers: ResourceChangeHandler<AptResource>[];
    transactionIntervalHandlers: TransactionIntervalHandler[];
    coder: MoveCoder;
    constructor(moduleName: string, options: AptosBindOptions);
    protected onMoveEvent(handler: (event: Event, ctx: AptosContext) => PromiseOrVoid, filter: EventFilter | EventFilter[], handlerOptions?: HandlerOptions<MoveFetchConfig, Event>): this;
    protected onEntryFunctionCall(handler: (call: EntryFunctionPayloadResponse, ctx: AptosContext) => PromiseOrVoid, filter: FunctionNameAndCallFilter | FunctionNameAndCallFilter[], handlerOptions?: HandlerOptions<MoveFetchConfig, EntryFunctionPayloadResponse>): this;
    onTransaction(handler: (transaction: UserTransactionResponse, ctx: AptosContext) => PromiseOrVoid, transactionFilter?: {
        includeFailed?: boolean;
        sender?: string;
    }, handleOptions?: HandlerOptions<MoveFetchConfig, UserTransactionResponse>): this;
    onEvent(handler: (event: Event, ctx: AptosContext) => void, handlerOptions?: HandlerOptions<MoveFetchConfig, Event>): this;
    onResourceChange<T>(handler: (changes: ResourceChange<T>[], ctx: AptosResourcesContext) => PromiseOrVoid, typeDesc: TypeDescriptor<T> | string, handlerOptions?: HandlerOptions<object, ResourceChange<T>[]>): this;
    onResourceChange<Descs extends readonly (TypeDescriptor<any> | string)[]>(handler: (changes: ResourceChange<ExtractDescriptorType<Descs[number]>>[], ctx: AptosResourcesContext) => PromiseOrVoid, typeDesc: [...Descs], handlerOptions?: HandlerOptions<object, ResourceChange<ExtractDescriptorType<Descs[number]>>[]>): this;
    protected onInterval(handler: (transaction: T, ctx: CT) => PromiseOrVoid, timeInterval: HandleInterval | undefined, versionInterval: HandleInterval | undefined, handlerOptions?: HandlerOptions<MoveFetchConfig, T>): this;
    onTimeInterval(handler: (transaction: T, ctx: CT) => PromiseOrVoid, timeIntervalInMinutes?: number, backfillTimeIntervalInMinutes?: number, handlerOptions?: HandlerOptions<MoveFetchConfig, T>): this;
    onVersionInterval(handler: (transaction: T, context: CT) => PromiseOrVoid, versionInterval?: number, backfillVersionInterval?: number, handlerOptions?: HandlerOptions<MoveFetchConfig, T>): this;
    getChainId(): string;
}
export declare class AptosBaseProcessor extends AptosTransactionProcessor<UserTransactionResponse, AptosContext> {
}
export declare class AptosModulesProcessor extends AptosTransactionProcessor<GeneralTransactionResponse, AptosTransactionContext<GeneralTransactionResponse>> {
    private constructor();
    static bind(options: AptosBindOptions): AptosModulesProcessor;
    onMoveEvent(handler: (event: Event, ctx: AptosContext) => PromiseOrVoid, filter: EventFilter | EventFilter[], handlerOptions?: HandlerOptions<MoveFetchConfig, Event>): this;
}
export declare class AptosGlobalProcessor {
    private baseProcessor;
    private constructor();
    static bind(options: AptosBindOptions): AptosGlobalProcessor;
    onTransaction(handler: (transaction: UserTransactionResponse, ctx: AptosContext) => PromiseOrVoid, transactionFilter?: {
        includeFailed?: boolean;
        sender?: string;
    }, fetchConfig?: Partial<MoveFetchConfig>): this;
    onTimeInterval(handler: (transaction: GeneralTransactionResponse, ctx: AptosTransactionContext<GeneralTransactionResponse>) => PromiseOrVoid, timeIntervalInMinutes?: number, backfillTimeIntervalInMinutes?: number, handlerOptions?: HandlerOptions<MoveFetchConfig, GeneralTransactionResponse>): this;
    onVersionInterval(handler: (transaction: GeneralTransactionResponse, ctx: AptosTransactionContext<GeneralTransactionResponse>) => PromiseOrVoid, versionInterval?: number, backfillVersionInterval?: number, handlerOptions?: HandlerOptions<MoveFetchConfig, GeneralTransactionResponse>): this;
}
export declare class AptosResourceProcessorState extends ListStateStorage<AptosResourcesProcessor> {
    static INSTANCE: AptosResourceProcessorState;
}
export declare class AptosResourcesProcessor {
    config: IndexConfigure;
    resourceIntervalHandlers: ResourceIntervalHandler[];
    static bind(options: AptosBindOptions): AptosResourcesProcessor;
    protected constructor(options: AptosBindOptions);
    getChainId(): string;
    onInterval(handler: (resources: MoveResource[], ctx: AptosResourcesContext) => PromiseOrVoid, timeInterval: HandleInterval | undefined, versionInterval: HandleInterval | undefined, type: string | undefined, handlerOptions?: HandlerOptions<MoveAccountFetchConfig, MoveResource[]>, handlerName?: string): this;
    onTimeInterval(handler: (resources: MoveResource[], ctx: AptosResourcesContext) => PromiseOrVoid, timeIntervalInMinutes?: number, backfillTimeIntervalInMinutes?: number, type?: string, handlerOptions?: HandlerOptions<MoveAccountFetchConfig, MoveResource[]>): this;
    onVersionInterval(handler: (resources: MoveResource[], ctx: AptosResourcesContext) => PromiseOrVoid, versionInterval?: number, backfillVersionInterval?: number, typePrefix?: string, handlerOptions?: HandlerOptions<MoveAccountFetchConfig, MoveResource[]>): this;
    onResourceChange<T>(handler: (changes: ResourceChange<T>[], ctx: AptosResourcesContext) => PromiseOrVoid, typeDesc: TypeDescriptor<T> | string): this;
    onResourceChange<Descs extends readonly (TypeDescriptor<any> | string)[]>(handler: (changes: ResourceChange<ExtractDescriptorType<Descs[number]>>[], ctx: AptosResourcesContext) => PromiseOrVoid, typeDesc: [...Descs]): this;
}
export {};
//# sourceMappingURL=aptos-processor.d.ts.map