Skip to content
Discussion options

You must be logged in to vote

Found the answer, just use estimateGas. before the method name like this format contractObject.estimateGas.method()here's my code if anyone needs:

/**
 * Gets an estimate for gas limit (units of gas) expressed in Gwei
 * @param {object} dexRouterContract - Contract object of the DEX router 
 * @param {str} tokenInAddress - Address of the input token
 * @param {str} tokenOutAddress - Address of the output token 
 * @param {int} tokenInAmount - Amount of input token denominated in Wei
 * @param {int} tokenOutAmount - Amount of output token denominated in Wei
 * @param {str} userAddress - Address to perform the swap 
 * (PS: Ensure this address has enough of the input and output token as it …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by StayFoolisj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant