diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-05-31 02:10:30 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-05-31 02:10:30 +0800 |
commit | 064608a8ef5c332e09fefaadd3b4c1155d4853c9 (patch) | |
tree | 8c6733a17294718756564e9becf488e727bc3fdb /packages/contracts/src/utils | |
parent | b20e40dd6fd9964876a0006efe8b879a9a1d2118 (diff) | |
download | dexon-sol-tools-064608a8ef5c332e09fefaadd3b4c1155d4853c9.tar dexon-sol-tools-064608a8ef5c332e09fefaadd3b4c1155d4853c9.tar.gz dexon-sol-tools-064608a8ef5c332e09fefaadd3b4c1155d4853c9.tar.bz2 dexon-sol-tools-064608a8ef5c332e09fefaadd3b4c1155d4853c9.tar.lz dexon-sol-tools-064608a8ef5c332e09fefaadd3b4c1155d4853c9.tar.xz dexon-sol-tools-064608a8ef5c332e09fefaadd3b4c1155d4853c9.tar.zst dexon-sol-tools-064608a8ef5c332e09fefaadd3b4c1155d4853c9.zip |
Add awaitTransactionSuccess where needed
Diffstat (limited to 'packages/contracts/src/utils')
-rw-r--r-- | packages/contracts/src/utils/token_registry_wrapper.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/contracts/src/utils/token_registry_wrapper.ts b/packages/contracts/src/utils/token_registry_wrapper.ts index 86daeca62..99f17050a 100644 --- a/packages/contracts/src/utils/token_registry_wrapper.ts +++ b/packages/contracts/src/utils/token_registry_wrapper.ts @@ -4,13 +4,16 @@ import { TokenRegistryContract } from '../contract_wrappers/generated/token_regi import { Token } from './types'; +import { constants } from './constants'; +import { web3Wrapper } from './web3_wrapper'; + export class TokenRegWrapper { private _tokenReg: TokenRegistryContract; constructor(tokenRegContract: TokenRegistryContract) { this._tokenReg = tokenRegContract; } public async addTokenAsync(token: Token, from: string): Promise<string> { - const tx = this._tokenReg.addToken.sendTransactionAsync( + const txHash = await this._tokenReg.addToken.sendTransactionAsync( token.address as string, token.name, token.symbol, @@ -19,7 +22,8 @@ export class TokenRegWrapper { token.swarmHash, { from }, ); - return tx; + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); + return txHash; } public async getTokenMetaDataAsync(tokenAddress: string): Promise<Token> { const data = await this._tokenReg.getTokenMetaData.callAsync(tokenAddress); |