import { type Address, type Commitment, type GetProgramAccountsApi, type Rpc, type Slot } from '@solana/kit';
import BN from 'bn.js';
import { Obligation } from '../@codegen/klend/accounts';
import { type AccountSubscriptionManager } from './accountSubscriptionManager';
import type { KaminoMarket } from './market';
export type BorrowOrderFillType = 'partial' | 'full';
export interface BorrowOrderFillEvent {
    obligation: Obligation;
    fillType: BorrowOrderFillType;
    debtLiquidityMint: Address;
    filledAmount: BN;
    remainingDebtAmount: BN;
    requestedDebtAmount: BN;
    slot: Slot;
}
export type BorrowOrderFillCallback = (event: BorrowOrderFillEvent) => void;
export type BorrowOrderFillErrorCallback = (error: unknown) => void;
export interface BorrowOrderFillListenerParams {
    /** Shared subscription manager — WS lifecycle is delegated here */
    manager: AccountSubscriptionManager;
    /** HTTP RPC for seeding initial obligation states */
    rpc: Rpc<GetProgramAccountsApi>;
    markets: KaminoMarket[];
    owner: Address;
    onFill: BorrowOrderFillCallback;
    onError?: BorrowOrderFillErrorCallback;
    programId?: Address;
    initialStates?: Map<Address, Obligation>;
    commitment?: Commitment;
}
/**
 * Listen for borrow order fills via the shared AccountSubscriptionManager.
 *
 * Seeds initial obligation states via HTTP, then subscribes to the manager
 * for real-time notifications. State diffing detects partial and full fills.
 *
 * On WS reconnect, re-fetches obligation states via HTTP to avoid stale diffs
 * (e.g. multiple fills during downtime being misclassified as one).
 *
 * Returns an unsubscribe function.
 */
export declare function listenToBorrowOrderFills(params: BorrowOrderFillListenerParams): Promise<() => void>;
//# sourceMappingURL=borrowOrderFillListener.d.ts.map