Skip to content

Commit

Permalink
fix(resolve all quote conversions)
Browse files Browse the repository at this point in the history
  • Loading branch information
sixtedemaupeou committed May 21, 2018
1 parent fe19da7 commit cbb87eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default ({ coreSagas }) => {
}
const leftResult = yield call(coreSagas.data.coinify.fetchQuote,
{ quote: { amount: payload * 100, baseCurrency: values.currency, quoteCurrency: 'BTC', type } })
const amount = leftResult.quoteAmount
const amount = Math.abs(leftResult.quoteAmount)
yield put(actions.form.initialize(form, merge(values, { 'rightVal': amount / 1e8 })))
yield put(A.coinifyCheckoutBusyOff())
break
Expand Down
4 changes: 2 additions & 2 deletions packages/blockchain-wallet-v4/src/redux/data/coinify/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ export default ({ api, options }) => {
try {
yield put(A.fetchRateQuoteLoading())
const { currency, type } = data.payload
const baseAmount = type === 'buy' ? -1e8 : 1e8
const quote = yield apply(coinify, coinify.getBuyQuote, [baseAmount, 'BTC', currency])
const getQuote = type === 'sell' ? coinify.getSellQuote : coinify.getBuyQuote
const quote = yield apply(coinify, getQuote, [-1e8, 'BTC', currency])
yield put(A.fetchRateQuoteSuccess(quote))
} catch (e) {
yield put(A.fetchRateQuoteFailure(e))
Expand Down

0 comments on commit cbb87eb

Please sign in to comment.