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

@meshsdk/midnight-setup

v1.9.0-beta.98

Published

Midnight Network integration SDK for MeshSDK - https://meshjs.dev/midnight

Downloads

75

Readme

npm version License: MIT TypeScript


Source repository with a full React integration example and a Compact contract: https://github.com/MeshJS/midnight-setup


Installation

npm install @meshsdk/midnight-setup

For Midnight Network projects, you'll also need these providers, if you already have them, skip this section:

npm install \
  @midnight-ntwrk/[email protected] \
  @midnight-ntwrk/[email protected] \
  @midnight-ntwrk/[email protected] \
  @midnight-ntwrk/[email protected] \
  @midnight-ntwrk/[email protected] \
  @midnight-ntwrk/[email protected]

Features

  • Type-safe SDK - Full TypeScript support
  • Provider abstraction - Easy wallet and network integration
  • Contract state management - Query contract and ledger states
  • Flexible contract support - Works with any Midnight smart contract
  • Lightweight - Only 10.4 KB package size
  • ESM & CJS - Supports both module systems

Quick Start

1. Setup Providers

import { FetchZkConfigProvider } from "@midnight-ntwrk/midnight-js-fetch-zk-config-provider";
import { httpClientProofProvider } from "@midnight-ntwrk/midnight-js-http-client-proof-provider";
import { indexerPublicDataProvider } from "@midnight-ntwrk/midnight-js-indexer-public-data-provider";
import { levelPrivateStateProvider } from "@midnight-ntwrk/midnight-js-level-private-state-provider";

import type { MidnightSetupContractProviders } from "@meshsdk/midnight-setup";

export async function setupProviders(): Promise<MidnightSetupContractProviders> {
  const wallet = window.midnight?.mnLace;
  if (!wallet) {
    throw new Error("Please install Lace Beta Wallet for Midnight Network");
  }

  const walletAPI = await wallet.enable();
  const walletState = await walletAPI.state();
  const uris = await wallet.serviceUriConfig();

  return {
    privateStateProvider: levelPrivateStateProvider({
      privateStateStoreName: "my-dapp-state",
    }),
    zkConfigProvider: new FetchZkConfigProvider(
      window.location.origin,
      fetch.bind(window),
    ),
    proofProvider: httpClientProofProvider(uris.proverServerUri),
    publicDataProvider: indexerPublicDataProvider(
      uris.indexerUri,
      uris.indexerWsUri,
    ),
    walletProvider: {
      coinPublicKey: walletState.coinPublicKey,
      encryptionPublicKey: walletState.encryptionPublicKey,
      balanceTx: (tx, newCoins) => {
        return walletAPI.balanceAndProveTransaction(tx, newCoins);
      },
    },
    midnightProvider: {
      submitTx: (tx) => {
        return walletAPI.submitTransaction(tx);
      },
    },
  };
}

2. Deploy a Contract

import { MidnightSetupAPI } from "@meshsdk/midnight-setup";

import { setupProviders } from "./providers";

async function deployContract() {
  const providers = await setupProviders();
  const contractInstance = new MyContract({});

  const api = await MidnightSetupAPI.deployContract(
    providers,
    contractInstance,
  );

  console.log("Contract deployed at:", api.deployedContractAddress);
  return api;
}

3. Join Existing Contract

async function joinContract(contractAddress: string) {
  const providers = await setupProviders();
  const contractInstance = new MyContract({});

  const api = await MidnightSetupAPI.joinContract(
    providers,
    contractInstance,
    contractAddress,
  );

  return api;
}

4. Read Contract State

// Get contract state
const contractState = await api.getContractState();
console.log("Contract data:", contractState.data);

// Get ledger state
const ledgerState = await api.getLedgerState();
console.log("Message:", ledgerState.ledgerState?.message);

API Reference

MidnightSetupAPI

Static Methods

deployContract(providers, contractInstance, logger?)

Deploys a new smart contract to Midnight Network.

Parameters:

  • providers: MidnightSetupContractProviders - Network and wallet providers
  • contractInstance: ContractInstance - Your compiled contract instance
  • logger?: Logger - Optional Pino logger

Returns: Promise<MidnightSetupAPI>


joinContract(providers, contractInstance, contractAddress, logger?)

Connects to an existing deployed contract.

Parameters:

  • providers: MidnightSetupContractProviders - Network and wallet providers
  • contractInstance: ContractInstance - Your compiled contract instance
  • contractAddress: string - Address of the deployed contract
  • logger?: Logger - Optional Pino logger

Returns: Promise<MidnightSetupAPI>


Instance Methods

getContractState() - Gets the current state of the contract

Returns: Promise<ContractStateData>

getLedgerState() - Gets and parses the ledger state

Returns: Promise<LedgerStateData>


TypeScript Types

import type {
  ContractInstance,
  ContractStateData,
  DeployedContract,
  DeployedMidnightSetupAPI,
  LedgerStateData,
  MidnightSetupContractProviders,
} from "@meshsdk/midnight-setup";

Requirements

  • Node.js v18 or higher
  • Midnight Lace Wallet browser extension
  • TypeScript (recommended)

Links


Contributing

Contributions are welcome! Please visit the source repository.


License

Apache2.0 © MeshJS Team

See LICENSE for more information.


Support