# `@polkadot-apps/host-sdk`

UserAgentKit's TypeScript SDK for building browser **Triangle User Agents**.

Use this package when you are building the trusted browser shell that owns:

- wallet state
- `ProductView` mounting
- chain/runtime wiring
- `window.host.__bridge` policy and capabilities

If you are building the product that runs inside that shell, use `@polkadot-apps/product-sdk` instead.

## Install

```sh
npm install @polkadot-apps/host-sdk @polkadot-apps/host-wasm
```

Add these only if your integration needs them:

- `@polkadot-apps/host-coinage-wasm` for Coinage vault/path/value helpers
- `@polkadot-apps/host-extensions-wasm`
- `smoldot`

## Minimal example

```ts
import { createHostSdk } from "@polkadot-apps/host-sdk";

const sdk = await createHostSdk();
sdk.wallet.loadMnemonic(
  "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
);

console.log("wallet state", sdk.wallet.state());
console.log("root address", sdk.wallet.rootAddress());
```

## Main entry points

- `createHostSdk()` for wallet, runtime, and WASM setup
- `mountProductView()` for sandboxed product embedding
- `HostRuntime` / `HostRuntimeRegistry` for shared runtime ownership
- `mountHostRuntimeFrame()` for runtime-in-a-frame web hosts

## Compatibility

- Node.js 18+
- ESM package
- peer dependency on `@polkadot-apps/host-wasm`
- optional peer dependencies on `@polkadot-apps/host-extensions-wasm` and `smoldot`
- separate optional package `@polkadot-apps/host-coinage-wasm` for Coinage helpers

## Documentation

- Quickstart: <https://github.com/paritytech/host-sdk/blob/main/site/src/content/docs/getting-started/index.md>
- Web integration: <https://github.com/paritytech/host-sdk/blob/main/site/src/content/docs/getting-started/web.md>
- Browser host guide: <https://github.com/paritytech/host-sdk/blob/main/site/src/content/docs/getting-started/web-host.md>

## Experimental surface

This package also includes an `experimental` subpath for APIs that are still settling. Treat those exports as unstable and pin versions tightly if you adopt them.
