ClientWithRpc

type ClientWithRpc<TRpcMethods> = object;

Represents a client that provides access to a Solana RPC endpoint.

The RPC interface allows making JSON-RPC calls to a Solana validator, such as fetching account data, sending transactions, and querying blockchain state.

Example

import { SolanaRpcApi } from '@solana/rpc-api';
 
async function getBalance(client: ClientWithRpc<SolanaRpcApi>, address: Address) {
    const { value: balance } = await client.rpc.getBalance(address).send();
    return balance;
}

Type Parameters

Type ParameterDescription
TRpcMethodsThe RPC methods available on this client. Use specific method types from @solana/rpc-api for the Solana JSON-RPC API.

Properties

rpc

rpc: Rpc<TRpcMethods>;

On this page