Struct multiversx_sc::contract_base::BlockchainWrapper
source · pub struct BlockchainWrapper<A>where
A: BlockchainApi + ManagedTypeApi + ErrorApi,{ /* private fields */ }Expand description
Interface to be used by the actual smart contract code.
Note: contracts and the api are not mutable. They simply pass on/retrieve data to/from the protocol. When mocking the blockchain state, we use the Rc/RefCell pattern to isolate mock state mutability from the contract interface.
Implementations§
source§impl<A> BlockchainWrapper<A>where
A: BlockchainApi + ManagedTypeApi + ErrorApi,
impl<A> BlockchainWrapper<A>where A: BlockchainApi + ManagedTypeApi + ErrorApi,
pub fn new() -> Self
pub fn get_caller(&self) -> ManagedAddress<A>
pub fn get_sc_address(&self) -> ManagedAddress<A>
pub fn get_owner_address(&self) -> ManagedAddress<A>
pub fn check_caller_is_owner(&self)
pub fn check_caller_is_user_account(&self)
pub fn get_shard_of_address(&self, address: &ManagedAddress<A>) -> u32
pub fn is_smart_contract(&self, address: &ManagedAddress<A>) -> bool
pub fn get_balance(&self, address: &ManagedAddress<A>) -> BigUint<A>
pub fn get_sc_balance( &self, token: &EgldOrEsdtTokenIdentifier<A>, nonce: u64 ) -> BigUint<A>
pub fn get_state_root_hash(&self) -> ManagedByteArray<A, 32>
pub fn get_tx_hash(&self) -> ManagedByteArray<A, 32>
pub fn get_gas_left(&self) -> u64
pub fn get_block_timestamp(&self) -> u64
pub fn get_block_nonce(&self) -> u64
pub fn get_block_round(&self) -> u64
pub fn get_block_epoch(&self) -> u64
pub fn get_block_random_seed(&self) -> ManagedByteArray<A, 48>
pub fn get_prev_block_timestamp(&self) -> u64
pub fn get_prev_block_nonce(&self) -> u64
pub fn get_prev_block_round(&self) -> u64
pub fn get_prev_block_epoch(&self) -> u64
pub fn get_prev_block_random_seed(&self) -> ManagedByteArray<A, 48>
pub fn get_current_esdt_nft_nonce( &self, address: &ManagedAddress<A>, token_id: &TokenIdentifier<A> ) -> u64
pub fn get_esdt_balance( &self, address: &ManagedAddress<A>, token_id: &TokenIdentifier<A>, nonce: u64 ) -> BigUint<A>
pub fn get_esdt_token_data( &self, address: &ManagedAddress<A>, token_id: &TokenIdentifier<A>, nonce: u64 ) -> EsdtTokenData<A>
sourcepub fn get_token_attributes<T: TopDecode>(
&self,
token_id: &TokenIdentifier<A>,
token_nonce: u64
) -> T
pub fn get_token_attributes<T: TopDecode>( &self, token_id: &TokenIdentifier<A>, token_nonce: u64 ) -> T
Retrieves and deserializes token attributes from the SC account, with given token identifier and nonce.
pub fn is_esdt_frozen( &self, address: &ManagedAddress<A>, token_id: &TokenIdentifier<A>, nonce: u64 ) -> bool
pub fn is_esdt_paused(&self, token_id: &TokenIdentifier<A>) -> bool
pub fn is_esdt_limited_transfer(&self, token_id: &TokenIdentifier<A>) -> bool
pub fn get_esdt_local_roles( &self, token_id: &TokenIdentifier<A> ) -> EsdtLocalRoleFlags
source§impl<A> BlockchainWrapper<A>where
A: BlockchainApi + StorageReadApi + ManagedTypeApi + ErrorApi,
impl<A> BlockchainWrapper<A>where A: BlockchainApi + StorageReadApi + ManagedTypeApi + ErrorApi,
sourcepub fn get_cumulated_validator_rewards(&self) -> BigUint<A>
pub fn get_cumulated_validator_rewards(&self) -> BigUint<A>
Retrieves validator rewards, as set by the protocol.
Trait Implementations§
source§impl<A> Default for BlockchainWrapper<A>where
A: BlockchainApi + ManagedTypeApi + ErrorApi + Default,
impl<A> Default for BlockchainWrapper<A>where A: BlockchainApi + ManagedTypeApi + ErrorApi + Default,
source§fn default() -> BlockchainWrapper<A>
fn default() -> BlockchainWrapper<A>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<A> CodecFromSelf for BlockchainWrapper<A>where A: CodecFromSelf,
impl<A> RefUnwindSafe for BlockchainWrapper<A>where A: RefUnwindSafe,
impl<A> Send for BlockchainWrapper<A>where A: Send,
impl<A> Sync for BlockchainWrapper<A>where A: Sync,
impl<A> Unpin for BlockchainWrapper<A>where A: Unpin,
impl<A> UnwindSafe for BlockchainWrapper<A>where A: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more