Fix connect unused vars

This commit is contained in:
Leonid Logvinov 2017-12-15 13:58:30 +01:00
parent 274aa50d74
commit 126048bac9
No known key found for this signature in database
GPG Key ID: 0DD294BFDE8C95D4
24 changed files with 8 additions and 54 deletions

View File

@ -5,7 +5,6 @@ import * as _ from 'lodash';
import {
OrderbookChannelMessage,
OrderbookChannelMessageTypes,
SignedOrder,
} from '../types';
import {typeConverters} from './type_converters';

View File

@ -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): {

View File

@ -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 = {

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -1,5 +1,5 @@
import {Artifacts} from '../util/artifacts';
import {ContractInstance, MultiSigConfigByNetwork} from '../util/types';
import {MultiSigConfigByNetwork} from '../util/types';
const {
MultiSigWalletWithTimeLock,
TokenTransferProxy,

View File

@ -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 {

View File

@ -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);
});
});

View File

@ -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);
});

View File

@ -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);

View File

@ -1,4 +1,3 @@
import {BigNumber} from 'bignumber.js';
import BN = require('bn.js');
import ABI = require('ethereumjs-abi');
import ethUtil = require('ethereumjs-util');

View File

@ -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;

View File

@ -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,

View File

@ -1,5 +1,4 @@
import * as express from 'express';
import * as fs from 'fs';
import rollbar = require('rollbar');
import {configs} from './configs';

View File

@ -1,6 +1,3 @@
import * as express from 'express';
import * as _ from 'lodash';
export const utils = {
consoleLog(message: string) {
/* tslint:disable */

View File

@ -1,5 +1,4 @@
import {ZeroEx} from '0x.js';
import {promisify} from '@0xproject/utils';
import BigNumber from 'bignumber.js';
import * as _ from 'lodash';

View File

@ -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);

View File

@ -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);

View File

@ -1,5 +1,4 @@
import * as _ from 'lodash';
import * as Web3 from 'web3';
export interface LedgerCommunicationClient {
close_async: () => Promise<void>;

View File

@ -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';

View File

@ -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';

View File

@ -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;

View File

@ -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(