Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .changeset/bump-product-sdk-truapi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
"playground-cli": minor
---

Bump the full `@parity` dependency stack to latest published and migrate to the
`Result`-based SDK error API.

- `@parity/product-sdk-*` to latest: host 0.14.1 (now built on `@parity/truapi`
instead of the former `@novasamatech` in-container host-api), cloud-storage
0.8.1, contracts 0.9.2, descriptors 0.8.0, keys 0.3.16, terminal 0.6.2, tx
0.3.2. Dropped the temporary vendored headless-host prerelease.
- `@parity/polkadot-app-deploy` 0.11.0 → 0.13.1, `@parity/dotns-cli` 0.7.2 →
0.8.0, `@parity/cdm-builder` 3.1.7 → 3.2.0, `@parity/cdm-codegen` 0.6.20 →
0.6.23, `@parity/cdm-env` 2.0.6 → 2.1.0, and `polkadot-api` aligned to 2.2.1
(single runtime instance).
- Migrated command handlers to the `Result` API (`submitAndWatch`, contract
`.tx`, cloud-storage `checkAuthorization`, `ContractManager.fromLiveClient`),
preserving user-facing error messages — and a failed registry publish now
surfaces the on-chain revert reason (e.g. `Unauthorized`, `NotRevealed`)
instead of a generic "reverted", failing fast on deterministic reverts.
- Retired the `summit` / `w3s` environment: polkadot-app-deploy 0.13.x removed
it from `environments.json` and product-sdk-descriptors 0.8.0 dropped the
`summit-*` descriptors. Only `paseo-next-v2` is wired.
25 changes: 13 additions & 12 deletions CLAUDE.md

Large diffs are not rendered by default.

