Merge pull request #883 from 0xProject/feature/tslint-improvements
New tslint rules
This commit is contained in:
		@@ -94,7 +94,7 @@
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "sinon": "^4.0.0",
 | 
			
		||||
        "source-map-support": "^0.5.0",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typedoc": "0xProject/typedoc",
 | 
			
		||||
        "typescript": "2.7.1",
 | 
			
		||||
        "webpack": "^3.1.0"
 | 
			
		||||
 
 | 
			
		||||
@@ -61,7 +61,7 @@ export class ZeroEx {
 | 
			
		||||
     * ERC721 proxy smart contract.
 | 
			
		||||
     */
 | 
			
		||||
    public erc721Proxy: ERC721ProxyWrapper;
 | 
			
		||||
    private _contractWrappers: ContractWrappers;
 | 
			
		||||
    private readonly _contractWrappers: ContractWrappers;
 | 
			
		||||
    /**
 | 
			
		||||
     * Generates a pseudo-random 256-bit salt.
 | 
			
		||||
     * The salt can be included in a 0x order, ensuring that the order generates a unique orderHash
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ before('migrate contracts', async function(): Promise<void> {
 | 
			
		||||
    // HACK: Since the migrations take longer then our global mocha timeout limit
 | 
			
		||||
    // we manually increase it for this before hook.
 | 
			
		||||
    const mochaTestTimeoutMs = 20000;
 | 
			
		||||
    this.timeout(mochaTestTimeoutMs);
 | 
			
		||||
    this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this
 | 
			
		||||
    const txDefaults = {
 | 
			
		||||
        gas: devConstants.GAS_LIMIT,
 | 
			
		||||
        from: devConstants.TESTRPC_FIRST_ADDRESS,
 | 
			
		||||
 
 | 
			
		||||
@@ -63,7 +63,7 @@
 | 
			
		||||
        "mocha": "^5.2.0",
 | 
			
		||||
        "npm-run-all": "^4.1.2",
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typescript": "2.7.1"
 | 
			
		||||
    },
 | 
			
		||||
    "publishConfig": {
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@
 | 
			
		||||
        "npm-run-all": "^4.1.2",
 | 
			
		||||
        "nyc": "^11.0.1",
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typescript": "2.7.1"
 | 
			
		||||
    },
 | 
			
		||||
    "dependencies": {
 | 
			
		||||
 
 | 
			
		||||
@@ -8,33 +8,33 @@ const HEX_REGEX = /^0x[0-9A-F]*$/i;
 | 
			
		||||
export const assert = {
 | 
			
		||||
    isBigNumber(variableName: string, value: BigNumber): void {
 | 
			
		||||
        const isBigNumber = _.isObject(value) && (value as any).isBigNumber;
 | 
			
		||||
        this.assert(isBigNumber, this.typeAssertionMessage(variableName, 'BigNumber', value));
 | 
			
		||||
        assert.assert(isBigNumber, assert.typeAssertionMessage(variableName, 'BigNumber', value));
 | 
			
		||||
    },
 | 
			
		||||
    isValidBaseUnitAmount(variableName: string, value: BigNumber): void {
 | 
			
		||||
        assert.isBigNumber(variableName, value);
 | 
			
		||||
        const isNegative = value.lessThan(0);
 | 
			
		||||
        this.assert(!isNegative, `${variableName} cannot be a negative number, found value: ${value.toNumber()}`);
 | 
			
		||||
        assert.assert(!isNegative, `${variableName} cannot be a negative number, found value: ${value.toNumber()}`);
 | 
			
		||||
        const hasDecimals = value.decimalPlaces() !== 0;
 | 
			
		||||
        this.assert(
 | 
			
		||||
        assert.assert(
 | 
			
		||||
            !hasDecimals,
 | 
			
		||||
            `${variableName} should be in baseUnits (no decimals), found value: ${value.toNumber()}`,
 | 
			
		||||
        );
 | 
			
		||||
    },
 | 
			
		||||
    isString(variableName: string, value: string): void {
 | 
			
		||||
        this.assert(_.isString(value), this.typeAssertionMessage(variableName, 'string', value));
 | 
			
		||||
        assert.assert(_.isString(value), assert.typeAssertionMessage(variableName, 'string', value));
 | 
			
		||||
    },
 | 
			
		||||
    isFunction(variableName: string, value: any): void {
 | 
			
		||||
        this.assert(_.isFunction(value), this.typeAssertionMessage(variableName, 'function', value));
 | 
			
		||||
        assert.assert(_.isFunction(value), assert.typeAssertionMessage(variableName, 'function', value));
 | 
			
		||||
    },
 | 
			
		||||
    isHexString(variableName: string, value: string): void {
 | 
			
		||||
        this.assert(
 | 
			
		||||
        assert.assert(
 | 
			
		||||
            _.isString(value) && HEX_REGEX.test(value),
 | 
			
		||||
            this.typeAssertionMessage(variableName, 'HexString', value),
 | 
			
		||||
            assert.typeAssertionMessage(variableName, 'HexString', value),
 | 
			
		||||
        );
 | 
			
		||||
    },
 | 
			
		||||
    isETHAddressHex(variableName: string, value: string): void {
 | 
			
		||||
        this.assert(_.isString(value), this.typeAssertionMessage(variableName, 'string', value));
 | 
			
		||||
        this.assert(addressUtils.isAddress(value), this.typeAssertionMessage(variableName, 'ETHAddressHex', value));
 | 
			
		||||
        assert.assert(_.isString(value), assert.typeAssertionMessage(variableName, 'string', value));
 | 
			
		||||
        assert.assert(addressUtils.isAddress(value), assert.typeAssertionMessage(variableName, 'ETHAddressHex', value));
 | 
			
		||||
    },
 | 
			
		||||
    doesBelongToStringEnum(
 | 
			
		||||
        variableName: string,
 | 
			
		||||
@@ -51,17 +51,17 @@ export const assert = {
 | 
			
		||||
        );
 | 
			
		||||
    },
 | 
			
		||||
    hasAtMostOneUniqueValue(value: any[], errMsg: string): void {
 | 
			
		||||
        this.assert(_.uniq(value).length <= 1, errMsg);
 | 
			
		||||
        assert.assert(_.uniq(value).length <= 1, errMsg);
 | 
			
		||||
    },
 | 
			
		||||
    isNumber(variableName: string, value: number): void {
 | 
			
		||||
        this.assert(_.isFinite(value), this.typeAssertionMessage(variableName, 'number', value));
 | 
			
		||||
        assert.assert(_.isFinite(value), assert.typeAssertionMessage(variableName, 'number', value));
 | 
			
		||||
    },
 | 
			
		||||
    isBoolean(variableName: string, value: boolean): void {
 | 
			
		||||
        this.assert(_.isBoolean(value), this.typeAssertionMessage(variableName, 'boolean', value));
 | 
			
		||||
        assert.assert(_.isBoolean(value), assert.typeAssertionMessage(variableName, 'boolean', value));
 | 
			
		||||
    },
 | 
			
		||||
    isWeb3Provider(variableName: string, value: any): void {
 | 
			
		||||
        const isWeb3Provider = _.isFunction(value.send) || _.isFunction(value.sendAsync);
 | 
			
		||||
        this.assert(isWeb3Provider, this.typeAssertionMessage(variableName, 'Provider', value));
 | 
			
		||||
        assert.assert(isWeb3Provider, assert.typeAssertionMessage(variableName, 'Provider', value));
 | 
			
		||||
    },
 | 
			
		||||
    doesConformToSchema(variableName: string, value: any, schema: Schema, subSchemas?: Schema[]): void {
 | 
			
		||||
        if (_.isUndefined(value)) {
 | 
			
		||||
@@ -76,15 +76,15 @@ export const assert = {
 | 
			
		||||
        const msg = `Expected ${variableName} to conform to schema ${schema.id}
 | 
			
		||||
Encountered: ${JSON.stringify(value, null, '\t')}
 | 
			
		||||
Validation errors: ${validationResult.errors.join(', ')}`;
 | 
			
		||||
        this.assert(!hasValidationErrors, msg);
 | 
			
		||||
        assert.assert(!hasValidationErrors, msg);
 | 
			
		||||
    },
 | 
			
		||||
    isWebUri(variableName: string, value: any): void {
 | 
			
		||||
        const isValidUrl = !_.isUndefined(validUrl.isWebUri(value));
 | 
			
		||||
        this.assert(isValidUrl, this.typeAssertionMessage(variableName, 'web uri', value));
 | 
			
		||||
        assert.assert(isValidUrl, assert.typeAssertionMessage(variableName, 'web uri', value));
 | 
			
		||||
    },
 | 
			
		||||
    isUri(variableName: string, value: any): void {
 | 
			
		||||
        const isValidUri = !_.isUndefined(validUrl.isUri(value));
 | 
			
		||||
        this.assert(isValidUri, this.typeAssertionMessage(variableName, 'uri', value));
 | 
			
		||||
        assert.assert(isValidUri, assert.typeAssertionMessage(variableName, 'uri', value));
 | 
			
		||||
    },
 | 
			
		||||
    assert(condition: boolean, message: string): void {
 | 
			
		||||
        if (!condition) {
 | 
			
		||||
 
 | 
			
		||||
@@ -49,7 +49,7 @@ describe('Assertions', () => {
 | 
			
		||||
    });
 | 
			
		||||
    describe('#isFunction', () => {
 | 
			
		||||
        it('should not throw for valid input', () => {
 | 
			
		||||
            const validInputs = [BigNumber, assert.isString];
 | 
			
		||||
            const validInputs = [BigNumber, assert.isString.bind(assert)];
 | 
			
		||||
            validInputs.forEach(input => expect(assert.isFunction.bind(assert, variableName, input)).to.not.throw());
 | 
			
		||||
        });
 | 
			
		||||
        it('should throw for invalid input', () => {
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,7 @@
 | 
			
		||||
        "mocha": "^4.0.1",
 | 
			
		||||
        "npm-run-all": "^4.1.2",
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typescript": "2.7.1"
 | 
			
		||||
    },
 | 
			
		||||
    "dependencies": {
 | 
			
		||||
 
 | 
			
		||||
@@ -72,15 +72,13 @@ export class BaseContract {
 | 
			
		||||
        // 1. Optional param passed in to public method call
 | 
			
		||||
        // 2. Global config passed in at library instantiation
 | 
			
		||||
        // 3. Gas estimate calculation + safety margin
 | 
			
		||||
        const removeUndefinedProperties = _.pickBy;
 | 
			
		||||
        const txDataWithDefaults: TxData = {
 | 
			
		||||
        const removeUndefinedProperties = _.pickBy.bind(_);
 | 
			
		||||
        const txDataWithDefaults = {
 | 
			
		||||
            ...removeUndefinedProperties(txDefaults),
 | 
			
		||||
            ...removeUndefinedProperties(txData as any),
 | 
			
		||||
            // HACK: TS can't prove that T is spreadable.
 | 
			
		||||
            // Awaiting https://github.com/Microsoft/TypeScript/pull/13288 to be merged
 | 
			
		||||
        } as any;
 | 
			
		||||
            ...removeUndefinedProperties(txData),
 | 
			
		||||
        };
 | 
			
		||||
        if (_.isUndefined(txDataWithDefaults.gas) && !_.isUndefined(estimateGasAsync)) {
 | 
			
		||||
            txDataWithDefaults.gas = await estimateGasAsync(txDataWithDefaults as any);
 | 
			
		||||
            txDataWithDefaults.gas = await estimateGasAsync(txDataWithDefaults);
 | 
			
		||||
        }
 | 
			
		||||
        return txDataWithDefaults;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -81,7 +81,7 @@
 | 
			
		||||
        "npm-run-all": "^4.1.2",
 | 
			
		||||
        "nyc": "^11.0.1",
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typedoc": "~0.8.0",
 | 
			
		||||
        "typescript": "2.7.1"
 | 
			
		||||
    },
 | 
			
		||||
 
 | 
			
		||||
@@ -38,7 +38,7 @@ const OPTS_TO_QUERY_FIELD_MAP = {
 | 
			
		||||
 * that implement the standard relayer API v0
 | 
			
		||||
 */
 | 
			
		||||
export class HttpClient implements Client {
 | 
			
		||||
    private _apiEndpointUrl: string;
 | 
			
		||||
    private readonly _apiEndpointUrl: string;
 | 
			
		||||
    /**
 | 
			
		||||
     * Format parameters to be appended to http requests into query string form
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -6,12 +6,12 @@ export const typeConverters = {
 | 
			
		||||
        const bids = _.get(orderbook, 'bids', []);
 | 
			
		||||
        const asks = _.get(orderbook, 'asks', []);
 | 
			
		||||
        return {
 | 
			
		||||
            bids: bids.map((order: any) => this.convertOrderStringFieldsToBigNumber(order)),
 | 
			
		||||
            asks: asks.map((order: any) => this.convertOrderStringFieldsToBigNumber(order)),
 | 
			
		||||
            bids: bids.map((order: any) => typeConverters.convertOrderStringFieldsToBigNumber(order)),
 | 
			
		||||
            asks: asks.map((order: any) => typeConverters.convertOrderStringFieldsToBigNumber(order)),
 | 
			
		||||
        };
 | 
			
		||||
    },
 | 
			
		||||
    convertOrderStringFieldsToBigNumber(order: any): any {
 | 
			
		||||
        return this.convertStringsFieldsToBigNumbers(order, [
 | 
			
		||||
        return typeConverters.convertStringsFieldsToBigNumbers(order, [
 | 
			
		||||
            'makerTokenAmount',
 | 
			
		||||
            'takerTokenAmount',
 | 
			
		||||
            'makerFee',
 | 
			
		||||
 
 | 
			
		||||
@@ -15,9 +15,9 @@ import { orderbookChannelMessageParser } from './utils/orderbook_channel_message
 | 
			
		||||
 * that implements the standard relayer API v0
 | 
			
		||||
 */
 | 
			
		||||
export class WebSocketOrderbookChannel implements OrderbookChannel {
 | 
			
		||||
    private _client: WebSocket.w3cwebsocket;
 | 
			
		||||
    private _handler: OrderbookChannelHandler;
 | 
			
		||||
    private _subscriptionOptsList: OrderbookChannelSubscriptionOpts[] = [];
 | 
			
		||||
    private readonly _client: WebSocket.w3cwebsocket;
 | 
			
		||||
    private readonly _handler: OrderbookChannelHandler;
 | 
			
		||||
    private readonly _subscriptionOptsList: OrderbookChannelSubscriptionOpts[] = [];
 | 
			
		||||
    /**
 | 
			
		||||
     * Instantiates a new WebSocketOrderbookChannel instance
 | 
			
		||||
     * @param   client               A WebSocket client
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@ describe('WebSocketOrderbookChannel', () => {
 | 
			
		||||
    const websocketUrl = 'ws://localhost:8080';
 | 
			
		||||
    const openClient = new WebSocket.w3cwebsocket(websocketUrl);
 | 
			
		||||
    Sinon.stub(openClient, 'readyState').get(() => WebSocket.w3cwebsocket.OPEN);
 | 
			
		||||
    Sinon.stub(openClient, 'send').callsFake(_.noop);
 | 
			
		||||
    Sinon.stub(openClient, 'send').callsFake(_.noop.bind(_));
 | 
			
		||||
    const openOrderbookChannel = new WebSocketOrderbookChannel(openClient, emptyOrderbookChannelHandler);
 | 
			
		||||
    const subscriptionOpts = {
 | 
			
		||||
        baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
 | 
			
		||||
 
 | 
			
		||||
@@ -69,7 +69,7 @@
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "sinon": "^4.0.0",
 | 
			
		||||
        "source-map-support": "^0.5.0",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typescript": "2.7.1"
 | 
			
		||||
    },
 | 
			
		||||
    "dependencies": {
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ before('migrate contracts', async function(): Promise<void> {
 | 
			
		||||
    // HACK: Since the migrations take longer then our global mocha timeout limit
 | 
			
		||||
    // we manually increase it for this before hook.
 | 
			
		||||
    const mochaTestTimeoutMs = 50000;
 | 
			
		||||
    this.timeout(mochaTestTimeoutMs);
 | 
			
		||||
    this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this
 | 
			
		||||
    const txDefaults = {
 | 
			
		||||
        gas: devConstants.GAS_LIMIT,
 | 
			
		||||
        from: devConstants.TESTRPC_FIRST_ADDRESS,
 | 
			
		||||
 
 | 
			
		||||
@@ -67,7 +67,7 @@
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "solc": "^0.4.24",
 | 
			
		||||
        "solhint": "^1.2.1",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typescript": "2.7.1",
 | 
			
		||||
        "yargs": "^10.0.3"
 | 
			
		||||
    },
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ interface ProxyIdToAssetWrappers {
 | 
			
		||||
 * the logic that uses it does not need to care what standard a token belongs to.
 | 
			
		||||
 */
 | 
			
		||||
export class AssetWrapper {
 | 
			
		||||
    private _proxyIdToAssetWrappers: ProxyIdToAssetWrappers;
 | 
			
		||||
    private readonly _proxyIdToAssetWrappers: ProxyIdToAssetWrappers;
 | 
			
		||||
    constructor(assetWrappers: AbstractAssetWrapper[]) {
 | 
			
		||||
        this._proxyIdToAssetWrappers = {};
 | 
			
		||||
        _.each(assetWrappers, assetWrapper => {
 | 
			
		||||
 
 | 
			
		||||
@@ -13,11 +13,11 @@ import { ERC20BalancesByOwner } from './types';
 | 
			
		||||
import { txDefaults } from './web3_wrapper';
 | 
			
		||||
 | 
			
		||||
export class ERC20Wrapper {
 | 
			
		||||
    private _tokenOwnerAddresses: string[];
 | 
			
		||||
    private _contractOwnerAddress: string;
 | 
			
		||||
    private _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private _provider: Provider;
 | 
			
		||||
    private _dummyTokenContracts: DummyERC20TokenContract[];
 | 
			
		||||
    private readonly _tokenOwnerAddresses: string[];
 | 
			
		||||
    private readonly _contractOwnerAddress: string;
 | 
			
		||||
    private readonly _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private readonly _provider: Provider;
 | 
			
		||||
    private readonly _dummyTokenContracts: DummyERC20TokenContract[];
 | 
			
		||||
    private _proxyContract?: ERC20ProxyContract;
 | 
			
		||||
    private _proxyIdIfExists?: string;
 | 
			
		||||
    constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
 | 
			
		||||
 
 | 
			
		||||
@@ -13,11 +13,11 @@ import { ERC721TokenIdsByOwner } from './types';
 | 
			
		||||
import { txDefaults } from './web3_wrapper';
 | 
			
		||||
 | 
			
		||||
export class ERC721Wrapper {
 | 
			
		||||
    private _tokenOwnerAddresses: string[];
 | 
			
		||||
    private _contractOwnerAddress: string;
 | 
			
		||||
    private _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private _provider: Provider;
 | 
			
		||||
    private _dummyTokenContracts: DummyERC721TokenContract[];
 | 
			
		||||
    private readonly _tokenOwnerAddresses: string[];
 | 
			
		||||
    private readonly _contractOwnerAddress: string;
 | 
			
		||||
    private readonly _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private readonly _provider: Provider;
 | 
			
		||||
    private readonly _dummyTokenContracts: DummyERC721TokenContract[];
 | 
			
		||||
    private _proxyContract?: ERC721ProxyContract;
 | 
			
		||||
    private _proxyIdIfExists?: string;
 | 
			
		||||
    private _initialTokenIdsByOwner: ERC721TokenIdsByOwner = {};
 | 
			
		||||
 
 | 
			
		||||
@@ -11,9 +11,9 @@ import { orderUtils } from './order_utils';
 | 
			
		||||
import { OrderInfo, SignedTransaction } from './types';
 | 
			
		||||
 | 
			
		||||
export class ExchangeWrapper {
 | 
			
		||||
    private _exchange: ExchangeContract;
 | 
			
		||||
    private _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private _logDecoder: LogDecoder;
 | 
			
		||||
    private readonly _exchange: ExchangeContract;
 | 
			
		||||
    private readonly _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private readonly _logDecoder: LogDecoder;
 | 
			
		||||
    constructor(exchangeContract: ExchangeContract, provider: Provider) {
 | 
			
		||||
        this._exchange = exchangeContract;
 | 
			
		||||
        this._web3Wrapper = new Web3Wrapper(provider);
 | 
			
		||||
 
 | 
			
		||||
@@ -18,10 +18,10 @@ const ZERO_AMOUNT = new BigNumber(0);
 | 
			
		||||
const INSUFFICENT_ORDERS_FOR_MAKER_AMOUNT = 'Unable to satisfy makerAssetFillAmount with provided orders';
 | 
			
		||||
 | 
			
		||||
export class ForwarderWrapper {
 | 
			
		||||
    private _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private _forwarderContract: ForwarderContract;
 | 
			
		||||
    private _logDecoder: LogDecoder;
 | 
			
		||||
    private _zrxAddress: string;
 | 
			
		||||
    private readonly _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private readonly _forwarderContract: ForwarderContract;
 | 
			
		||||
    private readonly _logDecoder: LogDecoder;
 | 
			
		||||
    private readonly _zrxAddress: string;
 | 
			
		||||
    private static _createOptimizedSellOrders(signedOrders: SignedOrder[]): MarketSellOrders {
 | 
			
		||||
        const marketSellOrders = formatters.createMarketSellOrders(signedOrders, ZERO_AMOUNT);
 | 
			
		||||
        const assetDataId = assetProxyUtils.decodeAssetDataId(signedOrders[0].makerAssetData);
 | 
			
		||||
 
 | 
			
		||||
@@ -15,9 +15,9 @@ import { artifacts } from './artifacts';
 | 
			
		||||
import { constants } from './constants';
 | 
			
		||||
 | 
			
		||||
export class LogDecoder {
 | 
			
		||||
    private _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private _contractAddress: string;
 | 
			
		||||
    private _abiDecoder: AbiDecoder;
 | 
			
		||||
    private readonly _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private readonly _contractAddress: string;
 | 
			
		||||
    private readonly _abiDecoder: AbiDecoder;
 | 
			
		||||
    public static wrapLogBigNumbers(log: any): any {
 | 
			
		||||
        const argNames = _.keys(log.args);
 | 
			
		||||
        for (const argName of argNames) {
 | 
			
		||||
 
 | 
			
		||||
@@ -14,10 +14,10 @@ chaiSetup.configure();
 | 
			
		||||
const expect = chai.expect;
 | 
			
		||||
 | 
			
		||||
export class MatchOrderTester {
 | 
			
		||||
    private _exchangeWrapper: ExchangeWrapper;
 | 
			
		||||
    private _erc20Wrapper: ERC20Wrapper;
 | 
			
		||||
    private _erc721Wrapper: ERC721Wrapper;
 | 
			
		||||
    private _feeTokenAddress: string;
 | 
			
		||||
    private readonly _exchangeWrapper: ExchangeWrapper;
 | 
			
		||||
    private readonly _erc20Wrapper: ERC20Wrapper;
 | 
			
		||||
    private readonly _erc721Wrapper: ERC721Wrapper;
 | 
			
		||||
    private readonly _feeTokenAddress: string;
 | 
			
		||||
 | 
			
		||||
    /// @dev Compares a pair of ERC20 balances and a pair of ERC721 token owners.
 | 
			
		||||
    /// @param expectedNewERC20BalancesByOwner Expected ERC20 balances.
 | 
			
		||||
 
 | 
			
		||||
@@ -10,9 +10,9 @@ import { constants } from './constants';
 | 
			
		||||
import { LogDecoder } from './log_decoder';
 | 
			
		||||
 | 
			
		||||
export class MultiSigWrapper {
 | 
			
		||||
    private _multiSig: MultiSigWalletContract;
 | 
			
		||||
    private _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private _logDecoder: LogDecoder;
 | 
			
		||||
    private readonly _multiSig: MultiSigWalletContract;
 | 
			
		||||
    private readonly _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private readonly _logDecoder: LogDecoder;
 | 
			
		||||
    constructor(multiSigContract: MultiSigWalletContract, provider: Provider) {
 | 
			
		||||
        this._multiSig = multiSigContract;
 | 
			
		||||
        this._web3Wrapper = new Web3Wrapper(provider);
 | 
			
		||||
 
 | 
			
		||||
@@ -7,8 +7,8 @@ import { constants } from './constants';
 | 
			
		||||
import { signingUtils } from './signing_utils';
 | 
			
		||||
 | 
			
		||||
export class OrderFactory {
 | 
			
		||||
    private _defaultOrderParams: Partial<Order>;
 | 
			
		||||
    private _privateKey: Buffer;
 | 
			
		||||
    private readonly _defaultOrderParams: Partial<Order>;
 | 
			
		||||
    private readonly _privateKey: Buffer;
 | 
			
		||||
    constructor(privateKey: Buffer, defaultOrderParams: Partial<Order>) {
 | 
			
		||||
        this._defaultOrderParams = defaultOrderParams;
 | 
			
		||||
        this._privateKey = privateKey;
 | 
			
		||||
 
 | 
			
		||||
@@ -24,13 +24,13 @@ const FIVE_UNITS_FIVE_DECIMALS = new BigNumber(500_000);
 | 
			
		||||
const ONE_NFT_UNIT = new BigNumber(1);
 | 
			
		||||
 | 
			
		||||
export class OrderFactoryFromScenario {
 | 
			
		||||
    private _userAddresses: string[];
 | 
			
		||||
    private _zrxAddress: string;
 | 
			
		||||
    private _nonZrxERC20EighteenDecimalTokenAddresses: string[];
 | 
			
		||||
    private _erc20FiveDecimalTokenAddresses: string[];
 | 
			
		||||
    private _erc721Token: DummyERC721TokenContract;
 | 
			
		||||
    private _erc721Balances: ERC721TokenIdsByOwner;
 | 
			
		||||
    private _exchangeAddress: string;
 | 
			
		||||
    private readonly _userAddresses: string[];
 | 
			
		||||
    private readonly _zrxAddress: string;
 | 
			
		||||
    private readonly _nonZrxERC20EighteenDecimalTokenAddresses: string[];
 | 
			
		||||
    private readonly _erc20FiveDecimalTokenAddresses: string[];
 | 
			
		||||
    private readonly _erc721Token: DummyERC721TokenContract;
 | 
			
		||||
    private readonly _erc721Balances: ERC721TokenIdsByOwner;
 | 
			
		||||
    private readonly _exchangeAddress: string;
 | 
			
		||||
    constructor(
 | 
			
		||||
        userAddresses: string[],
 | 
			
		||||
        zrxAddress: string,
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ import { BigNumber } from '@0xproject/utils';
 | 
			
		||||
import { AssetWrapper } from './asset_wrapper';
 | 
			
		||||
 | 
			
		||||
export class SimpleAssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndProxyAllowanceFetcher {
 | 
			
		||||
    private _assetWrapper: AssetWrapper;
 | 
			
		||||
    private readonly _assetWrapper: AssetWrapper;
 | 
			
		||||
    constructor(assetWrapper: AssetWrapper) {
 | 
			
		||||
        this._assetWrapper = assetWrapper;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -4,8 +4,8 @@ import { BigNumber } from '@0xproject/utils';
 | 
			
		||||
import { ExchangeWrapper } from './exchange_wrapper';
 | 
			
		||||
 | 
			
		||||
export class SimpleOrderFilledCancelledFetcher implements AbstractOrderFilledCancelledFetcher {
 | 
			
		||||
    private _exchangeWrapper: ExchangeWrapper;
 | 
			
		||||
    private _zrxAssetData: string;
 | 
			
		||||
    private readonly _exchangeWrapper: ExchangeWrapper;
 | 
			
		||||
    private readonly _zrxAssetData: string;
 | 
			
		||||
    constructor(exchange: ExchangeWrapper, zrxAssetData: string) {
 | 
			
		||||
        this._exchangeWrapper = exchange;
 | 
			
		||||
        this._zrxAssetData = zrxAssetData;
 | 
			
		||||
 
 | 
			
		||||
@@ -8,8 +8,8 @@ import { Token } from './types';
 | 
			
		||||
import { constants } from './constants';
 | 
			
		||||
 | 
			
		||||
export class TokenRegWrapper {
 | 
			
		||||
    private _tokenReg: TokenRegistryContract;
 | 
			
		||||
    private _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private readonly _tokenReg: TokenRegistryContract;
 | 
			
		||||
    private readonly _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    constructor(tokenRegContract: TokenRegistryContract, provider: Provider) {
 | 
			
		||||
        this._tokenReg = tokenRegContract;
 | 
			
		||||
        this._web3Wrapper = new Web3Wrapper(provider);
 | 
			
		||||
 
 | 
			
		||||
@@ -15,9 +15,9 @@ const EIP712_ZEROEX_TRANSACTION_SCHEMA: EIP712Schema = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export class TransactionFactory {
 | 
			
		||||
    private _signerBuff: Buffer;
 | 
			
		||||
    private _exchangeAddress: string;
 | 
			
		||||
    private _privateKey: Buffer;
 | 
			
		||||
    private readonly _signerBuff: Buffer;
 | 
			
		||||
    private readonly _exchangeAddress: string;
 | 
			
		||||
    private readonly _privateKey: Buffer;
 | 
			
		||||
    constructor(privateKey: Buffer, exchangeAddress: string) {
 | 
			
		||||
        this._privateKey = privateKey;
 | 
			
		||||
        this._exchangeAddress = exchangeAddress;
 | 
			
		||||
 
 | 
			
		||||
@@ -51,8 +51,10 @@ export const provider = web3Factory.getRpcProvider(providerConfigs);
 | 
			
		||||
const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage);
 | 
			
		||||
const isProfilerEnabled = env.parseBoolean(EnvVars.SolidityProfiler);
 | 
			
		||||
const isRevertTraceEnabled = env.parseBoolean(EnvVars.SolidityRevertTrace);
 | 
			
		||||
const enabledSubproviderCount = _.filter([isCoverageEnabled, isProfilerEnabled, isRevertTraceEnabled], _.identity)
 | 
			
		||||
    .length;
 | 
			
		||||
const enabledSubproviderCount = _.filter(
 | 
			
		||||
    [isCoverageEnabled, isProfilerEnabled, isRevertTraceEnabled],
 | 
			
		||||
    _.identity.bind(_),
 | 
			
		||||
).length;
 | 
			
		||||
if (enabledSubproviderCount > 1) {
 | 
			
		||||
    throw new Error(`Only one of coverage, profiler, or revert trace subproviders can be enabled at a time`);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -41,7 +41,7 @@
 | 
			
		||||
        "npm-run-all": "^4.1.2",
 | 
			
		||||
        "nyc": "^11.0.1",
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typescript": "2.7.1"
 | 
			
		||||
    },
 | 
			
		||||
    "dependencies": {
 | 
			
		||||
 
 | 
			
		||||
@@ -10,8 +10,8 @@ import * as _ from 'lodash';
 | 
			
		||||
const MINIMUM_BLOCKS = 3;
 | 
			
		||||
 | 
			
		||||
export class BlockchainLifecycle {
 | 
			
		||||
    private _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private _snapshotIdsStack: number[];
 | 
			
		||||
    private readonly _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private readonly _snapshotIdsStack: number[];
 | 
			
		||||
    private _addresses: string[] = [];
 | 
			
		||||
    private _nodeType: NodeType | undefined;
 | 
			
		||||
    constructor(web3Wrapper: Web3Wrapper) {
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@
 | 
			
		||||
        "copyfiles": "^1.2.0",
 | 
			
		||||
        "make-promises-safe": "^1.1.0",
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typescript": "2.7.1"
 | 
			
		||||
    },
 | 
			
		||||
    "dependencies": {
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@
 | 
			
		||||
        "make-promises-safe": "^1.1.0",
 | 
			
		||||
        "npm-run-all": "^4.1.2",
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typescript": "2.7.1"
 | 
			
		||||
    },
 | 
			
		||||
    "dependencies": {
 | 
			
		||||
 
 | 
			
		||||
@@ -11,12 +11,12 @@ import { ERC20TokenContract } from './generated_contract_wrappers/erc20_token';
 | 
			
		||||
import { ExchangeContract } from './generated_contract_wrappers/exchange';
 | 
			
		||||
 | 
			
		||||
export class FillScenarios {
 | 
			
		||||
    private _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private _userAddresses: string[];
 | 
			
		||||
    private _coinbase: string;
 | 
			
		||||
    private _zrxTokenAddress: string;
 | 
			
		||||
    private _exchangeAddress: string;
 | 
			
		||||
    private _erc20ProxyAddress: string;
 | 
			
		||||
    private readonly _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private readonly _userAddresses: string[];
 | 
			
		||||
    private readonly _coinbase: string;
 | 
			
		||||
    private readonly _zrxTokenAddress: string;
 | 
			
		||||
    private readonly _exchangeAddress: string;
 | 
			
		||||
    private readonly _erc20ProxyAddress: string;
 | 
			
		||||
    constructor(
 | 
			
		||||
        provider: Provider,
 | 
			
		||||
        userAddresses: string[],
 | 
			
		||||
 
 | 
			
		||||
@@ -68,7 +68,7 @@
 | 
			
		||||
        "npm-run-all": "^4.1.2",
 | 
			
		||||
        "nyc": "^11.0.1",
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typedoc": "0xProject/typedoc",
 | 
			
		||||
        "typescript": "2.7.1"
 | 
			
		||||
    },
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ import { schemas } from './schemas';
 | 
			
		||||
 * A validator for [JSON-schemas](http://json-schema.org/)
 | 
			
		||||
 */
 | 
			
		||||
export class SchemaValidator {
 | 
			
		||||
    private _validator: Validator;
 | 
			
		||||
    private readonly _validator: Validator;
 | 
			
		||||
    /**
 | 
			
		||||
     * Instantiates a SchemaValidator instance
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@
 | 
			
		||||
        "make-promises-safe": "^1.1.0",
 | 
			
		||||
        "npm-run-all": "^4.1.2",
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typescript": "2.7.1"
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@
 | 
			
		||||
        "make-promises-safe": "^1.1.0",
 | 
			
		||||
        "npm-run-all": "^4.1.2",
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typescript": "2.7.1"
 | 
			
		||||
    },
 | 
			
		||||
    "dependencies": {
 | 
			
		||||
 
 | 
			
		||||
@@ -4,8 +4,8 @@ import * as fs from 'fs';
 | 
			
		||||
import * as path from 'path';
 | 
			
		||||
 | 
			
		||||
export class ArtifactWriter {
 | 
			
		||||
    private _artifactsDir: string;
 | 
			
		||||
    private _networkId: number;
 | 
			
		||||
    private readonly _artifactsDir: string;
 | 
			
		||||
    private readonly _networkId: number;
 | 
			
		||||
    constructor(artifactsDir: string, networkId: number) {
 | 
			
		||||
        this._artifactsDir = artifactsDir;
 | 
			
		||||
        this._networkId = networkId;
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,7 @@
 | 
			
		||||
        "npm-run-all": "^4.1.2",
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "@types/semver": "5.5.0",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typescript": "2.7.1"
 | 
			
		||||
    },
 | 
			
		||||
    "dependencies": {
 | 
			
		||||
 
 | 
			
		||||
@@ -51,8 +51,13 @@ export const postpublishUtils = {
 | 
			
		||||
        return configs;
 | 
			
		||||
    },
 | 
			
		||||
    async runAsync(packageJSON: any, tsConfigJSON: any, cwd: string): Promise<void> {
 | 
			
		||||
        const configs = this.generateConfig(packageJSON, tsConfigJSON, cwd);
 | 
			
		||||
        await this.publishReleaseNotesAsync(configs.cwd, configs.packageName, configs.version, configs.assets);
 | 
			
		||||
        const configs = postpublishUtils.generateConfig(packageJSON, tsConfigJSON, cwd);
 | 
			
		||||
        await postpublishUtils.publishReleaseNotesAsync(
 | 
			
		||||
            configs.cwd,
 | 
			
		||||
            configs.packageName,
 | 
			
		||||
            configs.version,
 | 
			
		||||
            configs.assets,
 | 
			
		||||
        );
 | 
			
		||||
        if (
 | 
			
		||||
            !_.isUndefined(configs.docPublishConfigs.s3BucketPath) ||
 | 
			
		||||
            !_.isUndefined(configs.docPublishConfigs.s3StagingBucketPath)
 | 
			
		||||
@@ -69,7 +74,7 @@ export const postpublishUtils = {
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    async publishDocsToStagingAsync(packageJSON: any, tsConfigJSON: any, cwd: string): Promise<void> {
 | 
			
		||||
        const configs = this.generateConfig(packageJSON, tsConfigJSON, cwd);
 | 
			
		||||
        const configs = postpublishUtils.generateConfig(packageJSON, tsConfigJSON, cwd);
 | 
			
		||||
        if (_.isUndefined(configs.docPublishConfigs.s3StagingBucketPath)) {
 | 
			
		||||
            utils.log('config.postpublish.docPublishConfigs.s3StagingBucketPath entry in package.json not found!');
 | 
			
		||||
            return;
 | 
			
		||||
@@ -84,10 +89,10 @@ export const postpublishUtils = {
 | 
			
		||||
        );
 | 
			
		||||
    },
 | 
			
		||||
    async publishReleaseNotesAsync(cwd: string, packageName: string, version: string, assets: string[]): Promise<void> {
 | 
			
		||||
        const notes = this.getReleaseNotes(packageName, version);
 | 
			
		||||
        const releaseName = this.getReleaseName(packageName, version);
 | 
			
		||||
        const tag = this.getTag(packageName, version);
 | 
			
		||||
        this.adjustAssetPaths(cwd, assets);
 | 
			
		||||
        const notes = postpublishUtils.getReleaseNotes(packageName, version);
 | 
			
		||||
        const releaseName = postpublishUtils.getReleaseName(packageName, version);
 | 
			
		||||
        const tag = postpublishUtils.getTag(packageName, version);
 | 
			
		||||
        postpublishUtils.adjustAssetPaths(cwd, assets);
 | 
			
		||||
        utils.log('POSTPUBLISH: Releasing ', releaseName, '...');
 | 
			
		||||
        await publishReleaseAsync({
 | 
			
		||||
            token: constants.githubPersonalAccessToken,
 | 
			
		||||
@@ -165,7 +170,7 @@ export const postpublishUtils = {
 | 
			
		||||
        version: string,
 | 
			
		||||
        S3BucketPath: string,
 | 
			
		||||
    ): Promise<void> {
 | 
			
		||||
        const fileIncludesAdjusted = this.adjustFileIncludePaths(fileIncludes, cwd);
 | 
			
		||||
        const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, cwd);
 | 
			
		||||
        const projectFiles = fileIncludesAdjusted.join(' ');
 | 
			
		||||
        const jsonFilePath = `${cwd}/${generatedDocsDirectoryName}/index.json`;
 | 
			
		||||
        const result = await execAsync(
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@ import { Change, Changelog, VersionChangelog } from '../types';
 | 
			
		||||
 | 
			
		||||
const CHANGELOG_MD_HEADER = `
 | 
			
		||||
<!--
 | 
			
		||||
This file is auto-generated using the monorepo-scripts package. Don't edit directly.
 | 
			
		||||
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
 | 
			
		||||
Edit the package's CHANGELOG.json file only.
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
@@ -74,7 +74,7 @@ export const changelogUtils = {
 | 
			
		||||
    },
 | 
			
		||||
    getChangelogOrCreateIfMissing(packageName: string, packageLocation: string): Changelog {
 | 
			
		||||
        const changelogJSONPath = path.join(packageLocation, 'CHANGELOG.json');
 | 
			
		||||
        let changelogJsonIfExists = this.getChangelogJSONIfExists(changelogJSONPath);
 | 
			
		||||
        let changelogJsonIfExists = changelogUtils.getChangelogJSONIfExists(changelogJSONPath);
 | 
			
		||||
        if (_.isUndefined(changelogJsonIfExists)) {
 | 
			
		||||
            // If none exists, create new, empty one.
 | 
			
		||||
            changelogJsonIfExists = '[]';
 | 
			
		||||
@@ -91,12 +91,12 @@ export const changelogUtils = {
 | 
			
		||||
    async writeChangelogJsonFileAsync(packageLocation: string, changelog: Changelog): Promise<void> {
 | 
			
		||||
        const changelogJSONPath = path.join(packageLocation, 'CHANGELOG.json');
 | 
			
		||||
        fs.writeFileSync(changelogJSONPath, JSON.stringify(changelog, null, '\t'));
 | 
			
		||||
        await this.prettifyAsync(changelogJSONPath, constants.monorepoRootPath);
 | 
			
		||||
        await changelogUtils.prettifyAsync(changelogJSONPath, constants.monorepoRootPath);
 | 
			
		||||
    },
 | 
			
		||||
    async writeChangelogMdFileAsync(packageLocation: string, changelogMdString: string): Promise<void> {
 | 
			
		||||
        const changelogMarkdownPath = path.join(packageLocation, 'CHANGELOG.md');
 | 
			
		||||
        fs.writeFileSync(changelogMarkdownPath, changelogMdString);
 | 
			
		||||
        await this.prettifyAsync(changelogMarkdownPath, constants.monorepoRootPath);
 | 
			
		||||
        await changelogUtils.prettifyAsync(changelogMarkdownPath, constants.monorepoRootPath);
 | 
			
		||||
    },
 | 
			
		||||
    async prettifyAsync(filePath: string, cwd: string): Promise<void> {
 | 
			
		||||
        await execAsync(`prettier --write ${filePath} --config .prettierrc`, {
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@ export const utils = {
 | 
			
		||||
        console.log(...args); // tslint:disable-line:no-console
 | 
			
		||||
    },
 | 
			
		||||
    async getUpdatedLernaPackagesAsync(shouldIncludePrivate: boolean): Promise<LernaPackage[]> {
 | 
			
		||||
        const updatedPublicPackages = await this.getLernaUpdatedPackagesAsync(shouldIncludePrivate);
 | 
			
		||||
        const updatedPublicPackages = await utils.getLernaUpdatedPackagesAsync(shouldIncludePrivate);
 | 
			
		||||
        const updatedPackageNames = _.map(updatedPublicPackages, pkg => pkg.name);
 | 
			
		||||
 | 
			
		||||
        const allLernaPackages = lernaGetPackages(constants.monorepoRootPath);
 | 
			
		||||
@@ -110,7 +110,7 @@ export const utils = {
 | 
			
		||||
        } catch (err) {
 | 
			
		||||
            throw new Error(`Failed to delete local git tag. Got err: ${err}`);
 | 
			
		||||
        }
 | 
			
		||||
        this.log(`Removed local tag: ${tagName}`);
 | 
			
		||||
        utils.log(`Removed local tag: ${tagName}`);
 | 
			
		||||
    },
 | 
			
		||||
    async removeRemoteTagAsync(tagName: string): Promise<void> {
 | 
			
		||||
        try {
 | 
			
		||||
@@ -120,6 +120,6 @@ export const utils = {
 | 
			
		||||
        } catch (err) {
 | 
			
		||||
            throw new Error(`Failed to delete remote git tag. Got err: ${err}`);
 | 
			
		||||
        }
 | 
			
		||||
        this.log(`Removed remote tag: ${tagName}`);
 | 
			
		||||
        utils.log(`Removed remote tag: ${tagName}`);
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -67,7 +67,7 @@
 | 
			
		||||
        "npm-run-all": "^4.1.2",
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "sinon": "^4.0.0",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typedoc": "0xProject/typedoc",
 | 
			
		||||
        "typescript": "2.7.1"
 | 
			
		||||
    },
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,7 @@ const ERR_MSG_MAPPING = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export class ExchangeTransferSimulator {
 | 
			
		||||
    private _store: AbstractBalanceAndProxyAllowanceLazyStore;
 | 
			
		||||
    private readonly _store: AbstractBalanceAndProxyAllowanceLazyStore;
 | 
			
		||||
    private static _throwValidationError(
 | 
			
		||||
        failureReason: FailureReason,
 | 
			
		||||
        tradeSide: TradeSide,
 | 
			
		||||
 
 | 
			
		||||
@@ -27,8 +27,8 @@ interface SidedOrderRelevantState {
 | 
			
		||||
const ACCEPTABLE_RELATIVE_ROUNDING_ERROR = 0.0001;
 | 
			
		||||
 | 
			
		||||
export class OrderStateUtils {
 | 
			
		||||
    private _balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher;
 | 
			
		||||
    private _orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher;
 | 
			
		||||
    private readonly _balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher;
 | 
			
		||||
    private readonly _orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher;
 | 
			
		||||
    private static _validateIfOrderIsValid(
 | 
			
		||||
        signedOrder: SignedOrder,
 | 
			
		||||
        sidedOrderRelevantState: SidedOrderRelevantState,
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@ import { isValidSignatureAsync } from './signature_utils';
 | 
			
		||||
import { utils } from './utils';
 | 
			
		||||
 | 
			
		||||
export class OrderValidationUtils {
 | 
			
		||||
    private _orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher;
 | 
			
		||||
    private readonly _orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher;
 | 
			
		||||
    public static isRoundingError(numerator: BigNumber, denominator: BigNumber, target: BigNumber): boolean {
 | 
			
		||||
        // Solidity's mulmod() in JS
 | 
			
		||||
        // Source: https://solidity.readthedocs.io/en/latest/units-and-global-variables.html#mathematical-and-cryptographic-functions
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +1,14 @@
 | 
			
		||||
import { BigNumber } from '@0xproject/utils';
 | 
			
		||||
 | 
			
		||||
export class RemainingFillableCalculator {
 | 
			
		||||
    private _isTraderAssetZRX: boolean;
 | 
			
		||||
    private readonly _isTraderAssetZRX: boolean;
 | 
			
		||||
    // Transferrable Amount is the minimum of Approval and Balance
 | 
			
		||||
    private _transferrableAssetAmount: BigNumber;
 | 
			
		||||
    private _transferrableFeeAmount: BigNumber;
 | 
			
		||||
    private _remainingOrderAssetAmount: BigNumber;
 | 
			
		||||
    private _remainingOrderFeeAmount: BigNumber;
 | 
			
		||||
    private _orderFee: BigNumber;
 | 
			
		||||
    private _orderAssetAmount: BigNumber;
 | 
			
		||||
    private readonly _transferrableAssetAmount: BigNumber;
 | 
			
		||||
    private readonly _transferrableFeeAmount: BigNumber;
 | 
			
		||||
    private readonly _remainingOrderAssetAmount: BigNumber;
 | 
			
		||||
    private readonly _remainingOrderFeeAmount: BigNumber;
 | 
			
		||||
    private readonly _orderFee: BigNumber;
 | 
			
		||||
    private readonly _orderAssetAmount: BigNumber;
 | 
			
		||||
    constructor(
 | 
			
		||||
        orderFee: BigNumber,
 | 
			
		||||
        orderAssetAmount: BigNumber,
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ import { AbstractBalanceAndProxyAllowanceLazyStore } from '../abstract/abstract_
 | 
			
		||||
 * Copy on read store for balances/proxyAllowances of tokens/accounts
 | 
			
		||||
 */
 | 
			
		||||
export class BalanceAndProxyAllowanceLazyStore implements AbstractBalanceAndProxyAllowanceLazyStore {
 | 
			
		||||
    private _balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher;
 | 
			
		||||
    private readonly _balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher;
 | 
			
		||||
    private _balance: {
 | 
			
		||||
        [assetData: string]: {
 | 
			
		||||
            [userAddress: string]: BigNumber;
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,7 @@ describe('ExchangeTransferSimulator', async () => {
 | 
			
		||||
    let erc20ProxyAddress: string;
 | 
			
		||||
    before(async function(): Promise<void> {
 | 
			
		||||
        const mochaTestTimeoutMs = 20000;
 | 
			
		||||
        this.timeout(mochaTestTimeoutMs);
 | 
			
		||||
        this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this
 | 
			
		||||
 | 
			
		||||
        userAddresses = await web3Wrapper.getAvailableAddressesAsync();
 | 
			
		||||
        [coinbase, sender, recipient] = userAddresses;
 | 
			
		||||
@@ -77,8 +77,7 @@ describe('ExchangeTransferSimulator', async () => {
 | 
			
		||||
    describe('#transferFromAsync', function(): void {
 | 
			
		||||
        // HACK: For some reason these tests need a slightly longer timeout
 | 
			
		||||
        const mochaTestTimeoutMs = 3000;
 | 
			
		||||
        this.timeout(mochaTestTimeoutMs);
 | 
			
		||||
 | 
			
		||||
        this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this
 | 
			
		||||
        beforeEach(() => {
 | 
			
		||||
            const simpleERC20BalanceAndProxyAllowanceFetcher = new SimpleERC20BalanceAndProxyAllowanceFetcher(
 | 
			
		||||
                (dummyERC20Token as any) as ERC20TokenContract,
 | 
			
		||||
 
 | 
			
		||||
@@ -5,8 +5,8 @@ import { AbstractBalanceAndProxyAllowanceFetcher } from '../../src/abstract/abst
 | 
			
		||||
import { ERC20TokenContract } from '../../src/generated_contract_wrappers/erc20_token';
 | 
			
		||||
 | 
			
		||||
export class SimpleERC20BalanceAndProxyAllowanceFetcher implements AbstractBalanceAndProxyAllowanceFetcher {
 | 
			
		||||
    private _erc20TokenContract: ERC20TokenContract;
 | 
			
		||||
    private _erc20ProxyAddress: string;
 | 
			
		||||
    private readonly _erc20TokenContract: ERC20TokenContract;
 | 
			
		||||
    private readonly _erc20ProxyAddress: string;
 | 
			
		||||
    constructor(erc20TokenWrapper: ERC20TokenContract, erc20ProxyAddress: string) {
 | 
			
		||||
        this._erc20TokenContract = erc20TokenWrapper;
 | 
			
		||||
        this._erc20ProxyAddress = erc20ProxyAddress;
 | 
			
		||||
 
 | 
			
		||||
@@ -73,7 +73,7 @@
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "sinon": "^4.0.0",
 | 
			
		||||
        "source-map-support": "^0.5.0",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typescript": "2.7.1"
 | 
			
		||||
    },
 | 
			
		||||
    "dependencies": {
 | 
			
		||||
 
 | 
			
		||||
@@ -19,14 +19,14 @@ enum LogEventState {
 | 
			
		||||
 * depth.
 | 
			
		||||
 */
 | 
			
		||||
export class EventWatcher {
 | 
			
		||||
    private _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private readonly _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private _blockAndLogStreamerIfExists: BlockAndLogStreamer<Block, Log> | undefined;
 | 
			
		||||
    private _blockAndLogStreamIntervalIfExists?: NodeJS.Timer;
 | 
			
		||||
    private _onLogAddedSubscriptionToken: string | undefined;
 | 
			
		||||
    private _onLogRemovedSubscriptionToken: string | undefined;
 | 
			
		||||
    private _pollingIntervalMs: number;
 | 
			
		||||
    private _stateLayer: BlockParamLiteral;
 | 
			
		||||
    private _isVerbose: boolean;
 | 
			
		||||
    private readonly _pollingIntervalMs: number;
 | 
			
		||||
    private readonly _stateLayer: BlockParamLiteral;
 | 
			
		||||
    private readonly _isVerbose: boolean;
 | 
			
		||||
    constructor(
 | 
			
		||||
        web3Wrapper: Web3Wrapper,
 | 
			
		||||
        pollingIntervalIfExistsMs: undefined | number,
 | 
			
		||||
 
 | 
			
		||||
@@ -13,10 +13,10 @@ const DEFAULT_ORDER_EXPIRATION_CHECKING_INTERVAL_MS = 50;
 | 
			
		||||
 * It stores them in a min heap by expiration time and checks for expired ones every `orderExpirationCheckingIntervalMs`
 | 
			
		||||
 */
 | 
			
		||||
export class ExpirationWatcher {
 | 
			
		||||
    private _orderHashByExpirationRBTree: RBTree<string>;
 | 
			
		||||
    private _expiration: { [orderHash: string]: BigNumber } = {};
 | 
			
		||||
    private _orderExpirationCheckingIntervalMs: number;
 | 
			
		||||
    private _expirationMarginMs: number;
 | 
			
		||||
    private readonly _orderHashByExpirationRBTree: RBTree<string>;
 | 
			
		||||
    private readonly _expiration: { [orderHash: string]: BigNumber } = {};
 | 
			
		||||
    private readonly _orderExpirationCheckingIntervalMs: number;
 | 
			
		||||
    private readonly _expirationMarginMs: number;
 | 
			
		||||
    private _orderExpirationCheckingIntervalIdIfExists?: NodeJS.Timer;
 | 
			
		||||
    constructor(expirationMarginIfExistsMs?: number, orderExpirationCheckingIntervalIfExistsMs?: number) {
 | 
			
		||||
        this._orderExpirationCheckingIntervalMs =
 | 
			
		||||
@@ -44,7 +44,7 @@ export class ExpirationWatcher {
 | 
			
		||||
        this._orderExpirationCheckingIntervalIdIfExists = intervalUtils.setInterval(
 | 
			
		||||
            this._pruneExpiredOrders.bind(this, callback),
 | 
			
		||||
            this._orderExpirationCheckingIntervalMs,
 | 
			
		||||
            _.noop, // _pruneExpiredOrders never throws
 | 
			
		||||
            _.noop.bind(_), // _pruneExpiredOrders never throws
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
    public unsubscribe(): void {
 | 
			
		||||
 
 | 
			
		||||
@@ -70,18 +70,18 @@ const STATE_LAYER = BlockParamLiteral.Latest;
 | 
			
		||||
 * the order should be deemed invalid.
 | 
			
		||||
 */
 | 
			
		||||
export class OrderWatcher {
 | 
			
		||||
    private _contractWrappers: ContractWrappers;
 | 
			
		||||
    private _orderStateByOrderHashCache: OrderStateByOrderHash = {};
 | 
			
		||||
    private _orderByOrderHash: OrderByOrderHash = {};
 | 
			
		||||
    private _dependentOrderHashes: DependentOrderHashes = {};
 | 
			
		||||
    private readonly _contractWrappers: ContractWrappers;
 | 
			
		||||
    private readonly _orderStateByOrderHashCache: OrderStateByOrderHash = {};
 | 
			
		||||
    private readonly _orderByOrderHash: OrderByOrderHash = {};
 | 
			
		||||
    private readonly _dependentOrderHashes: DependentOrderHashes = {};
 | 
			
		||||
    private _callbackIfExists?: OnOrderStateChangeCallback;
 | 
			
		||||
    private _eventWatcher: EventWatcher;
 | 
			
		||||
    private _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private _expirationWatcher: ExpirationWatcher;
 | 
			
		||||
    private _orderStateUtils: OrderStateUtils;
 | 
			
		||||
    private _orderFilledCancelledLazyStore: OrderFilledCancelledLazyStore;
 | 
			
		||||
    private _balanceAndProxyAllowanceLazyStore: BalanceAndProxyAllowanceLazyStore;
 | 
			
		||||
    private _cleanupJobInterval: number;
 | 
			
		||||
    private readonly _eventWatcher: EventWatcher;
 | 
			
		||||
    private readonly _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private readonly _expirationWatcher: ExpirationWatcher;
 | 
			
		||||
    private readonly _orderStateUtils: OrderStateUtils;
 | 
			
		||||
    private readonly _orderFilledCancelledLazyStore: OrderFilledCancelledLazyStore;
 | 
			
		||||
    private readonly _balanceAndProxyAllowanceLazyStore: BalanceAndProxyAllowanceLazyStore;
 | 
			
		||||
    private readonly _cleanupJobInterval: number;
 | 
			
		||||
    private _cleanupJobIntervalIdIfExists?: NodeJS.Timer;
 | 
			
		||||
    constructor(provider: Provider, networkId: number, config?: OrderWatcherConfig) {
 | 
			
		||||
        this._web3Wrapper = new Web3Wrapper(provider);
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,6 @@ export const assert = {
 | 
			
		||||
    ...sharedAssert,
 | 
			
		||||
    isValidSignature(orderHash: string, ecSignature: ECSignature, signerAddress: string): void {
 | 
			
		||||
        const isValid = isValidSignature(orderHash, ecSignature, signerAddress);
 | 
			
		||||
        this.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`);
 | 
			
		||||
        assert.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`);
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ before('migrate contracts', async function(): Promise<void> {
 | 
			
		||||
    // HACK: Since the migrations take longer then our global mocha timeout limit
 | 
			
		||||
    // we manually increase it for this before hook.
 | 
			
		||||
    const mochaTestTimeoutMs = 25000;
 | 
			
		||||
    this.timeout(mochaTestTimeoutMs);
 | 
			
		||||
    this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this
 | 
			
		||||
    const txDefaults = {
 | 
			
		||||
        gas: devConstants.GAS_LIMIT,
 | 
			
		||||
        from: devConstants.TESTRPC_FIRST_ADDRESS,
 | 
			
		||||
 
 | 
			
		||||
@@ -116,8 +116,8 @@ describe('OrderWatcher', () => {
 | 
			
		||||
            orderWatcher.unsubscribe();
 | 
			
		||||
        });
 | 
			
		||||
        it('should fail when trying to subscribe twice', async () => {
 | 
			
		||||
            orderWatcher.subscribe(_.noop);
 | 
			
		||||
            expect(() => orderWatcher.subscribe(_.noop)).to.throw(OrderWatcherError.SubscriptionAlreadyPresent);
 | 
			
		||||
            orderWatcher.subscribe(_.noop.bind(_));
 | 
			
		||||
            expect(() => orderWatcher.subscribe(_.noop.bind(_))).to.throw(OrderWatcherError.SubscriptionAlreadyPresent);
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
    describe('tests with cleanup', async () => {
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ const PROTOCOL_TOKEN_SYMBOL = 'ZRX';
 | 
			
		||||
const WETH_TOKEN_SYMBOL = 'WETH';
 | 
			
		||||
 | 
			
		||||
export class TokenUtils {
 | 
			
		||||
    private _tokens: Token[];
 | 
			
		||||
    private readonly _tokens: Token[];
 | 
			
		||||
    constructor(tokens: Token[]) {
 | 
			
		||||
        this._tokens = tokens;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ export class DocsInfo {
 | 
			
		||||
    public sectionNameToMarkdown: { [sectionName: string]: string };
 | 
			
		||||
    public contractsByVersionByNetworkId?: ContractsByVersionByNetworkId;
 | 
			
		||||
    public typeConfigs: DocsInfoTypeConfigs;
 | 
			
		||||
    private _docsInfo: DocsInfoConfig;
 | 
			
		||||
    private readonly _docsInfo: DocsInfoConfig;
 | 
			
		||||
    constructor(config: DocsInfoConfig) {
 | 
			
		||||
        this.id = config.id;
 | 
			
		||||
        this.type = config.type;
 | 
			
		||||
 
 | 
			
		||||
@@ -31,8 +31,8 @@ export const doxityUtils = {
 | 
			
		||||
                    comment: doxityConstructor.details,
 | 
			
		||||
                    returnComment: doxityConstructor.return,
 | 
			
		||||
                    callPath: '',
 | 
			
		||||
                    parameters: this._convertParameters(doxityConstructor.inputs),
 | 
			
		||||
                    returnType: this._convertType(doxityContractObj.name),
 | 
			
		||||
                    parameters: doxityUtils._convertParameters(doxityConstructor.inputs),
 | 
			
		||||
                    returnType: doxityUtils._convertType(doxityContractObj.name),
 | 
			
		||||
                };
 | 
			
		||||
                constructors.push(constructor);
 | 
			
		||||
            }
 | 
			
		||||
@@ -40,7 +40,7 @@ export const doxityUtils = {
 | 
			
		||||
            const doxityMethods: DoxityAbiDoc[] = _.filter<DoxityAbiDoc>(
 | 
			
		||||
                doxityContractObj.abiDocs,
 | 
			
		||||
                (abiDoc: DoxityAbiDoc) => {
 | 
			
		||||
                    return this._isMethod(abiDoc);
 | 
			
		||||
                    return doxityUtils._isMethod(abiDoc);
 | 
			
		||||
                },
 | 
			
		||||
            );
 | 
			
		||||
            const methods: SolidityMethod[] = _.map<DoxityAbiDoc, SolidityMethod>(
 | 
			
		||||
@@ -52,10 +52,10 @@ export const doxityUtils = {
 | 
			
		||||
                        // no-op. It's already undefined
 | 
			
		||||
                    } else if (outputs.length === 1) {
 | 
			
		||||
                        const outputsType = outputs[0].type;
 | 
			
		||||
                        returnTypeIfExists = this._convertType(outputsType);
 | 
			
		||||
                        returnTypeIfExists = doxityUtils._convertType(outputsType);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        const outputsType = `[${_.map(outputs, output => output.type).join(', ')}]`;
 | 
			
		||||
                        returnTypeIfExists = this._convertType(outputsType);
 | 
			
		||||
                        returnTypeIfExists = doxityUtils._convertType(outputsType);
 | 
			
		||||
                    }
 | 
			
		||||
                    // For ZRXToken, we want to convert it to zrxToken, rather then simply zRXToken
 | 
			
		||||
                    const callPath =
 | 
			
		||||
@@ -70,7 +70,7 @@ export const doxityUtils = {
 | 
			
		||||
                        comment: doxityMethod.details,
 | 
			
		||||
                        returnComment: doxityMethod.return,
 | 
			
		||||
                        callPath,
 | 
			
		||||
                        parameters: this._convertParameters(doxityMethod.inputs),
 | 
			
		||||
                        parameters: doxityUtils._convertParameters(doxityMethod.inputs),
 | 
			
		||||
                        returnType: returnTypeIfExists,
 | 
			
		||||
                    };
 | 
			
		||||
                    return method;
 | 
			
		||||
@@ -80,7 +80,7 @@ export const doxityUtils = {
 | 
			
		||||
            const doxityProperties: DoxityAbiDoc[] = _.filter<DoxityAbiDoc>(
 | 
			
		||||
                doxityContractObj.abiDocs,
 | 
			
		||||
                (abiDoc: DoxityAbiDoc) => {
 | 
			
		||||
                    return this._isProperty(abiDoc);
 | 
			
		||||
                    return doxityUtils._isProperty(abiDoc);
 | 
			
		||||
                },
 | 
			
		||||
            );
 | 
			
		||||
            const properties = _.map<DoxityAbiDoc, Property>(doxityProperties, (doxityProperty: DoxityAbiDoc) => {
 | 
			
		||||
@@ -92,7 +92,7 @@ export const doxityUtils = {
 | 
			
		||||
                }
 | 
			
		||||
                const property = {
 | 
			
		||||
                    name: doxityProperty.name,
 | 
			
		||||
                    type: this._convertType(typeName),
 | 
			
		||||
                    type: doxityUtils._convertType(typeName),
 | 
			
		||||
                    comment: doxityProperty.details,
 | 
			
		||||
                };
 | 
			
		||||
                return property;
 | 
			
		||||
@@ -105,7 +105,7 @@ export const doxityUtils = {
 | 
			
		||||
            const events = _.map(doxityEvents, doxityEvent => {
 | 
			
		||||
                const event = {
 | 
			
		||||
                    name: doxityEvent.name,
 | 
			
		||||
                    eventArgs: this._convertEventArgs(doxityEvent.inputs),
 | 
			
		||||
                    eventArgs: doxityUtils._convertEventArgs(doxityEvent.inputs),
 | 
			
		||||
                };
 | 
			
		||||
                return event;
 | 
			
		||||
            });
 | 
			
		||||
@@ -129,7 +129,7 @@ export const doxityUtils = {
 | 
			
		||||
                name: input.name,
 | 
			
		||||
                comment: input.description,
 | 
			
		||||
                isOptional: false,
 | 
			
		||||
                type: this._convertType(input.type),
 | 
			
		||||
                type: doxityUtils._convertType(input.type),
 | 
			
		||||
            };
 | 
			
		||||
            return parameter;
 | 
			
		||||
        });
 | 
			
		||||
@@ -167,7 +167,7 @@ export const doxityUtils = {
 | 
			
		||||
            const eventArg = {
 | 
			
		||||
                isIndexed: input.indexed,
 | 
			
		||||
                name: input.name,
 | 
			
		||||
                type: this._convertType(input.type),
 | 
			
		||||
                type: doxityUtils._convertType(input.type),
 | 
			
		||||
            };
 | 
			
		||||
            return eventArg;
 | 
			
		||||
        });
 | 
			
		||||
 
 | 
			
		||||
@@ -235,7 +235,7 @@ export const typeDocUtils = {
 | 
			
		||||
                      childTypeIfExists = {
 | 
			
		||||
                          name: child.name,
 | 
			
		||||
                          typeDocType: TypeDocTypes.Reflection,
 | 
			
		||||
                          method: this._convertMethod(child, isConstructor, sections, sectionName, docId),
 | 
			
		||||
                          method: typeDocUtils._convertMethod(child, isConstructor, sections, sectionName, docId),
 | 
			
		||||
                      };
 | 
			
		||||
                  }
 | 
			
		||||
                  const c: CustomTypeChild = {
 | 
			
		||||
 
 | 
			
		||||
@@ -41,7 +41,7 @@ const styles: Styles = {
 | 
			
		||||
export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, NestedSidebarMenuState> {
 | 
			
		||||
    public static defaultProps: Partial<NestedSidebarMenuProps> = {
 | 
			
		||||
        shouldDisplaySectionHeaders: true,
 | 
			
		||||
        onMenuItemClick: _.noop,
 | 
			
		||||
        onMenuItemClick: _.noop.bind(_),
 | 
			
		||||
    };
 | 
			
		||||
    public render(): React.ReactNode {
 | 
			
		||||
        const navigation = _.map(this.props.topLevelMenu, (menuItems: string[], sectionName: string) => {
 | 
			
		||||
 
 | 
			
		||||
@@ -68,7 +68,7 @@
 | 
			
		||||
        "npm-run-all": "^4.1.2",
 | 
			
		||||
        "nyc": "^11.0.1",
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typedoc": "0xProject/typedoc",
 | 
			
		||||
        "types-bn": "^0.0.1",
 | 
			
		||||
        "typescript": "2.7.1",
 | 
			
		||||
 
 | 
			
		||||
@@ -58,13 +58,13 @@ const CONFIG_FILE = 'compiler.json';
 | 
			
		||||
 * to artifact files.
 | 
			
		||||
 */
 | 
			
		||||
export class Compiler {
 | 
			
		||||
    private _resolver: Resolver;
 | 
			
		||||
    private _nameResolver: NameResolver;
 | 
			
		||||
    private _contractsDir: string;
 | 
			
		||||
    private _compilerSettings: solc.CompilerSettings;
 | 
			
		||||
    private _artifactsDir: string;
 | 
			
		||||
    private _solcVersionIfExists: string | undefined;
 | 
			
		||||
    private _specifiedContracts: string[] | TYPE_ALL_FILES_IDENTIFIER;
 | 
			
		||||
    private readonly _resolver: Resolver;
 | 
			
		||||
    private readonly _nameResolver: NameResolver;
 | 
			
		||||
    private readonly _contractsDir: string;
 | 
			
		||||
    private readonly _compilerSettings: solc.CompilerSettings;
 | 
			
		||||
    private readonly _artifactsDir: string;
 | 
			
		||||
    private readonly _solcVersionIfExists: string | undefined;
 | 
			
		||||
    private readonly _specifiedContracts: string[] | TYPE_ALL_FILES_IDENTIFIER;
 | 
			
		||||
    /**
 | 
			
		||||
     * Instantiates a new instance of the Compiler class.
 | 
			
		||||
     * @return An instance of the Compiler class.
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ import { constants } from './util/constants';
 | 
			
		||||
const expect = chai.expect;
 | 
			
		||||
 | 
			
		||||
describe('#Compiler', function(): void {
 | 
			
		||||
    this.timeout(constants.timeoutMs);
 | 
			
		||||
    this.timeout(constants.timeoutMs); // tslint:disable-line:no-invalid-this
 | 
			
		||||
    const artifactsDir = `${__dirname}/fixtures/artifacts`;
 | 
			
		||||
    const contractsDir = `${__dirname}/fixtures/contracts`;
 | 
			
		||||
    const exchangeArtifactPath = `${artifactsDir}/Exchange.json`;
 | 
			
		||||
 
 | 
			
		||||
@@ -86,7 +86,7 @@
 | 
			
		||||
        "nyc": "^11.0.1",
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "sinon": "^4.0.0",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typedoc": "0xProject/typedoc",
 | 
			
		||||
        "typescript": "2.7.1"
 | 
			
		||||
    },
 | 
			
		||||
 
 | 
			
		||||
@@ -12,8 +12,8 @@ import { AbstractArtifactAdapter } from './abstract_artifact_adapter';
 | 
			
		||||
const CONFIG_FILE = 'compiler.json';
 | 
			
		||||
 | 
			
		||||
export class SolCompilerArtifactAdapter extends AbstractArtifactAdapter {
 | 
			
		||||
    private _artifactsPath: string;
 | 
			
		||||
    private _sourcesPath: string;
 | 
			
		||||
    private readonly _artifactsPath: string;
 | 
			
		||||
    private readonly _sourcesPath: string;
 | 
			
		||||
    constructor(artifactsPath?: string, sourcesPath?: string) {
 | 
			
		||||
        super();
 | 
			
		||||
        const config: CompilerOptions = fs.existsSync(CONFIG_FILE)
 | 
			
		||||
 
 | 
			
		||||
@@ -7,8 +7,8 @@ import { AbstractArtifactAdapter } from './abstract_artifact_adapter';
 | 
			
		||||
import { SolCompilerArtifactAdapter } from './sol_compiler_artifact_adapter';
 | 
			
		||||
 | 
			
		||||
export class TruffleArtifactAdapter extends AbstractArtifactAdapter {
 | 
			
		||||
    private _solcVersion: string;
 | 
			
		||||
    private _sourcesPath: string;
 | 
			
		||||
    private readonly _solcVersion: string;
 | 
			
		||||
    private readonly _sourcesPath: string;
 | 
			
		||||
    constructor(sourcesPath: string, solcVersion: string) {
 | 
			
		||||
        super();
 | 
			
		||||
        this._solcVersion = solcVersion;
 | 
			
		||||
 
 | 
			
		||||
@@ -18,15 +18,15 @@ enum BranchType {
 | 
			
		||||
 | 
			
		||||
export class ASTVisitor {
 | 
			
		||||
    private _entryId = 0;
 | 
			
		||||
    private _fnMap: FnMap = {};
 | 
			
		||||
    private _branchMap: BranchMap = {};
 | 
			
		||||
    private _modifiersStatementIds: number[] = [];
 | 
			
		||||
    private _statementMap: StatementMap = {};
 | 
			
		||||
    private _locationByOffset: LocationByOffset;
 | 
			
		||||
    private _ignoreRangesBeginningAt: number[];
 | 
			
		||||
    private readonly _fnMap: FnMap = {};
 | 
			
		||||
    private readonly _branchMap: BranchMap = {};
 | 
			
		||||
    private readonly _modifiersStatementIds: number[] = [];
 | 
			
		||||
    private readonly _statementMap: StatementMap = {};
 | 
			
		||||
    private readonly _locationByOffset: LocationByOffset;
 | 
			
		||||
    private readonly _ignoreRangesBeginningAt: number[];
 | 
			
		||||
    // keep track of contract/function ranges that are to be ignored
 | 
			
		||||
    // so we can also ignore any children nodes within the contract/function
 | 
			
		||||
    private _ignoreRangesWithin: Array<[number, number]> = [];
 | 
			
		||||
    private readonly _ignoreRangesWithin: Array<[number, number]> = [];
 | 
			
		||||
    constructor(locationByOffset: LocationByOffset, ignoreRangesBeginningAt: number[] = []) {
 | 
			
		||||
        this._locationByOffset = locationByOffset;
 | 
			
		||||
        this._ignoreRangesBeginningAt = ignoreRangesBeginningAt;
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ import { utils } from './utils';
 | 
			
		||||
 * It's used to compute your code coverage while running solidity tests.
 | 
			
		||||
 */
 | 
			
		||||
export class CoverageSubprovider extends TraceInfoSubprovider {
 | 
			
		||||
    private _coverageCollector: TraceCollector;
 | 
			
		||||
    private readonly _coverageCollector: TraceCollector;
 | 
			
		||||
    /**
 | 
			
		||||
     * Instantiates a CoverageSubprovider instance
 | 
			
		||||
     * @param artifactAdapter Adapter for used artifacts format (0x, truffle, giveth, etc.)
 | 
			
		||||
 
 | 
			
		||||
@@ -38,7 +38,7 @@ export function getSourceRangeSnippet(sourceRange: SourceRange, sourceCode: stri
 | 
			
		||||
 | 
			
		||||
// A visitor which collects ASTInfo for most nodes in the AST.
 | 
			
		||||
class ASTInfoVisitor {
 | 
			
		||||
    private _astInfos: ASTInfo[] = [];
 | 
			
		||||
    private readonly _astInfos: ASTInfo[] = [];
 | 
			
		||||
    public getASTInfoForRange(sourceRange: SourceRange): ASTInfo | null {
 | 
			
		||||
        // HACK(albrow): Sometimes the source range doesn't exactly match that
 | 
			
		||||
        // of astInfo. To work around that we try with a +/-1 offset on
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ import { utils } from './utils';
 | 
			
		||||
 * ProfilerSubprovider is used to profile Solidity code while running tests.
 | 
			
		||||
 */
 | 
			
		||||
export class ProfilerSubprovider extends TraceInfoSubprovider {
 | 
			
		||||
    private _profilerCollector: TraceCollector;
 | 
			
		||||
    private readonly _profilerCollector: TraceCollector;
 | 
			
		||||
    /**
 | 
			
		||||
     * Instantiates a ProfilerSubprovider instance
 | 
			
		||||
     * @param artifactAdapter Adapter for used artifacts format (0x, truffle, giveth, etc.)
 | 
			
		||||
 
 | 
			
		||||
@@ -18,8 +18,8 @@ import { utils } from './utils';
 | 
			
		||||
export class RevertTraceSubprovider extends TraceCollectionSubprovider {
 | 
			
		||||
    // Lock is used to not accept normal transactions while doing call/snapshot magic because they'll be reverted later otherwise
 | 
			
		||||
    private _contractsData!: ContractData[];
 | 
			
		||||
    private _artifactAdapter: AbstractArtifactAdapter;
 | 
			
		||||
    private _logger: Logger;
 | 
			
		||||
    private readonly _artifactAdapter: AbstractArtifactAdapter;
 | 
			
		||||
    private readonly _logger: Logger;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Instantiates a RevertTraceSubprovider instance
 | 
			
		||||
 
 | 
			
		||||
@@ -32,10 +32,10 @@ export interface TraceCollectionSubproviderConfig {
 | 
			
		||||
export abstract class TraceCollectionSubprovider extends Subprovider {
 | 
			
		||||
    protected _web3Wrapper!: Web3Wrapper;
 | 
			
		||||
    // Lock is used to not accept normal transactions while doing call/snapshot magic because they'll be reverted later otherwise
 | 
			
		||||
    private _lock = new Lock();
 | 
			
		||||
    private _defaultFromAddress: string;
 | 
			
		||||
    private readonly _lock = new Lock();
 | 
			
		||||
    private readonly _defaultFromAddress: string;
 | 
			
		||||
    private _isEnabled = true;
 | 
			
		||||
    private _config: TraceCollectionSubproviderConfig;
 | 
			
		||||
    private readonly _config: TraceCollectionSubproviderConfig;
 | 
			
		||||
    /**
 | 
			
		||||
     * Instantiates a TraceCollectionSubprovider instance
 | 
			
		||||
     * @param defaultFromAddress default from address to use when sending transactions
 | 
			
		||||
 
 | 
			
		||||
@@ -33,11 +33,11 @@ export type SingleFileSubtraceHandler = (
 | 
			
		||||
 * TraceCollector is used by CoverageSubprovider to compute code coverage based on collected trace data.
 | 
			
		||||
 */
 | 
			
		||||
export class TraceCollector {
 | 
			
		||||
    private _artifactAdapter: AbstractArtifactAdapter;
 | 
			
		||||
    private _logger: Logger;
 | 
			
		||||
    private readonly _artifactAdapter: AbstractArtifactAdapter;
 | 
			
		||||
    private readonly _logger: Logger;
 | 
			
		||||
    private _contractsData!: ContractData[];
 | 
			
		||||
    private _collector = new Collector();
 | 
			
		||||
    private _singleFileSubtraceHandler: SingleFileSubtraceHandler;
 | 
			
		||||
    private readonly _collector = new Collector();
 | 
			
		||||
    private readonly _singleFileSubtraceHandler: SingleFileSubtraceHandler;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Instantiates a TraceCollector instance
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@
 | 
			
		||||
        "copyfiles": "^1.2.0",
 | 
			
		||||
        "make-promises-safe": "^1.1.0",
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typescript": "2.7.1"
 | 
			
		||||
    },
 | 
			
		||||
    "dependencies": {
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ import { ContractSource } from '../types';
 | 
			
		||||
import { Resolver } from './resolver';
 | 
			
		||||
 | 
			
		||||
export class FallthroughResolver extends Resolver {
 | 
			
		||||
    private _resolvers: Resolver[] = [];
 | 
			
		||||
    private readonly _resolvers: Resolver[] = [];
 | 
			
		||||
    public appendResolver(resolver: Resolver): void {
 | 
			
		||||
        this._resolvers.push(resolver);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ import { EnumerableResolver } from './enumerable_resolver';
 | 
			
		||||
const SOLIDITY_FILE_EXTENSION = '.sol';
 | 
			
		||||
 | 
			
		||||
export class NameResolver extends EnumerableResolver {
 | 
			
		||||
    private _contractsDir: string;
 | 
			
		||||
    private readonly _contractsDir: string;
 | 
			
		||||
    constructor(contractsDir: string) {
 | 
			
		||||
        super();
 | 
			
		||||
        this._contractsDir = contractsDir;
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ import { ContractSource } from '../types';
 | 
			
		||||
import { Resolver } from './resolver';
 | 
			
		||||
 | 
			
		||||
export class NPMResolver extends Resolver {
 | 
			
		||||
    private _packagePath: string;
 | 
			
		||||
    private readonly _packagePath: string;
 | 
			
		||||
    constructor(packagePath: string) {
 | 
			
		||||
        super();
 | 
			
		||||
        this._packagePath = packagePath;
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ import { ContractSource } from '../types';
 | 
			
		||||
import { Resolver } from './resolver';
 | 
			
		||||
 | 
			
		||||
export class RelativeFSResolver extends Resolver {
 | 
			
		||||
    private _contractsDir: string;
 | 
			
		||||
    private readonly _contractsDir: string;
 | 
			
		||||
    constructor(contractsDir: string) {
 | 
			
		||||
        super();
 | 
			
		||||
        this._contractsDir = contractsDir;
 | 
			
		||||
 
 | 
			
		||||
@@ -65,7 +65,7 @@
 | 
			
		||||
        "npm-run-all": "^4.1.2",
 | 
			
		||||
        "nyc": "^11.0.1",
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typescript": "2.7.1"
 | 
			
		||||
    },
 | 
			
		||||
    "publishConfig": {
 | 
			
		||||
 
 | 
			
		||||
@@ -82,7 +82,7 @@
 | 
			
		||||
        "nyc": "^11.0.1",
 | 
			
		||||
        "shx": "^0.2.2",
 | 
			
		||||
        "sinon": "^4.0.0",
 | 
			
		||||
        "tslint": "5.8.0",
 | 
			
		||||
        "tslint": "5.11.0",
 | 
			
		||||
        "typedoc": "0xProject/typedoc",
 | 
			
		||||
        "typescript": "2.7.1",
 | 
			
		||||
        "webpack": "^3.1.0"
 | 
			
		||||
 
 | 
			
		||||
@@ -12,8 +12,8 @@ import { PrivateKeyWalletSubprovider } from './private_key_wallet';
 | 
			
		||||
 * Source: https://github.com/MetaMask/provider-engine/blob/master/subproviders/subprovider.js
 | 
			
		||||
 */
 | 
			
		||||
export class EthLightwalletSubprovider extends BaseWalletSubprovider {
 | 
			
		||||
    private _keystore: lightwallet.keystore;
 | 
			
		||||
    private _pwDerivedKey: Uint8Array;
 | 
			
		||||
    private readonly _keystore: lightwallet.keystore;
 | 
			
		||||
    private readonly _pwDerivedKey: Uint8Array;
 | 
			
		||||
    constructor(keystore: lightwallet.keystore, pwDerivedKey: Uint8Array) {
 | 
			
		||||
        super();
 | 
			
		||||
        this._keystore = keystore;
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@ import { Subprovider } from './subprovider';
 | 
			
		||||
 * It intercepts the `eth_estimateGas` JSON RPC call and always returns a constant gas amount when queried.
 | 
			
		||||
 */
 | 
			
		||||
export class FakeGasEstimateSubprovider extends Subprovider {
 | 
			
		||||
    private _constantGasAmount: number;
 | 
			
		||||
    private readonly _constantGasAmount: number;
 | 
			
		||||
    /**
 | 
			
		||||
     * Instantiates an instance of the FakeGasEstimateSubprovider
 | 
			
		||||
     * @param constantGasAmount The constant gas amount you want returned
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@ import { Subprovider } from './subprovider';
 | 
			
		||||
 * It intercepts all JSON RPC requests and relays them to an in-process ganache instance.
 | 
			
		||||
 */
 | 
			
		||||
export class GanacheSubprovider extends Subprovider {
 | 
			
		||||
    private _ganacheProvider: Provider;
 | 
			
		||||
    private readonly _ganacheProvider: Provider;
 | 
			
		||||
    /**
 | 
			
		||||
     * Instantiates a GanacheSubprovider
 | 
			
		||||
     * @param opts The desired opts with which to instantiate the Ganache provider
 | 
			
		||||
 
 | 
			
		||||
@@ -32,14 +32,14 @@ const DEFAULT_ADDRESS_SEARCH_LIMIT = 1000;
 | 
			
		||||
 */
 | 
			
		||||
export class LedgerSubprovider extends BaseWalletSubprovider {
 | 
			
		||||
    // tslint:disable-next-line:no-unused-variable
 | 
			
		||||
    private _nonceLock = new Lock();
 | 
			
		||||
    private _connectionLock = new Lock();
 | 
			
		||||
    private _networkId: number;
 | 
			
		||||
    private readonly _nonceLock = new Lock();
 | 
			
		||||
    private readonly _connectionLock = new Lock();
 | 
			
		||||
    private readonly _networkId: number;
 | 
			
		||||
    private _baseDerivationPath: string;
 | 
			
		||||
    private _ledgerEthereumClientFactoryAsync: LedgerEthereumClientFactoryAsync;
 | 
			
		||||
    private readonly _ledgerEthereumClientFactoryAsync: LedgerEthereumClientFactoryAsync;
 | 
			
		||||
    private _ledgerClientIfExists?: LedgerEthereumClient;
 | 
			
		||||
    private _shouldAlwaysAskForConfirmation: boolean;
 | 
			
		||||
    private _addressSearchLimit: number;
 | 
			
		||||
    private readonly _shouldAlwaysAskForConfirmation: boolean;
 | 
			
		||||
    private readonly _addressSearchLimit: number;
 | 
			
		||||
    /**
 | 
			
		||||
     * Instantiates a LedgerSubprovider. Defaults to derivationPath set to `44'/60'/0'`.
 | 
			
		||||
     * TestRPC/Ganache defaults to `m/44'/60'/0'/0`, so set this in the configs if desired.
 | 
			
		||||
 
 | 
			
		||||
@@ -20,10 +20,10 @@ const DEFAULT_ADDRESS_SEARCH_LIMIT = 1000;
 | 
			
		||||
 * all requests with accounts derived from the supplied mnemonic.
 | 
			
		||||
 */
 | 
			
		||||
export class MnemonicWalletSubprovider extends BaseWalletSubprovider {
 | 
			
		||||
    private _addressSearchLimit: number;
 | 
			
		||||
    private readonly _addressSearchLimit: number;
 | 
			
		||||
    private _baseDerivationPath: string;
 | 
			
		||||
    private _derivedKeyInfo: DerivedHDKeyInfo;
 | 
			
		||||
    private _mnemonic: string;
 | 
			
		||||
    private readonly _mnemonic: string;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Instantiates a MnemonicWalletSubprovider. Defaults to baseDerivationPath set to `44'/60'/0'/0`.
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ const NONCE_TOO_LOW_ERROR_MESSAGE = 'Transaction nonce is too low';
 | 
			
		||||
 * We added the additional feature of clearing the cached nonce value when a `nonce value too low` error occurs.
 | 
			
		||||
 */
 | 
			
		||||
export class NonceTrackerSubprovider extends Subprovider {
 | 
			
		||||
    private _nonceCache: { [address: string]: string } = {};
 | 
			
		||||
    private readonly _nonceCache: { [address: string]: string } = {};
 | 
			
		||||
    private static _reconstructTransaction(payload: JSONRPCRequestPayload): EthereumTx {
 | 
			
		||||
        const raw = payload.params[0];
 | 
			
		||||
        if (_.isUndefined(raw)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -13,8 +13,8 @@ import { BaseWalletSubprovider } from './base_wallet_subprovider';
 | 
			
		||||
 * all requests with the supplied Ethereum private key.
 | 
			
		||||
 */
 | 
			
		||||
export class PrivateKeyWalletSubprovider extends BaseWalletSubprovider {
 | 
			
		||||
    private _address: string;
 | 
			
		||||
    private _privateKeyBuffer: Buffer;
 | 
			
		||||
    private readonly _address: string;
 | 
			
		||||
    private readonly _privateKeyBuffer: Buffer;
 | 
			
		||||
    /**
 | 
			
		||||
     * Instantiates a PrivateKeyWalletSubprovider.
 | 
			
		||||
     * @param privateKey The corresponding private key to an Ethereum address
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ import { Subprovider } from './subprovider';
 | 
			
		||||
 * set of JSON RPC endpoints.
 | 
			
		||||
 */
 | 
			
		||||
export class RedundantSubprovider extends Subprovider {
 | 
			
		||||
    private _subproviders: Subprovider[];
 | 
			
		||||
    private readonly _subproviders: Subprovider[];
 | 
			
		||||
    private static async _firstSuccessAsync(
 | 
			
		||||
        subproviders: Subprovider[],
 | 
			
		||||
        payload: JSONRPCRequestPayload,
 | 
			
		||||
 
 | 
			
		||||
@@ -13,8 +13,8 @@ import { Subprovider } from './subprovider';
 | 
			
		||||
 * It forwards on JSON RPC requests to the supplied `rpcUrl` endpoint
 | 
			
		||||
 */
 | 
			
		||||
export class RPCSubprovider extends Subprovider {
 | 
			
		||||
    private _rpcUrl: string;
 | 
			
		||||
    private _requestTimeoutMs: number;
 | 
			
		||||
    private readonly _rpcUrl: string;
 | 
			
		||||
    private readonly _requestTimeoutMs: number;
 | 
			
		||||
    constructor(rpcUrl: string, requestTimeoutMs: number = 20000) {
 | 
			
		||||
        super();
 | 
			
		||||
        assert.isString('rpcUrl', rpcUrl);
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ import { Subprovider } from './subprovider';
 | 
			
		||||
 * are passed onwards for subsequent subproviders to handle.
 | 
			
		||||
 */
 | 
			
		||||
export class SignerSubprovider extends Subprovider {
 | 
			
		||||
    private _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    private readonly _web3Wrapper: Web3Wrapper;
 | 
			
		||||
    /**
 | 
			
		||||
     * Instantiates a new SignerSubprovider
 | 
			
		||||
     * @param provider Web3 provider that should handle  all user account related requests
 | 
			
		||||
 
 | 
			
		||||
@@ -6,8 +6,8 @@ import { DerivedHDKeyInfo } from '../types';
 | 
			
		||||
const DEFAULT_ADDRESS_SEARCH_LIMIT = 1000;
 | 
			
		||||
 | 
			
		||||
class DerivedHDKeyInfoIterator implements IterableIterator<DerivedHDKeyInfo> {
 | 
			
		||||
    private _parentDerivedKeyInfo: DerivedHDKeyInfo;
 | 
			
		||||
    private _searchLimit: number;
 | 
			
		||||
    private readonly _parentDerivedKeyInfo: DerivedHDKeyInfo;
 | 
			
		||||
    private readonly _searchLimit: number;
 | 
			
		||||
    private _index: number;
 | 
			
		||||
 | 
			
		||||
    constructor(initialDerivedKey: DerivedHDKeyInfo, searchLimit: number = DEFAULT_ADDRESS_SEARCH_LIMIT) {
 | 
			
		||||
 
 | 
			
		||||
@@ -176,7 +176,7 @@ describe('LedgerSubprovider', () => {
 | 
			
		||||
                    params: [tx],
 | 
			
		||||
                    id: 1,
 | 
			
		||||
                };
 | 
			
		||||
                await promisify(defaultProvider.sendAsync, defaultProvider)(payload);
 | 
			
		||||
                await promisify(defaultProvider.sendAsync.bind(defaultProvider))(payload);
 | 
			
		||||
 | 
			
		||||
                // Send transaction from Ledger
 | 
			
		||||
                tx = {
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@ describe('LedgerSubprovider', () => {
 | 
			
		||||
                    return ecSignature;
 | 
			
		||||
                },
 | 
			
		||||
                transport: {
 | 
			
		||||
                    close: _.noop,
 | 
			
		||||
                    close: _.noop.bind(_),
 | 
			
		||||
                } as LedgerCommunicationClient,
 | 
			
		||||
            };
 | 
			
		||||
            // tslint:enable:no-object-literal-type-assertion
 | 
			
		||||
 
 | 
			
		||||
@@ -60,9 +60,9 @@ describe('NonceTrackerSubprovider', () => {
 | 
			
		||||
 | 
			
		||||
        const payload = { ...getTransactionCountPayload, params: ['0x0', 'pending'] };
 | 
			
		||||
 | 
			
		||||
        const response = await promisify<any>(provider.sendAsync, provider)(payload);
 | 
			
		||||
        const response = await promisify<any>(provider.sendAsync.bind(provider))(payload);
 | 
			
		||||
        expect(response.result).to.be.eq('0x00');
 | 
			
		||||
        const secondResponse = await promisify<any>(provider.sendAsync, provider)(payload);
 | 
			
		||||
        const secondResponse = await promisify<any>(provider.sendAsync.bind(provider))(payload);
 | 
			
		||||
        expect(secondResponse.result).to.be.eq('0x00');
 | 
			
		||||
    });
 | 
			
		||||
    it('does not cache the result for latest transaction count', async () => {
 | 
			
		||||
@@ -74,9 +74,9 @@ describe('NonceTrackerSubprovider', () => {
 | 
			
		||||
 | 
			
		||||
        const payload = { ...getTransactionCountPayload, params: ['0x0', 'latest'] };
 | 
			
		||||
 | 
			
		||||
        const response = await promisify<any>(provider.sendAsync, provider)(payload);
 | 
			
		||||
        const response = await promisify<any>(provider.sendAsync.bind(provider))(payload);
 | 
			
		||||
        expect(response.result).to.be.eq('0x00');
 | 
			
		||||
        const secondResponse = await promisify<any>(provider.sendAsync, provider)(payload);
 | 
			
		||||
        const secondResponse = await promisify<any>(provider.sendAsync.bind(provider))(payload);
 | 
			
		||||
        expect(secondResponse.result).to.be.eq('0x99');
 | 
			
		||||
    });
 | 
			
		||||
    it('clears the cache on a Nonce Too Low Error', async () => {
 | 
			
		||||
@@ -103,14 +103,14 @@ describe('NonceTrackerSubprovider', () => {
 | 
			
		||||
            params: [transaction.serialize()],
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        const response = await promisify<any>(provider.sendAsync, provider)(noncePayload);
 | 
			
		||||
        const response = await promisify<any>(provider.sendAsync.bind(provider))(noncePayload);
 | 
			
		||||
        expect(response.result).to.be.eq('0x00');
 | 
			
		||||
        const secondResponse = await promisify<any>(provider.sendAsync, provider)(noncePayload);
 | 
			
		||||
        const secondResponse = await promisify<any>(provider.sendAsync.bind(provider))(noncePayload);
 | 
			
		||||
        expect(secondResponse.result).to.be.eq('0x00');
 | 
			
		||||
        try {
 | 
			
		||||
            await promisify(provider.sendAsync, provider)(txPayload);
 | 
			
		||||
            await promisify(provider.sendAsync.bind(provider))(txPayload);
 | 
			
		||||
        } catch (err) {
 | 
			
		||||
            const thirdResponse = await promisify<any>(provider.sendAsync, provider)(noncePayload);
 | 
			
		||||
            const thirdResponse = await promisify<any>(provider.sendAsync.bind(provider))(noncePayload);
 | 
			
		||||
            expect(thirdResponse.result).to.be.eq('0x99');
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
@@ -138,12 +138,12 @@ describe('NonceTrackerSubprovider', () => {
 | 
			
		||||
            params: [transaction.serialize()],
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        const response = await promisify<any>(provider.sendAsync, provider)(noncePayload);
 | 
			
		||||
        const response = await promisify<any>(provider.sendAsync.bind(provider))(noncePayload);
 | 
			
		||||
        expect(response.result).to.be.eq('0x00');
 | 
			
		||||
        const secondResponse = await promisify<any>(provider.sendAsync, provider)(noncePayload);
 | 
			
		||||
        const secondResponse = await promisify<any>(provider.sendAsync.bind(provider))(noncePayload);
 | 
			
		||||
        expect(secondResponse.result).to.be.eq('0x00');
 | 
			
		||||
        await promisify(provider.sendAsync, provider)(txPayload);
 | 
			
		||||
        const thirdResponse = await promisify<any>(provider.sendAsync, provider)(noncePayload);
 | 
			
		||||
        await promisify(provider.sendAsync.bind(provider))(txPayload);
 | 
			
		||||
        const thirdResponse = await promisify<any>(provider.sendAsync.bind(provider))(noncePayload);
 | 
			
		||||
        expect(thirdResponse.result).to.be.eq('0x01');
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user