1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00

Merge pull request #1351 from MetaMask/lint

Fix linting warnings
This commit is contained in:
Dan Finlay 2017-04-27 14:48:13 -07:00 committed by GitHub
commit a90b010de8
41 changed files with 124 additions and 135 deletions

View File

@ -4,7 +4,7 @@ const ethUtil = require('ethereumjs-util')
const accountImporter = {
importAccount(strategy, args) {
importAccount (strategy, args) {
try {
const importer = this.strategies[strategy]
const privateKeyHex = importer.apply(null, args)

View File

@ -41,10 +41,10 @@ asyncQ.waterfall([
// State and Persistence
//
function loadStateFromPersistence() {
function loadStateFromPersistence () {
// migrations
let migrator = new Migrator({ migrations })
let initialState = migrator.generateInitialState(firstTimeState)
const migrator = new Migrator({ migrations })
const initialState = migrator.generateInitialState(firstTimeState)
return asyncQ.waterfall([
// read from disk
() => Promise.resolve(diskStore.getState() || initialState),
@ -61,7 +61,6 @@ function loadStateFromPersistence() {
}
function setupController (initState) {
//
// MetaMask Controller
//
@ -85,8 +84,8 @@ function setupController (initState) {
diskStore
)
function versionifyData(state) {
let versionedData = diskStore.getState()
function versionifyData (state) {
const versionedData = diskStore.getState()
versionedData.data = state
return versionedData
}
@ -138,7 +137,6 @@ function setupController (initState) {
}
return Promise.resolve()
}
//

View File

@ -77,7 +77,7 @@ function doctypeCheck () {
}
}
function suffixCheck() {
function suffixCheck () {
var prohibitedTypes = ['xml', 'pdf']
var currentUrl = window.location.href
var currentRegex

View File

@ -39,11 +39,11 @@ class AddressBookController {
// pushed object is an object of two fields. Current behavior does not set an
// upper limit to the number of addresses.
_addToAddressBook (address, name) {
let addressBook = this._getAddressBook()
let identities = this._getIdentities()
const addressBook = this._getAddressBook()
const identities = this._getIdentities()
let addressBookIndex = addressBook.findIndex((element) => { return element.address.toLowerCase() === address.toLowerCase() || element.name === name })
let identitiesIndex = Object.keys(identities).findIndex((element) => { return element.toLowerCase() === address.toLowerCase() })
const addressBookIndex = addressBook.findIndex((element) => { return element.address.toLowerCase() === address.toLowerCase() || element.name === name })
const identitiesIndex = Object.keys(identities).findIndex((element) => { return element.toLowerCase() === address.toLowerCase() })
// trigger this condition if we own this address--no need to overwrite.
if (identitiesIndex !== -1) {
return Promise.resolve(addressBook)

View File

@ -51,9 +51,11 @@ class CurrencyController {
this.setConversionRate(Number(parsedResponse.ticker.price))
this.setConversionDate(Number(parsedResponse.timestamp))
}).catch((err) => {
console.warn('MetaMask - Failed to query currency conversion.')
this.setConversionRate(0)
this.setConversionDate('N/A')
if (err) {
console.warn('MetaMask - Failed to query currency conversion.')
this.setConversionRate(0)
this.setConversionDate('N/A')
}
})
}

View File

@ -36,8 +36,8 @@ class PreferencesController {
}
addToFrequentRpcList (_url) {
let rpcList = this.getFrequentRpcList()
let index = rpcList.findIndex((element) => { return element === _url })
const rpcList = this.getFrequentRpcList()
const index = rpcList.findIndex((element) => { return element === _url })
if (index !== -1) {
rpcList.splice(index, 1)
}
@ -53,13 +53,9 @@ class PreferencesController {
getFrequentRpcList () {
return this.store.getState().frequentRpcList
}
//
// PRIVATE METHODS
//
}
module.exports = PreferencesController

View File

@ -8,4 +8,4 @@ module.exports = {
type: 'testnet',
},
},
}
}

View File

@ -187,7 +187,7 @@ class KeyringController extends EventEmitter {
.then((accounts) => {
switch (type) {
case 'Simple Key Pair':
let isNotIncluded = !accounts.find((key) => key === newAccount[0] || key === ethUtil.stripHexPrefix(newAccount[0]))
const isNotIncluded = !accounts.find((key) => key === newAccount[0] || key === ethUtil.stripHexPrefix(newAccount[0]))
return (isNotIncluded) ? Promise.resolve(newAccount) : Promise.reject(new Error('The account you\'re are trying to import is a duplicate'))
default:
return Promise.resolve(newAccount)
@ -582,7 +582,7 @@ class KeyringController extends EventEmitter {
})
}
_updateMemStoreKeyrings() {
_updateMemStoreKeyrings () {
Promise.all(this.keyrings.map(this.displayForKeyring))
.then((keyrings) => {
this.memStore.updateState({ keyrings })

View File

@ -1,6 +1,6 @@
module.exports = getBuyEthUrl
function getBuyEthUrl({ network, amount, address }){
function getBuyEthUrl ({ network, amount, address }) {
let url
switch (network) {
case '1':
@ -16,4 +16,4 @@ function getBuyEthUrl({ network, amount, address }){
break
}
return url
}
}

View File

@ -10,7 +10,7 @@
const async = require('async')
const EthQuery = require('eth-query')
const ObservableStore = require('obs-store')
function noop() {}
function noop () {}
class EthereumStore extends ObservableStore {

View File

@ -85,7 +85,7 @@ MetamaskInpageProvider.prototype.send = function (payload) {
break
case 'net_version':
let networkVersion = self.publicConfigStore.getState().networkVersion
const networkVersion = self.publicConfigStore.getState().networkVersion
result = networkVersion
break
@ -125,7 +125,7 @@ function eachJsonMessage (payload, transformFn) {
}
}
function logStreamDisconnectWarning(remoteLabel, err){
function logStreamDisconnectWarning (remoteLabel, err) {
let warningMsg = `MetamaskInpageProvider - lost connection to ${remoteLabel}`
if (err) warningMsg += '\n' + err.stack
console.warn(warningMsg)

View File

@ -4,7 +4,7 @@ const ethUtil = require('ethereumjs-util')
const createId = require('./random-id')
module.exports = class MessageManager extends EventEmitter{
module.exports = class MessageManager extends EventEmitter {
constructor (opts) {
super()
this.memStore = new ObservableStore({
@ -108,7 +108,7 @@ module.exports = class MessageManager extends EventEmitter{
}
function normalizeMsgData(data) {
function normalizeMsgData (data) {
if (data.slice(0, 2) === '0x') {
// data is already hex
return data

View File

@ -3,17 +3,17 @@ const asyncQ = require('async-q')
class Migrator {
constructor (opts = {}) {
let migrations = opts.migrations || []
const migrations = opts.migrations || []
this.migrations = migrations.sort((a, b) => a.version - b.version)
let lastMigration = this.migrations.slice(-1)[0]
const lastMigration = this.migrations.slice(-1)[0]
// use specified defaultVersion or highest migration version
this.defaultVersion = opts.defaultVersion || (lastMigration && lastMigration.version) || 0
}
// run all pending migrations on meta in place
migrateData (versionedData = this.generateInitialState()) {
let remaining = this.migrations.filter(migrationIsPending)
const remaining = this.migrations.filter(migrationIsPending)
return (
asyncQ.eachSeries(remaining, (migration) => this.runMigration(versionedData, migration))
.then(() => versionedData)
@ -21,12 +21,12 @@ class Migrator {
// migration is "pending" if hit has a higher
// version number than currentVersion
function migrationIsPending(migration) {
function migrationIsPending (migration) {
return migration.version > versionedData.meta.version
}
}
runMigration(versionedData, migration) {
runMigration (versionedData, migration) {
return (
migration.migrate(versionedData)
.then((versionedData) => {

View File

@ -71,4 +71,4 @@ class NotificationManager {
}
module.exports = NotificationManager
module.exports = NotificationManager

View File

@ -5,7 +5,7 @@ const createId = require('./random-id')
const hexRe = /^[0-9A-Fa-f]+$/g
module.exports = class PersonalMessageManager extends EventEmitter{
module.exports = class PersonalMessageManager extends EventEmitter {
constructor (opts) {
super()
this.memStore = new ObservableStore({
@ -108,7 +108,7 @@ module.exports = class PersonalMessageManager extends EventEmitter{
this.emit('updateBadge')
}
normalizeMsgData(data) {
normalizeMsgData (data) {
try {
const stripped = ethUtil.stripHexPrefix(data)
if (stripped.match(hexRe)) {

View File

@ -75,14 +75,14 @@ module.exports = class txProviderUtils {
}
fillInTxParams (txParams, cb) {
let fromAddress = txParams.from
let reqs = {}
const fromAddress = txParams.from
const reqs = {}
if (isUndef(txParams.gas)) reqs.gas = (cb) => this.query.estimateGas(txParams, cb)
if (isUndef(txParams.gasPrice)) reqs.gasPrice = (cb) => this.query.gasPrice(cb)
if (isUndef(txParams.nonce)) reqs.nonce = (cb) => this.query.getTransactionCount(fromAddress, 'pending', cb)
async.parallel(reqs, function(err, result) {
async.parallel(reqs, function (err, result) {
if (err) return cb(err)
// write results to txParams obj
Object.assign(txParams, result)
@ -123,14 +123,14 @@ module.exports = class txProviderUtils {
// util
function isUndef(value) {
function isUndef (value) {
return value === undefined
}
function bnToHex(inputBn) {
function bnToHex (inputBn) {
return ethUtil.addHexPrefix(inputBn.toString(16))
}
function hexToBn(inputHex) {
function hexToBn (inputHex) {
return new BN(ethUtil.stripHexPrefix(inputHex), 16)
}

View File

@ -32,7 +32,7 @@ module.exports = class MetamaskController extends EventEmitter {
constructor (opts) {
super()
this.opts = opts
let initState = opts.initState || {}
const initState = opts.initState || {}
// platform-specific api
this.platform = opts.platform
@ -161,8 +161,7 @@ module.exports = class MetamaskController extends EventEmitter {
//
initializeProvider () {
let provider = MetaMaskProvider({
const provider = MetaMaskProvider({
static: {
eth_syncing: false,
web3_clientVersion: `MetaMask/v${version}`,
@ -170,8 +169,8 @@ module.exports = class MetamaskController extends EventEmitter {
rpcUrl: this.configManager.getCurrentRpcAddress(),
// account mgmt
getAccounts: (cb) => {
let selectedAddress = this.preferencesController.getSelectedAddress()
let result = selectedAddress ? [selectedAddress] : []
const selectedAddress = this.preferencesController.getSelectedAddress()
const result = selectedAddress ? [selectedAddress] : []
cb(null, result)
},
// tx signing
@ -196,7 +195,7 @@ module.exports = class MetamaskController extends EventEmitter {
publicConfigStore
)
function selectPublicState(state) {
function selectPublicState (state) {
const result = { selectedAddress: undefined }
try {
result.selectedAddress = state.PreferencesController.selectedAddress
@ -253,56 +252,56 @@ module.exports = class MetamaskController extends EventEmitter {
return {
// etc
getState: (cb) => cb(null, this.getState()),
setProviderType: this.setProviderType.bind(this),
useEtherscanProvider: this.useEtherscanProvider.bind(this),
setCurrentCurrency: this.setCurrentCurrency.bind(this),
markAccountsFound: this.markAccountsFound.bind(this),
getState: (cb) => cb(null, this.getState()),
setProviderType: this.setProviderType.bind(this),
useEtherscanProvider: this.useEtherscanProvider.bind(this),
setCurrentCurrency: this.setCurrentCurrency.bind(this),
markAccountsFound: this.markAccountsFound.bind(this),
// coinbase
buyEth: this.buyEth.bind(this),
// shapeshift
createShapeShiftTx: this.createShapeShiftTx.bind(this),
// primary HD keyring management
addNewAccount: this.addNewAccount.bind(this),
placeSeedWords: this.placeSeedWords.bind(this),
clearSeedWordCache: this.clearSeedWordCache.bind(this),
importAccountWithStrategy: this.importAccountWithStrategy.bind(this),
addNewAccount: this.addNewAccount.bind(this),
placeSeedWords: this.placeSeedWords.bind(this),
clearSeedWordCache: this.clearSeedWordCache.bind(this),
importAccountWithStrategy: this.importAccountWithStrategy.bind(this),
// vault management
submitPassword: this.submitPassword.bind(this),
// PreferencesController
setSelectedAddress: nodeify(preferencesController.setSelectedAddress).bind(preferencesController),
setDefaultRpc: nodeify(this.setDefaultRpc).bind(this),
setCustomRpc: nodeify(this.setCustomRpc).bind(this),
setSelectedAddress: nodeify(preferencesController.setSelectedAddress).bind(preferencesController),
setDefaultRpc: nodeify(this.setDefaultRpc).bind(this),
setCustomRpc: nodeify(this.setCustomRpc).bind(this),
// AddressController
setAddressBook: nodeify(addressBookController.setAddressBook).bind(addressBookController),
setAddressBook: nodeify(addressBookController.setAddressBook).bind(addressBookController),
// KeyringController
setLocked: nodeify(keyringController.setLocked).bind(keyringController),
setLocked: nodeify(keyringController.setLocked).bind(keyringController),
createNewVaultAndKeychain: nodeify(keyringController.createNewVaultAndKeychain).bind(keyringController),
createNewVaultAndRestore: nodeify(keyringController.createNewVaultAndRestore).bind(keyringController),
addNewKeyring: nodeify(keyringController.addNewKeyring).bind(keyringController),
saveAccountLabel: nodeify(keyringController.saveAccountLabel).bind(keyringController),
exportAccount: nodeify(keyringController.exportAccount).bind(keyringController),
createNewVaultAndRestore: nodeify(keyringController.createNewVaultAndRestore).bind(keyringController),
addNewKeyring: nodeify(keyringController.addNewKeyring).bind(keyringController),
saveAccountLabel: nodeify(keyringController.saveAccountLabel).bind(keyringController),
exportAccount: nodeify(keyringController.exportAccount).bind(keyringController),
// txManager
approveTransaction: txManager.approveTransaction.bind(txManager),
cancelTransaction: txManager.cancelTransaction.bind(txManager),
approveTransaction: txManager.approveTransaction.bind(txManager),
cancelTransaction: txManager.cancelTransaction.bind(txManager),
updateAndApproveTransaction: this.updateAndApproveTx.bind(this),
// messageManager
signMessage: nodeify(this.signMessage).bind(this),
cancelMessage: this.cancelMessage.bind(this),
signMessage: nodeify(this.signMessage).bind(this),
cancelMessage: this.cancelMessage.bind(this),
// personalMessageManager
signPersonalMessage: nodeify(this.signPersonalMessage).bind(this),
cancelPersonalMessage: this.cancelPersonalMessage.bind(this),
signPersonalMessage: nodeify(this.signPersonalMessage).bind(this),
cancelPersonalMessage: this.cancelPersonalMessage.bind(this),
// notices
checkNotices: noticeController.updateNoticesList.bind(noticeController),
checkNotices: noticeController.updateNoticesList.bind(noticeController),
markNoticeRead: noticeController.markNoticeRead.bind(noticeController),
}
}
@ -441,7 +440,7 @@ module.exports = class MetamaskController extends EventEmitter {
}
newUnsignedMessage (msgParams, cb) {
let msgId = this.messageManager.addUnapprovedMessage(msgParams)
const msgId = this.messageManager.addUnapprovedMessage(msgParams)
this.sendUpdate()
this.opts.showUnconfirmedMessage()
this.messageManager.once(`${msgId}:finished`, (data) => {
@ -461,7 +460,7 @@ module.exports = class MetamaskController extends EventEmitter {
return cb(new Error('MetaMask Message Signature: from field is required.'))
}
let msgId = this.personalMessageManager.addUnapprovedMessage(msgParams)
const msgId = this.personalMessageManager.addUnapprovedMessage(msgParams)
this.sendUpdate()
this.opts.showUnconfirmedMessage()
this.personalMessageManager.once(`${msgId}:finished`, (data) => {
@ -476,7 +475,7 @@ module.exports = class MetamaskController extends EventEmitter {
})
}
updateAndApproveTx(txMeta, cb) {
updateAndApproveTx (txMeta, cb) {
log.debug(`MetaMaskController - updateAndApproveTx: ${JSON.stringify(txMeta)}`)
const txManager = this.txManager
txManager.updateTx(txMeta)
@ -502,7 +501,7 @@ module.exports = class MetamaskController extends EventEmitter {
})
}
cancelMessage(msgId, cb) {
cancelMessage (msgId, cb) {
const messageManager = this.messageManager
messageManager.rejectMsg(msgId)
if (cb && typeof cb === 'function') {
@ -512,7 +511,7 @@ module.exports = class MetamaskController extends EventEmitter {
// Prefixed Style Message Signing Methods:
approvePersonalMessage (msgParams, cb) {
let msgId = this.personalMessageManager.addUnapprovedMessage(msgParams)
const msgId = this.personalMessageManager.addUnapprovedMessage(msgParams)
this.sendUpdate()
this.opts.showUnconfirmedMessage()
this.personalMessageManager.once(`${msgId}:finished`, (data) => {
@ -545,7 +544,7 @@ module.exports = class MetamaskController extends EventEmitter {
})
}
cancelPersonalMessage(msgId, cb) {
cancelPersonalMessage (msgId, cb) {
const messageManager = this.personalMessageManager
messageManager.rejectMsg(msgId)
if (cb && typeof cb === 'function') {
@ -559,13 +558,13 @@ module.exports = class MetamaskController extends EventEmitter {
cb(null, this.getState())
}
restoreOldVaultAccounts(migratorOutput) {
restoreOldVaultAccounts (migratorOutput) {
const { serialized } = migratorOutput
return this.keyringController.restoreKeyring(serialized)
.then(() => migratorOutput)
}
restoreOldLostAccounts(migratorOutput) {
restoreOldLostAccounts (migratorOutput) {
const { lostAccounts } = migratorOutput
if (lostAccounts) {
this.configManager.setLostAccounts(lostAccounts.map(acct => acct.address))

View File

@ -7,7 +7,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
let versionedData = clone(originalVersionedData)
const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
if (versionedData.data.config.provider.type === 'etherscan') {

View File

@ -8,7 +8,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
let versionedData = clone(originalVersionedData)
const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
if (versionedData.data.config.provider.rpcTarget === oldTestRpc) {

View File

@ -6,7 +6,7 @@ module.exports = {
version,
migrate: function (versionedData) {
let safeVersionedData = clone(versionedData)
const safeVersionedData = clone(versionedData)
safeVersionedData.meta.version = version
try {
if (safeVersionedData.data.config.provider.type !== 'rpc') return Promise.resolve(safeVersionedData)

View File

@ -14,7 +14,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
let versionedData = clone(originalVersionedData)
const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data

View File

@ -13,7 +13,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
let versionedData = clone(originalVersionedData)
const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data

View File

@ -13,7 +13,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
let versionedData = clone(originalVersionedData)
const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data

View File

@ -13,7 +13,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
let versionedData = clone(originalVersionedData)
const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data

View File

@ -13,7 +13,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
let versionedData = clone(originalVersionedData)
const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data

View File

@ -13,7 +13,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
let versionedData = clone(originalVersionedData)
const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data

View File

@ -12,7 +12,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
let versionedData = clone(originalVersionedData)
const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data

View File

@ -12,7 +12,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
let versionedData = clone(originalVersionedData)
const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data

View File

@ -15,15 +15,15 @@ const KeyringController = require('../../app/scripts/lib/keyring-controller')
const password = 'obviously not correct'
module.exports = {
version,
version,
migrate: function (versionedData) {
versionedData.meta.version = version
let store = new ObservableStore(versionedData.data)
let configManager = new ConfigManager({ store })
let idStoreMigrator = new IdentityStoreMigrator({ configManager })
let keyringController = new KeyringController({
const store = new ObservableStore(versionedData.data)
const configManager = new ConfigManager({ store })
const idStoreMigrator = new IdentityStoreMigrator({ configManager })
const keyringController = new KeyringController({
configManager: configManager,
})
@ -46,6 +46,5 @@ module.exports = {
return Promise.resolve(versionedData)
})
})
},
}

View File

@ -16,7 +16,6 @@ function initializePopup ({ container, connectionStream }, cb) {
(cb) => connectToAccountManager(connectionStream, cb),
(accountManager, cb) => launchMetamaskUi({ container, accountManager }, cb),
], cb)
}
function connectToAccountManager (connectionStream, cb) {

View File

@ -41,7 +41,7 @@ function closePopupIfOpen (windowType) {
}
}
function displayCriticalError(err) {
function displayCriticalError (err) {
container.innerHTML = '<div class="critical-error">The MetaMask app failed to load: please open and close MetaMask again to restart.</div>'
container.style.height = '80px'
log.error(err.stack)

View File

@ -28,9 +28,9 @@ module.exports = class TransactionManager extends EventEmitter {
// memstore is computed from a few different stores
this._updateMemstore()
this.store.subscribe(() => this._updateMemstore() )
this.networkStore.subscribe(() => this._updateMemstore() )
this.preferencesStore.subscribe(() => this._updateMemstore() )
this.store.subscribe(() => this._updateMemstore())
this.networkStore.subscribe(() => this._updateMemstore())
this.preferencesStore.subscribe(() => this._updateMemstore())
}
getState () {
@ -47,8 +47,8 @@ module.exports = class TransactionManager extends EventEmitter {
// Returns the tx list
getTxList () {
let network = this.getNetwork()
let fullTxList = this.getFullTxList()
const network = this.getNetwork()
const fullTxList = this.getFullTxList()
return fullTxList.filter(txMeta => txMeta.metamaskNetworkId === network)
}
@ -64,10 +64,10 @@ module.exports = class TransactionManager extends EventEmitter {
// Adds a tx to the txlist
addTx (txMeta) {
let txCount = this.getTxCount()
let network = this.getNetwork()
let fullTxList = this.getFullTxList()
let txHistoryLimit = this.txHistoryLimit
const txCount = this.getTxCount()
const network = this.getNetwork()
const fullTxList = this.getFullTxList()
const txHistoryLimit = this.txHistoryLimit
// checks if the length of the tx history is
// longer then desired persistence limit
@ -197,7 +197,7 @@ module.exports = class TransactionManager extends EventEmitter {
}
fillInTxParams (txId, cb) {
let txMeta = this.getTx(txId)
const txMeta = this.getTx(txId)
this.txProviderUtils.fillInTxParams(txMeta.txParams, (err) => {
if (err) return cb(err)
this.updateTx(txMeta)
@ -205,7 +205,7 @@ module.exports = class TransactionManager extends EventEmitter {
})
}
getChainId() {
getChainId () {
const networkState = this.networkStore.getState()
const getChainId = parseInt(networkState.network)
if (Number.isNaN(getChainId)) {
@ -242,7 +242,7 @@ module.exports = class TransactionManager extends EventEmitter {
// receives a txHash records the tx as signed
setTxHash (txId, txHash) {
// Add the tx hash to the persisted meta-tx object
let txMeta = this.getTx(txId)
const txMeta = this.getTx(txId)
txMeta.hash = txHash
this.updateTx(txMeta)
}
@ -315,7 +315,7 @@ module.exports = class TransactionManager extends EventEmitter {
}
setTxStatusFailed (txId, reason) {
let txMeta = this.getTx(txId)
const txMeta = this.getTx(txId)
txMeta.err = reason
this.updateTx(txMeta)
this._setTxStatus(txId, 'failed')
@ -338,7 +338,7 @@ module.exports = class TransactionManager extends EventEmitter {
var txHash = txMeta.hash
var txId = txMeta.id
if (!txHash) {
let errReason = {
const errReason = {
errCode: 'No hash was provided',
message: 'We had an error while submitting this transaction, please try again.',
}

View File

@ -73,7 +73,7 @@ AccountImportSubview.prototype.render = function () {
)
}
AccountImportSubview.prototype.renderImportView = function() {
AccountImportSubview.prototype.renderImportView = function () {
const props = this.props
const state = this.state || {}
const { type } = state

View File

@ -314,7 +314,7 @@ function importNewAccount (strategy, args) {
}
}
function navigateToNewAccountScreen() {
function navigateToNewAccountScreen () {
return {
type: this.NEW_ACCOUNT_SCREEN,
}
@ -665,7 +665,7 @@ function clearNotices () {
}
}
function markAccountsFound() {
function markAccountsFound () {
log.debug(`background.markAccountsFound`)
return callBackgroundThenUpdate(background.markAccountsFound)
}
@ -978,7 +978,7 @@ function callBackgroundThenUpdate (method, ...args) {
}
}
function forceUpdateMetamaskState(dispatch){
function forceUpdateMetamaskState (dispatch) {
log.debug(`background.getState`)
background.getState((err, newState) => {
if (err) {

View File

@ -552,5 +552,4 @@ App.prototype.renderCommonRpc = function (rpcList, provider) {
})
}
})
}

View File

@ -24,7 +24,7 @@ EnsInput.prototype.render = function () {
list: 'addresses',
onChange: () => {
const network = this.props.network
let resolverAddress = networkResolvers[network]
const resolverAddress = networkResolvers[network]
if (!resolverAddress) return
const recipient = document.querySelector('input[name="address"]').value
@ -52,7 +52,7 @@ EnsInput.prototype.render = function () {
[
// Corresponds to the addresses owned.
Object.keys(props.identities).map((key) => {
let identity = props.identities[key]
const identity = props.identities[key]
return h('option', {
value: identity.address,
label: identity.name,
@ -72,7 +72,7 @@ EnsInput.prototype.render = function () {
EnsInput.prototype.componentDidMount = function () {
const network = this.props.network
let resolverAddress = networkResolvers[network]
const resolverAddress = networkResolvers[network]
if (resolverAddress) {
const provider = web3.currentProvider

View File

@ -115,8 +115,9 @@ Notice.prototype.render = function () {
Notice.prototype.componentDidMount = function () {
var node = findDOMNode(this)
linker.setupListener(node)
if (document.getElementsByClassName('notice-box')[0].clientHeight < 310) { this.setState({disclaimerDisabled: false}) }
if (document.getElementsByClassName('notice-box')[0].clientHeight < 310) {
this.setState({disclaimerDisabled: false})
}
}
Notice.prototype.componentWillUnmount = function () {

View File

@ -15,7 +15,7 @@ TransactionIcon.prototype.render = function () {
const { transaction, txParams, isMsg } = this.props
switch (transaction.status) {
case 'unapproved':
return h( !isMsg ? '.unapproved-tx-icon' : 'i.fa.fa-certificate.fa-lg')
return h(!isMsg ? '.unapproved-tx-icon' : 'i.fa.fa-certificate.fa-lg')
case 'rejected':
return h('i.fa.fa-exclamation-triangle.fa-lg.warning', {

View File

@ -134,7 +134,6 @@ function failIfFailed (transaction) {
return h('span.error', ' (Rejected)')
}
if (transaction.err) {
return h(Tooltip, {
title: transaction.err.message,
position: 'bottom',
@ -142,5 +141,4 @@ function failIfFailed (transaction) {
h('span.error', ' (Failed)'),
])
}
}

View File

@ -125,14 +125,12 @@ function currentTxView (opts) {
if (txParams) {
log.debug('txParams detected, rendering pending tx')
return h(PendingTx, opts)
} else if (msgParams) {
log.debug('msgParams detected, rendering pending msg')
if (type === 'eth_sign') {
log.debug('rendering eth_sign message')
return h(PendingMsg, opts)
} else if (type === 'personal_sign') {
log.debug('rendering personal_sign message')
return h(PendingPersonalMsg, opts)

View File

@ -315,7 +315,7 @@ function reduceApp (state, action) {
case actions.COMPLETED_TX:
log.debug('reducing COMPLETED_TX for tx ' + action.value)
const otherUnconfActions = getUnconfActionList(state)
.filter(tx => tx.id !== action.value )
.filter(tx => tx.id !== action.value)
const hasOtherUnconfActions = otherUnconfActions.length > 0
if (hasOtherUnconfActions) {