2017-07-22 21:24:03 +00:00
|
|
|
// @flow
|
2017-07-31 23:14:30 +00: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 17:05:09 +00:00
|
|
|
|
|
|
|
export function changeStepSwap(value: number): ChangeStepSwapAction {
|
2017-06-19 05:39:07 +00:00
|
|
|
return {
|
2017-07-27 17:05:09 +00:00
|
|
|
type: 'SWAP_STEP',
|
2017-06-19 23:47:11 +00:00
|
|
|
value
|
2017-06-19 05:39:07 +00:00
|
|
|
};
|
2017-07-22 21:24:03 +00:00
|
|
|
}
|
2017-06-12 01:00:28 +00:00
|
|
|
|
2017-07-27 17:05:09 +00:00
|
|
|
export function originKindSwap(value: string): OriginKindSwapAction {
|
2017-06-19 05:39:07 +00:00
|
|
|
return {
|
2017-07-27 17:05:09 +00:00
|
|
|
type: 'SWAP_ORIGIN_KIND',
|
2017-06-19 05:39:07 +00:00
|
|
|
value
|
|
|
|
};
|
2017-07-27 17:05:09 +00:00
|
|
|
}
|
2017-06-12 01:00:28 +00:00
|
|
|
|
2017-07-27 17:05:09 +00:00
|
|
|
export function destinationKindSwap(value: string): DestinationKindSwapAction {
|
2017-06-19 05:39:07 +00:00
|
|
|
return {
|
2017-07-27 17:05:09 +00:00
|
|
|
type: 'SWAP_DESTINATION_KIND',
|
2017-06-19 05:39:07 +00:00
|
|
|
value
|
|
|
|
};
|
2017-07-27 17:05:09 +00:00
|
|
|
}
|
2017-06-12 01:00:28 +00:00
|
|
|
|
2017-07-27 17:05:09 +00:00
|
|
|
export function originAmountSwap(value: ?number): OriginAmountSwapAction {
|
2017-06-19 05:39:07 +00:00
|
|
|
return {
|
2017-07-27 17:05:09 +00:00
|
|
|
type: 'SWAP_ORIGIN_AMOUNT',
|
2017-06-19 05:39:07 +00:00
|
|
|
value
|
|
|
|
};
|
2017-07-27 17:05:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function destinationAmountSwap(
|
2017-07-22 21:24:03 +00:00
|
|
|
value: ?number
|
2017-07-27 17:05:09 +00:00
|
|
|
): DestinationAmountSwapAction {
|
2017-06-24 01:25:12 +00:00
|
|
|
return {
|
2017-07-27 17:05:09 +00:00
|
|
|
type: 'SWAP_DESTINATION_AMOUNT',
|
2017-06-24 01:25:12 +00:00
|
|
|
value
|
|
|
|
};
|
2017-07-27 17:05:09 +00:00
|
|
|
}
|
|
|
|
|
2017-07-31 23:14:30 +00:00
|
|
|
export function loadBityRatesSucceededSwap(
|
2017-07-27 17:05:09 +00:00
|
|
|
value: Pairs
|
2017-07-31 23:14:30 +00:00
|
|
|
): LoadBityRatesSucceededSwapAction {
|
2017-06-24 06:08:33 +00:00
|
|
|
return {
|
2017-07-31 23:14:30 +00:00
|
|
|
type: 'SWAP_LOAD_BITY_RATES_SUCCEEDED',
|
2017-06-24 06:08:33 +00:00
|
|
|
value
|
|
|
|
};
|
2017-07-27 17:05:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function destinationAddressSwap(
|
2017-07-22 21:24:03 +00:00
|
|
|
value: ?string
|
2017-07-27 17:05:09 +00:00
|
|
|
): DestinationAddressSwapAction {
|
2017-07-02 05:45:22 +00:00
|
|
|
return {
|
2017-07-27 17:05:09 +00:00
|
|
|
type: 'SWAP_DESTINATION_ADDRESS',
|
2017-07-02 05:45:22 +00:00
|
|
|
value
|
|
|
|
};
|
2017-07-27 17:05:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function restartSwap(): RestartSwapAction {
|
2017-07-02 05:45:22 +00:00
|
|
|
return {
|
2017-07-27 17:05:09 +00:00
|
|
|
type: 'SWAP_RESTART'
|
2017-07-02 05:45:22 +00:00
|
|
|
};
|
2017-07-27 17:05:09 +00:00
|
|
|
}
|
|
|
|
|
2017-07-31 23:14:30 +00:00
|
|
|
export function loadBityRatesRequestedSwap(): LoadBityRatesRequestedSwapAction {
|
2017-07-08 02:00:09 +00:00
|
|
|
return {
|
2017-07-31 23:14:30 +00:00
|
|
|
type: 'SWAP_LOAD_BITY_RATES_REQUESTED'
|
2017-07-08 02:00:09 +00:00
|
|
|
};
|
2017-07-27 17:05:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function stopLoadBityRatesSwap(): StopLoadBityRatesSwapAction {
|
2017-07-09 03:51:14 +00:00
|
|
|
return {
|
2017-07-27 17:05:09 +00:00
|
|
|
type: 'SWAP_STOP_LOAD_BITY_RATES'
|
2017-07-09 03:51:14 +00:00
|
|
|
};
|
2017-07-27 17:05:09 +00:00
|
|
|
}
|
|
|
|
|
2017-07-31 23:14:30 +00: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'
|
|
|
|
};
|
|
|
|
}
|