@useragent-kit/productkit
v0.0.1
Published
Minimal product-facing window.host contract and helpers for apps running inside a Triangle User Agent
Maintainers
Readme
@polkadot-apps/productkit
Minimal app-facing product contract and helpers for apps that consume
window.host.
Install
npm install @polkadot-apps/productkitUse this package when you want a narrow, product-oriented runtime surface:
getAddress()storage.get/set/removestatements.subscribe/write/statuson("statement")/off("statement")
Adapters such as @polkadot-apps/productkit-adapter-scale mount real host
implementations onto this contract.
Positioning
@polkadot-apps/productkit is the supported narrow compatibility layer for
product code that consumes window.host.
- use
@polkadot-apps/productkitwhen you only need address, storage, and statements, or when you need compatibility with an existing ProductKit host - use
@polkadot-apps/product-sdkfor the normal high-level product path in this repo's ecosystem - use
@polkadot/api-protocolif you need the canonical full host-product contract or want to build a custom facade/transport layer
ProductKit is not deprecated, but it intentionally stays smaller than the full
api-protocol surface.
Minimal example
import { hasCoreProductKit } from "@polkadot-apps/productkit";
if (!hasCoreProductKit(window.host)) {
throw new Error("ProductKit surface unavailable");
}
const address = await window.host.getAddress();
await window.host.storage.set("last-address", address);
window.host.on("statement", (event) => {
console.log(event);
});Compatibility
- product-side package
- expects a host shell that provides the ProductKit-compatible
window.hostsurface
Documentation
- Web product guide: https://github.com/paritytech/host-sdk/blob/main/site/src/content/docs/getting-started/web-product.md
- Positioning: https://github.com/paritytech/host-sdk/blob/main/site/src/content/docs/ecosystem/productkit-vs-api-protocol.md
- Migration guide: https://github.com/paritytech/host-sdk/blob/main/site/src/content/docs/ecosystem/productkit-migration.md
- Quickstart: https://github.com/paritytech/host-sdk/blob/main/site/src/content/docs/getting-started/index.md
