Skip to main content

BaseRuntime

Trait BaseRuntime 

Source
pub trait BaseRuntime {
    type Read: Debug + Send + Sync;
    type ContainsKey: Debug + Send + Sync;
    type ContainsKeys: Debug + Send + Sync;
    type ReadMultiValuesBytes: Debug + Send + Sync;
    type ReadValueBytes: Debug + Send + Sync;
    type FindKeysByPrefix: Debug + Send + Sync;
    type FindKeyValuesByPrefix: Debug + Send + Sync;

Show 30 methods // Required methods fn chain_id(&mut self) -> Result<ChainId, ExecutionError>; fn block_height(&mut self) -> Result<BlockHeight, ExecutionError>; fn application_id(&mut self) -> Result<ApplicationId, ExecutionError>; fn application_creator_chain_id( &mut self, ) -> Result<ChainId, ExecutionError>; fn read_application_description( &mut self, application_id: ApplicationId, ) -> Result<ApplicationDescription, ExecutionError>; fn application_parameters(&mut self) -> Result<Vec<u8>, ExecutionError>; fn read_system_timestamp(&mut self) -> Result<Timestamp, ExecutionError>; fn read_chain_balance(&mut self) -> Result<Amount, ExecutionError>; fn read_owner_balance( &mut self, owner: AccountOwner, ) -> Result<Amount, ExecutionError>; fn read_owner_balances( &mut self, ) -> Result<Vec<(AccountOwner, Amount)>, ExecutionError>; fn read_balance_owners( &mut self, ) -> Result<Vec<AccountOwner>, ExecutionError>; fn chain_ownership(&mut self) -> Result<ChainOwnership, ExecutionError>; fn application_permissions( &mut self, ) -> Result<ApplicationPermissions, ExecutionError>; fn contains_key_new( &mut self, key: Vec<u8>, ) -> Result<Self::ContainsKey, ExecutionError>; fn contains_key_wait( &mut self, promise: &Self::ContainsKey, ) -> Result<bool, ExecutionError>; fn contains_keys_new( &mut self, keys: Vec<Vec<u8>>, ) -> Result<Self::ContainsKeys, ExecutionError>; fn contains_keys_wait( &mut self, promise: &Self::ContainsKeys, ) -> Result<Vec<bool>, ExecutionError>; fn read_multi_values_bytes_new( &mut self, keys: Vec<Vec<u8>>, ) -> Result<Self::ReadMultiValuesBytes, ExecutionError>; fn read_multi_values_bytes_wait( &mut self, promise: &Self::ReadMultiValuesBytes, ) -> Result<Vec<Option<Vec<u8>>>, ExecutionError>; fn read_value_bytes_new( &mut self, key: Vec<u8>, ) -> Result<Self::ReadValueBytes, ExecutionError>; fn read_value_bytes_wait( &mut self, promise: &Self::ReadValueBytes, ) -> Result<Option<Vec<u8>>, ExecutionError>; fn find_keys_by_prefix_new( &mut self, key_prefix: Vec<u8>, ) -> Result<Self::FindKeysByPrefix, ExecutionError>; fn find_keys_by_prefix_wait( &mut self, promise: &Self::FindKeysByPrefix, ) -> Result<Vec<Vec<u8>>, ExecutionError>; fn find_key_values_by_prefix_new( &mut self, key_prefix: Vec<u8>, ) -> Result<Self::FindKeyValuesByPrefix, ExecutionError>; fn find_key_values_by_prefix_wait( &mut self, promise: &Self::FindKeyValuesByPrefix, ) -> Result<Vec<(Vec<u8>, Vec<u8>)>, ExecutionError>; fn perform_http_request( &mut self, request: Request, ) -> Result<Response, ExecutionError>; fn assert_before( &mut self, timestamp: Timestamp, ) -> Result<(), ExecutionError>; fn read_data_blob( &mut self, hash: DataBlobHash, ) -> Result<Vec<u8>, ExecutionError>; fn assert_data_blob_exists( &mut self, hash: DataBlobHash, ) -> Result<(), ExecutionError>; fn allow_application_logs(&mut self) -> Result<bool, ExecutionError>;
}
Expand description

The runtime API shared by the contract and service parts of an application.

Required Associated Types§

Source

type Read: Debug + Send + Sync

The pending result of a generic read.

Source

type ContainsKey: Debug + Send + Sync

The pending result of a key existence check.

Source

type ContainsKeys: Debug + Send + Sync

The pending result of a multi-key existence check.

Source

type ReadMultiValuesBytes: Debug + Send + Sync

The pending result of reading the values for multiple keys.

Source

type ReadValueBytes: Debug + Send + Sync

The pending result of reading the value for a single key.

Source

type FindKeysByPrefix: Debug + Send + Sync

The pending result of finding the keys with a given prefix.

Source

type FindKeyValuesByPrefix: Debug + Send + Sync

The pending result of finding the key-value pairs with a given prefix.

Required Methods§

Source

fn chain_id(&mut self) -> Result<ChainId, ExecutionError>

The current chain ID.

Source

