diff --git a/src/renderer/redux/actions/shape_shift.js b/src/renderer/redux/actions/shape_shift.js index c2aecefba..5e66e6255 100644 --- a/src/renderer/redux/actions/shape_shift.js +++ b/src/renderer/redux/actions/shape_shift.js @@ -14,6 +14,7 @@ import type { GetActiveShiftFail, } from 'redux/reducers/shape_shift'; import type { FormikActions } from 'types/common'; +import type { Dispatch, ThunkAction } from 'types/redux'; // use promise chains instead of callbacks for shapeshift api const shapeShift = Promise.promisifyAll(require('shapeshift.io')); @@ -38,9 +39,6 @@ export type Action = // Basic thunk types // It would be nice to import these from types/common // Not sure how that would work since they rely on the Action type -type PromiseAction = Promise; -export type Dispatch = (action: Action | PromiseAction | Array) => any; -type ThunkAction = (dispatch: Dispatch) => any; // ShapeShift form values export type ShapeShiftFormValues = { @@ -49,7 +47,7 @@ export type ShapeShiftFormValues = { receiveAddress: string, }; -export const getCoinStats = (coin: string) => (dispatch: Dispatch): ThunkAction => { +export const getCoinStats = (coin: string) => (dispatch: Dispatch): ThunkAction => { const pair = `${coin.toLowerCase()}_lbc`; dispatch({ type: ACTIONS.GET_COIN_STATS_START, data: coin }); @@ -60,7 +58,7 @@ export const getCoinStats = (coin: string) => (dispatch: Dispatch): ThunkAction .catch(err => dispatch({ type: ACTIONS.GET_COIN_STATS_FAIL, data: err })); }; -export const shapeShiftInit = () => (dispatch: Dispatch): ThunkAction => { +export const shapeShiftInit = () => (dispatch: Dispatch): ThunkAction => { dispatch({ type: ACTIONS.GET_SUPPORTED_COINS_START }); return shapeShift @@ -94,8 +92,8 @@ export const shapeShiftInit = () => (dispatch: Dispatch): ThunkAction => { }; export const createShapeShift = (values: ShapeShiftFormValues, actions: FormikActions) => ( - dispatch: Dispatch -): ThunkAction => { + dispatch: Dispatch +): ThunkAction => { const { originCoin, returnAddress, receiveAddress: withdrawalAddress } = values; const pair = `${originCoin.toLowerCase()}_lbc`; @@ -114,7 +112,9 @@ export const createShapeShift = (values: ShapeShiftFormValues, actions: FormikAc }); }; -export const getActiveShift = (depositAddress: string) => (dispatch: Dispatch): ThunkAction => { +export const getActiveShift = (depositAddress: string) => ( + dispatch: Dispatch +): ThunkAction => { dispatch({ type: ACTIONS.GET_ACTIVE_SHIFT_START }); return shapeShift @@ -123,5 +123,5 @@ export const getActiveShift = (depositAddress: string) => (dispatch: Dispatch): .catch(err => dispatch({ type: ACTIONS.GET_ACTIVE_SHIFT_FAIL, data: err })); }; -export const clearShapeShift = () => (dispatch: Dispatch): Action => +export const clearShapeShift = () => (dispatch: Dispatch): Action => dispatch({ type: ACTIONS.CLEAR_SHAPE_SHIFT });