Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Commit

Permalink
Test to remove some fields from estimation
Browse files Browse the repository at this point in the history
  • Loading branch information
anxolin committed Nov 13, 2020
1 parent 4e4dde1 commit f9c4a26
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/api/wallet/composeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,16 @@ export const composeProvider = <T extends Provider>(
if (!txConfig) return false

if (!txConfig.gas) {
const gasLimit = await web3.eth.estimateGas(txConfig).catch((error) => {
console.error('[composeProvider] Error estimating gas, probably failing transaction', txConfig)
throw error
})
const gasLimit = await web3.eth
.estimateGas({
from: txConfig.from,
gas: txConfig.gas,
value: txConfig.value,
})
.catch((error) => {
console.error('[composeProvider] Error estimating gas, probably failing transaction', txConfig)
throw error
})
logDebug('[composeProvider] No gas Limit. Using estimation ' + gasLimit)
txConfig.gas = numberToHex(gasLimit)
} else {
Expand Down

0 comments on commit f9c4a26

Please sign in to comment.