Trait linera_execution::ContractRuntime
source · pub trait ContractRuntime: BaseRuntime {
Show 14 methods
// Required methods
fn authenticated_signer(&mut self) -> Result<Option<Owner>, 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<UserApplicationId>, 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: Option<Owner>,
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: UserApplicationId,
argument: Vec<u8>
) -> Result<Vec<u8>, ExecutionError>;
fn open_chain(
&mut self,
ownership: ChainOwnership,
balance: Amount
) -> Result<ChainId, ExecutionError>;
fn close_chain(&mut self) -> Result<(), ExecutionError>;
}Required Methods§
sourcefn authenticated_signer(&mut self) -> Result<Option<Owner>, ExecutionError>
fn authenticated_signer(&mut self) -> Result<Option<Owner>, 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<UserApplicationId>, ExecutionError>
fn authenticated_caller_id( &mut self ) -> Result<Option<UserApplicationId>, 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: Option<Owner>,
destination: Account,
amount: Amount
) -> Result<(), ExecutionError>
fn transfer( &mut self, source: Option<Owner>, 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: UserApplicationId,
argument: Vec<u8>
) -> Result<Vec<u8>, ExecutionError>
fn try_call_application( &mut self, authenticated: bool, callee_id: UserApplicationId, 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 open_chain(
&mut self,
ownership: ChainOwnership,
balance: Amount
) -> Result<ChainId, ExecutionError>
fn open_chain( &mut self, ownership: ChainOwnership, balance: Amount ) -> Result<ChainId, ExecutionError>
Opens a new chain.
sourcefn close_chain(&mut self) -> Result<(), ExecutionError>
fn close_chain(&mut self) -> Result<(), ExecutionError>
Closes the current chain.