sui_types/
messages_safe_client.rs

1// Copyright (c) Mysten Labs, Inc.
2// SPDX-License-Identifier: Apache-2.0
3
4use crate::{
5    effects::{SignedTransactionEffects, TransactionEvents},
6    transaction::{SignedTransaction, Transaction},
7};
8
9/// This enum represents all possible states of a response returned from
10/// the safe client. Note that [struct SignedTransaction] and
11/// [struct SignedTransactionEffects] are represented as an Envelope
12/// instead of an VerifiedEnvelope. This is because the verification is
13/// now performed by the authority aggregator as an aggregated signature,
14/// instead of in SafeClient.
15#[derive(Clone, Debug)]
16#[allow(clippy::large_enum_variant)]
17pub enum PlainTransactionInfoResponse {
18    Signed(SignedTransaction),
19    Executed(Transaction, SignedTransactionEffects, TransactionEvents),
20}
21
22impl PlainTransactionInfoResponse {
23    pub fn is_executed(&self) -> bool {
24        match self {
25            PlainTransactionInfoResponse::Signed(_) => false,
26            PlainTransactionInfoResponse::Executed(_, _, _) => true,
27        }
28    }
29}