subsquid / squid-sdk

The main repo of the squid SDK
Apache License 2.0
1.23k stars 151 forks source link

Inquiry about decoding errors in event indexing #170

Closed Cupnfish closed 1 year ago

Cupnfish commented 1 year ago

Describe Hello,

I'm currently working on an event indexing project that uses a given ABI file to filter topics and decode results. However, since there is no fixed contract address, the input parameters may not always satisfy the decoding requirements, resulting in a panic during decoding.

I was wondering if there is a try_decode-like method available that could return null or an error when there are issues with decoding, such as incorrect length or failure to decode the event correctly. This would enable me to have more flexibility in handling these situations.

Could the development team provide any suggestions or advice for addressing this issue?

Thank you!

belopash commented 1 year ago

Hey, you can just wrap decode method in try ... catch and handle decoding errors as you want

Cupnfish commented 1 year ago

🎉 Thank you so much for helping me resolve my issue! I really appreciate the time and effort you put into helping me out. As someone who is not very familiar with TypeScript, I was struggling to find a solution on my own, and your help was invaluable.

👍 Your expertise and willingness to assist me has been truly impressive, and I can't thank you enough for your support. I'm so grateful to be part of such a supportive and helpful community.

🙏 Once again, thank you for all your help. I couldn't have done it without you!

@belopash