Skip to main content
@lumera-protocol/sdk-js is the official JavaScript and TypeScript SDK for Lumera Protocol. It puts chain queries, transaction signing, and Cascade storage behind a single client. Cascade is the Lumera permanent storage network with a pay once, store forever model. The SDK runs in Node.js 18 or later and in modern browsers with the Keplr and Leap wallets. File transfers go through SN-API, a REST gateway in front of SuperNodes. The current release is 0.3.0. This page takes you from install to your first upload and download. Every method is listed in the JavaScript SDK reference.

Install the SDK

Install the package together with the CosmJS peer dependencies for signing and chain queries.

Create a client

createLumeraClient is the entry point for everything. The testnet preset fills in the chain ID lumera-testnet-2 and the public testnet endpoints. Use mainnet for lumera-mainnet-1. To target your own node instead, pass custom endpoints as shown in the JavaScript SDK reference.
The signer must provide three methods. signDirect and signAmino sign transactions. signArbitrary implements ADR-036, the Cosmos standard for arbitrary message signing, which Cascade uses to authenticate with SuperNodes. Keplr and Leap cover all three in the browser. In Node.js you build a compatible signer from a mnemonic, as shown below.

Wallet options

Browser wallets must know the Lumera chain before they can sign for it. Register it once with experimentalSuggestChain using this config. The config uses coin type 60 with the Ethereum key features because testnet derives keys the Ethereum way since the v1.20.0 upgrade.
chain-config.ts
getKeplrSigner returns a signer with signDirect, signAmino, and signArbitrary already wired up.
keplr-client.ts

Upload a file

uploadFile runs the whole flow. It registers the action on chain, escrows the storage fee, sends the file to a SuperNode, and polls until processing completes. An action is the on-chain record of a storage request. The fee is paid in LUME, so fund your testnet account from the faucet first.
upload.ts
The action_id is the permanent on-chain reference to your file. Save it. You need it for every download.

Download a file

download signs the action ID with ADR-036 to authenticate, then returns a ReadableStream of the file bytes.
download.ts

Check action status

Query the action to follow its progress on chain.
status.ts
The state starts at PENDING after registration. It moves to PROCESSING while SuperNodes encode and distribute the file, then ends at DONE. A failed upload ends at FAILED and the escrowed fee is refunded.

Next steps

JavaScript SDK reference

Every method, option, and status value in the SDK.

Build a browser app

Wire the SDK into a browser upload flow.

Upload lifecycle

What happens between PENDING and DONE.