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>) -> CanisterId

source

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

source

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

source

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

source

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

source

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

source

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

source

pub fn delete_canister( &self, canister_id: CanisterId, 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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<T> for T

§

type Output = T

Should always be Self
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.