From afc12ac497de618133c87f9ec88dc3b716af0da7 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Thu, 6 Jul 2017 22:13:48 +0000 Subject: chore(package): update webpack to version 3.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ced8071a3..e8106b748 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "typescript": "^2.3.3", "web3-provider-engine": "^13.0.1", "web3-typescript-typings": "^0.0.10", - "webpack": "^2.6.0" + "webpack": "^3.1.0" }, "dependencies": { "bignumber.js": "^4.0.2", -- cgit v1.2.3 From 198cd364db9b87a5011622411b8decebadc6bdd0 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 4 Jul 2017 23:25:47 -0700 Subject: Paralellize fill scenarios --- test/utils/fill_scenarios.ts | 60 ++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/test/utils/fill_scenarios.ts b/test/utils/fill_scenarios.ts index 65a912955..439f22f9f 100644 --- a/test/utils/fill_scenarios.ts +++ b/test/utils/fill_scenarios.ts @@ -71,37 +71,15 @@ export class FillScenarios { makerAddress: string, takerAddress: string, makerFillableAmount: BigNumber.BigNumber, takerFillableAmount: BigNumber.BigNumber, feeRecepient: string, expirationUnixTimestampSec?: BigNumber.BigNumber): Promise { - await this.zeroEx.token.transferAsync(makerTokenAddress, this.coinbase, makerAddress, makerFillableAmount); - const oldMakerAllowance = await this.zeroEx.token.getProxyAllowanceAsync(makerTokenAddress, makerAddress); - const newMakerAllowance = oldMakerAllowance.plus(makerFillableAmount); - await this.zeroEx.token.setProxyAllowanceAsync( - makerTokenAddress, makerAddress, newMakerAllowance, - ); - await this.zeroEx.token.transferAsync(takerTokenAddress, this.coinbase, takerAddress, takerFillableAmount); - const oldTakerAllowance = await this.zeroEx.token.getProxyAllowanceAsync(takerTokenAddress, takerAddress); - const newTakerAllowance = oldTakerAllowance.plus(takerFillableAmount); - await this.zeroEx.token.setProxyAllowanceAsync( - takerTokenAddress, takerAddress, newTakerAllowance, - ); - if (!makerFee.isZero()) { - await this.zeroEx.token.transferAsync(this.zrxTokenAddress, this.coinbase, makerAddress, makerFee); - const oldMakerFeeAllowance = - await this.zeroEx.token.getProxyAllowanceAsync(this.zrxTokenAddress, makerAddress); - const newMakerFeeAllowance = oldMakerFeeAllowance.plus(makerFee); - await this.zeroEx.token.setProxyAllowanceAsync( - this.zrxTokenAddress, makerAddress, newMakerFeeAllowance, - ); - } - if (!takerFee.isZero()) { - await this.zeroEx.token.transferAsync(this.zrxTokenAddress, this.coinbase, takerAddress, takerFee); - const oldTakerFeeAllowance = - await this.zeroEx.token.getProxyAllowanceAsync(this.zrxTokenAddress, takerAddress); - const newTakerFeeAllowance = oldTakerFeeAllowance.plus(takerFee); - await this.zeroEx.token.setProxyAllowanceAsync( - this.zrxTokenAddress, takerAddress, newTakerFeeAllowance, - ); - } + await Promise.all([ + this.increaseBalanceAndAllowanceAsync(makerTokenAddress, makerAddress, makerFillableAmount), + this.increaseBalanceAndAllowanceAsync(takerTokenAddress, takerAddress, takerFillableAmount), + ]); + await Promise.all([ + this.increaseBalanceAndAllowanceAsync(this.zrxTokenAddress, makerAddress, makerFee), + this.increaseBalanceAndAllowanceAsync(this.zrxTokenAddress, takerAddress, takerFee), + ]); const signedOrder = await orderFactory.createSignedOrderAsync(this.zeroEx, makerAddress, takerAddress, makerFee, takerFee, @@ -109,4 +87,26 @@ export class FillScenarios { this.exchangeContractAddress, feeRecepient, expirationUnixTimestampSec); return signedOrder; } + private async increaseBalanceAndAllowanceAsync( + tokenAddress: string, address: string, amount: BigNumber.BigNumber): Promise { + if (amount.isZero()) { + return; + } + await Promise.all([ + this.increaseBalanceAsync(tokenAddress, address, amount), + this.increaseAllowanceAsync(tokenAddress, address, amount), + ]); + } + private async increaseBalanceAsync( + tokenAddress: string, address: string, amount: BigNumber.BigNumber): Promise { + await this.zeroEx.token.transferAsync(tokenAddress, this.coinbase, address, amount); + } + private async increaseAllowanceAsync( + tokenAddress: string, address: string, amount: BigNumber.BigNumber): Promise { + const oldMakerAllowance = await this.zeroEx.token.getProxyAllowanceAsync(tokenAddress, address); + const newMakerAllowance = oldMakerAllowance.plus(amount); + await this.zeroEx.token.setProxyAllowanceAsync( + tokenAddress, address, newMakerAllowance, + ); + } } -- cgit v1.2.3 From c0a90fe84e0a71ef927715b57a9e38ee3b875445 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 7 Jul 2017 10:31:02 -0700 Subject: Rename batchFillOrderAsync to batchFillOrdersAsync --- src/contract_wrappers/exchange_wrapper.ts | 4 ++-- test/exchange_wrapper_test.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 2353c826a..000258241 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -297,8 +297,8 @@ export class ExchangeWrapper extends ContractWrapper { * Must be available via the supplied Web3.Provider passed to 0x.js. */ @decorators.contractCallErrorHandler - public async batchFillOrderAsync(orderFillRequests: OrderFillRequest[], - shouldCheckTransfer: boolean, takerAddress: string): Promise { + public async batchFillOrdersAsync(orderFillRequests: OrderFillRequest[], + shouldCheckTransfer: boolean, takerAddress: string): Promise { assert.doesConformToSchema('orderFillRequests', orderFillRequests, orderFillRequestsSchema); const exchangeContractAddresses = _.map( orderFillRequests, diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index 45da44f54..9b05c3f5a 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -386,7 +386,7 @@ describe('ExchangeWrapper', () => { }); }); }); - describe('#batchFillOrderAsync', () => { + describe('#batchFillOrdersAsync', () => { let signedOrder: SignedOrder; let signedOrderHashHex: string; let anotherSignedOrder: SignedOrder; @@ -414,10 +414,10 @@ describe('ExchangeWrapper', () => { }); describe('successful batch fills', () => { it('should no-op for an empty batch', async () => { - await zeroEx.exchange.batchFillOrderAsync([], shouldCheckTransfer, takerAddress); + await zeroEx.exchange.batchFillOrdersAsync([], shouldCheckTransfer, takerAddress); }); it('should successfully fill multiple orders', async () => { - await zeroEx.exchange.batchFillOrderAsync(orderFillBatch, shouldCheckTransfer, takerAddress); + await zeroEx.exchange.batchFillOrdersAsync(orderFillBatch, shouldCheckTransfer, takerAddress); const filledAmount = await zeroEx.exchange.getFilledTakerAmountAsync( signedOrderHashHex, exchangeContractAddress, ); -- cgit v1.2.3 From 96596b1c2baa384a0cd97343dab3c280cba6898c Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 7 Jul 2017 10:31:22 -0700 Subject: Rename batchCancelOrderAsync to batchCancelOrdersAsync --- src/contract_wrappers/exchange_wrapper.ts | 2 +- test/exchange_wrapper_test.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 000258241..fa4b5904b 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -520,7 +520,7 @@ export class ExchangeWrapper extends ContractWrapper { * interface. */ @decorators.contractCallErrorHandler - public async batchCancelOrderAsync(orderCancellationRequests: OrderCancellationRequest[]): Promise { + public async batchCancelOrdersAsync(orderCancellationRequests: OrderCancellationRequest[]): Promise { assert.doesConformToSchema('orderCancellationRequests', orderCancellationRequests, orderCancellationRequestsSchema); const exchangeContractAddresses = _.map( diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index 9b05c3f5a..cd3b82708 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -531,7 +531,7 @@ describe('ExchangeWrapper', () => { }); }); }); - describe('#batchCancelOrderAsync', () => { + describe('#batchCancelOrdersAsync', () => { let anotherSignedOrder: SignedOrder; let anotherOrderHashHex: string; let cancelBatch: OrderCancellationRequest[]; @@ -556,7 +556,7 @@ describe('ExchangeWrapper', () => { const signedOrderWithDifferentMaker = await fillScenarios.createFillableSignedOrderAsync( makerTokenAddress, takerTokenAddress, takerAddress, takerAddress, fillableAmount, ); - return expect(zeroEx.exchange.batchCancelOrderAsync([ + return expect(zeroEx.exchange.batchCancelOrdersAsync([ cancelBatch[0], { order: signedOrderWithDifferentMaker, @@ -567,7 +567,7 @@ describe('ExchangeWrapper', () => { }); describe('successful batch cancels', () => { it('should cancel a batch of orders', async () => { - await zeroEx.exchange.batchCancelOrderAsync(cancelBatch); + await zeroEx.exchange.batchCancelOrdersAsync(cancelBatch); const cancelledAmount = await zeroEx.exchange.getCanceledTakerAmountAsync( orderHashHex, exchangeContractAddress, ); -- cgit v1.2.3 From b46d7f9ccae98d1d39d27a6119d0bee502b88616 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 7 Jul 2017 10:56:47 -0700 Subject: Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fdabfd92..16abcc0e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ v0.9.0 - TBD ------------------------ * Move `zeroEx.exchange.getAvailableContractAddressesAsync` to `zeroEx.getAvailableExchangeContractAddressesAsync` (#94) * Move `zeroEx.exchange.getProxyAuthorizedContractAddressesAsync` to `zeroEx.getProxyAuthorizedExchangeContractAddressesAsync` (#94) + * Rename `zeroEx.exchange.batchCancelOrderAsync` to `zeroEx.exchange.batchCancelOrdersAsync` + * Rename `zeroEx.exchange.batchFillOrderAsync` to `zeroEx.exchange.batchFillOrdersAsync` v0.8.0 - _Jul. 4, 2017_ ------------------------ -- cgit v1.2.3 From 014a4585259c6ec5709e320c8ce7ab542feba3d4 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Fri, 7 Jul 2017 18:10:54 +0000 Subject: chore(package): update web3-typescript-typings to version 0.0.11 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e8106b748..0ac014e76 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "typedoc": "^0.7.1", "typescript": "^2.3.3", "web3-provider-engine": "^13.0.1", - "web3-typescript-typings": "^0.0.10", + "web3-typescript-typings": "^0.0.11", "webpack": "^3.1.0" }, "dependencies": { -- cgit v1.2.3 From e9509b4ff372f001ad343185f160d452f8f1af7a Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 7 Jul 2017 11:50:23 -0700 Subject: Remove space after `it` keywork in tests --- test/0x.js_test.ts | 6 +++--- test/exchange_wrapper_test.ts | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/test/0x.js_test.ts b/test/0x.js_test.ts index 0d8d63985..f25f104bd 100644 --- a/test/0x.js_test.ts +++ b/test/0x.js_test.ts @@ -163,7 +163,7 @@ describe('ZeroEx library', () => { _.each(stubs, s => s.restore()); stubs = []; }); - it ('Should return the correct ECSignature on TestPRC nodeVersion', async () => { + it('Should return the correct ECSignature on TestPRC nodeVersion', async () => { const orderHash = '0x6927e990021d23b1eb7b8789f6a6feaf98fe104bb0cf8259421b79f9a34222b0'; const expectedECSignature = { v: 27, @@ -173,7 +173,7 @@ describe('ZeroEx library', () => { const ecSignature = await zeroEx.signOrderHashAsync(orderHash, makerAddress); expect(ecSignature).to.deep.equal(expectedECSignature); }); - it ('should return the correct ECSignature on Parity > V1.6.6', async () => { + it('should return the correct ECSignature on Parity > V1.6.6', async () => { const newParityNodeVersion = 'Parity//v1.6.7-beta-e128418-20170518/x86_64-macos/rustc1.17.0'; const orderHash = '0x34decbedc118904df65f379a175bb39ca18209d6ce41d5ed549d54e6e0a95004'; // tslint:disable-next-line: max-line-length @@ -194,7 +194,7 @@ describe('ZeroEx library', () => { const ecSignature = await zeroEx.signOrderHashAsync(orderHash, makerAddress); expect(ecSignature).to.deep.equal(expectedECSignature); }); - it ('should return the correct ECSignature on Parity < V1.6.6', async () => { + it('should return the correct ECSignature on Parity < V1.6.6', async () => { const newParityNodeVersion = 'Parity//v1.6.6-beta-8c6e3f3-20170411/x86_64-macos/rustc1.16.0'; const orderHash = '0xc793e33ffded933b76f2f48d9aa3339fc090399d5e7f5dec8d3660f5480793f7'; // tslint:disable-next-line: max-line-length diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index 45da44f54..51ebd485d 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -603,19 +603,19 @@ describe('ExchangeWrapper', () => { orderHash = zeroEx.getOrderHashHex(signedOrder); }); describe('#getUnavailableTakerAmountAsync', () => { - it ('should throw if passed an invalid orderHash', async () => { + it('should throw if passed an invalid orderHash', async () => { const invalidOrderHashHex = '0x123'; return expect(zeroEx.exchange.getUnavailableTakerAmountAsync( invalidOrderHashHex, exchangeContractAddress, )).to.be.rejected(); }); - it ('should return zero if passed a valid but non-existent orderHash', async () => { + it('should return zero if passed a valid but non-existent orderHash', async () => { const unavailableValueT = await zeroEx.exchange.getUnavailableTakerAmountAsync( NON_EXISTENT_ORDER_HASH, exchangeContractAddress, ); expect(unavailableValueT).to.be.bignumber.equal(0); }); - it ('should return the unavailableValueT for a valid and partially filled orderHash', async () => { + it('should return the unavailableValueT for a valid and partially filled orderHash', async () => { const unavailableValueT = await zeroEx.exchange.getUnavailableTakerAmountAsync( orderHash, exchangeContractAddress, ); @@ -623,19 +623,19 @@ describe('ExchangeWrapper', () => { }); }); describe('#getFilledTakerAmountAsync', () => { - it ('should throw if passed an invalid orderHash', async () => { + it('should throw if passed an invalid orderHash', async () => { const invalidOrderHashHex = '0x123'; return expect(zeroEx.exchange.getFilledTakerAmountAsync( invalidOrderHashHex, exchangeContractAddress, )).to.be.rejected(); }); - it ('should return zero if passed a valid but non-existent orderHash', async () => { + it('should return zero if passed a valid but non-existent orderHash', async () => { const filledValueT = await zeroEx.exchange.getFilledTakerAmountAsync( NON_EXISTENT_ORDER_HASH, exchangeContractAddress, ); expect(filledValueT).to.be.bignumber.equal(0); }); - it ('should return the filledValueT for a valid and partially filled orderHash', async () => { + it('should return the filledValueT for a valid and partially filled orderHash', async () => { const filledValueT = await zeroEx.exchange.getFilledTakerAmountAsync( orderHash, exchangeContractAddress, ); @@ -643,25 +643,25 @@ describe('ExchangeWrapper', () => { }); }); describe('#getCanceledTakerAmountAsync', () => { - it ('should throw if passed an invalid orderHash', async () => { + it('should throw if passed an invalid orderHash', async () => { const invalidOrderHashHex = '0x123'; return expect(zeroEx.exchange.getCanceledTakerAmountAsync( invalidOrderHashHex, exchangeContractAddress, )).to.be.rejected(); }); - it ('should return zero if passed a valid but non-existent orderHash', async () => { + it('should return zero if passed a valid but non-existent orderHash', async () => { const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync( NON_EXISTENT_ORDER_HASH, exchangeContractAddress, ); expect(cancelledValueT).to.be.bignumber.equal(0); }); - it ('should return the cancelledValueT for a valid and partially filled orderHash', async () => { + it('should return the cancelledValueT for a valid and partially filled orderHash', async () => { const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync( orderHash, exchangeContractAddress, ); expect(cancelledValueT).to.be.bignumber.equal(0); }); - it ('should return the cancelledValueT for a valid and cancelled orderHash', async () => { + 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( -- cgit v1.2.3 From 23f32b6bbafdf4adc75d32f2438ef8917e792cfb Mon Sep 17 00:00:00 2001 From: Leonid Date: Fri, 7 Jul 2017 14:07:26 -0700 Subject: Add noop comment --- test/utils/fill_scenarios.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/utils/fill_scenarios.ts b/test/utils/fill_scenarios.ts index 439f22f9f..bebf82fd8 100644 --- a/test/utils/fill_scenarios.ts +++ b/test/utils/fill_scenarios.ts @@ -90,7 +90,7 @@ export class FillScenarios { private async increaseBalanceAndAllowanceAsync( tokenAddress: string, address: string, amount: BigNumber.BigNumber): Promise { if (amount.isZero()) { - return; + return; // noop } await Promise.all([ this.increaseBalanceAsync(tokenAddress, address, amount), -- cgit v1.2.3