/product-sdk:product-sdk-cloud-storagefrom product-sdk
Uploads and retrieves data via CloudStorageClient SDK for CID-based decentralized storage. Covers store() upload builder, chunked uploads, container-only reads (fetch/query), CID helpers, and authorization.
Ships in product-sdk. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
@parity/product-sdk-cloud-storage is a TypeScript SDK for uploading and retrieving data via Cloud Storage -- a purpose-built parachain for decentralized data storage. Data is content-addressed using CIDv1 (blake2b-256 hash, raw codec). It wraps @parity/bulletin-sdk (chunking, DAG-PB manifests, CID calculation, progress events) and routes reads through the host's preimage subscription.
store(...) submits a TransactionStorage.store extrinsic, so create(...) requires a signer. In-container vs standalone only changes where the signer comes from (the account of the host vs a CommonSignerTxCreator you supply). There is no signer-less host upload path.fetchBytes/fetchJson/queryBytes resolve content through the host's preimage subscription and require a host container. Outside a container they return err(CloudStorageHostUnavailableError) -- the SDK does not fall back to a public IPFS gateway. A product that needs a standalone read path must branch on isInsideContainer() and perform its own gateway fetch.Result, not thrown errors: queryBytes/queryJson/executeQuery/checkAuthorization/verifyStored and their CloudStorageClient method equivalents (fetchBytes/fetchJson/checkAuthorization/verifyStored), plus the free authorizeAccount, return Result<T, E> = { ok: true; value: T } | { ok: false; error: E }. Check res.ok and read res.value (or res.error) -- they do not throw. (Upstream .send() builder results and the sync CID helpers are unchanged.)create({ environment }) accepts "paseo" (Paseo Next v2) and "devnet" (public Paseo testnet) -- the CloudStorageEnvironment presets, keys of CloudStorageNetworks; both currently available. "polkadot"/"kusama" are not yet available (compile error, and getChainAPI throws).import { CloudStorageClient, createLazySigner } from "@parity/product-sdk-cloud-storage";
// Create a client for the Paseo test network. A signer is REQUIRED -- every
// store() submits a transaction. createLazySigner defers signer resolution so
// you can build the client before an account is selected.
const cloudStorage = await CloudStorageClient.create({
environment: "paseo",
// getCurrentSigner returns the active `CommonSignerTxCreator | null`
// (e.g. wrap your signer manager / host account here).
signer: createLazySigner(() => getCurrentSigner()),
});
// Upload data (MUST be Uint8Array, not a string) via the store() builder
const data = new TextEncoder().encode(JSON.stringify({ title: "Hello Cloud Storage" }));
const result = await cloudStorage.store(data).send();
console.log("CID:", result.cid?.toString()); // result.cid is a CID object (undefined for chunked-without-manifest)
console.log("block:", result.blockNumber, "size:", result.size);
// Fetch it back as JSON (requires a host container -- returns err(CloudStorageHostUnavailableError) standalone).
// fetchJson returns a Result, so check .ok before reading .value.
const content = await cloudStorage.fetchJson<{ title: string }>(result.cid!.toString());
if (!content.ok) throw content.error;
console.log(content.value.title); // "Hello Cloud Storage"
WARNING:
store()expectsUint8Array, not strings. Always convert withnew TextEncoder().encode(...).
The CloudStorageClient wraps the upstream @parity/bulletin-sdk client and adds network presets, container-routed read helpers, and a pre-flight authorization check.
import { CloudStorageClient, CloudStorageNetworks, createLazySigner } from "@parity/product-sdk-cloud-storage";
// Environment shorthand (signer required)
const client = await CloudStorageClient.create({ environment: "paseo", signer });
// Explicit network / BYOD -- spread a preset (or supply your own genesisHash + descriptor)
const custom = await CloudStorageClient.create({
...CloudStorageNetworks.paseo,
signer,
config: { defaultChunkSize: 1 << 20 },
});
// From a pre-built AsyncBulletinClient + typed API (you own the connection lifecycle)
const fromInner = CloudStorageClient.from(inner, api);
| Method | When to use |
|---|---|
create({ environment, signer }) | Quick start against a preset network |
create({ ...descriptor, signer }) | Custom / BYOD network (explicit genesisHash + descriptor) |
from(inner, api) | You already own the AsyncBulletinClient and its connection lifecycle |
Uploads use the fluent store(data) builder (re-exported from @parity/bulletin-sdk):
const data = new TextEncoder().encode("raw file content");
// Simple signed upload
const result = await client.store(data).send();
// result.cid (CID | undefined), result.size, result.blockNumber, result.extrinsicIndex
// Chained options
const result2 = await client
.store(data)
.withWaitFor("finalized") // "in_block" | "finalized"
.send();
// Pre-authorized content can be stored fee-free by anyone via an unsigned tx
await client.authorizePreimage(contentHash, BigInt(data.length));
const result3 = await client.store(data).sendUnsigned();
There is no batchUpload. For large files, force the chunked path with withChunkSize -- a DAG-PB manifest (default) ties the chunks together and result.cid is the manifest CID:
const result = await client
.store(largeFile)
.withChunkSize(1 << 20) // 1 MiB chunks
.withCallback((evt) => console.log(evt)) // progress events
.send();
fetchBytes/fetchJson are instance methods and container-only (host preimage lookup; return err(CloudStorageHostUnavailableError) standalone). Both return a Result -- check .ok before reading .value:
// Raw bytes -- fetchBytes returns Result<Uint8Array, ProductCloudStorageError>
const res = await client.fetchBytes(cid);
if (!res.ok) return handle(res.error);
const bytes = res.value;
// Parsed JSON -- fetchJson returns Result<T, ProductCloudStorageError>
const meta = await client.fetchJson<{ name: string }>(cid);
if (!meta.ok) return handle(meta.error);
const metadata = meta.value;
import { calculateCid } from "@parity/product-sdk-cloud-storage";
// Compute a CID without uploading (standalone helper -- async, returns a CID object)
const cid = await calculateCid(data);
// Confirm a CID landed on-chain at a known block (pass the block from a store() receipt).
// verifyStored returns Result<ChainStoredEntry | null, ProductCloudStorageError>; ok(null) = not recorded at that block.
const verified = await client.verifyStored(result.cid!.toString(), { block: result.blockNumber! });
if (!verified.ok) throw verified.error;
const entry = verified.value; // ChainStoredEntry | null
// Pre-flight authorization check -- returns Result<AuthorizationStatus, CloudStorageAuthorizationError>
const authResult = await client.checkAuthorization(address);
if (!authResult.ok) throw authResult.error;
const auth = authResult.value;
// Estimate the authorization (transactions + bytes) a payload needs
const need = client.estimateAuthorization(data.length);
For advanced use cases:
import {
cidToPreimageKey,
hashToCid,
calculateCid, // async; returns a CID object
queryBytes, // container-only read (host preimage); returns Result, err(CloudStorageHostUnavailableError) standalone
queryJson, // container-only read (host preimage); returns Result, err(CloudStorageHostUnavailableError) standalone
executeQuery, // container-only read; returns Result<Uint8Array, ProductCloudStorageError>
resolveQueryStrategy,
} from "@parity/product-sdk-cloud-storage";
upload,batchUpload,cidExists,gatewayUrl,getGateway, and staticcomputeCid/hashToCidno longer exist. Uploads go through thestore(...)builder; CID computation is the standalone asynccalculateCid;fetchBytes/fetchJsonareCloudStorageClientinstance methods (container-only, no gateway argument).
store() instead of Uint8Array - convert with new TextEncoder().encode(...).create() requires a signer - every store() submits a transaction; use createLazySigner if no account is selected yet.result.cid as a string - it's a CID object (or undefined for chunked-without-manifest); call .toString().fetchBytes/fetchJson/queryBytes are container-only and return err(CloudStorageHostUnavailableError) outside a host.fetchBytes/fetchJson/queryBytes/queryJson/checkAuthorization/verifyStored (and authorizeAccount) return Result<T, E>. Check res.ok and read res.value -- they do not throw.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub paritytech/product-sdk --plugin product-sdk11 skills in this plugin
/migrating-to-product-sdkUse when migrating a product codebase to @parity/product-sdk — detects legacy stacks (polkadot-apps, novasamatech, hand-rolled crypto/IPFS, polkadot-api 1.x) in the target repo, decides which migration areas apply, writes a per-repo migration spec, then hands off to writing-plans.
/product-sdk-app-builderEnd-to-end scaffolding and implementation of Polkadot applications using @parity/product-sdk packages. Use when: creating a new Polkadot project, building a dApp, scaffolding chain interactions, choosing which @parity/product-sdk packages to install, or when a user says "build me a Polkadot app". Handles both developer-guided and fully autonomous (non-developer) workflows.
/product-sdk-chain-connectionUse 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.
/product-sdk-contractsUse when interacting with smart contracts (PolkaVM/Solidity) on Asset Hub, using ContractManager with cdm.json manifests, createContract for ad-hoc contracts, ContractRuntime creation, or contract type codegen. Covers @parity/product-sdk-contracts.
/product-sdk-individualityUse when reading a person's personhood or membership standing on the individuality chain from a DotNS username or an account address, when reading the usernames an account holds, or when sending a transaction that must run under a person, lite-person or score-participant origin instead of an account origin. Covers readPersonhoodState, lookupUsername, the seven-state PersonhoodState union, the pure derivation without a chain client and the decode helpers for raw Score.Participants and Resources.Consumers values; the game surface, its prize draws, claiming and sign-up with its airdrop VRFs; productContext, personhoodContext, peopleRing, litePeopleRing and readScoreContext for the ring-VRF proof contexts; withAsPerson, withLiteAlias and the RestrictOrigins requirement that otherwise fails every call; the two-transaction lite personhood bind then sign-up flow with buildLiteAliasBindTx, readLiteSignUpRequirement and signUpWithLiteInviteTx; game registration in one call with registerForGame, readGameSeat, deriveSeat, bindGameSeat and the /host entry's hostGameRegistrationCapabilities; and full-personhood registration with registerMessage, Score.register and withScoreParticipant.
/product-sdk-nftsUse when reading Scarcity NFT collections or their item catalogues on Asset Hub, which collections a claim can mint into, every collection, and what one of them holds. Covers getClaimableCollections, getCollections and getCollectionItems, getApprovedCollections for the collections apps offer per network, the one storage map that separates claimable from merely existing, the chain client they require and why a TypedApi is not enough, the descriptor entries they touch and what a pruned whitelist does, the open metadata schema and the two readings of ImageRef, why a missing collection is a success value rather than an error, getClaims across the People chain and Asset Hub with the four states a credit can be in, previewClaim and why it is the item a claim will produce, getVerifiedArtwork and why bytes are withheld unless they hash to the reference, getInstanceDisplays for the display metadata of minted NFTs by instance id with Found/NotFound per instance, and the purse-scoped reads that do not exist yet.
3 plugins in 2 repositories ship this exact skill · first indexed Oct 14, 2026
Other plugins' skills for the same job