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

@midnight-ntwrk/wallet-sdk-shielded

v2.1.0

Published

Manages shielded tokens on the Midnight network using zero-knowledge proofs.

Downloads

5,241

Readme

@midnight-ntwrk/wallet-sdk-shielded

Manages shielded tokens on the Midnight network using zero-knowledge proofs.

Installation

npm install @midnight-ntwrk/wallet-sdk-shielded

Overview

The Shielded Wallet handles private token operations where transaction values and addresses are hidden from observers while maintaining verifiability. It provides:

  • Zero-knowledge proof generation
  • Coin commitment tracking
  • Encrypted output decryption
  • Shielded transfer transactions
  • Transaction balancing for shielded tokens

Usage

Starting the Wallet

import { ShieldedWallet } from '@midnight-ntwrk/wallet-sdk-shielded';
import * as ledger from '@midnight-ntwrk/ledger-v7';
import { randomBytes } from 'node:crypto';

// Configuration for the wallet
const configuration = {
  networkId: 'preview',
  provingServerUrl: new URL('http://localhost:6300'),
  relayURL: new URL('ws://localhost:9944'),
  indexerClientConnection: {
    indexerHttpUrl: 'http://localhost:8088/api/v3/graphql',
    indexerWsUrl: 'ws://localhost:8088/api/v3/graphql/ws',
  },
};

// Create secret keys from a shielded seed
const seed = randomBytes(32);
const shieldedSecretKeys = ledger.ZswapSecretKeys.fromSeed(seed);

// Create and start the wallet
const shieldedWallet = ShieldedWallet(configuration).startWithSecretKeys(shieldedSecretKeys);

// Start syncing with the network
await shieldedWallet.start(shieldedSecretKeys);

Alternative: Start with Seed Directly

// Start directly with a shielded seed
const shieldedWallet = ShieldedWallet(configuration).startWithSeed(seed);
await shieldedWallet.start(ledger.ZswapSecretKeys.fromSeed(seed));

Restoring from Serialized State

// Restore a wallet from previously serialized state
const shieldedWallet = ShieldedWallet(configuration).restore(serializedState);
await shieldedWallet.start(shieldedSecretKeys);

Observing State

wallet.state.subscribe((state) => {
  console.log('Progress:', state.state.progress);
  console.log('Coins:', state.state.coins);
});

Creating Transfer Transactions

const tx = await wallet.transferTransaction(shieldedSecretKeys, [
  { type: 'NIGHT', receiverAddress: 'mn_shield-addr1...', amount: 1000n },
]);

Balancing Transactions

const balancingTx = await wallet.balanceTransaction(shieldedSecretKeys, transactionToBalance);

Creating Swap Offers

const swapTx = await wallet.initSwap(
  shieldedSecretKeys,
  { NIGHT: 500n }, // inputs
  [{ type: 'TOKEN_A', receiverAddress: shieldedAddress, amount: 100n }], // outputs
);

Privacy Model

Shielded transactions use zero-knowledge proofs to hide:

  • Transaction amounts
  • Sender addresses
  • Receiver addresses

While still proving:

  • The sender has sufficient balance
  • No tokens are created or destroyed
  • The transaction is valid

Exports

  • ShieldedWallet - Main wallet class
  • ShieldedWalletState - Wallet state type
  • Version 1 exports via @midnight-ntwrk/wallet-sdk-shielded/v1

License

Apache-2.0