[][src]Module near_bindgen::env

The methods that are available by the smart contracts to call. This is a safe wrapper around low-level BlockchainInterface.

Functions

account_balance

The balance attached to the given account. This includes the attached_deposit that was attached to the transaction

attached_deposit

The balance that was attached to the call that will be immediately deposited before the contract execution starts

block_index

Current block index.

current_account_id

The id of the account that owns the current contract.

input

The input to the contract call serialized as bytes. If input is not provided returns None.

log

Log the UTF-8 encodable message.

panic

Terminates the execution of the program.

predecessor_account_id

The id of the account that was the previous contract in the chain of cross-contract calls. If this is the first contract, it is equal to signer_account_id.

prepaid_gas

The amount of gas attached to the call that can be used to pay for the gas fees.

promise_and

Creates a new promise which completes when time all promises passed as arguments complete.

promise_create

Creates a promise that will execute a method on account with given arguments and attaches the given amount and gas.

promise_result

If the current function is invoked by a callback we can access the execution results of the promises that caused the callback.

promise_results_count

If the current function is invoked by a callback we can access the execution results of the promises that caused the callback. This function returns the number of complete and incomplete callbacks.

promise_return

Consider the execution result of promise under promise_idx as execution result of this function.

promise_then

Attaches the callback that is executed after promise pointed by promise_idx is complete.

random_seed

Get random seed from the register.

read_register

Reads the content of the register_id. If register is not used returns None.

register_len

Returns the size of the register. If register is not used returns None.

set_blockchain_interface
sha256

Hashes the random sequence of bytes using sha256.

signer_account_id

The id of the account that either signed the original transaction or issued the initial cross-contract call.

signer_account_pk

The public key of the account that did the signing.

state_read

Load the state of the given object.

state_write
storage_get_evicted

Reads the most recent value that was evicted with storage_write or storage_remove command.

storage_has_key

Checks if there is a key-value in the storage.

storage_iter_key_read

Reads the key that iterator was pointing to.

storage_iter_next

Checks the next element of iterator progressing it. Returns true if the element is available. Returns false if iterator has finished.

storage_iter_prefix

Creates an iterator that iterates key-values based on the prefix of the key.

storage_iter_range

Creates an iterator that iterates key-values in [start, end) interval.

storage_iter_value_read

Reads the value that iterator was pointing to.

storage_read

Reads the value stored under the given key.

storage_remove

Removes the value stored under the given key. If key-value existed returns true, otherwise false.

storage_usage

Current total storage usage of this smart contract that this account would be paying for.

storage_write

Writes key-value into storage. If another key-value existed in the storage with the same key it returns true, otherwise false.

used_gas

The gas that was already burnt during the contract execution (cannot exceed prepaid_gas)

value_return

Sets the blob of data as the return value of the contract.