Is there a way or api endpoint to calculate the gas fee before sending the ETH? My client requirements is to calculate the gas fee before sending an ETH to other user.
I can only get the gas price using blockcypher api.
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
If you are only sending Ethers directly to a user's wallet the gas usage is always 21000. But if you are sending Ethers to a contract it may be arbitrary.
Most clients offer functionality to estimate the gas usage in advance. Note that this is only an estimation and sometimes it's not possible to make even an estimate.
If you mean only the gas price, you can get that for example here: https://docs.ethgasstation.info/gas-price