Closed worthyking closed 5 years ago
@worthyking TronGrid supports filtering. Look at this TronWeb test as an example: https://github.com/TRON-US/tronweb/blob/master/test/lib/event.test.js#L194
I am not able to use Filtering via Trongid api or tronWeb. Is there a good code example of this somewhere or solid documentation anywhere?
@sullof
@worthyking TronGrid supports filtering. Look at this TronWeb test as an example: https://github.com/TRON-US/tronweb/blob/master/test/lib/event.test.js#L194
Some time watch event not works mainly if you are on shashta or any other testnet, Or there might be chance that watch log would be missed due to techincal failure of server. then Watch log won't be useful to recover data for missed records. So in that case we need to get events through API or Tronweb (method: getEventResult) or any other through which we can recover missed data.
But There is some problem to apply filters to get logs from event through api or method, Please refer to below link for more details: https://stackoverflow.com/questions/65121610/tron-blockchain-filters-not-working-on-get-events
@pardeepantech I am sorry, but I can't help :-/ — I left Tron in January.
I would like to suggest adding an advanced filtering method to filter event with params.
Example: https://api.trongrid.io/event/contract/TEEXEWrkMFKapSMJ6mErg39ELFKDqEs6w3/DiceResult
returns {"_number":"uint64","_referralAmount":"uint256","_direction":"uint64","_mentor":"address","_bettor":"address","_orderId":"uint256","_roll":"uint64","_amount":"uint256","_winAmount":"uint256"}
I suggest adding a new get method to allow further filtering such as:
https://api.trongrid.io/event/contract/TEEXEWrkMFKapSMJ6mErg39ELFKDqEs6w3/DiceResult/{params}/{filter value}
Example: https://api.trongrid.io/event/contract/TEEXEWrkMFKapSMJ6mErg39ELFKDqEs6w3/DiceResult/_bettor/{address} ........ this would return only events for the wallet address listed