Fix linter and prettier

This commit is contained in:
Jacob Evans 2018-04-18 11:24:59 +10:00
parent a63dfb7995
commit 1a161cc02e
No known key found for this signature in database
GPG Key ID: 2036DA2ADDFB0842
7 changed files with 26 additions and 12 deletions

View File

@ -19,7 +19,8 @@
"pr": 501
},
{
"note": "Add `zeroEx.exchange.getOrderStateAsync` to allow obtaining current OrderState for a signedOrder",
"note":
"Add `zeroEx.exchange.getOrderStateAsync` to allow obtaining current OrderState for a signedOrder",
"pr": 510
}
],

View File

@ -882,13 +882,19 @@ export class ExchangeWrapper extends ContractWrapper {
* @param stateLayer Optional, desired blockchain state layer (defaults to latest).
* @return OrderState of the signedOrder
*/
public async getOrderStateAsync(signedOrder: SignedOrder, stateLayer: BlockParamLiteral = BlockParamLiteral.Latest): Promise<OrderState> {
public async getOrderStateAsync(
signedOrder: SignedOrder,
stateLayer: BlockParamLiteral = BlockParamLiteral.Latest,
): Promise<OrderState> {
const simpleBalanceAndProxyAllowanceFetcher = new SimpleBalanceAndProxyAllowanceFetcher(
this._tokenWrapper,
stateLayer,
);
const simpleOrderFilledCancelledFetcher = new SimpleOrderFilledCancelledFetcher(this, stateLayer);
const orderStateUtils = new OrderStateUtils(simpleBalanceAndProxyAllowanceFetcher, simpleOrderFilledCancelledFetcher);
const orderStateUtils = new OrderStateUtils(
simpleBalanceAndProxyAllowanceFetcher,
simpleOrderFilledCancelledFetcher,
);
const orderState = orderStateUtils.getOrderStateAsync(signedOrder);
return orderState;
}

View File

@ -1,8 +1,8 @@
import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import {BalanceAndProxyAllowanceFetcher} from '../abstract/balance_and_proxy_allowance_fetcher';
import {TokenWrapper} from '../contract_wrappers/token_wrapper';
import { BalanceAndProxyAllowanceFetcher } from '../abstract/balance_and_proxy_allowance_fetcher';
import { TokenWrapper } from '../contract_wrappers/token_wrapper';
export class SimpleBalanceAndProxyAllowanceFetcher implements BalanceAndProxyAllowanceFetcher {
private _tokenWrapper: TokenWrapper;

View File

@ -1,8 +1,8 @@
import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import {OrderFilledCancelledFetcher} from '../abstract/order_filled_cancelled_fetcher';
import {ExchangeWrapper} from '../contract_wrappers/exchange_wrapper';
import { OrderFilledCancelledFetcher } from '../abstract/order_filled_cancelled_fetcher';
import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper';
export class SimpleOrderFilledCancelledFetcher implements OrderFilledCancelledFetcher {
private _exchangeWrapper: ExchangeWrapper;

View File

@ -2,8 +2,8 @@ import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import { TokenWrapper } from '../contract_wrappers/token_wrapper';
import { BalanceAndProxyAllowanceFetcher } from '../abstract/balance_and_proxy_allowance_fetcher';
import { TokenWrapper } from '../contract_wrappers/token_wrapper';
/**
* Copy on read store for balances/proxyAllowances of tokens/accounts
@ -60,7 +60,11 @@ export class BalanceAndProxyAllowanceLazyStore implements BalanceAndProxyAllowan
const methodOpts = {
defaultBlock: this._defaultBlock,
};
const proxyAllowance = await this._tokenWrapper.getProxyAllowanceAsync(tokenAddress, userAddress, methodOpts);
const proxyAllowance = await this._tokenWrapper.getProxyAllowanceAsync(
tokenAddress,
userAddress,
methodOpts,
);
this.setProxyAllowance(tokenAddress, userAddress, proxyAllowance);
}
const cachedProxyAllowance = this._proxyAllowance[tokenAddress][userAddress];

View File

@ -2,8 +2,8 @@ import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper';
import { OrderFilledCancelledFetcher } from '../abstract/order_filled_cancelled_fetcher';
import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper';
/**
* Copy on read store for filled/cancelled taker amounts
@ -45,7 +45,10 @@ export class OrderFilledCancelledLazyStore implements OrderFilledCancelledFetche
const methodOpts = {
defaultBlock: this._defaultBlock,
};
const cancelledTakerAmount = await this._exchangeWrapper.getCancelledTakerAmountAsync(orderHash, methodOpts);
const cancelledTakerAmount = await this._exchangeWrapper.getCancelledTakerAmountAsync(
orderHash,
methodOpts,
);
this.setCancelledTakerAmount(orderHash, cancelledTakerAmount);
}
const cachedCancelled = this._cancelledTakerAmount[orderHash];

View File

@ -3,9 +3,9 @@ import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import { ZeroEx } from '../0x';
import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper';
import { BalanceAndProxyAllowanceFetcher } from '../abstract/balance_and_proxy_allowance_fetcher';
import { OrderFilledCancelledFetcher } from '../abstract/order_filled_cancelled_fetcher';
import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper';
import { RemainingFillableCalculator } from '../order_watcher/remaining_fillable_calculator';
import { ExchangeContractErrs, OrderRelevantState, OrderState, OrderStateInvalid, OrderStateValid } from '../types';