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

triwebapi

v1.0.6

Published

This is official package of Triweb Genesis Private Limited

Readme

TriwebAPI Integration Guide

Backend Integration

Add triwebapi to your project dependencies

With Yarn

yarn add triwebapi

or with NPM

npm install triwebapi

import TriwebServer

With JavaScript

const { TriwebServer } = require('triwebapi');

or with TypeScript

import { TriwebServer } from 'triwebapi';

Use the projectId, triwebKey and triwebSecret you get from triwebapi.com to create TriwebServer object

const triwebServer = new TriwebServer(projectId, triwebKey, triwebSecret);

Create a route for your client app and serve the below auth token for integration with TriwebAPI

const triwebAuthToken = await triweb.getAuthenticationToken();

Example

const { TriwebServer } = require('triwebapi');

const projectId = process.env.TRIWEB_PROJECT_ID;
const triwebKey = process.env.TRIWEB_KEY;
const triwebSecret = process.env.TRIWEB_SECRET;
const triwebServer = new TriwebServer(projectId, triwebKey, triwebSecret);

app.post('/gettokenfromownclient', async (req, res) => {
  const triwebAuthToken = await triweb.getAuthenticationToken();
  res.send({ status: 'success', triwebAuthToken });
});

Client Integration

Add triwebapi to your project dependencies

With Yarn

yarn add triwebapi

or with NPM

npm install triwebapi

import TriwebClient and other required constants and enums Doc

With JavaScript

const { TriwebClient, CONTRACT, ENVIRONMENT, FUNCTION, NETWORK, EVENTS } = require('triwebapi');

or with TypeScript

import { TriwebClient, CONTRACT, ENVIRONMENT, FUNCTION, NETWORK, EVENTS } from 'triwebapi';

Create object of Triweb client by passing the blockchain environment and triweb Authentication token(For authentication token see TriwebServer)

const triwebClient = new TriwebClient(ENVIRONMENT.EVM, 'Triweb Token from own Backend');

To call a method to execute any function of any contract Docs

const response = await triwebClient.execute(FUNCTION.AIRDROP_BULKAIRDROPERC20, data, CONTRACT.AIRDROP, NETWORK.POLYGON);

To call a method to read data from contract Docs

Example
const data = await triwebClient.read(
  FUNCTION.PIGGY_BANK_GETBALANCE,
  {
    address: '0xe756ed2510d30911d5B9Ab4BeC5f89A4536D2111',
  },
  CONTRACT.PIGGY_BANK,
  NETWORK.POLYGON,
);

Subscribe for events and stay tuned

You can subscribe for

  • Success : At then end of successful process finish, it will give you response with status.
triwebClient.subscribe(EVENTS.TRIWEB_SUCCESS, successHandler);
  • Error: In case of Error in processing, it will give you response with status.
triwebClient.subscribe(EVENTS.TRIWEB_ERROR, errorHandler);
  • Process: It will help you in tracking the whole process and you can share the alerts with your user
triwebClient.subscribe(EVENTS.TRIWEB_PROCESS_ALERT, processHandler);
  • The event will send data in below format
{
  message: 'Step related message...',
  currentStep: '1',
  totalSteps: '10',
  isImportantStep: false, // If you dont want to show all the messages then it is recommended to show messages with isImportantStep:true
  isFinalStep: false,// If it is last step then this flag will be true
}

To set a default environment for Triweb Client

triwebClient.setEnvironment(ENUMS.ENVIRONMENT.EVM);

To change Triweb Authentication token anytime during the process, you can get it from your backend and do like below

triwebClient.setAuthenticationToken(jwt);

To switch between network types (i.e. Testnet and Mainnet)

To switch to Testnet

triwebClient.enableTestnet();

To switch to Mainnet

triwebClient.enableMainnet();