aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/reducers/metamask.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-06-22 04:18:32 +0800
committerDan Finlay <dan@danfinlay.com>2016-06-22 04:18:32 +0800
commita08c3bc01b11fbd0e3a243359befbe9fc909edf4 (patch)
treeb79b7324139945c429ca4b6c74715d8040fdf4e1 /ui/app/reducers/metamask.js
parentf7f8f8b1c50be39db22a7b10c6c6db007fe590aa (diff)
downloadtangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar.gz
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar.bz2
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar.lz
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar.xz
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar.zst
tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.zip
Auto linted
Diffstat (limited to 'ui/app/reducers/metamask.js')
-rw-r--r--ui/app/reducers/metamask.js185
1 files changed, 92 insertions, 93 deletions
diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js
index 646100120..670312830 100644
--- a/ui/app/reducers/metamask.js
+++ b/ui/app/reducers/metamask.js
@@ -3,8 +3,7 @@ const actions = require('../actions')
module.exports = reduceMetamask
-function reduceMetamask(state, action) {
-
+function reduceMetamask (state, action) {
// clone + defaults
var metamaskState = extend({
isInitialized: false,
@@ -17,99 +16,99 @@ function reduceMetamask(state, action) {
switch (action.type) {
- case actions.SHOW_ACCOUNTS_PAGE:
- var state = extend(metamaskState)
- delete state.seedWords
- return state
-
- case actions.UPDATE_METAMASK_STATE:
- return extend(metamaskState, action.value)
-
- case actions.AGREE_TO_DISCLAIMER:
- return extend(metamaskState, {
- isConfirmed: true,
- })
-
- case actions.UNLOCK_METAMASK:
- return extend(metamaskState, {
- isUnlocked: true,
- isInitialized: true,
- selectedAccount: action.value,
- })
-
- case actions.LOCK_METAMASK:
- return extend(metamaskState, {
- isUnlocked: false,
- })
-
- case actions.SET_RPC_TARGET:
- return extend(metamaskState, {
- provider: {
- type: 'rpc',
- rpcTarget: action.value,
- },
- })
-
- case actions.SET_PROVIDER_TYPE:
- return extend(metamaskState, {
- provider: {
- type: action.value,
- },
- })
-
- case actions.COMPLETED_TX:
- var stringId = String(action.id)
- var newState = extend(metamaskState, {
- unconfTxs: {},
- unconfMsgs: {},
- })
- for (var id in metamaskState.unconfTxs) {
- if (id !== stringId) {
- newState.unconfTxs[id] = metamaskState.unconfTxs[id]
+ case actions.SHOW_ACCOUNTS_PAGE:
+ var state = extend(metamaskState)
+ delete state.seedWords
+ return state
+
+ case actions.UPDATE_METAMASK_STATE:
+ return extend(metamaskState, action.value)
+
+ case actions.AGREE_TO_DISCLAIMER:
+ return extend(metamaskState, {
+ isConfirmed: true,
+ })
+
+ case actions.UNLOCK_METAMASK:
+ return extend(metamaskState, {
+ isUnlocked: true,
+ isInitialized: true,
+ selectedAccount: action.value,
+ })
+
+ case actions.LOCK_METAMASK:
+ return extend(metamaskState, {
+ isUnlocked: false,
+ })
+
+ case actions.SET_RPC_TARGET:
+ return extend(metamaskState, {
+ provider: {
+ type: 'rpc',
+ rpcTarget: action.value,
+ },
+ })
+
+ case actions.SET_PROVIDER_TYPE:
+ return extend(metamaskState, {
+ provider: {
+ type: action.value,
+ },
+ })
+
+ case actions.COMPLETED_TX:
+ var stringId = String(action.id)
+ var newState = extend(metamaskState, {
+ 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]
+ for (var id in metamaskState.unconfMsgs) {
+ if (id !== stringId) {
+ newState.unconfMsgs[id] = metamaskState.unconfMsgs[id]
+ }
}
- }
- return newState
-
- case actions.SHOW_NEW_VAULT_SEED:
- return extend(metamaskState, {
- isUnlocked: true,
- isInitialized: false,
- })
-
- case actions.CLEAR_SEED_WORD_CACHE:
- var newState = extend(metamaskState, {
- isUnlocked: true,
- isInitialized: true,
- selectedAccount: action.value,
- })
- delete newState.seedWords
- return newState
-
- case actions.SHOW_ACCOUNT_DETAIL:
- const newState = extend(metamaskState, {
- isUnlocked: true,
- isInitialized: true,
- selectedAccount: action.value,
- selectedAddress: action.value,
- })
- delete newState.seedWords
- return newState
-
- case actions.SAVE_ACCOUNT_LABEL:
- const account = action.value.account
- const name = action.value.label
- var id = {}
- id[account] = extend(metamaskState.identities[account], { name })
- var identities = extend(metamaskState.identities, id)
- return extend(metamaskState, { identities })
-
- default:
- return metamaskState
+ return newState
+
+ case actions.SHOW_NEW_VAULT_SEED:
+ return extend(metamaskState, {
+ isUnlocked: true,
+ isInitialized: false,
+ })
+
+ case actions.CLEAR_SEED_WORD_CACHE:
+ var newState = extend(metamaskState, {
+ isUnlocked: true,
+ isInitialized: true,
+ selectedAccount: action.value,
+ })
+ delete newState.seedWords
+ return newState
+
+ case actions.SHOW_ACCOUNT_DETAIL:
+ const newState = extend(metamaskState, {
+ isUnlocked: true,
+ isInitialized: true,
+ selectedAccount: action.value,
+ selectedAddress: action.value,
+ })
+ delete newState.seedWords
+ return newState
+
+ case actions.SAVE_ACCOUNT_LABEL:
+ const account = action.value.account
+ const name = action.value.label
+ var id = {}
+ id[account] = extend(metamaskState.identities[account], { name })
+ var identities = extend(metamaskState.identities, id)
+ return extend(metamaskState, { identities })
+
+ default:
+ return metamaskState
}
}