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

@no-witness-labs/midday-sdk

v0.2.3

Published

Developer-friendly SDK for building dapps on Midnight Network

Downloads

655

Readme

midday-sdk

Developer-friendly SDK for building dapps on Midnight Network.

Installation

pnpm add @no-witness-labs/midday-sdk

Quick Start

Promise API (Non-Effect Users)

import * as Midday from '@no-witness-labs/midday-sdk';

// Create client
const client = await Midday.Client.create({
  networkConfig: Midday.Config.NETWORKS.local,
  zkConfigProvider: new Midday.HttpZkConfigProvider('http://localhost:3000/zk'),
  privateStateProvider: Midday.inMemoryPrivateStateProvider(),
});

// Load and deploy a contract
const builder = await Midday.Client.contractFrom(client, {
  module: await import('./contracts/counter/index.js'),
});
const contract = await Midday.ContractBuilder.deploy(builder);

// Call contract actions
await Midday.Contract.call(contract, 'increment');

// Read state
const state = await Midday.Contract.ledgerState(contract);
console.log(state.counter);

Effect API (Pure Effect Users)

import * as Midday from '@no-witness-labs/midday-sdk';
import { Effect } from 'effect';

const program = Effect.gen(function* () {
  const client = yield* Midday.Client.effect.create({
    networkConfig: Midday.Config.NETWORKS.local,
    zkConfigProvider: new Midday.HttpZkConfigProvider('http://localhost:3000/zk'),
    privateStateProvider: Midday.inMemoryPrivateStateProvider(),
  });

  const builder = yield* Midday.Client.effect.contractFrom(client, {
    module: await import('./contracts/counter/index.js'),
  });

  const contract = yield* Midday.ContractBuilder.effect.deploy(builder);
  const result = yield* Midday.Contract.effect.call(contract, 'increment');

  return result;
});

const result = await Midday.runEffectPromise(program);

Effect DI (Dependency Injection)

import * as Midday from '@no-witness-labs/midday-sdk';
import { Effect, Layer } from 'effect';

const program = Effect.gen(function* () {
  const clientService = yield* Midday.ClientService;
  const contractBuilderService = yield* Midday.ContractBuilderService;
  const contractService = yield* Midday.ContractService;

  const client = yield* clientService.create({
    networkConfig: Midday.Config.NETWORKS.local,
    zkConfigProvider: new Midday.HttpZkConfigProvider('http://localhost:3000/zk'),
    privateStateProvider: Midday.inMemoryPrivateStateProvider(),
  });

  const builder = yield* clientService.contractFrom(client, {
    module: await import('./contracts/counter/index.js'),
  });

  const contract = yield* contractBuilderService.deploy(builder);
  const result = yield* contractService.call(contract, 'increment');

  return result;
});

// Compose layers
const MainLive = Layer.mergeAll(
  Midday.ClientLive,
  Midday.ContractBuilderLive,
  Midday.ContractLive,
);

const result = await Effect.runPromise(program.pipe(Effect.provide(MainLive)));

Browser Usage (Lace Wallet)

import * as Midday from '@no-witness-labs/midday-sdk';

// Connect to Lace wallet
const connection = await Midday.connectWallet('testnet');

// Create client from wallet connection
const client = await Midday.Client.fromWallet(connection, {
  zkConfigProvider: new Midday.HttpZkConfigProvider('https://cdn.example.com/zk'),
  privateStateProvider: Midday.indexedDBPrivateStateProvider({ privateStateStoreName: 'my-app' }),
});

// Use contract
const builder = await Midday.Client.contractFrom(client, {
  module: await import('./contracts/counter/index.js'),
});
const contract = await Midday.ContractBuilder.deploy(builder);
await Midday.Contract.call(contract, 'increment');

Configuration

Network Configuration

// Local network
const client = await Midday.Client.create({
  networkConfig: Midday.Config.NETWORKS.local,
  // ...
});

// Testnet
const client = await Midday.Client.create({
  networkConfig: Midday.Config.NETWORKS.testnet,
  seed: 'your-64-char-hex-seed',
  // ...
});

// Custom network
const client = await Midday.Client.create({
  networkConfig: {
    networkId: 'testnet',
    indexer: 'https://indexer.testnet.midnight.network/graphql',
    indexerWS: 'wss://indexer.testnet.midnight.network/graphql/ws',
    node: 'wss://node.testnet.midnight.network',
    proofServer: 'https://proof.testnet.midnight.network',
  },
  seed: 'your-64-char-hex-seed',
  // ...
});

Contract Operations

Deploy a New Contract

const builder = await Midday.Client.contractFrom(client, {
  module: await import('./contracts/my-contract/index.js'),
});
const contract = await Midday.ContractBuilder.deploy(builder);
console.log(`Deployed at: ${contract.address}`);

Join an Existing Contract

const builder = await Midday.Client.contractFrom(client, {
  module: await import('./contracts/my-contract/index.js'),
});
const contract = await Midday.ContractBuilder.join(builder, { address: contractAddress });

With Witnesses

const builder = await Midday.Client.contractFrom(client, {
  module: await import('./contracts/my-contract/index.js'),
  witnesses: {
    my_witness_function: myImplementation,
  },
});
const contract = await Midday.ContractBuilder.deploy(builder);

Call Actions

const result = await Midday.Contract.call(contract, 'increment');
console.log(`TX Hash: ${result.txHash}`);
console.log(`Block: ${result.blockHeight}`);

Read State

// Parsed state via ledger
const state = await Midday.Contract.ledgerState(contract);

// Raw state
const rawState = await Midday.Contract.state(contract);

// State at specific block
const historicalState = await Midday.Contract.ledgerStateAt(contract, blockHeight);

API Reference

Modules

  • Midday.Client - High-level client for contract interactions
  • Midday.ContractBuilder - Contract deployment and joining
  • Midday.Contract - Contract operations (call, state)
  • Midday.Config - Network configuration utilities
  • Midday.Wallet - Wallet initialization and management
  • Midday.Providers - Low-level provider setup

Services (Effect DI)

| Service | Layer | Description | |---------|-------|-------------| | ClientService | ClientLive | Client creation and contract loading | | ContractBuilderService | ContractBuilderLive | Contract deployment and joining | | ContractService | ContractLive | Contract operations | | WalletService | WalletLive | Wallet initialization | | ProvidersService | ProvidersLive | Provider setup | | ZkConfigService | ZkConfigLive | ZK configuration loading | | PrivateStateService | PrivateStateLive | Private state management | | WalletConnectorService | WalletConnectorLive | Browser wallet connection | | WalletProviderService | WalletProviderLive | Wallet provider operations |

Types

import type {
  ClientConfig,
  MidnightClient,
  ContractBuilder,
  ConnectedContract,
  CallResult,
  NetworkConfig,
  WalletContext,
  ContractProviders,
  StorageConfig,
} from '@no-witness-labs/midday-sdk';

License

MIT