diff options
author | frankiebee <frankie.diamond@gmail.com> | 2017-07-12 03:41:03 +0800 |
---|---|---|
committer | frankiebee <frankie.diamond@gmail.com> | 2017-07-12 03:41:03 +0800 |
commit | 971d25a8ab9fecbad041e3df1696bf67245bd858 (patch) | |
tree | 257ebef4fc679fede3ef7276879086cb250166da /app/scripts/lib | |
parent | a670e54973ed1bae20455507a4b3c44e231ba822 (diff) | |
parent | a1fd9bc6bebcad4421a10ab85f525b9686103549 (diff) | |
download | tangerine-wallet-browser-971d25a8ab9fecbad041e3df1696bf67245bd858.tar tangerine-wallet-browser-971d25a8ab9fecbad041e3df1696bf67245bd858.tar.gz tangerine-wallet-browser-971d25a8ab9fecbad041e3df1696bf67245bd858.tar.bz2 tangerine-wallet-browser-971d25a8ab9fecbad041e3df1696bf67245bd858.tar.lz tangerine-wallet-browser-971d25a8ab9fecbad041e3df1696bf67245bd858.tar.xz tangerine-wallet-browser-971d25a8ab9fecbad041e3df1696bf67245bd858.tar.zst tangerine-wallet-browser-971d25a8ab9fecbad041e3df1696bf67245bd858.zip |
Merge branch 'master' into nonce-tracker
Diffstat (limited to 'app/scripts/lib')
-rw-r--r-- | app/scripts/lib/tx-utils.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/scripts/lib/tx-utils.js b/app/scripts/lib/tx-utils.js index 149d93102..4e780fcc0 100644 --- a/app/scripts/lib/tx-utils.js +++ b/app/scripts/lib/tx-utils.js @@ -118,6 +118,15 @@ module.exports = class txProviderUtils { } } + sufficientBalance (tx, hexBalance) { + const balance = hexToBn(hexBalance) + const value = hexToBn(tx.value) + const gasLimit = hexToBn(tx.gas) + const gasPrice = hexToBn(tx.gasPrice) + + const maxCost = value.add(gasLimit.mul(gasPrice)) + return balance.gte(maxCost) + } } |