aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contract-wrappers')
-rw-r--r--packages/contract-wrappers/test/erc20_wrapper_test.ts8
-rw-r--r--packages/contract-wrappers/test/erc721_wrapper_test.ts29
-rw-r--r--packages/contract-wrappers/test/ether_token_wrapper_test.ts12
-rw-r--r--packages/contract-wrappers/test/utils/constants.ts1
4 files changed, 28 insertions, 22 deletions
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<ERC20TokenApprovalEventArgs>(
@@ -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<ERC721TokenApprovalForAllEventArgs>(
@@ -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<WETH9ApprovalEventArgs>(
@@ -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,