fn block_height(&mut self) -> Result<BlockHeight, ExecutionError>

The current block height.

Source

fn application_id(&mut self) -> Result<ApplicationId, ExecutionError>

The current application ID.

Source

fn application_creator_chain_id(&mut self) -> Result<ChainId, ExecutionError>

The current application creator’s chain ID.

Source

fn read_application_description( &mut self, application_id: ApplicationId, ) -> Result<ApplicationDescription, ExecutionError>

Returns the description of the given application.

Source

fn application_parameters(&mut self) -> Result<Vec<u8>, ExecutionError>

The current application parameters.

Source

fn read_system_timestamp(&mut self) -> Result<Timestamp, ExecutionError>

Reads the system timestamp.

Source

fn read_chain_balance(&mut self) -> Result<Amount, ExecutionError>

Reads the balance of the chain.

Source

fn read_owner_balance( &mut self, owner: AccountOwner, ) -> Result<Amount, ExecutionError>

Reads the owner balance.

Source

fn read_owner_balances( &mut self, ) -> Result<Vec<(AccountOwner, Amount)>, ExecutionError>

Reads the balances from all owners.

Source

fn read_balance_owners(&mut self) -> Result<Vec<AccountOwner>, ExecutionError>

Reads balance owners.

Source

fn chain_ownership(&mut self) -> Result<ChainOwnership, ExecutionError>

Reads the current ownership configuration for this chain.

Source

fn application_permissions( &mut self, ) -> Result<ApplicationPermissions, ExecutionError>

Reads the current application permissions for this chain.

Source

fn contains_key_new( &mut self, key: Vec<u8>, ) -> Result<Self::ContainsKey, ExecutionError>

Creates the promise to test whether a key exists in the key-value store

Source

fn contains_key_wait( &mut self, promise: &Self::ContainsKey, ) -> Result<bool, ExecutionError>

Resolves the promise to test whether a key exists in the key-value store

Source

fn contains_keys_new( &mut self, keys: Vec<Vec<u8>>, ) -> Result<Self::ContainsKeys, ExecutionError>

Creates the promise to test whether multiple keys exist in the key-value store

Source

fn contains_keys_wait( &mut self, promise: &Self::ContainsKeys, ) -> Result<Vec<bool>, ExecutionError>

Resolves the promise to test whether multiple keys exist in the key-value store

Source

fn read_multi_values_bytes_new( &mut self, keys: Vec<Vec<u8>>, ) -> Result<Self::ReadMultiValuesBytes, ExecutionError>

Creates the promise to access several keys from the key-value store

Source

fn read_multi_values_bytes_wait( &mut self, promise: &Self::ReadMultiValuesBytes, ) -> Result<Vec<Option<Vec<u8>>>, ExecutionError>

Resolves the promise to access several keys from the key-value store

Source

fn read_value_bytes_new( &mut self, key: Vec<u8>, ) -> Result<Self::ReadValueBytes, ExecutionError>

Creates the promise to access a key from the key-value store

Source

fn read_value_bytes_wait( &mut self, promise: &Self::ReadValueBytes, ) -> Result<Option<Vec<u8>>, ExecutionError>

Resolves the promise to access a key from the key-value store

Source

fn find_keys_by_prefix_new( &mut self, key_prefix: Vec<u8>, ) -> Result<Self::FindKeysByPrefix, ExecutionError>

Creates the promise to access keys having a specific prefix

Source

fn find_keys_by_prefix_wait( &mut self, promise: &Self::FindKeysByPrefix, ) -> Result<Vec<Vec<u8>>, ExecutionError>

Resolves the promise to access keys having a specific prefix

Source

fn find_key_values_by_prefix_new( &mut self, key_prefix: Vec<u8>, ) -> Result<Self::FindKeyValuesByPrefix, ExecutionError>

Creates the promise to access key/values having a specific prefix

Source

fn find_key_values_by_prefix_wait( &mut self, promise: &Self::FindKeyValuesByPrefix, ) -> Result<Vec<(Vec<u8>, Vec<u8>)>, ExecutionError>

Resolves the promise to access key/values having a specific prefix

Source

fn perform_http_request( &mut self, request: Request, ) -> Result<Response, ExecutionError>

Makes an HTTP request to the given URL and returns the answer, if any.

Source

fn assert_before(&mut self, timestamp: Timestamp) -> Result<(), ExecutionError>

Ensures that the current time at block validation is < timestamp. Note that block validation happens at or after the block timestamp, but isn’t necessarily the same.

Cannot be used in fast blocks: A block using this call should be proposed by a regular owner, not a super owner.

Source

fn read_data_blob( &mut self, hash: DataBlobHash, ) -> Result<Vec<u8>, ExecutionError>

Reads a data blob specified by a given hash.

Source

fn assert_data_blob_exists( &mut self, hash: DataBlobHash, ) -> Result<(), ExecutionError>

Asserts the existence of a data blob with the given hash.

Source

fn allow_application_logs(&mut self) -> Result<bool, ExecutionError>

Returns whether contract log messages should be output. This is typically enabled for clients but disabled for validators.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§