Skip to content

RPC Models

solana.rpc.models

Pydantic models for RPC types.

ClusterUrls

A collection of urls for each cluster.

Source code in src/solana/rpc/models.py
46
47
48
49
50
51
class ClusterUrls(PydanticModel):
    """A collection of urls for each cluster."""

    devnet: str
    testnet: str
    mainnet_beta: str

DataSliceOpts

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

Source code in src/solana/rpc/models.py
12
13
14
15
16
17
18
class DataSliceOpts(PydanticModel):
    """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: .

Endpoint

Container for http and https cluster urls.

Source code in src/solana/rpc/models.py
54
55
56
57
58
class Endpoint(PydanticModel):
    """Container for http and https cluster urls."""

    http: ClusterUrls
    https: ClusterUrls

MemcmpOpts

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

Source code in src/solana/rpc/models.py
21
22
23
24
25
26
27
class MemcmpOpts(PydanticModel):
    """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: .

TokenAccountOpts

Options when querying token accounts.

Provide one of mint or program_id.

Source code in src/solana/rpc/models.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class TokenAccountOpts(PydanticModel):
    """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), "base64", or "jsonParsed"."""
    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), "base64", or "jsonParsed".

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/models.py
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
class TxOpts(PydanticModel):
    """Options to specify when broadcasting a transaction."""

    skip_confirmation: bool = True
    """If false, `send_transaction` will await confirmation that the transaction was successfully broadcasted.

    When confirming a transaction, `send_transaction` polls for the transaction status until it is confirmed,
    the blockhash expires (when `last_valid_block_height` is set), or a 90-second timeout elapses. The call is
    asynchronous, so other tasks can continue to run while awaiting confirmation.
    """
    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 await confirmation that the transaction was successfully broadcasted.

When confirming a transaction, send_transaction polls for the transaction status until it is confirmed, the blockhash expires (when last_valid_block_height is set), or a 90-second timeout elapses. The call is asynchronous, so other tasks can continue to run while awaiting confirmation.

skip_preflight = False class-attribute instance-attribute

If true, skip the preflight transaction checks.