25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,27 @@
"test:e2e:nightly": "tools/e2e-local.sh nightly"
},
"dependencies": {
"@parity/cdm-builder": "3.1.7",
"@parity/cdm-codegen": "0.6.20",
"@parity/cdm-env": "^2.0.6",
"@parity/dotns-cli": "0.7.2",
"@parity/cdm-builder": "3.2.0",
"@parity/cdm-codegen": "0.6.23",
"@parity/cdm-env": "^2.1.0",
"@parity/dotns-cli": "0.8.0",
"@parity/product-sdk-address": "^0.1.1",
"@parity/product-sdk-cloud-storage": "^0.6.4",
"@parity/product-sdk-contracts": "^0.7.7",
"@parity/product-sdk-descriptors": "^0.6.1",
"@parity/product-sdk-keys": "^0.3.10",
"@parity/product-sdk-cloud-storage": "^0.8.1",
"@parity/product-sdk-contracts": "^0.9.2",
"@parity/product-sdk-descriptors": "^0.8.0",
"@parity/product-sdk-host": "^0.14.1",
"@parity/product-sdk-keys": "^0.3.16",
"@parity/product-sdk-logger": "^0.1.1",
"@parity/product-sdk-terminal": "^0.5.0",
"@parity/product-sdk-tx": "^0.2.14",
"@parity/product-sdk-terminal": "^0.6.2",
"@parity/product-sdk-tx": "^0.3.2",
"@parity/product-sdk-utils": "^0.1.1",
"@polkadot-api/sdk-ink": "^0.7.0",
"@scure/sr25519": "^2.2.0",
"@sentry/node": "^9.47.1",
"@parity/polkadot-app-deploy": "0.11.0",
"@parity/polkadot-app-deploy": "0.13.1",
"commander": "^12.0.0",
"ink": "^5.2.1",
"polkadot-api": "^2.1.6",
"polkadot-api": "^2.2.1",
"react": "^18.3.1",
"react-devtools-core": "file:stubs/react-devtools-core",
"tar": "^7.5.16"
Expand Down
985 changes: 504 additions & 481 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

58 changes: 30 additions & 28 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,35 @@ allowBuilds:
node-datachannel: false

minimumReleaseAgeExclude:
- "@parity/polkadot-app-deploy@0.11.0"
- "@parity/dotns-cli@0.7.2"
# The @novasamatech/* 0.8.7 family (pulled transitively by
# @parity/product-sdk-terminal@^0.5.0 → host-papp@^0.8.7) publishes the stable
# tag the same day; the min-age gate would otherwise pin us to the older
# 0.8.7-N prerelease line. We opt these onto the stable line explicitly — they
# come from the vetted triangle-js-sdks source. host-papp pins statement-store
# exact, so the whole family must move together. Drop these once the version
# naturally ages past the min-age window.
- "@novasamatech/host-papp@0.8.7"
- "@novasamatech/host-api@0.8.7"
- "@novasamatech/host-api-wrapper@0.8.7"
- "@novasamatech/statement-store@0.8.7"
- "@novasamatech/storage-adapter@0.8.7"
- "@novasamatech/scale@0.8.7"
- "@novasamatech/substrate-slot-sr25519-wasm@0.8.7"
- '@parity/cdm-builder@3.1.7'
- '@parity/cdm-codegen@0.6.20'
- '@parity/cdm-env@2.0.6'
- '@parity/product-sdk-chain-client@0.7.4'
- '@parity/product-sdk-cloud-storage@0.6.4'
- '@parity/product-sdk-contracts@0.7.7'
- '@parity/product-sdk-host@0.10.2'
- '@parity/product-sdk-keys@0.3.10'
- '@parity/product-sdk-local-storage@0.2.9'
- '@parity/product-sdk-signer@0.8.1'
- '@parity/product-sdk-tx@0.2.14'
- "@parity/polkadot-app-deploy@0.13.1"
- "@parity/dotns-cli@0.8.0"
# The @novasamatech/* 0.8.11 family (pulled transitively by
# @parity/product-sdk-terminal@^0.6.2 → host-papp@^0.8.9, which resolves to the
# 0.8.11 line) publishes the stable tag the same day; the min-age gate would
# otherwise pin us to the older prerelease line. We opt these onto the stable
# line explicitly — they come from the vetted triangle-js-sdks source.
# host-papp pins statement-store exact, so the whole family must move together.
# Drop these once the version naturally ages past the min-age window.
- "@novasamatech/host-papp@0.8.11"
- "@novasamatech/host-api@0.8.11"
- "@novasamatech/host-api-wrapper@0.8.11"
- "@novasamatech/statement-store@0.8.11"
- "@novasamatech/storage-adapter@0.8.11"
- "@novasamatech/scale@0.8.11"
- "@novasamatech/substrate-slot-sr25519-wasm@0.8.11"
- '@parity/cdm-builder@3.2.0'
- '@parity/cdm-codegen@0.6.23'
- '@parity/cdm-env@2.1.0'
- '@parity/product-sdk-chain-client@0.9.1'
- '@parity/product-sdk-cloud-storage@0.8.1'
- '@parity/product-sdk-contracts@0.9.2'
- '@parity/product-sdk-descriptors@0.8.0'
- '@parity/product-sdk-host@0.14.1'
- '@parity/product-sdk-keys@0.3.16'
- '@parity/product-sdk-local-storage@0.3.2'
- '@parity/product-sdk-signer@0.11.1'
- '@parity/product-sdk-tx@0.3.2'
- '@parity/product-sdk-terminal@0.6.2'

overrides:
# dotns-cli ships a broken publish manifest (file:.papi/descriptors missing
Expand All @@ -65,5 +67,5 @@ overrides:
patchedDependencies:
# PATCH(playground-cli) — local-only fixes pending upstream. See CLAUDE.md
# "Two local pnpm patches remain" for what each one does.
"@novasamatech/statement-store@0.8.7": "patches/@novasamatech__statement-store@0.8.7.patch"
"@novasamatech/statement-store@0.8.11": "patches/@novasamatech__statement-store@0.8.11.patch"
"@novasamatech/sdk-statement@0.6.0": "patches/@novasamatech__sdk-statement@0.6.0.patch"
17 changes: 15 additions & 2 deletions src/commands/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,19 @@ function asCdmAssetHubDescriptor(d: unknown): PipelineChainClient["descriptors"]
return d as PipelineChainClient["descriptors"]["assetHub"];
}

// Same family of skew: `installContracts` comes from `@parity/cdm-builder`,
// which pins an OLDER `@parity/product-sdk-contracts` whose `Contract.tx()`
// resolves a bare `TxResult`. Our root bumped contracts to 0.9.x, where `.tx()`
// resolves a `Result<TxResult, …>`, so the freshly-built `registry` contract is
// nominally unassignable to cdm-builder's `RegistryContract` param. The
// install-time registry is query-only (no signer wired in — see `liveManager`),
// so `.tx()` is never invoked through it and the cast is runtime-safe. Delete
// once cdm-builder's pinned contracts version realigns with our root.
type CdmRegistryContract = Parameters<typeof installContracts>[0]["registry"];
function asCdmRegistryContract(contract: unknown): CdmRegistryContract {
return contract as CdmRegistryContract;
}

