Env

Trait Env 

Source
pub trait Env {
    // Required methods
    fn signer_account_id(&self) -> AccountId;
    fn current_account_id(&self) -> AccountId;
    fn predecessor_account_id(&self) -> AccountId;
    fn block_height(&self) -> u64;
    fn block_timestamp(&self) -> Timestamp;
    fn attached_deposit(&self) -> u128;
    fn random_seed(&self) -> H256;
    fn prepaid_gas(&self) -> NearGas;
    fn used_gas(&self) -> NearGas;

    // Provided methods
    fn assert_private_call(&self) -> Result<(), PrivateCallError> { ... }
    fn assert_one_yocto(&self) -> Result<(), OneYoctoAttachError> { ... }
}
Expand description

Returns information about the NEAR context in which the transaction is executing. In the case of a standalone binary, independent of NEAR these values would need to be mocked or otherwise passed in from an external source.

Required Methods§

Source

fn signer_account_id(&self) -> AccountId

Account ID that signed the transaction.

Source

fn current_account_id(&self) -> AccountId

Account ID of the currently executing contract.

Source

fn predecessor_account_id(&self) -> AccountId

Account ID which called the current contract.

Source

fn block_height(&self) -> u64

Height of the current block.

Source

fn block_timestamp(&self) -> Timestamp

Timestamp (in ns) of the current block.

Source

fn attached_deposit(&self) -> u128

Amount of NEAR attached to current call

Source

fn random_seed(&self) -> H256

Random seed generated for the current block

Source

fn prepaid_gas(&self) -> NearGas

Prepaid NEAR Gas

Source

fn used_gas(&self) -> NearGas

Used NEAR Gas

Provided Methods§

Implementors§