aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/conf-tx.js
diff options
context:
space:
mode:
authorDan Finlay <flyswatter@users.noreply.github.com>2017-01-18 04:08:47 +0800
committerGitHub <noreply@github.com>2017-01-18 04:08:47 +0800
commitc53932a19a77516110a45d7b201b85dc6ea71a47 (patch)
tree4b53230af166215f932b0d5c3ac17888946c85ca /ui/app/conf-tx.js
parent79040c2e681012c98869b7e4d49a9e0ed406c52f (diff)
parenta245fb7d22a5fe08c4fc8c2c1c64d406805018a8 (diff)
downloadtangerine-wallet-browser-c53932a19a77516110a45d7b201b85dc6ea71a47.tar
tangerine-wallet-browser-c53932a19a77516110a45d7b201b85dc6ea71a47.tar.gz
tangerine-wallet-browser-c53932a19a77516110a45d7b201b85dc6ea71a47.tar.bz2
tangerine-wallet-browser-c53932a19a77516110a45d7b201b85dc6ea71a47.tar.lz
tangerine-wallet-browser-c53932a19a77516110a45d7b201b85dc6ea71a47.tar.xz
tangerine-wallet-browser-c53932a19a77516110a45d7b201b85dc6ea71a47.tar.zst
tangerine-wallet-browser-c53932a19a77516110a45d7b201b85dc6ea71a47.zip
Merge branch 'dev' into conversion-api-err
Diffstat (limited to 'ui/app/conf-tx.js')
-rw-r--r--ui/app/conf-tx.js27
1 files changed, 13 insertions, 14 deletions
diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js
index 5a645022a..a6e03c3ed 100644
--- a/ui/app/conf-tx.js
+++ b/ui/app/conf-tx.js
@@ -41,11 +41,13 @@ ConfirmTxScreen.prototype.render = function () {
var provider = state.provider
var unconfTxs = state.unconfTxs
var unconfMsgs = state.unconfMsgs
+
var unconfTxList = txHelper(unconfTxs, unconfMsgs, network)
- var index = state.index !== undefined ? state.index : 0
- var txData = unconfTxList[index] || unconfTxList[0] || {}
- var txParams = txData.txParams || {}
+ var index = state.index !== undefined && unconfTxList[index] ? state.index : 0
+ var txData = unconfTxList[index] || {}
+ var txParams = txData.params || {}
var isNotification = isPopupOrNotification() === 'notification'
+ if (unconfTxList.length === 0) return null
return (
@@ -115,27 +117,24 @@ ConfirmTxScreen.prototype.render = function () {
}
function currentTxView (opts) {
- if ('txParams' in opts.txData) {
+ const { txData } = opts
+ const { txParams, msgParams } = txData
+
+ if (txParams) {
// This is a pending transaction
return h(PendingTx, opts)
- } else if ('msgParams' in opts.txData) {
+ } else if (msgParams) {
// This is a pending message to sign
return h(PendingMsg, opts)
}
}
ConfirmTxScreen.prototype.checkBalanceAgainstTx = function (txData) {
+ if (!txData.txParams) return false
var state = this.props
-
- var txParams = txData.txParams || {}
- var address = txParams.from || state.selectedAccount
+ var address = txData.txParams.from || state.selectedAccount
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 maxCost = new BN(txData.maxCost)
var balanceBn = new BN(ethUtil.stripHexPrefix(balance), 16)
return maxCost.gt(balanceBn)