
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@solana/rpc-subscriptions-api
Advanced tools
This package contains types that describe the methods of the Solana JSON RPC Subscriptions API, and utilities for creating a RpcSubscriptionsApi implementation with sensible defaults. It can be used standalone, but it is also exported as part of Kit @solana/kit.
Each RPC subscriptions method is described in terms of a TypeScript type of the following form:
type ExampleApi = {
thingNotifications(address: Address): Thing;
};
A RpcSubscriptionsApi that implements ExampleApi will ultimately expose its defined methods on any RpcSubscriptions that uses it.
const rpcSubscriptions: RpcSubscriptions<ExampleApi> = createExampleRpcSubscriptions(/* ... */);
const thingNotifications = await rpc
.thingNotifications(address('95DpK3y3GF7U8s1k4EvZ7xqyeCkhsHeZaE97iZpHUGMN'))
.subscribe({ abortSignal: AbortSignal.timeout(5_000) });
try {
for await (const thing of thingNotifications) {
console.log('Got a thing', thing);
}
} catch (e) {
console.error('Our subscription to `Thing` notifications has failed', e);
} finally {
console.log('We are done listening for `Thing` notifications');
}
SolanaRpcSubscriptionsApi{Devnet|Testnet|Mainnet}These types represent the RPC subscription methods available on a specific Solana cluster.
createSolanaRpcSubscriptionsApi(config)Creates a RpcSubscriptionsApi implementation of the Solana JSON RPC Subscriptions API with some default behaviours.
The default behaviours include:
bigint inputs to number for compatibility with version 1.0 of the Solana JSON RPC.onIntegerOverflow handler whenever a bigint input would overflow a JavaScript IEEE 754 number. See this GitHub issue for more information.A config object with the following properties:
defaultCommitment: An optional default Commitment value. Given an RPC method that takes commitment as a parameter, this value will be used when the caller does not supply one.onIntegerOverflow(request, keyPath, value): void: An optional function that will be called whenever a bigint input exceeds that which can be expressed using JavaScript numbers. This is used in the default SolanaRpcSubscriptionsApi to throw an exception rather than to allow truncated values to propagate through a program.FAQs
Defines all default Solana RPC subscriptions as types
The npm package @solana/rpc-subscriptions-api receives a total of 293,085 weekly downloads. As such, @solana/rpc-subscriptions-api popularity was classified as popular.
We found that @solana/rpc-subscriptions-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.