From product-sdk
Use when uploading or retrieving data via Cloud Storage, working with CID-based decentralized storage, IPFS gateway access, or the CloudStorageClient SDK. Covers upload, batch upload, fetch, query, CID computation, and gateway utilities.
How this skill is triggered — by the user, by Claude, or both
Slash command
/product-sdk:product-sdk-cloud-storageThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
`@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) and retrievable via IPFS gateways.
@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) and retrievable via IPFS gateways.
PolkadotSigner or dev signer is used."polkadot", "kusama", "paseo" -- currently only "paseo" has a live gateway.import { CloudStorageClient } from "@parity/product-sdk-cloud-storage";
// Create a client for the Paseo test network
const cloudStorage = await CloudStorageClient.create("paseo");
// Upload data (MUST be Uint8Array, not a string)
const data = new TextEncoder().encode(JSON.stringify({ title: "Hello Cloud Storage" }));
const result = await cloudStorage.upload(data);
console.log("CID:", result.cid);
// Fetch it back as JSON
const content = await cloudStorage.fetchJson<{ title: string }>(result.cid);
console.log(content.title); // "Hello Cloud Storage"
WARNING:
upload()expectsUint8Array, not strings. Always convert withnew TextEncoder().encode(...).
The CloudStorageClient class bundles a typed Cloud Storage API and IPFS gateway URL.
import { CloudStorageClient } from "@parity/product-sdk-cloud-storage";
// From an environment name
const client = await CloudStorageClient.create("paseo");
// From explicit API and gateway (custom setups)
import { getGateway } from "@parity/product-sdk-cloud-storage";
const custom = CloudStorageClient.from(myApi, "https://my-gateway.example/ipfs/");
| Method | When to use | Size cost |
|---|---|---|
CloudStorageClient.create("paseo") | Quick prototyping | ~6.3 MB (all preset descriptors) |
CloudStorageClient.from(api, gateway) | Production apps, BYOD | Only the descriptors you import |
const data = new TextEncoder().encode("raw file content");
const result = await client.upload(data);
// result.cid, result.kind, result.gatewayUrl
// With explicit signer and options
const result2 = await client.upload(data, mySigner, {
waitFor: "finalized",
timeoutMs: 60_000,
});
const items = [
{ data: new TextEncoder().encode("file A"), label: "a.txt" },
{ data: new TextEncoder().encode("file B"), label: "b.txt" },
];
const results = await client.batchUpload(items, undefined, {
onProgress: (completed, total, current) => {
console.log(`${completed}/${total}: ${current.label}`);
},
});
// Raw bytes
const bytes = await client.fetchBytes(cid);
// Parsed JSON
const metadata = await client.fetchJson<{ name: string }>(cid);
// Compute CID without uploading
const cid = CloudStorageClient.computeCid(data);
// Check if CID exists
const exists = await client.cidExists(cid);
// Build gateway URL
const url = client.gatewayUrl(cid);
// Pre-flight authorization check
const auth = await client.checkAuthorization(address);
For advanced use cases:
import {
upload,
batchUpload,
computeCid,
cidToPreimageKey,
hashToCid,
getGateway,
fetchBytes,
fetchJson,
} from "@parity/product-sdk-cloud-storage";
"paseo" has a live gatewaybatchUpload does NOT throw on individual failuresCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub paritytech/product-sdk --plugin product-sdk