Add assertion that one cannot specify both blockHash & fromBlock/toBlock to getLogsAsync
This commit is contained in:
parent
4e8ec2359d
commit
e6840c60c7
@ -438,6 +438,10 @@ export class Web3Wrapper {
|
|||||||
* @returns The corresponding log entries
|
* @returns The corresponding log entries
|
||||||
*/
|
*/
|
||||||
public async getLogsAsync(filter: FilterObject): Promise<LogEntry[]> {
|
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;
|
let fromBlock = filter.fromBlock;
|
||||||
if (_.isNumber(fromBlock)) {
|
if (_.isNumber(fromBlock)) {
|
||||||
fromBlock = utils.numberToHex(fromBlock);
|
fromBlock = utils.numberToHex(fromBlock);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user