aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/pages
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@gmail.com>2018-07-21 05:18:50 +0800
committerAlexander Tseung <alextsg@gmail.com>2018-07-21 05:23:53 +0800
commit469a79f97ff887eae5ec99cf6be7b19c20972d02 (patch)
treed863732641d56c33bb41ce1ab66eaf6d5056bcbc /ui/app/components/pages
parentcb045fd8feec88bd631329ab9b3285aeed0f2e97 (diff)
downloadtangerine-wallet-browser-469a79f97ff887eae5ec99cf6be7b19c20972d02.tar
tangerine-wallet-browser-469a79f97ff887eae5ec99cf6be7b19c20972d02.tar.gz
tangerine-wallet-browser-469a79f97ff887eae5ec99cf6be7b19c20972d02.tar.bz2
tangerine-wallet-browser-469a79f97ff887eae5ec99cf6be7b19c20972d02.tar.lz
tangerine-wallet-browser-469a79f97ff887eae5ec99cf6be7b19c20972d02.tar.xz
tangerine-wallet-browser-469a79f97ff887eae5ec99cf6be7b19c20972d02.tar.zst
tangerine-wallet-browser-469a79f97ff887eae5ec99cf6be7b19c20972d02.zip
Add fallback options for displaying recipient name in the Confirm screen
Diffstat (limited to 'ui/app/components/pages')
-rw-r--r--ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.container.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.container.js b/ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.container.js
index 7db39adec..0c0deff18 100644
--- a/ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.container.js
+++ b/ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.container.js
@@ -2,6 +2,7 @@ import { connect } from 'react-redux'
import { compose } from 'recompose'
import { withRouter } from 'react-router-dom'
import R from 'ramda'
+import contractMap from 'eth-contract-metadata'
import ConfirmTransactionBase from './confirm-transaction-base.component'
import {
clearConfirmTransaction,
@@ -16,6 +17,14 @@ import { getHexGasTotal } from '../../../helpers/confirm-transaction/util'
import { isBalanceSufficient } from '../../send/send.utils'
import { conversionGreaterThan } from '../../../conversion-util'
import { MIN_GAS_LIMIT_DEC } from '../../send/send.constants'
+import { addressSlicer } from '../../../util'
+
+const casedContractMap = Object.keys(contractMap).reduce((acc, base) => {
+ return {
+ ...acc,
+ [base.toLowerCase()]: contractMap[base],
+ }
+}, {})
const mapStateToProps = (state, props) => {
const { toAddress: propsToAddress } = props
@@ -48,7 +57,10 @@ const mapStateToProps = (state, props) => {
const { balance } = accounts[selectedAddress]
const { name: fromName } = identities[selectedAddress]
const toAddress = propsToAddress || txParamsToAddress
- const toName = identities[toAddress] && identities[toAddress].name
+ const toName = identities[toAddress]
+ ? identities[toAddress].name
+ : casedContractMap[toAddress] ? casedContractMap[toAddress].name : addressSlicer(toAddress)
+
const isTxReprice = Boolean(lastGasPrice)
const transaction = R.find(({ id }) => id === transactionId)(selectedAddressTxList)