From 9a96f307444e41bd580fff66bccfe02619dc4121 Mon Sep 17 00:00:00 2001 From: Filippo Vecchiato Date: Wed, 13 May 2026 09:02:07 +0200 Subject: [PATCH] chore: rename product-sdk to host-api-wrapper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename `packages/product-sdk` → `packages/host-api-wrapper` and update the npm package name from `@novasamatech/product-sdk` to `@novasamatech/host-api-wrapper`. Update all imports, dependencies, READMEs, and tests across the monorepo. Closes paritytech/triangle-js-sdks#44 --- CLAUDE.md | 4 +- README.md | 2 +- __tests__/hostApi/accounts.spec.ts | 4 +- .../hostApi/chainInteraction.e2e.spec.ts | 2 +- __tests__/hostApi/chainInteraction.spec.ts | 2 +- __tests__/hostApi/chat.spec.ts | 4 +- __tests__/hostApi/chatReactRenderer.spec.tsx | 2 +- .../hostApi/containerDefaultHandlers.spec.ts | 2 +- .../hostApi/injectedWeb3Provider.spec.ts | 2 +- __tests__/hostApi/localStorage.spec.ts | 2 +- __tests__/hostApi/metaProvider.spec.ts | 2 +- __tests__/hostApi/payments.spec.ts | 4 +- __tests__/hostApi/preimage.spec.ts | 2 +- __tests__/hostApi/statementStore.spec.ts | 8 +-- package-lock.json | 58 ++++++++++++++++--- .../README.md | 30 +++++----- .../package.json | 4 +- .../src/accounts.ts | 0 .../src/chat.ts | 0 .../src/constants.ts | 0 .../src/deriveEntropy.ts | 0 .../src/helpers.ts | 0 .../src/hostApi.ts | 0 .../src/index.ts | 0 .../src/injectWeb3.ts | 0 .../src/localStorage.ts | 0 .../src/metaProvider.ts | 0 .../src/papiProvider.ts | 0 .../src/payments.ts | 0 .../src/permission.ts | 0 .../src/preimage.ts | 0 .../src/sandboxTransport.ts | 0 .../src/statementStore.ts | 0 .../src/theme.ts | 0 .../tsconfig.json | 0 packages/product-bulletin/README.md | 6 +- packages/product-bulletin/package.json | 2 +- .../src/createBulletinClient.ts | 2 +- packages/product-react-renderer/README.md | 2 +- packages/product-react-renderer/package.json | 4 +- .../src/rendererChatMessage.ts | 2 +- 41 files changed, 96 insertions(+), 56 deletions(-) rename packages/{product-sdk => host-api-wrapper}/README.md (94%) rename packages/{product-sdk => host-api-wrapper}/package.json (84%) rename packages/{product-sdk => host-api-wrapper}/src/accounts.ts (100%) rename packages/{product-sdk => host-api-wrapper}/src/chat.ts (100%) rename packages/{product-sdk => host-api-wrapper}/src/constants.ts (100%) rename packages/{product-sdk => host-api-wrapper}/src/deriveEntropy.ts (100%) rename packages/{product-sdk => host-api-wrapper}/src/helpers.ts (100%) rename packages/{product-sdk => host-api-wrapper}/src/hostApi.ts (100%) rename packages/{product-sdk => host-api-wrapper}/src/index.ts (100%) rename packages/{product-sdk => host-api-wrapper}/src/injectWeb3.ts (100%) rename packages/{product-sdk => host-api-wrapper}/src/localStorage.ts (100%) rename packages/{product-sdk => host-api-wrapper}/src/metaProvider.ts (100%) rename packages/{product-sdk => host-api-wrapper}/src/papiProvider.ts (100%) rename packages/{product-sdk => host-api-wrapper}/src/payments.ts (100%) rename packages/{product-sdk => host-api-wrapper}/src/permission.ts (100%) rename packages/{product-sdk => host-api-wrapper}/src/preimage.ts (100%) rename packages/{product-sdk => host-api-wrapper}/src/sandboxTransport.ts (100%) rename packages/{product-sdk => host-api-wrapper}/src/statementStore.ts (100%) rename packages/{product-sdk => host-api-wrapper}/src/theme.ts (100%) rename packages/{product-sdk => host-api-wrapper}/tsconfig.json (100%) diff --git a/CLAUDE.md b/CLAUDE.md index c40e0ecd..9218329e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -12,7 +12,7 @@ This is an Nx monorepo for the host-product integration SDKs — a set of TypeSc ### Glossary - **host** — the embedding browser application (e.g. a wallet/SSO surface). Owns the page and runs `host-container`, `host-api`, etc. -- **product** — a Polkadot ecosystem app embedded inside the host. Built against `product-sdk`; its worker code runs inside `host-worker-sandbox`. +- **product** — a Polkadot ecosystem app embedded inside the host. Built against `host-api-wrapper`; its worker code runs inside `host-worker-sandbox`. - **papp** — short for "Polkadot Mobile". `host-papp` is the host-side integration layer that pairs with it via deeplink handshake and routes signing requests. ## Common Commands @@ -45,7 +45,7 @@ Run `npm run build` before `typecheck` since typecheck depends on built artifact ### Tests - **Per-package unit tests** live next to source under `packages/*/src/**/*.spec.ts`. -- **Integration tests** live in top-level `__tests__/` and exercise full host ↔ product flows across packages (transport, container, product-sdk wired together). Shared test helpers live in `__tests__/hostApi/__mocks__/`. +- **Integration tests** live in top-level `__tests__/` and exercise full host ↔ product flows across packages (transport, container, host-api-wrapper wired together). Shared test helpers live in `__tests__/hostApi/__mocks__/`. ## Tech Stack diff --git a/README.md b/README.md index 56a2ffc6..65468c61 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ ## Packages ### For Product developers -* [**product-sdk**](./packages/product-sdk/README.md) — SDK for integrating and running a product inside the Polkadot browser host. +* [**host-api-wrapper**](./packages/host-api-wrapper/README.md) — Host API wrapper for integrating and running a product inside the Polkadot browser host. * [**product-react-renderer**](./packages/product-react-renderer/README.md) — Custom React reconciler for rendering native UI widgets from product scripts. ### For Host developers diff --git a/__tests__/hostApi/accounts.spec.ts b/__tests__/hostApi/accounts.spec.ts index d3921aff..ecf237e6 100644 --- a/__tests__/hostApi/accounts.spec.ts +++ b/__tests__/hostApi/accounts.spec.ts @@ -9,10 +9,10 @@ import { createTransport, toHex, } from '@novasamatech/host-api'; +import type { AccountConnectionStatus, ProductAccount } from '@novasamatech/host-api-wrapper'; +import { createAccountsProvider } from '@novasamatech/host-api-wrapper'; import type { ContainerHandlerOf } from '@novasamatech/host-container'; import { createContainer } from '@novasamatech/host-container'; -import type { AccountConnectionStatus, ProductAccount } from '@novasamatech/product-sdk'; -import { createAccountsProvider } from '@novasamatech/product-sdk'; import { describe, expect, it, vi } from 'vitest'; diff --git a/__tests__/hostApi/chainInteraction.e2e.spec.ts b/__tests__/hostApi/chainInteraction.e2e.spec.ts index 587b8285..aef50d06 100644 --- a/__tests__/hostApi/chainInteraction.e2e.spec.ts +++ b/__tests__/hostApi/chainInteraction.e2e.spec.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import { createTransport } from '@novasamatech/host-api'; +import { WellKnownChain, createPapiProvider } from '@novasamatech/host-api-wrapper'; import { createContainer } from '@novasamatech/host-container'; -import { WellKnownChain, createPapiProvider } from '@novasamatech/product-sdk'; import type { JsonRpcMessage, JsonRpcProvider, JsonRpcRequest, JsonRpcResponse } from '@polkadot-api/json-rpc-provider'; import { isRequest, isResponse } from '@polkadot-api/json-rpc-provider'; diff --git a/__tests__/hostApi/chainInteraction.spec.ts b/__tests__/hostApi/chainInteraction.spec.ts index 4aeebc0e..1e4bb04f 100644 --- a/__tests__/hostApi/chainInteraction.spec.ts +++ b/__tests__/hostApi/chainInteraction.spec.ts @@ -2,8 +2,8 @@ import type { HexString } from '@novasamatech/host-api'; import { createHostApi, createTransport, enumValue } from '@novasamatech/host-api'; +import { WellKnownChain, createPapiProvider } from '@novasamatech/host-api-wrapper'; import { createContainer } from '@novasamatech/host-container'; -import { WellKnownChain, createPapiProvider } from '@novasamatech/product-sdk'; import type { JsonRpcMessage } from '@polkadot-api/json-rpc-provider'; import type { JsonRpcProvider } from 'polkadot-api'; diff --git a/__tests__/hostApi/chat.spec.ts b/__tests__/hostApi/chat.spec.ts index 30a7d022..6767e2fe 100644 --- a/__tests__/hostApi/chat.spec.ts +++ b/__tests__/hostApi/chat.spec.ts @@ -7,10 +7,10 @@ import { createTransport, enumValue, } from '@novasamatech/host-api'; +import type { ChatMessageContent } from '@novasamatech/host-api-wrapper'; +import { createProductChatManager } from '@novasamatech/host-api-wrapper'; import type { ContainerHandlerOf } from '@novasamatech/host-container'; import { createContainer } from '@novasamatech/host-container'; -import type { ChatMessageContent } from '@novasamatech/product-sdk'; -import { createProductChatManager } from '@novasamatech/product-sdk'; import { describe, expect, it, vi } from 'vitest'; diff --git a/__tests__/hostApi/chatReactRenderer.spec.tsx b/__tests__/hostApi/chatReactRenderer.spec.tsx index 38b53072..2dac4f41 100644 --- a/__tests__/hostApi/chatReactRenderer.spec.tsx +++ b/__tests__/hostApi/chatReactRenderer.spec.tsx @@ -5,6 +5,7 @@ globalThis['IS_REACT_ACT_ENVIRONMENT'] = true; import type { CodecType } from '@novasamatech/host-api'; import { CustomRendererNode, Modifier, createTransport, enumValue } from '@novasamatech/host-api'; +import { createProductChatManager } from '@novasamatech/host-api-wrapper'; import { createContainer } from '@novasamatech/host-container'; import { Box, @@ -16,7 +17,6 @@ import { TextField, registerChatMessageRenderer, } from '@novasamatech/product-react-renderer'; -import { createProductChatManager } from '@novasamatech/product-sdk'; import { nanoid } from 'nanoid'; import { act, useState } from 'react'; diff --git a/__tests__/hostApi/containerDefaultHandlers.spec.ts b/__tests__/hostApi/containerDefaultHandlers.spec.ts index c022041c..c2dc02ed 100644 --- a/__tests__/hostApi/containerDefaultHandlers.spec.ts +++ b/__tests__/hostApi/containerDefaultHandlers.spec.ts @@ -1,6 +1,6 @@ import { LoginErr, RequestCredentialsErr, StorageErr, createTransport } from '@novasamatech/host-api'; +import { createAccountsProvider, createLocalStorage } from '@novasamatech/host-api-wrapper'; import { createContainer } from '@novasamatech/host-container'; -import { createAccountsProvider, createLocalStorage } from '@novasamatech/product-sdk'; import { describe, expect, it, vi } from 'vitest'; diff --git a/__tests__/hostApi/injectedWeb3Provider.spec.ts b/__tests__/hostApi/injectedWeb3Provider.spec.ts index 1b4e9746..d305d833 100644 --- a/__tests__/hostApi/injectedWeb3Provider.spec.ts +++ b/__tests__/hostApi/injectedWeb3Provider.spec.ts @@ -6,9 +6,9 @@ import { createTransport, toHex, } from '@novasamatech/host-api'; +import { createLegacyExtensionEnableFactory } from '@novasamatech/host-api-wrapper'; import type { ContainerHandlerOf } from '@novasamatech/host-container'; import { createContainer } from '@novasamatech/host-container'; -import { createLegacyExtensionEnableFactory } from '@novasamatech/product-sdk'; import type { SignerResult } from '@polkadot/types/types'; import { AccountId } from '@polkadot-api/substrate-bindings'; diff --git a/__tests__/hostApi/localStorage.spec.ts b/__tests__/hostApi/localStorage.spec.ts index 85a1e6b9..698ac93f 100644 --- a/__tests__/hostApi/localStorage.spec.ts +++ b/__tests__/hostApi/localStorage.spec.ts @@ -1,7 +1,7 @@ import { StorageErr, createTransport } from '@novasamatech/host-api'; +import { createLocalStorage } from '@novasamatech/host-api-wrapper'; import type { ContainerHandlerOf } from '@novasamatech/host-container'; import { createContainer } from '@novasamatech/host-container'; -import { createLocalStorage } from '@novasamatech/product-sdk'; import { describe, expect, it, vi } from 'vitest'; diff --git a/__tests__/hostApi/metaProvider.spec.ts b/__tests__/hostApi/metaProvider.spec.ts index 6c94ef4e..8a038f3f 100644 --- a/__tests__/hostApi/metaProvider.spec.ts +++ b/__tests__/hostApi/metaProvider.spec.ts @@ -1,7 +1,7 @@ import type { ConnectionStatus } from '@novasamatech/host-api'; import { createTransport } from '@novasamatech/host-api'; +import { createMetaProvider } from '@novasamatech/host-api-wrapper'; import { createContainer } from '@novasamatech/host-container'; -import { createMetaProvider } from '@novasamatech/product-sdk'; import { describe, expect, it, vi } from 'vitest'; diff --git a/__tests__/hostApi/payments.spec.ts b/__tests__/hostApi/payments.spec.ts index 72351082..f2ff0468 100644 --- a/__tests__/hostApi/payments.spec.ts +++ b/__tests__/hostApi/payments.spec.ts @@ -1,8 +1,8 @@ import { PaymentRequestErr, PaymentTopUpErr, createTransport } from '@novasamatech/host-api'; +import type { PaymentBalance, PaymentStatus } from '@novasamatech/host-api-wrapper'; +import { createPaymentManager } from '@novasamatech/host-api-wrapper'; import type { ContainerHandlerOf } from '@novasamatech/host-container'; import { createContainer } from '@novasamatech/host-container'; -import type { PaymentBalance, PaymentStatus } from '@novasamatech/product-sdk'; -import { createPaymentManager } from '@novasamatech/product-sdk'; import { describe, expect, it, vi } from 'vitest'; diff --git a/__tests__/hostApi/preimage.spec.ts b/__tests__/hostApi/preimage.spec.ts index b2b1d62a..ed9e960b 100644 --- a/__tests__/hostApi/preimage.spec.ts +++ b/__tests__/hostApi/preimage.spec.ts @@ -1,7 +1,7 @@ import { PreimageSubmitErr, createTransport } from '@novasamatech/host-api'; +import { createPreimageManager } from '@novasamatech/host-api-wrapper'; import type { ContainerHandlerOf } from '@novasamatech/host-container'; import { createContainer } from '@novasamatech/host-container'; -import { createPreimageManager } from '@novasamatech/product-sdk'; import { describe, expect, it, vi } from 'vitest'; diff --git a/__tests__/hostApi/statementStore.spec.ts b/__tests__/hostApi/statementStore.spec.ts index 518c653a..ec5b667c 100644 --- a/__tests__/hostApi/statementStore.spec.ts +++ b/__tests__/hostApi/statementStore.spec.ts @@ -1,14 +1,14 @@ import { GenericError, StatementProofErr, createTransport, enumValue } from '@novasamatech/host-api'; -import type { ContainerHandlerOf } from '@novasamatech/host-container'; -import { createContainer } from '@novasamatech/host-container'; import type { ProductAccountId, SignedStatement, Statement, StatementTopicFilter, Topic, -} from '@novasamatech/product-sdk'; -import { createStatementStore } from '@novasamatech/product-sdk'; +} from '@novasamatech/host-api-wrapper'; +import { createStatementStore } from '@novasamatech/host-api-wrapper'; +import type { ContainerHandlerOf } from '@novasamatech/host-container'; +import { createContainer } from '@novasamatech/host-container'; import { describe, expect, it, vi } from 'vitest'; diff --git a/package-lock.json b/package-lock.json index 502ce75f..83520a20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2757,6 +2757,10 @@ "resolved": "packages/host-api", "link": true }, + "node_modules/@novasamatech/host-api-wrapper": { + "resolved": "packages/host-api-wrapper", + "link": true + }, "node_modules/@novasamatech/host-chat": { "resolved": "packages/host-chat", "link": true @@ -2789,10 +2793,6 @@ "resolved": "packages/product-react-renderer", "link": true }, - "node_modules/@novasamatech/product-sdk": { - "resolved": "packages/product-sdk", - "link": true - }, "node_modules/@novasamatech/scale": { "resolved": "packages/scale", "link": true @@ -4116,6 +4116,7 @@ "hasInstallScript": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "detect-libc": "^2.0.3", "is-glob": "^4.0.3", @@ -4158,6 +4159,7 @@ "os": [ "android" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -4179,6 +4181,7 @@ "os": [ "darwin" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -4200,6 +4203,7 @@ "os": [ "darwin" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -4221,6 +4225,7 @@ "os": [ "freebsd" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -4242,6 +4247,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -4263,6 +4269,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -4284,6 +4291,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -4305,6 +4313,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -4326,6 +4335,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -4347,6 +4357,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -4368,6 +4379,7 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -4389,6 +4401,7 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -4410,6 +4423,7 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -10347,6 +10361,7 @@ "dev": true, "license": "Apache-2.0", "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -10571,6 +10586,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "prr": "~1.0.1" }, @@ -11961,6 +11977,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" }, @@ -12019,6 +12036,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "bin": { "image-size": "bin/image-size.js" }, @@ -12710,6 +12728,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "pify": "^4.0.1", "semver": "^5.6.0" @@ -12725,6 +12744,7 @@ "dev": true, "license": "ISC", "optional": true, + "peer": true, "bin": { "semver": "bin/semver" } @@ -12767,6 +12787,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "bin": { "mime": "cli.js" }, @@ -12996,6 +13017,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "iconv-lite": "^0.6.3", "sax": "^1.2.4" @@ -13049,7 +13071,8 @@ "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", "dev": true, "license": "MIT", - "optional": true + "optional": true, + "peer": true }, "node_modules/node-domexception": { "version": "1.0.0", @@ -13802,6 +13825,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "engines": { "node": ">=6" } @@ -14123,7 +14147,8 @@ "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==", "dev": true, "license": "MIT", - "optional": true + "optional": true, + "peer": true }, "node_modules/pump": { "version": "3.0.4", @@ -14818,7 +14843,8 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true, "license": "MIT", - "optional": true + "optional": true, + "peer": true }, "node_modules/sass": { "version": "1.99.0", @@ -14848,6 +14874,7 @@ "dev": true, "license": "BlueOak-1.0.0", "optional": true, + "peer": true, "engines": { "node": ">=11.0.0" } @@ -16904,6 +16931,18 @@ "scale-ts": "1.6.1" } }, + "packages/host-api-wrapper": { + "name": "@novasamatech/host-api-wrapper", + "version": "0.7.8", + "license": "Apache-2.0", + "dependencies": { + "@novasamatech/host-api": "0.7.8", + "@polkadot-api/json-rpc-provider-proxy": "^0.4.0", + "@polkadot/extension-inject": "^0.63.1", + "neverthrow": "^8.2.0", + "polkadot-api": ">=2" + } + }, "packages/host-api/node_modules/nanoid": { "version": "5.1.9", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.1.9.tgz", @@ -17080,7 +17119,7 @@ "version": "0.7.8", "license": "Apache-2.0", "dependencies": { - "@novasamatech/product-sdk": "0.7.8", + "@novasamatech/host-api-wrapper": "0.7.8", "@parity/bulletin-sdk": "^0.3.0", "polkadot-api": ">=2" } @@ -17091,7 +17130,7 @@ "license": "Apache-2.0", "dependencies": { "@novasamatech/host-api": "0.7.8", - "@novasamatech/product-sdk": "0.7.8", + "@novasamatech/host-api-wrapper": "0.7.8", "react-reconciler": "0.33.0", "scale-ts": "1.6.1" }, @@ -17105,6 +17144,7 @@ "packages/product-sdk": { "name": "@novasamatech/product-sdk", "version": "0.7.8", + "extraneous": true, "license": "Apache-2.0", "dependencies": { "@novasamatech/host-api": "0.7.8", diff --git a/packages/product-sdk/README.md b/packages/host-api-wrapper/README.md similarity index 94% rename from packages/product-sdk/README.md rename to packages/host-api-wrapper/README.md index 3a1cf177..6a1e2478 100644 --- a/packages/product-sdk/README.md +++ b/packages/host-api-wrapper/README.md @@ -1,4 +1,4 @@ -# @novasamatech/product-sdk +# @novasamatech/host-api-wrapper An easy way to embed Polkadot host functionality into your dapp. @@ -18,7 +18,7 @@ Core features: ## Installation ```shell -npm install @novasamatech/product-sdk --save -E +npm install @novasamatech/host-api-wrapper --save -E ``` ## Usage @@ -28,7 +28,7 @@ npm install @novasamatech/product-sdk --save -E Product SDK can provide account information and signers with the same interface as any other Polkadot-compatible wallet. ```ts -import { injectSpektrExtension, SpektrExtensionName } from '@novasamatech/product-sdk'; +import { injectSpektrExtension, SpektrExtensionName } from '@novasamatech/host-api-wrapper'; import { connectInjectedExtension, type InjectedPolkadotAccount } from '@polkadot-api/pjs-signer'; async function getSpektrExtension() { @@ -60,7 +60,7 @@ You can wrap your PAPI provider with Spektr provider to support redirecting requ ```diff import { createClient, type PolkadotClient } from 'polkadot-api'; import { getWsProvider } from 'polkadot-api/ws-provider'; -import { createPapiProvider, WellKnownChain } from '@novasamatech/product-sdk'; +import { createPapiProvider, WellKnownChain } from '@novasamatech/host-api-wrapper'; function createPapiClient(): PolkadotClient { const polkadotEndpoint = 'wss://...'; @@ -78,7 +78,7 @@ function createPapiClient(): PolkadotClient { ### Subscribing host connection status ```ts -import { metaProvider } from '@novasamatech/product-sdk'; +import { metaProvider } from '@novasamatech/host-api-wrapper'; const unsubscribe = metaProvider.subscribeConnectionStatus((status) => { console.log('connection status changed', status); @@ -88,7 +88,7 @@ const unsubscribe = metaProvider.subscribeConnectionStatus((status) => { ### Chat Integration ```ts -import { createProductChatManager } from '@novasamatech/product-sdk'; +import { createProductChatManager } from '@novasamatech/host-api-wrapper'; // Create manager instance const chat = createProductChatManager(); @@ -165,8 +165,8 @@ The Statement Store provides a decentralized way to store statements (messages). It can be used for various purposes like p2p communication, storing temp data, etc. ```ts -import { createStatementStore } from '@novasamatech/product-sdk'; -import type { Topic, Statement, SignedStatement, StatementTopicFilter } from '@novasamatech/product-sdk'; +import { createStatementStore } from '@novasamatech/host-api-wrapper'; +import type { Topic, Statement, SignedStatement, StatementTopicFilter } from '@novasamatech/host-api-wrapper'; // Create statement store instance const statementStore = createStatementStore(); @@ -211,8 +211,8 @@ subscription.unsubscribe(); The Accounts Provider allows you to access product accounts and create signers for signing transactions. ```ts -import { createAccountsProvider } from '@novasamatech/product-sdk'; -import type { ProductAccount } from '@novasamatech/product-sdk'; +import { createAccountsProvider } from '@novasamatech/host-api-wrapper'; +import type { ProductAccount } from '@novasamatech/host-api-wrapper'; // Create accounts provider instance const accountsProvider = createAccountsProvider(); @@ -295,7 +295,7 @@ const legacyAccountSignedTx = await tx.signAndSubmit(legacySigner); The Local Storage module provides a way to persist data in the host application's storage. ```ts -import { hostLocalStorage, createLocalStorage } from '@novasamatech/product-sdk'; +import { hostLocalStorage, createLocalStorage } from '@novasamatech/host-api-wrapper'; // Use the default instance const storage = hostLocalStorage; @@ -324,7 +324,7 @@ await storage.clear('key'); The Derive Entropy function allows products to derive deterministic 32-byte entropy scoped to the product and a caller-chosen key. ```ts -import { deriveEntropy } from '@novasamatech/product-sdk'; +import { deriveEntropy } from '@novasamatech/host-api-wrapper'; const result = await deriveEntropy(new Uint8Array([1, 2, 3])); @@ -339,7 +339,7 @@ if (result.isOk()) { Products can request device and remote permissions from the host. Decisions are prompted once and persisted permanently — subsequent calls for the same permission resolve immediately without prompting. ```ts -import { requestDevicePermission, requestPermission } from '@novasamatech/product-sdk'; +import { requestDevicePermission, requestPermission } from '@novasamatech/host-api-wrapper'; // Request a single device permission const deviceResult = await requestDevicePermission('Camera'); @@ -368,7 +368,7 @@ Available remote permission tags: `'Remote'` (HTTP/WS domain patterns), `'WebRTC The Preimage Manager allows you to lookup and submit preimages to the host application. ```ts -import { preimageManager, createPreimageManager } from '@novasamatech/product-sdk'; +import { preimageManager, createPreimageManager } from '@novasamatech/host-api-wrapper'; // Use the default instance const manager = preimageManager; @@ -395,7 +395,7 @@ const preimageKey = await manager.submit(new Uint8Array([1, 2, 3, 4])); ### Payment manager ```ts -import { createPaymentManager } from '@novasamatech/product-sdk'; +import { createPaymentManager } from '@novasamatech/host-api-wrapper'; const payments = createPaymentManager(); diff --git a/packages/product-sdk/package.json b/packages/host-api-wrapper/package.json similarity index 84% rename from packages/product-sdk/package.json rename to packages/host-api-wrapper/package.json index f2e413ea..7275352e 100644 --- a/packages/product-sdk/package.json +++ b/packages/host-api-wrapper/package.json @@ -1,8 +1,8 @@ { - "name": "@novasamatech/product-sdk", + "name": "@novasamatech/host-api-wrapper", "type": "module", "version": "0.7.8", - "description": "Polkadot product SDK: integrate and run your product inside Polkadot browser.", + "description": "Host API wrapper: integrate and run your product inside Polkadot browser.", "license": "Apache-2.0", "repository": { "type": "git", diff --git a/packages/product-sdk/src/accounts.ts b/packages/host-api-wrapper/src/accounts.ts similarity index 100% rename from packages/product-sdk/src/accounts.ts rename to packages/host-api-wrapper/src/accounts.ts diff --git a/packages/product-sdk/src/chat.ts b/packages/host-api-wrapper/src/chat.ts similarity index 100% rename from packages/product-sdk/src/chat.ts rename to packages/host-api-wrapper/src/chat.ts diff --git a/packages/product-sdk/src/constants.ts b/packages/host-api-wrapper/src/constants.ts similarity index 100% rename from packages/product-sdk/src/constants.ts rename to packages/host-api-wrapper/src/constants.ts diff --git a/packages/product-sdk/src/deriveEntropy.ts b/packages/host-api-wrapper/src/deriveEntropy.ts similarity index 100% rename from packages/product-sdk/src/deriveEntropy.ts rename to packages/host-api-wrapper/src/deriveEntropy.ts diff --git a/packages/product-sdk/src/helpers.ts b/packages/host-api-wrapper/src/helpers.ts similarity index 100% rename from packages/product-sdk/src/helpers.ts rename to packages/host-api-wrapper/src/helpers.ts diff --git a/packages/product-sdk/src/hostApi.ts b/packages/host-api-wrapper/src/hostApi.ts similarity index 100% rename from packages/product-sdk/src/hostApi.ts rename to packages/host-api-wrapper/src/hostApi.ts diff --git a/packages/product-sdk/src/index.ts b/packages/host-api-wrapper/src/index.ts similarity index 100% rename from packages/product-sdk/src/index.ts rename to packages/host-api-wrapper/src/index.ts diff --git a/packages/product-sdk/src/injectWeb3.ts b/packages/host-api-wrapper/src/injectWeb3.ts similarity index 100% rename from packages/product-sdk/src/injectWeb3.ts rename to packages/host-api-wrapper/src/injectWeb3.ts diff --git a/packages/product-sdk/src/localStorage.ts b/packages/host-api-wrapper/src/localStorage.ts similarity index 100% rename from packages/product-sdk/src/localStorage.ts rename to packages/host-api-wrapper/src/localStorage.ts diff --git a/packages/product-sdk/src/metaProvider.ts b/packages/host-api-wrapper/src/metaProvider.ts similarity index 100% rename from packages/product-sdk/src/metaProvider.ts rename to packages/host-api-wrapper/src/metaProvider.ts diff --git a/packages/product-sdk/src/papiProvider.ts b/packages/host-api-wrapper/src/papiProvider.ts similarity index 100% rename from packages/product-sdk/src/papiProvider.ts rename to packages/host-api-wrapper/src/papiProvider.ts diff --git a/packages/product-sdk/src/payments.ts b/packages/host-api-wrapper/src/payments.ts similarity index 100% rename from packages/product-sdk/src/payments.ts rename to packages/host-api-wrapper/src/payments.ts diff --git a/packages/product-sdk/src/permission.ts b/packages/host-api-wrapper/src/permission.ts similarity index 100% rename from packages/product-sdk/src/permission.ts rename to packages/host-api-wrapper/src/permission.ts diff --git a/packages/product-sdk/src/preimage.ts b/packages/host-api-wrapper/src/preimage.ts similarity index 100% rename from packages/product-sdk/src/preimage.ts rename to packages/host-api-wrapper/src/preimage.ts diff --git a/packages/product-sdk/src/sandboxTransport.ts b/packages/host-api-wrapper/src/sandboxTransport.ts similarity index 100% rename from packages/product-sdk/src/sandboxTransport.ts rename to packages/host-api-wrapper/src/sandboxTransport.ts diff --git a/packages/product-sdk/src/statementStore.ts b/packages/host-api-wrapper/src/statementStore.ts similarity index 100% rename from packages/product-sdk/src/statementStore.ts rename to packages/host-api-wrapper/src/statementStore.ts diff --git a/packages/product-sdk/src/theme.ts b/packages/host-api-wrapper/src/theme.ts similarity index 100% rename from packages/product-sdk/src/theme.ts rename to packages/host-api-wrapper/src/theme.ts diff --git a/packages/product-sdk/tsconfig.json b/packages/host-api-wrapper/tsconfig.json similarity index 100% rename from packages/product-sdk/tsconfig.json rename to packages/host-api-wrapper/tsconfig.json diff --git a/packages/product-bulletin/README.md b/packages/product-bulletin/README.md index 02dfa9d7..c39e7912 100644 --- a/packages/product-bulletin/README.md +++ b/packages/product-bulletin/README.md @@ -4,7 +4,7 @@ Bulletin Chain client adapter for Polkadot product applications. ## Overview -Wraps [`@parity/bulletin-sdk`](https://github.com/paritytech/polkadot-bulletin-chain/tree/main/sdk/typescript) for use inside product applications. Creates a polkadot-api client via `createPapiProvider()` from `@novasamatech/product-sdk` and wires it to `AsyncBulletinClient`. +Wraps [`@parity/bulletin-sdk`](https://github.com/paritytech/polkadot-bulletin-chain/tree/main/sdk/typescript) for use inside product applications. Creates a polkadot-api client via `createPapiProvider()` from `@novasamatech/host-api-wrapper` and wires it to `AsyncBulletinClient`. ## Installation @@ -15,7 +15,7 @@ npm install @novasamatech/product-bulletin --save -E ## Usage ```ts -import { createAccountsProvider } from '@novasamatech/product-sdk'; +import { createAccountsProvider } from '@novasamatech/host-api-wrapper'; import { BulletinChain, createBulletinClient } from '@novasamatech/product-bulletin'; // Get a signer from a product account. @@ -45,7 +45,7 @@ const largeResult = await client await client.destroy(); ``` -> **Error handling:** unlike `@novasamatech/product-sdk`, `AsyncBulletinClient` methods **throw** on failure (they do not return `Result`). Catch `BulletinError` and inspect its `code` (see `ErrorCode`) to handle specific failure modes. +> **Error handling:** unlike `@novasamatech/host-api-wrapper`, `AsyncBulletinClient` methods **throw** on failure (they do not return `Result`). Catch `BulletinError` and inspect its `code` (see `ErrorCode`) to handle specific failure modes. ### Known networks diff --git a/packages/product-bulletin/package.json b/packages/product-bulletin/package.json index 1d77a80d..6a322bed 100644 --- a/packages/product-bulletin/package.json +++ b/packages/product-bulletin/package.json @@ -27,7 +27,7 @@ "README.md" ], "dependencies": { - "@novasamatech/product-sdk": "0.7.8", + "@novasamatech/host-api-wrapper": "0.7.8", "@parity/bulletin-sdk": "^0.3.0", "polkadot-api": ">=2" }, diff --git a/packages/product-bulletin/src/createBulletinClient.ts b/packages/product-bulletin/src/createBulletinClient.ts index bfc86f41..20ac4e82 100644 --- a/packages/product-bulletin/src/createBulletinClient.ts +++ b/packages/product-bulletin/src/createBulletinClient.ts @@ -1,5 +1,5 @@ import type { HexString } from '@novasamatech/host-api'; -import { createPapiProvider } from '@novasamatech/product-sdk'; +import { createPapiProvider } from '@novasamatech/host-api-wrapper'; import type { ClientConfig } from '@parity/bulletin-sdk'; import { AsyncBulletinClient } from '@parity/bulletin-sdk'; import type { PolkadotSigner } from 'polkadot-api'; diff --git a/packages/product-react-renderer/README.md b/packages/product-react-renderer/README.md index 32f1acfe..7eab5874 100644 --- a/packages/product-react-renderer/README.md +++ b/packages/product-react-renderer/README.md @@ -1,6 +1,6 @@ # @novasamatech/product-react-renderer -A custom React reconciler for rendering native UI widgets inside Polkadot host applications. Use it together with [`@novasamatech/product-sdk`](../product-sdk) to render interactive widget trees in response to custom chat messages. +A custom React reconciler for rendering native UI widgets inside Polkadot host applications. Use it together with [`@novasamatech/host-api-wrapper`](../host-api-wrapper) to render interactive widget trees in response to custom chat messages. ## How it works diff --git a/packages/product-react-renderer/package.json b/packages/product-react-renderer/package.json index a5dcac79..58b1af95 100644 --- a/packages/product-react-renderer/package.json +++ b/packages/product-react-renderer/package.json @@ -2,7 +2,7 @@ "name": "@novasamatech/product-react-renderer", "type": "module", "version": "0.7.8", - "description": "React wrapper for custom renderer format from product-sdk", + "description": "React wrapper for custom renderer format from host-api-wrapper", "license": "Apache-2.0", "repository": { "type": "git", @@ -25,7 +25,7 @@ ], "dependencies": { "@novasamatech/host-api": "0.7.8", - "@novasamatech/product-sdk": "0.7.8", + "@novasamatech/host-api-wrapper": "0.7.8", "scale-ts": "1.6.1", "react-reconciler": "0.33.0" }, diff --git a/packages/product-react-renderer/src/rendererChatMessage.ts b/packages/product-react-renderer/src/rendererChatMessage.ts index be9bc733..487b1de0 100644 --- a/packages/product-react-renderer/src/rendererChatMessage.ts +++ b/packages/product-react-renderer/src/rendererChatMessage.ts @@ -1,4 +1,4 @@ -import type { ChatCustomMessageRenderer, ChatCustomMessageRendererParams } from '@novasamatech/product-sdk'; +import type { ChatCustomMessageRenderer, ChatCustomMessageRendererParams } from '@novasamatech/host-api-wrapper'; import type { ReactNode } from 'react'; import { createRenderer } from './renderer.js';