mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Add names to contract map & conf view
This commit is contained in:
parent
f06ad954b9
commit
1203bd15c2
@ -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
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user