Defines the interface for an RPC client. It allows us to interact with the Solana blockchain.

Hierarchy

  • RpcInterface

Methods

  • Whether or not an account at a given address exists.

    Returns

    true if the account exists, false otherwise.

    Parameters

    • publicKey: PublicKey<string>

      The public key of the account.

    • Optional options: RpcBaseOptions

      The options to use when checking if an account exists.

    Returns Promise<boolean>

  • Send and confirm an airdrop transaction to the given address.

    Parameters

    Returns Promise<void>

  • Send a custom RPC request to the node.

    Returns

    The generic result of the RPC call.

    Type Parameters

    • R

    • P extends any[] = any[]

    Parameters

    • method: string

      The method to call.

    • Optional params: [...P[]]

      The parameters to pass to the method.

    • Optional options: RpcCallOptions

      The options to use when sending a custom RPC request.

    Returns Promise<R>

  • Fetch a raw account at the given address.

    Returns

    A raw account that may or may not exist.

    Parameters

    • publicKey: PublicKey<string>

      The public key of the account to fetch.

    • Optional options: RpcGetAccountOptions

      The options to use when fetching the account.

    Returns Promise<MaybeRpcAccount>

  • Fetch multiple raw accounts at the given addresses.

    Returns

    An array of raw accounts that may or may not exist.

    Parameters

    Returns Promise<MaybeRpcAccount[]>

  • Fetch the balance of an account.

    Returns

    An amount of SOL.

    Parameters

    • publicKey: PublicKey<string>

      The public key of the account.

    • Optional options: RpcBaseOptions

      The options to use when fetching an account's balance.

    Returns Promise<SolAmount>

  • Fetch the estimated production time of a block.

    Returns

    The estimated production time of the block in Unix time.

    Parameters

    • slot: number

      The slot to get the estimated production time for.

    • Optional options: RpcBaseOptions

      The options to use when getting the block time of a slot.

    Returns Promise<null | bigint>

  • The Solana cluster of the RPC being used.

    Returns Cluster

  • The RPC endpoint used by the client.

    Returns string

  • Fetch the latest blockhash.

    Returns

    The latest blockhash and its block height.

    Parameters

    • Optional options: RpcBaseOptions

      The options to use when fetching the latest blockhash.

    Returns Promise<BlockhashWithExpiryBlockHeight>

  • Fetch multiple raw accounts from a program.

    Returns

    An array of raw accounts.

    Parameters

    Returns Promise<RpcAccount[]>

  • Get the amount of rent-exempt SOL required to create an account of the given size.

    Returns

    An amount of SOL.

    Parameters

    • bytes: number

      The size of the account in bytes.

    • Optional options: RpcGetRentOptions

      The options to use when fetching the rent exempt amount.

    Returns Promise<SolAmount>

  • Fetch transaction commitments from an array of signatures.

    Returns

    An array of transaction statuses in the same order as the signatures. If a transaction was not found, null will be returned instead.

    Parameters

    • signatures: Uint8Array[]

      The signatures of all transactions we want to fetch commitments for.

    • Optional options: RpcGetSignatureStatusesOptions

      The options to use when fetching transaction commitments.

    Returns Promise<(null | TransactionStatus)[]>

  • Fetch the recent slot.

    Returns

    The recent slot.

    Parameters

    • Optional options: RpcBaseOptions

      The options to use when fetching the recent slot.

    Returns Promise<number>

  • Fetch a transaction by its signature.

    Returns

    A transaction with its metadata or null if the transaction was not found.

    Parameters

    • signature: Uint8Array

      The signature of the transaction to fetch.

    • Optional options: RpcBaseOptions

      The options to use when fetching transactions.

    Returns Promise<null | TransactionWithMeta>

  • Send a transaction to the blockchain.

    Returns

    The signature of the sent transaction.

    Parameters

    Returns Promise<Uint8Array>

Generated using TypeDoc