Trait elrond_wasm::api::BlockchainApi[][src]

pub trait BlockchainApi: StorageReadApi + ErrorApi + Clone + Sized + 'static {
    type BalanceType: BigUintApi + 'static;
Show methods fn get_sc_address(&self) -> Address;
fn get_owner_address(&self) -> Address;
fn get_shard_of_address(&self, address: &Address) -> u32;
fn is_smart_contract(&self, address: &Address) -> bool;
fn get_caller(&self) -> Address;
fn get_balance(&self, address: &Address) -> Self::BalanceType;
fn get_tx_hash(&self) -> H256;
fn get_gas_left(&self) -> u64;
fn get_block_timestamp(&self) -> u64;
fn get_block_nonce(&self) -> u64;
fn get_block_round(&self) -> u64;
fn get_block_epoch(&self) -> u64;
fn get_block_random_seed(&self) -> Box<[u8; 48]>

Notable traits for Box<F, A>

impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
;
fn get_prev_block_timestamp(&self) -> u64;
fn get_prev_block_nonce(&self) -> u64;
fn get_prev_block_round(&self) -> u64;
fn get_prev_block_epoch(&self) -> u64;
fn get_prev_block_random_seed(&self) -> Box<[u8; 48]>

Notable traits for Box<F, A>

impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
;
fn get_current_esdt_nft_nonce(&self, address: &Address, token: &[u8]) -> u64;
fn get_esdt_balance(
        &self,
        address: &Address,
        token: &[u8],
        nonce: u64
    ) -> Self::BalanceType;
fn get_esdt_token_data(
        &self,
        address: &Address,
        token: &[u8],
        nonce: u64
    ) -> EsdtTokenData<Self::BalanceType>; fn get_sc_balance(&self) -> Self::BalanceType { ... }
fn get_cumulated_validator_rewards(&self) -> Self::BalanceType { ... }
fn get_esdt_local_roles(&self, token_id: &[u8]) -> Vec<EsdtLocalRole> { ... }
}
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.

Associated Types

type BalanceType: BigUintApi + 'static[src]

Expand description

The type of the token balances. Not named BigUint to avoid name collisions in types that implement multiple API traits.

Required methods

fn get_sc_address(&self) -> Address[src]

fn get_owner_address(&self) -> Address[src]

fn get_shard_of_address(&self, address: &Address) -> u32[src]

fn is_smart_contract(&self, address: &Address) -> bool[src]

fn get_caller(&self) -> Address[src]

fn get_balance(&self, address: &Address) -> Self::BalanceType[src]

fn get_tx_hash(&self) -> H256[src]

fn get_gas_left(&self) -> u64[src]

fn get_block_timestamp(&self) -> u64[src]

fn get_block_nonce(&self) -> u64[src]

fn get_block_round(&self) -> u64[src]

fn get_block_epoch(&self) -> u64[src]

fn get_block_random_seed(&self) -> Box<[u8; 48]>

Notable traits for Box<F, A>

impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

fn get_prev_block_timestamp(&self) -> u64[src]

fn get_prev_block_nonce(&self) -> u64[src]

fn get_prev_block_round(&self) -> u64[src]

fn get_prev_block_epoch(&self) -> u64[src]

fn get_prev_block_random_seed(&self) -> Box<[u8; 48]>

Notable traits for Box<F, A>

impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

fn get_current_esdt_nft_nonce(&self, address: &Address, token: &[u8]) -> u64[src]

fn get_esdt_balance(
    &self,
    address: &Address,
    token: &[u8],
    nonce: u64
) -> Self::BalanceType
[src]

fn get_esdt_token_data(
    &self,
    address: &Address,
    token: &[u8],
    nonce: u64
) -> EsdtTokenData<Self::BalanceType>
[src]

Provided methods

fn get_sc_balance(&self) -> Self::BalanceType[src]

fn get_cumulated_validator_rewards(&self) -> Self::BalanceType[src]

Expand description

Retrieves validator rewards, as set by the protocol. TODO: move to the storage API, once BigUint gets refactored

fn get_esdt_local_roles(&self, token_id: &[u8]) -> Vec<EsdtLocalRole>[src]

Expand description

Retrieves local roles for the token, by reading protected storage.

Implementors