radix_engine_interface/api/
transaction_runtime_api.rs

1use crate::internal_prelude::*;
2use crate::types::Level;
3use radix_common::crypto::Hash;
4use radix_common::types::GlobalAddress;
5
6pub trait SystemTransactionRuntimeApi<E> {
7    /// Encode an address into Bech32. The HRP part is dependent on the network which is running.
8    fn bech32_encode_address(&mut self, address: GlobalAddress) -> Result<String, E>;
9
10    /// Retrieve the hash of the current transaction which is running.
11    fn get_transaction_hash(&mut self) -> Result<Hash, E>;
12
13    /// Generate a unique id
14    fn generate_ruid(&mut self) -> Result<[u8; 32], E>;
15
16    /// Emit a log message which will be available in the transaction receipt
17    fn emit_log(&mut self, level: Level, message: String) -> Result<(), E>;
18
19    /// End the transaction immediately with a given message to be included in the transaction receipt
20    fn panic(&mut self, message: String) -> Result<(), E>;
21}