Use Number constructor for number conversion. Use existing noConversionRateAvailable message

feature/default_network_editable
Alexander Tseung 6 years ago
parent 279bdfc2e7
commit 301ae305b8
  1. 3
      app/_locales/en/messages.json
  2. 2
      ui/app/components/pages/confirm-token-transaction-base/confirm-token-transaction-base.component.js
  3. 6
      ui/app/selectors/confirm-transaction.js

@ -581,9 +581,6 @@
"noAddressForName": { "noAddressForName": {
"message": "No address has been set for this name." "message": "No address has been set for this name."
}, },
"noConversionRate": {
"message": "No Conversion Rate"
},
"noDeposits": { "noDeposits": {
"message": "No deposits received" "message": "No deposits received"
}, },

@ -39,7 +39,7 @@ export default class ConfirmTokenTransactionBase extends Component {
const { currentCurrency, contractExchangeRate } = this.props const { currentCurrency, contractExchangeRate } = this.props
if (typeof contractExchangeRate === 'undefined') { if (typeof contractExchangeRate === 'undefined') {
return this.context.t('noConversionRate') return this.context.t('noConversionRateAvailable')
} else { } else {
const fiatTransactionAmount = this.getFiatTransactionAmount() const fiatTransactionAmount = this.getFiatTransactionAmount()
return formatCurrency(fiatTransactionAmount, currentCurrency) return formatCurrency(fiatTransactionAmount, currentCurrency)

@ -105,7 +105,7 @@ export const tokenAmountAndToAddressSelector = createSelector(
const toParam = params.find(param => param.name === TOKEN_PARAM_TO) const toParam = params.find(param => param.name === TOKEN_PARAM_TO)
const valueParam = params.find(param => param.name === TOKEN_PARAM_VALUE) const valueParam = params.find(param => param.name === TOKEN_PARAM_VALUE)
toAddress = toParam ? toParam.value : params[0].value toAddress = toParam ? toParam.value : params[0].value
tokenAmount = valueParam ? +valueParam.value : +params[1].value tokenAmount = valueParam ? Number(valueParam.value) : Number(params[1].value)
} }
return { return {
@ -123,7 +123,7 @@ export const approveTokenAmountAndToAddressSelector = createSelector(
if (params && params.length) { if (params && params.length) {
toAddress = params.find(param => param.name === TOKEN_PARAM_SPENDER).value toAddress = params.find(param => param.name === TOKEN_PARAM_SPENDER).value
tokenAmount = +params.find(param => param.name === TOKEN_PARAM_VALUE).value tokenAmount = Number(params.find(param => param.name === TOKEN_PARAM_VALUE).value)
} }
return { return {
@ -142,7 +142,7 @@ export const sendTokenTokenAmountAndToAddressSelector = createSelector(
if (params && params.length) { if (params && params.length) {
toAddress = params.find(param => param.name === TOKEN_PARAM_TO).value toAddress = params.find(param => param.name === TOKEN_PARAM_TO).value
tokenAmount = +params.find(param => param.name === TOKEN_PARAM_VALUE).value tokenAmount = Number(params.find(param => param.name === TOKEN_PARAM_VALUE).value)
if (tokenDecimals) { if (tokenDecimals) {
tokenAmount = calcTokenAmount(tokenAmount, tokenDecimals) tokenAmount = calcTokenAmount(tokenAmount, tokenDecimals)

Loading…
Cancel
Save