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

@t402/tron

v2.7.1

Published

t402 Payment Protocol TRON Implementation

Readme

@t402/tron

TRON blockchain implementation of the t402 payment protocol using the Exact payment scheme with TRC-20 token transfers.

Installation

npm install @t402/tron

Overview

This package provides three main components for handling t402 payments on TRON:

  • Client - For applications that need to make payments (sign TRC-20 transfers)
  • Server - For resource servers that accept payments and build payment requirements
  • Facilitator - For payment processors that verify signatures and execute on-chain settlements

Quick Start

Client

import { ExactTronClient } from '@t402/tron/exact/client'

const client = new ExactTronClient(signer)
const payload = await client.createPaymentPayload(requirements)

Server

import { ExactTronServer } from '@t402/tron/exact/server'
import { t402ResourceServer } from '@t402/express'
import { HTTPFacilitatorClient } from '@t402/core/server'

const facilitator = new HTTPFacilitatorClient({ url: 'https://facilitator.t402.io' })
const resourceServer = new t402ResourceServer(facilitator).register(
  'tron:mainnet',
  new ExactTronServer(),
)

Facilitator

import { ExactTronFacilitator } from '@t402/tron/exact/facilitator'

const facilitator = new ExactTronFacilitator(signer)

Package Exports

Main Package (@t402/tron)

All constants, types, utilities, token registry, and scheme classes.

Subpath Exports

  • @t402/tron/exact/client - Client-only imports
  • @t402/tron/exact/server - Server-only imports
  • @t402/tron/exact/facilitator - Facilitator-only imports

Supported Networks

| Network | CAIP-2 Identifier | | ------------------- | ----------------- | | TRON Mainnet | tron:mainnet | | TRON Nile Testnet | tron:nile | | TRON Shasta Testnet | tron:shasta |

Supported Assets

| Token | Network | Contract Address | | ----- | ------- | ------------------------------------ | | USDT | Mainnet | TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t | | USDT | Nile | TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf |

Token Utilities

import {
  getDefaultToken,
  getTRC20Config,
  getNetworkTokens,
  getSupportedNetworks,
  isNetworkSupported,
} from '@t402/tron'

// Check if a network is supported
isNetworkSupported('tron:mainnet') // true

// Get USDT config for mainnet
const config = getTRC20Config('tron:mainnet', 'USDT')

// Get all supported networks
const networks = getSupportedNetworks()

Address & Amount Utilities

import {
  validateTronAddress,
  convertToSmallestUnits,
  convertFromSmallestUnits,
  estimateTransactionFee,
  formatAddress,
} from '@t402/tron'

// Validate TRON address (base58check T-prefix)
validateTronAddress('TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t') // true

// Convert amounts (6 decimals for USDT)
convertToSmallestUnits('1.5', 6) // 1500000n
convertFromSmallestUnits(1500000n, 6) // "1.5"

Security

  • Client signs TRC-20 transfer transactions using ECDSA (secp256k1)
  • Replay protection via Protobuf nonce and expiration
  • Facilitator verifies signatures before broadcasting to TRON network

Development

pnpm build    # Build the package
pnpm test     # Run unit tests
pnpm test:integration  # Run integration tests

Related Packages

  • @t402/core - Core protocol types and client
  • @t402/fetch - HTTP wrapper with automatic payment handling
  • @t402/evm - EVM implementation
  • @t402/svm - Solana implementation
  • @t402/ton - TON implementation
  • @t402/near - NEAR Protocol implementation
  • @t402/aptos - Aptos implementation
  • @t402/tezos - Tezos implementation
  • @t402/polkadot - Polkadot Asset Hub implementation
  • @t402/stacks - Stacks implementation
  • @t402/cosmos - Cosmos (Noble) implementation