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

@bankofai/x402-tron-extensions

v2.1.2

Published

TRON resource-sponsoring extensions for official x402 Core

Readme

@bankofai/x402-tron-extensions

Independent TRON resource sponsorship extension for official @x402/[email protected]. Install the same version as @bankofai/x402-tron. For upgrading from 2.0, see the migration guide.

The Core 2.29.0 peer update on this branch is unreleased. Build this package and the matching mechanism in the repository workspace until the next BOA release. Published TRON extensions 2.1.0 still require Core 2.28.0.

The mechanism maintains payment schemes, public contracts, and transaction utilities. The extension maintains declarations/schemas, client pre-signing, Approval transaction validation, resource budgets, energy/bandwidth delegation, reclamation, and the coordinator runtime. Basic payments require neither this package nor an Agent Wallet installation.

Client registration

import { x402Client } from "@x402/core/client";
import { ExactTronScheme } from "@bankofai/x402-tron/exact/client";
import { createClientTronSigner } from "@bankofai/x402-tron";
import { createTrc20ApprovalResourceSponsoringClientExtension } from "@bankofai/x402-tron-extensions";

const signer = await createClientTronSigner(wallet, { network: "tron:3448148188", rpcUrl });
const client = new x402Client()
  .register("tron:3448148188", new ExactTronScheme(signer))
  .registerExtension(createTrc20ApprovalResourceSponsoringClientExtension(signer));

The resource server declares the extension with declareTrc20ApprovalResourceSponsoringExtension(). The facilitator registers full capability with createTrc20ApprovalResourceSponsoringExtension(runtime); manually registering only { key, runtime } is insufficient. Create the runtime through createTrc20ResourceSponsoringRuntime({ network, resourceOwnerSigner, coordinator, allowedAssets, permissionId, ... }) or inject an implementation satisfying the interface. Applications supply Resource Owner signer bridging, providers, and persistent storage.

The client before hook validates declaration version and network. The mechanism creates the final authorization, and the extension uses its actual amount (the actual deposit for batch) to decide whether to pre-sign. When existing allowance or self-funded fallback succeeds, the final hook removes unused resource declarations. Declaration objects are not mutated; reused and concurrent calls remain isolated. Without client extension registration, official Core composition returns trc20_approval_client_extension_not_registered. Missing facilitator execution capability returns sponsor_runtime_unavailable.

Public entrypoints

This package exposes its root and trc20-approval-resource-sponsoring, plus client, facilitator, and resourceService beneath that subpath. All entrypoints support ESM/CJS.

Use official @x402/[email protected] for Bazaar, Sign-in-with-x, EVM gas sponsorship, and other upstream extensions.

Testing

pnpm --filter @bankofai/x402-tron build
pnpm --filter @bankofai/x402-tron-extensions build
pnpm --filter @bankofai/x402-tron-extensions test
pnpm --filter @bankofai/x402-tron-extensions test:consumer

Independent consumer validation uses both tarballs, official Core, and strict NodeNext (skipLibCheck: false) to test real Approval signatures, extension registration, and ordinary payments in ESM/CJS. Isolated tests also cover permissions, budgets, failure reclamation, pending retention, and real Agent Wallet signing.

Runtime recovery

Production must supply a persistent coordinator and continuously call runtime.reconcile() for reconciliation/recovery. The example InMemoryTrc20SponsoringCoordinator is for single-process validation only. When resource operations, Approval, or payment outcomes are unknown, reconcile the original txID and retain the corresponding records and resources to avoid duplicate broadcast or sponsorship.