Function std::tx::tx_type

pub fn tx_type() -> Transaction 
Expand description

Get the type of the current transaction.
Either Transaction::Script or Transaction::Create.

Returns

  • [Transaction] - The type of the current transaction.

Reverts

  • When the transaction type is unrecognized. This should never happen.

Example

use std::tx::tx_type;

fn foo() {
    let tx_type = tx_type();
    match tx_type {
        Transaction::Script => {
            log("Regular script transaction");
        },
        Transaction::Create => {
            log("Contract deployment transaction");
        },
    }
}