Catalog npm
Back to packageRELEASE DETAILS

0.2.7

npm

@0xkaleab/sdk-js

Lumera JS/TS SDK — CosmJS+REST blockchain client and Cascade (sn-api) client

Published21 Mar 2026
Direct dependencies43
Transitive dependenciesNot calculated

README

Current package documentation

@lumera-protocol/sdk-js

Official JavaScript/TypeScript SDK for Lumera Protocol

A unified SDK providing seamless access to the Lumera blockchain and Cascade distributed storage network. Built with modern TypeScript, featuring comprehensive type safety, and designed for both Node.js and browser environments.

✨ Features

  • 🔗 Unified Client Interface - Single entry point for all Lumera operations
  • ⛓️ Blockchain Operations - Complete CosmJS integration with LCD/REST queries
    • Transaction simulation, signing, and broadcasting
    • Action module queries and operations
    • Supernode module queries
    • Chain parameter queries
  • 📦 Cascade Storage - Full-featured distributed file storage client
    • Upload/download with progress tracking
    • Automatic file chunking and Reed-Solomon encoding
    • Task management with polling and status updates
    • Stream-based downloads for memory efficiency
  • 🔐 Wallet Integration - Support for multiple wallet types
    • Keplr wallet integration
    • Leap wallet integration
    • Programmatic signing with DirectSecp256k1HdWallet
  • 🎯 Type Safety - Full TypeScript support with comprehensive types
  • 🌐 Cross-Platform - Works in Node.js (v18+) and modern browsers
  • 📝 Extensive Documentation - Complete API reference and examples

📦 Installation

pnpm install @lumera-protocol/sdk-js

Peer Dependencies

For blockchain operations, you'll also need CosmJS packages:

pnpm install @cosmjs/proto-signing @cosmjs/stargate

🚀 Quick Start

1. Initialize the Client

import { createLumeraClient } from "@lumera-protocol/sdk-js";
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";

// Create a wallet
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(
  "your mnemonic phrase here",
  { prefix: "lumera" }
);

const [account] = await wallet.getAccounts();

// Create the client using testnet preset
const client = await createLumeraClient({
  preset: "testnet",
  signer: wallet,
  address: account.address,
  gasPrice: "0.025ulume"
});

2. Query the Blockchain

// Get chain information
const chainId = await client.Blockchain.getChainId();
console.log("Chain ID:", chainId);

// Query action module parameters
const actionParams = await client.Blockchain.Action.getParams();
console.log("Action params:", actionParams);

// Query supernode module parameters  
const supernodeParams = await client.Blockchain.Supernode.getParams();
console.log("Supernode params:", supernodeParams);

3. Upload a File to Cascade

// Prepare your file
const fileContent = "Hello, Lumera!";
const fileBytes = new TextEncoder().encode(fileContent);

// Upload to Cascade
const uploadResult = await client.Cascade.uploader.uploadFile(fileBytes, {
  actionId: `my-file-${Date.now()}`,
  rq_ids_ic: 1000,
  rq_ids_max: actionParams.rq_ids_max,
  taskOptions: {
    pollInterval: 2000,
    timeout: 300000,
  },
});

console.log("Upload completed:", uploadResult);

4. Download a File from Cascade

// Download using the action ID
const downloadStream = await client.Cascade.downloader.download(
  uploadResult.actionId
);

// Read the stream
const reader = downloadStream.getReader();
const chunks: Uint8Array[] = [];

while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  chunks.push(value);
}

// Combine chunks
const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
const downloadedBytes = new Uint8Array(totalLength);
let offset = 0;
for (const chunk of chunks) {
  downloadedBytes.set(chunk, offset);
  offset += chunk.length;
}

const downloadedContent = new TextDecoder().decode(downloadedBytes);
console.log("Downloaded:", downloadedContent);

📚 Documentation

🎯 Core Concepts

Chain Presets

The SDK includes built-in presets for quick setup:

const client = await createLumeraClient({
  preset: "testnet", // or "mainnet"
  signer: wallet,
  address: account.address,
});

Available presets:

  • testnet - Lumera testnet configuration
  • mainnet - Lumera mainnet configuration

Manual Configuration

For custom chains or advanced setups:

const client = await createLumeraClient({
  rpcUrl: "https://your-rpc-url.com",
  lcdUrl: "https://your-lcd-url.com",
  chainId: "your-chain-id",
  signer: wallet,
  address: account.address,
  gasPrice: "0.025ulume",
  cascade: {
    snapiBaseUrl: "https://your-snapi-url.com"
  }
});

Blockchain Client

Direct access to blockchain operations:

// Transaction operations
const msgs = [...]; // Your messages
const gas = await client.Blockchain.Tx.simulate(address, msgs);
const result = await client.Blockchain.Tx.broadcast(signedTx);

