pub struct HostApi { /* private fields */ }Expand description
Shared host implementation. Handles decoded requests, returns encoded responses.
Implementations§
Source§impl HostApi
impl HostApi
pub fn new() -> Self
Sourcepub fn set_accounts(&mut self, accounts: Vec<Account>)
pub fn set_accounts(&mut self, accounts: Vec<Account>)
Set the accounts that will be returned by host_get_non_product_accounts.
SECURITY: This exposes account identifiers to any product that requests them. Will be replaced by scoped per-product identities via host-sso.
Sourcepub fn set_supported_chains(
&mut self,
chains: impl IntoIterator<Item = [u8; 32]>,
)
pub fn set_supported_chains( &mut self, chains: impl IntoIterator<Item = [u8; 32]>, )
Set the chain genesis hashes that this host supports. Each hash is 32 bytes (raw, not hex-encoded).
Sourcepub fn handle_message(&mut self, raw: &[u8], app_id: &str) -> HostApiOutcome
pub fn handle_message(&mut self, raw: &[u8], app_id: &str) -> HostApiOutcome
Process a raw binary message from the app.
Returns HostApiOutcome::Response for immediate replies,
HostApiOutcome::NeedsSign for sign requests that need wallet approval,
or HostApiOutcome::Silent for fire-and-forget messages.
app_id scopes local storage — each app gets its own namespace.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HostApi
impl RefUnwindSafe for HostApi
impl Send for HostApi
impl Sync for HostApi
impl Unpin for HostApi
impl UnsafeUnpin for HostApi
impl UnwindSafe for HostApi
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more