execution_outcome

To Share and +4 nLEARNs

import Tabs from ‘@theme/Tabs’;
import TabItem from ‘@theme/TabItem’;

ExecutionOutcome Structure

Definition

ExecutionOutcome is the result of execution of Transaction or Receipt

::info Transaction’s ExecutionOutcome

In the result of the Transaction execution will always be a Receipt.

::

ExecutionOutcomeWithIdView


“`rust links=1
pub struct ExecutionOutcomeWithIdView {
pub proof: MerklePath,
pub block_hash: CryptoHash,
pub id: CryptoHash,
pub outcome: ExecutionOutcomeView,
}
“`


“`ts links=1
export type ExecutionOutcomeWithReceipt = {
executionOutcome: {
blockHash: string;
id: string;
outcome: {
executorId: string,
gasBurnt: number,
logs: string[],
metadata: {
gasProfile: string | null;
version: number;
};
receiptIds: string[],
status: ExecutionStatus,
tokensBurnt: string
};
proof: ExecutionProof[];
};
receipt: Receipt | null;
};
“`


ExecutionOutcomeView


“`rust links=1
pub struct ExecutionOutcomeView {
/// Logs from this transaction or receipt.
pub logs: Vec,
/// Receipt IDs generated by this transaction or receipt.
pub receipt_ids: Vec,
/// The amount of the gas burnt by the given transaction or receipt.
pub gas_burnt: Gas,
/// The amount of tokens burnt corresponding to the burnt gas amount.
/// This value doesn’t always equal to the `gas_burnt` multiplied by the gas price, because
/// the prepaid gas price might be lower than the actual gas price and it creates a deficit.
#[serde(with = “u128_dec_format”)]
pub tokens_burnt: Balance,
/// The id of the account on which the execution happens. For transaction this is signer_id,
/// for receipt this is receiver_id.
pub executor_id: AccountId,
/// Execution status. Contains the result in case of successful execution.
pub status: ExecutionStatusView,
/// Execution metadata, versioned
#[serde(default)]
pub metadata: ExecutionMetadataView,
}
“`


[ExecutionOutcomeWithIdView TypeScript](#executionoutcomewithidview) defines this structure already an nested


ExecutionStatusView


“`rust links=1
pub enum ExecutionStatusView {
/// The execution is pending or unknown.
Unknown,
/// The execution has failed.
Failure(TxExecutionError),
/// The final action succeeded and returned some value or an empty vec encoded in base64.
SuccessValue(String),
/// The final action of the receipt returned a promise or the signed transaction was converted
/// to a receipt. Contains the receipt_id of the generated receipt.
SuccessReceiptId(CryptoHash),
}
“`


“`ts links=1
export type ExecutionStatus =
| { Unknown: unknown }
| { Failure: unknown }
| { SuccessValue: string }
| { SuccessReceiptId: string };
“`


Generate comment with AI 2 nL
Scroll to Top
Report a bug👀