aboutsummaryrefslogtreecommitdiffstats
path: root/src/0x.ts
diff options
context:
space:
mode:
authorLeonid <logvinov.leon@gmail.com>2017-10-04 19:30:36 +0800
committerGitHub <noreply@github.com>2017-10-04 19:30:36 +0800
commit836d9be7fee9986c8ffa380633d873ba557511f4 (patch)
treebdbe710ada39c7619efa5087cdd4eee6256cbf33 /src/0x.ts
parent5d554ab88246563a8efcbde1b92e45ab926214d5 (diff)
parente5bdf60460330a24597e018f3611e7bc939c1362 (diff)
downloaddexon-sol-tools-836d9be7fee9986c8ffa380633d873ba557511f4.tar
dexon-sol-tools-836d9be7fee9986c8ffa380633d873ba557511f4.tar.gz
dexon-sol-tools-836d9be7fee9986c8ffa380633d873ba557511f4.tar.bz2
dexon-sol-tools-836d9be7fee9986c8ffa380633d873ba557511f4.tar.lz
dexon-sol-tools-836d9be7fee9986c8ffa380633d873ba557511f4.tar.xz
dexon-sol-tools-836d9be7fee9986c8ffa380633d873ba557511f4.tar.zst
dexon-sol-tools-836d9be7fee9986c8ffa380633d873ba557511f4.zip
Merge pull request #178 from 0xProject/feature/getLogs
Add zeroEx.getLogsAsync
Diffstat (limited to 'src/0x.ts')
-rw-r--r--src/0x.ts25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/0x.ts b/src/0x.ts
index e6fdf68e1..3180c52f6 100644
--- a/src/0x.ts
+++ b/src/0x.ts
@@ -31,6 +31,8 @@ import {
DecodedLogArgs,
TransactionReceiptWithDecodedLogs,
LogWithDecodedArgs,
+ FilterObject,
+ RawLog,
} from './types';
import {zeroExConfigSchema} from './schemas/zero_ex_config_schema';
@@ -200,10 +202,16 @@ export class ZeroEx {
this._web3Wrapper = new Web3Wrapper(provider, defaults);
this.token = new TokenWrapper(
this._web3Wrapper,
+ this._abiDecoder,
this._getTokenTransferProxyAddressAsync.bind(this),
);
const exchageContractAddressIfExists = _.isUndefined(config) ? undefined : config.exchangeContractAddress;
- this.exchange = new ExchangeWrapper(this._web3Wrapper, this.token, exchageContractAddressIfExists);
+ this.exchange = new ExchangeWrapper(
+ this._web3Wrapper,
+ this._abiDecoder,
+ this.token,
+ exchageContractAddressIfExists,
+ );
this.proxy = new TokenTransferProxyWrapper(
this._web3Wrapper,
this._getTokenTransferProxyAddressAsync.bind(this),
@@ -300,17 +308,10 @@ export class ZeroEx {
const transactionReceipt = await this._web3Wrapper.getTransactionReceiptAsync(txHash);
if (!_.isNull(transactionReceipt)) {
intervalUtils.clearAsyncExcludingInterval(intervalId);
- const logsWithDecodedArgs = _.map(transactionReceipt.logs, (log: Web3.LogEntry) => {
- const decodedLog = this._abiDecoder.decodeLog(log);
- if (_.isUndefined(decodedLog)) {
- return log;
- }
- const logWithDecodedArgs: LogWithDecodedArgs = {
- ...log,
- ...decodedLog,
- };
- return logWithDecodedArgs;
- });
+ const logsWithDecodedArgs = _.map(
+ transactionReceipt.logs,
+ this._abiDecoder.tryToDecodeLogOrNoop.bind(this._abiDecoder),
+ );
const transactionReceiptWithDecodedLogArgs: TransactionReceiptWithDecodedLogs = {
...transactionReceipt,
logs: logsWithDecodedArgs,