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,
},
NeedsPushNotification {
request_id: String,
text: String,
deeplink: Option<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>,
},
NeedsStorageRead {
request_id: String,
key: String,
},
NeedsStorageWrite {
request_id: String,
key: String,
value: Vec<u8>,
},
NeedsStorageClear {
request_id: String,
key: String,
},
Silent,
}Expand description
Outcome of processing a host-api message.
Variants§
Response
Send this response directly back to the app.
NeedsSign
Sign request — needs wallet to produce a signature before responding.
NeedsChainQuery
JSON-RPC query — needs routing through the chain API allowlist + RPC bridge.
NeedsChainSubscription
JSON-RPC subscription — needs routing through the chain API for streaming responses.
Navigation request — the workbench should open this URL (may be a .dot address).
NeedsPushNotification
Push notification — host should display a toast/banner with the given text.
deeplink is unvalidated by the SDK. The protocol layer passes it
through as-is. Hosts must reject or sanitize values that fail URL
parsing before opening them (e.g. null bytes, control characters).
NeedsChainFollow
Start a chainHead_v1_follow subscription for a specific chain.
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
NeedsStorageRead
Product-scoped storage read — the host must look up key in persistent
storage for the current product and call encode_storage_read_response.
NeedsStorageWrite
Product-scoped storage write — the host must persist value under key
for the current product and call encode_storage_write_response.
NeedsStorageClear
Product-scoped storage clear — the host must remove key from persistent
storage for the current product and call encode_storage_clear_response.
Silent
No response needed (fire-and-forget).