How meta estimating gas cost before broadcasting.
How can I calculate gas cost for myfunc() in web3js?
function myfunc(){
require(msg.sender == owner)
...
}
await contractInstance.myfunc.sendTransaction(); //it sends the transaction and wastes the gas if `myfunc` will fail.
Is there any best way to know gas cost before call solidity myfunc(), its saves gas for me ? (Similar like metamask)