MyCrypto/common/actions/swap.js

164 lines
3.1 KiB
JavaScript
Raw Normal View History

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