# @solana/client

> Framework-agnostic Solana client orchestration layer powering higher-level experiences

Latest version **1.7.0** (published 2026-01-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @solana/client
pnpm add @solana/client
yarn add @solana/client
bun add @solana/client
```

## Health

**Score 70/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.7.0 |
| Published | 2026-01-16 |
| First published | 2025-11-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=20.18.0 |
| Dependencies | 17 |
| Unpacked size | 484.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 86 |
| Author | Solana Maintainers |
| Maintainers | solana-devs |
| Keywords | solana, web3, client, zustand |

## Links

- npm: https://www.npmjs.com/package/@solana/client
- Repository: https://github.com/solana-foundation/framework-kit
- Homepage: https://github.com/solana-foundation/framework-kit#readme
- Issues: https://github.com/solana-foundation/framework-kit/issues
- npm.io page: https://npm.io/package/@solana/client

## Dependencies (17)

- [bs58](https://npm.io/package/bs58.md) ^6.0.0
- [zustand](https://npm.io/package/zustand.md) ^5.0.0
- [@solana/kit](https://npm.io/package/@solana/kit.md) ^5.0.0
- [@solana/transactions](https://npm.io/package/@solana/transactions.md) ^5.0.0
- [@wallet-standard/app](https://npm.io/package/@wallet-standard/app.md) ^1.0.1
- [@solana-program/stake](https://npm.io/package/@solana-program/stake.md) ^0.5.0
- [@solana-program/token](https://npm.io/package/@solana-program/token.md) ^0.9.0
- [@wallet-standard/base](https://npm.io/package/@wallet-standard/base.md) ^1.1.0
- [@solana-program/system](https://npm.io/package/@solana-program/system.md) ^0.10.0
- [@solana/codecs-strings](https://npm.io/package/@solana/codecs-strings.md) ^5.0.0
- [@wallet-standard/errors](https://npm.io/package/@wallet-standard/errors.md) ^0.1.1
- [@wallet-standard/features](https://npm.io/package/@wallet-standard/features.md) ^1.0.3
- [@solana-program/token-2022](https://npm.io/package/@solana-program/token-2022.md) ^0.7.0
- [@solana-program/compute-budget](https://npm.io/package/@solana-program/compute-budget.md) ^0.11.0
- [@solana/transaction-confirmation](https://npm.io/package/@solana/transaction-confirmation.md) ^5.0.0
- [@solana/wallet-standard-features](https://npm.io/package/@solana/wallet-standard-features.md) ^1.3.0
- [@solana-program/address-lookup-table](https://npm.io/package/@solana-program/address-lookup-table.md) ^0.10.0

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.7.0 (latest) — 2026-01-16
- 1.0.0-rc.2 (rc) — 2025-11-27
- 1.6.0 — 2026-01-13
- 1.5.0 — 2026-01-05
- 1.4.1 — 2026-01-05
- 1.4.0 — 2026-01-05
- 1.3.0 — 2026-01-05
- 1.2.2 — 2025-12-29
- 1.2.1 — 2025-12-29
- 1.2.0 — 2025-12-16
- 1.1.4 — 2025-12-05
- 1.1.3 — 2025-12-05
- 1.1.2 — 2025-12-05
- 1.1.1 — 2025-12-05
- 1.1.0 — 2025-12-04
- … 14 more at https://npm.io/package/@solana/client/versions

## README

# @solana/client

Framework-agnostic building blocks for Solana RPC, subscriptions, wallets, and transactions. Works
in any runtime (React, Svelte, API routes, workers, etc.).

> **Status:** Experimental – expect rapid iteration.

## Install

```bash
npm install @solana/client
```

## ConnectorKit (optional)

ConnectorKit integration is available as a **stable, opt-in entrypoint**: `@solana/client/connectorkit`.

This requires installing `@solana/connector` (an **optional peer dependency** of `@solana/client`):

```bash
npm install @solana/connector
```

```ts
import { connectorKit } from "@solana/client/connectorkit";

const walletConnectors = connectorKit({ defaultConfig: { /* ... */ } });
```

## Quickstart

1. Choose Wallet Standard connectors (auto-discovery is the fastest way to start).
2. Create a Solana client.
3. Call actions, watchers, and helpers anywhere in your app (React, APIs, workers, etc.).

```ts
import { autoDiscover, createClient } from "@solana/client";

const client = createClient({
  endpoint: "https://api.devnet.solana.com",
  websocketEndpoint: "wss://api.devnet.solana.com",
  walletConnectors: autoDiscover(),
});

// Connect Wallet Standard apps via their connector ids.
// Recommended: use canonical ids like "wallet-standard:phantom" (aliases like "phantom" also work).
await client.actions.connectWallet("wallet-standard:phantom");

// Fetch an account once.
const wallet = client.store.getState().wallet;
if (wallet.status === "connected") {
  const account = await client.actions.fetchAccount(wallet.session.account.address);
  console.log(account.lamports?.toString());
}
```

## Common Solana flows (copy/paste)

### Connect, disconnect, and inspect wallet state

```ts
const connectors = client.connectors.all; // Wallet Standard-aware connectors

await client.actions.connectWallet(connectors[0].id);

const wallet = client.store.getState().wallet;
if (wallet.status === "connected") {
  console.log(wallet.session.account.address.toString());
}

await client.actions.disconnectWallet();
```

### Fetch and watch lamports

```ts
import { toAddress } from "@solana/client";

const address = toAddress("Fg6PaFpoGXkYsidMpWFKfwtz6DhFVyG4dL1x8kj7ZJup");

const lamports = await client.actions.fetchBalance(address);
console.log(`Lamports: ${lamports.toString()}`);

const watcher = client.watchers.watchBalance({ address }, (nextLamports) => {
  console.log("Updated balance:", nextLamports.toString());
});

// Later…
watcher.abort();
```

### Request an airdrop (devnet/testnet)

```ts
const signature = await client.actions.requestAirdrop(address, 1_000_000_000n); // 1 SOL
console.log(signature.toString());
```

### Send SOL

```ts
const wallet = client.store.getState().wallet;
if (wallet.status !== "connected") throw new Error("Connect wallet first");

const signature = await client.solTransfer.sendTransfer({
  amount: 100_000_000n, // 0.1 SOL
  authority: wallet.session, // Wallet Standard session
  destination: "Ff34MXWdgNsEJ1kJFj9cXmrEe7y2P93b95mGu5CJjBQJ",
});
console.log(signature.toString());
```

### SPL token balance + transfer

```ts
const wallet = client.store.getState().wallet;
if (wallet.status !== "connected") throw new Error("Connect wallet first");

const usdc = client.splToken({ mint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" }); // USDC

const balance = await usdc.fetchBalance(wallet.session.account.address);
console.log(`Balance: ${balance.uiAmount}`);

const signature = await usdc.sendTransfer({
  amount: 1n,
  authority: wallet.session,
  destinationOwner: "Ff34MXWdgNsEJ1kJFj9cXmrEe7y2P93b95mGu5CJjBQJ",
});
console.log(signature.toString());
```

### Token 2022 support

Token 2022 mints are supported via the `tokenProgram` option:

```ts
// Auto-detect Token or Token 2022 (recommended)
const token = client.splToken({
  mint: "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo", // PYUSD
  tokenProgram: "auto",
});

// Or explicitly specify Token 2022 program
import { TOKEN_2022_PROGRAM_ADDRESS } from "@solana/client";

const token2022 = client.splToken({
  mint: mintAddress,
  tokenProgram: TOKEN_2022_PROGRAM_ADDRESS,
});

// Balance and transfers work the same way
const balance = await token.fetchBalance(wallet.session.account.address);
const signature = await token.sendTransfer({
  amount: 10,
  authority: wallet.session,
  destinationOwner: recipientAddress,
});
```

### Fetch address lookup tables

```ts
import { toAddress } from "@solana/client";

// Single lookup table
const lut = await client.actions.fetchLookupTable(
  toAddress("AddressLookupTab1e1111111111111111111111111"),
);
console.log(`Addresses in LUT: ${lut.addresses.length}`);

// Multiple lookup tables
const luts = await client.actions.fetchLookupTables([lutAddress1, lutAddress2]);
```

### Fetch nonce accounts

```ts
const nonce = await client.actions.fetchNonceAccount(
  toAddress("NonceAccountAddress111111111111111111111111"),
);
console.log(`Nonce: ${nonce.blockhash}`);
console.log(`Authority: ${nonce.authority}`);
```

### Build and send arbitrary transactions

```ts
import { getTransferSolInstruction } from "@solana-program/system";

const wallet = client.store.getState().wallet;
if (wallet.status !== "connected") throw new Error("Connect wallet first");

const prepared = await client.transaction.prepare({
  authority: wallet.session,
  instructions: [
    getTransferSolInstruction({
      destination: "Ff34MXWdgNsEJ1kJFj9cXmrEe7y2P93b95mGu5CJjBQJ",
      lamports: 10_000n,
      source: wallet.session.account.address,
    }),
  ],
  version: "auto", // defaults to 0 when lookups exist, otherwise 'legacy'
});

// Inspect or serialize first.
const wire = await client.transaction.toWire(prepared);

// Submit.
const signature = await client.transaction.send(prepared);
console.log(signature.toString());
```

### Watch signature confirmations

```ts
const watcher = client.watchers.watchSignature(
  { signature, commitment: "confirmed" },
  (notification) => console.log("Signature update:", notification),
);

// Later…
watcher.abort();
```

## Cluster monikers and endpoints

Pass a cluster moniker to auto-resolve RPC + WebSocket URLs. Monikers map to:

- `mainnet` / `mainnet-beta` → `https://api.mainnet-beta.solana.com`
- `testnet` → `https://api.testnet.solana.com`
- `devnet` (default) → `https://api.devnet.solana.com`
- `localnet` / `localhost` → `http://127.0.0.1:8899`

WebSocket URLs are inferred (`wss://` or `ws://`) when not supplied. Override with `endpoint`/`rpc` or `websocket`/`websocketEndpoint` when you need a custom host.

```ts
import { autoDiscover, createClient } from "@solana/client";

const client = createClient({
  cluster: "mainnet", // or 'devnet' | 'testnet' | 'localnet' | 'localhost'
  walletConnectors: autoDiscover(),
});
```

Custom endpoint with inferred WebSocket:

```ts
const client = createClient({
  endpoint: "http://127.0.0.1:8899", // websocket inferred as ws://127.0.0.1:8900
});
```

Use `resolveCluster` directly when you need the resolved URLs without creating a client:

```ts
import { resolveCluster } from "@solana/client";

const resolved = resolveCluster({ moniker: "testnet" });
console.log(resolved.endpoint, resolved.websocketEndpoint);
```

Notes:

- Default moniker is `devnet` when nothing is provided; moniker becomes `custom` when you pass a raw `endpoint`.
- `createClient`, `createDefaultClient` (`resolveClientConfig`), and `SolanaProvider` all use `resolveCluster` under the hood, so the moniker/endpoint behavior is consistent across entrypoints.

## Wallet connector filtering

Use `filterByNames` with `autoDiscover()` to filter wallets by name without wallet-specific code:

```ts
import { autoDiscover, filterByNames } from "@solana/client";

// Only show Phantom and Solflare
const connectors = autoDiscover({
  filter: filterByNames("phantom", "solflare"),
});

const client = createClient({
  cluster: "devnet",
  walletConnectors: connectors,
});
```

This approach follows Wallet Standard's wallet-agnostic discovery pattern while still allowing you to curate which wallets appear in your app.

You can also write custom filter functions:

```ts
const connectors = autoDiscover({
  filter: (wallet) => wallet.name.toLowerCase().includes("phantom"),
});
```

## Notes and defaults

- Wallet connectors: `autoDiscover()` picks up Wallet Standard injectables; use `filterByNames()` to filter by name, or compose `phantom()`, `solflare()`, `backpack()`, etc. when you need explicit control.
- Store: built on Zustand; pass `createStore` to `createClient` for custom persistence or server-side stores. `serializeSolanaState` / `deserializeSolanaState` help save and restore cluster + wallet metadata.
- Actions: `fetchAccount`, `fetchBalance`, `fetchLookupTable`, `fetchLookupTables`, `fetchNonceAccount`, `setCluster`, `requestAirdrop`, `sendTransaction`, and wallet connect/disconnect keep the store in sync.
- Watchers: `watchAccount`, `watchBalance`, and `watchSignature` stream updates into the store and return an `abort()` handle for cleanup.
- Helpers: `solTransfer`, `splToken`, and `transaction` cover common transfers plus low-level `prepare`/`sign`/`toWire` flows. Transaction versions default to `0` when any instruction references address lookup tables, otherwise `legacy`; override with `version` when needed.

## Scripts

- `pnpm build` – compile JS and type definitions
- `pnpm test:typecheck` – strict type-checking
- `pnpm lint` / `pnpm format` – Biome-powered linting and formatting

## More resources

- [Documentation](https://www.framework-kit.com/) — full guides and API reference
- Playground: `examples/vite-react` (run with `pnpm install && pnpm dev`).
- Next.js reference app: `examples/nextjs`.
- Client APIs live in `src/actions.ts`, `src/watchers`, and `src/features/*` for helper internals.

---
_Source: https://npm.io/package/@solana/client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
