UNPKG

@b3dotfun/anyspend-sdk

Version:

React Hooks and UI Components for AnySpend by B3

25 lines (22 loc) 597 B
import { anyspendService } from "@b3dotfun/anyspend-sdk/services/anyspend"; import { useQuery } from "@tanstack/react-query"; import { useMemo } from "react"; export function useAnyspendTokenList(isMainnet: boolean, chainId: number, query: string) { const { data = [], isLoading, refetch } = useQuery({ queryKey: ["getAnyspendTokenList", chainId, query], queryFn: () => anyspendService.getTokenList(isMainnet, chainId, query), enabled: true }); return useMemo( () => ({ data, isLoading, refetch }), [data, isLoading, refetch] ); }