aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-05-31 08:54:12 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-05-31 13:27:07 +0800
commita6d669453f9af7993bdd132862fa5d2da18a62f7 (patch)
treed1055e37ec01349334768f2fa843b67e02c74881 /packages
parent064608a8ef5c332e09fefaadd3b4c1155d4853c9 (diff)
downloaddexon-sol-tools-a6d669453f9af7993bdd132862fa5d2da18a62f7.tar.gz
dexon-sol-tools-a6d669453f9af7993bdd132862fa5d2da18a62f7.tar.zst
dexon-sol-tools-a6d669453f9af7993bdd132862fa5d2da18a62f7.zip
Pass in a provider and instantiate a new web3Wrapper in token_registry_wrapper
Diffstat (limited to 'packages')
-rw-r--r--packages/contracts/src/utils/token_registry_wrapper.ts10
-rw-r--r--packages/contracts/test/token_registry.ts2
2 files changed, 7 insertions, 5 deletions
diff --git a/packages/contracts/src/utils/token_registry_wrapper.ts b/packages/contracts/src/utils/token_registry_wrapper.ts
index 99f17050a..6e3abb26b 100644
--- a/packages/contracts/src/utils/token_registry_wrapper.ts
+++ b/packages/contracts/src/utils/token_registry_wrapper.ts
@@ -1,16 +1,18 @@
-import * as Web3 from 'web3';
+import { Provider } from '@0xproject/types';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { TokenRegistryContract } from '../contract_wrappers/generated/token_registry';
import { Token } from './types';
import { constants } from './constants';
-import { web3Wrapper } from './web3_wrapper';
export class TokenRegWrapper {
private _tokenReg: TokenRegistryContract;
- constructor(tokenRegContract: TokenRegistryContract) {
+ private _web3Wrapper: Web3Wrapper;
+ constructor(tokenRegContract: TokenRegistryContract, provider: Provider) {
this._tokenReg = tokenRegContract;
+ this._web3Wrapper = new Web3Wrapper(provider);
}
public async addTokenAsync(token: Token, from: string): Promise<string> {
const txHash = await this._tokenReg.addToken.sendTransactionAsync(
@@ -22,7 +24,7 @@ export class TokenRegWrapper {
token.swarmHash,
{ from },
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
+ await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
return txHash;
}
public async getTokenMetaDataAsync(tokenAddress: string): Promise<Token> {
diff --git a/packages/contracts/test/token_registry.ts b/packages/contracts/test/token_registry.ts
index 1cc519c53..9faa67e20 100644
--- a/packages/contracts/test/token_registry.ts
+++ b/packages/contracts/test/token_registry.ts
@@ -34,7 +34,7 @@ describe('TokenRegistry', () => {
owner = accounts[0];
notOwner = accounts[1];
tokenReg = await TokenRegistryContract.deployFrom0xArtifactAsync(artifacts.TokenRegistry, provider, txDefaults);
- tokenRegWrapper = new TokenRegWrapper(tokenReg);
+ tokenRegWrapper = new TokenRegWrapper(tokenReg, provider);
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();