Use computed balance for tx confirmation

feature/default_network_editable
Dan Finlay 7 years ago
parent 86cd4e4fed
commit 0ba6493175
  1. 6
      ui/app/components/pending-tx.js
  2. 4
      ui/app/conf-tx.js

@ -33,7 +33,7 @@ function PendingTx () {
PendingTx.prototype.render = function () { PendingTx.prototype.render = function () {
const props = this.props const props = this.props
const { currentCurrency, blockGasLimit } = props const { currentCurrency, blockGasLimit, computedBalances } = props
const conversionRate = props.conversionRate const conversionRate = props.conversionRate
const txMeta = this.gatherTxMeta() const txMeta = this.gatherTxMeta()
@ -42,8 +42,8 @@ PendingTx.prototype.render = function () {
// Account Details // Account Details
const address = txParams.from || props.selectedAddress const address = txParams.from || props.selectedAddress
const identity = props.identities[address] || { address: address } const identity = props.identities[address] || { address: address }
const account = props.accounts[address] const account = computedBalances[address]
const balance = account ? account.balance : '0x0' const balance = account ? account.ethBalance : '0x0'
// recipient check // recipient check
const isValidAddress = !txParams.to || util.isValidAddress(txParams.to) const isValidAddress = !txParams.to || util.isValidAddress(txParams.to)

@ -29,6 +29,7 @@ function mapStateToProps (state) {
conversionRate: state.metamask.conversionRate, conversionRate: state.metamask.conversionRate,
currentCurrency: state.metamask.currentCurrency, currentCurrency: state.metamask.currentCurrency,
blockGasLimit: state.metamask.currentBlockGasLimit, blockGasLimit: state.metamask.currentBlockGasLimit,
computedBalances: state.metamask.computedBalances,
} }
} }
@ -39,7 +40,7 @@ function ConfirmTxScreen () {
ConfirmTxScreen.prototype.render = function () { ConfirmTxScreen.prototype.render = function () {
const props = this.props const props = this.props
const { network, provider, unapprovedTxs, currentCurrency, const { network, provider, unapprovedTxs, currentCurrency, computedBalances,
unapprovedMsgs, unapprovedPersonalMsgs, conversionRate, blockGasLimit } = props unapprovedMsgs, unapprovedPersonalMsgs, conversionRate, blockGasLimit } = props
var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, unapprovedPersonalMsgs, network) var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, unapprovedPersonalMsgs, network)
@ -104,6 +105,7 @@ ConfirmTxScreen.prototype.render = function () {
currentCurrency, currentCurrency,
blockGasLimit, blockGasLimit,
unconfTxListLength, unconfTxListLength,
computedBalances,
// Actions // Actions
buyEth: this.buyEth.bind(this, txParams.from || props.selectedAddress), buyEth: this.buyEth.bind(this, txParams.from || props.selectedAddress),
sendTransaction: this.sendTransaction.bind(this), sendTransaction: this.sendTransaction.bind(this),

Loading…
Cancel
Save