aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/scripts/background.js14
-rw-r--r--app/scripts/contentscript.js10
-rw-r--r--app/scripts/inpage.js8
-rw-r--r--app/scripts/metamask-controller.js10
-rw-r--r--app/scripts/notice-controller.js6
-rw-r--r--app/scripts/phishing-detect.js2
-rw-r--r--app/scripts/platforms/extension.js2
-rw-r--r--app/scripts/popup-core.js12
8 files changed, 32 insertions, 32 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js
index 6056962dd..8cc60be80 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -421,13 +421,13 @@ function setupController (initState, initLangCode) {
* The number reflects the current number of pending transactions or message signatures needing user approval.
*/
function updateBadge () {
- var label = ''
- var unapprovedTxCount = controller.txController.getUnapprovedTxCount()
- var unapprovedMsgCount = controller.messageManager.unapprovedMsgCount
- var unapprovedPersonalMsgs = controller.personalMessageManager.unapprovedPersonalMsgCount
- var unapprovedTypedMsgs = controller.typedMessageManager.unapprovedTypedMessagesCount
+ let label = ''
+ const unapprovedTxCount = controller.txController.getUnapprovedTxCount()
+ const unapprovedMsgCount = controller.messageManager.unapprovedMsgCount
+ const unapprovedPersonalMsgs = controller.personalMessageManager.unapprovedPersonalMsgCount
+ const unapprovedTypedMsgs = controller.typedMessageManager.unapprovedTypedMessagesCount
const pendingProviderRequests = controller.providerApprovalController.store.getState().providerRequests.length
- var count = unapprovedTxCount + unapprovedMsgCount + unapprovedPersonalMsgs + unapprovedTypedMsgs + pendingProviderRequests
+ const count = unapprovedTxCount + unapprovedMsgCount + unapprovedPersonalMsgs + unapprovedTypedMsgs + pendingProviderRequests
if (count) {
label = String(count)
}
@@ -463,7 +463,7 @@ function openPopup () {
triggerUi()
return new Promise(
(resolve) => {
- var interval = setInterval(() => {
+ const interval = setInterval(() => {
if (!notificationIsOpen) {
clearInterval(interval)
resolve()
diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js
index 92e382ea5..65e2ec523 100644
--- a/app/scripts/contentscript.js
+++ b/app/scripts/contentscript.js
@@ -7,7 +7,7 @@ const PongStream = require('ping-pong-stream/pong')
const ObjectMultiplex = require('obj-multiplex')
const extension = require('extensionizer')
const PortStream = require('extension-port-stream')
-const TransformStream = require('stream').Transform
+const {Transform: TransformStream} = require('stream')
const inpageContent = fs.readFileSync(path.join(__dirname, '..', '..', 'dist', 'chrome', 'inpage.js')).toString()
const inpageSuffix = '//# sourceURL=' + extension.extension.getURL('inpage.js') + '\n'
@@ -247,7 +247,7 @@ function suffixCheck () {
* @returns {boolean} {@code true} if the documentElement is an html node or if none exists
*/
function documentElementCheck () {
- var documentElement = document.documentElement.nodeName
+ const documentElement = document.documentElement.nodeName
if (documentElement) {
return documentElement.toLowerCase() === 'html'
}
@@ -260,7 +260,7 @@ function documentElementCheck () {
* @returns {boolean} {@code true} if the current domain is blacklisted
*/
function blacklistedDomainCheck () {
- var blacklistedDomains = [
+ const blacklistedDomains = [
'uscourts.gov',
'dropbox.com',
'webbyawards.com',
@@ -271,8 +271,8 @@ function blacklistedDomainCheck () {
'ani.gamer.com.tw',
'blueskybooking.com',
]
- var currentUrl = window.location.href
- var currentRegex
+ const currentUrl = window.location.href
+ let currentRegex
for (let i = 0; i < blacklistedDomains.length; i++) {
const blacklistedDomain = blacklistedDomains[i].replace('.', '\\.')
currentRegex = new RegExp(`(?:https?:\\/\\/)(?:(?!${blacklistedDomain}).)*$`)
diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js
index f8c6cf573..fb2a84d1a 100644
--- a/app/scripts/inpage.js
+++ b/app/scripts/inpage.js
@@ -42,13 +42,13 @@ function onMessage (messageType, handler, remove) {
//
// setup background connection
-var metamaskStream = new LocalMessageDuplexStream({
+const metamaskStream = new LocalMessageDuplexStream({
name: 'inpage',
target: 'contentscript',
})
// compose the inpage provider
-var inpageProvider = new MetamaskInpageProvider(metamaskStream)
+const inpageProvider = new MetamaskInpageProvider(metamaskStream)
// set a high max listener count to avoid unnecesary warnings
inpageProvider.setMaxListeners(100)
@@ -181,7 +181,7 @@ if (typeof window.web3 !== 'undefined') {
and try again.`)
}
-var web3 = new Web3(proxiedInpageProvider)
+const web3 = new Web3(proxiedInpageProvider)
web3.setProvider = function () {
log.debug('MetaMask - overrode web3.setProvider')
}
@@ -218,7 +218,7 @@ inpageProvider.publicConfigStore.subscribe(function (state) {
// need to make sure we aren't affected by overlapping namespaces
// and that we dont affect the app with our namespace
// mostly a fix for web3's BigNumber if AMD's "define" is defined...
-var __define
+let __define
/**
* Caches reference to global define object and deletes it to
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 622eb78af..65cc2d3eb 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -19,7 +19,7 @@ const createSubscriptionManager = require('eth-json-rpc-filters/subscriptionMana
const createOriginMiddleware = require('./lib/createOriginMiddleware')
const createLoggerMiddleware = require('./lib/createLoggerMiddleware')
const createProviderMiddleware = require('./lib/createProviderMiddleware')
-const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex
+const {setupMultiplex} = require('./lib/stream-utils.js')
const KeyringController = require('eth-keyring-controller')
const NetworkController = require('./controllers/network')
const PreferencesController = require('./controllers/preferences')
@@ -42,9 +42,9 @@ const ProviderApprovalController = require('./controllers/provider-approval')
const nodeify = require('./lib/nodeify')
const accountImporter = require('./account-import-strategies')
const getBuyEthUrl = require('./lib/buy-eth-url')
-const Mutex = require('await-semaphore').Mutex
-const version = require('../manifest.json').version
-const BN = require('ethereumjs-util').BN
+const {Mutex} = require('await-semaphore')
+const {version} = require('../manifest.json')
+const {BN} = require('ethereumjs-util')
const GWEI_BN = new BN('1000000000')
const percentile = require('percentile')
const seedPhraseVerifier = require('./lib/seed-phrase-verifier')
@@ -208,7 +208,7 @@ module.exports = class MetamaskController extends EventEmitter {
})
this.networkController.on('networkDidChange', () => {
this.balancesController.updateAllBalances()
- var currentCurrency = this.currencyController.getCurrentCurrency()
+ const currentCurrency = this.currencyController.getCurrentCurrency()
this.setCurrentCurrency(currentCurrency, function () {})
})
this.balancesController.updateAllBalances()
diff --git a/app/scripts/notice-controller.js b/app/scripts/notice-controller.js
index ce686d9d1..6fe8b8cf0 100644
--- a/app/scripts/notice-controller.js
+++ b/app/scripts/notice-controller.js
@@ -1,4 +1,4 @@
-const EventEmitter = require('events').EventEmitter
+const {EventEmitter} = require('events')
const semver = require('semver')
const extend = require('xtend')
const ObservableStore = require('obs-store')
@@ -46,8 +46,8 @@ module.exports = class NoticeController extends EventEmitter {
markNoticeRead (noticeToMark, cb) {
cb = cb || function (err) { if (err) throw err }
try {
- var notices = this.getNoticesList()
- var index = notices.findIndex((currentNotice) => currentNotice.id === noticeToMark.id)
+ const notices = this.getNoticesList()
+ const index = notices.findIndex((currentNotice) => currentNotice.id === noticeToMark.id)
notices[index].read = true
notices[index].body = ''
this.setNoticesList(notices)
diff --git a/app/scripts/phishing-detect.js b/app/scripts/phishing-detect.js
index ff95d1f6f..b30c76b72 100644
--- a/app/scripts/phishing-detect.js
+++ b/app/scripts/phishing-detect.js
@@ -3,7 +3,7 @@ const dnode = require('dnode')
const { EventEmitter } = require('events')
const PortStream = require('extension-port-stream')
const extension = require('extensionizer')
-const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex
+const {setupMultiplex} = require('./lib/stream-utils.js')
const { getEnvironmentType } = require('./lib/util')
const ExtensionPlatform = require('./platforms/extension')
diff --git a/app/scripts/platforms/extension.js b/app/scripts/platforms/extension.js
index 3dadd5d34..099b0d7ea 100644
--- a/app/scripts/platforms/extension.js
+++ b/app/scripts/platforms/extension.js
@@ -1,5 +1,5 @@
const extension = require('extensionizer')
-const explorerLink = require('etherscan-link').createExplorerLink
+const {createExplorerLink: explorerLink} = require('etherscan-link')
class ExtensionPlatform {
diff --git a/app/scripts/popup-core.js b/app/scripts/popup-core.js
index db885ec93..e964d001d 100644
--- a/app/scripts/popup-core.js
+++ b/app/scripts/popup-core.js
@@ -1,11 +1,11 @@
-const EventEmitter = require('events').EventEmitter
+const {EventEmitter} = require('events')
const async = require('async')
const Dnode = require('dnode')
const Eth = require('ethjs')
const EthQuery = require('eth-query')
const launchMetamaskUi = require('../../ui')
const StreamProvider = require('web3-stream-provider')
-const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex
+const {setupMultiplex} = require('./lib/stream-utils.js')
module.exports = initializePopup
@@ -32,7 +32,7 @@ function initializePopup ({ container, connectionStream }, cb) {
function connectToAccountManager (connectionStream, cb) {
// setup communication with background
// setup multiplexing
- var mx = setupMultiplex(connectionStream)
+ const mx = setupMultiplex(connectionStream)
// connect features
setupControllerConnection(mx.createStream('controller'), cb)
setupWeb3Connection(mx.createStream('provider'))
@@ -44,7 +44,7 @@ function connectToAccountManager (connectionStream, cb) {
* @param {PortDuplexStream} connectionStream PortStream instance establishing a background connection
*/
function setupWeb3Connection (connectionStream) {
- var providerStream = new StreamProvider()
+ const providerStream = new StreamProvider()
providerStream.pipe(connectionStream).pipe(providerStream)
connectionStream.on('error', console.error.bind(console))
providerStream.on('error', console.error.bind(console))
@@ -62,8 +62,8 @@ function setupWeb3Connection (connectionStream) {
function setupControllerConnection (connectionStream, cb) {
// this is a really sneaky way of adding EventEmitter api
// to a bi-directional dnode instance
- var eventEmitter = new EventEmitter()
- var accountManagerDnode = Dnode({
+ const eventEmitter = new EventEmitter()
+ const accountManagerDnode = Dnode({
sendUpdate: function (state) {
eventEmitter.emit('update', state)
},