Typed wrapper around the full Solana JSON-RPC API surface.

Every method is a thin one-liner that delegates to the corresponding standalone function in ./methods, keeping this class easy to maintain and the standalone functions tree-shakeable.

const rpc = new SolanaRpc(transport);
const balance = await rpc.getBalance('So11...');
const block = await rpc.getBlock(123456);

1.0.0

Constructors

Methods

  • Get the commitment for a particular block.

    Parameters

    Returns Promise<{
        commitment: null | number[];
        totalStake: number;
    }>

    1.0.0

  • Get the current block height of the node.

    Parameters

    Returns Promise<number>

    1.0.0

  • Get confirmed blocks starting from a slot, with a limit.

    Parameters

    Returns Promise<Slot[]>

    1.0.0

  • Get the fee the network will charge for a particular message.

    Parameters

    • message: string
    • Optionalcommitment: Commitment
    • Optionalopts: CallOptions & {
          minContextSlot?: number;
      }

    Returns Promise<RpcContext<null | number>>

    1.0.0

  • Get the slot of the lowest confirmed block not yet purged from the ledger.

    Parameters

    Returns Promise<Slot>

    1.0.0

  • Check the health of the node ("ok" if healthy).

    Parameters

    Returns Promise<string>

    1.0.0

  • Get the highest slot information that the node has snapshots for.

    Parameters

    Returns Promise<{
        full: Slot;
        incremental?: Slot;
    }>

    1.0.0

  • Get the identity public key for the current node.

    Parameters

    Returns Promise<{
        identity: never;
    }>

    1.0.0

  • Get the 20 largest accounts by lamport balance.

    Parameters

    • Optionalopts: CallOptions & {
          commitment?: Commitment;
          filter?: "circulating" | "nonCirculating";
      }

    Returns Promise<RpcContext<{
        address: never;
        lamports: number;
    }[]>>

    1.0.0

  • Get the leader schedule for an epoch.

    Parameters

    Returns Promise<null | Record<never, number[]>>

    1.0.0

  • Get the minimum balance required to make an account rent-exempt.

    Parameters

    Returns Promise<number>

    1.0.0

  • Get a list of recent prioritization fees observed by the node.

    Parameters

    Returns Promise<{
        prioritizationFee: number;
        slot: Slot;
    }[]>

    1.0.0

  • Get the current slot leader.

    Parameters

    Returns Promise<never>

    1.0.0

  • Get the slot leaders for a range of slots.

    Parameters

    Returns Promise<never[]>

    1.0.0

  • Parameters

    • stakeAccount: never
    • Optionalopts: CallOptions & {
          commitment?: Commitment;
          epoch?: number;
          minContextSlot?: number;
      }

    Returns Promise<{
        active: number;
        inactive: number;
        state:
            | "active"
            | "inactive"
            | "activating"
            | "deactivating";
    }>

    Deprecated in solana-core v2.0.

    1.0.0

  • Get the 20 largest accounts of a particular SPL Token type.

    Parameters

    Returns Promise<RpcContext<{
        address: never;
        amount: string;
        decimals: number;
        uiAmount: null | number;
        uiAmountString: string;
    }[]>>

    1.0.0

  • Get the current transaction count from the ledger.

    Parameters

    Returns Promise<number>

    1.0.0

  • Get the current Solana version running on the node.

    Parameters

    Returns Promise<{
        feature-set: number;
        solana-core: string;
    }>

    1.0.0

  • Request an airdrop of lamports to a public key (devnet/testnet only).

    Parameters

    Returns Promise<never>

    1.0.0

  • Submit a signed transaction to the cluster for processing.

    Parameters

    Returns Promise<never>

    1.0.0