@@ -20,26 +20,24 @@ import {
2020 type TypedApi ,
2121} from "polkadot-api" ;
2222import { getWsProvider } from "polkadot-api/ws" ;
23- import { paseo_bulletin as bulletin } from "@parity/product-sdk-descriptors/paseo-bulletin" ;
24- import { paseo_individuality as individuality } from "@parity/product-sdk-descriptors/paseo-individuality" ;
25- import { paseo_asset_hub } from "@parity/product-sdk-descriptors/paseo-asset-hub" ;
2623import { getChainConfig , getNetworkLabel } from "../config.js" ;
24+ import {
25+ getAssetHubDescriptor ,
26+ getBulletinDescriptor ,
27+ getIndividualityDescriptor ,
28+ type AssetHubDescriptor ,
29+ type BulletinDescriptor ,
30+ type IndividualityDescriptor ,
31+ } from "./descriptors.js" ;
2732
28- // The chain DESCRIPTORS are intentionally the `paseo_*` ones for EVERY env,
29- // including summit — only the RPC URLs are env-driven (via getChainConfig). This
30- // mirrors `@parity/cdm-env`, whose `DEPLOY_CHAIN_DESCRIPTORS`/`ASSET_HUB_DESCRIPTORS`
31- // also map `w3s` (summit) → `paseo_asset_hub`/`paseo_bulletin`; the deploy engine
32- // `@parity/polkadot-app-deploy` is descriptor-free (live `getUnsafeApi()`). PAPI
33- // typed calls decode by structural type IDs, so this holds as long as summit's
34- // runtime shapes match paseo's (they do today — same testnet family). Dedicated
35- // `summit-*` descriptors DO exist in `@parity/product-sdk-descriptors` as an escape
36- // hatch if the runtimes ever diverge; switching to them before they're needed would
37- // DIVERGE from the engine. See CLAUDE.md → "Adding a network / Summit".
33+ // The public type name remains `PaseoClient` for compatibility with the rest of
34+ // the codebase, but runtime descriptor selection follows the active env. When
35+ // DEFAULT_ENV is summit, direct PAPI reads use product-sdk's summit descriptors.
3836
3937type PaseoChains = {
40- assetHub : typeof paseo_asset_hub ;
41- bulletin : typeof bulletin ;
42- individuality : typeof individuality ;
38+ assetHub : AssetHubDescriptor ;
39+ bulletin : BulletinDescriptor ;
40+ individuality : IndividualityDescriptor ;
4341} ;
4442
4543export type PaseoClient = {
@@ -65,6 +63,11 @@ function typedApi<T extends ChainDefinition>(raw: PolkadotClient, descriptor: T)
6563
6664async function connectPaseo ( ) : Promise < PaseoClient > {
6765 const cfg = getChainConfig ( ) ;
66+ const descriptors = {
67+ assetHub : getAssetHubDescriptor ( cfg . env ) ,
68+ bulletin : getBulletinDescriptor ( cfg . env ) ,
69+ individuality : getIndividualityDescriptor ( cfg . env ) ,
70+ } ;
6871 const raw = {
6972 assetHub : createRawClient ( [ cfg . assetHubRpc ] ) ,
7073 bulletin : createRawClient ( [ cfg . bulletinRpc , ...cfg . bulletinRpcFallbacks ] ) ,
@@ -73,9 +76,9 @@ async function connectPaseo(): Promise<PaseoClient> {
7376
7477 let destroyed = false ;
7578 return {
76- assetHub : typedApi ( raw . assetHub , paseo_asset_hub ) ,
77- bulletin : typedApi ( raw . bulletin , bulletin ) ,
78- individuality : typedApi ( raw . individuality , individuality ) ,
79+ assetHub : typedApi ( raw . assetHub , descriptors . assetHub ) ,
80+ bulletin : typedApi ( raw . bulletin , descriptors . bulletin ) ,
81+ individuality : typedApi ( raw . individuality , descriptors . individuality ) ,
7982 raw,
8083 destroy ( ) {
8184 if ( destroyed ) return ;
0 commit comments