aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/utils/multi_sig_wrapper.ts
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-05-31 01:00:58 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-05-31 01:00:58 +0800
commit5a840c88b5b767844cfcbf32b97b4123de1757fe (patch)
treedf59eb5ebeeb92feec5959c8f567effd9f20a926 /packages/contracts/src/utils/multi_sig_wrapper.ts
parentb20e40dd6fd9964876a0006efe8b879a9a1d2118 (diff)
downloaddexon-sol-tools-5a840c88b5b767844cfcbf32b97b4123de1757fe.tar
dexon-sol-tools-5a840c88b5b767844cfcbf32b97b4123de1757fe.tar.gz
dexon-sol-tools-5a840c88b5b767844cfcbf32b97b4123de1757fe.tar.bz2
dexon-sol-tools-5a840c88b5b767844cfcbf32b97b4123de1757fe.tar.lz
dexon-sol-tools-5a840c88b5b767844cfcbf32b97b4123de1757fe.tar.xz
dexon-sol-tools-5a840c88b5b767844cfcbf32b97b4123de1757fe.tar.zst
dexon-sol-tools-5a840c88b5b767844cfcbf32b97b4123de1757fe.zip
Change logDecoder back into class, remove awaitTransactionMined from multiSigWrapper
Diffstat (limited to 'packages/contracts/src/utils/multi_sig_wrapper.ts')
-rw-r--r--packages/contracts/src/utils/multi_sig_wrapper.ts18
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;
}
}