Add @solana/plugin-core package#1113
Conversation
🦋 Changeset detectedLatest commit: 33da353 The changes in this PR will be included in the next version bump. This PR includes changesets to release 43 packages
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 |
d490e96 to
28ff0d6
Compare
BundleMonFiles added (3)
Files updated (1)
Unchanged files (132)
Total files change +1.11KB +0.29% Final result: ✅ View report in BundleMon website ➡️ |
28ff0d6 to
c486e07
Compare
|
Documentation Preview: https://kit-docs-32a7da1wh-anza-tech.vercel.app |
94d1504 to
10f2441
Compare
mcintyre94
left a comment
There was a problem hiding this comment.
This looks great, especially the tests!
I think this is the exact right boundary for the piece that should be in the library
|
Just surfacing a slack thread to avoid merging this before we figure out naming: We currently deploy to NPM |
10f2441 to
8af12bb
Compare
8af12bb to
33da353
Compare
|
Thanks @GuiBibeau! As discussed on Slack, I updated the package name based on the naming convention we agreed on (see below). # In "anza-xyz/kit" repo.
@solana/plugin-core
# In "anza-xyz/kit-plugins" repo.
@solana/kit-plugins # The package re-exporting plugins and client factories.
@solana/kit-plugin-rpc
@solana/kit-plugin-litesvm
@solana/kit-plugin-payer
@solana/kit-plugin-instruction-plans
@solana/kit-plugin-*
# In program client repos.
@solana-program/token # contains token plugin.
@solana-program/stake # contains stake plugin.
# etc. |
|
🔎💬 Inkeep AI search and chat service is syncing content for source 'Solana Kit Docs' |
|
Because there has been no activity on this PR for 14 days since it was merged, it has been automatically locked. Please open a new issue if it requires a follow up. |

This PR introduces a new
@solana/plugin-corepackage to the monorepo that provides core utilities for creating modular Kit clients through a plugin architecture.It defines the following types and functions:
ClientPlugin: Defines a plugin. A function that extends a client by returning a new one. For instance,<T extends object>(client: T) => ({ ...client, rpc: createSolanaRpc("http://127.0.0.1:8899") }).Client: Defines a client object. Any object that contains ausefunction for applying plugins.AsyncClient: Defines the promise of a client. It also contains ausefunction for chaining async plugins without having to await them each time.createEmptyClient(): Function that returns an emptyClient. Can be used as the starting point for creating custom clients.To best illustrate this PR, let's explore some custom plugins and use them all at the end.
RPC plugin
Given an RPC endpoint, provides the
rpcandrpcSubscriptionsproperties to the client.Localhost plugin
An RPC plugin specifically for local environments. Since we are using a localnet, we also offer a
airdropfunction on the client that can be used later on by other plugins.Generated payer plugin (async)
A plugin that generates a new keypair signer and assigns it to the
payerproperty of the client.Generated payer with SOL plugin (async)
Same as the previous plugin but here we require an
airdropfunction on the client to also start the generated payer with some initial funds.Plugin usage
Finally, here's how we can create a localhost client that has all the features offered by the above plugins.
This is a small subset of features we can wrap in plugins to illustrate this PR. Some more can be found in this proof-of-concept repo.