github codama-idl/renderers-js v2.4.0

4 hours ago

Minor Changes

  • #175 716f6ef Thanks @ChiefWoods! - Generate typed program constants in program-specific files under a top-level constants directory and re-export them from the generated client.

  • #177 67b330d Thanks @macalinao! - Add a new importExtension option that appends explicit extensions to relative imports in generated code — .js/.ts for generated files and /index.js//index.ts for generated directories. This enables consumers using Node ESM resolution, Deno, Node type stripping, or TypeScript's allowImportingTsExtensions/rewriteRelativeImportExtensions options.

  • #178 68385f9 Thanks @macalinao! - Add a new erasableSyntax option that replaces generated enum declarations with const objects and union types, making generated clients compatible with TypeScript's erasableSyntaxOnly option and Node.js type stripping.

  • #174 a6221c9 Thanks @ChiefWoods! - Add event generation from EventNodes. Each program event is rendered into a dedicated events/ page containing its discriminator constants, a typed event payload, encoder/decoder/codec functions and a parseXxxEvent helper validating the event discriminators before decoding. Program pages additionally expose an event enum and an identifyMyProgramEvent helper mirroring the existing account and instruction identification helpers. Event codecs reference their discriminator constants instead of inlining the bytes, and all generated names are configurable through the new eventDataType, eventParseFunction, programEventsEnum, programEventsEnumVariant and programEventsIdentifierFunction name transformers.

  • #188 114b8ca Thanks @amilz! - Forward the program address to linked PDA default values in async instruction builders

    Instruction accounts defaulting to a linked PDA were derived by calling the generated find*Pda() function with no config, so the derivation always used the address baked into that function and silently ignored the programAddress passed to the instruction builder. Programs deployed at different addresses per cluster produced instructions aimed at the overridden program with PDAs derived from the original one.

    Async builders now pass { programAddress } through to the find function when the PDA is derived from the instruction's own program, matching what the generated fetch*FromSeeds account helpers already did. PDAs owned by another program, or pinned to an explicit program ID, keep their own address.

    This changes generated output for any client with a same-program linked PDA default, so regenerate after upgrading. PDA finders supplied through linkOverrides.pdas are called with the same signature as generated ones, so they must accept a trailing config: { programAddress?: Address } argument.

Patch Changes

  • #176 3764a46 Thanks @macalinao! - Group type-only imports as import type { ... } statements so that generated code no longer leaves empty side-effect imports in JavaScript emitted under verbatimModuleSyntax, and fix a missing type keyword on PDA seeds type imports in account PDA helpers. Consumers regenerating clients will see cosmetic import { type A }import type { A } diffs.

Don't miss a new renderers-js release

NewReleases is sending notifications on new releases.