address additional comments
This commit is contained in:
parent
1ae411fbf0
commit
f2b8045c21
|
@ -1,4 +1,3 @@
|
|||
// @flow
|
||||
export const SWAP_ORIGIN_KIND = 'SWAP_ORIGIN_KIND';
|
||||
export const SWAP_DESTINATION_KIND = 'SWAP_DESTINATION_KIND';
|
||||
export const SWAP_ORIGIN_AMOUNT = 'SWAP_ORIGIN_AMOUNT';
|
||||
|
@ -18,7 +17,7 @@ export const SWAP_DESTINATION_KIND_TO = (value) => {
|
|||
type: SWAP_DESTINATION_KIND,
|
||||
value
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const SWAP_ORIGIN_AMOUNT_TO = (value) => {
|
||||
return {
|
||||
|
@ -32,11 +31,11 @@ export const SWAP_DESTINATION_AMOUNT_TO = (value) => {
|
|||
type: SWAP_DESTINATION_AMOUNT,
|
||||
value
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const SWAP_UPDATE_BITY_RATES_TO = (value) => {
|
||||
return {
|
||||
type: SWAP_UPDATE_BITY_RATES,
|
||||
value
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import axios from 'axios';
|
||||
import bityConfig from 'config/bity';
|
||||
|
||||
// https://stackoverflow.com/questions/9828684/how-to-get-all-arguments-of-a-callback-function
|
||||
export function combineAndUpper() {
|
||||
|
@ -12,25 +13,6 @@ export function combineAndUpper() {
|
|||
}
|
||||
|
||||
export default class Bity {
|
||||
constructor() {
|
||||
this.SERVERURL = 'https://myetherapi.com';
|
||||
this.bityAPI = 'https://bity.com/api';
|
||||
this.decimals = 6;
|
||||
this.ethExplorer = 'https://etherscan.io/tx/[[txHash]]';
|
||||
this.btcExplorer = 'https://blockchain.info/tx/[[txHash]]';
|
||||
this.validStatus = ['RCVE', 'FILL', 'CONF', 'EXEC'];
|
||||
this.invalidStatus = ['CANC'];
|
||||
this.mainPairs = ['REP', 'ETH'];
|
||||
this.min = 0.01;
|
||||
this.max = 3;
|
||||
this.priceLoaded = false;
|
||||
this.postConfig = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json; charset=UTF-8'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
findRateFromBityRateList(rateObjects, pairName) {
|
||||
return rateObjects.find(x => x.pair === pairName);
|
||||
}
|
||||
|
@ -76,7 +58,7 @@ export default class Bity {
|
|||
|
||||
requestAllRates() {
|
||||
const path = '/v1/rate2/';
|
||||
const bityURL = this.bityAPI + path;
|
||||
const bityURL = bityConfig.bityAPI + path;
|
||||
return axios.get(bityURL)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
export default {
|
||||
SERVERURL: 'https://myetherapi.com',
|
||||
bityAPI: 'https://bity.com/api',
|
||||
decimals: 6,
|
||||
ethExplorer: 'https://etherscan.io/tx/[[txHash]]',
|
||||
btcExplorer: 'https://blockchain.info/tx/[[txHash]]',
|
||||
validStatus: ['RCVE', 'FILL', 'CONF', 'EXEC'],
|
||||
invalidStatus: ['CANC'],
|
||||
mainPairs: ['REP', 'ETH'],
|
||||
min: 0.01,
|
||||
max: 3,
|
||||
priceLoaded: false,
|
||||
postConfig: {
|
||||
headers: {
|
||||
'Content-Type': 'application/json; charse:UTF-8'
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,6 +7,35 @@ function sleep(ms) {
|
|||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
|
||||
class CoinTypeDropDown extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
kind: PropTypes.any,
|
||||
onChange: PropTypes.any,
|
||||
kindOptions: PropTypes.any
|
||||
};
|
||||
|
||||
render() {
|
||||
return (<span className="dropdown">
|
||||
<select value={this.props.kind}
|
||||
className="btn btn-default"
|
||||
onChange={this.props.onChange.bind(this)}>
|
||||
{
|
||||
this.props.kindOptions.map((obj, i) => {
|
||||
return <option value={obj} key={i}>{obj}</option>
|
||||
})
|
||||
}
|
||||
</select>
|
||||
</span>)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
export default class WantToSwapMy extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
@ -91,25 +120,14 @@ export default class WantToSwapMy extends Component {
|
|||
return (
|
||||
<article className="swap-panel">
|
||||
<h1>{translate('SWAP_init_1')}</h1>
|
||||
|
||||
<input
|
||||
className={`form-control ${(this.props.originAmount !== '' && this.props.originAmount > 0) ? 'is-valid' : 'is-invalid'}`}
|
||||
type="number"
|
||||
placeholder="Amount"
|
||||
onChange={(e) => this.onChangeOriginAmount(e.target.value)}
|
||||
value={originAmount}/>
|
||||
<CoinTypeDropDown type={originKind} onChange={this.onChangeOriginKind.bind(this)} kindOptions={originKindOptions}/>
|
||||
|
||||
<span className="dropdown">
|
||||
<select value={originKind}
|
||||
className="btn btn-default"
|
||||
onChange={this.onChangeOriginKind.bind(this)}>
|
||||
{
|
||||
originKindOptions.map((obj, i) => {
|
||||
return <option value={obj} key={i}>{obj}</option>
|
||||
})
|
||||
}
|
||||
</select>
|
||||
</span>
|
||||
<h1>{translate('SWAP_init_2')}</h1>
|
||||
|
||||
<input
|
||||
|
@ -118,18 +136,7 @@ export default class WantToSwapMy extends Component {
|
|||
placeholder="Amount"
|
||||
value={destinationAmount}
|
||||
onChange={(e) => this.onChangeDestinationAmount(e.target.value)}/>
|
||||
|
||||
<span className="dropdown">
|
||||
<select value={destinationKind}
|
||||
className="btn btn-default"
|
||||
onChange={this.onChangeDestinationKind.bind(this)}>
|
||||
{
|
||||
destinationKindOptions.map((obj, i) => {
|
||||
return <option value={obj} key={i}>{obj}</option>
|
||||
})
|
||||
}
|
||||
</select>
|
||||
</span>
|
||||
<CoinTypeDropDown type={destinationKind} onChange={this.onChangeDestinationKind.bind(this)} kindOptions={destinationKindOptions}/>
|
||||
|
||||
<div className="col-xs-12 clearfix text-center">
|
||||
<a onClick={this.onClickStartSwap} className="btn btn-info btn-lg">
|
||||
|
|
Loading…
Reference in New Issue