[][src]Enum exonum_explorer::TransactionInfo

#[non_exhaustive]pub enum TransactionInfo {
    InPool {
        message: Verified<AnyTx>,
    },
    Committed(CommittedTransaction),
}

Information about the transaction.

Values of this type are returned by the transaction() method of the BlockchainExplorer.

JSON presentation

Committed transactions

Committed transactions are represented just like a CommittedTransaction, with the additional type field equal to "committed".

Transaction in pool

Transactions in pool are represented with a 2-field object:

  • type field contains transaction type ("in-pool").
  • message is the full transaction message serialized to the hexadecimal form.

Examples

use exonum_explorer::TransactionInfo;
use exonum::{crypto::KeyPair, runtime::InstanceId};

/// Service interface.
#[exonum_interface]
trait ServiceInterface<Ctx> {
    type Output;
    #[interface_method(id = 0)]
    fn create_wallet(&self, ctx: Ctx, username: String) -> Self::Output;
}

// Create a signed transaction.
let keypair = KeyPair::random();
const SERVICE_ID: InstanceId = 100;
let tx = keypair.create_wallet(SERVICE_ID, "Alice".to_owned());
// This transaction in pool will be represented as follows:
let json = json!({
    "type": "in_pool",
    "message": tx,
});
let parsed: TransactionInfo = serde_json::from_value(json).unwrap();
assert!(parsed.is_in_pool());

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
InPool

Transaction is in the memory pool, but not yet committed to the blockchain.

Fields of InPool

message: Verified<AnyTx>

A content of the uncommitted transaction.

Transaction is already committed to the blockchain.

Methods

impl TransactionInfo[src]

pub fn message(&self) -> &Verified<AnyTx>[src]

Returns the content of this transaction.

pub fn is_in_pool(&self) -> bool[src]

Is this in-pool transaction?

pub fn is_committed(&self) -> bool[src]

Is this a committed transaction?

pub fn as_committed(&self) -> Option<&CommittedTransaction>[src]

Returns a reference to the inner committed transaction if this transaction is committed. For transactions in pool, returns None.

Trait Implementations

impl Debug for TransactionInfo[src]

impl<'de> Deserialize<'de> for TransactionInfo[src]

impl Serialize for TransactionInfo[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,