1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-28 03:08:30 +00:00

removed web3 references

This commit is contained in:
Szymon Lesisz 2018-09-03 17:43:17 +02:00
parent 021f932ded
commit 414d0b0d01
6 changed files with 10 additions and 19 deletions

View File

@ -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<State, 'selectedAccount'> = {
location: location.pathname,
@ -68,7 +66,6 @@ export const updateSelectedValues = (prevState: State, action: Action): AsyncAct
discovery,
tokens,
pending,
web3,
};
let needUpdate: boolean = false;

View File

@ -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,

View File

@ -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<Token>,
pending: Array<PendingTx>,
web3: ?Web3Instance,
discovery: ?Discovery
};
@ -30,7 +28,6 @@ export const initialState: State = {
network: null,
tokens: [],
pending: [],
web3: null,
discovery: null,
};

View File

@ -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)

View File

@ -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));

View File

@ -8,7 +8,6 @@ import LandingPage from './index';
export type StateProps = {
localStorage: $ElementType<State, 'localStorage'>,
modal: $ElementType<State, 'modal'>,
web3: $ElementType<State, 'web3'>,
wallet: $ElementType<State, 'wallet'>,
connect: $ElementType<State, 'connect'>,
router: $ElementType<State, 'router'>,
@ -29,7 +28,6 @@ export type Props = StateProps & DispatchProps;
const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = (state: State): StateProps => ({
localStorage: state.localStorage,
modal: state.modal,
web3: state.web3,
wallet: state.wallet,
connect: state.connect,
router: state.router,