@funkit/connect
Version:
Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.
24 lines (23 loc) • 1.16 kB
TypeScript
/**
* Reads one ERC-20 holding (balance + best-effort USD price) on-chain.
*
* - For tokens the wallet-assets API doesn't index, so they still appear as a
* payable source. Caller owns customer/flow gating.
* - Fails soft: a read failure drops the row, a price failure keeps it price-less
* — a flaky RPC never blocks the list.
*/
import { type Address } from 'viem';
import type { AssetHoldingsItem } from '../domains/wallet';
export type GetAssetHoldingsFromRpcParams = {
/** Chain to read on, as a string chain id (e.g. "57073"). */
chainId: string | undefined;
/** ERC-20 token address to read the balance of. */
tokenAddress: Address | undefined;
/** Holder address whose balance to read. */
walletAddress: Address | undefined;
/** Symbol to label the holding with — `symbol()` is never read on-chain. */
symbolHint?: string;
iconSrc?: string;
enabled?: boolean;
};
export declare function useGetAssetHoldingsFromRpc({ chainId, tokenAddress, walletAddress, symbolHint, iconSrc, enabled, }: GetAssetHoldingsFromRpcParams): import("@tanstack/react-query").UseQueryResult<AssetHoldingsItem | null, Error>;