-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
hi i am trying it on BSC network and using https://api.owlracle.info/v3/bsc/gas this for gas
import { ChainId } from "@0x/contract-addresses";
import axios from "axios";
import { ethers } from "ethers";
export const getGasEstimation = async (chainId: ChainId) => {
if (chainId === ChainId.BSC) {
const gasEstimation = await (await axios.get('https://api.owlracle.info/v3/bsc/gas')).data['speeds'];
// solution presented at ethers-io/ethers.js#2828
const maxFeePerGas = ethers.utils.parseUnits(
Math.ceil(gasEstimation.maxFee) + '',
'gwei'
)
const maxPriorityFeePerGas = ethers.utils.parseUnits(
Math.ceil(gasEstimation.maxPriorityFee) + '',
'gwei'
)
return { maxFeePerGas, maxPriorityFeePerGas }
}
return {}
}
Metadata
Metadata
Assignees
Labels
No labels