diff options
author | Fabio Berger <me@fabioberger.com> | 2017-11-28 11:38:09 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-11-28 11:38:09 +0800 |
commit | 0a19ba3014ac68c1c94fcb376bc1ddb5081db757 (patch) | |
tree | 0f7a8572c1fb6172b3f0474dd6e6356f569f8760 /packages/website/ts/subproviders | |
parent | 88bd0f5328863141564faf2718118594732b66ca (diff) | |
download | dexon-sol-tools-0a19ba3014ac68c1c94fcb376bc1ddb5081db757.tar dexon-sol-tools-0a19ba3014ac68c1c94fcb376bc1ddb5081db757.tar.gz dexon-sol-tools-0a19ba3014ac68c1c94fcb376bc1ddb5081db757.tar.bz2 dexon-sol-tools-0a19ba3014ac68c1c94fcb376bc1ddb5081db757.tar.lz dexon-sol-tools-0a19ba3014ac68c1c94fcb376bc1ddb5081db757.tar.xz dexon-sol-tools-0a19ba3014ac68c1c94fcb376bc1ddb5081db757.tar.zst dexon-sol-tools-0a19ba3014ac68c1c94fcb376bc1ddb5081db757.zip |
Fix tslint issues
Diffstat (limited to 'packages/website/ts/subproviders')
3 files changed, 23 insertions, 20 deletions
diff --git a/packages/website/ts/subproviders/injected_web3_subprovider.ts b/packages/website/ts/subproviders/injected_web3_subprovider.ts index b9e5af3ef..910fe3cdf 100644 --- a/packages/website/ts/subproviders/injected_web3_subprovider.ts +++ b/packages/website/ts/subproviders/injected_web3_subprovider.ts @@ -1,6 +1,6 @@ import * as _ from 'lodash'; -import Web3 = require('web3'); import {constants} from 'ts/utils/constants'; +import Web3 = require('web3'); /* * This class implements the web3-provider-engine subprovider interface and forwards @@ -38,6 +38,7 @@ export class InjectedWeb3SubProvider { } } // Required to implement this method despite not needing it for this subprovider + // tslint:disable-next-line:prefer-function-over-method public setEngine(engine: any) { // noop } diff --git a/packages/website/ts/subproviders/ledger_wallet_subprovider_factory.ts b/packages/website/ts/subproviders/ledger_wallet_subprovider_factory.ts index df0c5a4db..bfabc90ae 100644 --- a/packages/website/ts/subproviders/ledger_wallet_subprovider_factory.ts +++ b/packages/website/ts/subproviders/ledger_wallet_subprovider_factory.ts @@ -1,11 +1,11 @@ -import * as _ from 'lodash'; -import Web3 = require('web3'); import * as EthereumTx from 'ethereumjs-tx'; import ethUtil = require('ethereumjs-util'); import * as ledger from 'ledgerco'; -import HookedWalletSubprovider = require('web3-provider-engine/subproviders/hooked-wallet'); -import {constants} from 'ts/utils/constants'; +import * as _ from 'lodash'; import {LedgerEthConnection, SignPersonalMessageParams, TxParams} from 'ts/types'; +import {constants} from 'ts/utils/constants'; +import Web3 = require('web3'); +import HookedWalletSubprovider = require('web3-provider-engine/subproviders/hooked-wallet'); const NUM_ADDRESSES_TO_FETCH = 10; const ASK_FOR_ON_DEVICE_CONFIRMATION = false; diff --git a/packages/website/ts/subproviders/redundant_rpc_subprovider.ts b/packages/website/ts/subproviders/redundant_rpc_subprovider.ts index a6c53ebd1..74675d910 100644 --- a/packages/website/ts/subproviders/redundant_rpc_subprovider.ts +++ b/packages/website/ts/subproviders/redundant_rpc_subprovider.ts @@ -1,11 +1,26 @@ +import promisify = require('es6-promisify'); import * as _ from 'lodash'; import {JSONRPCPayload} from 'ts/types'; -import promisify = require('es6-promisify'); -import Subprovider = require('web3-provider-engine/subproviders/subprovider'); import RpcSubprovider = require('web3-provider-engine/subproviders/rpc'); +import Subprovider = require('web3-provider-engine/subproviders/subprovider'); export class RedundantRPCSubprovider extends Subprovider { private rpcs: RpcSubprovider[]; + private static async firstSuccessAsync( + rpcs: RpcSubprovider[], payload: JSONRPCPayload, next: () => void, + ): Promise<any> { + let lastErr; + for (const rpc of rpcs) { + try { + const data = await promisify(rpc.handleRequest.bind(rpc))(payload, next); + return data; + } catch (err) { + lastErr = err; + continue; + } + } + throw Error(lastErr); + } constructor(endpoints: string[]) { super(); this.rpcs = _.map(endpoints, endpoint => { @@ -25,17 +40,4 @@ export class RedundantRPCSubprovider extends Subprovider { } } - private async firstSuccessAsync(rpcs: RpcSubprovider[], payload: JSONRPCPayload, next: () => void): Promise<any> { - let lastErr; - for (const rpc of rpcs) { - try { - const data = await promisify(rpc.handleRequest.bind(rpc))(payload, next); - return data; - } catch (err) { - lastErr = err; - continue; - } - } - throw Error(lastErr); - } } |