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

@noosphere/contracts

v0.2.0-alpha.1

Published

Noosphere smart contract TypeScript wrappers and ABIs

Readme

@noosphere/contracts

TypeScript wrappers and ABIs for Noosphere smart contracts.

Installation

npm install @noosphere/contracts

Usage

Basic Example

import { RouterContract, CoordinatorContract, SubscriptionBatchReaderContract } from '@noosphere/contracts';
import { ethers } from 'ethers';

// Setup provider
const provider = new ethers.JsonRpcProvider('https://sepolia.hpp.io');

// Create contract instances
const router = new RouterContract(
  '0x89c76ee71E9cC8D57BEE3d414478B630AE41fF43',
  provider
);

const coordinator = new CoordinatorContract(
  '0x244D87a7CAe0D557C223C13a90Ae845e56430A50',
  provider
);

// Read subscription
const subscription = await router.getComputeSubscription(1n);
console.log('Subscription:', subscription);

// Check redundancy
const redundancy = await coordinator.redundancyCount('0x123...');
console.log('Redundancy count:', redundancy);

SubscriptionBatchReader

import { SubscriptionBatchReaderContract } from '@noosphere/contracts';

// Get BatchReader address from coordinator
const batchReaderAddress = await coordinator.raw.getSubscriptionBatchReader();

// Create BatchReader instance
const batchReader = new SubscriptionBatchReaderContract(
  batchReaderAddress,
  provider
);

// Read subscriptions in batch
const subscriptions = await batchReader.getSubscriptions(
  0n,    // startId
  100n,  // endId
  await provider.getBlockNumber() // optional: specific block
);

console.log(`Loaded ${subscriptions.length} subscriptions`);

Event Listening

// Listen for RequestStarted events
router.on('RequestStarted', (requestId, subscriptionId, containerId, commitment, event) => {
  console.log('New request:', {
    requestId,
    subscriptionId,
    containerId,
    commitment,
  });
});

// Query past events
const events = await router.queryFilter(
  router.filters.RequestStarted(),
  1000,  // from block
  'latest'
);

console.log(`Found ${events.length} RequestStarted events`);

Write Operations (requires Signer)

import { ethers } from 'ethers';

// Create signer
const wallet = new ethers.Wallet(privateKey, provider);

// Create contract with signer
const coordinatorWithSigner = new CoordinatorContract(
  coordinatorAddress,
  wallet
);

// Prepare next interval
const tx = await coordinatorWithSigner.prepareNextInterval(
  1n,           // subscriptionId
  5,            // nextInterval
  walletAddress // nodeWallet
);

await tx.wait();
console.log('Transaction confirmed:', tx.hash);

API

RouterContract

Read Methods:

  • getComputeSubscription(subscriptionId) - Get subscription details
  • hasSubscriptionNextInterval(subscriptionId, currentInterval) - Check if next interval exists
  • getLastSubscriptionId() - Get last subscription ID
  • getContractById(id) - Get contract address by ID
  • getWalletFactory() - Get WalletFactory address
  • isValidWallet(address) - Check if address is valid wallet

Write Methods:

  • sendRequest(subscriptionId, interval) - Create new request
  • fulfill(...) - Fulfill request
  • timeoutRequest(requestId, subscriptionId, interval) - Timeout request

Events:

  • RequestStarted
  • SubscriptionCreated
  • SubscriptionCancelled

CoordinatorContract

Read Methods:

  • getCommitment(subscriptionId, interval) - Get commitment
  • redundancyCount(requestId) - Get redundancy count
  • requestCommitments(requestId) - Get request ID

Write Methods:

  • startRequest(...) - Start new request
  • cancelRequest(requestId) - Cancel request
  • reportComputeResult(...) - Report compute result
  • prepareNextInterval(subscriptionId, interval, wallet) - Prepare interval

Events:

  • RequestStarted
  • RequestCancelled
  • ComputeDelivered
  • ProofVerified

SubscriptionBatchReaderContract

Read Methods:

  • getSubscriptions(startId, endId, blockNumber?) - Get batch of subscriptions
  • getIntervalStatuses(ids, intervals) - Get interval statuses

Types

All TypeScript types are exported:

import type {
  ComputeSubscription,
  Commitment,
  Payment,
  ProofVerificationRequest,
  IntervalStatus,
  FulfillResult,
  RequestStartedEvent,
} from '@noosphere/contracts';

ABIs

Access raw ABIs:

import { ABIs } from '@noosphere/contracts';

console.log(ABIs.Router);
console.log(ABIs.Coordinator);
console.log(ABIs.SubscriptionBatchReader);

License

MIT