diff options
Diffstat (limited to 'ui/lib/contract-namer.js')
-rw-r--r-- | ui/lib/contract-namer.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ui/lib/contract-namer.js b/ui/lib/contract-namer.js index a94c62b62..f05e770cc 100644 --- a/ui/lib/contract-namer.js +++ b/ui/lib/contract-namer.js @@ -5,14 +5,18 @@ * otherwise returns null. */ -// 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 (contractMap[checksummed] && contractMap[checksummed].name) { + 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) { |