pub struct TxResult {
pub result_status: ReturnCode,
pub result_message: String,
pub result_values: Vec<Vec<u8>>,
pub esdt_transfer_log: Option<TxLog>,
pub result_logs: Vec<TxLog>,
pub gas_used: GasUsed,
pub error_trace: Vec<TxErrorTrace>,
pub pending_calls: TxResultCalls,
pub all_calls: Vec<AsyncCallTxData>,
}Fields§
§result_status: ReturnCode§result_message: String§result_values: Vec<Vec<u8>>§esdt_transfer_log: Option<TxLog>Contains a log generated by ESDT transfer builtin functions,
like MultiESDTNFTTransfer or ESDTTransfer.
There is at most one such log per transaction, hence Option, not Vec.
It is kept separately, because, unlike regular logs, it is not erased in case of tx failure (e.g. via sync call fallbile).
It also appears in front of the regular logs, it is easier to merge this way.
It does get merged into the regular logs when merging results after a sync call.
result_logs: Vec<TxLog>Logs created during the transaction execution.
gas_used: GasUsed§error_trace: Vec<TxErrorTrace>Accumulates errors when they occur.
It mimics the behavior of the Go VM, and they contribute to the the internalVMErrors event log.
Of course, the data field of the internalVMErrors log is implementation-dependent, so a 1:1 match is impossible.
pending_calls: TxResultCallsCalls that need to be executed.
Structure is emptied as soon as async calls are executed.
all_calls: Vec<AsyncCallTxData>All async calls launched from the tx (legacy async, promises, transfer-execute).
Is never cleared of its contents.
Implementations§
Source§impl TxResult
impl TxResult
pub fn empty() -> TxResult
pub fn print(&self)
pub fn from_panic_obj(panic_obj: &TxPanic) -> TxResult
pub fn from_panic_string(s: &str) -> TxResult
pub fn from_unknown_panic() -> TxResult
pub fn from_error<S>(return_code: ReturnCode, result_message: S) -> TxResult
pub fn from_vm_error<S>(result_message: S) -> TxResult
pub fn from_function_not_found() -> TxResult
Sourcepub fn all_logs(&self) -> Vec<&TxLog>
pub fn all_logs(&self) -> Vec<&TxLog>
Retrieves all logs, including the ESDT transfer log if present.
Sourcepub fn append_all_logs(&mut self, source: &mut TxResult)
pub fn append_all_logs(&mut self, source: &mut TxResult)
Just like Vec::append, consumes the source TxResult logs.
pub fn merge_after_sync_call(&mut self, sync_call_result: &TxResult)
Sourcepub fn merge_error(&mut self, error_tx_result: TxResult)
pub fn merge_error(&mut self, error_tx_result: TxResult)
Clears all TxResult fields, and replaces the error status and message fields.
It also concatenates the error traces. In practice, the error_tx_result contains no error trace.
Implementation note: this is done via std::mem::replace to ensure that all fields are cleared, except the ones related to errors.
pub fn assert_ok(&self)
pub fn assert_error(&self, expected_status: u64, expected_message: &str)
pub fn assert_user_error(&self, expected_message: &str)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TxResult
impl RefUnwindSafe for TxResult
impl Send for TxResult
impl Sync for TxResult
impl Unpin for TxResult
impl UnwindSafe for TxResult
Blanket Implementations§
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> InterpretableFrom<&T> for Twhere
T: Clone,
impl<T> InterpretableFrom<&T> for Twhere
T: Clone,
fn interpret_from(from: &T, _context: &InterpreterContext) -> T
Source§impl<T> InterpretableFrom<T> for T
impl<T> InterpretableFrom<T> for T
fn interpret_from(from: T, _context: &InterpreterContext) -> T
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ReconstructableFrom<&T> for Twhere
T: Clone,
impl<T> ReconstructableFrom<&T> for Twhere
T: Clone,
fn reconstruct_from(from: &T, _builder: &ReconstructorContext) -> T
Source§impl<T> ReconstructableFrom<T> for T
impl<T> ReconstructableFrom<T> for T
fn reconstruct_from(from: T, _builder: &ReconstructorContext) -> T
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.