mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-16 14:14:13 +00:00
a66337ac0a
### Re-implements: * min/max validators on initial currency swap selection * polling of order status * timer that persists across refreshes via localStorage (computed based on `createdTime` and `validFor` amount) * swap persists across refreshes once order is created. * various type refactors ### New additions: * *SimpleButton* (can be PRd separately on request) * clear loading state after order create (via SimpleButton and font-awesome) * buffers for non-BTC swaps (bity does not actually accept 0.01 BTC worth of ETH as they claim they do in their JSON response, so a magic number of 10% is added to the minimum).
40 lines
1.4 KiB
JavaScript
40 lines
1.4 KiB
JavaScript
export default {
|
|
serverURL: 'https://bity.myetherapi.com',
|
|
bityAPI: 'https://bity.com/api',
|
|
ethExplorer: 'https://etherscan.io/tx/[[txHash]]',
|
|
btcExplorer: 'https://blockchain.info/tx/[[txHash]]',
|
|
validStatus: ['RCVE', 'FILL', 'CONF', 'EXEC'],
|
|
invalidStatus: ['CANC'],
|
|
// 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
|
|
ETHBuffer: 0.1, // percent higher/lower than 0.01 BTC worth
|
|
REPBuffer: 0.2, // percent higher/lower than 0.01 BTC worth
|
|
BTCMin: 0.01,
|
|
BTCMax: 3,
|
|
ETHMin: function(BTCETHRate: number) {
|
|
const ETHMin = BTCETHRate * this.BTCMin;
|
|
const ETHMinWithPadding = ETHMin + ETHMin * this.ETHBuffer;
|
|
return ETHMinWithPadding;
|
|
},
|
|
ETHMax: function(BTCETHRate: number) {
|
|
const ETHMax = BTCETHRate * this.BTCMax;
|
|
const ETHMaxWithPadding = ETHMax - ETHMax * this.ETHBuffer;
|
|
return ETHMaxWithPadding;
|
|
},
|
|
REPMin: function(BTCREPRate: number) {
|
|
const REPMin = BTCREPRate * this.BTCMin;
|
|
const REPMinWithPadding = REPMin + REPMin * this.REPBuffer;
|
|
return REPMinWithPadding;
|
|
},
|
|
REPMax: function(BTCREPRate: number) {
|
|
const REPMax = BTCREPRate * this.BTCMax;
|
|
const REPMaxWithPadding = REPMax - REPMax * this.ETHBuffer;
|
|
return REPMaxWithPadding;
|
|
},
|
|
postConfig: {
|
|
headers: {
|
|
'Content-Type': 'application/json; charset:UTF-8'
|
|
}
|
|
}
|
|
};
|