How to decode ContractEmitted event data. #354
Replies: 1 comment 1 reply
-
The SCALE-bytes in the To help decoding these ContractEvents, there are Contract abstraction classes available, for example the This retrieves and decodes the extrinsic, events and ContractEvents. If you want to know more details how this data is decoded, have a look at this part of the code: https://github.com/polkascan/py-substrate-interface/blob/master/substrateinterface/contracts.py#L487 and https://github.com/polkascan/py-substrate-interface/blob/master/substrateinterface/contracts.py#L412 Here the SCALE data is being decoded for the types defined in the contract metadata. I understand this is a tedious proces, there are no explicit delimiters or other context available in the data when decoding SCALE, which makes it efficient, but hard to debug or trace. The events of Substrate itself are basically decoded in the same way, this is decoded according to the |
Beta Was this translation helpful? Give feedback.
-
Hello! --discussion title speaks for itself.
I am struggling to understand how do decode the 'data' field for a ContractEmitted event. I have been running circles around scalecodec classes, substrate-interface ContractEvent, src, etc. to little avail.
Can somebody point me toward a resource/reference implementation/etc for decoding event metadata + values, one that is a little more explanatory than the scalecodec docs, substrate-interface docs, or the Substrate docs SCALE description?
Perhaps this question is better suited for the python scalecodec repo? I am at a loss.
Thank you for the consideration!
Beta Was this translation helpful? Give feedback.
All reactions