@railblock/opencommodity-sdk
v1.0.12
Published
TypeScript SDK for the OpenCommodity Protocol API
Downloads
1,543
Maintainers
Readme
OpenCommodity SDK
██████╗ ██████╗ ███████╗███╗ ██╗
██╔═══██╗██╔══██╗██╔════╝████╗ ██║
██║ ██║██████╔╝█████╗ ██╔██╗ ██║
██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║
╚██████╗██║ ██║███████╗██║ ╚████║
╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝
██████╗ ██████╗ ███╗ ███╗███╗ ███╗ ██████╗ ██████╗ ██╗████████╗██╗ ██╗
██╔════╝██╔═══██╗████╗ ████║████╗ ████║██╔═══██╗██╔══██╗██║╚══██╔══╝╚██╗ ██╔╝
██║ ██║ ██║██╔████╔██║██╔████╔██║██║ ██║██║ ██║██║ ██║ ╚████╔╝
██║ ██║ ██║██║╚██╔╝██║██║╚██╔╝██║██║ ██║██║ ██║██║ ██║ ╚██╔╝
╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚═╝ ██║╚██████╔╝██████╔╝██║ ██║ ██║
╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝TypeScript SDK for the OpenCommodity Protocol API.
Install
npm install @railblock/opencommodity-sdkQuick start
import {
OpenCommodityClient,
generateGCID,
parseGCID
} from "@railblock/opencommodity-sdk";
const client = new OpenCommodityClient({
apiKey: "your-api-key"
});
const commodities = await client.listCommodities({
category: "Metals",
limit: 10
});
const stats = await client.getStats();
const gcid = generateGCID("Coffee", "BR", "ARABICA", 1021, 2026);
const parsed = parseGCID(gcid);Custom base URL
import { OpenCommodityClient } from "@railblock/opencommodity-sdk";
const client = new OpenCommodityClient({
apiKey: "your-api-key",
baseUrl: "https://kiwwrdhvnqvhhavamrgn.supabase.co/functions/v1"
});Repository layout
src/
client.ts
gcid.ts
index.ts
types.ts
dist/Local development
npm install
npm run build
npm run testNotes
- This repository currently contains a single publishable SDK package at the repo root.
- The SDK is browser-safe at the package level: it uses native
fetchand does not shipstreamor websocket dependencies. - Published package:
@railblock/opencommodity-sdk
