diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-05-31 08:10:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-31 08:10:39 +0800 |
commit | c0cf55b40bb4a13cfd94a506bf125f6eb57c6767 (patch) | |
tree | f2cb7cbb5ed24cdc16da99fce78b9cf2324a7e12 /packages/contracts/src/utils/multi_sig_wrapper.ts | |
parent | e18d61b31a22519cd7d85ecffa62925ef7adc63d (diff) | |
parent | 5a840c88b5b767844cfcbf32b97b4123de1757fe (diff) | |
download | dexon-0x-contracts-c0cf55b40bb4a13cfd94a506bf125f6eb57c6767.tar dexon-0x-contracts-c0cf55b40bb4a13cfd94a506bf125f6eb57c6767.tar.gz dexon-0x-contracts-c0cf55b40bb4a13cfd94a506bf125f6eb57c6767.tar.bz2 dexon-0x-contracts-c0cf55b40bb4a13cfd94a506bf125f6eb57c6767.tar.lz dexon-0x-contracts-c0cf55b40bb4a13cfd94a506bf125f6eb57c6767.tar.xz dexon-0x-contracts-c0cf55b40bb4a13cfd94a506bf125f6eb57c6767.tar.zst dexon-0x-contracts-c0cf55b40bb4a13cfd94a506bf125f6eb57c6767.zip |
Merge pull request #639 from 0xProject/fix/contracts/multisigWrapper
Update LogDecoder
Diffstat (limited to 'packages/contracts/src/utils/multi_sig_wrapper.ts')
-rw-r--r-- | packages/contracts/src/utils/multi_sig_wrapper.ts | 18 |
1 files changed, 7 insertions, 11 deletions
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<TransactionReceiptWithDecodedLogs> { 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<TransactionReceiptWithDecodedLogs> { 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<TransactionReceiptWithDecodedLogs> { 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<TransactionReceiptWithDecodedLogs> { - 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; } } |