TxResult

Struct TxResult 

Source
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: TxResultCalls

Calls 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

Source

pub fn empty() -> TxResult

Source

pub fn print(&self)

Source

pub fn from_panic_obj(panic_obj: &TxPanic) -> TxResult

Source

pub fn from_panic_string(s: &str) -> TxResult

Source

pub fn from_unknown_panic() -> TxResult

Source

pub fn from_error<S>(return_code: ReturnCode, result_message: S) -> TxResult
where S: Into<String>,

Source

pub fn from_vm_error<S>(result_message: S) -> TxResult
where S: Into<String>,

Source

pub fn from_function_not_found() -> TxResult

Source

pub fn all_logs(&self) -> Vec<&TxLog>

Retrieves all logs, including the ESDT transfer log if present.

Source

pub fn append_all_logs(&mut self, source: &mut TxResult)

Just like Vec::append, consumes the source TxResult logs.

Source

pub fn merge_after_sync_call(&mut self, sync_call_result: &TxResult)

Source

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.

Source

pub fn assert_ok(&self)

Source

pub fn assert_error(&self, expected_status: u64, expected_message: &str)

Source

pub fn assert_user_error(&self, expected_message: &str)

Source§

impl TxResult

Source§

impl TxResult

Trait Implementations§

Source§

impl Clone for TxResult

Source§

fn clone(&self) -> TxResult

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TxResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for TxResult

Source§

fn default() -> TxResult

Returns the “default value” for a type. Read more
Source§

impl Display for TxResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. 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<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> 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> InterpretableFrom<&T> for T
where T: Clone,

Source§

fn interpret_from(from: &T, _context: &InterpreterContext) -> T

Source§

impl<T> InterpretableFrom<T> for T

Source§

fn interpret_from(from: T, _context: &InterpreterContext) -> T

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ReconstructableFrom<&T> for T
where T: Clone,

Source§

impl<T> ReconstructableFrom<T> for T

Source§

fn reconstruct_from(from: T, _builder: &ReconstructorContext) -> T

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

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