Skip to content

Add granular RPC connection plugins and deprecate rpc/localhostRpc#184

Merged
lorisleiva merged 1 commit into
mainfrom
04-12-add_granular_rpc_connection_plugins_and_deprecate_rpc___localhostrpc_
Apr 14, 2026
Merged

Add granular RPC connection plugins and deprecate rpc/localhostRpc#184
lorisleiva merged 1 commit into
mainfrom
04-12-add_granular_rpc_connection_plugins_and_deprecate_rpc___localhostrpc_

Conversation

@lorisleiva
Copy link
Copy Markdown
Member

This PR introduces four new granular plugins for setting up RPC and RPC Subscriptions connections independently: rpcConnection, rpcSubscriptionsConnection, solanaRpcConnection, and solanaRpcSubscriptionsConnection. The existing rpc and localhostRpc plugins, which inject both RPC and RPC Subscriptions in one go, are deprecated in favor of the new alternatives. Docblocks with migration snippets are included on the deprecated functions.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 12, 2026

🦋 Changeset detected

Latest commit: 6ffdfe5

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

This PR includes changesets to release 3 packages
Name Type
@solana/kit-plugin-rpc Minor
@solana/kit-client-rpc Minor
@solana/kit-plugins 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
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 introduces four new granular plugins — rpcConnection, rpcSubscriptionsConnection, solanaRpcConnection, and solanaRpcSubscriptionsConnection — that let users set up RPC and RPC Subscriptions connections independently. The existing rpc and localhostRpc plugins are deprecated (with migration snippets in their docblocks) and moved to the new solana-rpc.ts file alongside the Solana-specific convenience plugins. All docs, examples, and tests are updated to use the new API.

Clean separation of concerns: rpc.ts now holds the generic plugins (accept any Rpc/RpcSubscriptions instance), while solana-rpc.ts holds the Solana-specific URL-based helpers and the deprecated functions. Nice layering with the solana* variants delegating to the generic ones.

LGTM — this is a well-structured change. One minor nit inline.

Things to watch out for

  1. Unused importextendClient is imported in solana-rpc.ts but never used there (the deprecated functions use it, but they could also delegate to the generic plugins like the new functions do). Not a big deal since the deprecated code is a direct move, but it's a minor cleanup opportunity.

  2. Re-export collision — Both rpc.ts and solana-rpc.ts are re-exported via index.ts. Since rpc.ts no longer exports rpc or localhostRpc, and those now live in solana-rpc.ts, there's no name collision. Just worth verifying this stays clean.

  3. Tests for deprecated functions removed — The old rpc and localhostRpc tests were replaced with tests for the new plugins. There are no remaining tests for the deprecated functions themselves. This is probably fine since they're just moved code, but a reviewer might want to consider whether a smoke test for backwards compat is worth keeping.

Notes for subsequent reviewers

  • The deprecated rpc() function in solana-rpc.ts still does its own createSolanaRpc + createSolanaRpcSubscriptions + extendClient inline rather than delegating to solanaRpcConnection/solanaRpcSubscriptionsConnection. This is intentional to preserve exact behavior (single .use() call installing both), but worth noting.
  • Docs and examples are comprehensive and consistently updated across all packages.
  • The changeset correctly marks this as a minor for @solana/kit-plugin-rpc.

Comment thread packages/kit-plugin-rpc/src/solana-rpc.ts
Copy link
Copy Markdown
Member

@mcintyre94 mcintyre94 left a comment

Choose a reason for hiding this comment

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

The new plugins look correct, but I'm a bit unclear why we're changing this as part of the current changes. Bundling RPC and subscriptions with a default transform from one URL to the other that works for most cases seemed reasonable to me.

Edit: I see the upstack PR adds a plugin that combines them and that logic moves there, works for me!

Copy link
Copy Markdown
Member Author

lorisleiva commented Apr 14, 2026

Merge activity

  • Apr 14, 5:32 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Apr 14, 5:33 PM UTC: Graphite rebased this pull request as part of a merge.
  • Apr 14, 5:34 PM UTC: @lorisleiva merged this pull request with Graphite.

@lorisleiva lorisleiva changed the base branch from 04-12-bump_solana_kit_peer_dependency_to_6.8.0 to graphite-base/184 April 14, 2026 17:32
@lorisleiva lorisleiva changed the base branch from graphite-base/184 to main April 14, 2026 17:32
This PR introduces four new granular plugins for setting up RPC and RPC Subscriptions connections independently: `rpcConnection`, `rpcSubscriptionsConnection`, `solanaRpcConnection`, and `solanaRpcSubscriptionsConnection`. The existing `rpc` and `localhostRpc` plugins, which inject both RPC and RPC Subscriptions in one go, are deprecated in favor of the new alternatives. Docblocks with migration snippets are included on the deprecated functions.
@lorisleiva lorisleiva force-pushed the 04-12-add_granular_rpc_connection_plugins_and_deprecate_rpc___localhostrpc_ branch from 6a41ad4 to 6ffdfe5 Compare April 14, 2026 17:33
@lorisleiva lorisleiva merged commit 027ed86 into main Apr 14, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 14, 2026
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.

3 participants