diff --git a/common/actions/swap.js b/common/actions/swap.js index 1bdd4b83..c4825565 100644 --- a/common/actions/swap.js +++ b/common/actions/swap.js @@ -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 } -} +}; diff --git a/common/api/bity.js b/common/api/bity.js index 6b7f6b29..c9d1393c 100644 --- a/common/api/bity.js +++ b/common/api/bity.js @@ -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) } } diff --git a/common/config/bity.js b/common/config/bity.js new file mode 100644 index 00000000..2c4b0632 --- /dev/null +++ b/common/config/bity.js @@ -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' + } + } +} diff --git a/common/containers/Tabs/Swap/components/wantToSwapMy.js b/common/containers/Tabs/Swap/components/wantToSwapMy.js index 21158372..1a6481d1 100644 --- a/common/containers/Tabs/Swap/components/wantToSwapMy.js +++ b/common/containers/Tabs/Swap/components/wantToSwapMy.js @@ -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 ( + + ) + } + + +} + export default class WantToSwapMy extends Component { constructor(props) { super(props) @@ -91,25 +120,14 @@ export default class WantToSwapMy extends Component { return (

{translate('SWAP_init_1')}

- 0) ? 'is-valid' : 'is-invalid'}`} type="number" placeholder="Amount" onChange={(e) => this.onChangeOriginAmount(e.target.value)} value={originAmount}/> + - - -

{translate('SWAP_init_2')}

this.onChangeDestinationAmount(e.target.value)}/> - - - - +