Open BlockChainBobC opened 4 years ago
As a followup someone from the Tropn Developers Telegram suggested that filtering could be done as follows:
tronWeb.getEventResult("TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7",{eventName:"Transfer", size:10, filters:{from: "0xa319aae271b031fba91cf489b709616e837a1a56"}}).then(result => {console.log(result)})
No error is thrown but no results come back... Is there something that I am missing? Is there also a way that I could make a filter apply to all params, like to as well? Does filter accept OR, || ?
If not I think that would be a good addition to the api and tornweb.... It would limit the amount of data the API has to return if developers do not have to filter a huge chunk of data on the client or Server-side, but if the api just serve only what they need. In a case where I want all events for 1 address like would be the case in a, my account or banking app situation does not seem like a great idea to have to receive all the event data for every address then have to filter it... Let me know if this already exsits., Am I missing something, or if this functionality is coming soon. Thanks so much for the time and contributions to this!
I would also like to find a solution to this. It will be really helpful to filter on certain parameters. @BCwhoLikesPHP, did you come up with a solution by any chance?
@BCwhoLikesPHP it turns out it does work, you just need to include a value in the result that you wish to filter. For example, in my result I had a referrerId which I included as { filters: { "referrerId": "1" }}.
How to add fromBlockNumber like web3 getPastEvents function in this getEventResult function? Got solution for this question { eventName: "Reinvest", fromBlock: 7686454, orderBy:'block_timestamp,desc', { "referrerId": "1" } }
I am looking at how it may be possible to filter results from tronWeb and or trongrid when getting event results, and if this functionality does not exist I would like to propose it gets included as it is critical to building out an app where users can ss their event history without having to log it separately.
If my Tronweb command line is:
tronWeb.getEventResult("TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7",{size:10}).then(result => {console.log(result)})
How could I return a list that only included transactions with the address: "TQqbtjk4x4YuuPEoizdaNfVqDpkVzGAXgi"
This issue was addressed as issue number 12 some time ago:
https://github.com/tronprotocol/tron-grid/issues/12
I took a look at the response posted by:
@sullof
Where he pointed to the test using Watch, and I was wondering how I could implement this into my code example above, or what the call URL to trongrid.io would look like if I had to call it that way. It seems like it is possible but it is not documented at all in any of the docs other than in that one post... Any help would be much appreciated!