import { type ConvertBalances } from '../domains/convert/balances'; import type { ConvertRecipientAddresses, ConvertResolvedAsset, GetConvertBalances } from '../domains/convert/types'; export declare const BALANCES_QUERY_KEY: readonly ['convert', 'balances']; interface UseConvertBalancesParams { /** Scopes reads to one checkout, whose `getBalances` may differ from the last. */ checkoutId: string | undefined; /** Resolved assets; one read covers all of them. */ assets: ConvertResolvedAsset[] | undefined; getBalances: GetConvertBalances | undefined; /** * The host's account per VM. Part of the cache key, so an account switch * never shows the previous account's balances. These are the host's receive * addresses: an identity for the account, not a claim about which wallet * each balance was read from (Polygon pUSD is read from the proxy). */ recipientAddresses: ConvertRecipientAddresses | undefined; /** Isolates independent balance readers and identifies their warning logs. */ queryScope?: string; refetchIntervalMs?: number; /** Off stops reads and polling; the last read stays readable. */ enabled?: boolean; } export interface UseConvertBalancesResult { /** * One entry per listed asset, keyed by `convertAssetKey`; `undefined` * until the first read for the current asset list and account settles. A * failed poll keeps the last good read. */ balances: ConvertBalances | undefined; isLoading: boolean; /** A read is running, including a poll or retry with balances shown. */ isFetching: boolean; /** The latest read threw. `balances` still holds the last good one, if any. */ isError: boolean; /** * Read again now, e.g. before signing or after a convert settles. Resolves * with the fresh balances and rejects if the host's read failed, so a * caller never mistakes the last good read for a fresh one. * - With `assets`, reads only those and merges them into the cached * balances; the rest keep their last read. * - Without, reads every listed asset. */ refetch: (assets?: ConvertResolvedAsset[]) => Promise; } /** * Owns Convert's balance state: one query for every listed asset, polled on * a timer while mounted. Keyed by the asset list and the host's account, so a * change to either is a cache miss; a late response for an old key can't * replace a newer one. */ export declare function useConvertBalances({ checkoutId, assets, getBalances, recipientAddresses, queryScope, refetchIntervalMs, enabled, }: UseConvertBalancesParams): UseConvertBalancesResult; export {};