aboutsummaryrefslogtreecommitdiffstats
path: root/ui/lib
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-05-27 01:25:00 +0800
committerDan Finlay <dan@danfinlay.com>2017-05-27 01:31:42 +0800
commit1203bd15c2861332b62e4a39a3d961f61daed6dc (patch)
tree7c441207e1af1d692b532b8362e9eb8dc267001a /ui/lib
parentf06ad954b900aa94a36fbb3e4765d0a9222e0920 (diff)
downloadtangerine-wallet-browser-1203bd15c2861332b62e4a39a3d961f61daed6dc.tar
tangerine-wallet-browser-1203bd15c2861332b62e4a39a3d961f61daed6dc.tar.gz
tangerine-wallet-browser-1203bd15c2861332b62e4a39a3d961f61daed6dc.tar.bz2
tangerine-wallet-browser-1203bd15c2861332b62e4a39a3d961f61daed6dc.tar.lz
tangerine-wallet-browser-1203bd15c2861332b62e4a39a3d961f61daed6dc.tar.xz
tangerine-wallet-browser-1203bd15c2861332b62e4a39a3d961f61daed6dc.tar.zst
tangerine-wallet-browser-1203bd15c2861332b62e4a39a3d961f61daed6dc.zip
Add names to contract map & conf view
Diffstat (limited to 'ui/lib')
-rw-r--r--ui/lib/contract-namer.js11
1 files changed, 8 insertions, 3 deletions
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) {