@openocean.finance/widget
Version:
Openocean Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.
21 lines • 719 B
JavaScript
import { useQuery } from '@tanstack/react-query';
import { OpenOceanService } from '../services/OpenOceanService.js';
import { useSettings } from '../stores/settings/useSettings.js';
const gasKey = {
slow: 'standard',
normal: 'instant',
fast: 'fast',
};
export const useGasPrice = (chainName) => {
const { gasPrice } = useSettings(['gasPrice']);
const { data, isLoading } = useQuery({
queryKey: ['gasPrice'],
queryFn: () => OpenOceanService.getGasPrice(chainName.toLowerCase()),
});
const _gasPrice = data?.[gasKey[gasPrice || 'Normal']];
return {
gasPrice: _gasPrice && _gasPrice.maxFeePerGas,
isLoading,
};
};
//# sourceMappingURL=useGasPrice.js.map