Add new underscore-privates rule to @0xproject/tslint-config and fix lint errors

This commit is contained in:
Brandon Millman
2017-12-20 00:44:08 -05:00
committed by Leonid Logvinov
parent 972e1675f6
commit cb11aec84d
93 changed files with 1418 additions and 1345 deletions

View File

@@ -6,9 +6,9 @@ import {Order} from './order';
import {ContractInstance} from './types';
export class ExchangeWrapper {
private exchange: ContractInstance;
private _exchange: ContractInstance;
constructor(exchangeContractInstance: ContractInstance) {
this.exchange = exchangeContractInstance;
this._exchange = exchangeContractInstance;
}
public async fillOrderAsync(order: Order, from: string,
opts: {
@@ -17,7 +17,7 @@ export class ExchangeWrapper {
} = {}) {
const shouldThrowOnInsufficientBalanceOrAllowance = !!opts.shouldThrowOnInsufficientBalanceOrAllowance;
const params = order.createFill(shouldThrowOnInsufficientBalanceOrAllowance, opts.fillTakerTokenAmount);
const tx = await this.exchange.fillOrder(
const tx = await this._exchange.fillOrder(
params.orderAddresses,
params.orderValues,
params.fillTakerTokenAmount,
@@ -33,7 +33,7 @@ export class ExchangeWrapper {
public async cancelOrderAsync(order: Order, from: string,
opts: {cancelTakerTokenAmount?: BigNumber} = {}) {
const params = order.createCancel(opts.cancelTakerTokenAmount);
const tx = await this.exchange.cancelOrder(
const tx = await this._exchange.cancelOrder(
params.orderAddresses,
params.orderValues,
params.cancelTakerTokenAmount,
@@ -46,7 +46,7 @@ export class ExchangeWrapper {
opts: {fillTakerTokenAmount?: BigNumber} = {}) {
const shouldThrowOnInsufficientBalanceOrAllowance = true;
const params = order.createFill(shouldThrowOnInsufficientBalanceOrAllowance, opts.fillTakerTokenAmount);
const tx = await this.exchange.fillOrKillOrder(
const tx = await this._exchange.fillOrKillOrder(
params.orderAddresses,
params.orderValues,
params.fillTakerTokenAmount,
@@ -66,7 +66,7 @@ export class ExchangeWrapper {
const shouldThrowOnInsufficientBalanceOrAllowance = !!opts.shouldThrowOnInsufficientBalanceOrAllowance;
const params = formatters.createBatchFill(
orders, shouldThrowOnInsufficientBalanceOrAllowance, opts.fillTakerTokenAmounts);
const tx = await this.exchange.batchFillOrders(
const tx = await this._exchange.batchFillOrders(
params.orderAddresses,
params.orderValues,
params.fillTakerTokenAmounts,
@@ -82,7 +82,7 @@ export class ExchangeWrapper {
public async batchFillOrKillOrdersAsync(orders: Order[], from: string,
opts: {fillTakerTokenAmounts?: BigNumber[]} = {}) {
const params = formatters.createBatchFill(orders, undefined, opts.fillTakerTokenAmounts);
const tx = await this.exchange.batchFillOrKillOrders(
const tx = await this._exchange.batchFillOrKillOrders(
params.orderAddresses,
params.orderValues,
params.fillTakerTokenAmounts,
@@ -103,7 +103,7 @@ export class ExchangeWrapper {
const params = formatters.createFillUpTo(orders,
shouldThrowOnInsufficientBalanceOrAllowance,
opts.fillTakerTokenAmount);
const tx = await this.exchange.fillOrdersUpTo(
const tx = await this._exchange.fillOrdersUpTo(
params.orderAddresses,
params.orderValues,
params.fillTakerTokenAmount,
@@ -119,7 +119,7 @@ export class ExchangeWrapper {
public async batchCancelOrdersAsync(orders: Order[], from: string,
opts: {cancelTakerTokenAmounts?: BigNumber[]} = {}) {
const params = formatters.createBatchCancel(orders, opts.cancelTakerTokenAmounts);
const tx = await this.exchange.batchCancelOrders(
const tx = await this._exchange.batchCancelOrders(
params.orderAddresses,
params.orderValues,
params.cancelTakerTokenAmounts,
@@ -131,11 +131,11 @@ export class ExchangeWrapper {
public async getOrderHashAsync(order: Order): Promise<string> {
const shouldThrowOnInsufficientBalanceOrAllowance = false;
const params = order.createFill(shouldThrowOnInsufficientBalanceOrAllowance);
const orderHash = await this.exchange.getOrderHash(params.orderAddresses, params.orderValues);
const orderHash = await this._exchange.getOrderHash(params.orderAddresses, params.orderValues);
return orderHash;
}
public async isValidSignatureAsync(order: Order): Promise<boolean> {
const isValidSignature = await this.exchange.isValidSignature(
const isValidSignature = await this._exchange.isValidSignature(
order.params.maker,
order.params.orderHashHex,
order.params.v,
@@ -146,12 +146,12 @@ export class ExchangeWrapper {
}
public async isRoundingErrorAsync(numerator: BigNumber, denominator: BigNumber,
target: BigNumber): Promise<boolean> {
const isRoundingError = await this.exchange.isRoundingError(numerator, denominator, target);
const isRoundingError = await this._exchange.isRoundingError(numerator, denominator, target);
return isRoundingError;
}
public async getPartialAmountAsync(numerator: BigNumber, denominator: BigNumber,
target: BigNumber): Promise<BigNumber> {
const partialAmount = new BigNumber(await this.exchange.getPartialAmount(numerator, denominator, target));
const partialAmount = new BigNumber(await this._exchange.getPartialAmount(numerator, denominator, target));
return partialAmount;
}
}