From be6eb79296809b6907dc0ae25b731f58bd4c6055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Thu, 17 Nov 2016 14:00:53 +0100 Subject: [PATCH] Fixing JS lints --- js/src/api/rpc/parity/parity.js | 4 +- .../dapps/localtx/Application/application.js | 2 +- .../dapps/localtx/Transaction/transaction.js | 46 ++++++++++++------- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/js/src/api/rpc/parity/parity.js b/js/src/api/rpc/parity/parity.js index 2c90d091b..d14cc6554 100644 --- a/js/src/api/rpc/parity/parity.js +++ b/js/src/api/rpc/parity/parity.js @@ -135,7 +135,9 @@ export default class Parity { .then(transactions => { Object.values(transactions) .filter(tx => tx.transaction) - .map(tx => tx.transaction = outTransaction(tx.transaction)); + .map(tx => { + tx.transaction = outTransaction(tx.transaction); + }); return transactions; }); } diff --git a/js/src/dapps/localtx/Application/application.js b/js/src/dapps/localtx/Application/application.js index a6e6cd166..89b0b73b4 100644 --- a/js/src/dapps/localtx/Application/application.js +++ b/js/src/dapps/localtx/Application/application.js @@ -157,7 +157,7 @@ export default class Application extends Component { transactions.map((tx, idx) => ( + { api.util.fromWei(transaction.gasPrice, 'shannon').toFormat(2) } shannon ); @@ -72,7 +72,7 @@ class BaseTransaction extends Component { return ( - { transaction.gas.div(10**6).toFormat(3) } MGas + { transaction.gas.div(10 ** 6).toFormat(3) } MGas ); } @@ -137,13 +137,11 @@ export class Transaction extends BaseTransaction { render () { const { isLocal, stats, transaction, idx } = this.props; + const blockNo = new BigNumber(stats.firstSeen); const clazz = classnames(styles.transaction, { [styles.local]: isLocal }); - const noOfPeers = Object.keys(stats.propagatedTo).length; - const noOfPropagations = Object.values(stats.propagatedTo).reduce((sum, val) => sum + val, 0); - const blockNo = new BigNumber(stats.firstSeen); return ( @@ -232,17 +230,29 @@ export class LocalTransaction extends BaseTransaction { const { isResubmitting, gasPrice } = this.state; this.setState({ - isResubmitting: !isResubmitting, + isResubmitting: !isResubmitting }); if (gasPrice === null) { this.setState({ - gasPrice: `0x${ transaction.gasPrice.toString(16) }`, - gas: `0x${ transaction.gas.toString(16) }` + gasPrice: `0x${transaction.gasPrice.toString(16)}`, + gas: `0x${transaction.gas.toString(16)}` }); } }; + setGasPrice = el => { + this.setState({ + gasPrice: el.target.value + }); + }; + + setGas = el => { + this.setState({ + gas: el.target.value + }); + }; + sendTransaction = () => { const { transaction } = this.props; const { gasPrice, gas } = this.state; @@ -317,18 +327,20 @@ export class LocalTransaction extends BaseTransaction { const { details } = this.props; let state = { - 'pending': () => `In queue: Pending`, - 'future': () => `In queue: Future`, - 'mined': () => `Mined`, - 'dropped': () => `Dropped because of queue limit`, - 'invalid': () => `Transaction is invalid`, - 'rejected': () => `Rejected: ${ details.error }`, - 'replaced': () => `Replaced by ${ this.shortHash(details.hash) }`, + 'pending': () => 'In queue: Pending', + 'future': () => 'In queue: Future', + 'mined': () => 'Mined', + 'dropped': () => 'Dropped because of queue limit', + 'invalid': () => 'Transaction is invalid', + 'rejected': () => `Rejected: ${details.error}`, + 'replaced': () => `Replaced by ${this.shortHash(details.hash)}` }[this.props.status]; return state ? state() : 'unknown'; } + // TODO [ToDr] Gas Price / Gas selection is not needed + // when signer supports gasPrice/gas tunning. renderResubmit () { const { transaction } = this.props; const { gasPrice, gas } = this.state; @@ -350,12 +362,12 @@ export class LocalTransaction extends BaseTransaction { this.setState({ gasPrice: el.target.value }) } + onChange={ this.setGasPrice } /> this.setState({ gas: el.target.value }) } + onChange={ this.setGas } />