You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you supply additional optional like minBlockTimeStamp it will not work because of extra call to the eventWatcher function at line no 129.
Under file src/lib/core/Contract.js
asyncwatchEvent(contractAddress,eventName,options={},callback=false){letlistener=false;letlastBlock=false;letsince=Date.now()-1000;if(utils.isFunction(options)){callback=options;options={};}if(!utils.isFunction(callback)){thrownewError('Invalid callback function provided');}consteventWatcher=async()=>{try{options=Object.assign({
eventName,minBlockTimestamp: since,orderBy: 'timestamp,desc',// TODO:// add filters => eventron is already equipped for them// filters: options.filters},options)letevents;if(options.only_data_and_fingerprint){events=awaitthis.getEvents(contractAddress,options);}else{constresponse=awaitthis.getEvents(contractAddress,options);events=response.data;}const[latestEvent]=events.sort((a,b)=>b.block_timestamp-a.block_timestamp);constnewEvents=events.filter((event,index)=>{constduplicate=events.slice(0,index).some(priorEvent=>(JSON.stringify(priorEvent)==JSON.stringify(event)));if(duplicate)returnfalse;if(!lastBlock)returntrue;returnevent.block_timestamp>lastBlock;});if(latestEvent)lastBlock=latestEvent.block_timestamp;returnnewEvents;}catch(ex){returnPromise.reject(ex);}};constbindListener=()=>{if(listener)clearInterval(listener);listener=setInterval(()=>{eventWatcher().then(events=>events.forEach(event=>{callback(null,event)})).catch(err=>callback(err));},3000);};awaiteventWatcher();// here it will load the previous events but did not call the callback with those events.bindListener();return{start: bindListener(),stop: ()=>{if(!listener)return;clearInterval(listener);listener=false;}}}
The text was updated successfully, but these errors were encountered:
When you supply additional optional like
minBlockTimeStamp
it will not work because of extra call to theeventWatcher
function at line no 129.Under file
src/lib/core/Contract.js
The text was updated successfully, but these errors were encountered: