pub struct SimulateTransactionResponse {
pub latest_ledger: u32,
pub min_resource_fee: Option<String>,
pub error: Option<String>,
/* private fields */
}
Expand description
Response to simulate_transaction
Fields§
§latest_ledger: u32
The sequence number of the latest ledger known to Stellar RPC at the time it handled the request.
min_resource_fee: Option<String>
(optional) Stringified number - Recommended minimum resource fee to add when submitting the transaction. This fee is to be added on top of the Stellar network fee. Not present in case of error.
error: Option<String>
(optional) - This field will include details about why the invoke host function call failed. Only present if the transaction simulation failed.
Implementations§
Source§impl SimulateTransactionResponse
impl SimulateTransactionResponse
Sourcepub fn to_result(&self) -> Option<(ScVal, Vec<SorobanAuthorizationEntry>)>
pub fn to_result(&self) -> Option<(ScVal, Vec<SorobanAuthorizationEntry>)>
(optional) - This array will only have one element: the result for the Host Function invocation. Only present on successful simulation (i.e. no error) of InvokeHostFunction op
Sourcepub fn to_transaction_data(&self) -> Option<SorobanTransactionData>
pub fn to_transaction_data(&self) -> Option<SorobanTransactionData>
(optional) - The recommended Soroban Transaction Data to use when submitting the simulated transaction. This data contains the refundable fee and resource usage information such as the ledger footprint and IO access data. Not present in case of error.
Sourcepub fn to_restore_transaction_data(
&self,
) -> Option<(i64, SorobanTransactionData)>
pub fn to_restore_transaction_data( &self, ) -> Option<(i64, SorobanTransactionData)>
(optional) - It can only be present on successful simulation (i.e. no error) of InvokeHostFunction operations. If present, it indicates that the simulation detected archived ledger entries which need to be restored before the submission of the InvokeHostFunction operation. The minResourceFee and transactionData fields should be used to submit a transaction containing a RestoreFootprint operation.
let simulation = rpc.simulate_transaction(&tx, None).await.unwrap();
if let Some((min_resource_fee, transaction_data)) =
simulation.to_restore_transaction_data() {
// Build a RestoreFootprint transaction
}
Sourcepub fn to_events(&self) -> Option<Vec<DiagnosticEvent>>
pub fn to_events(&self) -> Option<Vec<DiagnosticEvent>>
(optional) - Array of the events emitted during the contract invocation. The events are ordered by their emission time. Only present when simulating of InvokeHostFunction operations, note that it can be present on error, providing extra context about what failed.
Sourcepub fn to_state_changes(&self) -> Vec<StateChange>
pub fn to_state_changes(&self) -> Vec<StateChange>
(optional) - On successful simulation of InvokeHostFunction operations, this field will be an array of LedgerEntrys before and after simulation occurred. Note that at least one of before or after will be present: before and no after indicates a deletion event, the inverse is a creation event, and both present indicates an update event. Or just check the type.
Trait Implementations§
Source§impl Clone for SimulateTransactionResponse
impl Clone for SimulateTransactionResponse
Source§fn clone(&self) -> SimulateTransactionResponse
fn clone(&self) -> SimulateTransactionResponse
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more