From d02b7c5fdfe984ebe430cc59d1c2c3a301ea8f45 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 11 Oct 2017 14:54:49 +0300 Subject: Fix a bug in logs fetching --- src/web3_wrapper.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/web3_wrapper.ts b/src/web3_wrapper.ts index 9de75c809..ff5d25d9c 100644 --- a/src/web3_wrapper.ts +++ b/src/web3_wrapper.ts @@ -107,11 +107,24 @@ export class Web3Wrapper { return addresses; } public async getLogsAsync(filter: Web3.FilterObject): Promise { + let fromBlock = filter.fromBlock; + if (_.isNumber(fromBlock)) { + fromBlock = this.web3.toHex(fromBlock); + } + let toBlock = filter.toBlock; + if (_.isNumber(toBlock)) { + toBlock = this.web3.toHex(toBlock); + } + const serializedFilter = { + ...filter, + fromBlock, + toBlock, + }; const payload = { jsonrpc: '2.0', id: this.jsonRpcRequestId++, method: 'eth_getLogs', - params: [filter], + params: [serializedFilter], }; const logs = await this.sendRawPayloadAsync(payload); return logs; -- cgit v1.2.3