import { getEvmClient } from '@1delta/providers';
import { Hex } from 'viem';
/**
 * Factory for the EVM client used by the broker reads. Callers that execute against a custom RPC
 * (e.g. a fork) must pass their own factory so the per-user broker reads (`userFixedPositions`,
 * …) hit the SAME chain as the rest of the user-data multicall — otherwise the loan created on a
 * fork is invisible (the default client points at the configured mainnet RPC).
 */
type EvmClientFactory = (chainId: string, rpcId?: number) => ReturnType<typeof getEvmClient>;
/** One term product offered by a broker (the borrow menu). Named generically (`ListaTerm`/`terms`)
 *  rather than "fixed" — Lista may add floating-rate terms later. */
export interface ListaTerm {
    termId: number;
    durationSecs: number;
    durationDays: number;
    /** annualised borrow rate in PERCENT (e.g. 3.857 = 3.857% APR), matching the other rate fields */
    apr: number;
}
/** One term loan tranche held by a user (debt only — collateral is shared). */
export interface ListaFixedLoan {
    /** global position id — the "loanId" consumed by the LISTA_BROKER_REPAY composer op */
    posId: string;
    /** best-effort term product id, matched from the loan's duration against the current
     *  getFixedTerms menu. Not stored on-chain per loan; undefined if no menu match. */
    termId?: number;
    principal: string;
    /** principal - principalRepaid */
    outstanding: string;
    /** annualised borrow rate in PERCENT */
    apr: number;
    start: number;
    end: number;
    termDays: number;
    /** outstanding accrued interest (gross accrued - interestRepaid), in loan-token units */
    accruedInterest: string;
    /**
     * early-repayment penalty (loan-token units) charged to close the full outstanding principal
     * right now; `0` once matured. Levied on top of outstanding + accruedInterest by the broker.
     */
    earlyRepayPenalty: string;
    isMatured: boolean;
}
/** Aggregated broker debt for one user in one market. */
export interface ListaBrokerUserData {
    /** broker.getUserTotalDebt — principal + all interest, the authoritative debt */
    totalDebt: string;
    dynamic?: {
        principal: string;
        normalizedDebt: string;
    };
    fixedLoans: ListaFixedLoan[];
}
/** Normalise a market key ('LISTA_DAO_<HEX>' or '0x<hash>') to a lowercase bytes32 id. */
export declare function toBytes32MarketId(key: string): Hex;
/**
 * Resolve the broker address for each Lista market via `Moolah.brokers(id)`.
 * Returns a map keyed by the bytes32 market id (lowercase). Results are cached forever
 * (broker registration is immutable per market). Markets without a broker resolve to undefined.
 */
export declare function resolveListaBrokers(chainId: string, marketKeys: string[], getClient?: EvmClientFactory): Promise<Record<string, string>>;
/**
 * Fetch the fixed-term menu (`getFixedTerms`) for every brokered Lista market and cache it.
 * Returns a map keyed by the bytes32 market id.
 */
export declare function fetchListaFixedTerms(chainId: string, marketKeys: string[]): Promise<Record<string, ListaTerm[]>>;
/** Read the cached fixed-term menu for a market (warm via {@link fetchListaFixedTerms}). */
export declare function getCachedListaFixedTerms(chainId: string, marketKey: string): ListaTerm[] | undefined;
/**
 * Fetch the per-user broker debt breakdown (fixed loans + dynamic + total debt) for every
 * brokered market and stash it in the per-account cache for the sync converter to read.
 */
export declare function fetchListaBrokerUserData(chainId: string, account: string, marketKeys: string[], nowSecs?: number, getClient?: EvmClientFactory): Promise<Record<string, ListaBrokerUserData>>;
/** Read the cached per-user broker data for a market (warm via {@link fetchListaBrokerUserData}). */
export declare function getCachedListaBrokerUserData(chainId: string, account: string, marketKey: string): ListaBrokerUserData | undefined;
export {};
//# sourceMappingURL=listaBroker.d.ts.map