Converts every EventNode on a program into a DefinedTypeNode
so that events are emitted as regular types by the JavaScript renderer.
As of @codama/nodes-from-anchor v1.5, Anchor events are parsed into
dedicated eventNodes (separate from defined types), and
@codama/renderers-js v2 no longer renders events at all. This visitor
restores the previous behavior of generating a struct codec per event by
re-homing each event's data into the program's defined types.
The event data is wrapped in a hiddenPrefixTypeNode carrying the
Anchor discriminator; we unwrap it so the rendered type is a plain struct
(matching the historical output), then drop the now-empty events list.
Converts every EventNode on a program into a DefinedTypeNode so that events are emitted as regular types by the JavaScript renderer.
As of
@codama/nodes-from-anchorv1.5, Anchor events are parsed into dedicatedeventNodes (separate from defined types), and@codama/renderers-jsv2 no longer renders events at all. This visitor restores the previous behavior of generating a struct codec per event by re-homing each event's data into the program's defined types.The event data is wrapped in a
hiddenPrefixTypeNodecarrying the Anchor discriminator; we unwrap it so the rendered type is a plain struct (matching the historical output), then drop the now-emptyeventslist.