pub struct Engine<DRV: Driver, RNG: CryptoRngCore = OsRng> { /* private fields */ }
Expand description

Engine provides hardware-independent support for MobileCoin wallet operations

Implementations§

source§

impl<DRV: Driver> Engine<DRV>

source

pub const fn new(drv: DRV) -> Self

Create a new transaction engine instance with the provided driver, using the default OsRng

source§

impl<DRV: Driver, RNG: CryptoRngCore> Engine<DRV, RNG>

source

pub const fn new_with_rng(drv: DRV, rng: RNG) -> Self

Create a new transaction engine instance with the provided driver and rng

source

pub unsafe fn init(p: *mut Self, drv: DRV, rng: RNG)

Initialise an uninitialised engine instance pointer, another adventure in stack frame reduction TODO: add checks that init and new_with_rng match

Safety

per-field init is okay so long as we init all fields

source

pub fn update(&mut self, evt: &Event) -> Result<Output, Error>

Handle incoming transaction events

source

pub fn state(&self) -> State

Fetch current engine state

source

pub fn get_account(&self, account_index: u32) -> Account

Fetch an [Account] instance for a given wallet index

source

pub fn get_subaddress( &self, account_index: u32, subaddress_index: u64, fog_id: FogId ) -> OutputAddress

Fetch a Subaddress instance for a given wallet and subaddress index

source

pub fn is_unlocked(&self) -> bool

Check whether engine is unlocked (ie. key requests and scanning have been approved)

source

pub fn unlock(&mut self)

Unlock the engine (allowing key requests and scanning)

source

pub fn lock(&mut self)

Lock the engine (requires approval for key requests and scanning)

source

pub fn approve(&mut self)

Approve a pending transaction (advances state to State::Ready)

source

pub fn deny(&mut self)

Deny a pending transaction

source

pub fn reset(&mut self)

Reset engine state

source

pub fn progress(&self) -> Option<usize>

Fetch progress for non-interactive states (summary, ring signing)

source

pub fn message(&self) -> Option<&[u8]>

Fetch message for transactions in progress

source

pub fn report(&self) -> Option<&TxSummaryUnblindingReport<MAX_RECORDS>>

Return report if available

source

pub fn address(&self, h: &ShortAddressHash) -> Option<&OutputAddress>

Resolve address if available

source

pub fn ident(&self) -> Option<&Ident>

Return ident info if available

source

pub fn ident_approve(&mut self, approve: bool)

Approve or deny a pending identity request, updating the IdentState

Auto Trait Implementations§

§

impl<DRV, RNG> RefUnwindSafe for Engine<DRV, RNG>where DRV: RefUnwindSafe, RNG: RefUnwindSafe,

§

impl<DRV, RNG> Send for Engine<DRV, RNG>where DRV: Send, RNG: Send,

§

impl<DRV, RNG> Sync for Engine<DRV, RNG>where DRV: Sync, RNG: Sync,

§

impl<DRV, RNG> Unpin for Engine<DRV, RNG>where DRV: Unpin, RNG: Unpin,

§

impl<DRV, RNG> UnwindSafe for Engine<DRV, RNG>where DRV: UnwindSafe, RNG: UnwindSafe,

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V