async function createContractChainClient(
target: ContractDeployTarget,
): Promise<ContractChainClient> {
Expand Down Expand Up @@ -679,15 +692,15 @@ export async function runContractInstall(
const result: ContractInstallRunResult = useUi
? await runContractInstallWithUI({
libraries: requests,
registry,
registry: asCdmRegistryContract(registry),
ipfs,
registryAddress: target.registryAddress,
assethubUrl: target.assethubUrl,
ipfsGatewayUrl: target.ipfsGatewayUrl,
})
: await installContracts({
libraries: requests,
registry,
registry: asCdmRegistryContract(registry),
ipfs,
onEvent: runOptions.onInstallEvent,
}).then((summary) => ({ summary, success: summary.success }));
Expand Down
1 change: 0 additions & 1 deletion src/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ describe("getPgasAssetId", () => {

it("returns a number for every wired env", () => {
expect(typeof getPgasAssetId("paseo-next-v2")).toBe("number");
expect(typeof getPgasAssetId("summit")).toBe("number");
});
});

Expand Down
47 changes: 12 additions & 35 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
* contract addresses, dapp identifiers, and feature defaults.
*
* Env IDs mirror polkadot-app-deploy's `assets/environments.json` (paseo-next,
* paseo-next-v2, paseo-review, summit, preview, polkadot, kusama) so a single
* value threads through both layers. paseo-next-v2 and summit are wired today;
* others throw from `getChainConfig` until they're populated.
* paseo-next-v2, paseo-review, preview, polkadot, kusama) so a single value
* threads through both layers. Only paseo-next-v2 is wired today; others throw
* from `getChainConfig` until they're populated. (Summit / w3s was retired when
* polkadot-app-deploy 0.13.x dropped it from `environments.json`.)
*/

