aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/pending-tx.js
diff options
context:
space:
mode:
authorFrankie <frankie.pangilinan@consensys.net>2016-09-16 05:31:45 +0800
committerFrankie <frankie.pangilinan@consensys.net>2016-09-16 05:31:45 +0800
commitcf484d735fab021a0dfe509243b957e8c6278532 (patch)
tree521c1baf581454c29b05c53a6598d5ec6fe8caa4 /ui/app/components/pending-tx.js
parent7293c67f686516485ea1a06fb3ee15094630da3e (diff)
downloadtangerine-wallet-browser-cf484d735fab021a0dfe509243b957e8c6278532.tar.gz
tangerine-wallet-browser-cf484d735fab021a0dfe509243b957e8c6278532.tar.zst
tangerine-wallet-browser-cf484d735fab021a0dfe509243b957e8c6278532.zip
Clean up some of the code
Diffstat (limited to 'ui/app/components/pending-tx.js')
-rw-r--r--ui/app/components/pending-tx.js25
1 files changed, 4 insertions, 21 deletions
diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js
index 57852010e..4c27a8092 100644
--- a/ui/app/components/pending-tx.js
+++ b/ui/app/components/pending-tx.js
@@ -3,9 +3,6 @@ const h = require('react-hyperscript')
const inherits = require('util').inherits
const PendingTxDetails = require('./pending-tx-details')
-const ethUtil = require('ethereumjs-util')
-const BN = ethUtil.BN
-
module.exports = PendingTx
inherits(PendingTx, Component)
@@ -16,20 +13,6 @@ function PendingTx () {
PendingTx.prototype.render = function () {
var state = this.props
var txData = state.txData
- var txParams = txData.txParams || {}
- var address = txParams.from || state.selectedAddress
-
- var account = state.accounts[address]
- var balance = account ? account.balance : '0x0'
-
- var gasCost = new BN(ethUtil.stripHexPrefix(txParams.gas || txData.estimatedGas), 16)
- var gasPrice = new BN(ethUtil.stripHexPrefix(txParams.gasPrice || '0x4a817c800'), 16)
- var txFee = gasCost.mul(gasPrice)
- var txValue = new BN(ethUtil.stripHexPrefix(txParams.value || '0x0'), 16)
- var maxCost = txValue.add(txFee)
-
- var balanceBn = new BN(ethUtil.stripHexPrefix(balance), 16)
- var insufficientBalance = maxCost.gt(balanceBn)
return (
@@ -47,7 +30,7 @@ PendingTx.prototype.render = function () {
}
`),
- insufficientBalance ?
+ state.insufficientBalance ?
h('span.error', {
style: {
marginLeft: 50,
@@ -65,14 +48,14 @@ PendingTx.prototype.render = function () {
},
}, [
- insufficientBalance ?
+ state.insufficientBalance ?
h('button.btn-green', {
- onClick: state.sendTransaction,
+ onClick: state.buyEth,
}, 'Buy Ether')
: null,
h('button.confirm', {
- disabled: insufficientBalance,
+ disabled: state.insufficientBalance,
onClick: state.sendTransaction,
}, 'Accept'),