Skip to main content

HostApiOutcome

Enum HostApiOutcome 

Source
pub enum HostApiOutcome {
    Response {
        data: Vec<u8>,
    },
    NeedsSign {
        request_id: String,
        request_tag: u8,
        public_key: Vec<u8>,
        payload: Vec<u8>,
    },
    NeedsChainQuery {
        request_id: String,
        method: String,
        params: Value,
    },
    NeedsChainSubscription {
        request_id: String,
        method: String,
        params: Value,
    },
    NeedsNavigate {
        request_id: String,
        url: String,
    },
    NeedsChainFollow {
        request_id: String,
        genesis_hash: Vec<u8>,
        with_runtime: bool,
    },
    NeedsChainRpc {
        request_id: String,
        request_tag: u8,
        genesis_hash: Vec<u8>,
        json_rpc_method: String,
        json_rpc_params: Value,
        follow_sub_id: Option<String>,
    },
    Silent,
}
Expand description

Outcome of processing a host-api message.

Variants§

§

Response

Send this response directly back to the app.

Fields

§data: Vec<u8>
§

NeedsSign

Sign request — needs wallet to produce a signature before responding.

Fields

§request_id: String
§request_tag: u8
§public_key: Vec<u8>
§payload: Vec<u8>
§

NeedsChainQuery

JSON-RPC query — needs routing through the chain API allowlist + RPC bridge.

Fields

§request_id: String
§method: String
§params: Value
§

NeedsChainSubscription

JSON-RPC subscription — needs routing through the chain API for streaming responses.

Fields

§request_id: String
§method: String
§params: Value
§

NeedsNavigate

Navigation request — the workbench should open this URL (may be a .dot address).

Fields

§request_id: String
§

NeedsChainFollow

Start a chainHead_v1_follow subscription for a specific chain.

Fields

§request_id: String
§genesis_hash: Vec<u8>
§with_runtime: bool
§

NeedsChainRpc

A chain interaction request (header, storage, call, etc.) that needs routing to smoldot via JSON-RPC. The response_tag and json_rpc_method tell the workbench how to route and encode the response.

Fields

§request_id: String
§request_tag: u8
§genesis_hash: Vec<u8>
§json_rpc_method: String
§json_rpc_params: Value
§follow_sub_id: Option<String>

The follow subscription ID from the product-SDK (opaque string).

§

Silent

No response needed (fire-and-forget).

Trait Implementations§

Source§

impl Serialize for HostApiOutcome

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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, 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.