/**
Expand All @@ -35,7 +36,6 @@ export const ENV_IDS = [
"paseo-next",
"paseo-review",
"paseo-next-v2",
"summit",
"polkadot",
"kusama",
] as const;
Expand All @@ -51,8 +51,8 @@ export const ENV_FLAG_CHOICES: readonly string[] = [...ENV_IDS, ...LEGACY_ENV_AL
/**
* THE network switch. This single constant selects the active testnet for the
* whole CLI — it feeds both `DEFAULT_ENV` and the legacy `testnet` alias in
* `resolveLegacyEnv`. Flipping it (e.g. to `"summit"`) is the one-line change an
* open-source actor makes to point a release at a different network; CI does the
* `resolveLegacyEnv`. Flipping it (e.g. to another wired env) is the one-line
* change an open-source actor makes to point a release at a different network; CI does the
* rest. The `config.test.ts` guard blocks the flip until the target env's
* endpoints match upstream AND its CDM meta-registry address exists.
*/
Expand Down Expand Up @@ -100,10 +100,11 @@ export interface ChainConfig {
faucetUrl: string | null;
/**
* Chain name that `@parity/cdm-env`'s `getRegistryAddress` understands, used
* to resolve the CDM meta-registry address for this env. Differs from `env`
* where the two catalogs disagree (our `summit` is cdm-env's `w3s`). The
* meta-registry ADDRESS itself lives ONLY in `@parity/cdm-env` and is never
* stored here — see `src/utils/registry.ts` and CLAUDE.md.
* to resolve the CDM meta-registry address for this env. Kept separate from
* `env` because the two catalogs can disagree on a network's name (the
* retired summit env was cdm-env's `w3s`); `paseo-next-v2` passes through
* unchanged. The meta-registry ADDRESS itself lives ONLY in `@parity/cdm-env`
* and is never stored here — see `src/utils/registry.ts` and CLAUDE.md.
*/
cdmEnvName: string;
/**
Expand Down Expand Up @@ -135,27 +136,6 @@ const PASEO_NEXT_V2: ChainConfig = {
pgasAssetId: 2_000_000_000,
};

// Web3 Summit network. Every endpoint/network value mirrors polkadot-app-deploy's
// `assets/environments.json` `summit` entry verbatim (the `config.test.ts` guard
// fails CI if they drift). The CDM meta-registry address is NOT stored here — it
// resolves at runtime from `@parity/cdm-env` via `cdmEnvName: "w3s"`, and is empty
// until that package ships it (see CLAUDE.md → "Adding a network / summit").
const SUMMIT: ChainConfig = {
env: "summit",
network: "testnet",
tokenSymbol: "SUM",
relayRpc: "wss://summit-rpc.polkadot.io",
assetHubRpc: "wss://summit-asset-hub-rpc.polkadot.io",
bulletinRpc: "wss://summit-bulletin-rpc.polkadot.io",
bulletinRpcFallbacks: [],
peopleEndpoints: ["wss://summit-people-rpc.polkadot.io"],
bulletinGateway: "https://summit-ipfs.polkadot.io/ipfs/",
autoAccountMapping: true,
faucetUrl: null,
cdmEnvName: "w3s",
pgasAssetId: 2_000_000_000,
};

/**
* Wired environments. Exported (read-only) so the `config.test.ts` divergence
* guard can compare every entry against polkadot-app-deploy's `environments.json`
Expand All @@ -164,7 +144,6 @@ const SUMMIT: ChainConfig = {
*/
export const CONFIGS: Partial<Record<Env, ChainConfig>> = {
"paseo-next-v2": PASEO_NEXT_V2,
summit: SUMMIT,
// Other envs are not wired yet — getChainConfig() throws below.
};

Expand Down Expand Up @@ -216,8 +195,6 @@ export function getNetworkLabel(env: Env = DEFAULT_ENV): string {
return "paseo next";
case "paseo-review":
return "paseo review";
case "summit":
return "summit";
case "preview":
return "preview";
case "polkadot":
Expand All @@ -230,7 +207,7 @@ export function getNetworkLabel(env: Env = DEFAULT_ENV): string {
/**
* Native token symbol for the given env (defaults to the active env). Display
* only — drives balance/drip labels via `formatPas`. Flipping
* `ACTIVE_TESTNET_ENV` (e.g. to `"summit"`) re-labels everything from here.
* `ACTIVE_TESTNET_ENV` re-labels everything from here.
*/
export function getTokenSymbol(env: Env = DEFAULT_ENV): string {
return getChainConfig(env).tokenSymbol;
Expand Down
17 changes: 10 additions & 7 deletions src/utils/account/allowance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import { Enum } from "polkadot-api";
import { submitAndWatch, createDevSigner } from "@parity/product-sdk-tx";
import { unwrapResult } from "../tx.js";
import type { PaseoClient } from "../connection.js";
import { remainingAuthorizationExtent } from "./authorizationExtent.js";

Expand Down Expand Up @@ -68,12 +69,14 @@ export async function ensureAllowance(client: PaseoClient, address: string): Pro
if (status.authorized && status.remainingTxs >= LOW_TX_THRESHOLD) return;

const alice = createDevSigner("Alice");
await submitAndWatch(
client.bulletin.tx.TransactionStorage.authorize_account({
who: address,
transactions: BULLETIN_TRANSACTIONS,
bytes: BULLETIN_BYTES,
}),
alice,
unwrapResult(
await submitAndWatch(
client.bulletin.tx.TransactionStorage.authorize_account({
who: address,
transactions: BULLETIN_TRANSACTIONS,
bytes: BULLETIN_BYTES,
}),
alice,
),
);
}
17 changes: 10 additions & 7 deletions src/utils/account/drip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

import { Enum } from "polkadot-api";
import { submitAndWatch } from "@parity/product-sdk-tx";
import { unwrapResult } from "../tx.js";
import { seedToAccount } from "@parity/product-sdk-keys";
import { getNetworkLabel, getTokenSymbol } from "../../config.js";
import type { PaseoClient } from "../connection.js";
Expand Down Expand Up @@ -168,13 +169,15 @@ export async function dripToProductAccount(
throw new DevFunderExhaustedError(dev.ss58Address, devBalance.data.free, required);
}

await submitAndWatch(
client.assetHub.tx.Balances.transfer_allow_death({
dest: Enum("Id", recipient),
value: DRIP_AMOUNT,
}),
dev.signer,
{ waitFor: "finalized" },
unwrapResult(
await submitAndWatch(
client.assetHub.tx.Balances.transfer_allow_death({
dest: Enum("Id", recipient),
value: DRIP_AMOUNT,
}),
dev.signer,
{ waitFor: "finalized" },
),
);
return { skipped: false, transferred: DRIP_AMOUNT, balance };
}
Expand Down
15 changes: 9 additions & 6 deletions src/utils/account/funding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import { Enum } from "polkadot-api";
import { submitAndWatch } from "@parity/product-sdk-tx";
import { unwrapResult } from "../tx.js";
import type { PaseoClient } from "../connection.js";
import { FUNDER_CHAIN, type Funder } from "./funder.js";
import { AllFundersExhaustedError } from "./errors.js";
Expand Down Expand Up @@ -97,11 +98,13 @@ export async function ensureFunded(
);
}

await submitAndWatch(
client.assetHub.tx.Balances.transfer_keep_alive({
dest: Enum("Id", address),
value: fundAmount,
}),
funder.signer,
unwrapResult(
await submitAndWatch(
client.assetHub.tx.Balances.transfer_keep_alive({
dest: Enum("Id", address),
value: fundAmount,
}),
funder.signer,
),
);
}
Loading
Loading