Skip to content

Commit

Permalink
fix getContractLogs params
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Borsuk committed Jan 11, 2020
1 parent 5c87bc2 commit a68d079
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "echo-web3",
"version": "0.1.9",
"version": "0.1.10",
"description": "The wrapper over the Web3 that helps you to save your DAPP's code with calling to web3 methods by call to ECHO blockchain",
"main": "./dist/index.js",
"types": "./types/index.d.ts",
Expand Down
8 changes: 5 additions & 3 deletions src/providers/methods/get-logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class GetLogs extends Method {
}

if (topics) {
opts.topics = topics.map((topic) => cutHexPrefix(topic));
opts.topics = topics.map((topic) => {
return topic === null ? [] : [cutHexPrefix(topic)];
});
}

const res = await this.api.getContractLogs(opts);
Expand All @@ -50,12 +52,12 @@ class GetLogs extends Method {
toBlock = blockNumber;
} else {
const latestBlock = await (new BlockNumber(this.echo)).execute();

fromBlock = Number(fromBlock) || latestBlock;
toBlock = Number(toBlock) || latestBlock;
}

if(fromBlock !== 1){
if (fromBlock !== 1) {
// NOTE:: echo chain interpreters `[fromBlock, toBlock]` is empty range, if fromBlock === toBlock
// we need to decrease left side of range for getting of toBlock's logs
// according with this behaviour we need to decrease fromBlock every time
Expand Down

0 comments on commit a68d079

Please sign in to comment.