1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-28 11:18:16 +00:00

Fixed some eslint and flow

This commit is contained in:
Vladimir Volek 2018-10-20 12:12:29 +02:00
parent 35ce9b6a1d
commit 235f5cbdc3
7 changed files with 31 additions and 17 deletions

View File

@ -1,9 +1,23 @@
/* @flow */ /* @flow */
import TrezorConnect from 'trezor-connect'; import TrezorConnect from 'trezor-connect';
import type { GetState, Dispatch } from 'flowtype'; import type {
GetState, Dispatch, ThunkAction, AsyncAction,
} from 'flowtype';
import type { State } from 'reducers/SignVerifyReducer';
import * as NOTIFICATION from 'actions/constants/notification'; import * as NOTIFICATION from 'actions/constants/notification';
import * as SIGN_VERIFY from './constants/signVerify'; import * as SIGN_VERIFY from './constants/signVerify';
export type SignVerifyAction = {
type: typeof SIGN_VERIFY.SIGN_SUCCESS,
signature: string
} | {
type: typeof SIGN_VERIFY.SIGN_PROGRESS,
isSignProgress: boolean
} | {
type: typeof SIGN_VERIFY.CLEAR,
state: State
}
export const sign = ( export const sign = (
path: Array<number>, path: Array<number>,
message: string, message: string,
@ -45,7 +59,7 @@ export const sign = (
actions: [{ actions: [{
label: 'Try again', label: 'Try again',
callback: () => { callback: () => {
dispatch(() => {}); dispatch(sign(path, message, hex));
}, },
}, },
], ],
@ -93,7 +107,7 @@ export const verify = (
{ {
label: 'Try again', label: 'Try again',
callback: () => { callback: () => {
dispatch(() => {}); dispatch(verify(address, message, signature, hex));
}, },
}, },
], ],
@ -106,6 +120,5 @@ export const verify = (
export const clear = (): ThunkAction => (dispatch: Dispatch): void => { export const clear = (): ThunkAction => (dispatch: Dispatch): void => {
dispatch({ dispatch({
type: SIGN_VERIFY.CLEAR, type: SIGN_VERIFY.CLEAR,
signature: '',
}); });
}; };

View File

@ -17,7 +17,6 @@ import InvalidPin from 'components/modals/pin/Invalid';
import Passphrase from 'components/modals/passphrase/Passphrase'; import Passphrase from 'components/modals/passphrase/Passphrase';
import PassphraseType from 'components/modals/passphrase/Type'; import PassphraseType from 'components/modals/passphrase/Type';
import ConfirmSignTx from 'components/modals/confirm/SignTx'; import ConfirmSignTx from 'components/modals/confirm/SignTx';
import ConfirmSignMessage from 'components/modals/confirm/SignMessage';
import ConfirmUnverifiedAddress from 'components/modals/confirm/UnverifiedAddress'; import ConfirmUnverifiedAddress from 'components/modals/confirm/UnverifiedAddress';
import ForgetDevice from 'components/modals/device/Forget'; import ForgetDevice from 'components/modals/device/Forget';
import RememberDevice from 'components/modals/device/Remember'; import RememberDevice from 'components/modals/device/Remember';
@ -91,9 +90,6 @@ const getDeviceContextModal = (props: Props) => {
case 'ButtonRequest_SignTx': case 'ButtonRequest_SignTx':
return <ConfirmSignTx device={modal.device} sendForm={props.sendForm} />; return <ConfirmSignTx device={modal.device} sendForm={props.sendForm} />;
case 'ButtonRequest_SignMessage':
return <ConfirmSignMessage device={modal.device} />;
case RECEIVE.REQUEST_UNVERIFIED: case RECEIVE.REQUEST_UNVERIFIED:
return ( return (
<ConfirmUnverifiedAddress <ConfirmUnverifiedAddress

View File

@ -25,6 +25,7 @@ import type { ModalAction } from 'actions/ModalActions';
import type { NotificationAction } from 'actions/NotificationActions'; import type { NotificationAction } from 'actions/NotificationActions';
import type { PendingTxAction } from 'actions/PendingTxActions'; import type { PendingTxAction } from 'actions/PendingTxActions';
import type { ReceiveAction } from 'actions/ReceiveActions'; import type { ReceiveAction } from 'actions/ReceiveActions';
import type { SignVerifyAction } from 'actions/SignVerifyActions';
import type { SendFormAction } from 'actions/SendFormActions'; import type { SendFormAction } from 'actions/SendFormActions';
import type { SummaryAction } from 'actions/SummaryActions'; import type { SummaryAction } from 'actions/SummaryActions';
import type { TokenAction } from 'actions/TokenActions'; import type { TokenAction } from 'actions/TokenActions';
@ -135,6 +136,7 @@ export type Action =
| DiscoveryAction | DiscoveryAction
| StorageAction | StorageAction
| LogAction | LogAction
| SignVerifyAction
| ModalAction | ModalAction
| NotificationAction | NotificationAction
| PendingTxAction | PendingTxAction

View File

@ -1,13 +1,10 @@
/* @flow */ /* @flow */
import type { Action } from 'flowtype'; import type { Action } from 'flowtype';
import type { NetworkToken } from './LocalStorageReducer';
import * as SIGN_VERIFY from '../actions/constants/signVerify'; import * as SIGN_VERIFY from '../actions/constants/signVerify';
export type State = { export type State = {
details: boolean; signature: string;
selectedToken: ?NetworkToken; isSignProgress: boolean;
} }
export const initialState: State = { export const initialState: State = {

View File

@ -12,6 +12,12 @@ type OwnProps = {}
export type StateProps = { export type StateProps = {
selectedAccount: $ElementType<State, 'selectedAccount'>, selectedAccount: $ElementType<State, 'selectedAccount'>,
signature: string,
isSignProgress: boolean
}
export type DispatchProps = {
signVerifyActions: typeof SignVerifyActions,
} }
export type Props = StateProps & DispatchProps; export type Props = StateProps & DispatchProps;