Open
Conversation
🦋 Changeset detectedLatest commit: 25ced3a 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 |
ioxde
commented
Apr 15, 2026
| }).filter(isNotInternal); | ||
| const definedTypesToExport = getAllDefinedTypes(node).filter(isNotInternal); | ||
| // program.events may be undefined when no events exist. | ||
| const eventsToExport = getAllEvents(node).filter(Boolean).filter(isNotInternal); |
Contributor
Author
There was a problem hiding this comment.
This guard and the *events ?? [] patterns should probably be fixed upstream so they can be removed.
ioxde
commented
Apr 15, 2026
| const data = 'data' in event ? event.data : event; | ||
| ${discriminatorsFragment} | ||
| // TODO: Use SolanaError once event-specific error codes are added to @solana/errors. | ||
| throw new Error('The provided event data does not match any known ${programNode.name} event.'); |
Contributor
Author
There was a problem hiding this comment.
This is most likely a blocker to this PR that will need to be addressed upstream anza-xyz/kit/packages/errors
bcdaea0 to
25ced3a
Compare
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.
NOTE: I don't like throwing out AI generated PRs but I think in this instance it is the right move. I made the typescript and rust version at the same time. Close if this is not the direction you want to go in.
What this does
Adds event codegen support following the same fragment-based architecture as instructions and accounts.
Per-event files (
events/{name}.ts) — event type, decoder, discriminator constants, and adecode{Name}()convenience wrapper. Events are decoder-only since they're emitted by programs, not constructed by clients.Program-level utilities —
{Program}Eventenum,identify{Program}Event(),parse{Program}Event(), and aParsed{Program}Eventdiscriminated union type.Plugin integration — adds an
eventsfield to the existing{Program}Plugintype (alongsideaccounts,instructions,pdas) with a{Program}PluginEventstype and decoder instances.Key design decision: Events without constant discriminators in a
hiddenPrefixTypeNodeget individual files but are excluded from program-level aggregation (enum/identify/parse) — there's no reliable way to identify them at runtime.Limitations / Blocking
throw new Error(...)for identification/parse failures probably should switch toSolanaErroronce event-specific error codes land in@solana/errors*events ?? []pattern that should probably be fixed upstreamTests
LpChangeEvent,SwapEvent)