Fix connect unused vars
This commit is contained in:
parent
274aa50d74
commit
126048bac9
@ -5,7 +5,6 @@ import * as _ from 'lodash';
|
|||||||
import {
|
import {
|
||||||
OrderbookChannelMessage,
|
OrderbookChannelMessage,
|
||||||
OrderbookChannelMessageTypes,
|
OrderbookChannelMessageTypes,
|
||||||
SignedOrder,
|
|
||||||
} from '../types';
|
} from '../types';
|
||||||
|
|
||||||
import {typeConverters} from './type_converters';
|
import {typeConverters} from './type_converters';
|
||||||
|
@ -8,7 +8,6 @@ import {
|
|||||||
OrderbookChannelHandler,
|
OrderbookChannelHandler,
|
||||||
OrderbookChannelMessageTypes,
|
OrderbookChannelMessageTypes,
|
||||||
OrderbookChannelSubscriptionOpts,
|
OrderbookChannelSubscriptionOpts,
|
||||||
SignedOrder,
|
|
||||||
WebsocketClientEventType,
|
WebsocketClientEventType,
|
||||||
WebsocketConnectionEventType,
|
WebsocketConnectionEventType,
|
||||||
} from './types';
|
} from './types';
|
||||||
@ -99,7 +98,6 @@ export class WebSocketOrderbookChannel implements OrderbookChannel {
|
|||||||
try {
|
try {
|
||||||
const utf8Data = message.utf8Data;
|
const utf8Data = message.utf8Data;
|
||||||
const parserResult = orderbookChannelMessageParsers.parser(utf8Data);
|
const parserResult = orderbookChannelMessageParsers.parser(utf8Data);
|
||||||
const type = parserResult.type;
|
|
||||||
if (parserResult.requestId === requestId) {
|
if (parserResult.requestId === requestId) {
|
||||||
switch (parserResult.type) {
|
switch (parserResult.type) {
|
||||||
case (OrderbookChannelMessageTypes.Snapshot): {
|
case (OrderbookChannelMessageTypes.Snapshot): {
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
import {Web3Wrapper} from '@0xproject/web3-wrapper';
|
import {Web3Wrapper} from '@0xproject/web3-wrapper';
|
||||||
import {BigNumber} from 'bignumber.js';
|
import {BigNumber} from 'bignumber.js';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as Web3 from 'web3';
|
|
||||||
|
|
||||||
import {Deployer} from './../src/deployer';
|
import {Deployer} from './../src/deployer';
|
||||||
import {constants} from './../src/utils/constants';
|
import {constants} from './../src/utils/constants';
|
||||||
import {Token} from './../src/utils/types';
|
|
||||||
import {tokenInfo} from './config/token_info';
|
import {tokenInfo} from './config/token_info';
|
||||||
|
|
||||||
export const migrator = {
|
export const migrator = {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import {promisify} from '@0xproject/utils';
|
|
||||||
import * as ethUtil from 'ethereumjs-util';
|
import * as ethUtil from 'ethereumjs-util';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
@ -14,7 +13,6 @@ import {
|
|||||||
ContractNetworks,
|
ContractNetworks,
|
||||||
ContractSources,
|
ContractSources,
|
||||||
ImportContents,
|
ImportContents,
|
||||||
SolcErrors,
|
|
||||||
} from './utils/types';
|
} from './utils/types';
|
||||||
import {utils} from './utils/utils';
|
import {utils} from './utils/utils';
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import {TxData} from '@0xproject/types';
|
import {TxData} from '@0xproject/types';
|
||||||
import {promisify} from '@0xproject/utils';
|
|
||||||
import {Web3Wrapper} from '@0xproject/web3-wrapper';
|
import {Web3Wrapper} from '@0xproject/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as Web3 from 'web3';
|
import * as Web3 from 'web3';
|
||||||
|
@ -4,7 +4,7 @@ import 'mocha';
|
|||||||
import {Compiler} from './../src/compiler';
|
import {Compiler} from './../src/compiler';
|
||||||
import {Deployer} from './../src/deployer';
|
import {Deployer} from './../src/deployer';
|
||||||
import {fsWrapper} from './../src/utils/fs_wrapper';
|
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 {constructor_args, exchange_binary} from './fixtures/exchange_bin';
|
||||||
import {constants} from './util/constants';
|
import {constants} from './util/constants';
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {Artifacts} from '../util/artifacts';
|
import {Artifacts} from '../util/artifacts';
|
||||||
import {ContractInstance, MultiSigConfigByNetwork} from '../util/types';
|
import {MultiSigConfigByNetwork} from '../util/types';
|
||||||
const {
|
const {
|
||||||
MultiSigWalletWithTimeLock,
|
MultiSigWalletWithTimeLock,
|
||||||
TokenTransferProxy,
|
TokenTransferProxy,
|
||||||
|
@ -3,7 +3,7 @@ import * as _ from 'lodash';
|
|||||||
|
|
||||||
import {Artifacts} from '../util/artifacts';
|
import {Artifacts} from '../util/artifacts';
|
||||||
import {constants} from '../util/constants';
|
import {constants} from '../util/constants';
|
||||||
import {ContractInstance, Token, TokenInfoByNetwork} from '../util/types';
|
import {ContractInstance, Token} from '../util/types';
|
||||||
|
|
||||||
import {tokenInfo} from './config/token_info';
|
import {tokenInfo} from './config/token_info';
|
||||||
const {
|
const {
|
||||||
|
@ -81,7 +81,7 @@ contract('EtherTokenV2', (accounts: string[]) => {
|
|||||||
const logArgs = (logs[0] as any).args;
|
const logArgs = (logs[0] as any).args;
|
||||||
expect(logArgs._from).to.equal(expectedFrom);
|
expect(logArgs._from).to.equal(expectedFrom);
|
||||||
expect(logArgs._to).to.equal(expectedTo);
|
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 () => {
|
it('should log 1 event with correct arguments', async () => {
|
||||||
const initEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account);
|
const initEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account);
|
||||||
const initEthBalance = await getEthBalanceAsync(account);
|
|
||||||
const ethTokensToWithdraw = initEthTokenBalance;
|
const ethTokensToWithdraw = initEthTokenBalance;
|
||||||
expect(ethTokensToWithdraw).to.not.be.bignumber.equal(0);
|
expect(ethTokensToWithdraw).to.not.be.bignumber.equal(0);
|
||||||
const txHash = await zeroEx.etherToken.withdrawAsync(ethTokensToWithdraw, account, {
|
const txHash = await zeroEx.etherToken.withdrawAsync(ethTokensToWithdraw, account, {
|
||||||
@ -137,7 +136,7 @@ contract('EtherTokenV2', (accounts: string[]) => {
|
|||||||
const logArgs = (logs[0] as any).args;
|
const logArgs = (logs[0] as any).args;
|
||||||
expect(logArgs._from).to.equal(expectedFrom);
|
expect(logArgs._from).to.equal(expectedFrom);
|
||||||
expect(logArgs._to).to.equal(expectedTo);
|
expect(logArgs._to).to.equal(expectedTo);
|
||||||
expect(logArgs._value).to.be.bignumber.equal(ethTokensToWithdraw);
|
expect(logArgs._value).to.be.bignumber.equal(expectedValue);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -748,7 +748,6 @@ contract('Exchange', (accounts: string[]) => {
|
|||||||
|
|
||||||
const res = await exWrapper.cancelOrderAsync(order, maker);
|
const res = await exWrapper.cancelOrderAsync(order, maker);
|
||||||
expect(res.logs).to.have.length(1);
|
expect(res.logs).to.have.length(1);
|
||||||
const errId = res.logs[0].args.errorId.toNumber();
|
|
||||||
const errCode = 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);
|
expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_FULLY_FILLED_OR_CANCELLED);
|
||||||
});
|
});
|
||||||
|
@ -227,8 +227,6 @@ contract('Exchange', (accounts: string[]) => {
|
|||||||
|
|
||||||
it('should throw if a single order does not fill the expected amount', async () => {
|
it('should throw if a single order does not fill the expected amount', async () => {
|
||||||
const fillTakerTokenAmounts: BigNumber[] = [];
|
const fillTakerTokenAmounts: BigNumber[] = [];
|
||||||
const makerToken = rep.address;
|
|
||||||
const takerToken = dgd.address;
|
|
||||||
orders.forEach(order => {
|
orders.forEach(order => {
|
||||||
const fillTakerTokenAmount = order.params.takerTokenAmount.div(2);
|
const fillTakerTokenAmount = order.params.takerTokenAmount.div(2);
|
||||||
fillTakerTokenAmounts.push(fillTakerTokenAmount);
|
fillTakerTokenAmounts.push(fillTakerTokenAmount);
|
||||||
@ -311,7 +309,7 @@ contract('Exchange', (accounts: string[]) => {
|
|||||||
const cancelTakerTokenAmounts = _.map(orders, order => order.params.takerTokenAmount);
|
const cancelTakerTokenAmounts = _.map(orders, order => order.params.takerTokenAmount);
|
||||||
await exWrapper.batchCancelOrdersAsync(orders, maker, {cancelTakerTokenAmounts});
|
await exWrapper.batchCancelOrdersAsync(orders, maker, {cancelTakerTokenAmounts});
|
||||||
|
|
||||||
const res = await exWrapper.batchFillOrdersAsync(
|
await exWrapper.batchFillOrdersAsync(
|
||||||
orders, taker, {fillTakerTokenAmounts: cancelTakerTokenAmounts});
|
orders, taker, {fillTakerTokenAmounts: cancelTakerTokenAmounts});
|
||||||
const newBalances = await dmyBalances.getAsync();
|
const newBalances = await dmyBalances.getAsync();
|
||||||
expect(balances).to.be.deep.equal(newBalances);
|
expect(balances).to.be.deep.equal(newBalances);
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import {BigNumber} from 'bignumber.js';
|
|
||||||
import BN = require('bn.js');
|
import BN = require('bn.js');
|
||||||
import ABI = require('ethereumjs-abi');
|
import ABI = require('ethereumjs-abi');
|
||||||
import ethUtil = require('ethereumjs-util');
|
import ethUtil = require('ethereumjs-util');
|
||||||
|
@ -3,7 +3,6 @@ import * as request from 'request-promise-native';
|
|||||||
|
|
||||||
export class RPC {
|
export class RPC {
|
||||||
private url: string;
|
private url: string;
|
||||||
private port: number;
|
|
||||||
private id: number;
|
private id: number;
|
||||||
constructor(url: string) {
|
constructor(url: string) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import {promisify} from '@0xproject/utils';
|
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as dirtyChai from 'dirty-chai';
|
import * as dirtyChai from 'dirty-chai';
|
||||||
@ -16,7 +15,6 @@ const {
|
|||||||
addressSchema,
|
addressSchema,
|
||||||
ecSignatureSchema,
|
ecSignatureSchema,
|
||||||
ecSignatureParameterSchema,
|
ecSignatureParameterSchema,
|
||||||
indexFilterValuesSchema,
|
|
||||||
orderCancellationRequestsSchema,
|
orderCancellationRequestsSchema,
|
||||||
orderFillOrKillRequestsSchema,
|
orderFillOrKillRequestsSchema,
|
||||||
orderFillRequestsSchema,
|
orderFillRequestsSchema,
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import * as express from 'express';
|
import * as express from 'express';
|
||||||
import * as fs from 'fs';
|
|
||||||
import rollbar = require('rollbar');
|
import rollbar = require('rollbar');
|
||||||
|
|
||||||
import {configs} from './configs';
|
import {configs} from './configs';
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
import * as express from 'express';
|
|
||||||
import * as _ from 'lodash';
|
|
||||||
|
|
||||||
export const utils = {
|
export const utils = {
|
||||||
consoleLog(message: string) {
|
consoleLog(message: string) {
|
||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import {ZeroEx} from '0x.js';
|
import {ZeroEx} from '0x.js';
|
||||||
import {promisify} from '@0xproject/utils';
|
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import {assert} from '@0xproject/assert';
|
import {assert} from '@0xproject/assert';
|
||||||
import {addressUtils} from '@0xproject/utils';
|
import {addressUtils} from '@0xproject/utils';
|
||||||
import promisify = require('es6-promisify');
|
|
||||||
import EthereumTx = require('ethereumjs-tx');
|
import EthereumTx = require('ethereumjs-tx');
|
||||||
import ethUtil = require('ethereumjs-util');
|
import ethUtil = require('ethereumjs-util');
|
||||||
import * as ledger from 'ledgerco';
|
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import Semaphore from 'semaphore-async-await';
|
import Semaphore from 'semaphore-async-await';
|
||||||
import Web3 = require('web3');
|
import Web3 = require('web3');
|
||||||
@ -23,7 +21,6 @@ const DEFAULT_DERIVATION_PATH = `44'/60'/0'`;
|
|||||||
const NUM_ADDRESSES_TO_FETCH = 10;
|
const NUM_ADDRESSES_TO_FETCH = 10;
|
||||||
const ASK_FOR_ON_DEVICE_CONFIRMATION = false;
|
const ASK_FOR_ON_DEVICE_CONFIRMATION = false;
|
||||||
const SHOULD_GET_CHAIN_CODE = false;
|
const SHOULD_GET_CHAIN_CODE = false;
|
||||||
const HEX_REGEX = /^[0-9A-Fa-f]+$/g;
|
|
||||||
|
|
||||||
export class LedgerSubprovider extends Subprovider {
|
export class LedgerSubprovider extends Subprovider {
|
||||||
private _nonceLock: Semaphore;
|
private _nonceLock: Semaphore;
|
||||||
@ -34,18 +31,6 @@ export class LedgerSubprovider extends Subprovider {
|
|||||||
private _ledgerEthereumClientFactoryAsync: LedgerEthereumClientFactoryAsync;
|
private _ledgerEthereumClientFactoryAsync: LedgerEthereumClientFactoryAsync;
|
||||||
private _ledgerClientIfExists?: LedgerEthereumClient;
|
private _ledgerClientIfExists?: LedgerEthereumClient;
|
||||||
private _shouldAlwaysAskForConfirmation: boolean;
|
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) {
|
private static validateSender(sender: string) {
|
||||||
if (_.isUndefined(sender) || !addressUtils.isAddress(sender)) {
|
if (_.isUndefined(sender) || !addressUtils.isAddress(sender)) {
|
||||||
throw new Error(LedgerSubproviderErrors.SenderInvalidOrNotSupplied);
|
throw new Error(LedgerSubproviderErrors.SenderInvalidOrNotSupplied);
|
||||||
|
@ -11,7 +11,6 @@ import {
|
|||||||
*/
|
*/
|
||||||
export class Subprovider {
|
export class Subprovider {
|
||||||
private engine: any;
|
private engine: any;
|
||||||
private currentBlock: any;
|
|
||||||
// Ported from: https://github.com/MetaMask/provider-engine/blob/master/util/random-id.js
|
// Ported from: https://github.com/MetaMask/provider-engine/blob/master/util/random-id.js
|
||||||
private static getRandomId() {
|
private static getRandomId() {
|
||||||
const extraDigits = 3;
|
const extraDigits = 3;
|
||||||
@ -34,9 +33,6 @@ export class Subprovider {
|
|||||||
}
|
}
|
||||||
public setEngine(engine: any): void {
|
public setEngine(engine: any): void {
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
engine.on('block', (block: any) => {
|
|
||||||
this.currentBlock = block;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
public async emitPayloadAsync(payload: JSONRPCPayload): Promise<any> {
|
public async emitPayloadAsync(payload: JSONRPCPayload): Promise<any> {
|
||||||
const finalPayload = Subprovider.createFinalPayload(payload);
|
const finalPayload = Subprovider.createFinalPayload(payload);
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as Web3 from 'web3';
|
|
||||||
|
|
||||||
export interface LedgerCommunicationClient {
|
export interface LedgerCommunicationClient {
|
||||||
close_async: () => Promise<void>;
|
close_async: () => Promise<void>;
|
||||||
|
@ -2,20 +2,16 @@ import * as chai from 'chai';
|
|||||||
import promisify = require('es6-promisify');
|
import promisify = require('es6-promisify');
|
||||||
import * as ethUtils from 'ethereumjs-util';
|
import * as ethUtils from 'ethereumjs-util';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as mocha from 'mocha';
|
|
||||||
import Web3 = require('web3');
|
import Web3 = require('web3');
|
||||||
import Web3ProviderEngine = require('web3-provider-engine');
|
import Web3ProviderEngine = require('web3-provider-engine');
|
||||||
import RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
|
import RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ECSignature,
|
|
||||||
ledgerEthereumNodeJsClientFactoryAsync,
|
ledgerEthereumNodeJsClientFactoryAsync,
|
||||||
LedgerSubprovider,
|
LedgerSubprovider,
|
||||||
} from '../../src';
|
} from '../../src';
|
||||||
import {
|
import {
|
||||||
DoneCallback,
|
DoneCallback,
|
||||||
LedgerGetAddressResult,
|
|
||||||
PartialTxParams,
|
|
||||||
} from '../../src/types';
|
} from '../../src/types';
|
||||||
import {chaiSetup} from '../chai_setup';
|
import {chaiSetup} from '../chai_setup';
|
||||||
import {reportCallbackErrors} from '../utils/report_callback_errors';
|
import {reportCallbackErrors} from '../utils/report_callback_errors';
|
||||||
|
@ -6,14 +6,11 @@ import Web3ProviderEngine = require('web3-provider-engine');
|
|||||||
import RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
|
import RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ECSignature,
|
|
||||||
LedgerSubprovider,
|
LedgerSubprovider,
|
||||||
} from '../../src';
|
} from '../../src';
|
||||||
import {
|
import {
|
||||||
DoneCallback,
|
DoneCallback,
|
||||||
ECSignatureString,
|
|
||||||
LedgerCommunicationClient,
|
LedgerCommunicationClient,
|
||||||
LedgerGetAddressResult,
|
|
||||||
LedgerSubproviderErrors,
|
LedgerSubproviderErrors,
|
||||||
} from '../../src/types';
|
} from '../../src/types';
|
||||||
import {chaiSetup} from '../chai_setup';
|
import {chaiSetup} from '../chai_setup';
|
||||||
|
@ -11,6 +11,7 @@ import {chaiSetup} from '../chai_setup';
|
|||||||
import {reportCallbackErrors} from '../utils/report_callback_errors';
|
import {reportCallbackErrors} from '../utils/report_callback_errors';
|
||||||
|
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
chaiSetup.configure();
|
||||||
|
|
||||||
describe('RedundantRpcSubprovider', () => {
|
describe('RedundantRpcSubprovider', () => {
|
||||||
let provider: Web3ProviderEngine;
|
let provider: Web3ProviderEngine;
|
||||||
|
@ -9,6 +9,7 @@ export class AsyncSuffixWalker extends Lint.RuleWalker {
|
|||||||
const methodName = methodNameNode.getText();
|
const methodName = methodNameNode.getText();
|
||||||
if (!_.isUndefined(node.type)) {
|
if (!_.isUndefined(node.type)) {
|
||||||
if (node.type.kind === ts.SyntaxKind.TypeReference) {
|
if (node.type.kind === ts.SyntaxKind.TypeReference) {
|
||||||
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
const returnTypeName = (node.type as ts.TypeReferenceNode).typeName.getText();
|
const returnTypeName = (node.type as ts.TypeReferenceNode).typeName.getText();
|
||||||
if (returnTypeName === 'Promise' && !methodName.endsWith('Async')) {
|
if (returnTypeName === 'Promise' && !methodName.endsWith('Async')) {
|
||||||
const failure = this.createFailure(
|
const failure = this.createFailure(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user