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

@octoclaw/tonguard

v1.0.0

Published

Security layer for AI agent TON transactions — confirmation codes, spending limits, cooldowns

Readme

@octoclaw/tonguard

Security layer for AI agent TON transactions. Confirmation codes, spending limits, cooldowns — works with any framework.

Install

npm install @octoclaw/tonguard

Quick Start

import { TonGuard } from '@octoclaw/tonguard';

const guard = new TonGuard({
  dailyLimitTon: 10,       // max 10 TON per day per user
  autoConfirmBelow: 0.1,   // auto-approve below 0.1 TON
  cooldownMs: 30_000,      // 30s between transactions
});

// Agent wants to send TON → ask the guard
const result = guard.gate('user-123', 5.0, 'EQxyz...', 'Payment');

if (result.status === 'pending') {
  console.log(`Confirm code: ${result.code}`);  // e.g. "A7K2X9"
  // Show to user, wait for confirmation
}

if (result.status === 'approved') {
  // Small amount, auto-confirmed — proceed with transaction
}

if (result.status === 'rejected') {
  console.log(result.reason);  // "Daily limit exceeded"
}

// User confirms
const confirm = guard.confirm('user-123', 'A7K2X9');
if (confirm.status === 'approved') {
  // Execute the TON transaction
}

LangChain / LangGraph

import { TonGuard, createLangChainTools } from '@octoclaw/tonguard';

const guard = new TonGuard({ dailyLimitTon: 10 });
const tools = createLangChainTools(guard, 'user-123');

// Use with LangGraph
import { createReactAgent } from '@langchain/langgraph/prebuilt';
const agent = createReactAgent({ llm, tools });

Framework-Agnostic Tools

import { TonGuard, createTonGuardTools } from '@octoclaw/tonguard';

const guard = new TonGuard();
const tools = createTonGuardTools(guard, 'user-123');

// Each tool has: { name, description, parameters, execute }
// Works with CrewAI, AutoGen, or any custom agent
for (const tool of tools) {
  console.log(tool.name, tool.description);
}

API

new TonGuard(config?)

| Option | Type | Default | Description | |--------|------|---------|-------------| | dailyLimitTon | number | 10 | Max TON per 24h per user | | perTxLimitTon | number | 5 | Max per transaction | | autoConfirmBelow | number | 0.1 | Auto-approve threshold | | cooldownMs | number | 30000 | Min ms between transactions | | codeExpiryMs | number | 300000 | Code TTL (5 min) | | store | TonGuardStore | MemoryStore | Custom storage backend |

guard.gate(userId, amount, toAddress?, comment?)

Returns { status, code?, expiresAt?, reason?, amount }:

  • approved — auto-confirmed (below threshold)
  • pending — code generated, needs user confirmation
  • rejected — policy violation (limit/cooldown)

guard.confirm(userId, code)

Returns { status, amount?, userId? }:

  • approved — transaction confirmed
  • expired — code expired
  • invalid — code not found

guard.reject(userId, code)

Cancel a pending transaction. Returns true if found.

guard.getStats(userId)

Returns spending stats: { spentToday, remainingToday, txCountToday, canTransact, cooldownEndsAt }.

Security Properties

  • Codes: 6-char from crypto.randomBytes, no ambiguous chars (0/O/1/I)
  • TTL: 5 minutes, enforced server-side
  • One-time use: deleted after confirm or expiry
  • Per-user isolation: codes scoped to userId
  • LLM cannot bypass: codes generated outside LLM context

Custom Store

Implement TonGuardStore interface for Redis, database, etc:

import { TonGuard, TonGuardStore } from '@octoclaw/tonguard';

class RedisStore implements TonGuardStore {
  // implement: getPending, setPending, deletePending, etc.
}

const guard = new TonGuard({ store: new RedisStore() });

License

MIT — OctoClaw