import { ChainTypeEnum } from '@openfort/openfort-js';
import type { SolanaCluster } from '../solana/types.js';
/**
* Returns a callback that marks every native balance and wallet-asset query
* stale, so anything showing a balance refetches. Call it after a transaction
* that moves funds (mint, send, deposit).
*
* @example
* ```tsx
* import { useInvalidateBalance } from '@openfort/react'
*
* function RefreshBalancesButton() {
* const invalidateBalance = useInvalidateBalance()
* return
* }
* ```
*/
export declare function useInvalidateBalance(): () => void;
type BalanceState = {
status: 'idle';
refetch: () => void;
} | {
status: 'loading';
refetch: () => void;
} | {
status: 'error';
error: Error;
refetch: () => void;
} | {
status: 'success';
value: bigint;
formatted: string;
symbol: string;
decimals: number;
refetch: () => void;
};
interface UseBalanceOptions {
/** Address to fetch balance for */
address: string;
/** Chain type */
chainType: ChainTypeEnum;
/** Ethereum chain ID (default: 84532 Base Sepolia) */
chainId?: number;
/** Solana cluster (default: devnet) */
cluster?: SolanaCluster;
/** Solana commitment level (default: confirmed) */
commitment?: 'processed' | 'confirmed' | 'finalized';
/** Enable/disable the query */
enabled?: boolean;
/** Refetch interval in ms (default: 30000) */
refetchInterval?: number;
}
type BalanceResult = {
value: bigint;
formatted: string;
symbol: string;
decimals: number;
};
export declare function fetchSolanaBalance(addressStr: string, rpcUrl: string, commitment: 'processed' | 'confirmed' | 'finalized'): Promise;
/** Hook for fetching native token balance. */
export declare function useBalance(options: UseBalanceOptions): BalanceState;
export {};