0

How do I declare a variable to be of a certain Anchor event type? In general, I am not sure how to extract a subtype within the program idl

1 Answer 1

1

I think you're asking for a way to declare a variable as being of the type of an Anchor event from the IDL? If that's the case then it's not currently possible. I have an open issue on the Anchor repo here you might want to follow: https://github.com/coral-xyz/anchor/issues/2050

In general, I am not sure how to extract a subtype within the program idl

To answer this more broadly, there are some helpers in Anchor. For example you can use type AccountName = IdlAccounts<IDLType>['accountName'] to get an account. See docs here: https://coral-xyz.github.io/anchor/ts/index.html#IdlAccounts

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.