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§
Sourcefn signer_account_id(&self) -> AccountId
fn signer_account_id(&self) -> AccountId
Account ID that signed the transaction.
Sourcefn current_account_id(&self) -> AccountId
fn current_account_id(&self) -> AccountId
Account ID of the currently executing contract.
Sourcefn predecessor_account_id(&self) -> AccountId
fn predecessor_account_id(&self) -> AccountId
Account ID which called the current contract.
Sourcefn block_height(&self) -> u64
fn block_height(&self) -> u64
Height of the current block.
Sourcefn block_timestamp(&self) -> Timestamp
fn block_timestamp(&self) -> Timestamp
Timestamp (in ns) of the current block.
Sourcefn attached_deposit(&self) -> u128
fn attached_deposit(&self) -> u128
Amount of NEAR attached to current call
Sourcefn random_seed(&self) -> H256
fn random_seed(&self) -> H256
Random seed generated for the current block
Sourcefn prepaid_gas(&self) -> NearGas
fn prepaid_gas(&self) -> NearGas
Prepaid NEAR Gas