Skip to Content

createSolanaRPC()

createSolanaRPC(params): Rpc<SolanaRpcApi>

Defined in: utils/createSolanaRPC.ts:37 

Retrieves a cached RPC client for a given URL or cluster moniker. If no cached client exists, it creates a new instance.

Parameters

params

Object containing rpcUrlOrMoniker and optional rpcUrls map.

rpcUrlOrMoniker

string

Either a full RPC URL or a cluster moniker like ‘mainnet’.

rpcUrls?

Partial<Record<SolanaClusterMoniker, string>>

Optional custom mapping of cluster monikers to RPC endpoints.

Returns

Rpc<SolanaRpcApi>

The RPC client instance.

Last updated on