coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.59k stars 1.32k forks source link

ts: CPI events parsing #2886

Open ochaloup opened 6 months ago

ochaloup commented 6 months ago

Based on the discussion at https://github.com/coral-xyz/anchor/issues/2609 I understood there is no parsing utilities for CPI events for TS libraries.

I would like to kick-off the PR that would add this support under official Anchor TS library. I'm not sure what would be the best on creating such functionality neither what is the best place to put it. Maybe the approach is in a wrong direction so it's fine to just close the PR.

/cc @acheroncrypto

vercel[bot] commented 6 months ago

@ochaloup is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

ochaloup commented 5 months ago

@acheroncrypto thanks for your comments. I'm moving from Draft to a Pull Request state. I did changes based on your comments with a bit of changing the logic to provide only one decode method for the coders. I believe it will be easier to grasp to just use decode that does what's needed. But I'm fine to change it back and split to two methods.

With adding the parseCpiEvents into interface I needed to change the default implemenation of the System(like) programs to get the build pass. I created an abstract class. It seemed to me cleaner but we can remove it back as it was.