Move to eth-contract-metadata

feature/default_network_editable
Dan Finlay 8 years ago
parent 7268fcb694
commit f06ad954b9
  1. 2
      package.json
  2. 7
      ui/lib/icon-factory.js

@ -62,11 +62,11 @@
"end-of-stream": "^1.1.0",
"ensnare": "^1.0.0",
"eth-bin-to-ops": "^1.0.1",
"eth-contract-metadata": "^1.0.0",
"eth-hd-keyring": "^1.1.1",
"eth-query": "^2.1.1",
"eth-sig-util": "^1.1.1",
"eth-simple-keyring": "^1.1.1",
"ethereum-contract-icons": "^1.0.0",
"ethereumjs-tx": "^1.3.0",
"ethereumjs-util": "ethereumjs/ethereumjs-util#ac5d0908536b447083ea422b435da27f26615de9",
"ethereumjs-wallet": "^0.6.0",

@ -1,7 +1,7 @@
var iconFactory
const isValidAddress = require('ethereumjs-util').isValidAddress
const toChecksumAddress = require('ethereumjs-util').toChecksumAddress
const iconMap = require('ethereum-contract-icons')
const contractMap = require('eth-contract-metadata')
module.exports = function (jazzicon) {
if (!iconFactory) {
@ -43,11 +43,12 @@ IconFactory.prototype.generateNewIdenticon = function (address, diameter) {
// util
function iconExistsFor (address) {
return (address in iconMap) && isValidAddress(address)
return (address in contractMap) && isValidAddress(address) && ('logo' in contractMap[address])
}
function imageElFor (address) {
const fileName = iconMap[address]
const contract = contractMap[address]
const fileName = contract.logo
const path = `images/contract/${fileName}`
const img = document.createElement('img')
img.src = path

Loading…
Cancel
Save