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.accounts !== state.accounts
|| prevState.discovery !== state.discovery || prevState.discovery !== state.discovery
|| prevState.tokens !== state.tokens || prevState.tokens !== state.tokens
|| prevState.pending !== state.pending || prevState.pending !== state.pending) {
|| prevState.web3 !== state.web3) {
if (locationChange) { if (locationChange) {
// dispose current account view // dispose current account view
dispatch(dispose()); dispatch(dispose());
@ -59,7 +58,6 @@ export const updateSelectedValues = (prevState: State, action: Action): AsyncAct
const discovery = stateUtils.getDiscoveryProcess(state); const discovery = stateUtils.getDiscoveryProcess(state);
const tokens = stateUtils.getAccountTokens(state, account); const tokens = stateUtils.getAccountTokens(state, account);
const pending = stateUtils.getAccountPendingTx(state.pending, account); const pending = stateUtils.getAccountPendingTx(state.pending, account);
const web3 = stateUtils.getWeb3(state);
const payload: $ElementType<State, 'selectedAccount'> = { const payload: $ElementType<State, 'selectedAccount'> = {
location: location.pathname, location: location.pathname,
@ -68,7 +66,6 @@ export const updateSelectedValues = (prevState: State, action: Action): AsyncAct
discovery, discovery,
tokens, tokens,
pending, pending,
web3,
}; };
let needUpdate: boolean = false; 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 WALLET from 'actions/constants/wallet';
import * as stateUtils from 'reducers/utils'; import * as stateUtils from 'reducers/utils';
import type import type {
{ Account,
Coin,
Discovery,
Token,
Device, Device,
TrezorDevice, TrezorDevice,
RouterLocationState, RouterLocationState,

View File

@ -10,7 +10,6 @@ import type {
Token, Token,
PendingTx, PendingTx,
Discovery, Discovery,
Web3Instance,
} from 'flowtype'; } from 'flowtype';
export type State = { export type State = {
@ -20,7 +19,6 @@ export type State = {
network: ?Coin; network: ?Coin;
tokens: Array<Token>, tokens: Array<Token>,
pending: Array<PendingTx>, pending: Array<PendingTx>,
web3: ?Web3Instance,
discovery: ?Discovery discovery: ?Discovery
}; };
@ -30,7 +28,6 @@ export const initialState: State = {
network: null, network: null,
tokens: [], tokens: [],
pending: [], pending: [],
web3: null,
discovery: null, discovery: null,
}; };

View File

@ -72,7 +72,6 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
__unloading = true; __unloading = true;
} else if (action.type === LOCATION_CHANGE && !__unloading) { } else if (action.type === LOCATION_CHANGE && !__unloading) {
const { location } = api.getState().router; const { location } = api.getState().router;
const { web3 } = api.getState();
const { devices } = api.getState(); const { devices } = api.getState();
const { error } = api.getState().connect; const { error } = api.getState().connect;
@ -92,8 +91,8 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
redirectPath = '/'; redirectPath = '/';
} else { } else {
const isModalOpened: boolean = api.getState().modal.opened; const isModalOpened: boolean = api.getState().modal.opened;
// if web3 wasn't initialized yet or there are no devices attached or initialization error occurs // there are no devices attached or initialization error occurs
const landingPage: boolean = web3.length < 1 || devices.length < 1 || error !== null; const landingPage: boolean = devices.length < 1 || error !== null;
// modal is still opened and currentPath is still valid // 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) // 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 TrezorConnectActions from 'actions/TrezorConnectActions';
import * as DiscoveryActions from 'actions/DiscoveryActions'; import * as DiscoveryActions from 'actions/DiscoveryActions';
import * as ModalActions from 'actions/ModalActions'; 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 STORAGE from 'actions/constants/localStorage';
import * as CONNECT from 'actions/constants/TrezorConnect'; import * as CONNECT from 'actions/constants/TrezorConnect';
@ -32,9 +30,8 @@ const TrezorConnectService: Middleware = (api: MiddlewareAPI) => (next: Middlewa
} else if (action.type === TRANSPORT.ERROR) { } else if (action.type === TRANSPORT.ERROR) {
// TODO: check if modal is open // TODO: check if modal is open
// api.dispatch( push('/') ); // api.dispatch( push('/') );
} else if (action.type === TRANSPORT.START && api.getState().web3.length < 1) { } else if (action.type === TRANSPORT.START) {
api.dispatch(initWeb3()); // api.dispatch({ type: WEB3.READY });
} else if (action.type === WEB3.READY) {
api.dispatch(TrezorConnectActions.postInit()); api.dispatch(TrezorConnectActions.postInit());
} else if (action.type === DEVICE.DISCONNECT) { } else if (action.type === DEVICE.DISCONNECT) {
api.dispatch(TrezorConnectActions.deviceDisconnect(action.device)); api.dispatch(TrezorConnectActions.deviceDisconnect(action.device));

View File

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