mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Make tx calculations account for gas prices
This commit is contained in:
parent
532a4040de
commit
fadc0617df
@ -32,9 +32,15 @@ class PendingBalanceCalculator {
|
|||||||
|
|
||||||
valueFor (tx) {
|
valueFor (tx) {
|
||||||
const txValue = tx.txParams.value
|
const txValue = tx.txParams.value
|
||||||
const normalized = normalize(txValue).substring(2)
|
|
||||||
const value = this.hexToBn(txValue)
|
const value = this.hexToBn(txValue)
|
||||||
return value
|
const gasPrice = this.hexToBn(tx.txParams.gasPrice)
|
||||||
|
|
||||||
|
const gas = tx.txParams.gas
|
||||||
|
const gasLimit = tx.txParams.gasLimit
|
||||||
|
const gasLimitBn = this.hexToBn(gas || gasLimit)
|
||||||
|
|
||||||
|
const gasCost = gasPrice.mul(gasLimitBn)
|
||||||
|
return value.add(gasCost)
|
||||||
}
|
}
|
||||||
|
|
||||||
hexToBn (hex) {
|
hexToBn (hex) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user