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

@superorange/network-js-sdk

v0.1.2

Published

Primus Network js sdk

Readme

PrimusNetwork SDK Documentation

Overview

The PrimusNetwork SDK is a TypeScript library designed for blockchain network interaction, enabling developers to submit tasks, perform attestations, and query task statuses. It abstracts smart contract interactions through a developer-friendly API.

Key Features

  1. SDK Initialization: Connect to specified blockchain networks
  2. Task Submission: Submit tasks requiring attestation to the network
  3. Attestation Execution: Perform verification using selected nodes
  4. Status Polling: Continuously check task status and results
  5. Balance Withdrawal: Claim rewards from the contract

Installation

npm install @primuslabs/network-js-sdk
# or
yarn add @primuslabs/network-js-sdk

Getting Started

1. Initialize the SDK

import { PrimusNetwork } from 'primus-network-sdk';
import { ethers } from 'ethers';

// Create provider (Metamask, WalletConnect, or custom node)
const provider = new ethers.providers.Web3Provider(window.ethereum);
const primusNetwork = new PrimusNetwork();

async function initializeSdk() {
  try {
    const chainId = 84532; // Base Sepolia example
    await primusNetwork.init(provider, chainId);
    console.log('SDK initialized successfully');
  } catch (error) {
    console.error('Initialization failed:', error);
  }
}

initializeSdk();

2. Submit Tasks

async function submitTask() {
  try {
    const params = {
      templateId: 'your_template_id', // Task template identifier
      address: '0x...', // User address
    };
    
    const result = await primusNetwork.submitTask(params);
    console.log('Task submitted:', result);
    // Result includes taskId, taskTxHash for subsequent operations
  } catch (error) {
    console.error('Submission failed:', error);
  }
}

3. Perform Attestation

async function attestTask(taskInfo: any) {
  try {
    const params = {
      templateId: 'your_template_id', // Task template identifier
      address: '0x...', // User address
      taskId: taskInfo.taskId,
      taskTxHash: taskInfo.taskTxHash,
      attestors: taskInfo.taskAttestors,
      // Additional attestation parameters...
    }; // Using taskId/taskTxHash/attestors from submitTask response
    
    const results = await primusNetwork.attest(params);
    console.log('Attestation results:', results);
  } catch (error) {
    console.error('Attestation failed:', error);
  }
}

4. Check Task Detail

async function monitorTask(taskId: string) {
  try {
    const taskDetailResult = await primusNetwork.pollTaskDetail({
      taskId,
    });
    
    console.log('TaskDetailResult :', taskDetailResult);
    // Process results...
  } catch (error) {
    console.error('Polling failed:', error);
  }
}

5. Withdraw Funds

async function withdrawRewards() {
  try {
    const settledTasks = await primusNetwork.withdrawBalance();
    console.log('Withdrawal successful. Settled tasks:', settledTasks);
  } catch (error) {
    console.error('Withdrawal failed:', error);
  }
}

Complete Example

import { PrimusNetwork } from 'primus-network-sdk';
import { ethers } from 'ethers';

async function main() {
  const provider = new ethers.providers.Web3Provider(window.ethereum);
  const primusNetwork = new PrimusNetwork();
  
  try {
    // Initialize
    await primusNetwork.init(provider, 84532); // Base Sepolia
    console.log('SDK initialized');
    
    // Submit task
    const submitTaskResult = await primusNetwork.submitTask({
      templateId: 'template_123',
      address: '0x...'
    });
    console.log('Task submitted:', submitTaskResult);
    
    // Perform attestation
    const attestResult = await primusNetwork.attest({
      templateId: 'template_123',
      address: '0x...',
      taskId: submitTaskResult.taskId,
      taskTxHash: submitTaskResult.taskTxHash,
      attestors: submitTaskResult.taskAttestors
    });
    console.log('Attestation completed:', submitTaskResult);
    
    // Check task detail
    const taskDetailResult = await primusNetwork.pollTaskDetail({
      taskId: submitTaskResult.taskId,
    });
    console.log('Final result:', taskDetailResult);
    
    // Optional withdrawal
    // const settled = await primusNetwork.withdrawBalance();
    // console.log('Withdrawn:', settled);
    
  } catch (error) {
    console.error('Main flow error:', error);
  }
}

main();

Important Notes

  1. Verify chainId is supported by checking SUPPORTEDCHAINIDS
  2. Initialize SDK before submitting tasks
  3. Set appropriate timeouts for attestation operations
  4. Implement comprehensive error handling

Supported Networks

Check SUPPORTEDCHAINIDS for available networks:

  • 1: Base Mainnet