mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-12 11:28:56 +00:00
55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
/* @flow */
|
|
|
|
import { UI } from 'trezor-connect';
|
|
import * as RECEIVE from 'actions/constants/receive';
|
|
import * as ACCOUNT from 'actions/constants/account';
|
|
import type { Action } from 'flowtype';
|
|
|
|
export type State = {
|
|
addressVerified: boolean,
|
|
addressUnverified: boolean,
|
|
};
|
|
|
|
export const initialState: State = {
|
|
addressVerified: false,
|
|
addressUnverified: false,
|
|
};
|
|
|
|
export default (state: State = initialState, action: Action): State => {
|
|
switch (action.type) {
|
|
case RECEIVE.INIT:
|
|
return action.state;
|
|
|
|
case ACCOUNT.DISPOSE:
|
|
return initialState;
|
|
|
|
case RECEIVE.SHOW_ADDRESS:
|
|
return {
|
|
...state,
|
|
addressVerified: true,
|
|
addressUnverified: false,
|
|
};
|
|
case RECEIVE.HIDE_ADDRESS:
|
|
return initialState;
|
|
|
|
case RECEIVE.SHOW_UNVERIFIED_ADDRESS:
|
|
return {
|
|
...state,
|
|
addressVerified: false,
|
|
addressUnverified: true,
|
|
};
|
|
|
|
case UI.REQUEST_BUTTON:
|
|
if (action.payload.code === 'ButtonRequest_Address') {
|
|
return {
|
|
...state,
|
|
addressVerified: true,
|
|
};
|
|
}
|
|
return state;
|
|
|
|
default:
|
|
return state;
|
|
}
|
|
};
|