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§
Sourcetype ContainsKey: Debug + Send + Sync
type ContainsKey: Debug + Send + Sync
The pending result of a key existence check.
Sourcetype ContainsKeys: Debug + Send + Sync
type ContainsKeys: Debug + Send + Sync
The pending result of a multi-key existence check.
Sourcetype ReadMultiValuesBytes: Debug + Send + Sync
type ReadMultiValuesBytes: Debug + Send + Sync
The pending result of reading the values for multiple keys.
Sourcetype ReadValueBytes: Debug + Send + Sync
type ReadValueBytes: Debug + Send + Sync
The pending result of reading the value for a single key.
Sourcetype FindKeysByPrefix: Debug + Send + Sync
type FindKeysByPrefix: Debug + Send + Sync
The pending result of finding the keys with a given prefix.
Sourcetype FindKeyValuesByPrefix: Debug + Send + Sync
type FindKeyValuesByPrefix: Debug + Send + Sync
The pending result of finding the key-value pairs with a given prefix.
Required Methods§
Sourcefn chain_id(&mut self) -> Result<ChainId, ExecutionError>
fn chain_id(&mut self) -> Result<ChainId, ExecutionError>
The current chain ID.
Sourcefn block_height(&mut self) -> Result<BlockHeight, ExecutionError>
fn block_height(&mut self) -> Result<BlockHeight, ExecutionError>
The current block height.
Sourcefn application_id(&mut self) -> Result<ApplicationId, ExecutionError>
fn application_id(&mut self) -> Result<ApplicationId, ExecutionError>
The current application ID.
Sourcefn application_creator_chain_id(&mut self) -> Result<ChainId, ExecutionError>
fn application_creator_chain_id(&mut self) -> Result<ChainId, ExecutionError>
The current application creator’s chain ID.
Sourcefn read_application_description(
&mut self,
application_id: ApplicationId,
) -> Result<ApplicationDescription, ExecutionError>
fn read_application_description( &mut self, application_id: ApplicationId, ) -> Result<ApplicationDescription, ExecutionError>
Returns the description of the given application.
Sourcefn application_parameters(&mut self) -> Result<Vec<u8>, ExecutionError>
fn application_parameters(&mut self) -> Result<Vec<u8>, ExecutionError>
The current application parameters.
Sourcefn read_system_timestamp(&mut self) -> Result<Timestamp, ExecutionError>
fn read_system_timestamp(&mut self) -> Result<Timestamp, ExecutionError>
Reads the system timestamp.
Sourcefn read_chain_balance(&mut self) -> Result<Amount, ExecutionError>
fn read_chain_balance(&mut self) -> Result<Amount, ExecutionError>
Reads the balance of the chain.
Sourcefn read_owner_balance(
&mut self,
owner: AccountOwner,
) -> Result<Amount, ExecutionError>
fn read_owner_balance( &mut self, owner: AccountOwner, ) -> Result<Amount, ExecutionError>
Reads the owner balance.
Sourcefn read_owner_balances(
&mut self,
) -> Result<Vec<(AccountOwner, Amount)>, ExecutionError>
fn read_owner_balances( &mut self, ) -> Result<Vec<(AccountOwner, Amount)>, ExecutionError>
Reads the balances from all owners.
Sourcefn read_balance_owners(&mut self) -> Result<Vec<AccountOwner>, ExecutionError>
fn read_balance_owners(&mut self) -> Result<Vec<AccountOwner>, ExecutionError>
Reads balance owners.
Sourcefn chain_ownership(&mut self) -> Result<ChainOwnership, ExecutionError>
fn chain_ownership(&mut self) -> Result<ChainOwnership, ExecutionError>
Reads the current ownership configuration for this chain.
Sourcefn application_permissions(
&mut self,
) -> Result<ApplicationPermissions, ExecutionError>
fn application_permissions( &mut self, ) -> Result<ApplicationPermissions, ExecutionError>
Reads the current application permissions for this chain.
Sourcefn contains_key_new(
&mut self,
key: Vec<u8>,
) -> Result<Self::ContainsKey, ExecutionError>
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
Sourcefn contains_key_wait(
&mut self,
promise: &Self::ContainsKey,
) -> Result<bool, ExecutionError>
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
Sourcefn contains_keys_new(
&mut self,
keys: Vec<Vec<u8>>,
) -> Result<Self::ContainsKeys, ExecutionError>
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
Sourcefn contains_keys_wait(
&mut self,
promise: &Self::ContainsKeys,
) -> Result<Vec<bool>, ExecutionError>
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
Sourcefn read_multi_values_bytes_new(
&mut self,
keys: Vec<Vec<u8>>,
) -> Result<Self::ReadMultiValuesBytes, ExecutionError>
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
Sourcefn read_multi_values_bytes_wait(
&mut self,
promise: &Self::ReadMultiValuesBytes,
) -> Result<Vec<Option<Vec<u8>>>, ExecutionError>
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
Sourcefn read_value_bytes_new(
&mut self,
key: Vec<u8>,
) -> Result<Self::ReadValueBytes, ExecutionError>
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
Sourcefn read_value_bytes_wait(
&mut self,
promise: &Self::ReadValueBytes,
) -> Result<Option<Vec<u8>>, ExecutionError>
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
Sourcefn find_keys_by_prefix_new(
&mut self,
key_prefix: Vec<u8>,
) -> Result<Self::FindKeysByPrefix, ExecutionError>
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
Sourcefn find_keys_by_prefix_wait(
&mut self,
promise: &Self::FindKeysByPrefix,
) -> Result<Vec<Vec<u8>>, ExecutionError>
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
Sourcefn find_key_values_by_prefix_new(
&mut self,
key_prefix: Vec<u8>,
) -> Result<Self::FindKeyValuesByPrefix, ExecutionError>
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
Sourcefn find_key_values_by_prefix_wait(
&mut self,
promise: &Self::FindKeyValuesByPrefix,
) -> Result<Vec<(Vec<u8>, Vec<u8>)>, ExecutionError>
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
Sourcefn perform_http_request(
&mut self,
request: Request,
) -> Result<Response, ExecutionError>
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.
Sourcefn assert_before(&mut self, timestamp: Timestamp) -> Result<(), ExecutionError>
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.
Sourcefn read_data_blob(
&mut self,
hash: DataBlobHash,
) -> Result<Vec<u8>, ExecutionError>
fn read_data_blob( &mut self, hash: DataBlobHash, ) -> Result<Vec<u8>, ExecutionError>
Reads a data blob specified by a given hash.
Sourcefn assert_data_blob_exists(
&mut self,
hash: DataBlobHash,
) -> Result<(), ExecutionError>
fn assert_data_blob_exists( &mut self, hash: DataBlobHash, ) -> Result<(), ExecutionError>
Asserts the existence of a data blob with the given hash.
Sourcefn allow_application_logs(&mut self) -> Result<bool, ExecutionError>
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".