From 5494aa4f9c34353158dc0c6d07d48abec247ccd8 Mon Sep 17 00:00:00 2001 From: frankiebee Date: Tue, 10 Apr 2018 14:53:40 -0700 Subject: transactions - lint fixes --- app/scripts/controllers/transactions/lib/util.js | 10 +++++----- app/scripts/controllers/transactions/tx-gas-utils.js | 2 +- app/scripts/controllers/transactions/tx-state-manager.js | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/scripts/controllers/transactions/lib/util.js b/app/scripts/controllers/transactions/lib/util.js index f403b0758..5d5e63c59 100644 --- a/app/scripts/controllers/transactions/lib/util.js +++ b/app/scripts/controllers/transactions/lib/util.js @@ -7,7 +7,7 @@ module.exports = { normalizeTxParams, validateTxParams, validateFrom, - validateRecipient + validateRecipient, } @@ -48,19 +48,19 @@ function validateTxParams (txParams) { } function validateFrom (txParams) { - if ( !(typeof txParams.from === 'string') ) throw new Error(`Invalid from address ${txParams.from} not a string`) + if (!(typeof txParams.from === 'string')) throw new Error(`Invalid from address ${txParams.from} not a string`) if (!isValidAddress(txParams.from)) throw new Error('Invalid from address') } function validateRecipient (txParams) { - if (txParams.to === '0x' || txParams.to === null ) { + if (txParams.to === '0x' || txParams.to === null) { if (txParams.data) { delete txParams.to } else { throw new Error('Invalid recipient address') } - } else if ( txParams.to !== undefined && !isValidAddress(txParams.to) ) { + } else if (txParams.to !== undefined && !isValidAddress(txParams.to)) { throw new Error('Invalid recipient address') } return txParams -} \ No newline at end of file +} diff --git a/app/scripts/controllers/transactions/tx-gas-utils.js b/app/scripts/controllers/transactions/tx-gas-utils.js index f40542603..1a7ff5b54 100644 --- a/app/scripts/controllers/transactions/tx-gas-utils.js +++ b/app/scripts/controllers/transactions/tx-gas-utils.js @@ -100,4 +100,4 @@ module.exports = class TxGasUtil { // otherwise use blockGasLimit return bnToHex(upperGasLimitBn) } -} \ No newline at end of file +} diff --git a/app/scripts/controllers/transactions/tx-state-manager.js b/app/scripts/controllers/transactions/tx-state-manager.js index cb24b8c99..f898cc44a 100644 --- a/app/scripts/controllers/transactions/tx-state-manager.js +++ b/app/scripts/controllers/transactions/tx-state-manager.js @@ -92,7 +92,7 @@ module.exports = class TransactionStateManager extends EventEmitter { // or rejected tx's. // not tx's that are pending or unapproved if (txCount > txHistoryLimit - 1) { - let index = transactions.findIndex((metaTx) => { + const index = transactions.findIndex((metaTx) => { return this.getFinalStates().includes(metaTx.status) }) if (index !== -1) { @@ -145,7 +145,7 @@ module.exports = class TransactionStateManager extends EventEmitter { } // validates txParams members by type - validateTxParams(txParams) { + validateTxParams (txParams) { Object.keys(txParams).forEach((key) => { const value = txParams[key] // validate types @@ -263,10 +263,10 @@ module.exports = class TransactionStateManager extends EventEmitter { // returns an array of states that can be considered final getFinalStates () { return [ - 'rejected', // the user has responded no! - 'confirmed', // the tx has been included in a block. - 'failed', // the tx failed for some reason, included on tx data. - 'dropped', // the tx nonce was already used + 'rejected', // the user has responded no! + 'confirmed', // the tx has been included in a block. + 'failed', // the tx failed for some reason, included on tx data. + 'dropped', // the tx nonce was already used ] } -- cgit v1.2.3