1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 03:12:42 +02:00

Add names to contract map & conf view

This commit is contained in:
Dan Finlay 2017-05-26 10:25:00 -07:00
parent f06ad954b9
commit 1203bd15c2
2 changed files with 9 additions and 3 deletions

View File

@ -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

View File

@ -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) {