Struct SurfnetSvmLocker

Source
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

Source

pub fn with_svm_reader<T, F>(&self, reader: F) -> T
where F: Fn(&SurfnetSvm) -> T + Send + Sync, T: Send + 'static,

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.

Source

pub fn with_svm_writer<T, F>(&self, writer: F) -> T
where F: Fn(&mut SurfnetSvm) -> T + Send + Sync, T: Send + 'static,

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

Source

pub fn new(svm: SurfnetSvm) -> Self

Constructs a new SurfnetSvmLocker wrapping the given SurfnetSvm instance.

Source

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

Source

pub fn get_account_local( &self, pubkey: &Pubkey, ) -> SvmAccessContext<GetAccountResult>

Retrieves a local account from the SVM cache, returning a contextualized result.

Source

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.

Source

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.

Source

pub fn get_multiple_accounts_local( &self, pubkeys: &[Pubkey], ) -> SvmAccessContext<Vec<GetAccountResult>>

Retrieves multiple accounts from local cache, returning a contextualized result.

Source

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.

Source

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

Source

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.

Source

pub fn get_transaction_local( &self, signature: &Signature, ) -> SvmAccessContext<GetTransactionResult>

Retrieves a transaction from local cache, returning a contextualized result.

Source

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

Source

pub fn simulate_transaction( &self, transaction: VersionedTransaction, ) -> Result<SimulatedTransactionInfo, FailedTransactionMetadata>

Simulates a transaction on the SVM, returning detailed info or failure metadata.

Source

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

Source

pub fn write_account_update(&self, account_update: GetAccountResult)

Writes a single account update into the SVM state if present.

Source

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

Source

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

Source

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.

Source

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

Source

pub fn estimate_compute_units( &self, transaction: &VersionedTransaction, ) -> SvmAccessContext<ComputeUnitsEstimationResult>

Estimates compute units for a transaction via contextualized simulation.

Source

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

Source

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

Source

pub fn simnet_events_tx(&self) -> Sender<SimnetEvent>

Returns a sender for simulation events from the underlying SVM.

Source

pub fn get_epoch_info(&self) -> EpochInfo

Retrieves the latest epoch info from the underlying SVM.

Source

pub fn get_latest_absolute_slot(&self) -> Slot

Retrieves the latest absolute slot from the underlying SVM.

Source

pub fn airdrop(&self, pubkey: &Pubkey, lamports: u64) -> TransactionResult

Executes an airdrop via the underlying SVM.

Source

pub fn airdrop_pubkeys(&self, lamports: u64, addresses: &[Pubkey])

Executes a batch airdrop via the underlying SVM.

Source

pub fn confirm_current_block(&self) -> SurfpoolResult<()>

Confirms the current block on the underlying SVM, returning Ok(()) or an error.

Source

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§

Source§

impl Clone for SurfnetSvmLocker

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,