2017-07-22 16:24:03 -05:00
|
|
|
// @flow
|
2017-07-31 18:14:30 -05:00
|
|
|
import type {
|
|
|
|
OriginKindSwapAction,
|
|
|
|
DestinationKindSwapAction,
|
|
|
|
OriginAmountSwapAction,
|
|
|
|
DestinationAmountSwapAction,
|
|
|
|
LoadBityRatesSucceededSwapAction,
|
|
|
|
DestinationAddressSwapAction,
|
|
|
|
BityOrderCreateSucceededSwapAction,
|
|
|
|
BityOrderCreateRequestedSwapAction,
|
|
|
|
OrderStatusSucceededSwapAction,
|
|
|
|
ChangeStepSwapAction,
|
|
|
|
Pairs,
|
|
|
|
RestartSwapAction,
|
|
|
|
LoadBityRatesRequestedSwapAction,
|
|
|
|
StopLoadBityRatesSwapAction,
|
|
|
|
BityOrderResponse,
|
|
|
|
BityOrderPostResponse,
|
|
|
|
OrderStatusRequestedSwapAction,
|
|
|
|
StopOrderTimerSwapAction,
|
|
|
|
StartOrderTimerSwapAction,
|
|
|
|
StartPollBityOrderStatusAction,
|
|
|
|
StopPollBityOrderStatusAction
|
|
|
|
} from './swapTypes';
|
2017-07-27 13:05:09 -04:00
|
|
|
|
|
|
|
export function changeStepSwap(value: number): ChangeStepSwapAction {
|
2017-06-19 00:39:07 -05:00
|
|
|
return {
|
2017-07-27 13:05:09 -04:00
|
|
|
type: 'SWAP_STEP',
|
2017-06-19 18:47:11 -05:00
|
|
|
value
|
2017-06-19 00:39:07 -05:00
|
|
|
};
|
2017-07-22 16:24:03 -05:00
|
|
|
}
|
2017-06-11 20:00:28 -05:00
|
|
|
|
2017-07-27 13:05:09 -04:00
|
|
|
export function originKindSwap(value: string): OriginKindSwapAction {
|
2017-06-19 00:39:07 -05:00
|
|
|
return {
|
2017-07-27 13:05:09 -04:00
|
|
|
type: 'SWAP_ORIGIN_KIND',
|
2017-06-19 00:39:07 -05:00
|
|
|
value
|
|
|
|
};
|
2017-07-27 13:05:09 -04:00
|
|
|
}
|
2017-06-11 20:00:28 -05:00
|
|
|
|
2017-07-27 13:05:09 -04:00
|
|
|
export function destinationKindSwap(value: string): DestinationKindSwapAction {
|
2017-06-19 00:39:07 -05:00
|
|
|
return {
|
2017-07-27 13:05:09 -04:00
|
|
|
type: 'SWAP_DESTINATION_KIND',
|
2017-06-19 00:39:07 -05:00
|
|
|
value
|
|
|
|
};
|
2017-07-27 13:05:09 -04:00
|
|
|
}
|
2017-06-11 20:00:28 -05:00
|
|
|
|
2017-07-27 13:05:09 -04:00
|
|
|
export function originAmountSwap(value: ?number): OriginAmountSwapAction {
|
2017-06-19 00:39:07 -05:00
|
|
|
return {
|
2017-07-27 13:05:09 -04:00
|
|
|
type: 'SWAP_ORIGIN_AMOUNT',
|
2017-06-19 00:39:07 -05:00
|
|
|
value
|
|
|
|
};
|
2017-07-27 13:05:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export function destinationAmountSwap(
|
2017-07-22 16:24:03 -05:00
|
|
|
value: ?number
|
2017-07-27 13:05:09 -04:00
|
|
|
): DestinationAmountSwapAction {
|
2017-06-23 20:25:12 -05:00
|
|
|
return {
|
2017-07-27 13:05:09 -04:00
|
|
|
type: 'SWAP_DESTINATION_AMOUNT',
|
2017-06-23 20:25:12 -05:00
|
|
|
value
|
|
|
|
};
|
2017-07-27 13:05:09 -04:00
|
|
|
}
|
|
|
|
|
2017-07-31 18:14:30 -05:00
|
|
|
export function loadBityRatesSucceededSwap(
|
2017-07-27 13:05:09 -04:00
|
|
|
value: Pairs
|
2017-07-31 18:14:30 -05:00
|
|
|
): LoadBityRatesSucceededSwapAction {
|
2017-06-24 01:08:33 -05:00
|
|
|
return {
|
2017-07-31 18:14:30 -05:00
|
|
|
type: 'SWAP_LOAD_BITY_RATES_SUCCEEDED',
|
2017-06-24 01:08:33 -05:00
|
|
|
value
|
|
|
|
};
|
2017-07-27 13:05:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export function destinationAddressSwap(
|
2017-07-22 16:24:03 -05:00
|
|
|
value: ?string
|
2017-07-27 13:05:09 -04:00
|
|
|
): DestinationAddressSwapAction {
|
2017-07-02 00:45:22 -05:00
|
|
|
return {
|
2017-07-27 13:05:09 -04:00
|
|
|
type: 'SWAP_DESTINATION_ADDRESS',
|
2017-07-02 00:45:22 -05:00
|
|
|
value
|
|
|
|
};
|
2017-07-27 13:05:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export function restartSwap(): RestartSwapAction {
|
2017-07-02 00:45:22 -05:00
|
|
|
return {
|
2017-07-27 13:05:09 -04:00
|
|
|
type: 'SWAP_RESTART'
|
2017-07-02 00:45:22 -05:00
|
|
|
};
|
2017-07-27 13:05:09 -04:00
|
|
|
}
|
|
|
|
|
2017-07-31 18:14:30 -05:00
|
|
|
export function loadBityRatesRequestedSwap(): LoadBityRatesRequestedSwapAction {
|
2017-07-08 06:00:09 +04:00
|
|
|
return {
|
2017-07-31 18:14:30 -05:00
|
|
|
type: 'SWAP_LOAD_BITY_RATES_REQUESTED'
|
2017-07-08 06:00:09 +04:00
|
|
|
};
|
2017-07-27 13:05:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export function stopLoadBityRatesSwap(): StopLoadBityRatesSwapAction {
|
2017-07-08 22:51:14 -05:00
|
|
|
return {
|
2017-07-27 13:05:09 -04:00
|
|
|
type: 'SWAP_STOP_LOAD_BITY_RATES'
|
2017-07-08 22:51:14 -05:00
|
|
|
};
|
2017-07-27 13:05:09 -04:00
|
|
|
}
|
|
|
|
|
2017-07-31 18:14:30 -05:00
|
|
|
export function orderTimeSwap(value: number) {
|
|
|
|
return {
|
|
|
|
type: 'SWAP_ORDER_TIME',
|
|
|
|
value
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function bityOrderCreateSucceededSwap(
|
|
|
|
payload: BityOrderPostResponse
|
|
|
|
): BityOrderCreateSucceededSwapAction {
|
|
|
|
return {
|
|
|
|
type: 'SWAP_BITY_ORDER_CREATE_SUCCEEDED',
|
|
|
|
payload
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function bityOrderCreateRequestedSwap(
|
|
|
|
amount: number,
|
|
|
|
destinationAddress: string,
|
|
|
|
pair: string,
|
|
|
|
mode: number = 0
|
|
|
|
): BityOrderCreateRequestedSwapAction {
|
|
|
|
return {
|
|
|
|
type: 'SWAP_ORDER_CREATE_REQUESTED',
|
|
|
|
payload: {
|
|
|
|
amount,
|
|
|
|
destinationAddress,
|
|
|
|
pair,
|
|
|
|
mode
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function orderStatusSucceededSwap(
|
|
|
|
payload: BityOrderResponse
|
|
|
|
): OrderStatusSucceededSwapAction {
|
|
|
|
return {
|
|
|
|
type: 'SWAP_BITY_ORDER_STATUS_SUCCEEDED',
|
|
|
|
payload
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function orderStatusRequestedSwap(): OrderStatusRequestedSwapAction {
|
|
|
|
return {
|
|
|
|
type: 'SWAP_BITY_ORDER_STATUS_REQUESTED'
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function startOrderTimerSwap(): StartOrderTimerSwapAction {
|
|
|
|
return {
|
|
|
|
type: 'SWAP_ORDER_START_TIMER'
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function stopOrderTimerSwap(): StopOrderTimerSwapAction {
|
|
|
|
return {
|
|
|
|
type: 'SWAP_ORDER_STOP_TIMER'
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function startPollBityOrderStatus(): StartPollBityOrderStatusAction {
|
|
|
|
return {
|
|
|
|
type: 'SWAP_START_POLL_BITY_ORDER_STATUS'
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function stopPollBityOrderStatus(): StopPollBityOrderStatusAction {
|
|
|
|
return {
|
|
|
|
type: 'SWAP_STOP_POLL_BITY_ORDER_STATUS'
|
|
|
|
};
|
|
|
|
}
|