pub trait ContractRuntime: BaseRuntime {
Show 23 methods
// Required methods
fn authenticated_signer(
&mut self,
) -> Result<Option<AccountOwner>, ExecutionError>;
fn message_id(&mut self) -> Result<Option<MessageId>, ExecutionError>;
fn message_is_bouncing(&mut self) -> Result<Option<bool>, ExecutionError>;
fn authenticated_caller_id(
&mut self,
) -> Result<Option<ApplicationId>, ExecutionError>;
fn remaining_fuel(&mut self) -> Result<u64, ExecutionError>;
fn consume_fuel(&mut self, fuel: u64) -> Result<(), ExecutionError>;
fn send_message(
&mut self,
message: SendMessageRequest<Vec<u8>>,
) -> Result<(), ExecutionError>;
fn subscribe(
&mut self,
chain: ChainId,
channel: ChannelName,
) -> Result<(), ExecutionError>;
fn unsubscribe(
&mut self,
chain: ChainId,
channel: ChannelName,
) -> Result<(), ExecutionError>;
fn transfer(
&mut self,
source: AccountOwner,
destination: Account,
amount: Amount,
) -> Result<(), ExecutionError>;
fn claim(
&mut self,
source: Account,
destination: Account,
amount: Amount,
) -> Result<(), ExecutionError>;
fn try_call_application(
&mut self,
authenticated: bool,
callee_id: ApplicationId,
argument: Vec<u8>,
) -> Result<Vec<u8>, ExecutionError>;
fn emit(
&mut self,
name: StreamName,
value: Vec<u8>,
) -> Result<u32, ExecutionError>;
fn read_event(
&mut self,
chain_id: ChainId,
stream_name: StreamName,
index: u32,
) -> Result<Vec<u8>, ExecutionError>;
fn subscribe_to_events(
&mut self,
chain_id: ChainId,
application_id: ApplicationId,
stream_name: StreamName,
) -> Result<(), ExecutionError>;
fn unsubscribe_from_events(
&mut self,
chain_id: ChainId,
application_id: ApplicationId,
stream_name: StreamName,
) -> Result<(), ExecutionError>;
fn query_service(
&mut self,
application_id: ApplicationId,
query: Vec<u8>,
) -> Result<Vec<u8>, ExecutionError>;
fn open_chain(
&mut self,
ownership: ChainOwnership,
application_permissions: ApplicationPermissions,
balance: Amount,
) -> Result<(MessageId, ChainId), ExecutionError>;
fn close_chain(&mut self) -> Result<(), ExecutionError>;
fn change_application_permissions(
&mut self,
application_permissions: ApplicationPermissions,
) -> Result<(), ExecutionError>;
fn create_application(
&mut self,
module_id: ModuleId,
parameters: Vec<u8>,
argument: Vec<u8>,
required_application_ids: Vec<ApplicationId>,
) -> Result<ApplicationId, ExecutionError>;
fn validation_round(&mut self) -> Result<Option<u32>, ExecutionError>;
fn write_batch(&mut self, batch: Batch) -> Result<(), ExecutionError>;
}
Required Methods§
Sourcefn authenticated_signer(
&mut self,
) -> Result<Option<AccountOwner>, ExecutionError>
fn authenticated_signer( &mut self, ) -> Result<Option<AccountOwner>, ExecutionError>
The authenticated signer for this execution, if there is one.
Sourcefn message_id(&mut self) -> Result<Option<MessageId>, ExecutionError>
fn message_id(&mut self) -> Result<Option<MessageId>, ExecutionError>
The current message ID, if there is one.
Sourcefn message_is_bouncing(&mut self) -> Result<Option<bool>, ExecutionError>
fn message_is_bouncing(&mut self) -> Result<Option<bool>, ExecutionError>
If the current message (if there is one) was rejected by its destination and is now bouncing back.
Sourcefn authenticated_caller_id(
&mut self,
) -> Result<Option<ApplicationId>, ExecutionError>
fn authenticated_caller_id( &mut self, ) -> Result<Option<ApplicationId>, ExecutionError>
The optional authenticated caller application ID, if it was provided and if there is one based on the execution context.
Sourcefn remaining_fuel(&mut self) -> Result<u64, ExecutionError>
fn remaining_fuel(&mut self) -> Result<u64, ExecutionError>
Returns the amount of execution fuel remaining before execution is aborted.
Sourcefn consume_fuel(&mut self, fuel: u64) -> Result<(), ExecutionError>
fn consume_fuel(&mut self, fuel: u64) -> Result<(), ExecutionError>
Consumes some of the execution fuel.
Sourcefn send_message(
&mut self,
message: SendMessageRequest<Vec<u8>>,
) -> Result<(), ExecutionError>
fn send_message( &mut self, message: SendMessageRequest<Vec<u8>>, ) -> Result<(), ExecutionError>
Schedules a message to be sent.
Sourcefn subscribe(
&mut self,
chain: ChainId,
channel: ChannelName,
) -> Result<(), ExecutionError>
fn subscribe( &mut self, chain: ChainId, channel: ChannelName, ) -> Result<(), ExecutionError>
Schedules to subscribe to some channel
on a chain
.
Sourcefn unsubscribe(
&mut self,
chain: ChainId,
channel: ChannelName,
) -> Result<(), ExecutionError>
fn unsubscribe( &mut self, chain: ChainId, channel: ChannelName, ) -> Result<(), ExecutionError>
Schedules to unsubscribe to some channel
on a chain
.
Sourcefn transfer(
&mut self,
source: AccountOwner,
destination: Account,
amount: Amount,
) -> Result<(), ExecutionError>
fn transfer( &mut self, source: AccountOwner, destination: Account, amount: Amount, ) -> Result<(), ExecutionError>
Transfers amount from source to destination.
Sourcefn claim(
&mut self,
source: Account,
destination: Account,
amount: Amount,
) -> Result<(), ExecutionError>
fn claim( &mut self, source: Account, destination: Account, amount: Amount, ) -> Result<(), ExecutionError>
Claims amount from source to destination.
Sourcefn try_call_application(
&mut self,
authenticated: bool,
callee_id: ApplicationId,
argument: Vec<u8>,
) -> Result<Vec<u8>, ExecutionError>
fn try_call_application( &mut self, authenticated: bool, callee_id: ApplicationId, argument: Vec<u8>, ) -> Result<Vec<u8>, ExecutionError>
Calls another application. Forwarded sessions will now be visible to
callee_id
(but not to the caller any more).
Sourcefn emit(
&mut self,
name: StreamName,
value: Vec<u8>,
) -> Result<u32, ExecutionError>
fn emit( &mut self, name: StreamName, value: Vec<u8>, ) -> Result<u32, ExecutionError>
Adds a new item to an event stream. Returns the new event’s index in the stream.
Sourcefn read_event(
&mut self,
chain_id: ChainId,
stream_name: StreamName,
index: u32,
) -> Result<Vec<u8>, ExecutionError>
fn read_event( &mut self, chain_id: ChainId, stream_name: StreamName, index: u32, ) -> Result<Vec<u8>, ExecutionError>
Reads an event from a stream. Returns the event’s value.
Returns an error if the event doesn’t exist.
Sourcefn subscribe_to_events(
&mut self,
chain_id: ChainId,
application_id: ApplicationId,
stream_name: StreamName,
) -> Result<(), ExecutionError>
fn subscribe_to_events( &mut self, chain_id: ChainId, application_id: ApplicationId, stream_name: StreamName, ) -> Result<(), ExecutionError>
Subscribes this application to an event stream.
Sourcefn unsubscribe_from_events(
&mut self,
chain_id: ChainId,
application_id: ApplicationId,
stream_name: StreamName,
) -> Result<(), ExecutionError>
fn unsubscribe_from_events( &mut self, chain_id: ChainId, application_id: ApplicationId, stream_name: StreamName, ) -> Result<(), ExecutionError>
Unsubscribes this application from an event stream.
Sourcefn query_service(
&mut self,
application_id: ApplicationId,
query: Vec<u8>,
) -> Result<Vec<u8>, ExecutionError>
fn query_service( &mut self, application_id: ApplicationId, query: Vec<u8>, ) -> Result<Vec<u8>, ExecutionError>
Queries a service.
Sourcefn open_chain(
&mut self,
ownership: ChainOwnership,
application_permissions: ApplicationPermissions,
balance: Amount,
) -> Result<(MessageId, ChainId), ExecutionError>
fn open_chain( &mut self, ownership: ChainOwnership, application_permissions: ApplicationPermissions, balance: Amount, ) -> Result<(MessageId, ChainId), ExecutionError>
Opens a new chain.
Sourcefn close_chain(&mut self) -> Result<(), ExecutionError>
fn close_chain(&mut self) -> Result<(), ExecutionError>
Closes the current chain.
Sourcefn change_application_permissions(
&mut self,
application_permissions: ApplicationPermissions,
) -> Result<(), ExecutionError>
fn change_application_permissions( &mut self, application_permissions: ApplicationPermissions, ) -> Result<(), ExecutionError>
Changes the application permissions on the current chain.
Sourcefn create_application(
&mut self,
module_id: ModuleId,
parameters: Vec<u8>,
argument: Vec<u8>,
required_application_ids: Vec<ApplicationId>,
) -> Result<ApplicationId, ExecutionError>
fn create_application( &mut self, module_id: ModuleId, parameters: Vec<u8>, argument: Vec<u8>, required_application_ids: Vec<ApplicationId>, ) -> Result<ApplicationId, ExecutionError>
Creates a new application on chain.
Sourcefn validation_round(&mut self) -> Result<Option<u32>, ExecutionError>
fn validation_round(&mut self) -> Result<Option<u32>, ExecutionError>
Returns the round in which this block was validated.
Sourcefn write_batch(&mut self, batch: Batch) -> Result<(), ExecutionError>
fn write_batch(&mut self, batch: Batch) -> Result<(), ExecutionError>
Writes a batch of changes.