Skip to content

Use extendClient in program plugins and bump @solana/kit to ^6.4.0#140

Open
lorisleiva wants to merge 1 commit intomainfrom
04-14-use_extendclient_in_program_plugins_and_bump_solana_kit_to_6.4.0
Open

Use extendClient in program plugins and bump @solana/kit to ^6.4.0#140
lorisleiva wants to merge 1 commit intomainfrom
04-14-use_extendclient_in_program_plugins_and_bump_solana_kit_to_6.4.0

Conversation

@lorisleiva
Copy link
Copy Markdown
Member

This updates the program plugin code generator to use extendClient from @solana/plugin-core instead of manually spreading the client object. The return type now uses Omit<T, key> & { key: Plugin } instead of T & { key: Plugin }, which allows proper type narrowing when extending clients with overlapping plugin keys. The minimum @solana/kit version is bumped to ^6.4.0 across all default dependency versions and e2e test packages.

This updates the program plugin code generator to use `extendClient` from `@solana/plugin-core` instead of manually spreading the client object. The return type now uses `Omit<T, key> & { key: Plugin }` instead of `T & { key: Plugin }`, which allows proper type narrowing when extending clients with overlapping plugin keys. The minimum `@solana/kit` version is bumped to `^6.4.0` across all default dependency versions and e2e test packages.
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 14, 2026

🦋 Changeset detected

Latest commit: 7f9d414

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@codama/renderers-js Minor

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

@lorisleiva lorisleiva marked this pull request as ready for review April 14, 2026 19:59
Copy link
Copy Markdown
Member Author

lorisleiva commented Apr 14, 2026

@lorisleiva
Copy link
Copy Markdown
Member Author

@trevor-cortex

Copy link
Copy Markdown

@trevor-cortex trevor-cortex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This PR updates the program plugin code generator to use extendClient from @solana/plugin-core instead of manually spreading the client object ({ ...client, key: { ... } }). The return type changes from T & { key: Plugin } to Omit<T, "key"> & { key: Plugin }, which enables proper type narrowing when composing plugins with overlapping keys. All @solana/* default dependency versions are bumped from ^6.1.0 to ^6.4.0.

Review

Clean, mechanical change. The core logic update is in src/fragments/programPlugin.ts — a single new use('extendClient', 'solanaPluginCore') call and two template literal changes. The import mapping in importMap.ts already maps solanaPluginCore@solana/kit (default) / @solana/plugin-core (granular), so the generated import will resolve correctly in both strategies.

The Omit<T, key> & { key: Plugin } pattern is the right approach — it replaces any existing property with the same key rather than creating an impossible intersection type (T & { key: Plugin } where T already has a different key).

All e2e generated files are consistent with the new template output, and the test expectation is updated to match.

Notes for subsequent reviewers

  • The <PluginType> type assertion on the object literal (e.g. <SplTokenPlugin>{ ... }) is worth noting — this is a deliberate cast. Since the object is being constructed inline with dynamic helpers like addSelfFetchFunctions, TypeScript may not be able to fully verify the shape matches the plugin type. This was likely already the case implicitly before; now it's explicit.
  • The ^6.4.0 bump applies to all 14 @solana/* default dependencies uniformly. If extendClient was introduced in a specific minor version, it might be worth confirming that 6.4.0 is indeed the minimum version that exports it.
  • The lockfile diff is large (~780 lines) but is just the natural result of bumping @solana/kit in the e2e test packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants