diff options
author | Fabio Berger <me@fabioberger.com> | 2018-09-21 20:43:06 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-09-21 20:43:06 +0800 |
commit | e6840c60c7a1528accb3aeb9c3aa4e94ff652dc3 (patch) | |
tree | f0c504c4401e407ce01832d250cc9aa64de7e934 /packages | |
parent | 4e8ec2359d0f3842411d752fcfe966d540b10178 (diff) | |
download | dexon-sol-tools-e6840c60c7a1528accb3aeb9c3aa4e94ff652dc3.tar dexon-sol-tools-e6840c60c7a1528accb3aeb9c3aa4e94ff652dc3.tar.gz dexon-sol-tools-e6840c60c7a1528accb3aeb9c3aa4e94ff652dc3.tar.bz2 dexon-sol-tools-e6840c60c7a1528accb3aeb9c3aa4e94ff652dc3.tar.lz dexon-sol-tools-e6840c60c7a1528accb3aeb9c3aa4e94ff652dc3.tar.xz dexon-sol-tools-e6840c60c7a1528accb3aeb9c3aa4e94ff652dc3.tar.zst dexon-sol-tools-e6840c60c7a1528accb3aeb9c3aa4e94ff652dc3.zip |
Add assertion that one cannot specify both blockHash & fromBlock/toBlock to getLogsAsync
Diffstat (limited to 'packages')
-rw-r--r-- | packages/web3-wrapper/src/web3_wrapper.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index af0fe3a72..e6944d4bb 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -438,6 +438,10 @@ export class Web3Wrapper { * @returns The corresponding log entries */ public async getLogsAsync(filter: FilterObject): Promise<LogEntry[]> { + if (!_.isUndefined(filter.blockHash) && (!_.isUndefined(filter.fromBlock) || !_.isUndefined(filter.toBlock))) { + throw new Error(`Cannot specify 'blockHash' as well as 'fromBlock'/'toBlock' in the filter supplied to 'getLogsAsync'`); + } + let fromBlock = filter.fromBlock; if (_.isNumber(fromBlock)) { fromBlock = utils.numberToHex(fromBlock); |