aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid <logvinov.leon@gmail.com>2017-10-11 20:11:40 +0800
committerGitHub <noreply@github.com>2017-10-11 20:11:40 +0800
commit080fe38d1cfa8487b4a215319f4a2586e2ee89e2 (patch)
treed48403a1e06dc6c09b671bb608ecb44014ae867d
parent233f97891c4e9fa88c339a29bd2ebc12096dbccb (diff)
parentdf327565561657e09084d51a90f13b84a8183b62 (diff)
downloaddexon-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
-rw-r--r--CHANGELOG.md6
-rw-r--r--src/web3_wrapper.ts15
2 files changed, 19 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2aae081bf..e4160f21e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,10 @@
# CHANGELOG
-v0.21.0 - _TBD, 2017_
+v0.21.1 - _October 11, 2017_
+------------------------
+ * Fixed a bug in subscriptions (#189)
+
+v0.21.0 - _October 10, 2017_
------------------------
* Complete rewrite of subscription logic (#182)
* Subscriptions no longer return historical logs. If you want them - use `getLogsAsync`
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;