Merge pull request #627 from MetaMask/i#589pendingTxsIssue

I#589pending txs issue
feature/default_network_editable
Dan Finlay 8 years ago committed by GitHub
commit fc0f64a5a8
  1. 1
      CHANGELOG.md
  2. 2
      ui/app/account-detail.js
  3. 1
      ui/app/accounts/index.js
  4. 4
      ui/app/conf-tx.js
  5. 9
      ui/app/reducers/app.js
  6. 5
      ui/index.js
  7. 4
      ui/lib/tx-helper.js

@ -2,6 +2,7 @@
## Current Master ## Current Master
- Fix bug where pending transactions from Test net (or other networks) show up In Main net.
- Add fiat conversion values to more views. - Add fiat conversion values to more views.
- On fresh install, open a new tab with the MetaMask Introduction video. - On fresh install, open a new tab with the MetaMask Introduction video.
- Block negative values from transactions. - Block negative values from transactions.

@ -235,7 +235,7 @@ AccountDetailScreen.prototype.subview = function () {
AccountDetailScreen.prototype.transactionList = function () { AccountDetailScreen.prototype.transactionList = function () {
const { transactions, unconfTxs, unconfMsgs, address, network, shapeShiftTxList } = this.props const { transactions, unconfTxs, unconfMsgs, address, network, shapeShiftTxList } = this.props
var txsToRender = transactions var txsToRender = transactions.concat(unconfTxs)
// only transactions that are from the current address // only transactions that are from the current address
.filter(tx => tx.txParams.from === address) .filter(tx => tx.txParams.from === address)
// only transactions that are on the current network // only transactions that are on the current network

@ -11,6 +11,7 @@ module.exports = connect(mapStateToProps)(AccountsScreen)
function mapStateToProps (state) { function mapStateToProps (state) {
const pendingTxs = valuesFor(state.metamask.unconfTxs) const pendingTxs = valuesFor(state.metamask.unconfTxs)
.filter(tx => tx.txParams.metamaskNetworkId === state.metamask.network)
const pendingMsgs = valuesFor(state.metamask.unconfMsgs) const pendingMsgs = valuesFor(state.metamask.unconfMsgs)
const pending = pendingTxs.concat(pendingMsgs) const pending = pendingTxs.concat(pendingMsgs)

@ -21,6 +21,7 @@ function mapStateToProps (state) {
unconfMsgs: state.metamask.unconfMsgs, unconfMsgs: state.metamask.unconfMsgs,
index: state.appState.currentView.context, index: state.appState.currentView.context,
warning: state.appState.warning, warning: state.appState.warning,
network: state.metamask.network,
} }
} }
@ -32,9 +33,10 @@ function ConfirmTxScreen () {
ConfirmTxScreen.prototype.render = function () { ConfirmTxScreen.prototype.render = function () {
var state = this.props var state = this.props
var network = state.network
var unconfTxs = state.unconfTxs var unconfTxs = state.unconfTxs
var unconfMsgs = state.unconfMsgs var unconfMsgs = state.unconfMsgs
var unconfTxList = txHelper(unconfTxs, unconfMsgs) var unconfTxList = txHelper(unconfTxs, unconfMsgs, network)
var index = state.index !== undefined ? state.index : 0 var index = state.index !== undefined ? state.index : 0
var txData = unconfTxList[index] || unconfTxList[0] || {} var txData = unconfTxList[index] || unconfTxList[0] || {}
var isNotification = isPopupOrNotification() === 'notification' var isNotification = isPopupOrNotification() === 'notification'

@ -258,8 +258,9 @@ function reduceApp (state, action) {
case actions.COMPLETED_TX: case actions.COMPLETED_TX:
var unconfTxs = state.metamask.unconfTxs var unconfTxs = state.metamask.unconfTxs
var unconfMsgs = state.metamask.unconfMsgs var unconfMsgs = state.metamask.unconfMsgs
var network = state.metamask.network
var unconfTxList = txHelper(unconfTxs, unconfMsgs) var unconfTxList = txHelper(unconfTxs, unconfMsgs, network)
.filter(tx => tx !== tx.id) .filter(tx => tx !== tx.id)
if (unconfTxList && unconfTxList.length > 0) { if (unconfTxList && unconfTxList.length > 0) {
@ -523,14 +524,16 @@ function reduceApp (state, action) {
function hasPendingTxs (state) { function hasPendingTxs (state) {
var unconfTxs = state.metamask.unconfTxs var unconfTxs = state.metamask.unconfTxs
var unconfMsgs = state.metamask.unconfMsgs var unconfMsgs = state.metamask.unconfMsgs
var unconfTxList = txHelper(unconfTxs, unconfMsgs) var network = state.metamask.network
var unconfTxList = txHelper(unconfTxs, unconfMsgs, network)
return unconfTxList.length > 0 return unconfTxList.length > 0
} }
function indexForPending (state, txId) { function indexForPending (state, txId) {
var unconfTxs = state.metamask.unconfTxs var unconfTxs = state.metamask.unconfTxs
var unconfMsgs = state.metamask.unconfMsgs var unconfMsgs = state.metamask.unconfMsgs
var unconfTxList = txHelper(unconfTxs, unconfMsgs) var network = state.metamask.network
var unconfTxList = txHelper(unconfTxs, unconfMsgs, network)
let idx let idx
unconfTxList.forEach((tx, i) => { unconfTxList.forEach((tx, i) => {
if (tx.id === txId) { if (tx.id === txId) {

@ -3,7 +3,7 @@ const h = require('react-hyperscript')
const Root = require('./app/root') const Root = require('./app/root')
const actions = require('./app/actions') const actions = require('./app/actions')
const configureStore = require('./app/store') const configureStore = require('./app/store')
const txHelper = require('./lib/tx-helper')
module.exports = launchApp module.exports = launchApp
function launchApp (opts) { function launchApp (opts) {
@ -34,7 +34,8 @@ function startApp (metamaskState, accountManager, opts) {
}) })
// if unconfirmed txs, start on txConf page // if unconfirmed txs, start on txConf page
if (Object.keys(metamaskState.unconfTxs || {}).length) { var unconfirmedTxsAll = txHelper(metamaskState.unconfTxs, metamaskState.unconfMsgs, metamaskState.network)
if (unconfirmedTxsAll.length > 0) {
store.dispatch(actions.showConfTxPage()) store.dispatch(actions.showConfTxPage())
} }

@ -1,7 +1,7 @@
const valuesFor = require('../app/util').valuesFor const valuesFor = require('../app/util').valuesFor
module.exports = function (unconfTxs, unconfMsgs) { module.exports = function (unconfTxs, unconfMsgs, network) {
var txValues = valuesFor(unconfTxs) var txValues = network ? valuesFor(unconfTxs).filter(tx => tx.txParams.metamaskNetworkId === network) : valuesFor(unconfTxs)
var msgValues = valuesFor(unconfMsgs) var msgValues = valuesFor(unconfMsgs)
var allValues = txValues.concat(msgValues) var allValues = txValues.concat(msgValues)
return allValues.sort(tx => tx.time) return allValues.sort(tx => tx.time)

Loading…
Cancel
Save