aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--ui/lib/contract-namer.js11
2 files changed, 9 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ca9cc6f5a..e050a7509 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@
- Now enforce 95% of block's gasLimit to protect users.
- Removing provider-engine from the inpage provider. This fixes some error handling inconsistencies introduced in 3.7.0.
- Some contracts will now display logos instead of jazzicons.
+- Some contracts will now have names displayed in the confirmation view.
## 3.7.0 2017-5-23
diff --git a/ui/lib/contract-namer.js b/ui/lib/contract-namer.js
index a94c62b62..0800ee7df 100644
--- a/ui/lib/contract-namer.js
+++ b/ui/lib/contract-namer.js
@@ -6,13 +6,18 @@
*/
// Nickname keys must be stored in lower case.
-const nicknames = {}
+const contractMap = require('eth-contract-metadata')
+const ethUtil = require('ethereumjs-util')
module.exports = function (addr, identities = {}) {
+ const checksummed = ethUtil.toChecksumAddress(addr)
+ if (checksummed in contractMap && 'name' in contractMap[checksummed]) {
+ return contractMap[checksummed].name
+ }
+
const address = addr.toLowerCase()
const ids = hashFromIdentities(identities)
-
- return addrFromHash(address, ids) || addrFromHash(address, nicknames)
+ return addrFromHash(address, ids)
}
function hashFromIdentities (identities) {