aboutsummaryrefslogtreecommitdiffstats
path: root/packages/subproviders
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-12-15 20:58:30 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-12-15 20:58:30 +0800
commit126048bac9f52871b841d9898cabe7cfd265ebb6 (patch)
treebcb2d17aeeaa4a99482bdf8e8a41758f02fd4ee4 /packages/subproviders
parent274aa50d740e4f3af9e3d50468843ed19b555aa3 (diff)
downloaddexon-sol-tools-126048bac9f52871b841d9898cabe7cfd265ebb6.tar
dexon-sol-tools-126048bac9f52871b841d9898cabe7cfd265ebb6.tar.gz
dexon-sol-tools-126048bac9f52871b841d9898cabe7cfd265ebb6.tar.bz2
dexon-sol-tools-126048bac9f52871b841d9898cabe7cfd265ebb6.tar.lz
dexon-sol-tools-126048bac9f52871b841d9898cabe7cfd265ebb6.tar.xz
dexon-sol-tools-126048bac9f52871b841d9898cabe7cfd265ebb6.tar.zst
dexon-sol-tools-126048bac9f52871b841d9898cabe7cfd265ebb6.zip
Fix connect unused vars
Diffstat (limited to 'packages/subproviders')
-rw-r--r--packages/subproviders/src/subproviders/ledger.ts15
-rw-r--r--packages/subproviders/src/subproviders/subprovider.ts4
-rw-r--r--packages/subproviders/src/types.ts1
-rw-r--r--packages/subproviders/test/integration/ledger_subprovider_test.ts4
-rw-r--r--packages/subproviders/test/unit/ledger_subprovider_test.ts3
-rw-r--r--packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts1
6 files changed, 1 insertions, 27 deletions
diff --git a/packages/subproviders/src/subproviders/ledger.ts b/packages/subproviders/src/subproviders/ledger.ts
index 578f6ff6f..9ffc105a4 100644
--- a/packages/subproviders/src/subproviders/ledger.ts
+++ b/packages/subproviders/src/subproviders/ledger.ts
@@ -1,9 +1,7 @@
import {assert} from '@0xproject/assert';
import {addressUtils} from '@0xproject/utils';
-import promisify = require('es6-promisify');
import EthereumTx = require('ethereumjs-tx');
import ethUtil = require('ethereumjs-util');
-import * as ledger from 'ledgerco';
import * as _ from 'lodash';
import Semaphore from 'semaphore-async-await';
import Web3 = require('web3');
@@ -23,7 +21,6 @@ const DEFAULT_DERIVATION_PATH = `44'/60'/0'`;
const NUM_ADDRESSES_TO_FETCH = 10;
const ASK_FOR_ON_DEVICE_CONFIRMATION = false;
const SHOULD_GET_CHAIN_CODE = false;
-const HEX_REGEX = /^[0-9A-Fa-f]+$/g;
export class LedgerSubprovider extends Subprovider {
private _nonceLock: Semaphore;
@@ -34,18 +31,6 @@ export class LedgerSubprovider extends Subprovider {
private _ledgerEthereumClientFactoryAsync: LedgerEthereumClientFactoryAsync;
private _ledgerClientIfExists?: LedgerEthereumClient;
private _shouldAlwaysAskForConfirmation: boolean;
- private static isValidHex(data: string) {
- if (!_.isString(data)) {
- return false;
- }
- const isHexPrefixed = data.slice(0, 2) === '0x';
- if (!isHexPrefixed) {
- return false;
- }
- const nonPrefixed = data.slice(2);
- const isValid = nonPrefixed.match(HEX_REGEX);
- return isValid;
- }
private static validateSender(sender: string) {
if (_.isUndefined(sender) || !addressUtils.isAddress(sender)) {
throw new Error(LedgerSubproviderErrors.SenderInvalidOrNotSupplied);
diff --git a/packages/subproviders/src/subproviders/subprovider.ts b/packages/subproviders/src/subproviders/subprovider.ts
index 64d97b958..41dde4238 100644
--- a/packages/subproviders/src/subproviders/subprovider.ts
+++ b/packages/subproviders/src/subproviders/subprovider.ts
@@ -11,7 +11,6 @@ import {
*/
export class Subprovider {
private engine: any;
- private currentBlock: any;
// Ported from: https://github.com/MetaMask/provider-engine/blob/master/util/random-id.js
private static getRandomId() {
const extraDigits = 3;
@@ -34,9 +33,6 @@ export class Subprovider {
}
public setEngine(engine: any): void {
this.engine = engine;
- engine.on('block', (block: any) => {
- this.currentBlock = block;
- });
}
public async emitPayloadAsync(payload: JSONRPCPayload): Promise<any> {
const finalPayload = Subprovider.createFinalPayload(payload);
diff --git a/packages/subproviders/src/types.ts b/packages/subproviders/src/types.ts
index 38dc1e67e..1e7d3eab0 100644
--- a/packages/subproviders/src/types.ts
+++ b/packages/subproviders/src/types.ts
@@ -1,5 +1,4 @@
import * as _ from 'lodash';
-import * as Web3 from 'web3';
export interface LedgerCommunicationClient {
close_async: () => Promise<void>;
diff --git a/packages/subproviders/test/integration/ledger_subprovider_test.ts b/packages/subproviders/test/integration/ledger_subprovider_test.ts
index 75f6d47fe..ab4ffb19a 100644
--- a/packages/subproviders/test/integration/ledger_subprovider_test.ts
+++ b/packages/subproviders/test/integration/ledger_subprovider_test.ts
@@ -2,20 +2,16 @@ import * as chai from 'chai';
import promisify = require('es6-promisify');
import * as ethUtils from 'ethereumjs-util';
import * as _ from 'lodash';
-import * as mocha from 'mocha';
import Web3 = require('web3');
import Web3ProviderEngine = require('web3-provider-engine');
import RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
import {
- ECSignature,
ledgerEthereumNodeJsClientFactoryAsync,
LedgerSubprovider,
} from '../../src';
import {
DoneCallback,
- LedgerGetAddressResult,
- PartialTxParams,
} from '../../src/types';
import {chaiSetup} from '../chai_setup';
import {reportCallbackErrors} from '../utils/report_callback_errors';
diff --git a/packages/subproviders/test/unit/ledger_subprovider_test.ts b/packages/subproviders/test/unit/ledger_subprovider_test.ts
index 964df5db9..bd4d93325 100644
--- a/packages/subproviders/test/unit/ledger_subprovider_test.ts
+++ b/packages/subproviders/test/unit/ledger_subprovider_test.ts
@@ -6,14 +6,11 @@ import Web3ProviderEngine = require('web3-provider-engine');
import RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
import {
- ECSignature,
LedgerSubprovider,
} from '../../src';
import {
DoneCallback,
- ECSignatureString,
LedgerCommunicationClient,
- LedgerGetAddressResult,
LedgerSubproviderErrors,
} from '../../src/types';
import {chaiSetup} from '../chai_setup';
diff --git a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts
index edeb1d5a2..2f1676915 100644
--- a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts
+++ b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts
@@ -11,6 +11,7 @@ import {chaiSetup} from '../chai_setup';
import {reportCallbackErrors} from '../utils/report_callback_errors';
const expect = chai.expect;
+chaiSetup.configure();
describe('RedundantRpcSubprovider', () => {
let provider: Web3ProviderEngine;