aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send_/send-content/send-amount-row/send-amount-row.selectors.js
blob: c2620b4dcbd6f208437d32278661014763b402f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import {
  getSelectedToken,
  getSelectedTokenToFiatRate,
  getConversionRate,
} from '../../send.selectors.js'

const selectors = {
  getMaxModeOn,
  sendAmountIsInError,
  getPrimaryCurrency,
  getAmountConversionRate,
}

module.exports = selectors

function getMaxModeOn (state) {
  return state.metamask.send.maxModeOn
}

function sendAmountIsInError (state) {
  return Boolean(state.metamask.send.errors.amount)
}

function getPrimaryCurrency (state) {
  const selectedToken = getSelectedToken(state)
  return selectedToken && selectedToken.symbol
}

function getAmountConversionRate (state) {
  return Boolean(getSelectedToken(state))
    ? getSelectedTokenToFiatRate(state)
    : getConversionRate(state)
}