aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/reducers
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-05-04 05:32:22 +0800
committerDan Finlay <dan@danfinlay.com>2016-05-04 05:32:22 +0800
commite6c4d63ccdaf93d8b74965d39661e80d774504d8 (patch)
tree28ba41a15fb93ac94f3ea1a8ff0dae637655119b /ui/app/reducers
parentdcbf17af2d547ce676178bf78328d5c01135e31a (diff)
downloadtangerine-wallet-browser-e6c4d63ccdaf93d8b74965d39661e80d774504d8.tar.gz
tangerine-wallet-browser-e6c4d63ccdaf93d8b74965d39661e80d774504d8.tar.zst
tangerine-wallet-browser-e6c4d63ccdaf93d8b74965d39661e80d774504d8.zip
Add UI for Signing Messages
Calls to `eth.sign` are now transiently persisted in memory, and displayed in a chronological stack with pending transactions (which are still persisted to disk). This allows the user a method to sign/cancel transactions even if they miss the Chrome notification. Improved a lot of the view routing, to avoid cases where routes would show an empty account view, or transition to the accounts list when it shouldn't. Broke the transaction approval view into a couple components so messages and transactions could have their own templates.
Diffstat (limited to 'ui/app/reducers')
-rw-r--r--ui/app/reducers/app.js27
-rw-r--r--ui/app/reducers/metamask.js8
2 files changed, 27 insertions, 8 deletions
diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js
index 57cdccbac..fb03ffeee 100644
--- a/ui/app/reducers/app.js
+++ b/ui/app/reducers/app.js
@@ -1,6 +1,7 @@
const extend = require('xtend')
const actions = require('../actions')
const valuesFor = require('../util').valuesFor
+const txHelper = require('../../lib/tx-helper')
module.exports = reduceApp
@@ -127,10 +128,7 @@ function reduceApp(state, action) {
case actions.GO_HOME:
return extend(appState, {
- currentView: {
- name: 'accountDetail',
- context: appState.currentView.context,
- },
+ currentView: {},
accountDetail: {
accountExport: 'none',
privateKey: '',
@@ -185,9 +183,24 @@ function reduceApp(state, action) {
warning: null,
})
+ case actions.SHOW_CONF_MSG_PAGE:
+ return extend(appState, {
+ currentView: {
+ name: 'confTx',
+ context: 0,
+ },
+ transForward: true,
+ warning: null,
+ })
+
case actions.COMPLETED_TX:
- var unconfTxs = Object.keys(state.metamask.unconfTxs).filter(tx => tx !== tx.id)
- if (unconfTxs && unconfTxs.length > 0) {
+ var unconfTxs = state.metamask.unconfTxs
+ var unconfMsgs = state.metamask.unconfMsgs
+
+ var unconfTxList = txHelper(unconfTxs, unconfMsgs)
+ .filter(tx => tx !== tx.id)
+
+ if (unconfTxList && unconfTxList.length > 0) {
return extend(appState, {
transForward: false,
currentView: {
@@ -202,7 +215,7 @@ function reduceApp(state, action) {
warning: null,
currentView: {
name: 'accountDetail',
- context: appState.currentView.context,
+ context: state.metamask.selectedAddress,
},
})
}
diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js
index 43bb3f761..2fe96c453 100644
--- a/ui/app/reducers/metamask.js
+++ b/ui/app/reducers/metamask.js
@@ -44,13 +44,19 @@ function reduceMetamask(state, action) {
case actions.COMPLETED_TX:
var stringId = String(action.id)
var newState = extend(metamaskState, {
- unconfTxs: {}
+ unconfTxs: {},
+ unconfMsgs: {},
})
for (var id in metamaskState.unconfTxs) {
if (id !== stringId) {
newState.unconfTxs[id] = metamaskState.unconfTxs[id]
}
}
+ for (var id in metamaskState.unconfMsgs) {
+ if (id !== stringId) {
+ newState.unconfMsgs[id] = metamaskState.unconfMsgs[id]
+ }
+ }
return newState
case actions.CLEAR_SEED_WORD_CACHE: