From 414d0b0d01b0b0037290ecc9af5b69fab39c3c42 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Mon, 3 Sep 2018 17:43:17 +0200 Subject: [PATCH] removed web3 references --- src/actions/SelectedAccountActions.js | 5 +---- src/actions/WalletActions.js | 7 +++++-- src/reducers/SelectedAccountReducer.js | 3 --- src/services/RouterService.js | 5 ++--- src/services/TrezorConnectService.js | 7 ++----- src/views/Landing/Container.js | 2 -- 6 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/actions/SelectedAccountActions.js b/src/actions/SelectedAccountActions.js index cb426256..0bacf1b3 100644 --- a/src/actions/SelectedAccountActions.js +++ b/src/actions/SelectedAccountActions.js @@ -47,8 +47,7 @@ export const updateSelectedValues = (prevState: State, action: Action): AsyncAct || prevState.accounts !== state.accounts || prevState.discovery !== state.discovery || prevState.tokens !== state.tokens - || prevState.pending !== state.pending - || prevState.web3 !== state.web3) { + || prevState.pending !== state.pending) { if (locationChange) { // dispose current account view dispatch(dispose()); @@ -59,7 +58,6 @@ export const updateSelectedValues = (prevState: State, action: Action): AsyncAct const discovery = stateUtils.getDiscoveryProcess(state); const tokens = stateUtils.getAccountTokens(state, account); const pending = stateUtils.getAccountPendingTx(state.pending, account); - const web3 = stateUtils.getWeb3(state); const payload: $ElementType = { location: location.pathname, @@ -68,7 +66,6 @@ export const updateSelectedValues = (prevState: State, action: Action): AsyncAct discovery, tokens, pending, - web3, }; let needUpdate: boolean = false; diff --git a/src/actions/WalletActions.js b/src/actions/WalletActions.js index a4bb0040..32830e26 100644 --- a/src/actions/WalletActions.js +++ b/src/actions/WalletActions.js @@ -5,8 +5,11 @@ import { LOCATION_CHANGE } from 'react-router-redux'; import * as WALLET from 'actions/constants/wallet'; import * as stateUtils from 'reducers/utils'; -import type -{ +import type { + Account, + Coin, + Discovery, + Token, Device, TrezorDevice, RouterLocationState, diff --git a/src/reducers/SelectedAccountReducer.js b/src/reducers/SelectedAccountReducer.js index a83b2dca..0500fb13 100644 --- a/src/reducers/SelectedAccountReducer.js +++ b/src/reducers/SelectedAccountReducer.js @@ -10,7 +10,6 @@ import type { Token, PendingTx, Discovery, - Web3Instance, } from 'flowtype'; export type State = { @@ -20,7 +19,6 @@ export type State = { network: ?Coin; tokens: Array, pending: Array, - web3: ?Web3Instance, discovery: ?Discovery }; @@ -30,7 +28,6 @@ export const initialState: State = { network: null, tokens: [], pending: [], - web3: null, discovery: null, }; diff --git a/src/services/RouterService.js b/src/services/RouterService.js index db3157cd..92ba3b4d 100644 --- a/src/services/RouterService.js +++ b/src/services/RouterService.js @@ -72,7 +72,6 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa __unloading = true; } else if (action.type === LOCATION_CHANGE && !__unloading) { const { location } = api.getState().router; - const { web3 } = api.getState(); const { devices } = api.getState(); const { error } = api.getState().connect; @@ -92,8 +91,8 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa redirectPath = '/'; } else { const isModalOpened: boolean = api.getState().modal.opened; - // if web3 wasn't initialized yet or there are no devices attached or initialization error occurs - const landingPage: boolean = web3.length < 1 || devices.length < 1 || error !== null; + // there are no devices attached or initialization error occurs + const landingPage: boolean = devices.length < 1 || error !== null; // modal is still opened and currentPath is still valid // example 1 (valid blocking): url changes while passphrase modal opened but device is still connected (we want user to finish this action) diff --git a/src/services/TrezorConnectService.js b/src/services/TrezorConnectService.js index f69f5b13..f32a17a5 100644 --- a/src/services/TrezorConnectService.js +++ b/src/services/TrezorConnectService.js @@ -7,8 +7,6 @@ import { import * as TrezorConnectActions from 'actions/TrezorConnectActions'; import * as DiscoveryActions from 'actions/DiscoveryActions'; import * as ModalActions from 'actions/ModalActions'; -import { init as initWeb3 } from 'actions/Web3Actions'; -import * as WEB3 from 'actions/constants/web3'; import * as STORAGE from 'actions/constants/localStorage'; import * as CONNECT from 'actions/constants/TrezorConnect'; @@ -32,9 +30,8 @@ const TrezorConnectService: Middleware = (api: MiddlewareAPI) => (next: Middlewa } else if (action.type === TRANSPORT.ERROR) { // TODO: check if modal is open // api.dispatch( push('/') ); - } else if (action.type === TRANSPORT.START && api.getState().web3.length < 1) { - api.dispatch(initWeb3()); - } else if (action.type === WEB3.READY) { + } else if (action.type === TRANSPORT.START) { + // api.dispatch({ type: WEB3.READY }); api.dispatch(TrezorConnectActions.postInit()); } else if (action.type === DEVICE.DISCONNECT) { api.dispatch(TrezorConnectActions.deviceDisconnect(action.device)); diff --git a/src/views/Landing/Container.js b/src/views/Landing/Container.js index da89a4b0..6c891761 100644 --- a/src/views/Landing/Container.js +++ b/src/views/Landing/Container.js @@ -8,7 +8,6 @@ import LandingPage from './index'; export type StateProps = { localStorage: $ElementType, modal: $ElementType, - web3: $ElementType, wallet: $ElementType, connect: $ElementType, router: $ElementType, @@ -29,7 +28,6 @@ export type Props = StateProps & DispatchProps; const mapStateToProps: MapStateToProps = (state: State): StateProps => ({ localStorage: state.localStorage, modal: state.modal, - web3: state.web3, wallet: state.wallet, connect: state.connect, router: state.router,