@solana/client 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +42 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -177,6 +177,48 @@ const watcher = client.watchers.watchSignature(
177
177
  watcher.abort();
178
178
  ```
179
179
 
180
+ ## Cluster monikers and endpoints
181
+
182
+ Pass a cluster moniker to auto-resolve RPC + WebSocket URLs. Monikers map to:
183
+
184
+ - `mainnet` / `mainnet-beta` → `https://api.mainnet-beta.solana.com`
185
+ - `testnet` → `https://api.testnet.solana.com`
186
+ - `devnet` (default) → `https://api.devnet.solana.com`
187
+ - `localnet` / `localhost` → `http://127.0.0.1:8899`
188
+
189
+ WebSocket URLs are inferred (`wss://` or `ws://`) when not supplied. Override with `endpoint`/`rpc` or `websocket`/`websocketEndpoint` when you need a custom host.
190
+
191
+ ```ts
192
+ import { autoDiscover, createClient } from "@solana/client";
193
+
194
+ const client = createClient({
195
+ cluster: "mainnet", // or 'devnet' | 'testnet' | 'localnet' | 'localhost'
196
+ walletConnectors: autoDiscover(),
197
+ });
198
+ ```
199
+
200
+ Custom endpoint with inferred WebSocket:
201
+
202
+ ```ts
203
+ const client = createClient({
204
+ endpoint: "http://127.0.0.1:8899", // websocket inferred as ws://127.0.0.1:8900
205
+ });
206
+ ```
207
+
208
+ Use `resolveCluster` directly when you need the resolved URLs without creating a client:
209
+
210
+ ```ts
211
+ import { resolveCluster } from "@solana/client";
212
+
213
+ const resolved = resolveCluster({ moniker: "testnet" });
214
+ console.log(resolved.endpoint, resolved.websocketEndpoint);
215
+ ```
216
+
217
+ Notes:
218
+
219
+ - Default moniker is `devnet` when nothing is provided; moniker becomes `custom` when you pass a raw `endpoint`.
220
+ - `createClient`, `createDefaultClient` (`resolveClientConfig`), and `SolanaProvider` all use `resolveCluster` under the hood, so the moniker/endpoint behavior is consistent across entrypoints.
221
+
180
222
  ## Notes and defaults
181
223
 
182
224
  - Wallet connectors: `autoDiscover()` picks up Wallet Standard injectables; compose `phantom()`, `solflare()`, `backpack()`, or `injected()` when you need explicit control.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/client",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Framework-agnostic Solana client orchestration layer powering higher-level experiences",
5
5
  "exports": {
6
6
  ".": {