Skip to content

Commit 264529a

Browse files
authored
Merge pull request #13 from OpenFuturePlatform/11-Fix-asset-exchange-rate
10 - Fix asset exchange rate
2 parents 4e7e5f7 + 8063a15 commit 264529a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

frontend/src/actions/deploy-contract.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ export const convertCurrencies = conversionValues => async dispatch => {
9696
const fromAmount = conversionValues.fromAmount ? conversionValues.fromAmount : '0';
9797
const fromCurrency = conversionValues.fromCurrency ? conversionValues.fromCurrency : 'usd';
9898
const toCurrency = conversionValues.toCurrency ? conversionValues.toCurrency : 'eth';
99-
const apiRequestUrl = `https://openexchangerates.org/api/convert/${fromAmount}/${fromCurrency}/${toCurrency}?app_id=d34199d67d85445a846040c0cf621510`;
99+
const apiRequestUrl = `https://api.binance.com/api/v3/avgPrice?symbol=${fromCurrency}${toCurrency}`;
100100

101101
try {
102102
const data = await dispatch(apiGet(apiRequestUrl));
103-
dispatch({ type: CONVERT_CURRENCIES, payload: data.response });
104-
return data.response;
103+
dispatch({ type: CONVERT_CURRENCIES, payload: data.price *fromAmount });
104+
return data.price * fromAmount;
105105
} catch (err) {
106106
console.log('Error in convertCurrencies', err);
107107
}

0 commit comments

Comments
 (0)