/* @flow */ 'use strict'; import type { Store as ReduxStore, StoreEnhancer as ReduxStoreEnhancer, Dispatch as ReduxDispatch, Middleware as ReduxMiddleware, MiddlewareAPI as ReduxMiddlewareAPI, ThunkAction as ReduxThunkAction, ThunkDispatch as ReduxThunkDispatch, PlainDispatch as ReduxPlainDispatch } from 'redux'; import type { Reducers, ReducersState } from '../reducers'; // Actions import type { AbstractAccountAction } from '../actions/AbstractAccountActions'; import type { AddressAction } from '../actions/AddressActions'; import type { DiscoveryAction } from '../actions/DiscoveryActions'; import type { StorageAction } from '../actions/LocalStorageActions'; import type { LogAction } from '../actions/LogActions'; import type { ModalAction } from '../actions/ModalActions'; import type { NotificationAction } from '../actions/NotificationActions'; import type { ReceiveAction } from '../actions/ReceiveActions'; import type { SendFormAction } from '../actions/SendFormActions'; import type { SummaryAction } from '../actions/SummaryActions'; import type { TokenAction } from '../actions/TokenActions'; import type { TrezorConnectAction } from '../actions/TrezorConnectActions'; import type { WalletAction } from '../actions/WalletActions'; import type { Web3Action } from '../actions/Web3Actions'; import type { FiatRateAction } from '../services/CoinmarketcapService'; // this service has no action file, all is written inside one file import type { Device, Features, DeviceMessageType, TransportMessageType, UiMessageType, } from 'trezor-connect'; import type { RouterAction, LocationState } from 'react-router-redux'; export type TrezorDevice = { remember: boolean; connected: boolean; available: boolean; // device cannot be used because of features.passphrase_protection is different then expected (saved) path: string; label: string; state: ?string; instance?: number; instanceLabel: string; features?: Features; unacquired?: boolean; acquiring: boolean; isUsedElsewhere?: boolean; featuresNeedsReload?: boolean; ts: number; } export type RouterLocationState = LocationState; // Cast event from TrezorConnect event listener to react Action type DeviceEventAction = { type: DeviceMessageType, device: Device, } type TransportEventAction = { type: TransportMessageType, payload: any, } type UiEventAction = { type: UiMessageType, payload: any, } // TODO: join this message with uiMessage type IFrameHandshake = { type: 'iframe_handshake', payload: any } export type Action = RouterAction | IFrameHandshake | TransportEventAction | DeviceEventAction | UiEventAction | AbstractAccountAction | AddressAction | DiscoveryAction | StorageAction | LogAction | ModalAction | NotificationAction | ReceiveAction | SendFormAction | SummaryAction | TokenAction | TrezorConnectAction | WalletAction | Web3Action | FiatRateAction; export type State = ReducersState; export type Accounts = $ElementType; export type LocalStorage = $ElementType; export type Config = $PropertyType<$ElementType, 'config'>; export type Dispatch = ReduxDispatch; export type MiddlewareDispatch = ReduxPlainDispatch; export type MiddlewareAPI = ReduxMiddlewareAPI; export type Middleware = ReduxMiddleware; export type Store = ReduxStore; export type StoreEnhancer = ReduxStoreEnhancer; export type GetState = () => State; export type AsyncAction = ReduxThunkAction;