diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-12-15 20:58:30 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-12-15 20:58:30 +0800 |
commit | 126048bac9f52871b841d9898cabe7cfd265ebb6 (patch) | |
tree | bcb2d17aeeaa4a99482bdf8e8a41758f02fd4ee4 /packages | |
parent | 274aa50d740e4f3af9e3d50468843ed19b555aa3 (diff) | |
download | dexon-0x-contracts-126048bac9f52871b841d9898cabe7cfd265ebb6.tar.gz dexon-0x-contracts-126048bac9f52871b841d9898cabe7cfd265ebb6.tar.zst dexon-0x-contracts-126048bac9f52871b841d9898cabe7cfd265ebb6.zip |
Fix connect unused vars
Diffstat (limited to 'packages')
24 files changed, 8 insertions, 54 deletions
diff --git a/packages/connect/src/utils/orderbook_channel_message_parsers.ts b/packages/connect/src/utils/orderbook_channel_message_parsers.ts index 486a416ef..d9a84cca2 100644 --- a/packages/connect/src/utils/orderbook_channel_message_parsers.ts +++ b/packages/connect/src/utils/orderbook_channel_message_parsers.ts @@ -5,7 +5,6 @@ import * as _ from 'lodash'; import { OrderbookChannelMessage, OrderbookChannelMessageTypes, - SignedOrder, } from '../types'; import {typeConverters} from './type_converters'; diff --git a/packages/connect/src/ws_orderbook_channel.ts b/packages/connect/src/ws_orderbook_channel.ts index 6687025c0..f58593484 100644 --- a/packages/connect/src/ws_orderbook_channel.ts +++ b/packages/connect/src/ws_orderbook_channel.ts @@ -8,7 +8,6 @@ import { OrderbookChannelHandler, OrderbookChannelMessageTypes, OrderbookChannelSubscriptionOpts, - SignedOrder, WebsocketClientEventType, WebsocketConnectionEventType, } from './types'; @@ -99,7 +98,6 @@ export class WebSocketOrderbookChannel implements OrderbookChannel { try { const utf8Data = message.utf8Data; const parserResult = orderbookChannelMessageParsers.parser(utf8Data); - const type = parserResult.type; if (parserResult.requestId === requestId) { switch (parserResult.type) { case (OrderbookChannelMessageTypes.Snapshot): { diff --git a/packages/contracts/deploy/migrations/migrate.ts b/packages/contracts/deploy/migrations/migrate.ts index f40b7c4ba..e893e6a6f 100644 --- a/packages/contracts/deploy/migrations/migrate.ts +++ b/packages/contracts/deploy/migrations/migrate.ts @@ -1,11 +1,9 @@ import {Web3Wrapper} from '@0xproject/web3-wrapper'; import {BigNumber} from 'bignumber.js'; import * as _ from 'lodash'; -import * as Web3 from 'web3'; import {Deployer} from './../src/deployer'; import {constants} from './../src/utils/constants'; -import {Token} from './../src/utils/types'; import {tokenInfo} from './config/token_info'; export const migrator = { diff --git a/packages/contracts/deploy/src/compiler.ts b/packages/contracts/deploy/src/compiler.ts index 8a44e94a3..333a2d0ce 100644 --- a/packages/contracts/deploy/src/compiler.ts +++ b/packages/contracts/deploy/src/compiler.ts @@ -1,4 +1,3 @@ -import {promisify} from '@0xproject/utils'; import * as ethUtil from 'ethereumjs-util'; import * as _ from 'lodash'; import * as path from 'path'; @@ -14,7 +13,6 @@ import { ContractNetworks, ContractSources, ImportContents, - SolcErrors, } from './utils/types'; import {utils} from './utils/utils'; diff --git a/packages/contracts/deploy/src/deployer.ts b/packages/contracts/deploy/src/deployer.ts index 4c8018ecc..991504972 100644 --- a/packages/contracts/deploy/src/deployer.ts +++ b/packages/contracts/deploy/src/deployer.ts @@ -1,5 +1,4 @@ import {TxData} from '@0xproject/types'; -import {promisify} from '@0xproject/utils'; import {Web3Wrapper} from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import * as Web3 from 'web3'; diff --git a/packages/contracts/deploy/test/deploy_test.ts b/packages/contracts/deploy/test/deploy_test.ts index 7e7b98f90..263174a94 100644 --- a/packages/contracts/deploy/test/deploy_test.ts +++ b/packages/contracts/deploy/test/deploy_test.ts @@ -4,7 +4,7 @@ import 'mocha'; import {Compiler} from './../src/compiler'; import {Deployer} from './../src/deployer'; import {fsWrapper} from './../src/utils/fs_wrapper'; -import {CompilerOptions, ContractArtifact, ContractData, DeployerOptions, DoneCallback} from './../src/utils/types'; +import {CompilerOptions, ContractArtifact, ContractData, DoneCallback} from './../src/utils/types'; import {constructor_args, exchange_binary} from './fixtures/exchange_bin'; import {constants} from './util/constants'; diff --git a/packages/contracts/migrations/2_deploy_independent_contracts.ts b/packages/contracts/migrations/2_deploy_independent_contracts.ts index db9fc370d..4bf316be6 100644 --- a/packages/contracts/migrations/2_deploy_independent_contracts.ts +++ b/packages/contracts/migrations/2_deploy_independent_contracts.ts @@ -1,5 +1,5 @@ import {Artifacts} from '../util/artifacts'; -import {ContractInstance, MultiSigConfigByNetwork} from '../util/types'; +import {MultiSigConfigByNetwork} from '../util/types'; const { MultiSigWalletWithTimeLock, TokenTransferProxy, diff --git a/packages/contracts/migrations/3_register_tokens.ts b/packages/contracts/migrations/3_register_tokens.ts index c72ac1510..f81693628 100644 --- a/packages/contracts/migrations/3_register_tokens.ts +++ b/packages/contracts/migrations/3_register_tokens.ts @@ -3,7 +3,7 @@ import * as _ from 'lodash'; import {Artifacts} from '../util/artifacts'; import {constants} from '../util/constants'; -import {ContractInstance, Token, TokenInfoByNetwork} from '../util/types'; +import {ContractInstance, Token} from '../util/types'; import {tokenInfo} from './config/token_info'; const { diff --git a/packages/contracts/test/ts/ether_token_v2.ts b/packages/contracts/test/ts/ether_token_v2.ts index b88fef579..61ac4cb57 100644 --- a/packages/contracts/test/ts/ether_token_v2.ts +++ b/packages/contracts/test/ts/ether_token_v2.ts @@ -81,7 +81,7 @@ contract('EtherTokenV2', (accounts: string[]) => { const logArgs = (logs[0] as any).args; expect(logArgs._from).to.equal(expectedFrom); expect(logArgs._to).to.equal(expectedTo); - expect(logArgs._value).to.be.bignumber.equal(ethToDeposit); + expect(logArgs._value).to.be.bignumber.equal(expectedValue); }); }); @@ -120,7 +120,6 @@ contract('EtherTokenV2', (accounts: string[]) => { it('should log 1 event with correct arguments', async () => { const initEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account); - const initEthBalance = await getEthBalanceAsync(account); const ethTokensToWithdraw = initEthTokenBalance; expect(ethTokensToWithdraw).to.not.be.bignumber.equal(0); const txHash = await zeroEx.etherToken.withdrawAsync(ethTokensToWithdraw, account, { @@ -137,7 +136,7 @@ contract('EtherTokenV2', (accounts: string[]) => { const logArgs = (logs[0] as any).args; expect(logArgs._from).to.equal(expectedFrom); expect(logArgs._to).to.equal(expectedTo); - expect(logArgs._value).to.be.bignumber.equal(ethTokensToWithdraw); + expect(logArgs._value).to.be.bignumber.equal(expectedValue); }); }); diff --git a/packages/contracts/test/ts/exchange/core.ts b/packages/contracts/test/ts/exchange/core.ts index 641084937..aef2b5a5d 100644 --- a/packages/contracts/test/ts/exchange/core.ts +++ b/packages/contracts/test/ts/exchange/core.ts @@ -748,7 +748,6 @@ contract('Exchange', (accounts: string[]) => { const res = await exWrapper.cancelOrderAsync(order, maker); expect(res.logs).to.have.length(1); - const errId = res.logs[0].args.errorId.toNumber(); const errCode = res.logs[0].args.errorId.toNumber(); expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_FULLY_FILLED_OR_CANCELLED); }); diff --git a/packages/contracts/test/ts/exchange/wrapper.ts b/packages/contracts/test/ts/exchange/wrapper.ts index 3097f6887..13a0b6058 100644 --- a/packages/contracts/test/ts/exchange/wrapper.ts +++ b/packages/contracts/test/ts/exchange/wrapper.ts @@ -227,8 +227,6 @@ contract('Exchange', (accounts: string[]) => { it('should throw if a single order does not fill the expected amount', async () => { const fillTakerTokenAmounts: BigNumber[] = []; - const makerToken = rep.address; - const takerToken = dgd.address; orders.forEach(order => { const fillTakerTokenAmount = order.params.takerTokenAmount.div(2); fillTakerTokenAmounts.push(fillTakerTokenAmount); @@ -311,7 +309,7 @@ contract('Exchange', (accounts: string[]) => { const cancelTakerTokenAmounts = _.map(orders, order => order.params.takerTokenAmount); await exWrapper.batchCancelOrdersAsync(orders, maker, {cancelTakerTokenAmounts}); - const res = await exWrapper.batchFillOrdersAsync( + await exWrapper.batchFillOrdersAsync( orders, taker, {fillTakerTokenAmounts: cancelTakerTokenAmounts}); const newBalances = await dmyBalances.getAsync(); expect(balances).to.be.deep.equal(newBalances); diff --git a/packages/contracts/util/crypto.ts b/packages/contracts/util/crypto.ts index 5253b8c15..2e43ae816 100644 --- a/packages/contracts/util/crypto.ts +++ b/packages/contracts/util/crypto.ts @@ -1,4 +1,3 @@ -import {BigNumber} from 'bignumber.js'; import BN = require('bn.js'); import ABI = require('ethereumjs-abi'); import ethUtil = require('ethereumjs-util'); diff --git a/packages/dev-utils/src/rpc.ts b/packages/dev-utils/src/rpc.ts index c276b2452..19834dbb4 100644 --- a/packages/dev-utils/src/rpc.ts +++ b/packages/dev-utils/src/rpc.ts @@ -3,7 +3,6 @@ import * as request from 'request-promise-native'; export class RPC { private url: string; - private port: number; private id: number; constructor(url: string) { this.url = url; diff --git a/packages/json-schemas/test/schema_test.ts b/packages/json-schemas/test/schema_test.ts index 8a2f9407d..067b02827 100644 --- a/packages/json-schemas/test/schema_test.ts +++ b/packages/json-schemas/test/schema_test.ts @@ -1,4 +1,3 @@ -import {promisify} from '@0xproject/utils'; import BigNumber from 'bignumber.js'; import * as chai from 'chai'; import * as dirtyChai from 'dirty-chai'; @@ -16,7 +15,6 @@ const { addressSchema, ecSignatureSchema, ecSignatureParameterSchema, - indexFilterValuesSchema, orderCancellationRequestsSchema, orderFillOrKillRequestsSchema, orderFillRequestsSchema, diff --git a/packages/kovan-faucets/src/ts/error_reporter.ts b/packages/kovan-faucets/src/ts/error_reporter.ts index db21647c0..bc1844aa2 100644 --- a/packages/kovan-faucets/src/ts/error_reporter.ts +++ b/packages/kovan-faucets/src/ts/error_reporter.ts @@ -1,5 +1,4 @@ import * as express from 'express'; -import * as fs from 'fs'; import rollbar = require('rollbar'); import {configs} from './configs'; diff --git a/packages/kovan-faucets/src/ts/utils.ts b/packages/kovan-faucets/src/ts/utils.ts index 6a0b262e6..893f82ca3 100644 --- a/packages/kovan-faucets/src/ts/utils.ts +++ b/packages/kovan-faucets/src/ts/utils.ts @@ -1,6 +1,3 @@ -import * as express from 'express'; -import * as _ from 'lodash'; - export const utils = { consoleLog(message: string) { /* tslint:disable */ diff --git a/packages/kovan-faucets/src/ts/zrx_request_queue.ts b/packages/kovan-faucets/src/ts/zrx_request_queue.ts index 6e6590e7c..3b505690f 100644 --- a/packages/kovan-faucets/src/ts/zrx_request_queue.ts +++ b/packages/kovan-faucets/src/ts/zrx_request_queue.ts @@ -1,5 +1,4 @@ import {ZeroEx} from '0x.js'; -import {promisify} from '@0xproject/utils'; import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; 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; diff --git a/packages/tslint-config/rules/walkers/async_suffix.ts b/packages/tslint-config/rules/walkers/async_suffix.ts index 0c89bd99f..7fa7a78b8 100644 --- a/packages/tslint-config/rules/walkers/async_suffix.ts +++ b/packages/tslint-config/rules/walkers/async_suffix.ts @@ -9,6 +9,7 @@ export class AsyncSuffixWalker extends Lint.RuleWalker { const methodName = methodNameNode.getText(); if (!_.isUndefined(node.type)) { if (node.type.kind === ts.SyntaxKind.TypeReference) { + // tslint:disable-next-line:no-unnecessary-type-assertion const returnTypeName = (node.type as ts.TypeReferenceNode).typeName.getText(); if (returnTypeName === 'Promise' && !methodName.endsWith('Async')) { const failure = this.createFailure( |