@lifi/widget
Version:
LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.
29 lines • 1.01 kB
JavaScript
import { ChainType, isBatchingSupported } from '@lifi/sdk';
import { useQuery } from '@tanstack/react-query';
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js';
import { getQueryKey } from '../utils/queries.js';
export function useIsBatchingSupported(chain, address) {
const { keyPrefix } = useWidgetConfig();
const enabled = Boolean(chain && chain.chainType === ChainType.EVM && !!address);
const { data, isLoading } = useQuery({
queryKey: [
getQueryKey('isBatchingSupported', keyPrefix),
chain?.id,
address,
],
queryFn: () => {
return isBatchingSupported({
chainId: chain.id,
skipReady: true,
});
},
enabled,
staleTime: 3600000,
retry: false,
});
return {
isBatchingSupported: data,
isBatchingSupportedLoading: enabled && isLoading,
};
}
//# sourceMappingURL=useIsBatchingSupported.js.map