pub fn tx_type() -> Transaction
Expand description
Get the type of the current transaction.
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");
},
Transaction::Mint => {
log("This should never happen");
},
Transaction::Upgrade => {
log("Upgrade transaction");
},
Transaction::Upload => {
log("Upload transaction");
},
Transaction::Blob => {
log("Blob transaction");
},
}
}