Skip to content

RPC Types

Deprecated

The NamedTuple types in this module (DataSliceOpts, MemcmpOpts, TokenAccountOpts, TxOpts) are deprecated. Use the Pydantic models in solana.rpc.models instead — they carry the same field names and defaults, so migrating is just a matter of changing the import path.

solana.rpc.types

RPC types.

RPCMethod = NewType('RPCMethod', str) module-attribute

Type for RPC method.

URI = NewType('URI', str) module-attribute

Type for endpoint URI.

DataSliceOpts

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

Source code in src/solana/rpc/types.py
28
29
30
31
32
33
34
35
@deprecated("DataSliceOpts is deprecated; use solana.rpc.models instead.")
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 instance-attribute

Limit the returned account data using the provided length: .

offset instance-attribute

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 src/solana/rpc/types.py
38
39
40
41
42
43
44
45
@deprecated("MemcmpOpts is deprecated; use solana.rpc.models instead.")
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 instance-attribute

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

offset instance-attribute

Offset into program account data to start comparison: .

RPCError

RPC error.

Source code in src/solana/rpc/types.py
19
20
21
22
23
24
25
class RPCError(TypedDict):
    """RPC error."""

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

code instance-attribute

HTTP status code.

message instance-attribute

Error message.

TokenAccountOpts

Options when querying token accounts.

Provide one of mint or program_id.

Source code in src/solana/rpc/types.py
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
@deprecated("TokenAccountOpts is deprecated; use solana.rpc.models instead.")
class TokenAccountOpts(NamedTuple):
    """Options when querying token accounts.

    Provide one of mint or program_id.
    """

    mint: Pubkey | None = None
    """Public key of the specific token Mint to limit accounts to."""
    program_id: Pubkey | None = 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: DataSliceOpts | None = None
    """Option to limit the returned account data, only available for "base58" or "base64" encoding."""

data_slice = None class-attribute instance-attribute

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

encoding = 'base64' class-attribute instance-attribute

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

mint = None class-attribute instance-attribute

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

program_id = None class-attribute instance-attribute

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

TxOpts

Options to specify when broadcasting a transaction.

Source code in src/solana/rpc/types.py
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
@deprecated("TxOpts is deprecated; use solana.rpc.models instead.")
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: int | None = 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: int | None = 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 = None class-attribute instance-attribute

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

max_retries = None class-attribute instance-attribute

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 = Finalized class-attribute instance-attribute

Commitment level to use for preflight.

skip_confirmation = True class-attribute instance-attribute

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 = False class-attribute instance-attribute

If true, skip the preflight transaction checks.