npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dignetwork/datalayer-driver-wasm

v3.0.0

Published

WebAssembly bindings for the Chia DataLayer driver (offline DIGStore spend-bundle construction).

Downloads

220

Readme

@dignetwork/datalayer-driver-wasm

WebAssembly bindings for the Chia DataLayer driver, mirroring the offline subset of the NAPI @dignetwork/datalayer-driver interface for browser/bundler use.

Scope

This package is offline only — it contains no networking. There is no Peer, Tls, connect, sync, or broadcast. Reading coins from the chain and broadcasting the resulting spend bundle are the consumer's responsibility (e.g. via a wallet extension such as Goby, or via a full-node RPC in JavaScript).

The package exists to build and sign DIGStore (DataStore) spend bundles client-side, inside a browser or any bundler-based environment, without shipping a full node.

Installation

npm install @dignetwork/datalayer-driver-wasm

Startup

Call init() once at startup. It installs the Rust panic hook so that panics surface as readable JavaScript errors rather than cryptic traps.

import init from "@dignetwork/datalayer-driver-wasm";
await init();

Note: When built with --target bundler (see below), many bundlers auto-run the default export initializer. Even so, calling init() explicitly is safe and recommended — it is idempotent after the first call.

Build target

This package is built with:

wasm-pack --target bundler

The bundler target works out of the box with webpack, Vite, Next.js, and esbuild. If you need plain Node.js (without a bundler), build the nodejs target yourself from the wasm/ crate in the source repo:

wasm-pack build . --target nodejs --out-dir pkg-node

Primary use case — build and sign a DIGStore mint bundle

import init, * as dl from "@dignetwork/datalayer-driver-wasm";

// Call init() to install the panic hook (safe to call multiple times).
await dl.init();

// ---------------------------------------------------------------------------
// 1. Derive keys from the master secret key (32-byte Uint8Array).
// ---------------------------------------------------------------------------
const sk = /* 32-byte Uint8Array — your master secret key */;
const pk             = dl.secretKeyToPublicKey(sk);
const syntheticKey   = dl.masterPublicKeyToWalletSyntheticKey(pk);
const syntheticSk    = dl.masterSecretKeyToWalletSyntheticSecretKey(sk);
const ownerPuzzleHash = dl.masterPublicKeyToFirstPuzzleHash(pk);

// ---------------------------------------------------------------------------
// 2. Fetch coins from your chain source (wallet RPC, Goby, etc.) and select.
//    All `amount` fields are bigint; all byte values are Uint8Array.
// ---------------------------------------------------------------------------
const allCoins = /* Coin[] fetched by your app */;
const selected  = dl.selectCoins(allCoins, 1n /* mojos needed + fee */);

// ---------------------------------------------------------------------------
// 3. Build the mint spend bundle.
// ---------------------------------------------------------------------------
const rootHash = /* 32-byte Uint8Array — SHA-256 root of the data tree */;

const mint = dl.mintStore(
  syntheticKey,
  selected,
  rootHash,
  "my-store",          // label (string | undefined)
  "description",       // description (string | undefined)
  undefined,           // bytes (bigint | undefined)
  undefined,           // sizeProof (Uint8Array | undefined)
  ownerPuzzleHash,
  [dl.adminDelegatedPuzzleFromKey(syntheticKey)],
  0n                   // fee in mojos
);

// ---------------------------------------------------------------------------
// 4. Sign and serialize.
// ---------------------------------------------------------------------------
const sig = dl.signCoinSpends(
  mint.coinSpends,
  [syntheticSk],
  false  // false = mainnet, true = testnet11
);

const bundleHex = dl.spendBundleToHex({
  coinSpends: mint.coinSpends,
  aggregatedSignature: sig,
});

// Broadcast `bundleHex` via your full-node RPC or wallet extension.

Type notes

  • All byte values (Uint8Array) — including keys, puzzle hashes, root hashes, and coin fields — are plain Uint8Array.
  • All amounts (bigint) — including amount, fee, and bytes — use JavaScript's native bigint type.

These conventions match the NAPI @dignetwork/datalayer-driver package exactly, so code that runs offline is portable between environments.

Available functions

| Category | Functions | |---|---| | Key derivation | secretKeyToPublicKey, masterPublicKeyToWalletSyntheticKey, masterPublicKeyToFirstPuzzleHash, masterSecretKeyToWalletSyntheticSecretKey, syntheticKeyToPuzzleHash | | Addresses | puzzleHashToAddress, addressToPuzzleHash | | Delegated puzzles | adminDelegatedPuzzleFromKey, writerDelegatedPuzzleFromKey | | Proofs / IDs | newLineageProof, newEveProof, getCoinId, morphLauncherId | | Genesis challenges | getMainnetGenesisChallenge, getTestnet11GenesisChallenge | | DIGStore builders | mintStore, oracleSpend, meltStore, updateStoreMetadata, updateStoreOwnership | | Signing / verification | signCoinSpends, signMessage, verifySignedMessage | | Serialization | spendBundleToHex, hexSpendBundleToCoinSpends | | Coin selection / fees | selectCoins, addFee, getCost | | Transfers | sendXch | | Server coins | createServerCoin |

Full TypeScript types are in datalayer-driver-wasm.d.ts (published with the package).

Parity guarantee

This package is generated from the wasm/ crate in the DataLayer-Driver repository. Its offline functions are validated byte-for-byte against the NAPI package by a parity test that runs in CI on every commit. If a result differs between the WASM and NAPI implementations the CI build fails.