import { Address } from "@project-serum/anchor";
import { AccountInfo, MintInfo } from "@solana/spl-token";
import { Connection } from "@solana/web3.js";
import { PositionData, TickArrayData, WhirlpoolData, WhirlpoolsConfigData } from "../..";
import { FeeTierData } from "../../types/public";
import { ParsableEntity } from "./parsing";
/**
 * Supported accounts
 */
declare type CachedValue = WhirlpoolsConfigData | WhirlpoolData | PositionData | TickArrayData | FeeTierData | AccountInfo | MintInfo;
/**
 * Include both the entity (i.e. type) of the stored value, and the value itself
 */
interface CachedContent<T extends CachedValue> {
    entity: ParsableEntity<T>;
    value: CachedValue | null;
}
/**
 * Filter params for Whirlpools when invoking getProgramAccounts.
 * @category Fetcher
 */
export declare type ListWhirlpoolParams = {
    programId: Address;
    configId: Address;
};
/**
 * Tuple containing Whirlpool address and parsed account data.
 * @category Fetcher
 */
export declare type WhirlpoolAccount = [Address, WhirlpoolData];
/**
 * Data access layer to access Whirlpool related accounts
 * Includes internal cache that can be refreshed by the client.
 *
 * @category Fetcher
 */
export declare class AccountFetcher {
    private readonly connection;
    private readonly _cache;
    private _accountRentExempt;
    constructor(connection: Connection, cache?: Record<string, CachedContent<CachedValue>>);
    /*** Public Methods ***/
    /**
     * Retrieve minimum balance for rent exemption of a Token Account;
     *
     * @param refresh force refresh of account rent exemption
     * @returns minimum balance for rent exemption
     */
    getAccountRentExempt(refresh?: boolean): Promise<number>;
    /**
     * Retrieve a cached whirlpool account. Fetch from rpc on cache miss.
     *
     * @param address whirlpool address
     * @param refresh force cache refresh
     * @returns whirlpool account
     */
    getPool(address: Address, refresh?: boolean): Promise<WhirlpoolData | null>;
    /**
     * Retrieve a cached position account. Fetch from rpc on cache miss.
     *
     * @param address position address
     * @param refresh force cache refresh
     * @returns position account
     */
    getPosition(address: Address, refresh?: boolean): Promise<PositionData | null>;
    /**
     * Retrieve a cached tick array account. Fetch from rpc on cache miss.
     *
     * @param address tick array address
     * @param refresh force cache refresh
     * @returns tick array account
     */
    getTickArray(address: Address, refresh?: boolean): Promise<TickArrayData | null>;
    /**
     * Retrieve a cached fee tier account. Fetch from rpc on cache miss.
     *
     * @param address fee tier address
     * @param refresh force cache refresh
     * @returns fee tier account
     */
    getFeeTier(address: Address, refresh?: boolean): Promise<FeeTierData | null>;
    /**
     * Retrieve a cached token info account. Fetch from rpc on cache miss.
     *
     * @param address token info address
     * @param refresh force cache refresh
     * @returns token info account
     */
    getTokenInfo(address: Address, refresh?: boolean): Promise<AccountInfo | null>;
    /**
     * Retrieve a cached mint info account. Fetch from rpc on cache miss.
     *
     * @param address mint info address
     * @param refresh force cache refresh
     * @returns mint info account
     */
    getMintInfo(address: Address, refresh?: boolean): Promise<MintInfo | null>;
    /**
     * Retrieve a cached whirlpool config account. Fetch from rpc on cache miss.
     *
     * @param address whirlpool config address
     * @param refresh force cache refresh
     * @returns whirlpool config account
     */
    getConfig(address: Address, refresh?: boolean): Promise<WhirlpoolsConfigData | null>;
    /**
     * Retrieve a list of cached whirlpool accounts. Fetch from rpc for cache misses.
     *
     * @param addresses whirlpool addresses
     * @param refresh force cache refresh
     * @returns whirlpool accounts
     */
    listPools(addresses: Address[], refresh: boolean): Promise<(WhirlpoolData | null)[]>;
    /**
     * Retrieve a list of cached whirlpool addresses and accounts filtered by the given params using
     * getProgramAccounts.
     *
     * @param params whirlpool filter params
     * @returns tuple of whirlpool addresses and accounts
     */
    listPoolsWithParams({ programId, configId, }: ListWhirlpoolParams): Promise<WhirlpoolAccount[]>;
    /**
     * Retrieve a list of cached position accounts. Fetch from rpc for cache misses.
     *
     * @param addresses position addresses
     * @param refresh force cache refresh
     * @returns position accounts
     */
    listPositions(addresses: Address[], refresh: boolean): Promise<(PositionData | null)[]>;
    /**
     * Retrieve a list of cached tick array accounts. Fetch from rpc for cache misses.
     *
     * @param addresses tick array addresses
     * @param refresh force cache refresh
     * @returns tick array accounts
     */
    listTickArrays(addresses: Address[], refresh: boolean): Promise<(TickArrayData | null)[]>;
    /**
     * Retrieve a list of cached token info accounts. Fetch from rpc for cache misses.
     *
     * @param addresses token info addresses
     * @param refresh force cache refresh
     * @returns token info accounts
     */
    listTokenInfos(addresses: Address[], refresh: boolean): Promise<(AccountInfo | null)[]>;
    /**
     * Retrieve a list of cached mint info accounts. Fetch from rpc for cache misses.
     *
     * @param addresses mint info addresses
     * @param refresh force cache refresh
     * @returns mint info accounts
     */
    listMintInfos(addresses: Address[], refresh: boolean): Promise<(MintInfo | null)[]>;
    /**
     * Update the cached value of all entities currently in the cache.
     * Uses batched rpc request for network efficient fetch.
     */
    refreshAll(): Promise<void>;
    /*** Private Methods ***/
    /**
     * Retrieve from cache or fetch from rpc, an account
     */
    private get;
    /**
     * Retrieve from cache or fetch from rpc, a list of accounts
     */
    private list;
    /**
     * Make batch rpc request
     */
    private bulkRequest;
}
export {};
