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

agentwallet-langchain

v1.0.1

Published

Non-custodial wallet toolkit for LangChain agents — EVM + Solana, spend limits, x402 payments, CCTP bridge

Readme

agentwallet-langchain

A LangChain toolkit that gives agents a non-custodial wallet. Five StructuredTools for checking balances, sending tokens, swapping, bridging cross-chain, and paying x402 endpoints — all backed by agentwallet-sdk.

Works with LangGraph out of the box. No Coinbase CDP required.

Install

npm install agentwallet-langchain agentwallet-sdk @langchain/core

Quick start

import { AgentWalletToolkit } from "agentwallet-langchain";
import { createReactAgent } from "@langchain/langgraph/prebuilt";
import { ChatOpenAI } from "@langchain/openai";

const toolkit = new AgentWalletToolkit({
  privateKey: process.env.AGENT_PRIVATE_KEY!,
  accountAddress: "0x...",  // your deployed AgentAccountV2 contract
  chain: "base",
});

const agent = createReactAgent({
  llm: new ChatOpenAI({ model: "gpt-4o" }),
  tools: toolkit.getTools(),
});

const result = await agent.invoke({
  messages: [{ role: "user", content: "Check my USDC balance and send 5 USDC to 0x..." }],
});

Tools

| Tool name | What it does | |-----------|-------------| | agent_wallet_balance | Check remaining autonomous spend budget (per-tx and period limits) | | agent_wallet_transfer | Send ERC-20 or native ETH — queues for owner approval if over limit | | agent_wallet_swap | Swap tokens via SmartSwapRouter (Uniswap V3 routing on Base) | | agent_wallet_bridge | Move USDC cross-chain via CCTP V2 (17 chains, 2–20 min finality) | | agent_wallet_x402_pay | Pay HTTP 402 endpoints via x402 micropayments |

Using individual tools

You can import tools directly if you only need some of them:

import {
  AgentWalletBalanceTool,
  AgentWalletTransferTool,
  AgentWalletX402Tool,
} from "agentwallet-langchain";

Each tool takes a WalletContext from the toolkit. Use AgentWalletToolkit to create it, then extract the tools you need:

const toolkit = new AgentWalletToolkit({ privateKey, accountAddress, chain: "base" });
const [balance, transfer, , , x402] = toolkit.getTools();

Spend limits

The smart contract enforces spend limits at the EVM level — not just in software. If an agent tries to spend more than the configured per-tx or period cap, the transaction gets queued for owner approval instead of reverting.

The agent_wallet_transfer tool tells the agent clearly when a transaction was queued vs executed, so it can communicate this back to the user:

{ "status": "queued", "message": "Transfer exceeded spend limit and is queued for owner approval.", "txHash": "0x..." }

Supported chains

| Chain | ID | Support | |-------|----|---------| | Base | 8453 | Full (swap + bridge + x402) | | Ethereum | 1 | Full | | Arbitrum | 42161 | Full | | Optimism | 10 | Full | | Polygon | 137 | Full | | Base Sepolia | 84532 | Testnet | | Solana | — | Bridge only (via CCTP V2) |

Config

interface AgentWalletToolkitConfig {
  privateKey: string;       // Agent's 0x-prefixed private key
  accountAddress: string;   // Deployed AgentAccountV2 contract address
  chain?: string;           // Default: "base"
  rpcUrl?: string;          // Custom RPC (optional)
  tokenMap?: Record<string, `0x${string}`>;  // Custom token symbols
}

LangGraph example

import { StateGraph, MessagesAnnotation } from "@langchain/langgraph";
import { ToolNode } from "@langchain/langgraph/prebuilt";
import { AgentWalletToolkit } from "agentwallet-langchain";

const toolkit = new AgentWalletToolkit({ privateKey, accountAddress, chain: "base" });
const tools = toolkit.getTools();
const toolNode = new ToolNode(tools);

const graph = new StateGraph(MessagesAnnotation)
  .addNode("agent", callModel)
  .addNode("tools", toolNode)
  .addEdge("__start__", "agent")
  .addConditionalEdges("agent", shouldContinue)
  .addEdge("tools", "agent");

Running tests

npm install
npm test

Tests use mocked SDK and viem calls — no live RPC needed.

Related

License

MIT