|
@ -1,7 +1,8 @@ |
|
|
import * as Action from './web3Actions' |
|
|
import * as Action from './web3Actions' |
|
|
|
|
|
import { ACCOUNTS_FAILED } from '../accounts/accountsActions' |
|
|
|
|
|
|
|
|
const initialState = { |
|
|
const initialState = { |
|
|
status: '' |
|
|
status: 'initializing' |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const web3Reducer = (state = initialState, action) => { |
|
|
const web3Reducer = (state = initialState, action) => { |
|
@ -38,14 +39,16 @@ const web3Reducer = (state = initialState, action) => { |
|
|
...state, |
|
|
...state, |
|
|
networkId: action.networkInfo.networkId, |
|
|
networkId: action.networkInfo.networkId, |
|
|
chainId: action.networkInfo.chainId, |
|
|
chainId: action.networkInfo.chainId, |
|
|
nodeInfo: action.networkInfo.nodeInfo |
|
|
nodeInfo: action.networkInfo.nodeInfo, |
|
|
|
|
|
networkFailed: false, |
|
|
|
|
|
networkMismatch: false |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (action.type === Action.WEB3_NETWORK_FAILED) { |
|
|
if (action.type === Action.WEB3_NETWORK_FAILED) { |
|
|
return { |
|
|
return { |
|
|
...state, |
|
|
...state, |
|
|
networkId: action.networkId |
|
|
networkFailed: true |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (action.type === Action.WEB3_NETWORK_MISMATCH) { |
|
|
if (action.type === Action.WEB3_NETWORK_MISMATCH) { |
|
@ -55,6 +58,13 @@ const web3Reducer = (state = initialState, action) => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (action.type === ACCOUNTS_FAILED) { |
|
|
|
|
|
return { |
|
|
|
|
|
...state, |
|
|
|
|
|
accountsFailed: true |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return state |
|
|
return state |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|