From 7777ba38688922ce0ec071e8a53a1c16e072278e Mon Sep 17 00:00:00 2001 From: Nick Borsuk Date: Wed, 20 Nov 2019 13:11:40 +0300 Subject: [PATCH] [EDEX-26] fix getLogs fromBlock calculating --- package.json | 2 +- src/providers/methods/get-logs.js | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index dfa588a..9ef66a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "echo-web3", - "version": "0.1.3", + "version": "0.1.4", "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", diff --git a/src/providers/methods/get-logs.js b/src/providers/methods/get-logs.js index d373a89..557e6cb 100644 --- a/src/providers/methods/get-logs.js +++ b/src/providers/methods/get-logs.js @@ -55,10 +55,12 @@ class GetLogs extends Method { toBlock = Number(toBlock) || latestBlock; } - // 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 - 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 + fromBlock -= 1; + } if (toBlock < fromBlock) throw new Error('toBlock is less than fromBlock');