Skip to content

RPC Types

solana.rpc.types

RPC types.

RPCMethod

Type for RPC method.

URI

Type for endpoint URI.

DataSliceOpts

Option to limit the returned account data, only available for "base58" or "base64" encoding.

Source code in solana/rpc/types.py
class DataSliceOpts(NamedTuple):
    """Option to limit the returned account data, only available for "base58" or "base64" encoding."""

    offset: int
    """Limit the returned account data using the provided offset: <usize>."""
    length: int
    """Limit the returned account data using the provided length: <usize>."""

length: int

Limit the returned account data using the provided length: .

offset: int

Limit the returned account data using the provided offset: .

MemcmpOpts

Option to compare a provided series of bytes with program account data at a particular offset.

Source code in solana/rpc/types.py
class MemcmpOpts(NamedTuple):
    """Option to compare a provided series of bytes with program account data at a particular offset."""

    offset: int
    """Offset into program account data to start comparison: <usize>."""
    bytes: str
    """Data to match, as base-58 encoded string: <string>."""

bytes: str

Data to match, as base-58 encoded string: .

offset: int

Offset into program account data to start comparison: .

RPCError

RPC error.

Source code in solana/rpc/types.py
class RPCError(TypedDict):
    """RPC error."""

    code: int
    """HTTP status code."""
    message: str
    """Error message."""

TokenAccountOpts

Options when querying token accounts.

Provide one of mint or program_id.

Source code in solana/rpc/types.py
class TokenAccountOpts(NamedTuple):
    """Options when querying token accounts.

    Provide one of mint or program_id.
    """

    mint: Optional[Pubkey] = None
    """Public key of the specific token Mint to limit accounts to."""
    program_id: Optional[Pubkey] = None
    """Public key of the Token program ID that owns the accounts."""
    encoding: str = "base64"
    """Encoding for Account data, either "base58" (slow) or "base64"."""
    data_slice: Optional[DataSliceOpts] = None
    """Option to limit the returned account data, only available for "base58" or "base64" encoding."""

data_slice: Optional[solana.rpc.types.DataSliceOpts]

Option to limit the returned account data, only available for "base58" or "base64" encoding.

encoding: str

Encoding for Account data, either "base58" (slow) or "base64".

mint: Optional[solders.pubkey.Pubkey]

Public key of the specific token Mint to limit accounts to.

program_id: Optional[solders.pubkey.Pubkey]

Public key of the Token program ID that owns the accounts.

TxOpts

Options to specify when broadcasting a transaction.

Source code in solana/rpc/types.py
class TxOpts(NamedTuple):
    """Options to specify when broadcasting a transaction."""

    skip_confirmation: bool = True
    """If false, `send_transaction` will try to confirm that the transaction was successfully broadcasted.

    When confirming a transaction, `send_transaction` will block for a maximum of 30 seconds. Wrap the call
    inside a thread to make it asynchronous.
    """
    skip_preflight: bool = False
    """If true, skip the preflight transaction checks."""
    preflight_commitment: Commitment = Finalized
    """Commitment level to use for preflight."""
    max_retries: Optional[int] = None
    """Maximum number of times for the RPC node to retry sending the transaction to the leader.
    If this parameter not provided, the RPC node will retry the transaction until it is finalized
    or until the blockhash expires.
    """
    last_valid_block_height: Optional[int] = None
    """Pass the latest valid block height here, to be consumed by confirm_transaction.
    Valid only if skip_confirmation is False.
    """

last_valid_block_height: Optional[int]

Pass the latest valid block height here, to be consumed by confirm_transaction. Valid only if skip_confirmation is False.

max_retries: Optional[int]

Maximum number of times for the RPC node to retry sending the transaction to the leader. If this parameter not provided, the RPC node will retry the transaction until it is finalized or until the blockhash expires.

preflight_commitment: <function NewType.<locals>.new_type at 0x7f64561da550>

Commitment level to use for preflight.

skip_confirmation: bool

If false, send_transaction will try to confirm that the transaction was successfully broadcasted.

When confirming a transaction, send_transaction will block for a maximum of 30 seconds. Wrap the call inside a thread to make it asynchronous.

skip_preflight: bool

If true, skip the preflight transaction checks.