// Query operations
const actionList = await client.Blockchain.Action.listActions();
const supernodeList = await client.Blockchain.Supernode.listAll();

Cascade Client

File storage operations:

// Upload with progress tracking
const uploader = client.Cascade.uploader;
const result = await uploader.uploadFile(fileBytes, {
  actionId: "my-action",
  rq_ids_ic: 1000,
  rq_ids_max: 10000,
});

// Download as stream
const downloader = client.Cascade.downloader;
const stream = await downloader.download("action-id");

LEP-1 Helpers & Deterministic IDs

For low-level control over LEP-1 layout generation and ID derivation, the SDK exposes helpers:

import {
  createSingleBlockLayout,
  generateIds,
  buildIndexFile,
} from "@lumera-protocol/sdk-js";

// 1. Create a single-block RaptorQ layout from file bytes
const layoutBytes = await createSingleBlockLayout(fileBytes);

// 2. Sign the canonical JSON layout bytes with your wallet (ADR-036)
//    and obtain the base64-encoded signature string.

// 3. Derive deterministic layout IDs (must match on-chain validation)
const layoutIds = await generateIds(
  layoutFileB64,
  layoutSignatureB64,
  rq_ids_ic,
  rq_ids_max,
);

// 4. Build the LEP-1 index file
const index = buildIndexFile(layoutIds, layoutSignatureB64);

To debug or validate determinism across Go and JS implementations, use the lep1-id-lab golden-vector setup at the repo root.

🧪 Development

# Install dependencies
pnpm install

# Run tests
pnpm test

# Run tests with coverage
pnpm run coverage

# Build the SDK
pnpm build

# Generate API documentation
pnpm run docs

# Lint code
pnpm lint

📋 Requirements

  • Node.js v18 or higher
  • TypeScript 5.x (for development)
  • Modern browser with ES2020+ support (for browser usage)

🤝 Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.

📄 License

Apache-2.0 - see LICENSE file for details.

💡 Support

  • For bug reports and feature requests, please open an issue on GitHub
  • For questions and discussions, join our community channels

Built with ❤️ by the Lumera Protocol team

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 43

