diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-06-22 04:56:04 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-06-22 04:56:04 +0800 |
commit | 8fde8a8921135112ccfdd13ce6b009755b5f71ed (patch) | |
tree | cd4ceb1dcd74a601506f92e5669e3022ca800c0c /app/scripts | |
parent | ab15b4c8259d6f6c5ae9d1e51548d73cfc1c67cb (diff) | |
download | tangerine-wallet-browser-8fde8a8921135112ccfdd13ce6b009755b5f71ed.tar tangerine-wallet-browser-8fde8a8921135112ccfdd13ce6b009755b5f71ed.tar.gz tangerine-wallet-browser-8fde8a8921135112ccfdd13ce6b009755b5f71ed.tar.bz2 tangerine-wallet-browser-8fde8a8921135112ccfdd13ce6b009755b5f71ed.tar.lz tangerine-wallet-browser-8fde8a8921135112ccfdd13ce6b009755b5f71ed.tar.xz tangerine-wallet-browser-8fde8a8921135112ccfdd13ce6b009755b5f71ed.tar.zst tangerine-wallet-browser-8fde8a8921135112ccfdd13ce6b009755b5f71ed.zip |
Manually linted
Diffstat (limited to 'app/scripts')
-rw-r--r-- | app/scripts/chromereload.js | 8 | ||||
-rw-r--r-- | app/scripts/lib/id-management.js | 16 | ||||
-rw-r--r-- | app/scripts/lib/idStore.js | 10 | ||||
-rw-r--r-- | app/scripts/lib/inpage-provider.js | 7 | ||||
-rw-r--r-- | app/scripts/popup.js | 3 |
5 files changed, 17 insertions, 27 deletions
diff --git a/app/scripts/chromereload.js b/app/scripts/chromereload.js index 0dd6bd5aa..283a131f1 100644 --- a/app/scripts/chromereload.js +++ b/app/scripts/chromereload.js @@ -603,10 +603,10 @@ window.LiveReloadOptions = { host: 'localhost' }; } else if (__indexOf.call(message.protocols, PROTOCOL_7) >= 0) { this.protocol = 7 } else if (__indexOf.call(message.protocols, PROTOCOL_6) >= 0) { - this.protocol = 6 - } else { - throw new ProtocolError('no supported protocols found') - } + this.protocol = 6 + } else { + throw new ProtocolError('no supported protocols found') + } } return this.handlers.connected(this.protocol) } else if (this.protocol === 6) { diff --git a/app/scripts/lib/id-management.js b/app/scripts/lib/id-management.js index 4e18bc8a9..30ea866f4 100644 --- a/app/scripts/lib/id-management.js +++ b/app/scripts/lib/id-management.js @@ -12,7 +12,7 @@ function IdManagement (opts) { this.hdPathString = "m/44'/60'/0'/0" this.getAddresses = function () { - return keyStore.getAddresses(this.hdPathString).map(function (address) { return '0x' + address }) + return this.keyStore.getAddresses(this.hdPathString).map(function (address) { return '0x' + address }) } this.signTx = function (txParams) { @@ -60,17 +60,17 @@ function IdManagement (opts) { } } -function pad_with_zeroes (number, length) { - var my_string = '' + number - while (my_string.length < length) { - my_string = '0' + my_string +function padWithZeroes (number, length) { + var myString = '' + number + while (myString.length < length) { + myString = '0' + myString } - return my_string + return myString } function concatSig (v, r, s) { - r = pad_with_zeroes(ethUtil.fromSigned(r), 64) - s = pad_with_zeroes(ethUtil.fromSigned(s), 64) + r = padWithZeroes(ethUtil.fromSigned(r), 64) + s = padWithZeroes(ethUtil.fromSigned(s), 64) r = ethUtil.stripHexPrefix(r.toString('hex')) s = ethUtil.stripHexPrefix(s.toString('hex')) v = ethUtil.stripHexPrefix(ethUtil.intToHex(v)) diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index 7fd2eeb01..d9657dacf 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -1,10 +1,7 @@ const EventEmitter = require('events').EventEmitter const inherits = require('util').inherits -const Transaction = require('ethereumjs-tx') const ethUtil = require('ethereumjs-util') const LightwalletKeyStore = require('eth-lightwallet').keystore -const LightwalletSigner = require('eth-lightwallet').signing -const async = require('async') const clone = require('clone') const extend = require('xtend') const createId = require('web3-provider-engine/util/random-id') @@ -88,7 +85,6 @@ IdentityStore.prototype.clearSeedWordCache = function (cb) { IdentityStore.prototype.getState = function () { var seedWords = this.getSeedIfUnlocked() - var wallet = configManager.getWallet() return clone(extend(this._currentState, { isInitialized: !!configManager.getWallet() && !seedWords, isUnlocked: this._isUnlocked(), @@ -125,7 +121,6 @@ IdentityStore.prototype.setSelectedAddress = function (address, cb) { } IdentityStore.prototype.revealAccount = function (cb) { - let addresses = this._getAddresses() const derivedKey = this._idmgmt.derivedKey const keyStore = this._keyStore @@ -133,7 +128,6 @@ IdentityStore.prototype.revealAccount = function (cb) { keyStore.generateNewAddress(derivedKey, 1) configManager.setWallet(keyStore.serialize()) - addresses = this._getAddresses() this._loadIdentities() this._didUpdate() cb(null) @@ -233,7 +227,6 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone // comes from metamask ui IdentityStore.prototype.approveTransaction = function (txId, cb) { - var txData = configManager.getTx(txId) var approvalCb = this._unconfTxCbs[txId] || noop // accept tx @@ -247,7 +240,6 @@ IdentityStore.prototype.approveTransaction = function (txId, cb) { // comes from metamask ui IdentityStore.prototype.cancelTransaction = function (txId) { - var txData = configManager.getTx(txId) var approvalCb = this._unconfTxCbs[txId] || noop // reject tx @@ -299,7 +291,6 @@ IdentityStore.prototype.addUnconfirmedMessage = function (msgParams, cb) { // comes from metamask ui IdentityStore.prototype.approveMessage = function (msgId, cb) { - var msgData = messageManager.getMsg(msgId) var approvalCb = this._unconfMsgCbs[msgId] || noop // accept msg @@ -313,7 +304,6 @@ IdentityStore.prototype.approveMessage = function (msgId, cb) { // comes from metamask ui IdentityStore.prototype.cancelMessage = function (msgId) { - var txData = messageManager.getMsg(msgId) var approvalCb = this._unconfMsgCbs[msgId] || noop // reject tx diff --git a/app/scripts/lib/inpage-provider.js b/app/scripts/lib/inpage-provider.js index afb07ca16..3b6ec154f 100644 --- a/app/scripts/lib/inpage-provider.js +++ b/app/scripts/lib/inpage-provider.js @@ -48,19 +48,20 @@ function MetamaskInpageProvider (connectionStream) { MetamaskInpageProvider.prototype.send = function (payload) { const self = this + let selectedAddress var result = null switch (payload.method) { case 'eth_accounts': // read from localStorage - var selectedAddress = self.publicConfigStore.get('selectedAddress') + selectedAddress = self.publicConfigStore.get('selectedAddress') result = selectedAddress ? [selectedAddress] : [] break case 'eth_coinbase': // read from localStorage - var selectedAddress = self.publicConfigStore.get('selectedAddress') + selectedAddress = self.publicConfigStore.get('selectedAddress') result = selectedAddress || '0x0000000000000000000000000000000000000000' break @@ -90,7 +91,7 @@ MetamaskInpageProvider.prototype.isConnected = function () { function createSyncProvider (providerConfig) { providerConfig = providerConfig || {} - var syncProviderUrl = undefined + let syncProviderUrl if (providerConfig.rpcTarget) { syncProviderUrl = providerConfig.rpcTarget diff --git a/app/scripts/popup.js b/app/scripts/popup.js index 9e4051d05..5173507fa 100644 --- a/app/scripts/popup.js +++ b/app/scripts/popup.js @@ -69,12 +69,11 @@ function setupApp (err, opts) { if (err) { alert(err.stack) throw err - return } var container = document.getElementById('app-content') - var app = MetaMaskUi({ + MetaMaskUi({ container: container, accountManager: opts.accountManager, currentDomain: opts.currentDomain, |