From 5dea432ebf27cf35cb85823c8f7fdc81fe8ae4f6 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 29 Jun 2018 16:41:58 +0300 Subject: Set the interval to 0 in awaitTranscationSuccessAsync --- .../contract-wrappers/test/erc20_wrapper_test.ts | 8 +++--- .../contract-wrappers/test/erc721_wrapper_test.ts | 29 +++++++++++++--------- .../test/ether_token_wrapper_test.ts | 12 ++++----- packages/contract-wrappers/test/utils/constants.ts | 1 + .../artifacts/2.0.0/AssetProxyOwner.json | 10 ++++++-- .../migrations/artifacts/2.0.0/ERC20Proxy.json | 10 ++++++-- .../migrations/artifacts/2.0.0/ERC721Proxy.json | 10 ++++++-- packages/migrations/artifacts/2.0.0/Exchange.json | 10 ++++++-- packages/migrations/artifacts/2.0.0/WETH9.json | 10 ++++++-- packages/migrations/artifacts/2.0.0/ZRXToken.json | 10 ++++++-- 10 files changed, 76 insertions(+), 34 deletions(-) (limited to 'packages') diff --git a/packages/contract-wrappers/test/erc20_wrapper_test.ts b/packages/contract-wrappers/test/erc20_wrapper_test.ts index 6539a0cbf..dd15a9b82 100644 --- a/packages/contract-wrappers/test/erc20_wrapper_test.ts +++ b/packages/contract-wrappers/test/erc20_wrapper_test.ts @@ -592,7 +592,7 @@ describe('ERC20Wrapper', () => { }); it('should get logs with decoded args emitted by Approval', async () => { txHash = await contractWrappers.erc20Token.setUnlimitedProxyAllowanceAsync(tokenAddress, coinbase); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const eventName = ERC20TokenEvents.Approval; const indexFilterValues = {}; const logs = await contractWrappers.erc20Token.getLogsAsync( @@ -610,7 +610,7 @@ describe('ERC20Wrapper', () => { }); it('should only get the logs with the correct event name', async () => { txHash = await contractWrappers.erc20Token.setUnlimitedProxyAllowanceAsync(tokenAddress, coinbase); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const differentEventName = ERC20TokenEvents.Transfer; const indexFilterValues = {}; const logs = await contractWrappers.erc20Token.getLogsAsync( @@ -623,12 +623,12 @@ describe('ERC20Wrapper', () => { }); it('should only get the logs with the correct indexed fields', async () => { txHash = await contractWrappers.erc20Token.setUnlimitedProxyAllowanceAsync(tokenAddress, coinbase); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); txHash = await contractWrappers.erc20Token.setUnlimitedProxyAllowanceAsync( tokenAddress, addressWithoutFunds, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const eventName = ERC20TokenEvents.Approval; const indexFilterValues = { _owner: coinbase, diff --git a/packages/contract-wrappers/test/erc721_wrapper_test.ts b/packages/contract-wrappers/test/erc721_wrapper_test.ts index 7d976c210..78bad2915 100644 --- a/packages/contract-wrappers/test/erc721_wrapper_test.ts +++ b/packages/contract-wrappers/test/erc721_wrapper_test.ts @@ -64,7 +64,7 @@ describe('ERC721Wrapper', () => { it('should successfully transfer tokens when sender is an approved address', async () => { const tokenId = await tokenUtils.mintDummyERC721Async(tokenAddress, ownerAddress); let txHash = await contractWrappers.erc721Token.setApprovalAsync(tokenAddress, approvedAddress, tokenId); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const owner = await contractWrappers.erc721Token.getOwnerOfAsync(tokenAddress, tokenId); expect(owner).to.be.equal(ownerAddress); txHash = await contractWrappers.erc721Token.transferFromAsync( @@ -73,7 +73,7 @@ describe('ERC721Wrapper', () => { approvedAddress, tokenId, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const newOwner = await contractWrappers.erc721Token.getOwnerOfAsync(tokenAddress, tokenId); expect(newOwner).to.be.equal(receiverAddress); }); @@ -86,7 +86,7 @@ describe('ERC721Wrapper', () => { operatorAddress, isApprovedForAll, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const owner = await contractWrappers.erc721Token.getOwnerOfAsync(tokenAddress, tokenId); expect(owner).to.be.equal(ownerAddress); txHash = await contractWrappers.erc721Token.transferFromAsync( @@ -95,7 +95,7 @@ describe('ERC721Wrapper', () => { operatorAddress, tokenId, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const newOwner = await contractWrappers.erc721Token.getOwnerOfAsync(tokenAddress, tokenId); expect(newOwner).to.be.equal(receiverAddress); }); @@ -172,7 +172,7 @@ describe('ERC721Wrapper', () => { operatorAddress, true, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); isApprovedForAll = await contractWrappers.erc721Token.isApprovedForAllAsync( tokenAddress, ownerAddress, @@ -186,7 +186,7 @@ describe('ERC721Wrapper', () => { operatorAddress, false, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); isApprovedForAll = await contractWrappers.erc721Token.isApprovedForAllAsync( tokenAddress, ownerAddress, @@ -202,7 +202,7 @@ describe('ERC721Wrapper', () => { ownerAddress, true, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const isApprovedForAll = await contractWrappers.erc721Token.isProxyApprovedForAllAsync( tokenAddress, ownerAddress, @@ -268,6 +268,7 @@ describe('ERC721Wrapper', () => { operatorAddress, isApprovedForAll, ), + constants.AWAIT_TRANSACTION_MINED_MS, ); contractWrappers.erc721Token.subscribe( tokenAddress, @@ -282,6 +283,7 @@ describe('ERC721Wrapper', () => { operatorAddress, tokenId, ), + constants.AWAIT_TRANSACTION_MINED_MS, ); })().catch(done); }); @@ -306,6 +308,7 @@ describe('ERC721Wrapper', () => { const tokenId = await tokenUtils.mintDummyERC721Async(tokenAddress, ownerAddress); await web3Wrapper.awaitTransactionSuccessAsync( await contractWrappers.erc721Token.setApprovalAsync(tokenAddress, approvedAddress, tokenId), + constants.AWAIT_TRANSACTION_MINED_MS, ); })().catch(done); }); @@ -333,6 +336,7 @@ describe('ERC721Wrapper', () => { const tokenId = await tokenUtils.mintDummyERC721Async(tokenAddress, ownerAddress); await web3Wrapper.awaitTransactionSuccessAsync( await contractWrappers.erc721Token.setApprovalAsync(tokenAddress, approvedAddress, tokenId), + constants.AWAIT_TRANSACTION_MINED_MS, ); done(); })().catch(done); @@ -361,6 +365,7 @@ describe('ERC721Wrapper', () => { operatorAddress, isApproved, ), + constants.AWAIT_TRANSACTION_MINED_MS, ); done(); })().catch(done); @@ -383,7 +388,7 @@ describe('ERC721Wrapper', () => { operatorAddress, true, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const eventName = ERC721TokenEvents.ApprovalForAll; const indexFilterValues = {}; const logs = await contractWrappers.erc721Token.getLogsAsync( @@ -406,7 +411,7 @@ describe('ERC721Wrapper', () => { operatorAddress, true, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const differentEventName = ERC721TokenEvents.Transfer; const indexFilterValues = {}; const logs = await contractWrappers.erc721Token.getLogsAsync( @@ -417,21 +422,21 @@ describe('ERC721Wrapper', () => { ); expect(logs).to.have.length(0); }); - it('should only get the logs with the correct indexed fields', async () => { + it.only('should only get the logs with the correct indexed fields', async () => { txHash = await contractWrappers.erc721Token.setApprovalForAllAsync( tokenAddress, ownerAddress, operatorAddress, true, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); txHash = await contractWrappers.erc721Token.setApprovalForAllAsync( tokenAddress, anotherOwnerAddress, operatorAddress, true, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const eventName = ERC721TokenEvents.ApprovalForAll; const indexFilterValues = { _owner: anotherOwnerAddress, diff --git a/packages/contract-wrappers/test/ether_token_wrapper_test.ts b/packages/contract-wrappers/test/ether_token_wrapper_test.ts index 1e46f05d1..373d4e935 100644 --- a/packages/contract-wrappers/test/ether_token_wrapper_test.ts +++ b/packages/contract-wrappers/test/ether_token_wrapper_test.ts @@ -94,7 +94,7 @@ describe('EtherTokenWrapper', () => { depositWeiAmount, addressWithETH, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const postETHBalanceInWei = await web3Wrapper.getBalanceInWeiAsync(addressWithETH); const postWETHBalanceInBaseUnits = await contractWrappers.erc20Token.getBalanceAsync( @@ -139,7 +139,7 @@ describe('EtherTokenWrapper', () => { depositWeiAmount, addressWithETH, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const postETHBalance = await web3Wrapper.getBalanceInWeiAsync(addressWithETH); const postWETHBalanceInBaseUnits = await contractWrappers.erc20Token.getBalanceAsync( @@ -351,7 +351,7 @@ describe('EtherTokenWrapper', () => { etherTokenAddress, addressWithETH, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const eventName = WETH9Events.Approval; const indexFilterValues = {}; const logs = await contractWrappers.etherToken.getLogsAsync( @@ -388,7 +388,7 @@ describe('EtherTokenWrapper', () => { etherTokenAddress, addressWithETH, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const differentEventName = WETH9Events.Transfer; const indexFilterValues = {}; const logs = await contractWrappers.etherToken.getLogsAsync( @@ -404,12 +404,12 @@ describe('EtherTokenWrapper', () => { etherTokenAddress, addressWithETH, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); txHash = await contractWrappers.erc20Token.setUnlimitedProxyAllowanceAsync( etherTokenAddress, addressWithoutFunds, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const eventName = WETH9Events.Approval; const indexFilterValues = { _owner: addressWithETH, diff --git a/packages/contract-wrappers/test/utils/constants.ts b/packages/contract-wrappers/test/utils/constants.ts index 62d5a1ade..60c3370a2 100644 --- a/packages/contract-wrappers/test/utils/constants.ts +++ b/packages/contract-wrappers/test/utils/constants.ts @@ -5,6 +5,7 @@ export const constants = { ROPSTEN_NETWORK_ID: 3, KOVAN_NETWORK_ID: 42, TESTRPC_NETWORK_ID: 50, + AWAIT_TRANSACTION_MINED_MS: 0, KOVAN_RPC_URL: 'https://kovan.infura.io/', ROPSTEN_RPC_URL: 'https://ropsten.infura.io/', ZRX_DECIMALS: 18, diff --git a/packages/migrations/artifacts/2.0.0/AssetProxyOwner.json b/packages/migrations/artifacts/2.0.0/AssetProxyOwner.json index f4df25b8b..b16cc2906 100644 --- a/packages/migrations/artifacts/2.0.0/AssetProxyOwner.json +++ b/packages/migrations/artifacts/2.0.0/AssetProxyOwner.json @@ -744,5 +744,11 @@ } } }, - "networks": {} -} + "networks": { + "50": { + "address": "0x34d402f14d58e001d8efbe6585051bf9706aa064", + "links": {}, + "constructorArgs": "[[\"0x5409ed021d9299bf6814279a6a1411a7e866a631\",\"0x6ecbe1db9ef729cbe972c83fb886247691fb6beb\"],[\"0x1dc4c1cefef38a777b15aa20260a54e584b16c48\",\"0x1d7022f5b17d2f8b695918fb48fa1089c9f85401\"],\"2\",\"0\"]" + } + } +} \ No newline at end of file diff --git a/packages/migrations/artifacts/2.0.0/ERC20Proxy.json b/packages/migrations/artifacts/2.0.0/ERC20Proxy.json index ef8b0c92a..480db5f62 100644 --- a/packages/migrations/artifacts/2.0.0/ERC20Proxy.json +++ b/packages/migrations/artifacts/2.0.0/ERC20Proxy.json @@ -277,5 +277,11 @@ } } }, - "networks": {} -} + "networks": { + "50": { + "address": "0x1dc4c1cefef38a777b15aa20260a54e584b16c48", + "links": {}, + "constructorArgs": "[]" + } + } +} \ No newline at end of file diff --git a/packages/migrations/artifacts/2.0.0/ERC721Proxy.json b/packages/migrations/artifacts/2.0.0/ERC721Proxy.json index d1b2a708c..650483850 100644 --- a/packages/migrations/artifacts/2.0.0/ERC721Proxy.json +++ b/packages/migrations/artifacts/2.0.0/ERC721Proxy.json @@ -277,5 +277,11 @@ } } }, - "networks": {} -} + "networks": { + "50": { + "address": "0x1d7022f5b17d2f8b695918fb48fa1089c9f85401", + "links": {}, + "constructorArgs": "[]" + } + } +} \ No newline at end of file diff --git a/packages/migrations/artifacts/2.0.0/Exchange.json b/packages/migrations/artifacts/2.0.0/Exchange.json index a1c0c7971..007b610b7 100644 --- a/packages/migrations/artifacts/2.0.0/Exchange.json +++ b/packages/migrations/artifacts/2.0.0/Exchange.json @@ -2078,5 +2078,11 @@ } } }, - "networks": {} -} + "networks": { + "50": { + "address": "0x48bacb9266a570d521063ef5dd96e61686dbe788", + "links": {}, + "constructorArgs": "[\"0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c\"]" + } + } +} \ No newline at end of file diff --git a/packages/migrations/artifacts/2.0.0/WETH9.json b/packages/migrations/artifacts/2.0.0/WETH9.json index 0e2b819e6..7268f3e1b 100644 --- a/packages/migrations/artifacts/2.0.0/WETH9.json +++ b/packages/migrations/artifacts/2.0.0/WETH9.json @@ -326,5 +326,11 @@ } } }, - "networks": {} -} + "networks": { + "50": { + "address": "0x0b1ba0af832d7c05fd64161e0db78e85978e8082", + "links": {}, + "constructorArgs": "[]" + } + } +} \ No newline at end of file diff --git a/packages/migrations/artifacts/2.0.0/ZRXToken.json b/packages/migrations/artifacts/2.0.0/ZRXToken.json index cad596044..20797771c 100644 --- a/packages/migrations/artifacts/2.0.0/ZRXToken.json +++ b/packages/migrations/artifacts/2.0.0/ZRXToken.json @@ -282,5 +282,11 @@ } } }, - "networks": {} -} + "networks": { + "50": { + "address": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c", + "links": {}, + "constructorArgs": "[]" + } + } +} \ No newline at end of file -- cgit