diff options
author | Leonid <logvinov.leon@gmail.com> | 2017-10-11 20:11:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-11 20:11:40 +0800 |
commit | 080fe38d1cfa8487b4a215319f4a2586e2ee89e2 (patch) | |
tree | d48403a1e06dc6c09b671bb608ecb44014ae867d /src/web3_wrapper.ts | |
parent | 233f97891c4e9fa88c339a29bd2ebc12096dbccb (diff) | |
parent | df327565561657e09084d51a90f13b84a8183b62 (diff) | |
download | dexon-sol-tools-080fe38d1cfa8487b4a215319f4a2586e2ee89e2.tar dexon-sol-tools-080fe38d1cfa8487b4a215319f4a2586e2ee89e2.tar.gz dexon-sol-tools-080fe38d1cfa8487b4a215319f4a2586e2ee89e2.tar.bz2 dexon-sol-tools-080fe38d1cfa8487b4a215319f4a2586e2ee89e2.tar.lz dexon-sol-tools-080fe38d1cfa8487b4a215319f4a2586e2ee89e2.tar.xz dexon-sol-tools-080fe38d1cfa8487b4a215319f4a2586e2ee89e2.tar.zst dexon-sol-tools-080fe38d1cfa8487b4a215319f4a2586e2ee89e2.zip |
Merge pull request #189 from 0xProject/fix/getLogsParamsSerialization
Fix a bug in logs fetching
Diffstat (limited to 'src/web3_wrapper.ts')
-rw-r--r-- | src/web3_wrapper.ts | 15 |
1 files changed, 14 insertions, 1 deletions
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<Web3.LogEntry[]> { + 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; |