From product-sdk
Use when connecting to Polkadot chains, querying chain state, subscribing to storage, working with typed APIs, or choosing between preset and BYOD paths. Covers @parity/product-sdk-chain-client and @parity/product-sdk-descriptors.
How this skill is triggered — by the user, by Claude, or both
Slash command
/product-sdk:product-sdk-chain-connectionThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
`@parity/product-sdk-chain-client` provides typed access to Polkadot parachains via polkadot-api (PAPI). It offers two paths: **preset** (zero-config for known environments) and **BYOD** (bring your own descriptors for custom setups).
@parity/product-sdk-chain-client provides typed access to Polkadot parachains via polkadot-api (PAPI). It offers two paths: preset (zero-config for known environments) and BYOD (bring your own descriptors for custom setups).
import { getChainAPI } from "@parity/product-sdk-chain-client";
const client = await getChainAPI("paseo");
// Query balance
const account = await client.assetHub.query.System.Account.getValue(
"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
);
console.log("Free balance:", account.data.free);
// Clean up
client.destroy();
import { createChainClient } from "@parity/product-sdk-chain-client";
import { paseo_asset_hub } from "@parity/product-sdk-descriptors/paseo-asset-hub";
const client = await createChainClient({
chains: { assetHub: paseo_asset_hub },
});
const account = await client.assetHub.query.System.Account.getValue(
"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
);
client.destroy();
getChainAPI (Preset) | createChainClient (BYOD) | |
|---|---|---|
| When | Known environments (paseo, polkadot, kusama) | Custom chains or a subset of chains |
| Descriptors | Built-in, lazy-loaded | You import and provide them |
| Chains | Always assetHub + bulletin + individuality | Any combination you choose |
| Bundle size | Slightly larger (~6.3 MB for all 3 chains) | Minimal (only what you import) |
Use getChainAPI when you want zero-config connection to a standard environment.
Use createChainClient when you need:
// Get current block number
const blockNumber = await client.assetHub.query.System.Number.getValue();
// Get account info
const account = await client.assetHub.query.System.Account.getValue(address);
// Get specific asset balance
const balance = await client.assetHub.query.Assets.Account.getValue(
assetId,
address
);
// Subscribe to balance changes
const unsubscribe = client.assetHub.query.System.Account.watchValue(
address,
(account) => {
console.log("Balance changed:", account.data.free);
}
);
// Later: stop subscription
unsubscribe();
// Get all entries in a storage map
const entries = await client.assetHub.query.System.Account.getEntries();
for (const [key, value] of entries) {
console.log(key, value.data.free);
}
For advanced use cases (like creating ContractRuntime for contracts), access the raw PAPI client:
import { createContractRuntime } from "@parity/product-sdk-contracts";
const runtime = createContractRuntime(client.raw.assetHub, { atBest: true });
WARNING: Only the
"paseo"environment is currently available. Using"polkadot"or"kusama"will throw an error.
| Environment | Asset Hub | Bulletin | Individuality |
|---|---|---|---|
| paseo (testnet) | Yes | Yes | Yes |
| polkadot (mainnet) | Planned | Planned | Planned |
| kusama (canary) | Planned | Planned | Planned |
Always destroy clients when done to close WebSocket connections:
// Single client
client.destroy();
// All clients (useful in tests)
import { destroyAll } from "@parity/product-sdk-chain-client";
destroyAll();
Forgetting await — getChainAPI() and createChainClient() return Promises.
Using unavailable environments — Only "paseo" works. "polkadot" and "kusama" throw.
Not cleaning up — Call client.destroy() when done to close WebSocket connections.
Barrel importing descriptors — Use subpath imports: @parity/product-sdk-descriptors/paseo-bulletin, NOT @parity/product-sdk-descriptors.
Missing polkadot-api — It's a peer dependency. Always install it alongside chain-client.
npx claudepluginhub paritytech/product-sdk --plugin product-sdkCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.