53 lines
1.2 KiB
JavaScript
53 lines
1.2 KiB
JavaScript
import { ETHTxExplorer, BTCTxExplorer } from './data';
|
|
|
|
type SupportedDestinationKind = 'ETH' | 'BTC' | 'REP';
|
|
|
|
const serverURL = 'https://bity.myetherapi.com';
|
|
const bityURL = 'https://bity.com/api';
|
|
const BTCMin = 0.01;
|
|
const BTCMax = 3;
|
|
|
|
// while Bity is supposedly OK with any order that is at least 0.01 BTC Worth, the order will fail if you send 0.01 BTC worth of ETH.
|
|
// This is a bad magic number, but will suffice for now
|
|
// value = percent higher/lower than 0.01 BTC worth
|
|
const buffers = {
|
|
ETH: 0.1,
|
|
REP: 0.2
|
|
};
|
|
|
|
// rate must be BTC[KIND]
|
|
export function kindMin(
|
|
BTCKINDRate: number,
|
|
kind: SupportedDestinationKind
|
|
): number {
|
|
const kindMin = BTCKINDRate * BTCMin;
|
|
return kindMin + kindMin * buffers[kind];
|
|
}
|
|
|
|
// rate must be BTC[KIND]
|
|
export function kindMax(
|
|
BTCKINDRate: number,
|
|
kind: SupportedDestinationKind
|
|
): number {
|
|
const kindMax = BTCKINDRate * BTCMax;
|
|
return kindMax - kindMax * buffers[kind];
|
|
}
|
|
|
|
const info = {
|
|
serverURL,
|
|
bityURL,
|
|
ETHTxExplorer,
|
|
BTCTxExplorer,
|
|
BTCMin,
|
|
BTCMax,
|
|
validStatus: ['RCVE', 'FILL', 'CONF', 'EXEC'],
|
|
invalidStatus: ['CANC'],
|
|
postConfig: {
|
|
headers: {
|
|
'Content-Type': 'application/json; charset:UTF-8'
|
|
}
|
|
}
|
|
};
|
|
|
|
export default info;
|