From b1b473d3cb73323bc879d8a7e8ac11e3cd13c8b5 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Mon, 13 Nov 2017 12:54:31 -0500 Subject: Renamed canceled to cancelled --- packages/0x.js/src/contract_wrappers/exchange_wrapper.ts | 4 ++-- .../src/stores/order_filled_cancelled_lazy_store.ts | 2 +- packages/0x.js/src/types.ts | 2 +- packages/0x.js/src/utils/order_state_utils.ts | 6 +++--- packages/0x.js/test/exchange_wrapper_test.ts | 16 ++++++++-------- packages/0x.js/test/order_state_watcher_test.ts | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) (limited to 'packages/0x.js') diff --git a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts index 654637a38..5acfd3cc9 100644 --- a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts @@ -95,7 +95,7 @@ export class ExchangeWrapper extends ContractWrapper { * @param orderHash The hex encoded orderHash for which you would like to retrieve the * unavailable takerAmount. * @param methodOpts Optional arguments this method accepts. - * @return The amount of the order (in taker tokens) that has either been filled or canceled. + * @return The amount of the order (in taker tokens) that has either been filled or cancelled. */ public async getUnavailableTakerAmountAsync(orderHash: string, methodOpts?: MethodOpts): Promise { @@ -133,7 +133,7 @@ export class ExchangeWrapper extends ContractWrapper { * @param methodOpts Optional arguments this method accepts. * @return The amount of the order (in taker tokens) that has been cancelled. */ - public async getCanceledTakerAmountAsync(orderHash: string, methodOpts?: MethodOpts): Promise { + public async getCancelledTakerAmountAsync(orderHash: string, methodOpts?: MethodOpts): Promise { assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema); const exchangeContract = await this._getExchangeContractAsync(); diff --git a/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts b/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts index 9d74da096..666d8363c 100644 --- a/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts +++ b/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts @@ -42,7 +42,7 @@ export class OrderFilledCancelledLazyStore { const methodOpts = { defaultBlock: BlockParamLiteral.Pending, }; - const cancelledTakerAmount = await this.exchange.getCanceledTakerAmountAsync(orderHash, methodOpts); + const cancelledTakerAmount = await this.exchange.getCancelledTakerAmountAsync(orderHash, methodOpts); this.setCancelledTakerAmount(orderHash, cancelledTakerAmount); } const cachedCancelled = this.cancelledTakerAmount[orderHash]; diff --git a/packages/0x.js/src/types.ts b/packages/0x.js/src/types.ts index 11683378f..11b5d8569 100644 --- a/packages/0x.js/src/types.ts +++ b/packages/0x.js/src/types.ts @@ -488,7 +488,7 @@ export interface OrderRelevantState { makerFeeBalance: BigNumber; makerFeeProxyAllowance: BigNumber; filledTakerTokenAmount: BigNumber; - canceledTakerTokenAmount: BigNumber; + cancelledTakerTokenAmount: BigNumber; remainingFillableMakerTokenAmount: BigNumber; } diff --git a/packages/0x.js/src/utils/order_state_utils.ts b/packages/0x.js/src/utils/order_state_utils.ts index f82601cae..a1ee7577d 100644 --- a/packages/0x.js/src/utils/order_state_utils.ts +++ b/packages/0x.js/src/utils/order_state_utils.ts @@ -67,7 +67,7 @@ export class OrderStateUtils { zrxTokenAddress, signedOrder.maker, ); const filledTakerTokenAmount = await this.orderFilledCancelledLazyStore.getFilledTakerAmountAsync(orderHash); - const canceledTakerTokenAmount = await this.orderFilledCancelledLazyStore.getCancelledTakerAmountAsync( + const cancelledTakerTokenAmount = await this.orderFilledCancelledLazyStore.getCancelledTakerAmountAsync( orderHash, ); const unavailableTakerTokenAmount = await exchange.getUnavailableTakerAmountAsync(orderHash); @@ -85,13 +85,13 @@ export class OrderStateUtils { makerFeeBalance, makerFeeProxyAllowance, filledTakerTokenAmount, - canceledTakerTokenAmount, + cancelledTakerTokenAmount, remainingFillableMakerTokenAmount, }; return orderRelevantState; } private validateIfOrderIsValid(signedOrder: SignedOrder, orderRelevantState: OrderRelevantState): void { - const unavailableTakerTokenAmount = orderRelevantState.canceledTakerTokenAmount.add( + const unavailableTakerTokenAmount = orderRelevantState.cancelledTakerTokenAmount.add( orderRelevantState.filledTakerTokenAmount, ); const availableTakerTokenAmount = signedOrder.takerTokenAmount.minus(unavailableTakerTokenAmount); diff --git a/packages/0x.js/test/exchange_wrapper_test.ts b/packages/0x.js/test/exchange_wrapper_test.ts index 26b8c1e0e..add89a3b2 100644 --- a/packages/0x.js/test/exchange_wrapper_test.ts +++ b/packages/0x.js/test/exchange_wrapper_test.ts @@ -443,7 +443,7 @@ describe('ExchangeWrapper', () => { it('should cancel an order', async () => { const txHash = await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelAmount); await zeroEx.awaitTransactionMinedAsync(txHash); - const cancelledAmount = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHashHex); + const cancelledAmount = await zeroEx.exchange.getCancelledTakerAmountAsync(orderHashHex); expect(cancelledAmount).to.be.bignumber.equal(cancelAmount); }); }); @@ -502,8 +502,8 @@ describe('ExchangeWrapper', () => { describe('successful batch cancels', () => { it('should cancel a batch of orders', async () => { await zeroEx.exchange.batchCancelOrdersAsync(cancelBatch); - const cancelledAmount = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHashHex); - const anotherCancelledAmount = await zeroEx.exchange.getCanceledTakerAmountAsync( + const cancelledAmount = await zeroEx.exchange.getCancelledTakerAmountAsync(orderHashHex); + const anotherCancelledAmount = await zeroEx.exchange.getCancelledTakerAmountAsync( anotherOrderHashHex, ); expect(cancelledAmount).to.be.bignumber.equal(cancelAmount); @@ -592,23 +592,23 @@ describe('ExchangeWrapper', () => { expect(filledValueT).to.be.bignumber.equal(partialFillAmount); }); }); - describe('#getCanceledTakerAmountAsync', () => { + describe('#getCancelledTakerAmountAsync', () => { it('should throw if passed an invalid orderHash', async () => { const invalidOrderHashHex = '0x123'; - return expect(zeroEx.exchange.getCanceledTakerAmountAsync(invalidOrderHashHex)).to.be.rejected(); + return expect(zeroEx.exchange.getCancelledTakerAmountAsync(invalidOrderHashHex)).to.be.rejected(); }); it('should return zero if passed a valid but non-existent orderHash', async () => { - const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync(NON_EXISTENT_ORDER_HASH); + const cancelledValueT = await zeroEx.exchange.getCancelledTakerAmountAsync(NON_EXISTENT_ORDER_HASH); expect(cancelledValueT).to.be.bignumber.equal(0); }); it('should return the cancelledValueT for a valid and partially filled orderHash', async () => { - const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHash); + const cancelledValueT = await zeroEx.exchange.getCancelledTakerAmountAsync(orderHash); expect(cancelledValueT).to.be.bignumber.equal(0); }); it('should return the cancelledValueT for a valid and cancelled orderHash', async () => { const cancelAmount = fillableAmount.minus(partialFillAmount); await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelAmount); - const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHash); + const cancelledValueT = await zeroEx.exchange.getCancelledTakerAmountAsync(orderHash); expect(cancelledValueT).to.be.bignumber.equal(cancelAmount); }); }); diff --git a/packages/0x.js/test/order_state_watcher_test.ts b/packages/0x.js/test/order_state_watcher_test.ts index c8a4a8064..32f493ee6 100644 --- a/packages/0x.js/test/order_state_watcher_test.ts +++ b/packages/0x.js/test/order_state_watcher_test.ts @@ -345,7 +345,7 @@ describe('OrderStateWatcher', () => { const validOrderState = orderState as OrderStateValid; expect(validOrderState.orderHash).to.be.equal(orderHash); const orderRelevantState = validOrderState.orderRelevantState; - expect(orderRelevantState.canceledTakerTokenAmount).to.be.bignumber.equal(cancelAmountInBaseUnits); + expect(orderRelevantState.cancelledTakerTokenAmount).to.be.bignumber.equal(cancelAmountInBaseUnits); done(); }); zeroEx.orderStateWatcher.subscribe(callback); -- cgit v1.2.3