Requests
- class GetAccountInfo
A
getAccountInfo
request.- Parameters:
pubkey (Pubkey) – Pubkey of account to query.
config (Optional[RpcAccountInfoConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetAccountInfo >>> from solders.rpc.config import RpcAccountInfoConfig >>> from solders.pubkey import Pubkey >>> from solders.account_decoder import UiAccountEncoding >>> config = RpcAccountInfoConfig(UiAccountEncoding.Base64) >>> GetAccountInfo(Pubkey.default(), config).to_json() '{"method":"getAccountInfo","jsonrpc":"2.0","id":0,"params":["11111111111111111111111111111111",{"encoding":"base64","dataSlice":null,"minContextSlot":null}]}'
- config
Extra configuration.
- Type:
Optional[RpcAccountInfoConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetBalance
A
getBalance
request.- Parameters:
pubkey (Pubkey) – Pubkey of account to query.
config (Optional[RpcContextConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetBalance >>> from solders.rpc.config import RpcContextConfig >>> from solders.pubkey import Pubkey >>> config = RpcContextConfig(min_context_slot=1) >>> GetBalance(Pubkey.default(), config).to_json() '{"method":"getBalance","jsonrpc":"2.0","id":0,"params":["11111111111111111111111111111111",{"minContextSlot":1}]}'
- config
Extra configuration.
- Type:
Optional[RpcContextConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetBlock
A
getBlock
request.- Parameters:
slot (int) – The slot to query.
config (Optional[RpcBlockConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetBlock >>> from solders.rpc.config import RpcBlockConfig >>> from solders.transaction_status import TransactionDetails, UiTransactionEncoding >>> config = RpcBlockConfig(encoding=UiTransactionEncoding.Base58, transaction_details=TransactionDetails.None_) >>> GetBlock(123, config).to_json() '{"method":"getBlock","jsonrpc":"2.0","id":0,"params":[123,{"encoding":"base58","transactionDetails":"none","rewards":null,"maxSupportedTransactionVersion":null}]}'
- config
Extra configuration.
- Type:
Optional[RpcBlockConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- slot
The slot to query.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetBlockHeight
A
getBlockHeight
request.- Parameters:
config (Optional[RpcContextConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetBlockHeight >>> from solders.rpc.config import RpcContextConfig >>> config = RpcContextConfig(min_context_slot=123) >>> GetBlockHeight(config).to_json() '{"method":"getBlockHeight","jsonrpc":"2.0","id":0,"params":[{"minContextSlot":123}]}'
- config
Extra configuration.
- Type:
Optional[RpcContextConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetBlockProduction
A
getBlockProduction
request.- Parameters:
config (Optional[RpcBlockProductionConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetBlockProduction >>> from solders.rpc.config import RpcBlockProductionConfig, RpcBlockProductionConfigRange >>> from solders.pubkey import Pubkey >>> slot_range = RpcBlockProductionConfigRange(first_slot=10, last_slot=15) >>> config = RpcBlockProductionConfig(identity=Pubkey.default(), range=slot_range) >>> GetBlockProduction(config).to_json() '{"method":"getBlockProduction","jsonrpc":"2.0","id":0,"params":[{"identity":"11111111111111111111111111111111","range":{"firstSlot":10,"lastSlot":15}}]}'
- config
Extra configuration.
- Type:
Optional[RpcBlockProductionConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetBlockCommitment
A
getBlockCommitment
request.- Parameters:
slot (int) – The slot to query.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetBlockCommitment >>> GetBlockCommitment(123).to_json() '{"method":"getBlockCommitment","jsonrpc":"2.0","id":0,"params":[123]}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- slot
The slot to query.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetBlocks
A
getBlocks
request.- Parameters:
start (int) – The start slot.
end (Optional[int]) – The end slot.
commitment (Optional[CommitmentLevel]) – Bank state to query.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetBlocks >>> from solders.commitment_config import CommitmentLevel >>> GetBlocks(123, commitment=CommitmentLevel.Processed).to_json() '{"method":"getBlocks","jsonrpc":"2.0","id":0,"params":[123,null,{"commitment":"processed"}]}'
- commitment
Bank state to query.
- Type:
Optional[CommitmentLevel]
- end
The end slot.
- Type:
Optional[int]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- start
The start slot.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetBlocksWithLimit
A
getBlocksWithLimit
request.- Parameters:
start (int) – The start slot.
limit (Optional[int]) – Maximum number of blocks.
commitment (Optional[CommitmentLevel]) – Bank state to query.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetBlocksWithLimit >>> from solders.commitment_config import CommitmentLevel >>> GetBlocksWithLimit(123, 5, commitment=CommitmentLevel.Processed).to_json() '{"method":"getBlocksWithLimit","jsonrpc":"2.0","id":0,"params":[123,5,{"commitment":"processed"}]}'
- commitment
Bank state to query.
- Type:
Optional[CommitmentLevel]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- limit
Maximum number of blocks.
- Type:
Optional[int]
- start
The start slot.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetBlockTime
A
getBlockTime
request.- Parameters:
slot (int) – The slot to query.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetBlockTime >>> GetBlockTime(123).to_json() '{"method":"getBlockTime","jsonrpc":"2.0","id":0,"params":[123]}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- slot
The slot to query.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetClusterNodes
getClusterNodes
request.- Parameters:
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetClusterNodes >>> GetClusterNodes(123).to_json() '{"method":"getClusterNodes","jsonrpc":"2.0","id":123}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetEpochInfo
A
getEpochInfo
request.- Parameters:
config (Optional[RpcContextConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetEpochInfo >>> from solders.rpc.config import RpcContextConfig >>> from solders.commitment_config import CommitmentLevel >>> config = RpcContextConfig(commitment=CommitmentLevel.Processed) >>> GetEpochInfo(config).to_json() '{"method":"getEpochInfo","jsonrpc":"2.0","id":0,"params":[{"commitment":"processed","minContextSlot":null}]}'
- config
Extra configuration.
- Type:
Optional[RpcContextConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetEpochSchedule
getEpochSchedule
request.- Parameters:
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetEpochSchedule >>> GetEpochSchedule(123).to_json() '{"method":"getEpochSchedule","jsonrpc":"2.0","id":123}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetFeeForMessage
A
getFeeForMessage
request.- Parameters:
message (VersionedMessage) – The message for which to calculate the fee.
commitment (Optional[CommitmentLevel]) – Bank state to query.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetFeeForMessage >>> from solders.commitment_config import CommitmentLevel >>> from solders.message import MessageV0 >>> GetFeeForMessage(MessageV0.default(), commitment=CommitmentLevel.Processed).to_json() '{"method":"getFeeForMessage","jsonrpc":"2.0","id":0,"params":["gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",{"commitment":"processed"}]}'
- commitment
Bank state to query.
- Type:
Optional[CommitmentLevel]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- message
The message for which to calculate the fee.
- Type:
VersionedMessage
- to_json()
Convert to a JSON string.
- class GetFirstAvailableBlock
getFirstAvailableBlock
request.- Parameters:
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetFirstAvailableBlock >>> GetFirstAvailableBlock(123).to_json() '{"method":"getFirstAvailableBlock","jsonrpc":"2.0","id":123}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetGenesisHash
getGenesisHash
request.- Parameters:
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetGenesisHash >>> GetGenesisHash(123).to_json() '{"method":"getGenesisHash","jsonrpc":"2.0","id":123}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetHealth
getHealth
request.- Parameters:
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetHealth >>> GetHealth(123).to_json() '{"method":"getHealth","jsonrpc":"2.0","id":123}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetHighestSnapshotSlot
getHighestSnapshotSlot
request.- Parameters:
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetHighestSnapshotSlot >>> GetHighestSnapshotSlot(123).to_json() '{"method":"getHighestSnapshotSlot","jsonrpc":"2.0","id":123}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetIdentity
getIdentity
request.- Parameters:
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetIdentity >>> GetIdentity(123).to_json() '{"method":"getIdentity","jsonrpc":"2.0","id":123}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetInflationGovernor
A
getInflationGovernor
request.- Parameters:
config (Optional[CommitmentLevel]) – Bank state to query.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetInflationGovernor >>> from solders.commitment_config import CommitmentLevel >>> GetInflationGovernor(CommitmentLevel.Finalized).to_json() '{"method":"getInflationGovernor","jsonrpc":"2.0","id":0,"params":[{"commitment":"finalized"}]}'
- commitment
Bank state to query.
- Type:
Optional[CommitmentLevel]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetInflationRate
getInflationRate
request.- Parameters:
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetInflationRate >>> GetInflationRate(123).to_json() '{"method":"getInflationRate","jsonrpc":"2.0","id":123}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetInflationReward
A
getInflationReward
request.- Parameters:
addresses (Optional[Sequence[Pubkey]]) – Addresses to query.
config (Optional[RpcEpochConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetInflationReward >>> from solders.rpc.config import RpcEpochConfig >>> from solders.pubkey import Pubkey >>> config = RpcEpochConfig(epoch=1234) >>> addresses = [Pubkey.default(), Pubkey.default()] >>> GetInflationReward(addresses, config).to_json() '{"method":"getInflationReward","jsonrpc":"2.0","id":0,"params":[["11111111111111111111111111111111","11111111111111111111111111111111"],{"epoch":1234,"minContextSlot":null}]}'
- config
Extra configuration.
- Type:
Optional[RpcEpochConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetLargestAccounts
A
getLargestAccounts
request.- Parameters:
commitment (Optional[CommitmentLevel]) – Bank state to query.
filter (Optional[RpcLargestAccountsFilter]) – Filter results by account type.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetLargestAccounts >>> from solders.rpc.config import RpcLargestAccountsFilter >>> from solders.commitment_config import CommitmentLevel >>> commitment = CommitmentLevel.Processed >>> filter_ = RpcLargestAccountsFilter.Circulating >>> GetLargestAccounts(commitment=commitment, filter_=filter_).to_json() '{"method":"getLargestAccounts","jsonrpc":"2.0","id":0,"params":[{"commitment":"processed"},"circulating"]}'
- commitment
Bank state to query.
- Type:
Optional[CommitmentLevel]
- filter_
Filter results by account type.
- Type:
Optional[RpcLargestAccountsFilter]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetLatestBlockhash
A
getLatestBlockhash
request.- Parameters:
config (Optional[RpcContextConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetLatestBlockhash >>> from solders.rpc.config import RpcContextConfig >>> from solders.commitment_config import CommitmentLevel >>> config = RpcContextConfig(commitment=CommitmentLevel.Processed) >>> GetLatestBlockhash(config).to_json() '{"method":"getLatestBlockhash","jsonrpc":"2.0","id":0,"params":[{"commitment":"processed","minContextSlot":null}]}'
- config
Extra configuration.
- Type:
Optional[RpcContextConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetLeaderSchedule
A
GetLeaderSchedule
request.- Parameters:
slot (Optional[int]) – The slot to query.
config (Optional[RpcLeaderScheduleConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetLeaderSchedule >>> from solders.rpc.config import RpcLeaderScheduleConfig >>> from solders.pubkey import Pubkey >>> config = RpcLeaderScheduleConfig(identity=Pubkey.default()) >>> GetLeaderSchedule(123, config).to_json() '{"method":"getLeaderSchedule","jsonrpc":"2.0","id":0,"params":[123,{"identity":"11111111111111111111111111111111"}]}'
- config
Extra configuration.
- Type:
Optional[RpcLeaderScheduleConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- slot
The slot to query.
- Type:
Optional[int]
- to_json()
Convert to a JSON string.
- class GetMaxRetransmitSlot
getMaxRetransmitSlot
request.- Parameters:
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetMaxRetransmitSlot >>> GetMaxRetransmitSlot(123).to_json() '{"method":"getMaxRetransmitSlot","jsonrpc":"2.0","id":123}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetMaxShredInsertSlot
getMaxShredInsertSlot
request.- Parameters:
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetMaxShredInsertSlot >>> GetMaxShredInsertSlot(123).to_json() '{"method":"getMaxShredInsertSlot","jsonrpc":"2.0","id":123}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetMinimumBalanceForRentExemption
A
getMinimumBalanceForRentExemption
request.- Parameters:
length (int) – Acccount data length
commitment (Optional[CommitmentLevel]) – Bank state to query.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetMinimumBalanceForRentExemption >>> GetMinimumBalanceForRentExemption(50).to_json() '{"method":"getMinimumBalanceForRentExemption","jsonrpc":"2.0","id":0,"params":[50]}'
- commitment
Bank state to query.
- Type:
Optional[CommitmentLevel]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- length
Acccount data length
- Type:
int
- to_json()
Convert to a JSON string.
- class GetMultipleAccounts
A
getMultipleAccounts
request.- Parameters:
accounts (Sequence[Pubkey]) – Accounts to query.
config (Optional[RpcAccountInfoConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetMultipleAccounts >>> from solders.rpc.config import RpcAccountInfoConfig >>> from solders.commitment_config import CommitmentLevel >>> from solders.pubkey import Pubkey >>> from solders.account_decoder import UiAccountEncoding, UiDataSliceConfig >>> encoding = UiAccountEncoding.Base64Zstd >>> data_slice = UiDataSliceConfig(10, 8) >>> config = RpcAccountInfoConfig(encoding=encoding, data_slice=data_slice) >>> accounts = [Pubkey.default(), Pubkey.default()] >>> GetMultipleAccounts(accounts, config).to_json() '{"method":"getMultipleAccounts","jsonrpc":"2.0","id":0,"params":[["11111111111111111111111111111111","11111111111111111111111111111111"],{"encoding":"base64+zstd","dataSlice":{"offset":10,"length":8},"minContextSlot":null}]}'
- config
Extra configuration.
- Type:
Optional[RpcAccountInfoConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetProgramAccounts
A
getProgramAccounts
request.- Parameters:
program (Pubkey) – The program that owns the accounts
config (Optional[RpcProgramAccountsConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetProgramAccounts >>> from solders.rpc.config import RpcProgramAccountsConfig, RpcAccountInfoConfig >>> from solders.rpc.filter import Memcmp >>> from solders.pubkey import Pubkey >>> acc_info_config = RpcAccountInfoConfig.default() >>> filters = [10, Memcmp(offset=10, bytes_=b"123")] >>> config = RpcProgramAccountsConfig(acc_info_config, filters) >>> GetProgramAccounts(Pubkey.default(), config).to_json() '{"method":"getProgramAccounts","jsonrpc":"2.0","id":0,"params":["11111111111111111111111111111111",{"filters":[{"dataSize":10},{"memcmp":{"offset":10,"encoding":"bytes","bytes":[49,50,51]}}],"encoding":null,"dataSlice":null,"minContextSlot":null,"withContext":null,"sortResults":null}]}'
- config
Extra configuration.
- Type:
Optional[RpcProgramAccountsConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetRecentPerformanceSamples
A
getRecentPerformanceSamples
request.- Parameters:
limit (int) – Number of samples to return (maximum 720).
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetRecentPerformanceSamples >>> GetRecentPerformanceSamples(5).to_json() '{"method":"getRecentPerformanceSamples","jsonrpc":"2.0","id":0,"params":[5]}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- limit
Number of samples to return.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetSignaturesForAddress
A
getSignaturesForAddress
request.- Parameters:
address (Pubkey) – The address by which to filter transactions.
config (Optional[RpcSignaturesForAddressConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetSignaturesForAddress >>> from solders.rpc.config import RpcSignaturesForAddressConfig >>> config = RpcSignaturesForAddressConfig(limit=10) >>> GetSignaturesForAddress(Pubkey.default(), config).to_json() '{"method":"getSignaturesForAddress","jsonrpc":"2.0","id":0,"params":["11111111111111111111111111111111",{"before":null,"until":null,"limit":10,"minContextSlot":null}]}'
- config
Extra configuration
- Type:
Optional[RpcSignaturesForAddressConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetSignatureStatuses
A
getSignatureStatuses
request.- Parameters:
signatures (Sequence[Signature]) – The signatures to query.
config (Optional[RpcSignatureStatusConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetSignatureStatuses >>> from solders.signature import Signature >>> from solders.rpc.config import RpcSignatureStatusConfig >>> config = RpcSignatureStatusConfig(search_transaction_history=True) >>> GetSignatureStatuses([Signature.default()], config).to_json() '{"method":"getSignatureStatuses","jsonrpc":"2.0","id":0,"params":[["1111111111111111111111111111111111111111111111111111111111111111"],{"searchTransactionHistory":true}]}'
- config
Extra configuration.
- Type:
Optional[RpcSignatureStatusConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetSlot
A
getSlot
request.- Parameters:
config (Optional[RpcContextConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetSlot >>> from solders.rpc.config import RpcContextConfig >>> config = RpcContextConfig(min_context_slot=123) >>> GetSlot(config).to_json() '{"method":"getSlot","jsonrpc":"2.0","id":0,"params":[{"minContextSlot":123}]}'
- config
Extra configuration.
- Type:
Optional[RpcContextConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetSlotLeader
A
getSlotLeader
request.- Parameters:
config (Optional[RpcContextConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetSlotLeader >>> from solders.rpc.config import RpcContextConfig >>> config = RpcContextConfig(min_context_slot=123) >>> GetSlotLeader(config).to_json() '{"method":"getSlotLeader","jsonrpc":"2.0","id":0,"params":[{"minContextSlot":123}]}'
- config
Extra configuration.
- Type:
Optional[RpcContextConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetSlotLeaders
A
getSlotLeaders
request.- Parameters:
start (int) – The start slot.
limit (int) – The number of leaders to return.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetSlotLeaders >>> GetSlotLeaders(100, 10).to_json() '{"method":"getSlotLeaders","jsonrpc":"2.0","id":0,"params":[100,10]}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- limit
The number of leaders to return.
- Type:
int
- start
The start slot.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetStakeActivation
A
getStakeActivation
request.- Parameters:
account (Pubkey) – The stake account to query.
config (Optional[RpcEpochConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetStakeActivation >>> from solders.rpc.config import RpcEpochConfig >>> from solders.pubkey import Pubkey >>> config = RpcEpochConfig(epoch=1234) >>> GetStakeActivation(Pubkey.default(), config).to_json() '{"method":"getStakeActivation","jsonrpc":"2.0","id":0,"params":["11111111111111111111111111111111",{"epoch":1234,"minContextSlot":null}]}'
- config
Extra configuration.
- Type:
Optional[RpcEpochConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetSupply
A
getSupply
request.- Parameters:
config (Optional[RpcSupplyConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetSupply >>> from solders.rpc.config import RpcSupplyConfig >>> config = RpcSupplyConfig(exclude_non_circulating_accounts_list=True) >>> GetSupply(config).to_json() '{"method":"getSupply","jsonrpc":"2.0","id":0,"params":[{"excludeNonCirculatingAccountsList":true}]}'
- config
Extra configuration.
- Type:
Optional[RpcSupplyConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetTokenAccountBalance
A
getTokenAccountBalance
request.- Parameters:
account (Pubkey) – The token account to query.
commitment (Optional[CommitmentLevel]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetTokenAccountBalance >>> from solders.commitment_config import CommitmentLevel >>> from solders.pubkey import Pubkey >>> GetTokenAccountBalance(Pubkey.default(), CommitmentLevel.Processed).to_json() '{"method":"getTokenAccountBalance","jsonrpc":"2.0","id":0,"params":["11111111111111111111111111111111",{"commitment":"processed"}]}'
- commitment
Bank state to query.
- Type:
Optional[CommitmentLevel]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetTokenAccountsByDelegate
A
getTokenAccountsByDelegate
request.- Parameters:
account (Pubkey) – The account delegate to query.
filter (RpcTokenAccountsFilterMint | RpcTokenAccountsFilterProgramId) – Filter by either token mint or token program.
config (Optional[RpcAccountInfoConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetTokenAccountsByDelegate >>> from solders.rpc.config import RpcTokenAccountsFilterProgramId, RpcAccountInfoConfig >>> from solders.pubkey import Pubkey >>> program_filter = RpcTokenAccountsFilterProgramId(Pubkey.from_string("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")) >>> config = RpcAccountInfoConfig(min_context_slot=1234) >>> req = GetTokenAccountsByDelegate(Pubkey.default(), program_filter, config) >>> req.to_json() '{"method":"getTokenAccountsByDelegate","jsonrpc":"2.0","id":0,"params":["11111111111111111111111111111111",{"programId":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"encoding":null,"dataSlice":null,"minContextSlot":1234}]}' >>> req.filter_ RpcTokenAccountsFilterProgramId( Pubkey( TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA, ), )
- config
Extra configuration.
- Type:
Optional[RpcAccountInfoConfig]
- filter_
Filter by either token mint or token program.
- Type:
RpcTokenAccountsFilterWrapper
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetTokenAccountsByOwner
A
getTokenAccountsByOwner
request.- Parameters:
account (Pubkey) – The account owner to query.
filter (RpcTokenAccountsFilterMint | RpcTokenAccountsFilterProgramId) – Filter by either token mint or token program.
config (Optional[RpcAccountInfoConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetTokenAccountsByOwner >>> from solders.rpc.config import RpcTokenAccountsFilterMint, RpcAccountInfoConfig >>> from solders.pubkey import Pubkey >>> mint_filter = RpcTokenAccountsFilterMint(Pubkey.default()) >>> config = RpcAccountInfoConfig(min_context_slot=1234) >>> req = GetTokenAccountsByOwner(Pubkey.default(), mint_filter, config) >>> req.to_json() '{"method":"getTokenAccountsByOwner","jsonrpc":"2.0","id":0,"params":["11111111111111111111111111111111",{"mint":"11111111111111111111111111111111"},{"encoding":null,"dataSlice":null,"minContextSlot":1234}]}' >>> req.filter_ RpcTokenAccountsFilterMint( Pubkey( 11111111111111111111111111111111, ), )
- config
Extra configuration.
- Type:
Optional[RpcAccountInfoConfig]
- filter_
Filter by either token mint or token program.
- Type:
RpcTokenAccountsFilterWrapper
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetTokenLargestAccounts
A
getTokenLargestAccounts
request.- Parameters:
mint (Pubkey) – The token mint to query.
commitment (Optional[CommitmentLevel]) – Bank state to query.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetTokenLargestAccounts >>> from solders.pubkey import Pubkey >>> GetTokenLargestAccounts(Pubkey.default()).to_json() '{"method":"getTokenLargestAccounts","jsonrpc":"2.0","id":0,"params":["11111111111111111111111111111111"]}'
- commitment
Bank state to query.
- Type:
Optional[CommitmentLevel]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetTokenSupply
A
getTokenSupply
request.- Parameters:
mint (Pubkey) – The token mint to query.
commitment (Optional[CommitmentLevel]) – Bank state to query.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetTokenSupply >>> from solders.pubkey import Pubkey >>> GetTokenSupply(Pubkey.default()).to_json() '{"method":"getTokenSupply","jsonrpc":"2.0","id":0,"params":["11111111111111111111111111111111"]}'
- commitment
Bank state to query.
- Type:
Optional[CommitmentLevel]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetTransaction
A
getTransaction
request.- Parameters:
signature (Signature) – The transaction signature to query.
config (Optional[RpcTransactionConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetTransaction >>> from solders.rpc.config import RpcTransactionConfig >>> from solders.signature import Signature >>> config = RpcTransactionConfig(max_supported_transaction_version=1) >>> GetTransaction(Signature.default(), config).to_json() '{"method":"getTransaction","jsonrpc":"2.0","id":0,"params":["1111111111111111111111111111111111111111111111111111111111111111",{"encoding":null,"maxSupportedTransactionVersion":1}]}'
- config
Extra configuration.
- Type:
Optional[RpcTransactionConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetTransactionCount
A
getTransactionCount
request.- Parameters:
config (Optional[RpcContextConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetTransactionCount >>> from solders.rpc.config import RpcContextConfig >>> config = RpcContextConfig(min_context_slot=1234) >>> GetTransactionCount(config).to_json() '{"method":"getTransactionCount","jsonrpc":"2.0","id":0,"params":[{"minContextSlot":1234}]}'
- config
Extra configuration.
- Type:
Optional[RpcContextConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetVersion
getVersion
request.- Parameters:
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetVersion >>> GetVersion(123).to_json() '{"method":"getVersion","jsonrpc":"2.0","id":123}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class GetVoteAccounts
A
getVoteAccounts
request.- Parameters:
config (Optional[RpcGetVoteAccountsConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import GetVoteAccounts >>> from solders.rpc.config import RpcGetVoteAccountsConfig >>> config = RpcGetVoteAccountsConfig(keep_unstaked_delinquents=False) >>> GetVoteAccounts(config).to_json() '{"method":"getVoteAccounts","jsonrpc":"2.0","id":0,"params":[{"votePubkey":null,"keepUnstakedDelinquents":false,"delinquentSlotDistance":null}]}'
- config
Extra configuration.
- Type:
Optional[RpcGetVoteAccountsConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class IsBlockhashValid
An
isBlockhashValid
request.- Parameters:
blockhash (Hash) – The blockhash to check.
config (Optional[RpcContextConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import IsBlockhashValid >>> from solders.hash import Hash >>> IsBlockhashValid(Hash.default()).to_json() '{"method":"isBlockhashValid","jsonrpc":"2.0","id":0,"params":["11111111111111111111111111111111"]}'
- config
Extra configuration.
- Type:
Optional[RpcContextConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class MinimumLedgerSlot
minimumLedgerSlot
request.- Parameters:
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import MinimumLedgerSlot >>> MinimumLedgerSlot(123).to_json() '{"method":"minimumLedgerSlot","jsonrpc":"2.0","id":123}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class RequestAirdrop
A
requestAirdrop
request.- Parameters:
pubkey (Pubkey) – Pubkey of account to receive lamports.
lamports (int) – How many lamports to airdrop.
config (Optional[RpcRequestAirdropConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import RequestAirdrop >>> from solders.rpc.config import RpcRequestAirdropConfig >>> from solders.pubkey import Pubkey >>> from solders.commitment_config import CommitmentLevel >>> config = RpcRequestAirdropConfig(commitment=CommitmentLevel.Confirmed) >>> RequestAirdrop(Pubkey.default(), 1000, config).to_json() '{"method":"requestAirdrop","jsonrpc":"2.0","id":0,"params":["11111111111111111111111111111111",1000,{"recentBlockhash":null,"commitment":"confirmed"}]}'
- config
Extra configuration.
- Type:
Optional[RpcRequestAirdropConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- lamports
How many lamports to airdrop.
- Type:
int
- to_json()
Convert to a JSON string.
- class SendLegacyTransaction
A
sendTransaction
request.- Parameters:
tx (Transaction) – The signed transaction to send.
config (Optional[RpcSendTransactionConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from typing import List >>> from solders.rpc.requests import SendLegacyTransaction >>> from solders.rpc.config import RpcSendTransactionConfig >>> from solders.transaction import Transaction >>> from solders.message import Message >>> from solders.keypair import Keypair >>> from solders.instruction import Instruction, AccountMeta >>> from solders.hash import Hash >>> from solders.pubkey import Pubkey >>> from solders.commitment_config import CommitmentLevel >>> program_id = Pubkey.default() >>> arbitrary_instruction_data = b"abc" >>> accounts: List[AccountMeta] = [] >>> instruction = Instruction(program_id, arbitrary_instruction_data, accounts) >>> seed = bytes([1] * 32) >>> payer = Keypair.from_seed(seed) >>> message = Message([instruction], payer.pubkey()) >>> blockhash = Hash.default() # replace with a real blockhash >>> tx = Transaction([payer], message, blockhash) >>> commitment = CommitmentLevel.Confirmed >>> config = RpcSendTransactionConfig(preflight_commitment=commitment) >>> SendLegacyTransaction(tx, config).to_json() '{"method":"sendTransaction","jsonrpc":"2.0","id":0,"params":["AaVkKDb3UlpidO/ucBnOcmS+1dY8ZAC4vHxTxiccV8zPBlupuozppRjwrILZJaoKggAcVSD1XlAKstDVEPFOVgwBAAECiojj3XQJ8ZX9UtstPLpdcspnCb8dlBIb83SIAbQPb1wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAA2FiYw==",{"skipPreflight":false,"preflightCommitment":"confirmed","encoding":"base64","maxRetries":null,"minContextSlot":null}]}'
- config
Extra configuration.
- Type:
Optional[RpcSendTransactionConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- tx
The signed transaction to send.
- Type:
- class SendRawTransaction
A raw
sendTransaction
request.- Parameters:
tx (bytes) – The signed, serialized transaction to send.
config (Optional[RpcSendTransactionConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from typing import List >>> from solders.rpc.requests import SendRawTransaction >>> from solders.rpc.config import RpcSendTransactionConfig >>> from solders.transaction import Transaction >>> from solders.message import Message >>> from solders.keypair import Keypair >>> from solders.instruction import Instruction, AccountMeta >>> from solders.hash import Hash >>> from solders.pubkey import Pubkey >>> from solders.commitment_config import CommitmentLevel >>> program_id = Pubkey.default() >>> arbitrary_instruction_data = b"abc" >>> accounts: List[AccountMeta] = [] >>> instruction = Instruction(program_id, arbitrary_instruction_data, accounts) >>> seed = bytes([1] * 32) >>> payer = Keypair.from_seed(seed) >>> message = Message([instruction], payer.pubkey()) >>> blockhash = Hash.default() # replace with a real blockhash >>> tx = Transaction([payer], message, blockhash) >>> commitment = CommitmentLevel.Confirmed >>> config = RpcSendTransactionConfig(preflight_commitment=commitment) >>> SendRawTransaction(bytes(tx), config).to_json() '{"method":"sendTransaction","jsonrpc":"2.0","id":0,"params":["AaVkKDb3UlpidO/ucBnOcmS+1dY8ZAC4vHxTxiccV8zPBlupuozppRjwrILZJaoKggAcVSD1XlAKstDVEPFOVgwBAAECiojj3XQJ8ZX9UtstPLpdcspnCb8dlBIb83SIAbQPb1wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAA2FiYw==",{"skipPreflight":false,"preflightCommitment":"confirmed","encoding":"base64","maxRetries":null,"minContextSlot":null}]}'
- config
Extra configuration.
- Type:
Optional[RpcSendTransactionConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- tx
The raw signed transaction to send.
- Type:
List[int]
- class SendVersionedTransaction
A
sendTransaction
request.- Parameters:
tx (VersionedTransaction) – The signed transaction to send.
config (Optional[RpcSendTransactionConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from typing import List >>> from solders.rpc.requests import SendVersionedTransaction >>> from solders.rpc.config import RpcSendTransactionConfig >>> from solders.transaction import VersionedTransaction >>> from solders.message import Message >>> from solders.keypair import Keypair >>> from solders.instruction import Instruction, AccountMeta >>> from solders.hash import Hash >>> from solders.pubkey import Pubkey >>> from solders.commitment_config import CommitmentLevel >>> program_id = Pubkey.default() >>> arbitrary_instruction_data = b"abc" >>> accounts: List[AccountMeta] = [] >>> instruction = Instruction(program_id, arbitrary_instruction_data, accounts) >>> seed = bytes([1] * 32) >>> payer = Keypair.from_seed(seed) >>> blockhash = Hash.default() # replace with a real blockhash >>> message = Message.new_with_blockhash([instruction], payer.pubkey(), blockhash) >>> tx = VersionedTransaction(message, [payer]) >>> commitment = CommitmentLevel.Confirmed >>> config = RpcSendTransactionConfig(preflight_commitment=commitment) >>> SendVersionedTransaction(tx, config).to_json() '{"method":"sendTransaction","jsonrpc":"2.0","id":0,"params":["AaVkKDb3UlpidO/ucBnOcmS+1dY8ZAC4vHxTxiccV8zPBlupuozppRjwrILZJaoKggAcVSD1XlAKstDVEPFOVgwBAAECiojj3XQJ8ZX9UtstPLpdcspnCb8dlBIb83SIAbQPb1wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAA2FiYw==",{"skipPreflight":false,"preflightCommitment":"confirmed","encoding":"base64","maxRetries":null,"minContextSlot":null}]}'
- config
Extra configuration.
- Type:
Optional[RpcSendTransactionConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- tx
The signed transaction to send.
- Type:
- class ValidatorExit
validatorExit
request.- Parameters:
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import ValidatorExit >>> ValidatorExit(123).to_json() '{"method":"validatorExit","jsonrpc":"2.0","id":123}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class AccountSubscribe
An
accountSubscribe
request.- Parameters:
account (Pubkey) – Account to watch.
config (Optional[RpcAccountInfoConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import AccountSubscribe >>> from solders.rpc.config import RpcAccountInfoConfig >>> from solders.pubkey import Pubkey >>> from solders.account_decoder import UiAccountEncoding >>> config = RpcAccountInfoConfig(UiAccountEncoding.Base64) >>> AccountSubscribe(Pubkey.default(), config).to_json() '{"method":"accountSubscribe","jsonrpc":"2.0","id":0,"params":["11111111111111111111111111111111",{"encoding":"base64","dataSlice":null,"minContextSlot":null}]}'
- config
Extra configuration.
- Type:
Optional[RpcAccountInfoConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class BlockSubscribe
A
blockSubscribe
request.- Parameters:
filter (RpcBlockSubscribeFilter | RpcBlockSubscribeFilterMentions) – Filter criteria for the logs to receive results by account type.
config (Optional[RpcBlockSubscribeConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import BlockSubscribe >>> from solders.rpc.config import RpcBlockSubscribeConfig, RpcBlockSubscribeFilter, RpcBlockSubscribeFilterMentions >>> from solders.pubkey import Pubkey >>> from solders.commitment_config import CommitmentLevel >>> from solders.transaction_status import TransactionDetails >>> config = RpcBlockSubscribeConfig(transaction_details=TransactionDetails.Signatures) >>> BlockSubscribe(RpcBlockSubscribeFilter.All, config).to_json() '{"method":"blockSubscribe","jsonrpc":"2.0","id":0,"params":["all",{"encoding":null,"transactionDetails":"signatures","showRewards":null,"maxSupportedTransactionVersion":null}]}' >>> BlockSubscribe(RpcBlockSubscribeFilterMentions(Pubkey.default()), config).to_json() '{"method":"blockSubscribe","jsonrpc":"2.0","id":0,"params":[{"mentionsAccountOrProgram":"11111111111111111111111111111111"},{"encoding":null,"transactionDetails":"signatures","showRewards":null,"maxSupportedTransactionVersion":null}]}'
- config
Extra configuration.
- Type:
Optional[RpcBlockSubscribeConfig]
- filter_
The filter being applied.
- Type:
Union[RpcBlockSubscribeFilter | RpcBlockSubscribeFilterMentions]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class LogsSubscribe
A
logsSubscribe
request.- Parameters:
filter (RpcTransactionLogsFilter | RpcTransactionLogsFilterMentions) – Filter criteria for the logs to receive results by account type.
config (Optional[RpcTransactionLogsConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import LogsSubscribe >>> from solders.rpc.config import RpcTransactionLogsConfig, RpcTransactionLogsFilter, RpcTransactionLogsFilterMentions >>> from solders.pubkey import Pubkey >>> from solders.commitment_config import CommitmentLevel >>> config = RpcTransactionLogsConfig(commitment=CommitmentLevel.Confirmed) >>> LogsSubscribe(RpcTransactionLogsFilter.All, config).to_json() '{"method":"logsSubscribe","jsonrpc":"2.0","id":0,"params":["all",{"commitment":"confirmed"}]}' >>> LogsSubscribe(RpcTransactionLogsFilterMentions(Pubkey.default()), config).to_json() '{"method":"logsSubscribe","jsonrpc":"2.0","id":0,"params":[{"mentions":["11111111111111111111111111111111"]},{"commitment":"confirmed"}]}'
- config
Extra configuration.
- Type:
Optional[RpcTransactionLogsConfig]
- filter_
The filter being applied.
- Type:
Union[RpcTransactionLogsFilter | RpcTransactionLogsFilterMentions]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class ProgramSubscribe
A
programSubscribe
request.- Parameters:
program (Pubkey) – The program that owns the accounts
config (Optional[RpcProgramAccountsConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import ProgramSubscribe >>> from solders.rpc.config import RpcProgramAccountsConfig, RpcAccountInfoConfig >>> from solders.rpc.filter import Memcmp >>> from solders.pubkey import Pubkey >>> acc_info_config = RpcAccountInfoConfig.default() >>> filters = [10, Memcmp(offset=10, bytes_=b"123")] >>> config = RpcProgramAccountsConfig(acc_info_config, filters) >>> ProgramSubscribe(Pubkey.default(), config).to_json() '{"method":"programSubscribe","jsonrpc":"2.0","id":0,"params":["11111111111111111111111111111111",{"filters":[{"dataSize":10},{"memcmp":{"offset":10,"encoding":"bytes","bytes":[49,50,51]}}],"encoding":null,"dataSlice":null,"minContextSlot":null,"withContext":null,"sortResults":null}]}'
- config
Extra configuration.
- Type:
Optional[RpcProgramAccountsConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class SignatureSubscribe
A
signatureSubscribe
request.- Parameters:
signature (Signature) – The transaction to watch.
config (Optional[RpcSignatureSubscribeConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import SignatureSubscribe >>> from solders.rpc.config import RpcSignatureSubscribeConfig >>> from solders.signature import Signature >>> config = RpcSignatureSubscribeConfig(enable_received_notification=False) >>> SignatureSubscribe(Signature.default(), config).to_json() '{"method":"signatureSubscribe","jsonrpc":"2.0","id":0,"params":["1111111111111111111111111111111111111111111111111111111111111111",{"enableReceivedNotification":false}]}'
- config
Extra configuration.
- Type:
Optional[RpcSignatureSubscribeConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class SlotSubscribe
slotSubscribe
request.- Parameters:
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import SlotSubscribe >>> SlotSubscribe(123).to_json() '{"method":"slotSubscribe","jsonrpc":"2.0","id":123}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class SlotsUpdatesSubscribe
slotsUpdatesSubscribe
request.- Parameters:
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import SlotsUpdatesSubscribe >>> SlotsUpdatesSubscribe(123).to_json() '{"method":"slotsUpdatesSubscribe","jsonrpc":"2.0","id":123}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class RootSubscribe
rootSubscribe
request.- Parameters:
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import RootSubscribe >>> RootSubscribe(123).to_json() '{"method":"rootSubscribe","jsonrpc":"2.0","id":123}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class VoteSubscribe
voteSubscribe
request.- Parameters:
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import VoteSubscribe >>> VoteSubscribe(123).to_json() '{"method":"voteSubscribe","jsonrpc":"2.0","id":123}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- class AccountUnsubscribe
accountUnsubscribe
request.- Parameters:
subscription_id (int) – ID of subscription to cancel
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import AccountUnsubscribe >>> AccountUnsubscribe(1, 2).to_json() '{"method":"accountUnsubscribe","jsonrpc":"2.0","id":2,"params":[1]}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- subscription_id
ID of subscription to cancel
- Type:
int
- to_json()
Convert to a JSON string.
- class BlockUnsubscribe
blockUnsubscribe
request.- Parameters:
subscription_id (int) – ID of subscription to cancel
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import BlockUnsubscribe >>> BlockUnsubscribe(1, 2).to_json() '{"method":"blockUnsubscribe","jsonrpc":"2.0","id":2,"params":[1]}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- subscription_id
ID of subscription to cancel
- Type:
int
- to_json()
Convert to a JSON string.
- class LogsUnsubscribe
logsUnsubscribe
request.- Parameters:
subscription_id (int) – ID of subscription to cancel
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import LogsUnsubscribe >>> LogsUnsubscribe(1, 2).to_json() '{"method":"logsUnsubscribe","jsonrpc":"2.0","id":2,"params":[1]}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- subscription_id
ID of subscription to cancel
- Type:
int
- to_json()
Convert to a JSON string.
- class ProgramUnsubscribe
programUnsubscribe
request.- Parameters:
subscription_id (int) – ID of subscription to cancel
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import ProgramUnsubscribe >>> ProgramUnsubscribe(1, 2).to_json() '{"method":"programUnsubscribe","jsonrpc":"2.0","id":2,"params":[1]}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- subscription_id
ID of subscription to cancel
- Type:
int
- to_json()
Convert to a JSON string.
- class SignatureUnsubscribe
signatureUnsubscribe
request.- Parameters:
subscription_id (int) – ID of subscription to cancel
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import SignatureUnsubscribe >>> SignatureUnsubscribe(1, 2).to_json() '{"method":"signatureUnsubscribe","jsonrpc":"2.0","id":2,"params":[1]}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- subscription_id
ID of subscription to cancel
- Type:
int
- to_json()
Convert to a JSON string.
- class SimulateLegacyTransaction
A
simulateTransaction
request.- Parameters:
tx (Transaction) – The (possibly unsigned) transaction to simulate.
config (Optional[RpcSimulateTransactionConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import SimulateLegacyTransaction >>> from solders.rpc.config import RpcSimulateTransactionConfig, RpcSimulateTransactionAccountsConfig >>> from solders.account_decoder import UiAccountEncoding >>> from solders.transaction import Transaction >>> from solders.message import Message >>> from solders.keypair import Keypair >>> from solders.instruction import Instruction >>> from solders.hash import Hash >>> from solders.pubkey import Pubkey >>> from solders.commitment_config import CommitmentLevel >>> program_id = Pubkey.default() >>> arbitrary_instruction_data = b"abc" >>> accounts = [] >>> instruction = Instruction(program_id, arbitrary_instruction_data, accounts) >>> seed = bytes([1] * 32) >>> payer = Keypair.from_seed(seed) >>> message = Message([instruction], payer.pubkey()) >>> blockhash = Hash.default() # replace with a real blockhash >>> tx = Transaction([payer], message, blockhash) >>> account_encoding = UiAccountEncoding.Base64Zstd >>> accounts_config = RpcSimulateTransactionAccountsConfig([Pubkey.default()], account_encoding) >>> commitment = CommitmentLevel.Confirmed >>> config = RpcSimulateTransactionConfig(commitment=commitment, accounts=accounts_config) >>> SimulateLegacyTransaction(tx, config).to_json() '{"method":"simulateTransaction","jsonrpc":"2.0","id":0,"params":["AaVkKDb3UlpidO/ucBnOcmS+1dY8ZAC4vHxTxiccV8zPBlupuozppRjwrILZJaoKggAcVSD1XlAKstDVEPFOVgwBAAECiojj3XQJ8ZX9UtstPLpdcspnCb8dlBIb83SIAbQPb1wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAA2FiYw==",{"sigVerify":false,"replaceRecentBlockhash":false,"commitment":"confirmed","encoding":"base64","accounts":{"encoding":"base64+zstd","addresses":["11111111111111111111111111111111"]},"minContextSlot":null,"innerInstructions":false}]}'
- config
Extra configuration.
- Type:
Optional[RpcSimulateTransactionConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- tx
The transaction to simulate.
- Type:
- class SimulateVersionedTransaction
A
simulateTransaction
request.- Parameters:
tx (Transaction) – The (possibly unsigned) transaction to simulate.
config (Optional[RpcSimulateTransactionConfig]) – Extra configuration.
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import SimulateVersionedTransaction >>> from solders.rpc.config import RpcSimulateTransactionConfig, RpcSimulateTransactionAccountsConfig >>> from solders.account_decoder import UiAccountEncoding >>> from solders.transaction import VersionedTransaction >>> from solders.message import Message >>> from solders.keypair import Keypair >>> from solders.instruction import Instruction >>> from solders.hash import Hash >>> from solders.pubkey import Pubkey >>> from solders.commitment_config import CommitmentLevel >>> program_id = Pubkey.default() >>> arbitrary_instruction_data = b"abc" >>> accounts = [] >>> instruction = Instruction(program_id, arbitrary_instruction_data, accounts) >>> seed = bytes([1] * 32) >>> blockhash = Hash.default() # replace with a real blockhash >>> payer = Keypair.from_seed(seed) >>> message = Message.new_with_blockhash([instruction], payer.pubkey(), blockhash) >>> tx = VersionedTransaction.populate(message, []) >>> account_encoding = UiAccountEncoding.Base64Zstd >>> accounts_config = RpcSimulateTransactionAccountsConfig([Pubkey.default()], account_encoding) >>> commitment = CommitmentLevel.Confirmed >>> config = RpcSimulateTransactionConfig(commitment=commitment, accounts=accounts_config) >>> SimulateVersionedTransaction(tx, config).to_json() '{"method":"simulateTransaction","jsonrpc":"2.0","id":0,"params":["AAEAAQKKiOPddAnxlf1S2y08ul1yymcJvx2UEhvzdIgBtA9vXAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQADYWJj",{"sigVerify":false,"replaceRecentBlockhash":false,"commitment":"confirmed","encoding":"base64","accounts":{"encoding":"base64+zstd","addresses":["11111111111111111111111111111111"]},"minContextSlot":null,"innerInstructions":false}]}'
- config
Extra configuration.
- Type:
Optional[RpcSimulateTransactionConfig]
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- to_json()
Convert to a JSON string.
- tx
The transaction to simulate.
- Type:
- class SlotUnsubscribe
slotUnsubscribe
request.- Parameters:
subscription_id (int) – ID of subscription to cancel
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import SlotUnsubscribe >>> SlotUnsubscribe(1, 2).to_json() '{"method":"slotUnsubscribe","jsonrpc":"2.0","id":2,"params":[1]}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- subscription_id
ID of subscription to cancel
- Type:
int
- to_json()
Convert to a JSON string.
- class SlotsUpdatesUnsubscribe
slotsUpdatesUnsubscribe
request.- Parameters:
subscription_id (int) – ID of subscription to cancel
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import SlotsUpdatesUnsubscribe >>> SlotsUpdatesUnsubscribe(1, 2).to_json() '{"method":"slotsUpdatesUnsubscribe","jsonrpc":"2.0","id":2,"params":[1]}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- subscription_id
ID of subscription to cancel
- Type:
int
- to_json()
Convert to a JSON string.
- class RootUnsubscribe
rootUnsubscribe
request.- Parameters:
subscription_id (int) – ID of subscription to cancel
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import RootUnsubscribe >>> RootUnsubscribe(1, 2).to_json() '{"method":"rootUnsubscribe","jsonrpc":"2.0","id":2,"params":[1]}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- subscription_id
ID of subscription to cancel
- Type:
int
- to_json()
Convert to a JSON string.
- class VoteUnsubscribe
voteUnsubscribe
request.- Parameters:
subscription_id (int) – ID of subscription to cancel
id (Optional[int]) – Request ID.
Example
>>> from solders.rpc.requests import VoteUnsubscribe >>> VoteUnsubscribe(1, 2).to_json() '{"method":"voteUnsubscribe","jsonrpc":"2.0","id":2,"params":[1]}'
- static from_bytes(data)
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)
Build from a JSON string.
- id
The ID of the RPC request.
- Type:
int
- subscription_id
ID of subscription to cancel
- Type:
int
- to_json()
Convert to a JSON string.
- batch_to_json(reqs)
Serialize a list of request objects into a single batch request JSON.
- Parameters:
reqs – A list of request objects.
- Returns:
The batch JSON string.
- Return type:
str
Example
>>> from solders.rpc.requests import batch_to_json, GetClusterNodes, GetEpochSchedule >>> batch_to_json([GetClusterNodes(0), GetEpochSchedule(1)]) '[{"method":"getClusterNodes","jsonrpc":"2.0","id":0},{"method":"getEpochSchedule","jsonrpc":"2.0","id":1}]'
- batch_from_json(raw)
Deserialize a batch request JSON string into a list of request objects.
- Parameters:
raw (str) – The batch JSON string.
- Returns:
A list of request objects.
Example
>>> from solders.rpc.requests import batch_from_json >>> raw = '[{"jsonrpc":"2.0","id":0,"method":"getClusterNodes"},{"jsonrpc":"2.0","id":1,"method":"getEpochSchedule"}]' >>> batch_from_json(raw) [GetClusterNodes { base: RequestBase { jsonrpc: TwoPointOh, id: 0, }, }, GetEpochSchedule { base: RequestBase { jsonrpc: TwoPointOh, id: 1, }, }]