import { type QueryClient } from '@tanstack/react-query'; import type { Address } from 'viem'; /** * Shared query key for a Polymarket account's USD balance, keyed by address. * Keying by address (not by the opaque getter fn) is what lets the "Deposit to" * dropdown and the in-modal transfer step dedupe into a single cache entry — so * navigating between them reuses the already-loaded balance instead of * refetching from scratch (no loading flash on entry). */ export declare const polymarketAccountBalanceQueryKey: (address: Address | undefined) => readonly ['polymarket', 'accountBalanceUsd', `0x${string}` | null]; /** * Refetches the given accounts' balances right away — call once the * integrator's `transfer` resolves so the displayed numbers move without * waiting out the poll interval. Nothing is adjusted client-side: the values * shown before, during and after a transfer are always what the integrator's * `getBalanceUsd` reports, so the modal can never disagree with the * integrator's own balance display. */ export declare function refetchPolymarketAccountBalances(queryClient: QueryClient, addresses: readonly Address[]): Promise; /** The fields a balance reader needs from a Polymarket account. */ export interface PolymarketBalanceAccount { address: Address; /** Integrator-owned live balance fetcher (USD). */ getBalanceUsd: () => Promise; } export interface PolymarketAccountBalance { /** Latest polled balance, or `undefined` until the first fetch resolves. */ balanceUsd: number | undefined; /** Whether the last balance is being retained while its query reloads. */ isRefreshing: boolean; } export interface UsePolymarketAccountBalancesOptions { /** * How often (ms) to poll each account's balance. Defaults to * {@link DEFAULT_BALANCE_REFETCH_MS}. */ refetchIntervalMs?: number; } /** * Live USD balances for the Polymarket Predictions and Perps accounts, backed * by a single TanStack Query cache keyed by account address. Both the "Deposit * to" dropdown and the in-modal transfer step read through this hook, so they * share one store: whichever screen loads first populates the balance, and the * other reads it instantly on navigation. The values are the integrator's * own, unmodified; a completed transfer refetches them via * {@link refetchPolymarketAccountBalances}. */ export declare function usePolymarketAccountBalances(accounts: { predictions: PolymarketBalanceAccount | undefined; perps: PolymarketBalanceAccount | undefined; }, options?: UsePolymarketAccountBalancesOptions): { predictions: PolymarketAccountBalance; perps: PolymarketAccountBalance; };