diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-10-11 19:54:49 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-10-11 19:54:49 +0800 |
commit | d02b7c5fdfe984ebe430cc59d1c2c3a301ea8f45 (patch) | |
tree | b976e7f55bce219a45a45501d4fba11d0cf1f4b7 /src | |
parent | 233f97891c4e9fa88c339a29bd2ebc12096dbccb (diff) | |
download | dexon-sol-tools-d02b7c5fdfe984ebe430cc59d1c2c3a301ea8f45.tar dexon-sol-tools-d02b7c5fdfe984ebe430cc59d1c2c3a301ea8f45.tar.gz dexon-sol-tools-d02b7c5fdfe984ebe430cc59d1c2c3a301ea8f45.tar.bz2 dexon-sol-tools-d02b7c5fdfe984ebe430cc59d1c2c3a301ea8f45.tar.lz dexon-sol-tools-d02b7c5fdfe984ebe430cc59d1c2c3a301ea8f45.tar.xz dexon-sol-tools-d02b7c5fdfe984ebe430cc59d1c2c3a301ea8f45.tar.zst dexon-sol-tools-d02b7c5fdfe984ebe430cc59d1c2c3a301ea8f45.zip |
Fix a bug in logs fetching
Diffstat (limited to 'src')
-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; |