I created a stream that listens to the events of a marketplace and I would like to know if there is any way to know, when we receive the notification from moralis, which event that notifications matches. For example: createListing, cancelListing. I know that there is an option to decode the input and that returns the event, but I would like to know if there is any other way to discover that
Thanks
Hi @Minio10
You can also compare the topic0 which also requires finding or comparing the topic0 hash on your backend.
Thank you
And how can I get the parameters associated with that event ?
Hi @Minio10
If you are referring to the input params of the event then you can use Moralis.Streams.parsedLogs
to decode the event logs present in the stream.
You can find an example in below docs.
Thanks again, it looks exactly what I need, but my backend uses Ruby, is there any way to adapt that to Ruby ?
You can try to replicate the logic in ruby. Our sdk is internally using @ethersproject
sdk to decode the logs.
You can find more details in the below source files.
sdk function src reference
etherporject decoding reference
I donβt know if ruby has ethersproject
or any equivalent project that can help with decoding.
So I was trying to use a gem to decode the events that were passed to my backend, but with ListingRemoved events the data that comes from the transaction is β0xβ and i canβt decode because of that. Any idea to why the field data has that value ?
Not exactly sure on this.
Did you check the data from the stream if there is any such data?
If it is not from the stream data then it is probably generated from your code.