-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gas estimation failed #2
Comments
import { ChainId } from "@0x/contract-addresses"; export const Markets: MarketConfig[] = [
] |
Swap api not works well with tokens with taxes, you need to use a higher slippagePercentage to help it cover the tax fee |
You don't need to change the gas fee logic for BSC, it should solve the issue when you put a higher slippage |
data: { |
yarn run v1.22.19 |
baseTokenAddress: '0x77fc65deda64f0cca9e3aea7b9d8521f4151882e', |
token have 1% buy and 1% transfer fees only |
Slippage pergentage should be a value between 0 and 1 |
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 {}
}
The text was updated successfully, but these errors were encountered: