diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b46360e..7a7a836 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: jobs: build-and-test: - runs-on: parity-default + runs-on: parity-int-ubuntu steps: - uses: actions/checkout@v4 @@ -37,7 +37,7 @@ jobs: run: pnpm pack && ls -lh *.tgz integration-tests: - runs-on: parity-default + runs-on: parity-int-ubuntu steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/npm-release.yml b/.github/workflows/npm-release.yml index 3d0e27c..a16fe5a 100644 --- a/.github/workflows/npm-release.yml +++ b/.github/workflows/npm-release.yml @@ -6,7 +6,7 @@ on: jobs: publish: - runs-on: parity-default + runs-on: parity-int-ubuntu steps: - uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index aa4904f..b942c9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 0.7.4 + +### Added + +- **`handleRequestResourceAllocation`** (RFC-0010) — products can request resource allowances (StatementStoreAllowance, BulletInAllowance, SmartContractAllowance, AutoSigning). The test host auto-allocates all requested resources. +- **`handleStatementStoreCreateProofAuthorized`** — creates statement proofs using the host-internal allowance account (no product account required). Uses the first configured account. + +### Changed + +- **Dependencies** — `@novasamatech/host-api`, `host-container`, `product-sdk` → ^0.7.7. Upstream changes include RFC-0010 resource allocation, authorized statement proofs, SSO signer fixes, and reconnect improvements. + ## 0.7.3 ### Breaking changes diff --git a/package.json b/package.json index 1412f5f..528ff7f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@parity/host-api-test-sdk", - "version": "0.7.3", + "version": "0.7.4", "description": "Lightweight test host for Spektr product E2E testing — embeds dapps with auto-signing dev accounts, no Docker needed", "license": "MIT", "repository": { @@ -42,11 +42,11 @@ } }, "dependencies": { - "@novasamatech/host-api": "^0.7.4" + "@novasamatech/host-api": "^0.7.7" }, "devDependencies": { - "@novasamatech/host-container": "^0.7.4", - "@novasamatech/product-sdk": "^0.7.4", + "@novasamatech/host-container": "^0.7.7", + "@novasamatech/product-sdk": "^0.7.7", "@polkadot/keyring": "^14.0.0", "@polkadot/types": "^16.0.0", "@polkadot/util": "^14.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f6e75cb..b092fbf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,18 +9,18 @@ importers: .: dependencies: '@novasamatech/host-api': - specifier: ^0.7.4 - version: 0.7.4 + specifier: ^0.7.7 + version: 0.7.7 '@playwright/test': specifier: '>=1.0.0' version: 1.58.2 devDependencies: '@novasamatech/host-container': - specifier: ^0.7.4 - version: 0.7.4(esbuild@0.25.12)(rxjs@7.8.2) + specifier: ^0.7.7 + version: 0.7.7(esbuild@0.25.12)(rxjs@7.8.2) '@novasamatech/product-sdk': - specifier: ^0.7.4 - version: 0.7.4(@polkadot/api@16.5.6)(@polkadot/util@14.0.1)(esbuild@0.25.12)(rxjs@7.8.2) + specifier: ^0.7.7 + version: 0.7.7(@polkadot/api@16.5.6)(@polkadot/util@14.0.1)(esbuild@0.25.12)(rxjs@7.8.2) '@polkadot/keyring': specifier: ^14.0.0 version: 14.0.1(@polkadot/util-crypto@14.0.1(@polkadot/util@14.0.1))(@polkadot/util@14.0.1) @@ -232,17 +232,17 @@ packages: resolution: {integrity: sha512-IYqDGiTXab6FniAgnSdZwgWbomxpy9FtYvLKs7wCUs2a8RkITG+DFGO1DM9cr+E3/RgADRpFjrKVaJ1z6sjtEg==} engines: {node: '>= 20.19.0'} - '@novasamatech/host-api@0.7.4': - resolution: {integrity: sha512-2Nd8QMNmpJI5vIKxJEVEIyVr9nt6+v50GY1/IbqM0yo1TiDXIrZJEW4m9C9sbqTR7wAqgVus47t4osvQtGt6wg==} + '@novasamatech/host-api@0.7.7': + resolution: {integrity: sha512-2aU6ZIZrfYkdRj39PP9+Rsg+hl5KlzjyC7dUsbcV4mepWtyHFYCCkt621Zg3TmCrT4oDJoY107DOxankB4UV3Q==} - '@novasamatech/host-container@0.7.4': - resolution: {integrity: sha512-wlb3V50ndn+79HcZfoja9+EOoUsmQvDuVNBYV79euC31ffvklUw8unagOz4o35JO4XSfxuUREzu/GUmD2t5wiw==} + '@novasamatech/host-container@0.7.7': + resolution: {integrity: sha512-X6kbEHa3GHDuAD6BKu6fv94Kh/wPX8WZDRnyMqzru83pccPeDyTGaOqqPLPmxyfJp1iZudlaNwBmDfVWNt211g==} - '@novasamatech/product-sdk@0.7.4': - resolution: {integrity: sha512-abNi+d668qEXvL5OThE/oaSXpiP8BqIiT87fSeqvD3JDl6jwmeL8NpAFV1v25qORRtLh6uxKQcVLoscj9R72OA==} + '@novasamatech/product-sdk@0.7.7': + resolution: {integrity: sha512-Jh3AXmbt1OblniHfzSdaRS4esXEeaP9Gbstv7/wqgAiMPMmJvmMTYFmNVCLWxFrz55P4NwTwhG1V+yeU940Dmw==} - '@novasamatech/scale@0.7.4': - resolution: {integrity: sha512-kxdKxtSKBkgoXYMWD0iXZMOa4cDXRFZ1mRbMpHvnZG3jNCF9zr1QPo8jnTmut1vbHJ6O3o+At+4dI6CiU6SFOw==} + '@novasamatech/scale@0.7.7': + resolution: {integrity: sha512-t4qdnp9gsG8B0LoxKUWpOHB3JAy7/jS7n2vUn3ynPJDDBsKgbqg5GKfWD6QCRdDhtilzR6k9H0LpDS5yCLFvog==} '@playwright/test@1.58.2': resolution: {integrity: sha512-akea+6bHYBBfA9uQqSYmlJXn61cTa+jbO87xVLCWbTqbWadRVmhxlXATaOjOgcBaWU4ePo0wB41KMFv3o35IXA==} @@ -1308,18 +1308,19 @@ snapshots: '@noble/hashes@2.2.0': {} - '@novasamatech/host-api@0.7.4': + '@novasamatech/host-api@0.7.7': dependencies: - '@novasamatech/scale': 0.7.4 + '@novasamatech/scale': 0.7.7 nanoevents: 9.1.0 nanoid: 5.1.9 neverthrow: 8.2.0 scale-ts: 1.6.1 - '@novasamatech/host-container@0.7.4(esbuild@0.25.12)(rxjs@7.8.2)': + '@novasamatech/host-container@0.7.7(esbuild@0.25.12)(rxjs@7.8.2)': dependencies: '@noble/hashes': 2.2.0 - '@novasamatech/host-api': 0.7.4 + '@novasamatech/host-api': 0.7.7 + '@polkadot-api/substrate-client': 0.7.0 nanoid: 5.1.9 neverthrow: 8.2.0 polkadot-api: 2.0.2(esbuild@0.25.12)(rxjs@7.8.2) @@ -1330,9 +1331,9 @@ snapshots: - supports-color - utf-8-validate - '@novasamatech/product-sdk@0.7.4(@polkadot/api@16.5.6)(@polkadot/util@14.0.1)(esbuild@0.25.12)(rxjs@7.8.2)': + '@novasamatech/product-sdk@0.7.7(@polkadot/api@16.5.6)(@polkadot/util@14.0.1)(esbuild@0.25.12)(rxjs@7.8.2)': dependencies: - '@novasamatech/host-api': 0.7.4 + '@novasamatech/host-api': 0.7.7 '@polkadot-api/json-rpc-provider-proxy': 0.4.0 '@polkadot/extension-inject': 0.63.1(@polkadot/api@16.5.6)(@polkadot/util@14.0.1) neverthrow: 8.2.0 @@ -1346,7 +1347,7 @@ snapshots: - supports-color - utf-8-validate - '@novasamatech/scale@0.7.4': + '@novasamatech/scale@0.7.7': dependencies: '@polkadot-api/utils': 0.4.0 scale-ts: 1.6.1 diff --git a/src/browser/host-runtime.ts b/src/browser/host-runtime.ts index 79e92c9..edcd036 100644 --- a/src/browser/host-runtime.ts +++ b/src/browser/host-runtime.ts @@ -839,6 +839,22 @@ function setupContainer( }); }); + // Authorized proof: uses the first account (host-internal allowance, no product account needed) + container.handleStatementStoreCreateProofAuthorized((statement, { ok }) => { + const pair = pairs[0]?.pair; + const dataToSign = + (statement as { data?: Uint8Array }).data ?? new Uint8Array(); + const signature = pair ? pair.sign(dataToSign) : new Uint8Array(64); + + return ok({ + tag: "Sr25519", + value: { + signature, + signer: pair?.publicKey ?? new Uint8Array(32), + }, + }); + }); + container.handleStatementStoreSubmit((statement, { ok }) => { statementStore.push(statement); submittedStatements.push({ @@ -1011,6 +1027,17 @@ function setupContainer( }; }); + // ── Resource allocation (RFC-0010) ─────────────────────────── + + container.handleRequestResourceAllocation((resources, { ok }) => { + // Auto-allocate all requested resources for test purposes + const outcomes = resources.map(() => ({ + tag: "Allocated" as const, + value: undefined, + })); + return ok(outcomes); + }); + // ── Connection status ──────────────────────────────────────── container.subscribeProductConnectionStatus((status) => {