feat(nodes-from-anchor): add event support to V00 anchor IDLs#998
Open
stegaBOB wants to merge 2 commits into
Open
feat(nodes-from-anchor): add event support to V00 anchor IDLs#998stegaBOB wants to merge 2 commits into
stegaBOB wants to merge 2 commits into
Conversation
Old (V00) anchor IDLs define events inline with fields and rely on a
SHA256("event:EventName") discriminator. Bring V00 in line with V01 by
emitting EventNodes for these IDLs.
🦋 Changeset detectedLatest commit: f77f67e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Author
|
Could probably make an argument for this to be a patch bump? Minor seems like a lot. I don't have a preference one way or the other |
Member
trevor-cortex
approved these changes
May 18, 2026
trevor-cortex
left a comment
There was a problem hiding this comment.
Brings V00 anchor IDLs in line with V01 by emitting EventNodes, using the classic sha256("event:<PascalCase>")[0..8] discriminator scheme. The shape of the produced node (hidden-prefix struct + constant discriminator) matches eventNodeFromAnchorV01 exactly, which is what we want.
Things that look right:
- Origin gating in
ProgramNode.ts(origin === 'anchor' ? … : []) mirrors howaccountNodeFromAnchorV00only attaches anchor discriminators whenorigin === 'anchor'. Correct — shank IDLs reusing the V00 schema shouldn't get anchor event semantics. - 8-byte fixed-size constant matches Anchor's classic prefix.
IdlV00EventFieldis structurally compatible with whatstructTypeNodeFromAnchorV00reads (name+type); theindexflag is effectively ignored, which matches actual on-chain behavior for V00 anchor events (no real indexing in the emitted bytes).- Changeset is a
minorbump on a pre-1.0 package — appropriate for a user-facing additive feature.
Notes for subsequent reviewers:
- Worth a quick sanity check that the expected discriminator
60b8c5f38b025a94forMyEventmatches what anchor itself emits — easy to verify against any real V00 anchor IDL with events (e.g. an older Metaplex program). - No "event type missing" error path like V01 has, but that's by design: V00 defines event fields inline, so there's no separate type def to look up.
LGTM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Old (V00) anchor IDLs define events inline with fields and rely on a SHA256("event:EventName") discriminator. Bring V00 in line with V01 by emitting EventNodes for these IDLs.