pub struct SurfnetSvmLocker(pub Arc<RwLock<SurfnetSvm>>);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 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<EpochInfo>
pub async fn initialize( &self, remote_ctx: &Option<SurfnetRemoteClient>, ) -> SurfpoolResult<EpochInfo>
Initializes the locked SurfnetSvm by fetching or defaulting epoch info,
then calling its initialize method. Returns the epoch info on success.
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.
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_local_then_remote(
&self,
client: &SurfnetRemoteClient,
pubkeys: &[Pubkey],
commitment_config: CommitmentConfig,
) -> SurfpoolContextualizedResult<Vec<GetAccountResult>>
pub async fn get_multiple_accounts_local_then_remote( &self, client: &SurfnetRemoteClient, pubkeys: &[Pubkey], commitment_config: CommitmentConfig, ) -> SurfpoolContextualizedResult<Vec<GetAccountResult>>
Retrieves multiple accounts, fetching missing ones from remote, returning a contextualized result.
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.
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, Option<UiTransactionEncoding>)>,
signature: &Signature,
) -> SvmAccessContext<GetTransactionResult>
pub async fn get_transaction( &self, remote_ctx: &Option<(SurfnetRemoteClient, Option<UiTransactionEncoding>)>, signature: &Signature, ) -> SvmAccessContext<GetTransactionResult>
Retrieves a transaction by signature, using local or remote based on context.
Sourcepub fn get_transaction_local(
&self,
signature: &Signature,
) -> SvmAccessContext<GetTransactionResult>
pub fn get_transaction_local( &self, signature: &Signature, ) -> SvmAccessContext<GetTransactionResult>
Retrieves a transaction from local cache, returning a contextualized result.
Sourcepub async fn get_transaction_local_then_remote(
&self,
client: &SurfnetRemoteClient,
signature: &Signature,
encoding: Option<UiTransactionEncoding>,
) -> SvmAccessContext<GetTransactionResult>
pub async fn get_transaction_local_then_remote( &self, client: &SurfnetRemoteClient, signature: &Signature, encoding: Option<UiTransactionEncoding>, ) -> SvmAccessContext<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,
) -> Result<SimulatedTransactionInfo, FailedTransactionMetadata>
pub fn simulate_transaction( &self, transaction: VersionedTransaction, ) -> Result<SimulatedTransactionInfo, FailedTransactionMetadata>
Simulates a transaction on the SVM, returning detailed info or failure metadata.
Sourcepub async fn process_transaction(
&self,
remote_ctx: &Option<SurfnetRemoteClient>,
transaction: VersionedTransaction,
status_tx: Sender<TransactionStatusEvent>,
skip_preflight: bool,
) -> SurfpoolContextualizedResult<()>
pub async fn process_transaction( &self, remote_ctx: &Option<SurfnetRemoteClient>, transaction: VersionedTransaction, status_tx: Sender<TransactionStatusEvent>, skip_preflight: bool, ) -> SurfpoolContextualizedResult<()>
Processes a transaction: verifies signatures, preflight sim, sends to SVM, and enqueues status events.
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.
Source§impl SurfnetSvmLocker
Token account related functions
impl SurfnetSvmLocker
Token account related functions
Sourcepub async fn get_all_token_accounts(
&self,
remote_ctx: &Option<SurfnetRemoteClient>,
owner: Pubkey,
token_program: Pubkey,
) -> SurfpoolContextualizedResult<(Vec<RpcKeyedAccount>, Vec<Pubkey>)>
pub async fn get_all_token_accounts( &self, remote_ctx: &Option<SurfnetRemoteClient>, owner: Pubkey, token_program: Pubkey, ) -> SurfpoolContextualizedResult<(Vec<RpcKeyedAccount>, Vec<Pubkey>)>
Fetches all token accounts for an owner, returning remote results and missing pubkeys contexts.
Source§impl SurfnetSvmLocker
Address lookup table related functions
impl SurfnetSvmLocker
Address lookup table related functions
Sourcepub async fn get_pubkeys_from_message(
&self,
remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>,
message: &VersionedMessage,
) -> SurfpoolResult<Vec<Pubkey>>
pub async fn get_pubkeys_from_message( &self, remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, message: &VersionedMessage, ) -> SurfpoolResult<Vec<Pubkey>>
Extracts pubkeys from a VersionedMessage, resolving address lookup tables as needed.
Sourcepub async fn get_lookup_table_addresses(
&self,
remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>,
address_table_lookup: &MessageAddressTableLookup,
) -> SurfpoolContextualizedResult<LoadedAddresses>
pub async fn get_lookup_table_addresses( &self, remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, address_table_lookup: &MessageAddressTableLookup, ) -> SurfpoolContextualizedResult<LoadedAddresses>
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 write_profiling_results(
&self,
tag: String,
profile_result: ProfileResult,
)
pub fn write_profiling_results( &self, tag: String, profile_result: ProfileResult, )
Records profiling results under a tag and emits a tagged profile event.
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.
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.
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 airdrop(&self, pubkey: &Pubkey, lamports: u64) -> TransactionResult
pub fn airdrop(&self, pubkey: &Pubkey, lamports: u64) -> TransactionResult
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 fn confirm_current_block(&self) -> SurfpoolResult<()>
pub fn confirm_current_block(&self) -> 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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SurfnetSvmLocker
impl !RefUnwindSafe for SurfnetSvmLocker
impl Send for SurfnetSvmLocker
impl Sync for SurfnetSvmLocker
impl Unpin for SurfnetSvmLocker
impl !UnwindSafe for SurfnetSvmLocker
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more