aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/utils/erc20_wrapper.ts
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-05-25 06:33:56 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-05-25 06:39:19 +0800
commit237ebb07161c46fa85ca778a1c2ff60f63611bd7 (patch)
tree67deae8c77054c06435521b05016fda3ac63e780 /packages/contracts/src/utils/erc20_wrapper.ts
parentfdea260e41111f3d27c05ab2d2523d2473c1ac05 (diff)
downloaddexon-0x-contracts-237ebb07161c46fa85ca778a1c2ff60f63611bd7.tar.gz
dexon-0x-contracts-237ebb07161c46fa85ca778a1c2ff60f63611bd7.tar.zst
dexon-0x-contracts-237ebb07161c46fa85ca778a1c2ff60f63611bd7.zip
Use web3-wrapper instead of 0x.js, update logDecoder
Diffstat (limited to 'packages/contracts/src/utils/erc20_wrapper.ts')
-rw-r--r--packages/contracts/src/utils/erc20_wrapper.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/contracts/src/utils/erc20_wrapper.ts b/packages/contracts/src/utils/erc20_wrapper.ts
index 0303649a5..92cf01cc2 100644
--- a/packages/contracts/src/utils/erc20_wrapper.ts
+++ b/packages/contracts/src/utils/erc20_wrapper.ts
@@ -1,5 +1,6 @@
import { Provider } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import { DummyERC20TokenContract } from '../contract_wrappers/generated/dummy_e_r_c20_token';
@@ -13,10 +14,12 @@ import { txDefaults } from './web3_wrapper';
export class ERC20Wrapper {
private _tokenOwnerAddresses: string[];
private _contractOwnerAddress: string;
+ private _web3Wrapper: Web3Wrapper;
private _provider: Provider;
private _dummyTokenContracts?: DummyERC20TokenContract[];
private _proxyContract?: ERC20ProxyContract;
constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
+ this._web3Wrapper = new Web3Wrapper(provider);
this._provider = provider;
this._tokenOwnerAddresses = tokenOwnerAddresses;
this._contractOwnerAddress = contractOwnerAddress;
@@ -68,7 +71,8 @@ export class ERC20Wrapper {
);
});
});
- await Promise.all([...setBalancePromises, ...setAllowancePromises]);
+ const txHashes = await Promise.all([...setBalancePromises, ...setAllowancePromises]);
+ await Promise.all(_.map(txHashes, async txHash => this._web3Wrapper.awaitTransactionSuccessAsync(txHash)));
}
public async getBalancesAsync(): Promise<ERC20BalancesByOwner> {
this._validateDummyTokenContractsExistOrThrow();