import type { AssetBalanceInfo, SolanaAddress } from '@funkit/api-base'; import React, { type ReactNode } from 'react'; import type { Address } from 'viem'; import type { AsyncImageSrc } from '../components/AsyncImage/useAsyncImage'; import type { IdentityProvider } from '../interfaces/identity'; import { type UseDisconnectReturnType, type UseReconnectReturnType } from '../wagmi/hooks'; import { type FunkitUserInfo } from '../consts/funkit'; import { LoginType } from '../utils/userInfo'; /** AssetBalanceInfo with known price and totalUsdValue */ export interface KnownAssetBalanceInfo extends AssetBalanceInfo { price: number; totalUsdValue: number; } export { LoginType } from '../utils/userInfo'; /** * A wallet that can pay, with the vendor identity a row needs to name and * depict it. Recorded checkouts widen the address, having stored what paid * rather than validated it. */ export interface PayerWallet { address: TAddress; name?: string; icon?: string | AsyncImageSrc; } /** One entry per ecosystem: two entries mean two addresses. */ export interface CheckoutPayer { evmWallet: PayerWallet
; solanaWallet: PayerWallet | undefined; } export interface GeneralWalletContextProps { walletAddress: CheckoutPayer['evmWallet']['address']; payerWallets: CheckoutPayer; isUserLoggedIn: boolean; loginType: LoginType; connectorId: string | undefined; userInfo: FunkitUserInfo; l2Address: string | undefined; /** Rejects when a wallet fails to disconnect; UI event handlers should use {@link useFunkitDisconnect}'s `disconnect` instead. */ handleLogout: () => Promise; logoutSymbol: symbol | undefined; } export declare function GeneralWalletProvider({ children }: { children: ReactNode; }): React.JSX.Element; export declare const useGeneralWallet: () => GeneralWalletContextProps; /** * Web implementation of the {@link IdentityProvider} contract: exposes the * connected-wallet **user** identity (`GeneralWalletProvider`) as the * platform-agnostic {@link FunkitIdentity} consumed by core hooks. React Native * supplies its own implementation from host props. * * Customer identity (`apiKey`) is deliberately *not* included — it lives on * `useFunkitConfig` so user identity and customer identity stay separable. * * `userId` is `userInfo.id` (not `userInfo.address`). `walletAddress` is the * resolved `evmAddress` from context, normalized to the contract's `''` * sentinel when absent. */ export declare const useIdentity: IdentityProvider['useIdentity']; /** * Replacement for wagmi's `useAccount` */ export declare const useFunkitAccount: () => { address: Address; addresses: readonly [Address, ...Address[]]; chain: import("viem").Chain | undefined; chainId: number; connector: import("wagmi").Connector; isConnecting: false; isDisconnected: false; isReconnecting: false; status: 'connected'; account: "" | `0x${string}`; isConnected: boolean; loginType: LoginType; } | { address: Address | undefined; addresses: readonly Address[] | undefined; chain: import("viem").Chain | undefined; chainId: number | undefined; connector: import("wagmi").Connector | undefined; isConnecting: false; isDisconnected: false; isReconnecting: true; status: 'reconnecting'; account: "" | `0x${string}`; isConnected: boolean; loginType: LoginType; } | { address: Address | undefined; addresses: readonly Address[] | undefined; chain: import("viem").Chain | undefined; chainId: number | undefined; connector: import("wagmi").Connector | undefined; isReconnecting: false; isConnecting: true; isDisconnected: false; status: 'connecting'; account: "" | `0x${string}`; isConnected: boolean; loginType: LoginType; } | { address: undefined; addresses: undefined; chain: undefined; chainId: undefined; connector: undefined; isReconnecting: false; isConnecting: false; isDisconnected: true; status: 'disconnected'; account: "" | `0x${string}`; isConnected: boolean; loginType: LoginType; }; export declare const useFunkitUserInfo: () => FunkitUserInfo; export type FunkitDisconnectReturnType = UseDisconnectReturnType & { disconnect: () => void; disconnectAsync: () => Promise; }; /** * Replacement for wagmi's `disconnect` from `useDisconnect`. * `disconnectAsync` rejects when a wallet fails to disconnect; `disconnect` * is safe for event handlers — each failure is already logged at WARN. */ export declare const useFunkitDisconnect: () => FunkitDisconnectReturnType; /** * Replacement for wagmi's `useReconnect` */ export declare const useFunkitReconnect: () => UseReconnectReturnType; /** * Replacement for wagmi's useSwitchChains */ export declare const useFunkitSwitchChains: ({ onSettled, }: { onSettled?: () => void; }) => { switchChain: import("wagmi/query").SwitchChainMutate; switchChainAsync: import("wagmi/query").SwitchChainMutateAsync; pendingChainId: number | null; };