Struct StateMachine

Source
pub struct StateMachine { /* private fields */ }

Implementations§

Source§

impl StateMachine

Source

pub fn new(binary_path: &str, debug: bool) -> Self

Source

pub fn update_call( &self, canister_id: Principal, sender: Principal, method: &str, arg: Vec<u8>, ) -> Result<WasmResult, UserError>

Source

pub fn query_call( &self, canister_id: Principal, sender: Principal, method: &str, arg: Vec<u8>, ) -> Result<WasmResult, UserError>

Source

pub fn root_key(&self) -> Vec<u8>

Source

pub fn create_canister(&self, sender: Option<Principal>) -> Principal

Source

pub fn create_canister_with_settings( &self, settings: Option<CanisterSettings>, sender: Option<Principal>, ) -> Principal

Source

pub fn install_canister( &self, canister_id: Principal, wasm_module: Vec<u8>, arg: Vec<u8>, sender: Option<Principal>, )

Source

pub fn upgrade_canister( &self, canister_id: Principal, wasm_module: Vec<u8>, arg: Vec<u8>, sender: Option<Principal>, ) -> Result<(), CallError>

Source

pub fn reinstall_canister( &self, canister_id: Principal, wasm_module: Vec<u8>, arg: Vec<u8>, sender: Option<Principal>, ) -> Result<(), CallError>

Source

pub fn start_canister( &self, canister_id: Principal, sender: Option<Principal>, ) -> Result<(), CallError>

Source

pub fn stop_canister( &self, canister_id: Principal, sender: Option<Principal>, ) -> Result<(), CallError>

Source

pub fn delete_canister( &self, canister_id: Principal, sender: Option<Principal>, ) -> Result<(), CallError>

Source

pub fn canister_exists(&self, canister_id: Principal) -> bool

Source

pub fn time(&self) -> SystemTime

Source

pub fn set_time(&self, time: SystemTime)

Source

pub fn advance_time(&self, duration: Duration)

Source

pub fn tick(&self)

Source

pub fn run_until_completion(&self, max_ticks: u64)

Source

pub fn stable_memory(&self, canister_id: Principal) -> Vec<u8>

Source

pub fn set_stable_memory(&self, canister_id: Principal, data: ByteBuf)

Source

pub fn cycle_balance(&self, canister_id: Principal) -> u128

Source

pub fn add_cycles(&self, canister_id: Principal, amount: u128) -> u128

Source

pub fn verify_canister_signature( &self, msg: Vec<u8>, sig: Vec<u8>, pubkey: Vec<u8>, root_pubkey: Vec<u8>, ) -> Result<(), String>

Verifies a canister signature. Returns Ok(()) if the signature is valid. On error, returns a string describing the error.

Trait Implementations§

Source§

impl Drop for StateMachine

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.