2020-05-06 20:56:09 +02:00
|
|
|
import * as actionConstants from '../../store/actionConstants'
|
2020-05-08 21:45:52 +02:00
|
|
|
import { ALERT_TYPES } from '../../../../app/scripts/controllers/alert'
|
2016-04-14 00:28:44 +02:00
|
|
|
|
2020-02-06 17:38:14 +01:00
|
|
|
export default function reduceMetamask (state = {}, action) {
|
2020-01-13 17:29:21 +01:00
|
|
|
const metamaskState = Object.assign({
|
2016-04-14 00:28:44 +02:00
|
|
|
isInitialized: false,
|
|
|
|
isUnlocked: false,
|
2017-10-16 07:28:25 +02:00
|
|
|
isAccountMenuOpen: false,
|
2016-04-14 00:28:44 +02:00
|
|
|
rpcTarget: 'https://rawtestrpc.metamask.io/',
|
|
|
|
identities: {},
|
2017-01-28 01:11:59 +01:00
|
|
|
unapprovedTxs: {},
|
2017-03-08 01:01:51 +01:00
|
|
|
frequentRpcList: [],
|
2017-03-09 22:58:42 +01:00
|
|
|
addressBook: [],
|
2017-09-06 12:17:49 +02:00
|
|
|
selectedTokenAddress: null,
|
2018-04-16 05:37:42 +02:00
|
|
|
contractExchangeRates: {},
|
2017-10-03 19:25:52 +02:00
|
|
|
tokens: [],
|
2018-05-20 08:04:19 +02:00
|
|
|
pendingTokens: {},
|
2019-09-27 06:30:36 +02:00
|
|
|
customNonceValue: '',
|
2017-10-12 18:42:14 +02:00
|
|
|
send: {
|
|
|
|
gasLimit: null,
|
|
|
|
gasPrice: null,
|
2017-10-17 19:22:23 +02:00
|
|
|
gasTotal: null,
|
2018-11-20 01:06:34 +01:00
|
|
|
tokenBalance: '0x0',
|
2017-10-17 19:22:23 +02:00
|
|
|
from: '',
|
|
|
|
to: '',
|
2019-02-25 19:16:23 +01:00
|
|
|
amount: '0',
|
2017-10-17 19:22:23 +02:00
|
|
|
memo: '',
|
2017-10-17 22:13:20 +02:00
|
|
|
errors: {},
|
2017-11-16 19:14:25 +01:00
|
|
|
maxModeOn: false,
|
2017-11-08 17:44:48 +01:00
|
|
|
editingTransactionId: null,
|
2018-03-26 15:30:54 +02:00
|
|
|
toNickname: '',
|
2019-07-31 21:56:44 +02:00
|
|
|
ensResolution: null,
|
|
|
|
ensResolutionError: '',
|
2017-10-12 18:42:14 +02:00
|
|
|
},
|
2017-09-25 23:51:49 +02:00
|
|
|
coinOptions: {},
|
2017-11-24 02:33:44 +01:00
|
|
|
useBlockie: false,
|
2017-11-14 17:04:55 +01:00
|
|
|
featureFlags: {},
|
2020-01-09 04:34:58 +01:00
|
|
|
networkEndpointType: undefined,
|
2018-03-08 18:31:21 +01:00
|
|
|
welcomeScreenSeen: false,
|
2018-03-23 17:59:59 +01:00
|
|
|
currentLocale: '',
|
2018-10-17 01:03:29 +02:00
|
|
|
preferences: {
|
2020-05-13 16:53:00 +02:00
|
|
|
autoLockTimeLimit: undefined,
|
2019-02-26 19:30:41 +01:00
|
|
|
showFiatInTestnets: false,
|
2020-05-13 16:53:00 +02:00
|
|
|
useNativeCurrencyAsPrimaryCurrency: true,
|
2018-10-17 01:03:29 +02:00
|
|
|
},
|
2019-03-05 16:45:01 +01:00
|
|
|
firstTimeFlowType: null,
|
2019-01-23 16:25:34 +01:00
|
|
|
completedOnboarding: false,
|
2019-01-22 19:22:56 +01:00
|
|
|
knownMethodData: {},
|
2019-03-05 16:45:01 +01:00
|
|
|
participateInMetaMetrics: null,
|
|
|
|
metaMetricsSendCount: 0,
|
2019-09-27 06:30:36 +02:00
|
|
|
nextNonce: null,
|
2020-02-06 17:38:14 +01:00
|
|
|
}, state)
|
2016-04-14 00:28:44 +02:00
|
|
|
|
|
|
|
switch (action.type) {
|
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.UPDATE_METAMASK_STATE:
|
2020-01-13 17:29:21 +01:00
|
|
|
return { ...metamaskState, ...action.value }
|
2016-06-21 22:18:32 +02:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.LOCK_METAMASK:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2016-06-21 22:18:32 +02:00
|
|
|
isUnlocked: false,
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2016-06-21 22:18:32 +02:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.SET_RPC_TARGET:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2016-06-21 22:18:32 +02:00
|
|
|
provider: {
|
|
|
|
type: 'rpc',
|
2017-03-07 19:25:50 +01:00
|
|
|
rpcTarget: action.value,
|
2016-06-21 22:18:32 +02:00
|
|
|
},
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2016-06-21 22:18:32 +02:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.SET_PROVIDER_TYPE:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2016-06-21 22:18:32 +02:00
|
|
|
provider: {
|
|
|
|
type: action.value,
|
|
|
|
},
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2016-06-21 22:18:32 +02:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.SHOW_ACCOUNT_DETAIL:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2016-06-21 22:18:32 +02:00
|
|
|
isUnlocked: true,
|
|
|
|
isInitialized: true,
|
2017-01-31 00:08:31 +01:00
|
|
|
selectedAddress: action.value,
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2016-06-21 22:18:32 +02:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.SET_SELECTED_TOKEN: {
|
2020-02-06 17:38:14 +01:00
|
|
|
const newState = {
|
2020-01-13 17:29:21 +01:00
|
|
|
...metamaskState,
|
2017-09-06 12:17:49 +02:00
|
|
|
selectedTokenAddress: action.value,
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
|
|
|
const newSend = { ...metamaskState.send }
|
2019-04-17 21:15:13 +02:00
|
|
|
|
|
|
|
if (metamaskState.send.editingTransactionId && !action.value) {
|
|
|
|
delete newSend.token
|
|
|
|
const unapprovedTx = newState.unapprovedTxs[newSend.editingTransactionId] || {}
|
|
|
|
const txParams = unapprovedTx.txParams || {}
|
2020-01-13 17:29:21 +01:00
|
|
|
newState.unapprovedTxs = {
|
|
|
|
...newState.unapprovedTxs,
|
|
|
|
[newSend.editingTransactionId]: {
|
|
|
|
...unapprovedTx,
|
|
|
|
txParams: { ...txParams, data: '' },
|
|
|
|
},
|
|
|
|
}
|
2019-04-17 21:15:13 +02:00
|
|
|
newSend.tokenBalance = null
|
|
|
|
newSend.balance = '0'
|
2020-03-06 22:34:56 +01:00
|
|
|
newSend.from = unapprovedTx.from || ''
|
2019-04-17 21:15:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
newState.send = newSend
|
|
|
|
return newState
|
2020-02-06 17:38:14 +01:00
|
|
|
}
|
2017-09-06 12:17:49 +02:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.SET_ACCOUNT_LABEL:
|
2016-06-21 22:18:32 +02:00
|
|
|
const account = action.value.account
|
|
|
|
const name = action.value.label
|
2017-11-08 20:18:27 +01:00
|
|
|
const id = {}
|
2020-01-13 17:29:21 +01:00
|
|
|
id[account] = Object.assign({}, metamaskState.identities[account], { name })
|
|
|
|
const identities = Object.assign({}, metamaskState.identities, id)
|
|
|
|
return Object.assign(metamaskState, { identities })
|
2016-06-21 22:18:32 +02:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.SET_CURRENT_FIAT:
|
2020-01-13 17:29:21 +01:00
|
|
|
return Object.assign(metamaskState, {
|
2017-03-15 01:06:16 +01:00
|
|
|
currentCurrency: action.value.currentCurrency,
|
2016-07-21 19:15:34 +02:00
|
|
|
conversionRate: action.value.conversionRate,
|
2016-07-21 23:08:26 +02:00
|
|
|
conversionDate: action.value.conversionDate,
|
2016-07-21 19:15:34 +02:00
|
|
|
})
|
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.UPDATE_TOKENS:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2017-10-03 19:25:52 +02:00
|
|
|
tokens: action.newTokens,
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2017-10-03 19:25:52 +02:00
|
|
|
|
2017-10-17 19:22:23 +02:00
|
|
|
// metamask.send
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.UPDATE_GAS_LIMIT:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2017-10-12 18:42:14 +02:00
|
|
|
send: {
|
|
|
|
...metamaskState.send,
|
|
|
|
gasLimit: action.value,
|
|
|
|
},
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.UPDATE_CUSTOM_NONCE:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2019-09-27 06:30:36 +02:00
|
|
|
customNonceValue: action.value,
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.UPDATE_GAS_PRICE:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2017-10-12 18:42:14 +02:00
|
|
|
send: {
|
|
|
|
...metamaskState.send,
|
|
|
|
gasPrice: action.value,
|
|
|
|
},
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2017-10-12 18:42:14 +02:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.TOGGLE_ACCOUNT_MENU:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2017-10-16 07:28:25 +02:00
|
|
|
isAccountMenuOpen: !metamaskState.isAccountMenuOpen,
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2017-10-16 07:28:25 +02:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.UPDATE_GAS_TOTAL:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2017-10-17 19:22:23 +02:00
|
|
|
send: {
|
|
|
|
...metamaskState.send,
|
|
|
|
gasTotal: action.value,
|
|
|
|
},
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2017-10-17 19:22:23 +02:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.UPDATE_SEND_TOKEN_BALANCE:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2017-10-30 18:48:50 +01:00
|
|
|
send: {
|
|
|
|
...metamaskState.send,
|
|
|
|
tokenBalance: action.value,
|
|
|
|
},
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2017-10-30 18:48:50 +01:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.UPDATE_SEND_HEX_DATA:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2018-07-17 00:31:36 +02:00
|
|
|
send: {
|
|
|
|
...metamaskState.send,
|
|
|
|
data: action.value,
|
|
|
|
},
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2018-07-17 00:31:36 +02:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.UPDATE_SEND_TO:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2017-10-17 19:22:23 +02:00
|
|
|
send: {
|
|
|
|
...metamaskState.send,
|
2018-03-26 15:30:54 +02:00
|
|
|
to: action.value.to,
|
|
|
|
toNickname: action.value.nickname,
|
2017-10-17 19:22:23 +02:00
|
|
|
},
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2017-10-17 19:22:23 +02:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.UPDATE_SEND_AMOUNT:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2017-10-17 19:22:23 +02:00
|
|
|
send: {
|
|
|
|
...metamaskState.send,
|
|
|
|
amount: action.value,
|
|
|
|
},
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2017-10-17 19:22:23 +02:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.UPDATE_MAX_MODE:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2017-11-16 19:14:25 +01:00
|
|
|
send: {
|
|
|
|
...metamaskState.send,
|
|
|
|
maxModeOn: action.value,
|
|
|
|
},
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2017-11-16 19:14:25 +01:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.UPDATE_SEND:
|
2020-01-13 17:29:21 +01:00
|
|
|
return Object.assign(metamaskState, {
|
2017-11-10 04:49:16 +01:00
|
|
|
send: {
|
|
|
|
...metamaskState.send,
|
|
|
|
...action.value,
|
|
|
|
},
|
2019-07-31 21:56:44 +02:00
|
|
|
})
|
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.UPDATE_SEND_ENS_RESOLUTION:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2019-07-31 21:56:44 +02:00
|
|
|
send: {
|
|
|
|
...metamaskState.send,
|
|
|
|
ensResolution: action.payload,
|
|
|
|
ensResolutionError: '',
|
|
|
|
},
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2019-07-31 21:56:44 +02:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.UPDATE_SEND_ENS_RESOLUTION_ERROR:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2019-07-31 21:56:44 +02:00
|
|
|
send: {
|
|
|
|
...metamaskState.send,
|
|
|
|
ensResolution: null,
|
|
|
|
ensResolutionError: action.payload,
|
|
|
|
},
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2017-11-10 04:49:16 +01:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.CLEAR_SEND:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2017-10-21 04:05:22 +02:00
|
|
|
send: {
|
|
|
|
gasLimit: null,
|
|
|
|
gasPrice: null,
|
|
|
|
gasTotal: null,
|
2017-11-10 04:49:16 +01:00
|
|
|
tokenBalance: null,
|
2017-10-21 04:05:22 +02:00
|
|
|
from: '',
|
|
|
|
to: '',
|
|
|
|
amount: '0x0',
|
|
|
|
memo: '',
|
|
|
|
errors: {},
|
2018-10-10 10:12:25 +02:00
|
|
|
maxModeOn: false,
|
2017-11-10 04:49:16 +01:00
|
|
|
editingTransactionId: null,
|
2018-10-10 10:12:25 +02:00
|
|
|
toNickname: '',
|
2017-10-21 04:05:22 +02:00
|
|
|
},
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2017-10-21 04:05:22 +02:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.UPDATE_TRANSACTION_PARAMS:
|
2017-11-08 20:18:27 +01:00
|
|
|
const { id: txId, value } = action
|
2020-03-06 22:34:56 +01:00
|
|
|
let { currentNetworkTxList } = metamaskState
|
|
|
|
currentNetworkTxList = currentNetworkTxList.map((tx) => {
|
2017-11-08 20:18:27 +01:00
|
|
|
if (tx.id === txId) {
|
2019-11-28 23:59:15 +01:00
|
|
|
const newTx = Object.assign({}, tx)
|
|
|
|
newTx.txParams = value
|
|
|
|
return newTx
|
2017-11-08 17:44:48 +01:00
|
|
|
}
|
|
|
|
return tx
|
|
|
|
})
|
|
|
|
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2020-03-06 22:34:56 +01:00
|
|
|
currentNetworkTxList,
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2017-11-08 17:44:48 +01:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.SET_PARTICIPATE_IN_METAMETRICS:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2019-03-05 16:45:01 +01:00
|
|
|
participateInMetaMetrics: action.value,
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2019-03-05 16:45:01 +01:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.SET_METAMETRICS_SEND_COUNT:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2019-03-05 16:45:01 +01:00
|
|
|
metaMetricsSendCount: action.value,
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2019-03-05 16:45:01 +01:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.SET_USE_BLOCKIE:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2018-10-10 10:12:25 +02:00
|
|
|
useBlockie: action.value,
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2017-11-24 02:33:44 +01:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.UPDATE_FEATURE_FLAGS:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2017-11-14 17:04:55 +01:00
|
|
|
featureFlags: action.value,
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2017-11-14 17:04:55 +01:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.CLOSE_WELCOME_SCREEN:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2018-03-08 18:31:21 +01:00
|
|
|
welcomeScreenSeen: true,
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2018-03-08 18:31:21 +01:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.SET_CURRENT_LOCALE:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2019-09-06 15:47:07 +02:00
|
|
|
currentLocale: action.value.locale,
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2018-03-16 01:29:45 +01:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.SET_PENDING_TOKENS:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2018-05-20 08:04:19 +02:00
|
|
|
pendingTokens: { ...action.payload },
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2018-05-20 08:04:19 +02:00
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.CLEAR_PENDING_TOKENS: {
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2018-05-20 08:04:19 +02:00
|
|
|
pendingTokens: {},
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2018-05-20 08:04:19 +02:00
|
|
|
}
|
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.UPDATE_PREFERENCES: {
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2019-02-26 19:30:41 +01:00
|
|
|
preferences: {
|
|
|
|
...metamaskState.preferences,
|
|
|
|
...action.payload,
|
|
|
|
},
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2018-10-17 01:03:29 +02:00
|
|
|
}
|
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.COMPLETE_ONBOARDING: {
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2019-01-23 16:25:34 +01:00
|
|
|
completedOnboarding: true,
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2019-01-23 16:25:34 +01:00
|
|
|
}
|
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.SET_FIRST_TIME_FLOW_TYPE: {
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2019-03-05 16:45:01 +01:00
|
|
|
firstTimeFlowType: action.value,
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2019-03-05 16:45:01 +01:00
|
|
|
}
|
|
|
|
|
2020-04-09 02:35:37 +02:00
|
|
|
case actionConstants.SET_NEXT_NONCE: {
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
|
|
|
...metamaskState,
|
2019-09-27 06:30:36 +02:00
|
|
|
nextNonce: action.value,
|
2020-01-13 17:29:21 +01:00
|
|
|
}
|
2019-09-27 06:30:36 +02:00
|
|
|
}
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
default:
|
|
|
|
return metamaskState
|
2016-04-14 00:28:44 +02:00
|
|
|
}
|
|
|
|
}
|
2020-03-23 18:07:05 +01:00
|
|
|
|
|
|
|
export const getCurrentLocale = (state) => state.metamask.currentLocale
|
2020-05-08 21:45:52 +02:00
|
|
|
|
|
|
|
export const getAlertEnabledness = (state) => state.metamask.alertEnabledness
|
|
|
|
|
2020-05-12 15:01:52 +02:00
|
|
|
export const getSwitchToConnectedAlertEnabledness = (state) => getAlertEnabledness(state)[ALERT_TYPES.switchToConnected]
|
|
|
|
|
2020-05-08 21:45:52 +02:00
|
|
|
export const getUnconnectedAccountAlertEnabledness = (state) => getAlertEnabledness(state)[ALERT_TYPES.unconnectedAccount]
|
2020-05-12 15:01:52 +02:00
|
|
|
|
|
|
|
export const getSwitchToConnectedAlertShown = (state) => state.metamask.switchToConnectedAlertShown
|