Skip to Content
API Reference@parity/product-sdk-hostOverview

@parity/product-sdk-host

Detect and talk to the Polkadot Desktop/Mobile host container.

Use isInsideContainer to branch behavior when running embedded vs. standalone, and getHostLocalStorage, getHostProvider, and getStatementStore to reach the storage, signer, and statement-store APIs the host injects.

npm install @parity/product-sdk-host

Exports

Classes

NameSummary
ChainNotSupportedErrorThrown by getHostProvider when the host container is reachable but does

Functions

NameSummary
assertEnumVariant()
createHostLocalStorage()Construct a fresh host-backed HostLocalStorage instance with an optional
createHostPreimageManager()Construct a fresh PreimageManager instance with an optional custom
createProofAuthorized()Have the host sign a Statement using an allowance-bearing account it
deriveEntropy()Derive deterministic entropy from a context key (RFC-0007).
enumValue()
formatHostError()Extract a human-readable message from a host-side error. Hosts wrap
fromHex()
getAccountsProvider()Get the accounts provider for managing host accounts.
getChatManager()Get the host chat manager.
getHostLocalStorage()Get the Host API localStorage instance when running inside a container.
getHostProvider()Get a PAPI-compatible JSON-RPC provider that routes through the host connection.
getNotificationManager()Get the host notification manager.
getPaymentManager()Get the host payment manager.
getPreimageManager()Get the preimage manager for bulletin chain operations.
getStatementStore()Get the host API statement store when running inside a container.
getThemeProvider()Get the host theme provider.
getTruApi()Get the TruAPI instance for direct low-level access.
isEnumVariant()
isInsideContainer()Detect if running inside a Host container (Polkadot Browser / Polkadot Desktop).
isInsideContainerSync()Synchronous container detection — fast heuristic check without product-sdk.
matchChatCustomRenderers()Dispatch helper that composes multiple custom-message renderers into a
requestDevicePermission()Request a single device permission (camera, microphone, etc.) from the
requestPermission()Request a single remote permission from the host.
requestResourceAllocation()Request the host to pre-allocate one or more resource allowances.
resultErr()
resultOk()
toHex()
unwrapResultOrThrow()

Interfaces

NameSummary
ContextualAliasA contextual alias obtained from Ring VRF.
HostAccountOne of the user’s existing wallet accounts, surfaced through the host and
ProductAccountA product account — an app-scoped derived account managed by the host wallet.
ResultAsyncNeverthrow-style ResultAsync returned by product-sdk methods.

Type Aliases

