pub struct SurfnetSvmLocker(pub Arc<RwLock<SurfnetSvm>>);Expand description
Tuple Fields§
§0: Arc<RwLock<SurfnetSvm>>Implementations§
Source§impl SurfnetSvmLocker
Functions for reading and writing to the underlying SurfnetSvm instance
impl SurfnetSvmLocker
Functions for reading and writing to the underlying SurfnetSvm instance
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Explicitly shutdown the SVM, performing cleanup like WAL checkpoint for SQLite. This should be called before the application exits to ensure data is persisted.
Sourcepub fn with_svm_reader<T, F>(&self, reader: F) -> T
pub fn with_svm_reader<T, F>(&self, reader: F) -> T
Executes a read-only operation on the underlying SurfnetSvm by acquiring a blocking read lock.
Accepts a closure that receives a shared reference to SurfnetSvm and returns a value.
§Returns
The result produced by the closure.
Sourcepub fn with_svm_writer<T, F>(&self, writer: F) -> T
pub fn with_svm_writer<T, F>(&self, writer: F) -> T
Executes a write operation on the underlying SurfnetSvm by acquiring a blocking write lock.
Accepts a closure that receives a mutable reference to SurfnetSvm and returns a value.
§Returns
The result produced by the closure.
Source§impl SurfnetSvmLocker
Functions for creating and initializing the underlying SurfnetSvm instance
impl SurfnetSvmLocker
Functions for creating and initializing the underlying SurfnetSvm instance
Sourcepub fn new(svm: SurfnetSvm) -> Self
pub fn new(svm: SurfnetSvm) -> Self
Constructs a new SurfnetSvmLocker wrapping the given SurfnetSvm instance.
Sourcepub async fn initialize(
&self,
remote_ctx: &Option<SurfnetRemoteClient>,
) -> SurfpoolResult<()>
pub async fn initialize( &self, remote_ctx: &Option<SurfnetRemoteClient>, ) -> SurfpoolResult<()>
Initializes the locked SurfnetSvm with remote-derived startup state when available.
Source§impl SurfnetSvmLocker
Functions for getting accounts from the underlying SurfnetSvm instance or remote client
impl SurfnetSvmLocker
Functions for getting accounts from the underlying SurfnetSvm instance or remote client
Sourcepub fn get_account_local(
&self,
pubkey: &Pubkey,
) -> SvmAccessContext<GetAccountResult>
pub fn get_account_local( &self, pubkey: &Pubkey, ) -> SvmAccessContext<GetAccountResult>
Retrieves a local account from the SVM cache, returning a contextualized result.
Sourcepub async fn get_account_local_then_remote(
&self,
client: &SurfnetRemoteClient,
pubkey: &Pubkey,
commitment_config: CommitmentConfig,
) -> SurfpoolContextualizedResult<GetAccountResult>
pub async fn get_account_local_then_remote( &self, client: &SurfnetRemoteClient, pubkey: &Pubkey, commitment_config: CommitmentConfig, ) -> SurfpoolContextualizedResult<GetAccountResult>
Attempts local retrieval, then fetches from remote if missing, returning a contextualized result.
Does not fetch from remote if the account has been explicitly blocked from remote downloads.
Sourcepub async fn get_account(
&self,
remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>,
pubkey: &Pubkey,
factory: Option<AccountFactory>,
) -> SurfpoolContextualizedResult<GetAccountResult>
pub async fn get_account( &self, remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, pubkey: &Pubkey, factory: Option<AccountFactory>, ) -> SurfpoolContextualizedResult<GetAccountResult>
Retrieves an account, using local or remote based on context, applying a default factory if provided.
Sourcepub fn get_multiple_accounts_local(
&self,
pubkeys: &[Pubkey],
) -> SvmAccessContext<Vec<GetAccountResult>>
pub fn get_multiple_accounts_local( &self, pubkeys: &[Pubkey], ) -> SvmAccessContext<Vec<GetAccountResult>>
Retrieves multiple accounts from local cache, returning a contextualized result.
Sourcepub async fn get_multiple_accounts_with_remote_fallback(
&self,
client: &SurfnetRemoteClient,
pubkeys: &[Pubkey],
commitment_config: CommitmentConfig,
) -> SurfpoolContextualizedResult<Vec<GetAccountResult>>
pub async fn get_multiple_accounts_with_remote_fallback( &self, client: &SurfnetRemoteClient, pubkeys: &[Pubkey], commitment_config: CommitmentConfig, ) -> SurfpoolContextualizedResult<Vec<GetAccountResult>>
Retrieves multiple accounts from local storage, with remote fallback for missing accounts.
Returns accounts in the same order as the input pubkeys array. Accounts found locally
are returned as-is; accounts not found locally are fetched from the remote RPC client.
Accounts that have been marked offline are not fetched from remote.
Sourcepub async fn get_multiple_accounts(
&self,
remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>,
pubkeys: &[Pubkey],
factory: Option<AccountFactory>,
) -> SurfpoolContextualizedResult<Vec<GetAccountResult>>
pub async fn get_multiple_accounts( &self, remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, pubkeys: &[Pubkey], factory: Option<AccountFactory>, ) -> SurfpoolContextualizedResult<Vec<GetAccountResult>>
Retrieves multiple accounts, using local or remote context and applying factory defaults if provided.
Sourcepub async fn load_snapshot(
&self,
snapshot: &BTreeMap<String, Option<AccountSnapshot>>,
remote_client: Option<&SurfnetRemoteClient>,
commitment_config: CommitmentConfig,
) -> SurfpoolResult<usize>
pub async fn load_snapshot( &self, snapshot: &BTreeMap<String, Option<AccountSnapshot>>, remote_client: Option<&SurfnetRemoteClient>, commitment_config: CommitmentConfig, ) -> SurfpoolResult<usize>
Loads accounts from a snapshot into the SVM.
This method should be called before geyser plugins start to ensure they receive
the account updates with is_startup=true.
§Arguments
snapshot- A map of pubkey strings to optional account snapshots.- If the value is Some(AccountSnapshot), the account is loaded directly.
- If the value is None, the account is fetched from the remote RPC (if available).
remote_client- Optional remote RPC client to fetch None accounts.commitment_config- Commitment level for remote RPC calls.
§Returns
The number of accounts successfully loaded.
Sourcepub fn get_largest_accounts_local(
&self,
config: RpcLargestAccountsConfig,
) -> SurfpoolContextualizedResult<Vec<RpcAccountBalance>>
pub fn get_largest_accounts_local( &self, config: RpcLargestAccountsConfig, ) -> SurfpoolContextualizedResult<Vec<RpcAccountBalance>>
Retrieves largest accounts from local cache, returning a contextualized result.
pub async fn get_largest_accounts_local_then_remote( &self, client: &SurfnetRemoteClient, config: RpcLargestAccountsConfig, commitment_config: CommitmentConfig, ) -> SurfpoolContextualizedResult<Vec<RpcAccountBalance>>
pub async fn get_largest_accounts( &self, remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, config: RpcLargestAccountsConfig, ) -> SurfpoolContextualizedResult<Vec<RpcAccountBalance>>
pub fn account_to_rpc_keyed_account<T: ReadableAccount + Send + Sync>( &self, pubkey: &Pubkey, account: &T, config: &RpcAccountInfoConfig, token_mint: Option<Pubkey>, ) -> RpcKeyedAccount
Source§impl SurfnetSvmLocker
Get signatures for Addresses
impl SurfnetSvmLocker
Get signatures for Addresses
Sourcepub fn get_signatures_for_address_local(
&self,
pubkey: &Pubkey,
config: Option<&RpcSignaturesForAddressConfig>,
) -> SvmAccessContext<Vec<RpcConfirmedTransactionStatusWithSignature>>
pub fn get_signatures_for_address_local( &self, pubkey: &Pubkey, config: Option<&RpcSignaturesForAddressConfig>, ) -> SvmAccessContext<Vec<RpcConfirmedTransactionStatusWithSignature>>
Returns local getSignaturesForAddress results in the same newest-first order expected by
the Solana RPC.
The implementation has to do more than filter by slot:
- transactions are ordered by descending slot
- transactions within the same slot are ordered by their execution order in the block
beforeanduntilare pagination boundaries in that final ordered stream
To preserve those semantics, we first collect matching transactions, reconstruct their
intra-slot ordering from block headers, sort the full result stream, and only then apply
the before / until window followed by limit.
pub async fn get_signatures_for_address_local_then_remote( &self, client: &SurfnetRemoteClient, pubkey: &Pubkey, config: Option<&RpcSignaturesForAddressConfig>, ) -> SurfpoolContextualizedResult<Vec<RpcConfirmedTransactionStatusWithSignature>>
pub async fn get_signatures_for_address( &self, remote_ctx: &Option<(SurfnetRemoteClient, ())>, pubkey: &Pubkey, config: Option<&RpcSignaturesForAddressConfig>, ) -> SurfpoolContextualizedResult<Vec<RpcConfirmedTransactionStatusWithSignature>>
Source§impl SurfnetSvmLocker
Functions for getting transactions from the underlying SurfnetSvm instance or remote client
impl SurfnetSvmLocker
Functions for getting transactions from the underlying SurfnetSvm instance or remote client
Sourcepub async fn get_transaction(
&self,
remote_ctx: &Option<SurfnetRemoteClient>,
signature: &Signature,
config: RpcTransactionConfig,
) -> SurfpoolResult<GetTransactionResult>
pub async fn get_transaction( &self, remote_ctx: &Option<SurfnetRemoteClient>, signature: &Signature, config: RpcTransactionConfig, ) -> SurfpoolResult<GetTransactionResult>
Retrieves a transaction by signature, using local or remote based on context.
Sourcepub fn store_bundle(
&self,
bundle_id: String,
signatures: Vec<String>,
) -> SurfpoolResult<()>
pub fn store_bundle( &self, bundle_id: String, signatures: Vec<String>, ) -> SurfpoolResult<()>
Stores a bundle’s signatures under the given bundle ID.
Sourcepub fn get_bundle(&self, bundle_id: &str) -> Option<Vec<String>>
pub fn get_bundle(&self, bundle_id: &str) -> Option<Vec<String>>
Retrieves the list of transaction signatures for a previously stored bundle.
Returns None when there is no local entry for bundle_id (or the backing store read fails).
This is not an “invalid id” signal: callers such as Jito getBundleStatuses treat None as
“no data” and return a null RPC result rather than an error.
Sourcepub fn get_transaction_local(
&self,
signature: &Signature,
config: &RpcTransactionConfig,
) -> SurfpoolResult<GetTransactionResult>
pub fn get_transaction_local( &self, signature: &Signature, config: &RpcTransactionConfig, ) -> SurfpoolResult<GetTransactionResult>
Retrieves a transaction from local cache, returning a contextualized result.
Sourcepub async fn get_transaction_local_then_remote(
&self,
client: &SurfnetRemoteClient,
signature: &Signature,
config: RpcTransactionConfig,
) -> SurfpoolResult<GetTransactionResult>
pub async fn get_transaction_local_then_remote( &self, client: &SurfnetRemoteClient, signature: &Signature, config: RpcTransactionConfig, ) -> SurfpoolResult<GetTransactionResult>
Retrieves a transaction locally then from remote if missing, returning a contextualized result.
Source§impl SurfnetSvmLocker
Functions for simulating and processing transactions in the underlying SurfnetSvm instance
impl SurfnetSvmLocker
Functions for simulating and processing transactions in the underlying SurfnetSvm instance
Sourcepub fn simulate_transaction(
&self,
transaction: VersionedTransaction,
sigverify: bool,
) -> Result<SimulatedTransactionInfo, FailedTransactionMetadata>
pub fn simulate_transaction( &self, transaction: VersionedTransaction, sigverify: bool, ) -> Result<SimulatedTransactionInfo, FailedTransactionMetadata>
Simulates a transaction on the SVM, returning detailed info or failure metadata.
pub fn is_instruction_profiling_enabled(&self) -> bool
pub fn get_profiling_map_capacity(&self) -> usize
pub async fn process_transaction( &self, remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, transaction: VersionedTransaction, status_tx: Sender<TransactionStatusEvent>, skip_preflight: bool, sigverify: bool, ) -> SurfpoolResult<()>
pub async fn profile_transaction( &self, remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, transaction: VersionedTransaction, tag: Option<String>, ) -> SurfpoolContextualizedResult<Uuid>
Source§impl SurfnetSvmLocker
Functions for writing account updates to the underlying SurfnetSvm instance
impl SurfnetSvmLocker
Functions for writing account updates to the underlying SurfnetSvm instance
Sourcepub fn write_account_update(&self, account_update: GetAccountResult)
pub fn write_account_update(&self, account_update: GetAccountResult)
Writes a single account update into the SVM state if present.
Sourcepub fn write_multiple_account_updates(
&self,
account_updates: &[GetAccountResult],
)
pub fn write_multiple_account_updates( &self, account_updates: &[GetAccountResult], )
Writes multiple account updates into the SVM state when any are present.
Sourcepub fn reset_account(
&self,
pubkey: Pubkey,
include_owned_accounts: bool,
) -> SurfpoolResult<()>
pub fn reset_account( &self, pubkey: Pubkey, include_owned_accounts: bool, ) -> SurfpoolResult<()>
Resets an account in the SVM state for refresh/streaming.
This function coordinates the reset of accounts by removing them from the local cache, allowing them to be fetched fresh from mainnet on the next access. It handles program accounts (including their program data accounts) and can optionally cascade the reset to all accounts owned by a program.
Sourcepub async fn reset_network(
&self,
remote_ctx: &Option<SurfnetRemoteClient>,
) -> SurfpoolResult<()>
pub async fn reset_network( &self, remote_ctx: &Option<SurfnetRemoteClient>, ) -> SurfpoolResult<()>
Resets SVM state and clears all offline account entries.
This function coordinates the reset of the entire network state. It also clears the offline account set so all accounts can be fetched from mainnet again.
Sourcepub async fn insert_offline_account(
&self,
pubkey: Pubkey,
include_owned_accounts: bool,
) -> SurfpoolResult<()>
pub async fn insert_offline_account( &self, pubkey: Pubkey, include_owned_accounts: bool, ) -> SurfpoolResult<()>
Marks an account as offline, preventing it from being downloaded from the remote RPC.
When include_owned_accounts is enabled, this also marks accounts as offline that are already known locally.
Accounts discovered later through direct remote fetches are rejected lazily if they are
owned by an offline owner.
Sourcepub fn stream_account(
&self,
pubkey: Pubkey,
include_owned_accounts: bool,
) -> SurfpoolResult<()>
pub fn stream_account( &self, pubkey: Pubkey, include_owned_accounts: bool, ) -> SurfpoolResult<()>
Streams an account by its pubkey.
pub fn get_streamed_accounts(&self) -> Vec<(String, bool)>
Sourcepub fn remove_offline_account(
&self,
pubkey: Pubkey,
include_owned_accounts: bool,
) -> SurfpoolResult<()>
pub fn remove_offline_account( &self, pubkey: Pubkey, include_owned_accounts: bool, ) -> SurfpoolResult<()>
Removes an account from the offline account set.
This allows the account to be fetched from mainnet again if requested. This is useful when resetting an account for a refresh/stream operation.
Sourcepub fn is_account_offline(&self, pubkey: &Pubkey) -> bool
pub fn is_account_offline(&self, pubkey: &Pubkey) -> bool
Returns true if the given pubkey is marked offline.
Sourcepub fn get_offline_account_owners(&self) -> Vec<Pubkey>
pub fn get_offline_account_owners(&self) -> Vec<Pubkey>
Gets all owners whose accounts are marked offline.
Sourcepub fn register_scenario(
&self,
scenario: Scenario,
slot: Option<Slot>,
) -> SurfpoolResult<()>
pub fn register_scenario( &self, scenario: Scenario, slot: Option<Slot>, ) -> SurfpoolResult<()>
Registers a scenario for execution
Sourcepub async fn materialize_overrides_for_slot(
&self,
remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>,
slot: Slot,
) -> SurfpoolResult<()>
pub async fn materialize_overrides_for_slot( &self, remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, slot: Slot, ) -> SurfpoolResult<()>
Materializes overrides for a specific slot (not necessarily the current slot)
Source§impl SurfnetSvmLocker
Token account related functions
impl SurfnetSvmLocker
Token account related functions
Sourcepub async fn get_token_accounts_by_owner(
&self,
remote_ctx: &Option<SurfnetRemoteClient>,
owner: Pubkey,
filter: &TokenAccountsFilter,
config: &RpcAccountInfoConfig,
) -> SurfpoolContextualizedResult<Vec<RpcKeyedAccount>>
pub async fn get_token_accounts_by_owner( &self, remote_ctx: &Option<SurfnetRemoteClient>, owner: Pubkey, filter: &TokenAccountsFilter, config: &RpcAccountInfoConfig, ) -> SurfpoolContextualizedResult<Vec<RpcKeyedAccount>>
Fetches all token accounts for an owner, returning remote results and missing pubkeys contexts.
pub fn get_token_accounts_by_owner_local( &self, owner: Pubkey, filter: &TokenAccountsFilter, config: &RpcAccountInfoConfig, ) -> SurfpoolContextualizedResult<Vec<RpcKeyedAccount>>
pub async fn get_token_accounts_by_owner_local_then_remote( &self, owner: Pubkey, filter: &TokenAccountsFilter, remote_client: &SurfnetRemoteClient, config: &RpcAccountInfoConfig, ) -> SurfpoolContextualizedResult<Vec<RpcKeyedAccount>>
pub async fn get_token_accounts_by_delegate( &self, remote_ctx: &Option<SurfnetRemoteClient>, delegate: Pubkey, filter: &TokenAccountsFilter, config: &RpcAccountInfoConfig, ) -> SurfpoolContextualizedResult<Vec<RpcKeyedAccount>>
Source§impl SurfnetSvmLocker
Token account by delegate related functions
impl SurfnetSvmLocker
Token account by delegate related functions
pub fn get_token_accounts_by_delegate_local( &self, delegate: Pubkey, filter: &TokenAccountsFilter, config: &RpcAccountInfoConfig, ) -> SurfpoolContextualizedResult<Vec<RpcKeyedAccount>>
pub async fn get_token_accounts_by_delegate_local_then_remote( &self, delegate: Pubkey, filter: &TokenAccountsFilter, remote_client: &SurfnetRemoteClient, config: &RpcAccountInfoConfig, ) -> SurfpoolContextualizedResult<Vec<RpcKeyedAccount>>
Source§impl SurfnetSvmLocker
Get largest account related account
impl SurfnetSvmLocker
Get largest account related account
pub fn get_token_largest_accounts_local( &self, mint: &Pubkey, ) -> SvmAccessContext<Vec<RpcTokenAccountBalance>>
pub async fn get_token_largest_accounts_local_then_remote( &self, client: &SurfnetRemoteClient, mint: &Pubkey, commitment_config: CommitmentConfig, ) -> SurfpoolContextualizedResult<Vec<RpcTokenAccountBalance>>
Sourcepub async fn get_token_largest_accounts(
&self,
remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>,
mint: &Pubkey,
) -> SurfpoolContextualizedResult<Vec<RpcTokenAccountBalance>>
pub async fn get_token_largest_accounts( &self, remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, mint: &Pubkey, ) -> SurfpoolContextualizedResult<Vec<RpcTokenAccountBalance>>
Fetches the largest token accounts for a specific mint, returning contextualized results.
Source§impl SurfnetSvmLocker
Address lookup table related functions
impl SurfnetSvmLocker
Address lookup table related functions
Sourcepub fn get_pubkeys_from_message(
&self,
message: &VersionedMessage,
all_transaction_lookup_table_addresses: Option<Vec<&Pubkey>>,
) -> Vec<Pubkey>
pub fn get_pubkeys_from_message( &self, message: &VersionedMessage, all_transaction_lookup_table_addresses: Option<Vec<&Pubkey>>, ) -> Vec<Pubkey>
Extracts pubkeys from a VersionedMessage, resolving address lookup tables as needed.
Sourcepub async fn get_loaded_addresses(
&self,
remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>,
message: &VersionedMessage,
) -> SurfpoolResult<Option<TransactionLoadedAddresses>>
pub async fn get_loaded_addresses( &self, remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, message: &VersionedMessage, ) -> SurfpoolResult<Option<TransactionLoadedAddresses>>
Gets addresses loaded from on-chain lookup tables from a VersionedMessage.
Sourcepub async fn get_lookup_table_addresses(
&self,
remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>,
address_table_lookup: &MessageAddressTableLookup,
transaction_loaded_addresses: &mut TransactionLoadedAddresses,
) -> SurfpoolResult<()>
pub async fn get_lookup_table_addresses( &self, remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, address_table_lookup: &MessageAddressTableLookup, transaction_loaded_addresses: &mut TransactionLoadedAddresses, ) -> SurfpoolResult<()>
Retrieves loaded addresses from a lookup table account, validating owner and indices.
Source§impl SurfnetSvmLocker
Profiling helper functions
impl SurfnetSvmLocker
Profiling helper functions
Sourcepub fn estimate_compute_units(
&self,
transaction: &VersionedTransaction,
) -> SvmAccessContext<ComputeUnitsEstimationResult>
pub fn estimate_compute_units( &self, transaction: &VersionedTransaction, ) -> SvmAccessContext<ComputeUnitsEstimationResult>
Estimates compute units for a transaction via contextualized simulation.
Sourcepub fn get_profile_result(
&self,
signature_or_uuid: UuidOrSignature,
config: &RpcProfileResultConfig,
) -> SurfpoolResult<Option<UiKeyedProfileResult>>
pub fn get_profile_result( &self, signature_or_uuid: UuidOrSignature, config: &RpcProfileResultConfig, ) -> SurfpoolResult<Option<UiKeyedProfileResult>>
Returns the profile result for a given signature or UUID, and whether it exists in the SVM.
pub fn encode_ui_keyed_profile_result( &self, profile: KeyedProfileResult, config: &RpcProfileResultConfig, ) -> UiKeyedProfileResult
Sourcepub fn get_profile_results_by_tag(
&self,
tag: String,
config: &RpcProfileResultConfig,
) -> SurfpoolResult<Option<Vec<UiKeyedProfileResult>>>
pub fn get_profile_results_by_tag( &self, tag: String, config: &RpcProfileResultConfig, ) -> SurfpoolResult<Option<Vec<UiKeyedProfileResult>>>
Returns the profile results for a given tag.
pub fn register_idl(&self, idl: Idl, slot: Option<Slot>) -> SurfpoolResult<()>
pub fn get_idl(&self, address: &Pubkey, slot: Option<Slot>) -> Option<Idl>
Sourcepub fn get_forged_account_data(
&self,
account_pubkey: &Pubkey,
account_data: &[u8],
idl: &Idl,
overrides: &HashMap<String, Value>,
) -> SurfpoolResult<Vec<u8>>
pub fn get_forged_account_data( &self, account_pubkey: &Pubkey, account_data: &[u8], idl: &Idl, overrides: &HashMap<String, Value>, ) -> SurfpoolResult<Vec<u8>>
Forges account data by decoding with IDL, applying overrides, and re-encoding.
§Arguments
account_pubkey- The public key of the account (used for error messages)account_data- The raw account data bytesidl- The IDL for decoding/encoding the account dataoverrides- HashMap of field paths (dot notation) to values to override
§Returns
The modified account data bytes with discriminator Forges account data by applying overrides to existing account data
This delegates to the SurfnetSvm implementation.
§Arguments
account_pubkey- The account address (for error messages)account_data- The original account data bytesidl- The IDL for the account’s programoverrides- Map of field paths to new values
§Returns
The forged account data as bytes, or an error
Source§impl SurfnetSvmLocker
Program account related functions
impl SurfnetSvmLocker
Program account related functions
Sourcepub async fn clone_program_account(
&self,
remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>,
source_program_id: &Pubkey,
destination_program_id: &Pubkey,
) -> SurfpoolContextualizedResult<()>
pub async fn clone_program_account( &self, remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, source_program_id: &Pubkey, destination_program_id: &Pubkey, ) -> SurfpoolContextualizedResult<()>
Clones a program account from source to destination, handling upgradeable loader state.
pub async fn get_program_accounts( &self, remote_ctx: &Option<SurfnetRemoteClient>, program_id: &Pubkey, account_config: RpcAccountInfoConfig, filters: Option<Vec<RpcFilterType>>, ) -> SurfpoolContextualizedResult<Vec<RpcKeyedAccount>>
Sourcepub fn get_program_accounts_local(
&self,
program_id: &Pubkey,
account_config: RpcAccountInfoConfig,
filters: Option<Vec<RpcFilterType>>,
) -> SurfpoolContextualizedResult<Vec<RpcKeyedAccount>>
pub fn get_program_accounts_local( &self, program_id: &Pubkey, account_config: RpcAccountInfoConfig, filters: Option<Vec<RpcFilterType>>, ) -> SurfpoolContextualizedResult<Vec<RpcKeyedAccount>>
Retrieves program accounts from the local SVM cache, returning a contextualized result.
pub fn encode_ui_account( &self, pubkey: &Pubkey, account: &Account, encoding: UiAccountEncoding, additional_data: Option<AccountAdditionalDataV3>, data_slice: Option<UiDataSliceConfig>, ) -> UiAccount
Sourcepub async fn get_program_accounts_local_then_remote(
&self,
client: &SurfnetRemoteClient,
program_id: &Pubkey,
account_config: RpcAccountInfoConfig,
filters: Option<Vec<RpcFilterType>>,
) -> SurfpoolContextualizedResult<Vec<RpcKeyedAccount>>
pub async fn get_program_accounts_local_then_remote( &self, client: &SurfnetRemoteClient, program_id: &Pubkey, account_config: RpcAccountInfoConfig, filters: Option<Vec<RpcFilterType>>, ) -> SurfpoolContextualizedResult<Vec<RpcKeyedAccount>>
Retrieves program accounts from the local cache and remote client, combining results.
Source§impl SurfnetSvmLocker
impl SurfnetSvmLocker
Sourcepub fn get_first_local_slot(&self) -> Option<Slot>
pub fn get_first_local_slot(&self) -> Option<Slot>
Returns the first local slot (the genesis_slot when this surfnet started). Since empty blocks can be reconstructed on-the-fly, all slots from genesis_slot onwards are valid.
pub async fn get_block( &self, remote_ctx: &Option<SurfnetRemoteClient>, slot: &Slot, config: &RpcBlockConfig, ) -> SurfpoolContextualizedResult<Option<UiConfirmedBlock>>
pub fn get_block_local( &self, slot: &Slot, config: &RpcBlockConfig, ) -> SurfpoolResult<Option<UiConfirmedBlock>>
pub fn get_genesis_hash_local(&self) -> SvmAccessContext<Hash>
pub async fn get_genesis_hash( &self, remote_ctx: &Option<SurfnetRemoteClient>, ) -> SurfpoolContextualizedResult<Hash>
Source§impl SurfnetSvmLocker
Pass through functions for accessing the underlying SurfnetSvm instance
impl SurfnetSvmLocker
Pass through functions for accessing the underlying SurfnetSvm instance
Sourcepub fn simnet_events_tx(&self) -> Sender<SimnetEvent>
pub fn simnet_events_tx(&self) -> Sender<SimnetEvent>
Returns a sender for simulation events from the underlying SVM.
Sourcepub fn get_epoch_info(&self) -> EpochInfo
pub fn get_epoch_info(&self) -> EpochInfo
Retrieves the latest epoch info from the underlying SVM.
pub fn time_travel( &self, key: Option<(Hash, String)>, simnet_command_tx: Sender<SimnetCommand>, config: TimeTravelConfig, ) -> SurfpoolResult<EpochInfo>
Sourcepub fn get_latest_absolute_slot(&self) -> Slot
pub fn get_latest_absolute_slot(&self) -> Slot
Retrieves the latest absolute slot from the underlying SVM.
Sourcepub fn get_latest_blockhash(&self, config: &CommitmentConfig) -> Option<Hash>
pub fn get_latest_blockhash(&self, config: &CommitmentConfig) -> Option<Hash>
Retrieves the latest blockhash for the given commitment config from the underlying SVM.
pub fn latest_absolute_blockhash(&self) -> Hash
pub fn get_slot_for_commitment(&self, commitment: &CommitmentConfig) -> Slot
Sourcepub fn airdrop(
&self,
pubkey: &Pubkey,
lamports: u64,
) -> Result<TransactionResult, AirdropError>
pub fn airdrop( &self, pubkey: &Pubkey, lamports: u64, ) -> Result<TransactionResult, AirdropError>
Executes an airdrop via the underlying SVM.
Sourcepub fn airdrop_pubkeys(&self, lamports: u64, addresses: &[Pubkey])
pub fn airdrop_pubkeys(&self, lamports: u64, addresses: &[Pubkey])
Executes a batch airdrop via the underlying SVM.
Sourcepub async fn confirm_current_block(
&self,
remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>,
) -> SurfpoolResult<()>
pub async fn confirm_current_block( &self, remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, ) -> SurfpoolResult<()>
Confirms the current block on the underlying SVM, returning Ok(()) or an error.
Sourcepub fn subscribe_for_signature_updates(
&self,
signature: &Signature,
subscription_type: SignatureSubscriptionType,
) -> Receiver<(Slot, Option<TransactionError>)>
pub fn subscribe_for_signature_updates( &self, signature: &Signature, subscription_type: SignatureSubscriptionType, ) -> Receiver<(Slot, Option<TransactionError>)>
Subscribes for signature updates (confirmed/finalized) and returns a receiver of events.
Sourcepub fn subscribe_for_account_updates(
&self,
account_pubkey: &Pubkey,
encoding: Option<UiAccountEncoding>,
) -> Receiver<UiAccount>
pub fn subscribe_for_account_updates( &self, account_pubkey: &Pubkey, encoding: Option<UiAccountEncoding>, ) -> Receiver<UiAccount>
Subscribes for account updates and returns a receiver of account updates.
Sourcepub fn subscribe_for_program_updates(
&self,
program_id: &Pubkey,
encoding: Option<UiAccountEncoding>,
filters: Option<Vec<RpcFilterType>>,
) -> Receiver<RpcKeyedAccount>
pub fn subscribe_for_program_updates( &self, program_id: &Pubkey, encoding: Option<UiAccountEncoding>, filters: Option<Vec<RpcFilterType>>, ) -> Receiver<RpcKeyedAccount>
Subscribes for program account updates and returns a receiver of keyed account updates.
Sourcepub fn subscribe_for_slot_updates(&self) -> Receiver<SlotInfo>
pub fn subscribe_for_slot_updates(&self) -> Receiver<SlotInfo>
Subscribes for slot updates and returns a receiver of slot updates.
Sourcepub fn subscribe_for_slots_updates(&self) -> Receiver<Arc<SlotUpdate>>
pub fn subscribe_for_slots_updates(&self) -> Receiver<Arc<SlotUpdate>>
Subscribes for tagged slotsUpdatesSubscribe notifications and
returns a receiver of shared SlotUpdate events.
Sourcepub fn subscribe_for_logs_updates(
&self,
commitment_level: &CommitmentLevel,
filter: &RpcTransactionLogsFilter,
) -> Receiver<(Slot, RpcLogsResponse)>
pub fn subscribe_for_logs_updates( &self, commitment_level: &CommitmentLevel, filter: &RpcTransactionLogsFilter, ) -> Receiver<(Slot, RpcLogsResponse)>
Subscribes for logs updates and returns a receiver of logs updates.
Sourcepub fn subscribe_for_snapshot_import_updates(
&self,
snapshot_url: &str,
snapshot_id: &str,
) -> Receiver<SnapshotImportNotification>
pub fn subscribe_for_snapshot_import_updates( &self, snapshot_url: &str, snapshot_id: &str, ) -> Receiver<SnapshotImportNotification>
Subscribes for snapshot import updates and returns a receiver of snapshot import notifications.
This method spawns a background task that fetches the snapshot and loads it via load_snapshot.
pub fn runbook_executions(&self) -> Vec<RunbookExecutionStatusReport>
pub fn start_runbook_execution(&self, runbook_id: String)
pub fn complete_runbook_execution( &self, runbook_id: String, error: Option<Vec<String>>, re_enable_ix_profiling: bool, )
pub fn export_snapshot( &self, config: ExportSnapshotConfig, ) -> SurfpoolResult<BTreeMap<String, AccountSnapshot>>
pub fn get_start_time(&self) -> SystemTime
Source§impl SurfnetSvmLocker
Helpers for writing program accounts
impl SurfnetSvmLocker
Helpers for writing program accounts
pub async fn write_program( &self, program_id: Pubkey, authority: Option<Pubkey>, offset: usize, data: &[u8], remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, ) -> SurfpoolResult<()>
pub async fn get_or_create_program_account( &self, program_id: Pubkey, program_data_address: Pubkey, remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, ) -> SurfpoolResult<Account>
pub async fn write_program_data_account_with_offset( &self, program_id: Pubkey, authority: Option<Pubkey>, program_data_address: Pubkey, offset: usize, data: &[u8], remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, ) -> SurfpoolResult<Account>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SurfnetSvmLocker
impl !UnwindSafe for SurfnetSvmLocker
impl Freeze for SurfnetSvmLocker
impl Send for SurfnetSvmLocker
impl Sync for SurfnetSvmLocker
impl Unpin for SurfnetSvmLocker
impl UnsafeUnpin for SurfnetSvmLocker
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.