Native requirements
43 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
zod
Environment
{
  "local_name": "zod",
  "alias": false,
  "peer_metadata": null
}
^3.23.8runtime
bs58
Environment
{
  "local_name": "bs58",
  "alias": false,
  "peer_metadata": null
}
^6.0.0runtime
blake3
Environment
{
  "local_name": "blake3",
  "alias": false,
  "peer_metadata": null
}
^2.1.7runtime
undici
Environment
{
  "local_name": "undici",
  "alias": false,
  "peer_metadata": null
}
^6.19.8runtime
cosmjs-types
Environment
{
  "local_name": "cosmjs-types",
  "alias": false,
  "peer_metadata": null
}
^0.9.0runtime
@cosmjs/amino
Environment
{
  "local_name": "@cosmjs/amino",
  "alias": false,
  "peer_metadata": null
}
^0.36.0runtime
formdata-node
Environment
{
  "local_name": "formdata-node",
  "alias": false,
  "peer_metadata": null
}
^6.0.3runtime
@cosmjs/crypto
Environment
{
  "local_name": "@cosmjs/crypto",
  "alias": false,
  "peer_metadata": null
}
^0.36.0runtime
rq-library-wasm
Environment
{
  "local_name": "rq-library-wasm",
  "alias": false,
  "peer_metadata": null
}
^1.0.2runtime
@cosmjs/encoding
Environment
{
  "local_name": "@cosmjs/encoding",
  "alias": false,
  "peer_metadata": null
}
^0.36.0runtime
@cosmjs/stargate
Environment
{
  "local_name": "@cosmjs/stargate",
  "alias": false,
  "peer_metadata": null
}
^0.36.0runtime
@mongodb-js/zstd
Environment
{
  "local_name": "@mongodb-js/zstd",
  "alias": false,
  "peer_metadata": null
}
^2.0.0runtime
@bokuweb/zstd-wasm
Environment
{
  "local_name": "@bokuweb/zstd-wasm",
  "alias": false,
  "peer_metadata": null
}
^0.0.27runtime
@bufbuild/protobuf
Environment
{
  "local_name": "@bufbuild/protobuf",
  "alias": false,
  "peer_metadata": null
}
^2.2.2runtime
@interchainjs/math
Environment
{
  "local_name": "@interchainjs/math",
  "alias": false,
  "peer_metadata": null
}
^1.18.0runtime
@interchainjs/types
Environment
{
  "local_name": "@interchainjs/types",
  "alias": false,
  "peer_metadata": null
}
^1.18.0runtime
@interchainjs/utils
Environment
{
  "local_name": "@interchainjs/utils",
  "alias": false,
  "peer_metadata": null
}
^1.18.0runtime
@interchainjs/cosmos
Environment
{
  "local_name": "@interchainjs/cosmos",
  "alias": false,
  "peer_metadata": null
}
^1.18.0runtime
@interchainjs/pubkey
Environment
{
  "local_name": "@interchainjs/pubkey",
  "alias": false,
  "peer_metadata": null
}
^1.18.0runtime
@cosmjs/proto-signing
Environment
{
  "local_name": "@cosmjs/proto-signing",
  "alias": false,
  "peer_metadata": null
}
^0.36.0runtime
@cosmjs/tendermint-rpc
Environment
{
  "local_name": "@cosmjs/tendermint-rpc",
  "alias": false,
  "peer_metadata": null
}
^0.36.0runtime
@interchainjs/encoding
Environment
{
  "local_name": "@interchainjs/encoding",
  "alias": false,
  "peer_metadata": null
}
^1.18.0runtime
glob
Environment
{
  "local_name": "glob",
  "alias": false,
  "peer_metadata": null
}
^10.4.2development
eslint
Environment
{
  "local_name": "eslint",
  "alias": false,
  "peer_metadata": null
}
^9.11.1development
rimraf
Environment
{
  "local_name": "rimraf",
  "alias": false,
  "peer_metadata": null
}
^6.0.1development
vitest
Environment
{
  "local_name": "vitest",
  "alias": false,
  "peer_metadata": null
}
^2.1.2development
shelljs
Environment
{
  "local_name": "shelljs",
  "alias": false,
  "peer_metadata": null
}
^0.10.0development
ts-node
Environment
{
  "local_name": "ts-node",
  "alias": false,
  "peer_metadata": null
}
^10.9.2development
typedoc
Environment
{
  "local_name": "typedoc",
  "alias": false,
  "peer_metadata": null
}
^0.28.14development
prettier
Environment
{
  "local_name": "prettier",
  "alias": false,
  "peer_metadata": null
}
^3.3.3development
fast-glob
Environment
{
  "local_name": "fast-glob",
  "alias": false,
  "peer_metadata": null
}
^3.3.3development
happy-dom
Environment
{
  "local_name": "happy-dom",
  "alias": false,
  "peer_metadata": null
}
^15.8.3development
minimatch
Environment
{
  "local_name": "minimatch",
  "alias": false,
  "peer_metadata": null
}
^10.0.3development
playwright
Environment
{
  "local_name": "playwright",
  "alias": false,
  "peer_metadata": null
}
^1.57.0development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^5.5.3development
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
^20.14.10development
@vitest/browser
Environment
{
  "local_name": "@vitest/browser",
  "alias": false,
  "peer_metadata": null
}
^2.1.2development
openapi-typescript
Environment
{
  "local_name": "openapi-typescript",
  "alias": false,
  "peer_metadata": null
}
^7.4.0development
@hyperweb/telescope
Environment
{
  "local_name": "@hyperweb/telescope",
  "alias": false,
  "peer_metadata": null
}
^2.0.3development
eslint-config-prettier
Environment
{
  "local_name": "eslint-config-prettier",
  "alias": false,
  "peer_metadata": null
}
^9.1.0development
typedoc-plugin-markdown
Environment
{
  "local_name": "typedoc-plugin-markdown",
  "alias": false,
  "peer_metadata": null
}
^4.9.0development
@typescript-eslint/parser
Environment
{
  "local_name": "@typescript-eslint/parser",
  "alias": false,
  "peer_metadata": null
}
^8.10.0development
@typescript-eslint/eslint-plugin
Environment
{
  "local_name": "@typescript-eslint/eslint-plugin",
  "alias": false,
  "peer_metadata": null
}
^8.10.0development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "9fdaeeed0c9bb0da010aa4392a67636b54e5e2c4",
  "tarball": "https://registry.npmjs.org/@0xkaleab/sdk-js/-/sdk-js-0.2.7.tgz",
  "fileCount": 1378,
  "integrity": "sha512-u/pKPoRQAD6tEogRR7PouswvWsEn1cv7eB+D7lLx6TnE8TD2SvG7CpvUlBIBRwvpd+371muusf9zlUK11fRV6A==",
  "signatures": [
    {
      "sig": "MEQCIC+kKkYhgA3dlgZ1RNQB1Q288ZX7q2AUoDjjAffjxsLEAiAVu7C9tCqWKtS2NiWQwCBGgn4kvhyf800KKAmvURXlGw==",
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
    }
  ],
  "unpackedSize": 17287996
}

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 09:00 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:6ada3a198533c3393dae18b558fbb48660e5d996c2ea0432b6dadd8724718809

Other collected versions

0.2.821 MarView all collected versions →