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

agent-treasury

v0.1.0

Published

Treasury management utilities for AI agents. Track balances, detect idle USDC, compare DeFi yields, and activate autonomous earning.

Readme

agent-treasury

Treasury management utilities for AI agents.

Your agent earns USDC. It sits idle. You earn 0%.

agent-treasury fixes that. Track balances across chains, compare DeFi yields in real time, get alerts when funds go idle, and activate earning with one call.

Install

npm install agent-treasury ethers

Quick Start

import { AgentTreasury } from "agent-treasury";

const treasury = new AgentTreasury();
const report = await treasury.report("0xYourAgentWallet");
console.log(report.recommendation);
// → "500.00 USDC is idle. Best yield: 4.2% APY (~$21.00/year). Consider activating yield."

Features

Balance Tracker

Check USDC balances across Base, Ethereum, Arbitrum, and Optimism in a single call.

const balances = await treasury.getBalances("0x...");
console.log(balances.totalFormatted); // "1250.00"
console.log(balances.balances);       // per-chain breakdown

Yield Finder

Compare live supply APY across Aave V3, Compound V3, and Morpho on Base.

const yields = await treasury.compareYields();
console.log(yields.best);
// → { protocol: "aave-v3", supplyAPY: 4.2, asset: "USDC", chain: "base" }

Idle Balance Detection

Get alerted when USDC sits idle too long.

// One-time check
const idle = await treasury.getIdleBalance("0x...");

// Continuous monitoring
treasury.watchIdle("0x...", (alert) => {
  console.log(`${alert.totalIdleFormatted} USDC idle for ${alert.idleDurationHuman}`);
});

Configure thresholds:

const treasury = new AgentTreasury({
  idleThresholdUsdc: 50,          // Alert when > 50 USDC
  idleTimeMs: 30 * 60 * 1000,    // idle for > 30 minutes
});

Activate Yield

Put idle USDC to work with one call.

import { ClicksActivator } from "agent-treasury";

const clicks = new ClicksActivator();
const result = await clicks.deposit(signer, "500.00");
// → Deposits 500 USDC into optimized yield strategy

Full Report

Get a complete treasury overview: balances, yields, idle status, and recommendations.

const report = await treasury.report("0x...");
// {
//   balances: { totalFormatted: "500.00", ... },
//   yields: { best: { protocol: "aave-v3", supplyAPY: 4.2 }, ... },
//   idleStatus: { idleDurationHuman: "3d 2h", ... },
//   recommendation: "500.00 USDC is idle. Best yield: 4.2% APY..."
// }

Configuration

const treasury = new AgentTreasury({
  // Custom RPC endpoints
  rpcs: {
    base: "https://your-base-rpc.com",
    ethereum: "https://your-eth-rpc.com",
  },
  // Track specific chains only
  chains: ["base", "ethereum"],
  // Yield protocols to compare
  protocols: ["aave-v3", "compound-v3"],
  // Idle detection settings
  idleThresholdUsdc: 100,
  idleTimeMs: 60 * 60 * 1000,
});

API

| Method | Description | |--------|-------------| | getBalances(address) | Multi-chain USDC balances | | compareYields() | Compare DeFi APYs on Base | | getBestYield() | Get highest current APY | | getIdleBalance(address) | Check if balance is idle | | watchIdle(address, callback) | Monitor for idle balances | | unwatchIdle(address) | Stop monitoring | | report(address) | Full treasury report |

How It Works

  1. Balance Tracker reads USDC balances via public RPC on Base, Ethereum, Arbitrum, and Optimism
  2. Yield Finder queries Aave V3 and Compound V3 smart contracts on Base for current supply rates
  3. Idle Detector compares balance snapshots over time to detect stagnant funds
  4. Activate (optional) connects to Clicks Protocol to deposit idle USDC into yield strategies

Balance tracking and yield comparison work entirely standalone. The Clicks integration is an optional feature for agents that want automated yield activation.

License

MIT


Powered by Clicks Protocol