[−][src]Enum exonum_explorer::TransactionInfo
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)
Transaction is in the memory pool, but not yet committed to the blockchain.
Committed(CommittedTransaction)
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]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for TransactionInfo
[src]
Auto Trait Implementations
impl RefUnwindSafe for TransactionInfo
impl Send for TransactionInfo
impl Sync for TransactionInfo
impl Unpin for TransactionInfo
impl UnwindSafe for TransactionInfo
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,