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::{CertifiedTransaction, 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)]
16pub enum PlainTransactionInfoResponse {
17    Signed(SignedTransaction),
18    ExecutedWithCert(
19        CertifiedTransaction,
20        SignedTransactionEffects,
21        TransactionEvents,
22    ),
23    ExecutedWithoutCert(Transaction, SignedTransactionEffects, TransactionEvents),
24}
25
26impl PlainTransactionInfoResponse {
27    pub fn is_executed(&self) -> bool {
28        match self {
29            PlainTransactionInfoResponse::Signed(_) => false,
30            PlainTransactionInfoResponse::ExecutedWithCert(_, _, _)
31            | PlainTransactionInfoResponse::ExecutedWithoutCert(_, _, _) => true,
32        }
33    }
34}