UNPKG

@funkit/connect

Version:

Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.

38 lines (37 loc) 1.62 kB
import { type Erc20AssetInfo, type GetAssetPriceInfoResponse } from '@funkit/api-base'; import type { Address } from 'viem'; export declare function getAssetPriceInfoWithFallback({ apiKey, chainId, assetTokenAddress, }: { apiKey: string; chainId: string; assetTokenAddress: Address; }): Promise<GetAssetPriceInfoResponse>; interface UseAssetAddressPriceParams { chainId: string | undefined; assetTokenAddress: Address | undefined; /** Pass `false` to fetch once and disable interval polling. */ refetchInterval?: number | false; /** defaults to 1 hence price returned is unit price */ amount?: number; /** Asset symbol — when provided and the symbol is a stablecoin, price is hardcoded to 1 */ symbol?: string; /** Disable the query without changing other inputs. Defaults to true. */ enabled?: boolean; } type AssetPriceResult = { error: Error | null; isLoading: boolean; /** unit price if custom amount is not provided */ price: number | undefined; }; export declare function useAssetAddressPrice({ chainId, assetTokenAddress, amount, refetchInterval, symbol, enabled, }: UseAssetAddressPriceParams): AssetPriceResult; type AssetSymbolPriceParams = { chainId: string | undefined; symbol: string | undefined; refetchInterval?: number | false; /** Disable the query without changing other inputs. Defaults to true. */ enabled?: boolean; }; export declare const useAssetSymbolPrice: ({ chainId, symbol, refetchInterval, enabled, }: AssetSymbolPriceParams) => AssetPriceResult & { asset?: Erc20AssetInfo | null; }; export {};