NameSummary
AccountsProviderAccounts provider handle from @novasamatech/host-api-wrapper. Surfaces the
AllocatableResourceResource types requestable via requestResourceAllocation.
AllocatableResourceTagTag-only view of AllocatableResource for places that just need the variant name.
AllocationOutcomePer-resource outcome from requestResourceAllocation.
AllocationOutcomeTagTag-only view of AllocationOutcome ("Allocated" | "Rejected" | "NotAvailable").
ChatBotRegistrationResultResult of registering a bot ("New" | "Exists"). Re-exported from @novasamatech/host-api-wrapper.
ChatCustomMessageRendererRenderer callback for custom message types. Re-exported from @novasamatech/host-api-wrapper.
ChatCustomMessageRendererParamsParameters passed to a ChatCustomMessageRenderer. Re-exported from @novasamatech/host-api-wrapper.
ChatManagerChat manager handle. Exposes room/bot registration, message sending,
ChatMessageContentChat message payload variants. Re-exported from @novasamatech/host-api-wrapper.
ChatReceivedActionAction received via ChatManager.subscribeAction. Re-exported from @novasamatech/host-api-wrapper.
ChatRoomRoom metadata delivered to ChatManager.subscribeChatList. Re-exported from @novasamatech/host-api-wrapper.
ChatRoomRegistrationResultResult of registering a chat room ("New" | "Exists"). Re-exported from @novasamatech/host-api-wrapper.
DevicePermissionKindDevice permission the dapp can ask the host to grant via
HexString
HostLocalStoragePersistent storage exposed by the host container, including string, JSON
HostStatementStoreStatement Store handle exposed by the host container. Provides
HostSubscriptionSubscription handle returned by the host - equivalent to
NotificationIdHost-assigned id for a scheduled notification — pass to
NotificationManagerHost notification manager handle. Exposes push(input) (resolves to a
PaymentBalanceAvailable balance for the user’s payment account. Re-exported from @novasamatech/host-api-wrapper.
PaymentManagerPayment manager handle. Exposes balance subscription, top-up, payment
PaymentStatusStatus of an in-flight payment request. Re-exported from @novasamatech/host-api-wrapper.
PreimageManagerPreimage manager handle for bulletin chain operations. lookup returns a
ProductAccountId[ss58Address, chainPrefix] tuple identifying a product account at the codec layer. Re-exported from @novasamatech/host-api-wrapper.
PushNotificationInputPush payload: text, an optional deeplink, and an optional
RemotePermissionRemote permission the dapp can ask the host to grant via
RemotePermissionItemAlias of RemotePermission matching the upstream
RemotePermissionTagTag-only view of RemotePermission.
SignedStatementStatement bundled with its StatementProof. Re-exported from @novasamatech/host-api-wrapper.
StatementUnsigned statement payload. Re-exported from @novasamatech/host-api-wrapper.
StatementProofCryptographic proof attached to a statement before submission, returned by
StatementsPageA page of signed statements delivered by HostStatementStore.subscribe.
StatementTopicFilterTopic-based subscription filter. The host delivers statements that match
ThemeModeHost theme value. Re-exported from @novasamatech/host-api-wrapper.
ThemeNameActive theme name: { tag: "Default" }, or { tag: "Custom", value }
ThemeProviderHost theme provider handle. Exposes subscribeTheme(callback) which
ThemeVariantLight/dark variant of the active theme: "Light" | "Dark".
TopicA single topic value used inside a StatementTopicFilter. Re-exported from @novasamatech/host-api-wrapper.
TopUpSourceSource for PaymentManager.topUp. Re-exported from @novasamatech/host-api-wrapper.
TruApiThe TruApi type - provides low-level methods for communicating with the host.

Variables

NameSummary
BULLETIN_RPCSBulletin Chain RPC endpoints per network environment. paseo and summit
DEFAULT_BULLETIN_ENDPOINTDefault Bulletin Chain endpoint — the first entry under BULLETIN_RPCS.paseo.
PushNotificationError

Classes

class ChainNotSupportedError

Thrown by getHostProvider when the host container is reachable but does not support the requested chain — e.g. the chain isn’t enabled in this host build, or the descriptor’s genesis hash has drifted from the host’s after a network reset.

Surfacing this as a thrown error (rather than handing back a provider that silently swallows every JSON-RPC request) is what lets callers of createChainClient detect the failure. Without it, the host’s fallback no-op provider drops every request on the floor and queries await forever.

Extends: Error

Constructors

constructor
new ChainNotSupportedError(genesisHash: string): ChainNotSupportedError

Properties

genesisHash
propertyreadonlystring

Genesis hash of the chain the host refused, for programmatic detection.

Functions

assertEnumVariant()

assertEnumVariant(v: Enum, tag: Tag, message: string): v is Extract<Enum, { tag: Tag }>

createHostLocalStorage()

Construct a fresh host-backed HostLocalStorage instance with an optional custom transport. Use this when you need a non-default transport (e.g. for tests); otherwise prefer getHostLocalStorage, which returns the shared singleton.

Mirrors createLocalStorage from @novasamatech/host-api-wrapper.

createHostLocalStorage(transport?: Transport): Promise<{ clear: unknown; readBytes: unknown; readJSON: unknown; readString: unknown; writeBytes: unknown; writeJSON: unknown; writeString: unknown } | null>

Parameters

  • transport: Optional transport; defaults to the sandbox transport.

Returns

A new HostLocalStorage instance, or null if unavailable.

createHostPreimageManager()

Construct a fresh PreimageManager instance with an optional custom transport. Use this when you need a non-default transport; otherwise prefer getPreimageManager, which returns the shared singleton.

Mirrors createPreimageManager from @novasamatech/host-api-wrapper.

createHostPreimageManager(transport?: Transport): Promise<{ lookup: unknown; submit: unknown } | null>

Parameters

  • transport: Optional transport; defaults to the sandbox transport.

Returns

A new PreimageManager instance, or null if unavailable.

createProofAuthorized()

Have the host sign a Statement using an allowance-bearing account it picks internally — RFC-10 §“Statement Store allowance”.

The product passes only the Statement payload; the host chooses the //allowance//statement-store//{productId} account that holds SSS allowance and signs with it. Allowance is provisioned implicitly on first use if the host hasn’t already pre-allocated via requestResourceAllocation; products never see the signing account or its key material.

Pairs with getStatementStore’s submit: call this to obtain a proof, attach it to the Statement, and submit the result.

createProofAuthorized(statement: { channel: Uint8Array<ArrayBufferLike> | undefined; data: Uint8Array<ArrayBufferLike> | undefined; decryptionKey: Uint8Array<ArrayBufferLike> | undefined; expiry: bigint | undefined; proof: { tag: "Sr25519"; value: { signature: Uint8Array<ArrayBufferLike>; signer: Uint8Array<ArrayBufferLike> } } | { tag: "Ed25519"; value: { signature: Uint8Array<ArrayBufferLike>; signer: Uint8Array<ArrayBufferLike> } } | { tag: "Ecdsa"; value: { signature: Uint8Array<ArrayBufferLike>; signer: Uint8Array<ArrayBufferLike> } } | { tag: "OnChain"; value: { blockHash: Uint8Array<ArrayBufferLike>; event: bigint; who: Uint8Array<ArrayBufferLike> } } | undefined; topics: Uint8Array<ArrayBufferLike>[] }): Promise<{ tag: "Sr25519"; value: { signature: Uint8Array<ArrayBufferLike>; signer: Uint8Array<ArrayBufferLike> } } | { tag: "Ed25519"; value: { signature: Uint8Array<ArrayBufferLike>; signer: Uint8Array<ArrayBufferLike> } } | { tag: "Ecdsa"; value: { signature: Uint8Array<ArrayBufferLike>; signer: Uint8Array<ArrayBufferLike> } } | { tag: "OnChain"; value: { blockHash: Uint8Array<ArrayBufferLike>; event: bigint; who: Uint8Array<ArrayBufferLike> } }>

Remarks

RFC-10 introduces this as a new, strictly additive TruAPI call. The pre-existing HostStatementStore.createProof(accountId, statement) surface stays available for products that own a non-allowance signing account; this wrapper is the sponsored-submission path.

Parameters

  • statement: The Statement to be signed.

Returns

The proof to attach before submitting.

Throws

  • If the host is unavailable or the host-side signing fails.

Examples

import { createProofAuthorized, getStatementStore } from "@parity/product-sdk-host"; const statement = { proof: undefined, decryptionKey: undefined, expiry: undefined, channel: undefined, topics: [], data: payload, }; const proof = await createProofAuthorized(statement); const store = await getStatementStore(); await store?.submit({ ...statement, proof });

deriveEntropy()

Derive deterministic entropy from a context key (RFC-0007).

The host derives entropy from the user’s wallet + the provided context key. Calling with the same key on the same wallet yields the same bytes; different keys (or different wallets) yield uncorrelated entropy.

deriveEntropy(key: Uint8Array): Promise<Uint8Array<ArrayBufferLike>>

Parameters

  • key: Context key bytes (typically a SCALE-encoded discriminator).

Returns

The derived entropy bytes.

Throws

  • If the host is unavailable or the host-side derivation fails.

Examples

import { deriveEntropy } from "@parity/product-sdk-host"; const seed = await deriveEntropy(new TextEncoder().encode("my-app:seed-v1"));

enumValue()

enumValue(tag: Tag, value: Value): { tag: Tag; value: Value }

formatHostError()

Extract a human-readable message from a host-side error. Hosts wrap errors in versioned envelopes ({ tag: "v1", value: CodecError }); this helper unwraps the envelope and renders the inner error’s name/message so callers see the host’s actual diagnostic instead of "[object Object]" (from String(err)) or a JSON-stringified envelope.

Exported for the higher-level wrappers (requestPermission, deriveEntropy, etc.) that build their throw new Error(...) messages.

formatHostError(err: unknown): string

fromHex()

fromHex(hex: string): Uint8Array<ArrayBufferLike>

getAccountsProvider()

Get the accounts provider for managing host accounts.

getAccountsProvider(): Promise<{ createRingVRFProof: unknown; getLegacyAccounts: unknown; getLegacyAccountSigner: unknown; getProductAccount: unknown; getProductAccountAlias: unknown; getProductAccountSigner: unknown; getUserId: unknown; requestLogin: unknown; subscribeAccountConnectionStatus: unknown } | null>

Returns

The accounts provider, or null if unavailable.

getChatManager()

Get the host chat manager.

Returns the chat manager from @novasamatech/host-api-wrapper, or null if the package is unavailable (running outside a host container or the optional peer dep isn’t installed).

getChatManager(): Promise<{ onCustomMessageRenderingRequest: unknown; registerBot: unknown; registerRoom: unknown; sendMessage: unknown; subscribeAction: unknown; subscribeChatList: unknown } | null>

Returns

The chat manager, or null if unavailable.

Examples

import { getChatManager } from "@parity/product-sdk-host"; const chat = await getChatManager(); if (chat) { await chat.registerBot({ botId: "echo", name: "Echo Bot", icon: "" }); chat.subscribeAction((action) => { ... }); }

getHostLocalStorage()

Get the Host API localStorage instance when running inside a container. Returns null outside a container or when product-sdk is unavailable.

getHostLocalStorage(): Promise<{ clear: unknown; readBytes: unknown; readJSON: unknown; readString: unknown; writeBytes: unknown; writeJSON: unknown; writeString: unknown } | null>

getHostProvider()

Get a PAPI-compatible JSON-RPC provider that routes through the host connection.

When running inside a Polkadot container, this wraps the chain connection via the host’s createPapiProvider, enabling shared connections and efficient routing. Returns null when @novasamatech/host-api-wrapper is unavailable or when not running inside a container.

getHostProvider(genesisHash: `0x${string}`): Promise<JsonRpcProvider | null>

Parameters

  • genesisHash: Genesis hash of the target chain (0x-prefixed hex string).

Returns

A host-routed JsonRpcProvider, or null if unavailable.

Throws

  • When inside a container but the host can’t serve the chain — surfaced instead of returning a provider that would hang forever.

getNotificationManager()

Get the host notification manager.

Returns the shared notificationManager singleton from @novasamatech/host-api-wrapper, or null if the package is unavailable (running outside a host container or the optional peer dep isn’t installed).

getNotificationManager(): Promise<{ cancel: unknown; push: unknown } | null>

Returns

The notification manager, or null if unavailable.

Examples

import { getNotificationManager, PushNotificationError } from "@parity/product-sdk-host"; const notifications = await getNotificationManager(); if (notifications) { try { const id = await notifications.push({ text: "Doors open in 1h", scheduledAt: someUnixMs, }); // later: await notifications.cancel(id); } catch (err) { if (err instanceof PushNotificationError.ScheduleLimitReached) { // host hit its pending-notification cap — surface to the user } } }

getPaymentManager()

Get the host payment manager.

Returns the shared paymentManager singleton from @novasamatech/host-api-wrapper, or null if the package is unavailable (running outside a host container or the optional peer dep isn’t installed).

getPaymentManager(): Promise<{ requestPayment: unknown; subscribeBalance: unknown; subscribePaymentStatus: unknown; topUp: unknown } | null>

Returns

The payment manager, or null if unavailable.

Examples

import { getPaymentManager } from "@parity/product-sdk-host"; const payments = await getPaymentManager(); if (payments) { const sub = payments.subscribeBalance((b) => { ... }); await payments.topUp(1_000_000n, { type: "productAccount", derivationIndex: 0 }); const destination = new Uint8Array(32); const { id } = await payments.requestPayment(500n, destination); sub.unsubscribe(); }

getPreimageManager()

Get the preimage manager for bulletin chain operations.

The preimage manager handles uploading and looking up preimages (arbitrary data) on the bulletin chain through the host’s optimized path.

getPreimageManager(): Promise<{ lookup: unknown; submit: unknown } | null>

Returns

The preimage manager, or null if unavailable.

Examples

import { getPreimageManager } from "@parity/product-sdk-host"; const manager = await getPreimageManager(); if (manager) { // Submit a preimage const key = await manager.submit(new Uint8Array([1, 2, 3])); // Look up a preimage const sub = manager.lookup(key, (data) => { if (data) console.log("Found:", data); }); }

getStatementStore()

Get the host API statement store when running inside a container.

Returns a statement store with subscribe, createProof, and submit methods that communicate through the host’s native binary protocol — bypassing JSON-RPC entirely. Returns null when @novasamatech/host-api-wrapper is unavailable.

getStatementStore(): Promise<{ createProof: unknown; submit: unknown; subscribe: unknown } | null>

Returns

The host statement store, or null if unavailable.

getThemeProvider()

Get the host theme provider.

Returns the theme-subscription handle exported by @novasamatech/host-api-wrapper, or null if the package is unavailable (running outside a host container or the optional peer dep isn’t installed).

Implementation note: upstream @novasamatech/host-api-wrapper exports only the createThemeProvider factory and no themeProvider singleton, so this getter constructs a fresh instance on each call (unlike getPreimageManager or getHostLocalStorage, which return upstream singletons). The constructed provider is cheap to allocate; it only opens a subscription when subscribeTheme is called.

getThemeProvider(): Promise<{ subscribeTheme: unknown } | null>

Returns

The theme provider, or null if unavailable.

Examples

import { getThemeProvider } from "@parity/product-sdk-host"; const provider = await getThemeProvider(); if (provider) { const sub = provider.subscribeTheme((theme) => { document.documentElement.dataset.theme = theme.variant.toLowerCase(); if (theme.name.tag === "Custom") loadCustomTheme(theme.name.value); }); // sub.unsubscribe() to stop listening }

getTruApi()

Get the TruAPI instance for direct low-level access.

Returns the hostApi object from @novasamatech/host-api-wrapper which provides methods for communicating directly with the host container. Returns null when running outside a container or when the SDK is unavailable.

For most use cases, prefer the higher-level functions like getHostLocalStorage(), getHostProvider(), etc. Use this when you need direct access to host methods like navigateTo(), permission(), or deriveEntropy().

getTruApi(): Promise<HostApi | null>

Returns

The TruAPI instance, or null if unavailable.

Examples

import { getTruApi, enumValue } from "@parity/product-sdk-host"; const truApi = await getTruApi(); if (truApi) { // Request permission const result = await truApi.permission([enumValue("ChainSubmit")]); // Navigate to a URL await truApi.navigateTo("polkadot://settings"); // Subscribe to theme changes const sub = truApi.themeSubscribe(undefined, (theme) => { console.log("Theme changed:", theme); }); }

isEnumVariant()

isEnumVariant(v: Enum, tag: Tag): v is Extract<Enum, { tag: Tag }>

isInsideContainer()

Detect if running inside a Host container (Polkadot Browser / Polkadot Desktop).

The SDK is designed to run exclusively inside a host container. This function is primarily useful for early validation or informational purposes.

Uses product-sdk’s sandboxProvider as primary detection. Falls back to manual signal checks when product-sdk is not installed.

isInsideContainer(): Promise<boolean>

isInsideContainerSync()

Synchronous container detection — fast heuristic check without product-sdk.

Checks for iframe, webview marker, and host message port signals. Use this when you need a quick sync check (e.g., in hot code paths). For full detection including product-sdk, use isInsideContainer (async).

isInsideContainerSync(): boolean

matchChatCustomRenderers()

Dispatch helper that composes multiple custom-message renderers into a single ChatCustomMessageRenderer keyed by messageType.

Mirrors matchChatCustomRenderers from @novasamatech/host-api-wrapper inline (the upstream implementation is pure dispatch logic with no transport / runtime dependency on Novasama), so callers get the same sync signature instead of an async-with-null wrapper.

matchChatCustomRenderers(map: Record<string, ChatCustomMessageRenderer>): ChatCustomMessageRenderer

Parameters

  • map: Object mapping messageType strings to renderers.

Returns

A composed renderer that dispatches to the entry matching params.messageType, or throws if no renderer is registered.

requestDevicePermission()

Request a single device permission (camera, microphone, etc.) from the host.

Builds the v1 envelope, calls hostApi.devicePermission, unwraps the response, and returns the host’s boolean granted/denied outcome.

requestDevicePermission(permission: "Notifications" | "Camera" | "Microphone" | "Bluetooth" | "NFC" | "Location" | "Clipboard" | "OpenUrl" | "Biometrics"): Promise<boolean>

Parameters

  • permission: The device permission to request.

Returns

true if the host granted the permission, false if denied.

Throws

  • If the host is unavailable or the request fails.

Examples

const granted = await requestDevicePermission("Camera"); if (!granted) { showCameraDeniedMessage(); }

requestPermission()

Request a single remote permission from the host.

Builds the v1 envelope, calls hostApi.permission, unwraps the response, and returns the host’s boolean granted/denied outcome.

requestPermission(permission: { tag: "Remote"; value: string[] } | { tag: "WebRtc"; value: undefined } | { tag: "ChainSubmit"; value: undefined } | { tag: "PreimageSubmit"; value: undefined } | { tag: "StatementSubmit"; value: undefined }): Promise<boolean>

Parameters

  • permission: The remote permission to request.

Returns

true if the host granted the permission, false if denied.

Throws

  • If the host is unavailable or the request fails.

Examples

const granted = await requestPermission({ tag: "ChainSubmit", value: undefined }); if (!granted) { tellUserToReconnect(); }

requestResourceAllocation()

Request the host to pre-allocate one or more resource allowances.

The host prompts the user once; subsequent operations covered by the granted allowance don’t re-prompt.

requestResourceAllocation(resources: { tag: "StatementStoreAllowance"; value: undefined } | { tag: "BulletinAllowance"; value: undefined } | { tag: "SmartContractAllowance"; value: number } | { tag: "AutoSigning"; value: undefined }[]): Promise<{ tag: "Rejected"; value: undefined } | { tag: "Allocated"; value: undefined } | { tag: "NotAvailable"; value: undefined }[]>

Parameters

  • resources: Resources to request.

Returns

Per-resource outcomes in the same order as resources.

Throws

  • If the host is unavailable or the request fails.

Examples

const outcomes = await requestResourceAllocation([ { tag: "BulletinAllowance", value: undefined }, ]); if (outcomes[0].tag === "Allocated") { ... }

resultErr()

resultErr(e: T): { success: false; value: T }

resultOk()

resultOk(value: T): { success: true; value: T }

toHex()

toHex(data: Uint8Array): `0x${string}`

unwrapResultOrThrow()

unwrapResultOrThrow(response: ResultPayload<Ok, Err>, toError: (e: Err) => Error): Ok

Interfaces

interface ContextualAlias

A contextual alias obtained from Ring VRF.

Proves account membership in a ring without revealing which account.

Properties

alias
propertyUint8Array

The Ring VRF alias bytes.

context
propertyUint8Array

Ring context (32 bytes).

interface HostAccount

One of the user’s existing wallet accounts, surfaced through the host and identified by its public key and an optional name. Contrast with ProductAccount, which is also user-controlled but derived by the host for a specific app rather than picked from the user’s existing keys.

Properties

name
propertyoptionalstring
publicKey
propertyUint8Array

interface ProductAccount

A product account — an app-scoped derived account managed by the host wallet.

The host derives a unique keypair for each app (identified by dotNsIdentifier) so apps get their own account that the user controls but is scoped to the app.

Properties

derivationIndex
propertynumber

Derivation index within the app scope. Default: 0

dotNsIdentifier
propertystring

App identifier (e.g., “mark3t.dot”).

publicKey
propertyUint8Array

Raw public key (32 bytes).

interface ResultAsync

Neverthrow-style ResultAsync returned by product-sdk methods.

Use .match(onOk, onErr) to handle success/error cases.

Properties

match
property(ok: (t: T) => A, err: (e: E) => B) => Promise<A | B>

Type Aliases

type AccountsProvider

Accounts provider handle from @novasamatech/host-api-wrapper. Surfaces the full upstream API - host wallet accounts, app-scoped product accounts, Ring VRF, user identity (getUserId, requestLogin), and connection status subscription.

Type identical to createAccountsProvider() from @novasamatech/host-api-wrapper; methods return neverthrow ResultAsync values with typed CodecError variants in the error channel.

type AccountsProvider = ReturnType<typeof createAccountsProvider>

type AllocatableResource

Resource types requestable via requestResourceAllocation. Derived from the upstream codec so variant renames surface as compile errors, not runtime failures.

type AllocatableResource = CodecType<typeof AllocatableResourceCodec>

type AllocatableResourceTag

Tag-only view of AllocatableResource for places that just need the variant name.

type AllocatableResourceTag = AllocatableResource["tag"]

type AllocationOutcome

Per-resource outcome from requestResourceAllocation. The host strips secret payloads from Allocated before returning, so value is always undefined on the product side.

type AllocationOutcome = CodecType<typeof AllocationOutcomeCodec>

type AllocationOutcomeTag

Tag-only view of AllocationOutcome ("Allocated" | "Rejected" | "NotAvailable").

type AllocationOutcomeTag = AllocationOutcome["tag"]

type ChatBotRegistrationResult

Result of registering a bot ("New" | "Exists"). Re-exported from @novasamatech/host-api-wrapper.

type ChatBotRegistrationResult = NovasamaChatBotRegistrationResult

type ChatCustomMessageRenderer

Renderer callback for custom message types. Re-exported from @novasamatech/host-api-wrapper.

type ChatCustomMessageRenderer = NovasamaChatCustomMessageRenderer

type ChatCustomMessageRendererParams

Parameters passed to a ChatCustomMessageRenderer. Re-exported from @novasamatech/host-api-wrapper.

type ChatCustomMessageRendererParams = NovasamaChatCustomMessageRendererParams<T>

type ChatManager

Chat manager handle. Exposes room/bot registration, message sending, subscription to room list and incoming actions, and custom-renderer registration.

Type identical to createProductChatManager() from @novasamatech/host-api-wrapper.

type ChatManager = ReturnType<typeof createProductChatManager>

type ChatMessageContent

Chat message payload variants. Re-exported from @novasamatech/host-api-wrapper.

type ChatMessageContent = NovasamaChatMessageContent

type ChatReceivedAction

Action received via ChatManager.subscribeAction. Re-exported from @novasamatech/host-api-wrapper.

type ChatReceivedAction = NovasamaChatReceivedAction

type ChatRoom

Room metadata delivered to ChatManager.subscribeChatList. Re-exported from @novasamatech/host-api-wrapper.

type ChatRoom = NovasamaChatRoom

type ChatRoomRegistrationResult

Result of registering a chat room ("New" | "Exists"). Re-exported from @novasamatech/host-api-wrapper.

type ChatRoomRegistrationResult = NovasamaChatRoomRegistrationResult

type DevicePermissionKind

Device permission the dapp can ask the host to grant via requestDevicePermission.

Derived from the upstream codec so variant renames surface as compile errors, not runtime failures.

type DevicePermissionKind = CodecType<typeof DevicePermissionCodec>

type HexString

type HexString = `0x${string}`

type HostLocalStorage

Persistent storage exposed by the host container, including string, JSON and raw byte (readBytes/writeBytes) accessors. Most apps reach it indirectly through the Storage package’s KvStore; reach for it directly via getHostLocalStorage when you need raw host storage without the KV abstraction.

Type identical to hostLocalStorage from @novasamatech/host-api-wrapper.

type HostLocalStorage = typeof hostLocalStorage

type HostStatementStore

Statement Store handle exposed by the host container. Provides subscribe, createProof, and submit operations that go through the host’s native binary protocol; the statement-store package layers a higher-level client on top.

Type identical to createStatementStore() from @novasamatech/host-api-wrapper.

type HostStatementStore = ReturnType<typeof createStatementStore>

type HostSubscription

Subscription handle returned by the host - equivalent to Subscription<void> from @novasamatech/host-api. Exposes unsubscribe() plus an onInterrupt hook that fires if the host interrupts the subscription server-side.

type HostSubscription = Subscription<void>

type NotificationId

Host-assigned id for a scheduled notification — pass to NotificationManager.cancel. Derived from the manager’s push return type so codec changes surface here as compile errors.

type NotificationId = Awaited<ReturnType<NotificationManager["push"]>>

type NotificationManager

Host notification manager handle. Exposes push(input) (resolves to a NotificationId) and cancel(id).

Type identical to notificationManager from @novasamatech/host-api-wrapper.

type NotificationManager = typeof notificationManager

type PaymentBalance

Available balance for the user’s payment account. Re-exported from @novasamatech/host-api-wrapper.

type PaymentBalance = NovasamaPaymentBalance

type PaymentManager

Payment manager handle. Exposes balance subscription, top-up, payment requests, and payment status subscription.

Type identical to paymentManager from @novasamatech/host-api-wrapper.

type PaymentManager = typeof paymentManager

type PaymentStatus

Status of an in-flight payment request. Re-exported from @novasamatech/host-api-wrapper.

type PaymentStatus = NovasamaPaymentStatus

type PreimageManager

Preimage manager handle for bulletin chain operations. lookup returns a Subscription<void> (unsubscribe + onInterrupt); submit returns a 0x-prefixed hex preimage key.

Type identical to preimageManager from @novasamatech/host-api-wrapper.

type PreimageManager = typeof preimageManager

type ProductAccountId

[ss58Address, chainPrefix] tuple identifying a product account at the codec layer. Re-exported from @novasamatech/host-api-wrapper.

type ProductAccountId = NovasamaProductAccountId

type PushNotificationInput

Push payload: text, an optional deeplink, and an optional scheduledAt (omit for immediate delivery). Derived from the manager’s push parameter so the shape stays in lockstep with upstream.

type PushNotificationInput = Parameters<NotificationManager["push"]>[0]

type RemotePermission

Remote permission the dapp can ask the host to grant via requestPermission.

Derived from the upstream codec so variant renames surface as compile errors, not runtime failures.

type RemotePermission = CodecType<typeof RemotePermissionCodec>

type RemotePermissionItem

Alias of RemotePermission matching the upstream @novasamatech/host-api-wrapper name. Use either freely.

type RemotePermissionItem = RemotePermission

type RemotePermissionTag

Tag-only view of RemotePermission.

type RemotePermissionTag = RemotePermission["tag"]

type SignedStatement

Statement bundled with its StatementProof. Re-exported from @novasamatech/host-api-wrapper.

type SignedStatement = NovasamaSignedStatement

type Statement

Unsigned statement payload. Re-exported from @novasamatech/host-api-wrapper.

type Statement = NovasamaStatement

type StatementProof

Cryptographic proof attached to a statement before submission, returned by HostStatementStore.createProof. Variants cover the supported signature schemes - Sr25519, Ed25519, Ecdsa, and OnChain (chain- attestation-based proofs).

Inferred from createStatementStore().createProof’s return type so codec changes surface here as compile errors, not runtime decode failures.

type StatementProof = Awaited<ReturnType<ReturnType<typeof createStatementStore>["createProof"]>>

type StatementsPage

A page of signed statements delivered by HostStatementStore.subscribe.

Pages arrive sequentially. isComplete is true on the final page of a subscription’s initial backfill; subsequent pages contain new statements as they appear on chain. statements is SignedStatement[] (typed, not unknown[]).

type StatementsPage = NovasamaStatementsPage

type StatementTopicFilter

Topic-based subscription filter. The host delivers statements that match either all of the listed topics (matchAll) or any of them (matchAny). Re-exported from @novasamatech/host-api-wrapper.

type StatementTopicFilter = NovasamaStatementTopicFilter

type ThemeMode

Host theme value. Re-exported from @novasamatech/host-api-wrapper.

A { name, variant } struct as of v0.8 (previously a flat "light" | "dark" string).

type ThemeMode = NovasamaThemeMode

type ThemeName

Active theme name: { tag: "Default" }, or { tag: "Custom", value } carrying the custom theme’s string id.

type ThemeName = ThemeMode["name"]

type ThemeProvider

Host theme provider handle. Exposes subscribeTheme(callback) which receives a typed ThemeMode struct on every change and returns a Subscription<void> (unsubscribe + onInterrupt).

Type identical to createThemeProvider() from @novasamatech/host-api-wrapper.

type ThemeProvider = ReturnType<typeof createThemeProvider>

type ThemeVariant

Light/dark variant of the active theme: "Light" | "Dark".

type ThemeVariant = ThemeMode["variant"]

type Topic

A single topic value used inside a StatementTopicFilter. Re-exported from @novasamatech/host-api-wrapper.

type Topic = NovasamaTopic

type TopUpSource

Source for PaymentManager.topUp. Re-exported from @novasamatech/host-api-wrapper.

type TopUpSource = NovasamaTopUpSource

type TruApi

The TruApi type - provides low-level methods for communicating with the host.

Methods include:

  • navigateTo(url) - Navigate to a URL within the host
  • permission(permissions) - Request permissions from the host
  • localStorageRead/Write/Clear - Host-backed storage
  • sign(payload) - Request transaction signing
  • deriveEntropy(context) - Derive deterministic entropy
  • themeSubscribe() - Subscribe to host theme changes
  • And many more…

Type identical to hostApi from @novasamatech/host-api-wrapper so that truApi.X(...) calls keep their full inference (return types, method names, parameter shapes) instead of decaying to any.

type TruApi = hostApi

Variables

BULLETIN_RPCS

Bulletin Chain RPC endpoints per network environment. paseo and summit are populated today; polkadot and kusama are reserved for when those Bulletin deployments go live.

let BULLETIN_RPCS: { readonly kusama: string[]; readonly paseo: readonly ["wss://paseo-bulletin-next-rpc.polkadot.io"]; readonly polkadot: string[]; readonly summit: readonly ["wss://summit-bulletin-rpc.polkadot.io"] } = ...

DEFAULT_BULLETIN_ENDPOINT

Default Bulletin Chain endpoint — the first entry under BULLETIN_RPCS.paseo.

let DEFAULT_BULLETIN_ENDPOINT: string = ...

PushNotificationError

let PushNotificationError: [Encoder, Decoder] & { dec: Decoder; enc: Encoder } & { readonly ScheduleLimitReached: ErrCodec; readonly Unknown: ErrCodec } & { [hasInstance]: unknown }
Last updated on