mirror of
https://github.com/trezor/trezor-wallet
synced 2025-07-05 14:22:35 +00:00
58 lines
1.3 KiB
JavaScript
58 lines
1.3 KiB
JavaScript
/* @flow */
|
|
'use strict';
|
|
|
|
import { UI } from 'trezor-connect';
|
|
import * as RECEIVE from '../actions/constants/receive';
|
|
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 RECEIVE.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;
|
|
}
|
|
|
|
} |