2017-07-22 21:24:03 +00:00
|
|
|
// @flow
|
2017-07-27 17:05:09 +00:00
|
|
|
|
|
|
|
/*** Change Step ***/
|
|
|
|
export type ChangeStepSwapAction = {
|
|
|
|
type: 'SWAP_STEP',
|
|
|
|
value: number
|
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
/*** Change Reference Number ***/
|
|
|
|
export type ReferenceNumberSwapAction = {
|
|
|
|
type: 'SWAP_REFERENCE_NUMBER',
|
2017-07-22 21:24:03 +00:00
|
|
|
value: string
|
2017-07-27 17:05:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export function referenceNumberSwap(value: string): ReferenceNumberSwapAction {
|
2017-06-19 05:39:07 +00:00
|
|
|
return {
|
2017-07-27 17:05:09 +00:00
|
|
|
type: 'SWAP_REFERENCE_NUMBER',
|
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
|
|
|
/*** Change Origin Kind ***/
|
|
|
|
export type OriginKindSwapAction = {
|
|
|
|
type: 'SWAP_ORIGIN_KIND',
|
2017-07-22 21:24:03 +00:00
|
|
|
value: string
|
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
|
|
|
/*** Change Destination Kind ***/
|
|
|
|
export type DestinationKindSwapAction = {
|
|
|
|
type: 'SWAP_DESTINATION_KIND',
|
2017-07-22 21:24:03 +00:00
|
|
|
value: string
|
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
|
|
|
/*** Change Origin Amount ***/
|
|
|
|
export type OriginAmountSwapAction = {
|
|
|
|
type: 'SWAP_ORIGIN_AMOUNT',
|
2017-07-22 21:24:03 +00:00
|
|
|
value: ?number
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/*** Change Destination Amount ***/
|
|
|
|
export type DestinationAmountSwapAction = {
|
|
|
|
type: 'SWAP_DESTINATION_AMOUNT',
|
|
|
|
value: ?number
|
2017-06-19 00:56:11 +00:00
|
|
|
};
|
2017-06-24 01:25:12 +00:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/*** Update Bity Rates ***/
|
|
|
|
export type Pairs = {
|
|
|
|
ETHBTC: number,
|
|
|
|
ETHREP: number,
|
|
|
|
BTCETH: number,
|
|
|
|
BTCREP: number
|
|
|
|
};
|
|
|
|
|
|
|
|
export type BityRatesSwapAction = {
|
|
|
|
type: 'SWAP_UPDATE_BITY_RATES',
|
|
|
|
value: Pairs
|
2017-06-24 01:25:12 +00:00
|
|
|
};
|
2017-06-24 06:08:33 +00:00
|
|
|
|
2017-07-27 17:05:09 +00:00
|
|
|
export function updateBityRatesSwap(value: Pairs): BityRatesSwapAction {
|
2017-06-24 06:08:33 +00:00
|
|
|
return {
|
2017-07-27 17:05:09 +00:00
|
|
|
type: 'SWAP_UPDATE_BITY_RATES',
|
2017-06-24 06:08:33 +00:00
|
|
|
value
|
|
|
|
};
|
2017-07-27 17:05:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** Change Destination Address ***/
|
|
|
|
export type DestinationAddressSwapAction = {
|
|
|
|
type: 'SWAP_DESTINATION_ADDRESS',
|
|
|
|
value: ?string
|
2017-06-24 06:08:33 +00:00
|
|
|
};
|
2017-07-02 05:45:22 +00:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/*** Restart ***/
|
|
|
|
export type RestartSwapAction = {
|
|
|
|
type: 'SWAP_RESTART'
|
2017-07-02 05:45:22 +00:00
|
|
|
};
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/*** Load Bity Rates ***/
|
|
|
|
export type LoadBityRatesSwapAction = {
|
|
|
|
type: 'SWAP_LOAD_BITY_RATES'
|
2017-07-02 05:45:22 +00:00
|
|
|
};
|
2017-07-08 02:00:09 +00:00
|
|
|
|
2017-07-27 17:05:09 +00:00
|
|
|
export function loadBityRatesSwap(): LoadBityRatesSwapAction {
|
2017-07-08 02:00:09 +00:00
|
|
|
return {
|
2017-07-27 17:05:09 +00:00
|
|
|
type: 'SWAP_LOAD_BITY_RATES'
|
2017-07-08 02:00:09 +00:00
|
|
|
};
|
2017-07-27 17:05:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** Stop Loading Bity Rates ***/
|
|
|
|
export type StopLoadBityRatesSwapAction = {
|
|
|
|
type: 'SWAP_STOP_LOAD_BITY_RATES'
|
2017-07-08 02:00:09 +00:00
|
|
|
};
|
2017-07-09 03:51:14 +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
|
|
|
}
|
|
|
|
|
|
|
|
/*** Action Type Union ***/
|
|
|
|
export type SwapAction =
|
|
|
|
| ChangeStepSwapAction
|
|
|
|
| ReferenceNumberSwapAction
|
|
|
|
| OriginKindSwapAction
|
|
|
|
| DestinationKindSwapAction
|
|
|
|
| OriginAmountSwapAction
|
|
|
|
| DestinationAmountSwapAction
|
|
|
|
| BityRatesSwapAction
|
|
|
|
| DestinationAddressSwapAction
|
|
|
|
| RestartSwapAction
|
|
|
|
| LoadBityRatesSwapAction
|
|
|
|
| StopLoadBityRatesSwapAction;
|