open-index/open-npm huggingface dataset:
npm package: @solana/assertions
Description: Helpers for asserting that a JavaScript environment supports certain features necessary for the operation of the Solana JavaScript SDK
Author: Solana Labs Maintainers
Latest version: 6.8.0

[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]
<br />
[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]

[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
[code-style-prettier-url]: https://github.com/prettier/prettier
[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/assertions?style=flat
[npm-image]: https://img.shields.io/npm/v/@solana/assertions?style=flat
[npm-url]: https://www.npmjs.com/package/@solana/assertions

# @solana/assertions

This package contains utilities for asserting that a JavaScript environment supports certain features necessary for the operation of the Solana JavaScript SDK.

## Functions

`assertDigestCapabilityIsAvailable()`

Throws an exception unless `crypto.subtle.digest()` is available in the current JavaScript environment.

`assertKeyExporterIsAvailable()`

Throws an exception unless `crypto.subtle.exportKey()` is available in the current JavaScript environment.

`assertKeyGenerationIsAvailable()`

Throws an exception unless `crypto.subtle.generateKey()` is available in the current JavaScript environment and has support for the `Ed25519` curve.

`assertSigningCapabilityIsAvailable()`

Throws an exception unless `crypto.subtle.sign()` is available in the current JavaScript environment.

`assertVerificationCapabilityIsAvailable()`

Throws an exception unless `crypto.subtle.sign()` is available in the current JavaScript environment.
npm package: @solana/compat
Description: Helpers for converting from legacy web3js classes
Author: Solana Labs Maintainers
Latest version: 6.8.0

[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]
<br />
[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]

[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
[code-style-prettier-url]: https://github.com/prettier/prettier
[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/compat?style=flat
[npm-image]: https://img.shields.io/npm/v/@solana/compat?style=flat
[npm-url]: https://www.npmjs.com/package/@solana/compat

# @solana/compat

This package contains utilities for converting from legacy web3js classes to the new data structures in Kit. It can be used standalone, but it is also exported as part of Kit [`@solana/kit`](https://github.com/anza-xyz/kit/tree/main/packages/kit).

## Functions

### `fromLegacyPublicKey()`

This can be used to convert a legacy `PublicKey` object to an `Address` type

```ts
import { fromLegacyPublicKey } from '@solana/compat';
const address = fromLegacyPublicKey(new PublicKey('49XBVQsvSW44ULKL9qufS9YqQPbdcps1TQRijx4FQ9sH'));
```

### `fromLegacyKeypair()`

This can be used to convert a legacy `Keypair` object to a native Ed25519 `CryptoKeyPair` object

```ts
import { fromLegacyKeypair } from '@solana/compat';
const { privateKey, publicKey } = await fromLegacyKeypair(Keypair.generate());
```

### `fromVersionedTransaction()`

This can be used to convert a legacy `VersionedTransaction` object to a `Transaction` object.

```ts
import { fromVersionedTransaction } from '@solana/compat';

// imagine a function that returns a legacy `VersionedTransaction`
const legacyVersionedTransaction = getMyLegacyVersionedTransaction();
const transaction = fromVersionedTransaction(legacyVersionedTransaction);
```

### `fromLegacyTransactionInstruction()`

This can be used to convert a legacy `TransactionInstruction` object to a `Instruction` object.

```ts
import { fromLegacyTransactionInstruction } from '@solana/compat';

// imagine a function that returns a legacy `TransactionInstruction`
const legacyInstruction = getMyLegacyInstruction();
const instruction = fromLegacyTransactionInstruction(legacyInstruction);
```
npm package: @solana/eslint-config-solana
Description: ESLint rules to be shared across all Solana Labs projects
Author: Solana Maintainers
Latest version: 6.0.0

# Solana ESLint config

Let's share this ESLint config across all of our projects, to keep things consistent.

## Installation

1. Install this package in the target project, along with the required peer dependencies
   ```bash
   pnpx install-peerdeps@2 --pnpm --dev @solana/eslint-config-solana
   ```
2. Create an `.eslint.json` file in your target project that extends this module
   ```json
   {
     "extends": ["@solana/eslint-config-solana"]
   }
   ```
npm package: @solana/fast-stable-stringify
Description: Deterministic stringification for when performance and bundle size matters
Author: Solana Labs Maintainers
Latest version: 6.8.0

# fast-stable-stringify

This project is a fork of [nickyout/fast-stable-stringify](https://github.com/nickyout/fast-stable-stringify)

The most popular repository providing this feature is [substack's json-stable-stringify](https://www.npmjs.com/package/json-stable-stringify). The intent of this library is to provide a faster alternative for when performance is more important than features. It assumes you provide basic javascript values without circular references, and returns a non-indented string.

Usage:

```javascript
import stringify from '@solana/fast-stable-stringify';
stringify({ d: 0, c: 1, a: 2, b: 3, e: 4 }); // '{"a":2,"b":3,"c":1,"d":0,"e":4}'
```

Just like substack's, it:

- handles all variations of all basic javascript values (number, string, boolean, array, object, null, Date, BigInt)
- handles undefined _and_ function in the same way as `JSON.stringify`
- **does not support ie8 (and below) with complete certainty**.

Unlike substack's, it:

- does not implement the 'replacer' or 'space' arguments of the JSON.stringify method
- does not check for circular references

## Running tests

```
npm run test:unit:browser
npm run test:unit:node
```
npm package: @solana/functional
Description: Functional JavaScript helpers
Author: Solana Labs Maintainers
Latest version: 6.8.0

[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]
<br />
[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]

[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
[code-style-prettier-url]: https://github.com/prettier/prettier
[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/functional?style=flat
[npm-image]: https://img.shields.io/npm/v/@solana/functional?style=flat
[npm-url]: https://www.npmjs.com/package/@solana/functional

# @solana/functional

This package contains generalized functional helpers and functional helpers specific to Solana application components. It can be used standalone, but it is also exported as part of Kit [`@solana/kit`](https://github.com/anza-xyz/kit/tree/main/packages/kit).

## Functions

### `pipe()`

A pipeline is a solution that allows you to perform successive transforms of a value using functions. This is useful when building up a transaction message.

Until the [pipeline operator](https://github.com/tc39/proposal-pipeline-operator) becomes part of JavaScript you can use this utility to create pipelines.

```ts
const add = (a, b) => a + b;
const add10 = x => add(x, 10);
const add100 = x => add(x, 100);
const sum = pipe(1, add10, add100);
sum === 111; // true
```

```ts
const transferTransactionMessage = pipe(
    // The result of the first expression...
    createTransactionMessage({ version: 0 }),
    // ...gets passed as the sole argument to the next function in the pipeline.
    tx => setTransactionMessageFeePayer(myAddress, tx),
    // The return value of that function gets passed to the next...
    tx => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx),
    // ...and so on.
    tx => appendTransactionMessageInstruction(getTransferSolInstruction({ source, destination, amount }), tx),
);
```
npm package: @solana/instruction-plans
Description: Construct, plan and execute transactions from multiple instructions.
Author: Solana Labs Maintainers
Latest version: 6.8.0

[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]
<br />
[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]

[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
[code-style-prettier-url]: https://github.com/prettier/prettier
[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/instruction-plans?style=flat
[npm-image]: https://img.shields.io/npm/v/@solana/instruction-plans?style=flat
[npm-url]: https://www.npmjs.com/package/@solana/instruction-plans

# @solana/instruction-plans

This package contains types and functions for planning transaction from multiple instructions. It can be used standalone, but it is also exported as part of Kit [`@solana/kit`](https://github.com/anza-xyz/kit/tree/main/packages/kit).

You can read more about instruction plans in the [official Kit documentation](https://www.solanakit.com/docs/concepts/instruction-plans).
npm package: @solana/keychain-crossmint
Description: Crossmint wallet signer for Solana transactions
Author: Solana Foundation
Latest version: 1.0.1

# @solana/keychain-crossmint

Crossmint wallet signer for Solana transactions using Crossmint Wallets API.

## Installation

```bash
pnpm add @solana/keychain-crossmint
```

## Usage

```typescript
import { createCrossmintSigner } from '@solana/keychain-crossmint';

const signer = await createCrossmintSigner({
    apiKey: process.env.CROSSMINT_API_KEY!,
    walletLocator: process.env.CROSSMINT_WALLET_LOCATOR!,
});
```

## Configuration

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `apiKey` | `string` | Yes | - | Crossmint API key |
| `walletLocator` | `string` | Yes | - | Crossmint wallet locator |
| `apiBaseUrl` | `string` | No | `https://www.crossmint.com/api` | Base URL for Wallets API |
| `pollIntervalMs` | `number` | No | `1000` | Poll interval for managed transaction flow |
| `maxPollAttempts` | `number` | No | `60` | Max poll attempts before timeout |
| `signer` | `string` | No | - | Optional delegated signer locator |

## Behavior Notes

1. `signTransactions` uses a managed flow similar to Fireblocks `PROGRAM_CALL` style: create transaction, poll status, then extract a signature from Crossmint response data.
2. `signMessages` is intentionally unsupported and throws a signer error.

## License

MIT
npm package: @solana/keychain-gcp-kms
Description: Google Cloud KMS-based signer for Solana transactions using EdDSA (Ed25519)
Author: Solana Foundation
Latest version: 1.0.1

# @solana/keychain-gcp-kms

Google Cloud KMS-based signer for Solana transactions using EdDSA (Ed25519) signing.

## Installation

```bash
pnpm add @solana/keychain-gcp-kms
```

## Prerequisites

1. A Google Cloud KMS key with:
   - **Algorithm**: `EC_SIGN_ED25519`
   - **Purpose**: `ASYMMETRIC_SIGN`

2. Google Cloud credentials configured (see [Google Cloud Credentials](#google-cloud-credentials) below)

## Google Cloud Credentials

The signer uses the **Application Default Credentials (ADC)** to authenticate. You don't need to pass credentials explicitly when running in a Google Cloud environment (Compute Engine, GKE, Cloud Run, etc.).

### IAM Permissions

For this signer:

- Signing operations require `cloudkms.cryptoKeyVersions.useToSign`
- Availability checks (`isAvailable()`) require `cloudkms.cryptoKeyVersions.viewPublicKey`

### Local Development

For local development, you can:

1. **Use the gcloud CLI**:
   ```bash
   gcloud auth application-default login
   ```

2. **Use a Service Account Key**:
   ```bash
   export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/service-account-file.json"
   ```

## Creating a Google Cloud KMS Key

Use the `gcloud` CLI to create a key suitable for Solana signing:

```bash
# Create a KeyRing
gcloud kms keyrings create "my-keyring" --location "us-east1"

# Create a CryptoKey
gcloud kms keys create "my-key" \
  --location "us-east1" \
  --keyring "my-keyring" \
  --purpose "asymmetric-signing" \
  --default-algorithm "ec-sign-ed25519"
```

## Usage

### Basic Example

```typescript
import { createGcpKmsSigner } from '@solana/keychain-gcp-kms';

const signer = createGcpKmsSigner({
    keyName: 'projects/my-project/locations/us-east1/keyRings/my-ring/cryptoKeys/my-key/cryptoKeyVersions/1',
    publicKey: 'YourSolanaPublicKeyBase58',
});

// Sign a message
const message = { content: new Uint8Array([1, 2, 3, 4]) };
const signatures = await signer.signMessages([message]);

// Sign a transaction
const signatures = await signer.signTransactions([transaction]);
```

## API Reference

### `GcpKmsSigner`

#### Constructor

```typescript
createGcpKmsSigner(config: GcpKmsSignerConfig)
```

**Config Options:**
- `keyName` (required): Full resource name of the GCP KMS crypto key version
- `publicKey` (required): Solana public key (base58-encoded)
- `requestDelayMs` (optional): Delay in ms between concurrent signing requests to avoid rate limits (default: 0)

#### Properties

- `address`: The Solana address (public key) for this signer

#### Methods

- `signMessages(messages)`: Sign multiple messages
- `signTransactions(transactions)`: Sign multiple transactions
- `isAvailable()`: Check if the signer is available by retrieving the public key and verifying `EC_SIGN_ED25519`
npm package: @solana/keychain-privy
Description: Privy-based signer for Solana transactions
Author: Solana Foundation
Latest version: 1.0.1

# @solana/keychain-privy

Privy-based signer for Solana transactions using Privy's wallet API.

## Installation

```bash
pnpm add @solana/keychain-privy
```

## Usage

### Create and Initialize

```typescript
import { createPrivySigner } from '@solana/keychain-privy';

// Create and initialize the signer (fetches public key from Privy API)
const signer = await createPrivySigner({
    appId: 'your-privy-app-id',
    appSecret: 'your-privy-app-secret',
    walletId: 'user-wallet-id',
});

console.log('Signer address:', signer.address);
```

### Sign Messages

```typescript
import { createSignableMessage } from '@solana/signers';

const message = createSignableMessage('Hello, Privy!');
const [signatures] = await signer.signMessages([message]);
```

### Sign Transactions

```typescript
// Sign transactions using Privy's API
const [signatures] = await signer.signTransactions([transaction]);
```

### Check Availability

```typescript
const available = await signer.isAvailable();
console.log('Privy API available:', available);
```

## API Reference

### `createPrivySigner(config)`

Creates and initializes a new PrivySigner instance.

**Config options:**

- `appId` (string, required): Your Privy application ID
- `appSecret` (string, required): Your Privy application secret
- `walletId` (string, required): The Privy wallet ID to use for signing
- `apiBaseUrl` (string, optional): Custom API base URL (defaults to `https://api.privy.io/v1`)
- `requestDelayMs` (number, optional): Delay in ms between concurrent signing requests to avoid rate limits (default: 0)

**Example:**

**Returns:** `Promise<PrivySigner>`

### Methods

- `signMessages(messages)`: Signs one or more messages
- `signTransactions(transactions)`: Signs one or more transactions
- `isAvailable()`: Checks if the Privy API is reachable
- `address`: Read-only property containing the signer's Solana address

## How It Works

1. **Initialization**: Fetches the wallet's public key from Privy API during creation
2. **Signing**: Sends transactions/messages to Privy's signing API endpoint
3. **Extraction**: Uses `extractSignatureFromWireTransaction` to extract signatures from Privy's response

## Security Notes

- Store your `appSecret` securely (use environment variables)
- Never expose your `appSecret` in client-side code
- This signer is intended for server-side use or secure environments
- Privy handles key management - your private keys never leave Privy's infrastructure
npm package: @solana/kit-client-litesvm
Description: Pre-configured LiteSVM client for Solana Kit
Latest version: 0.9.0

# Kit Plugins ➤ LiteSVM Client

[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]

[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/kit-client-litesvm.svg?style=flat
[npm-image]: https://img.shields.io/npm/v/@solana/kit-client-litesvm.svg?style=flat&label=%40solana%2Fkit-client-litesvm
[npm-url]: https://www.npmjs.com/package/@solana/kit-client-litesvm

This package provides a pre-configured LiteSVM client for Solana Kit. It bundles several plugins together so you can get started with a single function call.

> [!NOTE]
> This package is only available in Node.js environments. LiteSVM relies on Node.js APIs and cannot run in browsers or React Native.

## Installation

```sh
pnpm install @solana/kit-client-litesvm
```

## `createClient`

Pre-configured client using LiteSVM for testing without an RPC connection.

```ts
import { createClient } from '@solana/kit-client-litesvm';

const client = await createClient();

// Set up test environment
client.svm.setAccount(myTestAccount);
client.svm.addProgramFromFile(myProgramAddress, 'program.so');

// Execute transactions locally
await client.sendTransaction([myInstruction]);
```

### Features

- `client.svm`: Embedded LiteSVM instance for local blockchain simulation.
- `client.rpc`: Subset of RPC methods that delegate to the LiteSVM instance.
- `client.payer`: The main payer signer for transactions.
- `client.airdrop`: Function to request SOL from the LiteSVM instance.
- `client.getMinimumBalance`: Computes the minimum lamports required for an account with a given data size.
- `client.transactionPlanner`: Plans instructions into transaction messages.
- `client.transactionPlanExecutor`: Executes planned transaction messages.
- `client.planTransactions`: Plans transaction messages, instructions or instruction plans into a transaction plan without executing it.
- `client.planTransaction`: Same as `client.planTransactions` but asserts a single transaction message is returned.
- `client.sendTransactions`: Sends transaction messages, instructions or instruction plans to the cluster by using the client's transaction planner and executor.
- `client.sendTransaction`: Same as `client.sendTransactions` but ensuring only a single transaction is sent.

### Configuration

| Option  | Type                | Description                                                                                                     |
| ------- | ------------------- | --------------------------------------------------------------------------------------------------------------- |
| `payer` | `TransactionSigner` | Signer used to pay for transaction fees and on-chain account storage. Defaults to a generated and funded payer. |
npm package: @solana/kit-plugin-airdrop
Description: [DEPRECATED] Airdrop helpers for Kit clients
Latest version: 0.9.0

# Kit Plugins ➤ Airdrop (deprecated)

[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]

[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/kit-plugin-airdrop.svg?style=flat
[npm-image]: https://img.shields.io/npm/v/@solana/kit-plugin-airdrop.svg?style=flat&label=%40solana%2Fkit-plugin-airdrop
[npm-url]: https://www.npmjs.com/package/@solana/kit-plugin-airdrop

> [!WARNING]
> This package is deprecated. Use `rpcAirdrop` from [`@solana/kit-plugin-rpc`](../kit-plugin-rpc) or `litesvmAirdrop` from [`@solana/kit-plugin-litesvm`](../kit-plugin-litesvm) instead.

## Migration

### RPC-based airdrop

```diff
  import { createEmptyClient } from '@solana/kit';
- import { airdrop, localhostRpc } from '@solana/kit-plugins';
+ import { localhostRpc, rpcAirdrop } from '@solana/kit-plugin-rpc';

  const client = createEmptyClient()
      .use(localhostRpc())
-     .use(airdrop());
+     .use(rpcAirdrop());
```

### LiteSVM-based airdrop

```diff
  import { createEmptyClient } from '@solana/kit';
- import { airdrop, litesvm } from '@solana/kit-plugins';
+ import { litesvm, litesvmAirdrop } from '@solana/kit-plugin-litesvm';

  const client = createEmptyClient()
      .use(litesvm())
-     .use(airdrop());
+     .use(litesvmAirdrop());
```
npm package: @solana/kit-plugins
Description: [DEPRECATED] Essential plugins and plugin presets for Solana Kit.
Latest version: 0.9.0

# Kit Plugins ➤ Main Library (deprecated)

[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]

[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/kit-plugins.svg?style=flat
[npm-image]: https://img.shields.io/npm/v/@solana/kit-plugins.svg?style=flat&label=%40solana%2Fkit-plugins
[npm-url]: https://www.npmjs.com/package/@solana/kit-plugins

> [!WARNING]
> This package is deprecated. Install individual plugin packages directly instead, or use the pre-configured client packages for a quick start.
>
> | Deprecated import from `@solana/kit-plugins`                                                 | Use instead                                                                                            |
> | -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
> | `rpc`, `localhostRpc`, `rpcAirdrop`, `rpcTransactionPlanner`, `rpcTransactionPlanExecutor`   | [`@solana/kit-plugin-rpc`](../kit-plugin-rpc)                                                          |
> | `payer`, `payerFromFile`, `generatedPayer`, `generatedPayerWithSol`, `payerOrGeneratedPayer` | [`@solana/kit-plugin-payer`](../kit-plugin-payer)                                                      |
> | `litesvm`, `litesvmAirdrop`, `litesvmTransactionPlanner`, `litesvmTransactionPlanExecutor`   | [`@solana/kit-plugin-litesvm`](../kit-plugin-litesvm)                                                  |
> | `transactionPlanner`, `transactionPlanExecutor`, `planAndSendTransactions`                   | [`@solana/kit-plugin-instruction-plan`](../kit-plugin-instruction-plan)                                |
> | `airdrop`                                                                                    | [`@solana/kit-plugin-rpc`](../kit-plugin-rpc) or [`@solana/kit-plugin-litesvm`](../kit-plugin-litesvm) |
> | `createDefaultRpcClient`                                                                     | `createClient` from [`@solana/kit-client-rpc`](../kit-client-rpc)                                      |
> | `createDefaultLocalhostRpcClient`                                                            | `createLocalClient` from [`@solana/kit-client-rpc`](../kit-client-rpc)                                 |
> | `createDefaultLiteSVMClient`                                                                 | `createClient` from [`@solana/kit-client-litesvm`](../kit-client-litesvm)                              |
npm package: @solana/kora
Description: TypeScript SDK for Kora RPC
Latest version: 0.2.1

# Kora TypeScript SDK

A TypeScript SDK for interacting with the Kora RPC server. This SDK provides a type-safe interface to all Kora RPC methods (requires a Kora RPC server to be running).


## Installation

```bash
pnpm install @solana/kora
```

## Quick Start

```typescript
import { KoraClient } from '@solana/kora';

// Initialize the client with your RPC endpoint
const client = new KoraClient({ rpcUrl: 'http://localhost:8080' });

// Example: Get Kora to sign a transaction
const result = await client.signTransaction({
  transaction: 'myBase64EncodedTransaction'
});

// Access the signed transaction (base64 encoded)
console.log('Signed transaction:', result.signed_transaction);
```

**[→ API Reference](https://launch.solana.com/docs/kora/json-rpc-api)**
**[→ Quick Start](https://launch.solana.com/docs/kora/getting-started/quick-start)**

## Local Development

### Building from Source

```bash
# Install dependencies
pnpm install

# Build the SDK
pnpm run build
```

### Running Tests


Start your local Kora RPC Server from the root project directory: 

```bash
kora --config tests/src/common/fixtures/kora-test.toml rpc start --signers-config tests/src/common/fixtures/signers.toml
```

Tests rely on [Solana CLI's](https://solana.com/docs/intro/installation) local test validator. 

Run:

```bash
pnpm test:ci:integration
```

This will start a local test validator and run all tests.
npm package: @solana/offchain-messages
Description: Helpers for encoding and decoding messages according to the offchain message specification
Author: Solana Labs Maintainers
Latest version: 6.8.0

[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]
<br />
[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]

[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
[code-style-prettier-url]: https://github.com/prettier/prettier
[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/offchain-messages?style=flat
[npm-image]: https://img.shields.io/npm/v/@solana/offchain-messages?style=flat
[npm-url]: https://www.npmjs.com/package/@solana/offchain-messages

# @solana/offchain-messages

This package contains utilities for encoding and decoding messages according to the offchain message [specification](https://github.com/solana-foundation/SRFCs/discussions/3). It can be used standalone, but it is also exported as part of Kit [`@solana/kit`](https://github.com/anza-xyz/kit/tree/main/packages/kit).
npm package: @solana/plugin-core
Description: Core helpers for creating and extending Kit clients with plugins
Author: Solana Labs Maintainers
Latest version: 6.8.0

[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]
<br />
[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]

[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
[code-style-prettier-url]: https://github.com/prettier/prettier
[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/plugin-core?style=flat
[npm-image]: https://img.shields.io/npm/v/@solana/plugin-core?style=flat
[npm-url]: https://www.npmjs.com/package/@solana/plugin-core

# @solana/plugin-core

This package contains utilities for creating modular Kit clients that can be extended with plugins. It can be used standalone, but it is also exported as part of Kit [`@solana/kit`](https://github.com/anza-xyz/kit/tree/main/packages/kit).
npm package: @solana/prettier-config-solana
Description: Prettier rules to be shared across all Solana Labs projects
Author: Solana Maintainers
Latest version: 0.0.6

# Solana Prettier config

Let's share this Prettier config across all of our projects, to keep things consistent.

## Installation

1. Install this package in the target project, along with the required peer dependencies
   ```bash
   pnpx install-peerdeps@2 --pnpm --dev @solana/prettier-config-solana
   ```
2. Add a reference to this module in your `package.json`
   ```json
   "prettier": "@solana/prettier-config-solana"
   ```
npm package: @solana/program-client-core
Description: Core utilities for building Solana program clients
Author: Solana Labs Maintainers
Latest version: 6.8.0

[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]
<br />
[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]

[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
[code-style-prettier-url]: https://github.com/prettier/prettier
[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/program-client-core?style=flat
[npm-image]: https://img.shields.io/npm/v/@solana/program-client-core?style=flat
[npm-url]: https://www.npmjs.com/package/@solana/program-client-core

# @solana/program-client-core

This package contains types and utilities for building Solana program clients. This is mainly used by the JavaScript Codama renderer to generate Kit-compatible program clients.
npm package: @solana/programs
Description: Helpers for defining programs and resolving program errors
Author: Solana Labs Maintainers
Latest version: 6.8.0

[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]
<br />
[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]

[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
[code-style-prettier-url]: https://github.com/prettier/prettier
[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/programs?style=flat
[npm-image]: https://img.shields.io/npm/v/@solana/programs?style=flat
[npm-url]: https://www.npmjs.com/package/@solana/programs

# @solana/programs

This package contains helpers for identifying custom program errors. It can be used standalone, but it is also exported as part of Kit [`@solana/kit`](https://github.com/anza-xyz/kit/tree/main/packages/kit).

## Functions

### `isProgramError()`

This function identifies whether an error -- typically caused by a transaction failure -- is a custom program error from the provided program address. It takes the following parameters:

- The `error` to identify.
- The `transactionMessage` object that failed to execute. Since the RPC response only provides the index of the failed instruction, the transaction message is required to determine its program address.
- The `programAddress` of the program from which the error is expected to have originated.
- Optionally, the expected error `code` of the custom program error. When provided, the function will check that the custom program error code matches the given value.

```ts
try {
    // Send and confirm your transaction.
} catch (error) {
    if (isProgramError(error, transactionMessage, myProgramAddress, 42)) {
        // Handle custom program error 42 from this program.
    } else if (isProgramError(error, transactionMessage, myProgramAddress)) {
        // Handle all other custom program errors from this program.
    } else {
        throw error;
    }
}
```
npm package: @solana/promises
Description: Helpers for using JavaScript promises
Author: Solana Labs Maintainers
Latest version: 6.8.0

[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]
<br />
[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]

[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
[code-style-prettier-url]: https://github.com/prettier/prettier
[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/promises?style=flat
[npm-image]: https://img.shields.io/npm/v/@solana/promises?style=flat
[npm-url]: https://www.npmjs.com/package/@solana/promises

# @solana/promises

This package contains helpers for using JavaScript promises.

## Functions

### `getAbortablePromise(promise, abortSignal?)`

Returns a new promise that will reject if the abort signal fires before the original promise settles. Resolves or rejects with the value of the original promise otherwise.

```ts
const result = await getAbortablePromise(
    // Resolves or rejects when `fetch` settles.
    fetch('https://example.com/json').then(r => r.json()),
    // ...unless it takes longer than 5 seconds, after which the `AbortSignal` is triggered.
    AbortSignal.timeout(5000),
);
```

### `safeRace(...promises)`

An implementation of `Promise.race` that causes all of the losing promises to settle. This allows them to be released and garbage collected, preventing memory leaks.

Read more here: https://github.com/nodejs/node/issues/17469
npm package: @solana/rpc-api
Description: Defines all default Solana RPC methods as types
Author: Solana Labs Maintainers
Latest version: 6.8.0

[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]
<br />
[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]

[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
[code-style-prettier-url]: https://github.com/prettier/prettier
[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/rpc-api?style=flat
[npm-image]: https://img.shields.io/npm/v/@solana/rpc-api?style=flat
[npm-url]: https://www.npmjs.com/package/@solana/rpc-api

# @solana/rpc-api

This package contains types that describe the [methods](https://solana.com/docs/rpc/http) 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`](https://github.com/anza-xyz/kit/tree/main/packages/kit).

Each RPC method is described in terms of a TypeScript type of the following form:

```ts
type ExampleApi = {
    getSomething(address: Address): Something;
};
```

A `RpcApi` that implements `ExampleApi` will ultimately expose its defined methods on any `Rpc` that uses it.

```ts
const rpc: Rpc<ExampleApi> = createExampleRpc(/* ... */);
const something: Something = await rpc.getSomething(address('95DpK3y3GF7U8s1k4EvZ7xqyeCkhsHeZaE97iZpHUGMN')).send();
```

## Types

### `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.

## Functions

### `createSolanaRpcApi(config)`

Creates a `RpcApi` implementation of the Solana JSON RPC API with some default behaviours.

The default behaviours include:

- A transform that converts `bigint` inputs to `number` for compatibility with version 1.0 of the Solana JSON RPC.
- A transform that calls the config's `onIntegerOverflow` handler whenever a `bigint` input would overflow a JavaScript IEEE 754 number. See [this](https://github.com/solana-labs/solana-web3.js/issues/1116) GitHub issue for more information.
- A transform that applies a default commitment wherever not specified

#### Arguments

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.
npm package: @solana/rpc-parsed-types
Description: Type definitions for parsed types used in the Solana RPC
Author: Solana Labs Maintainers
Latest version: 6.8.0

[![npm][npm-image]][npm-url] [![npm-downloads][npm-downloads-image]][npm-url]
<br />
[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]

[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
[code-style-prettier-url]: https://github.com/prettier/prettier
[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/rpc-types?style=flat
[npm-image]: https://img.shields.io/npm/v/@solana/rpc-types?style=flat
[npm-url]: https://www.npmjs.com/package/@solana/rpc-types

# @solana/rpc-parsed-types

This package defines types for parsed objects returned by methods of the [Solana JSON-RPC](https://docs.solana.com/api/http). It can be used standalone, but it is also exported as part of Kit [`@solana/kit`](https://github.com/anza-xyz/kit/tree/main/packages/kit).
npm package: @solana/rpc-spec-types
Description: Shared generic JSON RPC specifications
Author: Solana Labs Maintainers
Latest version: 6.8.0

[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]
<br />
[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]

[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
[code-style-prettier-url]: https://github.com/prettier/prettier
[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/rpc-spec-types?style=flat
[npm-image]: https://img.shields.io/npm/v/@solana/rpc-spec-types?style=flat
[npm-url]: https://www.npmjs.com/package/@solana/rpc-spec-types

# @solana/rpc-spec-types

This package contains core types that can be used on both RPC and RPC Subscriptions specifications. It can be used standalone, but it is also exported as part of Kit [`@solana/kit`](https://github.com/anza-xyz/kit/tree/main/packages/kit).

## Types

### `RpcRequest`

An object that describes the elements of a RPC or RPC Subscriptions request. It consists of the following properties:

- `methodName`: The name of the RPC method or subscription requested.
- `params`: The parameters to be passed to the RPC server.

### `RpcRequestTransformer`

A function that accepts a `RpcRequest` and returns another `RpcRequest`. This allows the `RpcApi` to transform the request before it is sent to the RPC server.

### `RpcResponse`

A type that represents the response from a RPC server. This could be any sort of data which is why `RpcResponse` defaults to `unknown`. You may use a type parameter to specify the shape of the response — e.g. `RpcResponse<{ result: number }>`.

### `RpcResponseTransformer`

A function that accepts a `RpcResponse` and returns another `RpcResponse`. This allows the `RpcApi` to transform the response before it is returned to the caller.
npm package: @solana/spl-governance
Description: SPL Governance Client API
Author: Solana Maintainers
Latest version: 0.3.28

# `spl-governance SDK`

SPL Governance Client API for spl-governance program

## Installation

`(npm|pnpm|yarn) add @solana/spl-governance @solana/web3.js`

## Usage

```typescript
import { getRealms } from '@solana/spl-governance';
import { Connection, PublicKey } from '@solana/web3.js';

const connection = new Connection("https://api.mainnet-beta.solana.com", 'recent');
const programId = new PublicKey('GovER5Lthms3bLBqWub97yVrMmEogzX7xNjdXpPPCVZw');

const realms = getRealms(connection, programId);