From 5a840c88b5b767844cfcbf32b97b4123de1757fe Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Wed, 30 May 2018 10:00:58 -0700 Subject: Change logDecoder back into class, remove awaitTransactionMined from multiSigWrapper --- packages/contracts/src/utils/multi_sig_wrapper.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'packages/contracts/src/utils/multi_sig_wrapper.ts') diff --git a/packages/contracts/src/utils/multi_sig_wrapper.ts b/packages/contracts/src/utils/multi_sig_wrapper.ts index 5c73cdf5a..d67692194 100644 --- a/packages/contracts/src/utils/multi_sig_wrapper.ts +++ b/packages/contracts/src/utils/multi_sig_wrapper.ts @@ -7,14 +7,16 @@ import { AssetProxyOwnerContract } from '../contract_wrappers/generated/asset_pr import { MultiSigWalletContract } from '../contract_wrappers/generated/multi_sig_wallet'; import { constants } from './constants'; -import { logDecoder } from './log_decoder'; +import { LogDecoder } from './log_decoder'; export class MultiSigWrapper { private _multiSig: MultiSigWalletContract; private _web3Wrapper: Web3Wrapper; + private _logDecoder: LogDecoder; constructor(multiSigContract: MultiSigWalletContract, provider: Provider) { this._multiSig = multiSigContract; this._web3Wrapper = new Web3Wrapper(provider); + this._logDecoder = new LogDecoder(this._web3Wrapper, this._multiSig.address); } public async submitTransactionAsync( destination: string, @@ -26,17 +28,17 @@ export class MultiSigWrapper { const txHash = await this._multiSig.submitTransaction.sendTransactionAsync(destination, value, data, { from, }); - const tx = await this._getTxWithDecodedMultiSigLogsAsync(txHash); + const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); return tx; } public async confirmTransactionAsync(txId: BigNumber, from: string): Promise { const txHash = await this._multiSig.confirmTransaction.sendTransactionAsync(txId, { from }); - const tx = await this._getTxWithDecodedMultiSigLogsAsync(txHash); + const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); return tx; } public async executeTransactionAsync(txId: BigNumber, from: string): Promise { const txHash = await this._multiSig.executeTransaction.sendTransactionAsync(txId, { from }); - const tx = await this._getTxWithDecodedMultiSigLogsAsync(txHash); + const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); return tx; } public async executeRemoveAuthorizedAddressAsync( @@ -45,13 +47,7 @@ export class MultiSigWrapper { ): Promise { const txHash = await (this ._multiSig as AssetProxyOwnerContract).executeRemoveAuthorizedAddress.sendTransactionAsync(txId, { from }); - const tx = await this._getTxWithDecodedMultiSigLogsAsync(txHash); - return tx; - } - private async _getTxWithDecodedMultiSigLogsAsync(txHash: string): Promise { - const tx = await this._web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); - tx.logs = _.filter(tx.logs, log => log.address === this._multiSig.address); - tx.logs = _.map(tx.logs, log => logDecoder.decodeLogOrThrow(log)); + const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); return tx; } } -- cgit v1.2.3