From 2b547f94a44dfed029b5559b743344d5998fa3bc Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 5 Sep 2017 10:07:16 +0200 Subject: Change non-exhange contracts to also return txHash --- test/ether_token_wrapper_test.ts | 6 ++++-- test/exchange_wrapper_test.ts | 8 ++++---- test/token_wrapper_test.ts | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/ether_token_wrapper_test.ts b/test/ether_token_wrapper_test.ts index 601800cd1..f50aac48b 100644 --- a/test/ether_token_wrapper_test.ts +++ b/test/ether_token_wrapper_test.ts @@ -52,7 +52,8 @@ describe('EtherTokenWrapper', () => { expect(preETHBalance).to.be.bignumber.gt(0); expect(preWETHBalance).to.be.bignumber.equal(0); - await zeroEx.etherToken.depositAsync(depositWeiAmount, addressWithETH); + const txHash = await zeroEx.etherToken.depositAsync(depositWeiAmount, addressWithETH); + await zeroEx.awaitTransactionMinedAsync(txHash); const postETHBalanceInWei = await (zeroEx as any)._web3Wrapper.getBalanceInWeiAsync(addressWithETH); const postWETHBalanceInBaseUnits = await zeroEx.token.getBalanceAsync(wethContractAddress, addressWithETH); @@ -86,7 +87,8 @@ describe('EtherTokenWrapper', () => { expect(gasCost).to.be.bignumber.lte(MAX_REASONABLE_GAS_COST_IN_WEI); expect(preWETHBalance).to.be.bignumber.equal(depositWeiAmount); - await zeroEx.etherToken.withdrawAsync(depositWeiAmount, addressWithETH); + const txHash = await zeroEx.etherToken.withdrawAsync(depositWeiAmount, addressWithETH); + await zeroEx.awaitTransactionMinedAsync(txHash); const postETHBalance = await (zeroEx as any)._web3Wrapper.getBalanceInWeiAsync(addressWithETH); const postWETHBalanceInBaseUnits = await zeroEx.token.getBalanceAsync(wethContractAddress, addressWithETH); diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index 99e61a751..990a4dca6 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -205,7 +205,7 @@ describe('ExchangeWrapper', () => { ); const txHash = await zeroEx.exchange.fillOrderAsync( signedOrder, fillTakerAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress); - await zeroEx.awaitTransactionMined(txHash); + await zeroEx.awaitTransactionMinedAsync(txHash); expect(await zeroEx.token.getBalanceAsync(zrxTokenAddress, feeRecipient)) .to.be.bignumber.equal(makerFee.plus(takerFee)); }); @@ -246,7 +246,7 @@ describe('ExchangeWrapper', () => { it('should successfully fill multiple orders', async () => { const txHash = await zeroEx.exchange.batchFillOrdersAsync( orderFillBatch, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress); - await zeroEx.awaitTransactionMined(txHash); + await zeroEx.awaitTransactionMinedAsync(txHash); const filledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(signedOrderHashHex); const anotherFilledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(anotherOrderHashHex); expect(filledAmount).to.be.bignumber.equal(fillTakerAmount); @@ -282,7 +282,7 @@ describe('ExchangeWrapper', () => { const txHash = await zeroEx.exchange.fillOrdersUpToAsync( signedOrders, fillUpToAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, ); - await zeroEx.awaitTransactionMined(txHash); + await zeroEx.awaitTransactionMinedAsync(txHash); const filledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(signedOrderHashHex); const anotherFilledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(anotherOrderHashHex); expect(filledAmount).to.be.bignumber.equal(fillableAmount); @@ -316,7 +316,7 @@ describe('ExchangeWrapper', () => { describe('successful cancels', () => { it('should cancel an order', async () => { const txHash = await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelAmount); - await zeroEx.awaitTransactionMined(txHash); + await zeroEx.awaitTransactionMinedAsync(txHash); const cancelledAmount = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHashHex); expect(cancelledAmount).to.be.bignumber.equal(cancelAmount); }); diff --git a/test/token_wrapper_test.ts b/test/token_wrapper_test.ts index e4223ffc7..68dca0769 100644 --- a/test/token_wrapper_test.ts +++ b/test/token_wrapper_test.ts @@ -58,7 +58,8 @@ describe('TokenWrapper', () => { const toAddress = addressWithoutFunds; const preBalance = await zeroEx.token.getBalanceAsync(token.address, toAddress); expect(preBalance).to.be.bignumber.equal(0); - await zeroEx.token.transferAsync(token.address, fromAddress, toAddress, transferAmount); + const txHash = await zeroEx.token.transferAsync(token.address, fromAddress, toAddress, transferAmount); + await zeroEx.awaitTransactionMinedAsync(txHash); const postBalance = await zeroEx.token.getBalanceAsync(token.address, toAddress); return expect(postBalance).to.be.bignumber.equal(transferAmount); }); -- cgit v1.2.3