import type { LighterAccountIndex } from '@funkit/api-base'; import type { Address } from 'viem'; export type LighterAsset = { symbol: string; asset_id: number; balance: string; locked_balance: string; }; /** * A user's stake in a Lighter public pool. Entry state only: current value is * `shares_amount` × the pool's share price, which needs the pool account too. */ export type LighterShare = { public_pool_index: number; shares_amount: number; entry_usdc: string; principal_amount: string; entry_timestamp: number; }; /** * Public-pool accounting, present only on pool accounts (`account_type: 4`). * Share price is ` / total_shares`. */ export type LighterPoolInfo = { total_shares: number; operator_shares: number; }; export type LighterAccount = { code: number; account_type: number; index: number; l1_address: Address; cancel_all_time: number; total_order_count: number; total_isolated_order_count: number; pending_order_count: number; available_balance: string; status: number; collateral: string; transaction_time: number; account_trading_mode: number; account_index: number; name: string; description: string; can_invite: boolean; referral_points_percentage: string; can_rfq: boolean; created_at: number; positions: unknown[]; assets: LighterAsset[]; total_asset_value: string; cross_asset_value: string; shares: LighterShare[]; pending_unlocks: unknown[]; /** Pool accounts only — absent on user accounts. */ pool_info?: LighterPoolInfo; }; export type LighterAccountResponse = { code: number; total: number; accounts: LighterAccount[]; }; export type LighterAccountLookup = { by: 'index'; value: LighterAccountIndex; } | { by: 'l1_address'; value: Address; }; export declare function getLighterAccount(lookup: LighterAccountLookup, activeOnly?: boolean): Promise; /** * Ungated Lighter account query. For callers whose module is Lighter-specific * by construction — `clients/lighter` is a separate bundle entry with its own copy * of the config context, so `useFunkitConfig()` there yields no api key and a * customer check would disable the query forever. */ export declare function useLighterAccountQuery(lookup: LighterAccountLookup | null, options?: { activeOnly?: boolean; }): { account: LighterAccount | undefined; data: LighterAccountResponse; error: Error; isError: true; isPending: false; isLoading: false; isLoadingError: false; isRefetchError: true; isSuccess: false; isPlaceholderData: false; status: "error"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; failureReason: Error | null; errorUpdateCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isInitialLoading: boolean; isPaused: boolean; isRefetching: boolean; isStale: boolean; refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise>; fetchStatus: import("@tanstack/react-query").FetchStatus; promise: Promise; } | { account: LighterAccount | undefined; data: LighterAccountResponse; error: null; isError: false; isPending: false; isLoading: false; isLoadingError: false; isRefetchError: false; isSuccess: true; isPlaceholderData: false; status: "success"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; failureReason: Error | null; errorUpdateCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isInitialLoading: boolean; isPaused: boolean; isRefetching: boolean; isStale: boolean; refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise>; fetchStatus: import("@tanstack/react-query").FetchStatus; promise: Promise; } | { account: LighterAccount | undefined; data: undefined; error: Error; isError: true; isPending: false; isLoading: false; isLoadingError: true; isRefetchError: false; isSuccess: false; isPlaceholderData: false; status: "error"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; failureReason: Error | null; errorUpdateCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isInitialLoading: boolean; isPaused: boolean; isRefetching: boolean; isStale: boolean; refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise>; fetchStatus: import("@tanstack/react-query").FetchStatus; promise: Promise; } | { account: LighterAccount | undefined; data: undefined; error: null; isError: false; isPending: true; isLoading: true; isLoadingError: false; isRefetchError: false; isSuccess: false; isPlaceholderData: false; status: "pending"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; failureReason: Error | null; errorUpdateCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isInitialLoading: boolean; isPaused: boolean; isRefetching: boolean; isStale: boolean; refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise>; fetchStatus: import("@tanstack/react-query").FetchStatus; promise: Promise; } | { account: LighterAccount | undefined; data: undefined; error: null; isError: false; isPending: true; isLoadingError: false; isRefetchError: false; isSuccess: false; isPlaceholderData: false; status: "pending"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; failureReason: Error | null; errorUpdateCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isLoading: boolean; isInitialLoading: boolean; isPaused: boolean; isRefetching: boolean; isStale: boolean; refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise>; fetchStatus: import("@tanstack/react-query").FetchStatus; promise: Promise; } | { account: LighterAccount | undefined; data: LighterAccountResponse; isError: false; error: null; isPending: false; isLoading: false; isLoadingError: false; isRefetchError: false; isSuccess: true; isPlaceholderData: true; status: "success"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; failureReason: Error | null; errorUpdateCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isInitialLoading: boolean; isPaused: boolean; isRefetching: boolean; isStale: boolean; refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise>; fetchStatus: import("@tanstack/react-query").FetchStatus; promise: Promise; }; /** * Returns a callback that invalidates the cached Lighter account queries so the * balance refetches eagerly (e.g. right after a withdrawal). No-op for * non-Lighter customers. */ export declare function useInvalidateLighterAccount(): () => void; //# sourceMappingURL=useLighterAccountQuery.d.ts.map