MultiversX Tracker is Live!

How to estimate the price of Gas prior to submitting a transaction on ethers?

Etherum Reddit

More / Etherum Reddit 114 Views

I am trying to estimate gas using ethers. I have tred using await this.signer.getGasPrice() but this doesn't take into account my contract's function and my address.I saw that on ethers's documentation they have a function

await provider.estimateGas({ // Wrapped ETH address

to: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // `function deposit() payable`

data: "0xd0e30db0", // 1 ether

value: parseEther("1.0") });

but this takes transaction data as an input?

How am I supposed to get tranaction data prior to submitting a transaction?

submitted by /u/pepeman931
[link] [comments]
Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments