iota_types/
messages_safe_client.rs

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