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

@radiustechsystems/ai-agent-plugin-uniswap

v1.0.4

Published

Uniswap integration plugin for the Radius AI Agent Toolkit

Readme

Radius AI Agent Toolkit - Uniswap Plugin

This plugin enables AI agents to interact with the Uniswap protocol on Radius, allowing them to get token quotes and perform token swaps.

This package is part of the Radius AI Agent Toolkit, which provides tools for integrating AI agents with the Radius platform.

Installation

# Install this specific package
npm install @radiustechsystems/ai-agent-plugin-uniswap

# Required peer dependencies
npm install @radiustechsystems/ai-agent-core
npm install @radiustechsystems/ai-agent-wallet

Prerequisites

  • Node.js >=20.12.2 <23
  • Uniswap API key - Get it from: Uniswap Hub
  • Radius wallet setup with a funded account

Configuration

Required environment variables:

  • UNISWAP_API_KEY: Your Uniswap API key
    • Format: 32-character string
    • Required for: Accessing Uniswap's API for quotes and swaps
  • UNISWAP_BASE_URL: Uniswap API base URL
    • Format: Full URL with protocol and version
    • Default: https://api.uniswap.org/v1

Usage

import { uniswap } from "@radiustechsystems/ai-agent-plugin-uniswap";
import { createRadiusWallet } from "@radiustechsystems/ai-agent-wallet";
import { getOnChainTools } from "@radiustechsystems/ai-agent-adapter-vercel-ai";

// Create a Radius wallet
const wallet = await createRadiusWallet({
  rpcUrl: process.env.RPC_PROVIDER_URL,
  privateKey: process.env.WALLET_PRIVATE_KEY
});

// Initialize the Uniswap plugin
const uniswapPlugin = uniswap({
  baseUrl: process.env.UNISWAP_BASE_URL,
  apiKey: process.env.UNISWAP_API_KEY
});

// Create AI agent tools with the Uniswap plugin
const tools = await getOnChainTools({
  wallet,
  plugins: [uniswapPlugin]
});

API Reference

uniswap(config)

Creates a new Uniswap plugin instance.

Parameters:

  • config.baseUrl (string): Uniswap API base URL
  • config.apiKey (string): Your Uniswap API key

Returns:

  • A UniswapPlugin instance that can be used with AI agent frameworks

Provided Tools

The Uniswap plugin provides the following AI agent tools:

uniswap_check_approval

Checks if a wallet has enough token approval for a swap.

Parameters:

  • token (string): The token address to check approval for
  • amount (string): The amount to approve
  • walletAddress (string, optional): The wallet address to check (defaults to connected wallet)

Example:

try {
  const approvalStatus = await checkApprovalTool.execute({
    token: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
    amount: "1000000", // 1 USDC (6 decimals)
    walletAddress: "0xefbf7a6fa61a1602eb7630c92e79e5b6e63909e1"
  });
  
  console.log("Approval status:", approvalStatus);
  // { needsApproval: true, currentAllowance: "0", requiredApproval: "1000000" }
} catch (error) {
  console.error(`Approval check failed: ${error.message}`);
}

uniswap_get_quote

Gets a quote for swapping tokens.

Parameters:

  • tokenIn (string): The address of the input token
  • tokenOut (string): The address of the output token
  • amount (string): The amount of tokenIn to swap
  • type (string): The type of swap ("EXACT_INPUT" or "EXACT_OUTPUT")
  • protocols (string[]): The protocols to use for the swap (e.g., ["V3"])

Example:

try {
  const quoteParams = {
    tokenIn: "0x9aeEa4f3025940dBdbf6863C7e16a23Ea95272a4", // RADUSD
    tokenOut: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
    amount: "1000000000000000000", // 1 RADUSD (18 decimals)
    type: "EXACT_INPUT",
    protocols: ["V3"]
  };
  
  const quote = await getQuoteTool.execute(quoteParams);
  console.log("Swap quote result:", quote);
  // { amountOut: "1800.25", estimatedGas: "150000", ... }
} catch (error) {
  console.error(`Getting quote failed: ${error.message}`);
}

uniswap_swap_tokens

Executes a token swap on Uniswap.

Parameters:

  • tokenIn (string): The address of the input token
  • tokenOut (string): The address of the output token
  • amount (string): The amount of tokenIn to swap
  • type (string): The type of swap ("EXACT_INPUT" or "EXACT_OUTPUT")
  • protocols (string[]): The protocols to use for the swap (e.g., ["V3"])
  • slippageTolerance (number, optional): The maximum slippage allowed (default: 0.5)

Example:

try {
  const swapParams = {
    tokenIn: "0x9aeEa4f3025940dBdbf6863C7e16a23Ea95272a4", // RADUSD
    tokenOut: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
    amount: "1000000000000000000", // 1 RADUSD (18 decimals)
    type: "EXACT_INPUT",
    protocols: ["V3"],
    slippageTolerance: 0.5
  };
  
  const swapResult = await swapTokensTool.execute(swapParams);
  console.log("Swap transaction:", swapResult);
  // { hash: "0x...", confirmations: 1, ... }
} catch (error) {
  console.error(`Swap failed: ${error.message}`);
}

Note on Tool Naming: The Uniswap plugin explicitly prefixes its tool names with uniswap_ in the implementation, which is consistent with the final available tool names.

Integration Examples

For a complete example integrating this plugin with the Vercel AI SDK, see:

Related Packages

Resources

Contributing

Please see the Contributing Guide for detailed information about contributing to this toolkit.

License

This project is licensed under the MIT License.