#what's the best way of listening to events live emitted from my contract.

9 messages · Page 1 of 1 (latest)

ocean pumice
#

I have my contract emiiting events that a react component needs to listen to , what's the best way to do this. and is it possible

covert prism
#

can you show what event you're emitting and how?

ocean pumice
#

event through my contract example arc4.emit(TokenClosed(arc4.UInt64(token_id)))

#

@covert prism just reading about the subscriber docs, but some links are broken

covert prism
#

so provided the syntax was correct, this should show up in the logs field of the transaction emitted the event

#

so you should inspect the transaction that emitted this event and pull out the corresponding log

#

if there are multiple logs, you need to pluck out the correct one

#

then you also need to decoded it, since it will be a bytes type

#

and because you used arc4.emit, it will have some addead overhead bytes