diff options
author | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2019-02-15 05:03:21 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2019-02-21 01:48:46 +0800 |
commit | 3c73781787f7aab6cdba0b738e4844a26aab5d8e (patch) | |
tree | 5a98f0acdcda6d3dd1a8368be6bb0ddf77c8fa6a /old-ui/lib | |
parent | 41f89ac7edf994f3d15d32d3d82d8d2b03dec481 (diff) | |
download | tangerine-wallet-browser-3c73781787f7aab6cdba0b738e4844a26aab5d8e.tar tangerine-wallet-browser-3c73781787f7aab6cdba0b738e4844a26aab5d8e.tar.gz tangerine-wallet-browser-3c73781787f7aab6cdba0b738e4844a26aab5d8e.tar.bz2 tangerine-wallet-browser-3c73781787f7aab6cdba0b738e4844a26aab5d8e.tar.lz tangerine-wallet-browser-3c73781787f7aab6cdba0b738e4844a26aab5d8e.tar.xz tangerine-wallet-browser-3c73781787f7aab6cdba0b738e4844a26aab5d8e.tar.zst tangerine-wallet-browser-3c73781787f7aab6cdba0b738e4844a26aab5d8e.zip |
Delete old-ui folder
Diffstat (limited to 'old-ui/lib')
-rw-r--r-- | old-ui/lib/contract-namer.js | 33 | ||||
-rw-r--r-- | old-ui/lib/etherscan-prefix-for-network.js | 21 | ||||
-rw-r--r-- | old-ui/lib/icon-factory.js | 65 | ||||
-rw-r--r-- | old-ui/lib/lost-accounts-notice.js | 23 | ||||
-rw-r--r-- | old-ui/lib/persistent-form.js | 61 | ||||
-rw-r--r-- | old-ui/lib/tx-helper.js | 28 |
6 files changed, 0 insertions, 231 deletions
diff --git a/old-ui/lib/contract-namer.js b/old-ui/lib/contract-namer.js deleted file mode 100644 index f05e770cc..000000000 --- a/old-ui/lib/contract-namer.js +++ /dev/null @@ -1,33 +0,0 @@ -/* CONTRACT NAMER - * - * Takes an address, - * Returns a nicname if we have one stored, - * otherwise returns null. - */ - -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) -} - -function hashFromIdentities (identities) { - const result = {} - for (const key in identities) { - result[key] = identities[key].name - } - return result -} - -function addrFromHash (addr, hash) { - const address = addr.toLowerCase() - return hash[address] || null -} diff --git a/old-ui/lib/etherscan-prefix-for-network.js b/old-ui/lib/etherscan-prefix-for-network.js deleted file mode 100644 index 2c1904f1c..000000000 --- a/old-ui/lib/etherscan-prefix-for-network.js +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = function (network) { - const net = parseInt(network) - let prefix - switch (net) { - case 1: // main net - prefix = '' - break - case 3: // ropsten test net - prefix = 'ropsten.' - break - case 4: // rinkeby test net - prefix = 'rinkeby.' - break - case 42: // kovan test net - prefix = 'kovan.' - break - default: - prefix = '' - } - return prefix -} diff --git a/old-ui/lib/icon-factory.js b/old-ui/lib/icon-factory.js deleted file mode 100644 index 27a74de66..000000000 --- a/old-ui/lib/icon-factory.js +++ /dev/null @@ -1,65 +0,0 @@ -var iconFactory -const isValidAddress = require('ethereumjs-util').isValidAddress -const toChecksumAddress = require('ethereumjs-util').toChecksumAddress -const contractMap = require('eth-contract-metadata') - -module.exports = function (jazzicon) { - if (!iconFactory) { - iconFactory = new IconFactory(jazzicon) - } - return iconFactory -} - -function IconFactory (jazzicon) { - this.jazzicon = jazzicon - this.cache = {} -} - -IconFactory.prototype.iconForAddress = function (address, diameter) { - const addr = toChecksumAddress(address) - if (iconExistsFor(addr)) { - return imageElFor(addr) - } - - return this.generateIdenticonSvg(address, diameter) -} - -// returns svg dom element -IconFactory.prototype.generateIdenticonSvg = function (address, diameter) { - var cacheId = `${address}:${diameter}` - // check cache, lazily generate and populate cache - var identicon = this.cache[cacheId] || (this.cache[cacheId] = this.generateNewIdenticon(address, diameter)) - // create a clean copy so you can modify it - var cleanCopy = identicon.cloneNode(true) - return cleanCopy -} - -// creates a new identicon -IconFactory.prototype.generateNewIdenticon = function (address, diameter) { - var numericRepresentation = jsNumberForAddress(address) - var identicon = this.jazzicon(diameter, numericRepresentation) - return identicon -} - -// util - -function iconExistsFor (address) { - return contractMap[address] && isValidAddress(address) && contractMap[address].logo -} - -function imageElFor (address) { - const contract = contractMap[address] - const fileName = contract.logo - const path = `images/contract/${fileName}` - const img = document.createElement('img') - img.src = path - img.style.width = '75%' - return img -} - -function jsNumberForAddress (address) { - var addr = address.slice(2, 10) - var seed = parseInt(addr, 16) - return seed -} - diff --git a/old-ui/lib/lost-accounts-notice.js b/old-ui/lib/lost-accounts-notice.js deleted file mode 100644 index 948b13db6..000000000 --- a/old-ui/lib/lost-accounts-notice.js +++ /dev/null @@ -1,23 +0,0 @@ -const summary = require('../app/util').addressSummary - -module.exports = function (lostAccounts) { - return { - date: new Date().toDateString(), - title: 'Account Problem Caught', - body: `MetaMask has fixed a bug where some accounts were previously mis-generated. This was a rare issue, but you were affected! - -We have successfully imported the accounts that were mis-generated, but they will no longer be recovered with your normal seed phrase. - -We have marked the affected accounts as "Loose", and recommend you transfer ether and tokens away from those accounts, or export & back them up elsewhere. - -Your affected accounts are: -${lostAccounts.map(acct => ` - ${summary(acct)}`).join('\n')} - -These accounts have been marked as "Loose" so they will be easy to recognize in the account list. - -For more information, please read [our blog post.][1] - -[1]: https://medium.com/metamask/metamask-3-migration-guide-914b79533cdd#.7d8ktj4h3 - `, - } -} diff --git a/old-ui/lib/persistent-form.js b/old-ui/lib/persistent-form.js deleted file mode 100644 index d4dc20b03..000000000 --- a/old-ui/lib/persistent-form.js +++ /dev/null @@ -1,61 +0,0 @@ -const inherits = require('util').inherits -const Component = require('react').Component -const defaultKey = 'persistent-form-default' -const eventName = 'keyup' - -module.exports = PersistentForm - -function PersistentForm () { - Component.call(this) -} - -inherits(PersistentForm, Component) - -PersistentForm.prototype.componentDidMount = function () { - const fields = document.querySelectorAll('[data-persistent-formid]') - const store = this.getPersistentStore() - - for (var i = 0; i < fields.length; i++) { - const field = fields[i] - const key = field.getAttribute('data-persistent-formid') - const cached = store[key] - if (cached !== undefined) { - field.value = cached - } - - field.addEventListener(eventName, this.persistentFieldDidUpdate.bind(this)) - } -} - -PersistentForm.prototype.getPersistentStore = function () { - let store = window.localStorage[this.persistentFormParentId || defaultKey] - if (store && store !== 'null') { - store = JSON.parse(store) - } else { - store = {} - } - return store -} - -PersistentForm.prototype.setPersistentStore = function (newStore) { - window.localStorage[this.persistentFormParentId || defaultKey] = JSON.stringify(newStore) -} - -PersistentForm.prototype.persistentFieldDidUpdate = function (event) { - const field = event.target - const store = this.getPersistentStore() - const key = field.getAttribute('data-persistent-formid') - const val = field.value - store[key] = val - this.setPersistentStore(store) -} - -PersistentForm.prototype.componentWillUnmount = function () { - const fields = document.querySelectorAll('[data-persistent-formid]') - for (var i = 0; i < fields.length; i++) { - const field = fields[i] - field.removeEventListener(eventName, this.persistentFieldDidUpdate.bind(this)) - } - this.setPersistentStore({}) -} - diff --git a/old-ui/lib/tx-helper.js b/old-ui/lib/tx-helper.js deleted file mode 100644 index 0a6f55a63..000000000 --- a/old-ui/lib/tx-helper.js +++ /dev/null @@ -1,28 +0,0 @@ -const valuesFor = require('../app/util').valuesFor -const log = require('loglevel') - -module.exports = function (unapprovedTxs, unapprovedMsgs, personalMsgs, typedMessages, network) { - log.debug('tx-helper called with params:') - log.debug({ unapprovedTxs, unapprovedMsgs, personalMsgs, typedMessages, network }) - - const txValues = network ? valuesFor(unapprovedTxs).filter(txMeta => txMeta.metamaskNetworkId === network) : valuesFor(unapprovedTxs) - log.debug(`tx helper found ${txValues.length} unapproved txs`) - - const msgValues = valuesFor(unapprovedMsgs) - log.debug(`tx helper found ${msgValues.length} unsigned messages`) - let allValues = txValues.concat(msgValues) - - const personalValues = valuesFor(personalMsgs) - log.debug(`tx helper found ${personalValues.length} unsigned personal messages`) - allValues = allValues.concat(personalValues) - - const typedValues = valuesFor(typedMessages) - log.debug(`tx helper found ${typedValues.length} unsigned typed messages`) - allValues = allValues.concat(typedValues) - - allValues = allValues.sort((a, b) => { - return a.time > b.time - }) - - return allValues -} |