
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@solana/rpc-api
Advanced tools
This package contains types that describe the methods of the Solana JSON RPC API, and utilities for creating a RpcApi implementation with sensible defaults. It can be used standalone, but it is also exported as part of Kit @solana/kit.
Each RPC method is described in terms of a TypeScript type of the following form:
type ExampleApi = {
getSomething(address: Address): Something;
};
A RpcApi that implements ExampleApi will ultimately expose its defined methods on any Rpc that uses it.
const rpc: Rpc<ExampleApi> = createExampleRpc(/* ... */);
const something: Something = await rpc.getSomething(address('95DpK3y3GF7U8s1k4EvZ7xqyeCkhsHeZaE97iZpHUGMN')).send();
SolanaRpcApi{Devnet|Testnet|Mainnet}These types represent the RPC methods available on a specific Solana cluster.
For instance, the test clusters support the RequestAirdropApi while mainnet does not.
createSolanaRpcApi(config)Creates a RpcApi implementation of the Solana JSON RPC 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 SolanaRpcApi to throw an exception rather than to allow truncated values to propagate through a program.FAQs
Defines all default Solana RPC methods as types
The npm package @solana/rpc-api receives a total of 206,616 weekly downloads. As such, @solana/rpc-api popularity was classified as popular.
We found that @solana/rpc-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.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.