diff options
author | Fabio Berger <me@fabioberger.com> | 2018-05-23 04:15:01 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-05-23 04:15:01 +0800 |
commit | 9de9bf651b7cede14ed718a438c48204dec5f989 (patch) | |
tree | c1b8e4410e2e1aec674f13c46c794330926820b3 /packages/contracts/src/utils | |
parent | 09d80b1e503b00483f32c60745a61ca8e4477be9 (diff) | |
download | dexon-sol-tools-9de9bf651b7cede14ed718a438c48204dec5f989.tar dexon-sol-tools-9de9bf651b7cede14ed718a438c48204dec5f989.tar.gz dexon-sol-tools-9de9bf651b7cede14ed718a438c48204dec5f989.tar.bz2 dexon-sol-tools-9de9bf651b7cede14ed718a438c48204dec5f989.tar.lz dexon-sol-tools-9de9bf651b7cede14ed718a438c48204dec5f989.tar.xz dexon-sol-tools-9de9bf651b7cede14ed718a438c48204dec5f989.tar.zst dexon-sol-tools-9de9bf651b7cede14ed718a438c48204dec5f989.zip |
Fix ExchangeWrapper
Diffstat (limited to 'packages/contracts/src/utils')
-rw-r--r-- | packages/contracts/src/utils/exchange_wrapper.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts index 17445ff75..0d0977ab8 100644 --- a/packages/contracts/src/utils/exchange_wrapper.ts +++ b/packages/contracts/src/utils/exchange_wrapper.ts @@ -1,4 +1,4 @@ -import { TransactionReceiptWithDecodedLogs } from '@0xproject/types'; +import { Provider, TransactionReceiptWithDecodedLogs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; @@ -14,9 +14,11 @@ import { AssetProxyId, OrderInfo, SignedOrder, SignedTransaction } from './types export class ExchangeWrapper { private _exchange: ExchangeContract; + private _web3Wrapper: Web3Wrapper; private _logDecoder: LogDecoder = new LogDecoder(constants.TESTRPC_NETWORK_ID); - constructor(exchangeContract: ExchangeContract) { + constructor(exchangeContract: ExchangeContract, provider: Provider) { this._exchange = exchangeContract; + this._web3Wrapper = new Web3Wrapper(provider); } public async fillOrderAsync( signedOrder: SignedOrder, @@ -245,7 +247,7 @@ export class ExchangeWrapper { return tx; } private async _getTxWithDecodedExchangeLogsAsync(txHash: string): Promise<TransactionReceiptWithDecodedLogs> { - const tx = await Web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); + const tx = await this._web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); tx.logs = _.filter(tx.logs, log => log.address === this._exchange.address); tx.logs = _.map(tx.logs, log => this._logDecoder.decodeLogOrThrow(log)); return tx; |