1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-15 21:08:57 +00:00
trezor-wallet/src/js/reducers/SelectedAccountReducer.js

45 lines
802 B
JavaScript
Raw Normal View History

2018-02-20 09:30:36 +00:00
/* @flow */
2018-07-30 10:52:13 +00:00
2018-02-20 09:30:36 +00:00
import * as ACCOUNT from '../actions/constants/account';
2018-07-30 10:52:13 +00:00
import type {
Action,
Account,
Coin,
Token,
PendingTx,
Discovery,
2018-07-30 10:52:13 +00:00
Web3Instance,
2018-08-14 12:56:47 +00:00
} from 'flowtype';
2018-04-16 21:19:50 +00:00
2018-02-20 09:30:36 +00:00
export type State = {
location?: string;
account: ?Account;
network: ?Coin;
tokens: Array<Token>,
pending: Array<PendingTx>,
web3: ?Web3Instance,
discovery: ?Discovery
2018-02-20 09:30:36 +00:00
};
export const initialState: State = {
location: '/',
account: null,
network: null,
tokens: [],
pending: [],
web3: null,
2018-07-30 10:52:13 +00:00
discovery: null,
};
2018-02-20 09:30:36 +00:00
export default (state: State = initialState, action: Action): State => {
2018-02-20 09:30:36 +00:00
switch (action.type) {
2018-07-30 10:52:13 +00:00
case ACCOUNT.UPDATE_SELECTED_ACCOUNT:
return action.payload;
2018-02-20 09:30:36 +00:00
default:
return state;
}
2018-07-30 10:52:13 +00:00
};