Skip to content

Commit

Permalink
ethlike - allow get estimated gas in wei
Browse files Browse the repository at this point in the history
  • Loading branch information
shendel committed Oct 5, 2024
1 parent a12ac02 commit b3e2eff
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/front/shared/redux/actions/ethLikeAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,16 @@ class EthLikeAction {
|| (typeof limit === 'string' && limit.match(/^0x[0-9a-f]+$/i))
)

send = async (params): Promise<{ transactionHash: string } | Error> => {
send = async (params): Promise<{ transactionHash: string } | number | Error> => {
const {
to,
amount = 0,
amountInWei = false,
gasLimit: customGasLimit,
speed,
data,
waitReceipt = false
waitReceipt = false,
estimateGas = false,
} = params
let { gasPrice } = params

Expand Down Expand Up @@ -438,6 +439,10 @@ class EthLikeAction {
}
}

if (estimateGas) {
return new BigNumber(txData.gas).multipliedBy(txData.gasPrice).toNumber()
}

const privateKey = this.getPrivateKeyByAddress(ownerAddress)
const walletData = actions.core.getWallet({
address: ownerAddress,
Expand Down

0 comments on commit b3e2eff

Please sign in to comment.