message: return getExchangeRate action
diff: @@ -91,6 +91,42 @@ const getBalances = () => {
  // actions.nimiq.getBalance()
  }
  +const getExchangeRate = (sellCurrency, buyCurrency) => {
  + if (buyCurrency.toLowerCase() === 'usd') {
  + return new Promise((resolve, reject) => {
  + let dataKey = sellCurrency.toLowerCase()
  + switch (sellCurrency.toLowerCase()) {
  + case 'btc (sms-protected)':
  + case 'btc (multisig)':
  + dataKey = 'btc'
  + break
  + default:
  + }
  + const { user } = getState()
  + if (user[`${dataKey}Data`] && user[`${dataKey}Data`].infoAboutCurrency) {
  + const currencyData = user[`${dataKey}Data`]
  + resolve(currencyData.infoAboutCurrency.price_usd)
  + } else {
  + resolve(1)
  + }
  + })
  + }
  + return new Promise((resolve, reject) => {
  + const url = `https://api.cryptonator.com/api/full/${sellCurrency}-${buyCurrency}`
  +
  + request.get(url, { cacheResponse: 60000 }).then(({ ticker: { price: exchangeRate } }) => {
  + resolve(exchangeRate)
  + })
  + .catch(() => {
  + if (constants.customEcxchangeRate[sellCurrency.toLowerCase()] !== undefined) {
  + resolve(constants.customEcxchangeRate[sellCurrency])
  + } else {
  + resolve(1)
  + }
  + })
  + })
  +}
  +
  const getDemoMoney = process.env.MAINNET ? () => { } : () => {
  // googe bitcoin (or rinkeby) faucet
  request.get('https://swap.wpmix.net/demokeys.php', {})
  @@ -268,6 +304,7 @@ export default {
  setTransactions,
  downloadPrivateKeys,
  getText,
  + getExchangeRate,
  getReputation,
  getInfoAboutCurrency
  }
  