Skip to content

RPC Types

RPC types.

RPCMethod

Type for RPC method.

URI

Type for endpoint URI.

DataSliceOpts (tuple)

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: .

__getnewargs__(self) special

Return self as a plain tuple. Used by copy and pickle.

Source code in solana/rpc/types.py
def __getnewargs__(self):
    'Return self as a plain tuple.  Used by copy and pickle.'
    return _tuple(self)

__new__(_cls, offset, length) special staticmethod

Create new instance of DataSliceOpts(offset, length)

__repr__(self) special

Return a nicely formatted representation string

Source code in solana/rpc/types.py
def __repr__(self):
    'Return a nicely formatted representation string'
    return self.__class__.__name__ + repr_fmt % self

MemcmpOpts (tuple)

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: .

__getnewargs__(self) special

Return self as a plain tuple. Used by copy and pickle.

Source code in solana/rpc/types.py
def __getnewargs__(self):
    'Return self as a plain tuple.  Used by copy and pickle.'
    return _tuple(self)

__new__(_cls, offset, bytes) special staticmethod

Create new instance of MemcmpOpts(offset, bytes)

__repr__(self) special

Return a nicely formatted representation string

Source code in solana/rpc/types.py
def __repr__(self):
    'Return a nicely formatted representation string'
    return self.__class__.__name__ + repr_fmt % self

RPCError (dict)

RPC error.

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

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

TokenAccountOpts (tuple)

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.

__getnewargs__(self) special

Return self as a plain tuple. Used by copy and pickle.

Source code in solana/rpc/types.py
def __getnewargs__(self):
    'Return self as a plain tuple.  Used by copy and pickle.'
    return _tuple(self)

__new__(_cls, mint=None, program_id=None, encoding='base64', data_slice=None) special staticmethod

Create new instance of TokenAccountOpts(mint, program_id, encoding, data_slice)

__repr__(self) special

Return a nicely formatted representation string

Source code in solana/rpc/types.py
def __repr__(self):
    'Return a nicely formatted representation string'
    return self.__class__.__name__ + repr_fmt % self

TxOpts (tuple)

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 0x7ff67e9af0d0>

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.

__getnewargs__(self) special

Return self as a plain tuple. Used by copy and pickle.

Source code in solana/rpc/types.py
def __getnewargs__(self):
    'Return self as a plain tuple.  Used by copy and pickle.'
    return _tuple(self)

__new__(_cls, skip_confirmation=True, skip_preflight=False, preflight_commitment='finalized', max_retries=None, last_valid_block_height=None) special staticmethod

Create new instance of TxOpts(skip_confirmation, skip_preflight, preflight_commitment, max_retries, last_valid_block_height)

__repr__(self) special

Return a nicely formatted representation string

Source code in solana/rpc/types.py
def __repr__(self):
    'Return a nicely formatted representation string'
    return self.__class__.__name__ + repr_fmt % self