[][src]Struct fabric_contract::blockchain::TransactionContext

pub struct TransactionContext { /* fields omitted */ }

Represents a transaction

This can be used to obtain information about the current transaction that trigger a contract function to be executed.

Timestamp and MSPID are two important fields

Example

pub fn myTransactionFn(){
  let tx = fabric_contract::blockchain::TransactionContext::current_transaction();

  let id = tx.get_id();
  let timestamp = tx.get_timestamp();
  let mspid = tx.get_peer_mspid();
}

Implementations

impl TransactionContext[src]

pub fn new(ctx: &TxCtx) -> TransactionContext[src]

pub fn get_id(&self) -> String[src]

Gets the transaction id

Full transaction id

pub fn get_timestamp(&self) -> String[src]

Gets the timestamp of this transaction

Format is ISO - need better type here

pub fn get_channelid(&self) -> String[src]

pub fn get_peer_mspid(&self) -> String[src]

The MSP Identifier of the originating organization

pub fn get_submitting_identity(&self) -> Result<ClientIdentity, String>[src]

Get

pub fn current_transaction() -> TransactionContext[src]

Get the current transaction

Trait Implementations

impl Clone for TransactionContext[src]

impl Default for TransactionContext[src]

Auto Trait Implementations

impl RefUnwindSafe for TransactionContext

impl Send for TransactionContext

impl Sync for TransactionContext

impl Unpin for TransactionContext

impl UnwindSafe for TransactionContext

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> From<T> for T[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.