You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-wallet/src/reducers/ReceiveReducer.js

55 lines
1.3 KiB

/* @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;
}
};