The Radius Wallet package provides a simple, unified interface for interacting with Radius from AI agents. It offers high-performance wallet operations and tool-based interactions that integrate seamlessly with AI agent frameworks.
This package is part of the Radius AI Agent Toolkit, which provides tools for integrating AI agents with the Radius platform.
# Install this specific package
npm install @radiustechsystems/ai-agent-wallet
# Required peer dependencies
npm install @radiustechsystems/ai-agent-core
- Node.js >=20.12.2 <23
- Access to a Radius RPC endpoint
- A funded private key for the Radius network
import { createRadiusWallet, sendETH } 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
});
// Get wallet address
const address = await wallet.getAddress();
console.log(`Wallet address: ${address}`);
// Check wallet balance using balanceOf method
const balance = await wallet.balanceOf(address);
console.log(`Balance: ${balance.value} ${balance.symbol}`);
// Create sendETH plugin
const sendEthPlugin = sendETH();
// Get the tools provided by the plugin
const tools = sendEthPlugin.getTools(wallet);
// Or create tools for AI agents with the adapter
const aiTools = await getOnChainTools({
wallet,
plugins: [sendETH()] // Enable ETH transfers
});
Creates a new Radius wallet instance.
Parameters:
-
options.rpcUrl
(string): URL of the Radius RPC endpoint -
options.privateKey
(string): Private key for the wallet -
enableBatch
(boolean, optional): Whether to enable batch transactions -
logger
(function, optional): Custom logger function
Returns:
- A RadiusWalletInterface instance that can be used with AI agent tools
Creates a plugin that enables ETH transfer functionality for AI agents.
Returns:
- A plugin that can be used with the
getOnChainTools
function
Returns the wallet's address.
Returns the balance info for the specified address, including value, symbol, and other details.
Sends a transaction to the network.
Sends multiple transactions as a batch (if batch mode is enabled).
// Create a wallet with batch transaction support
const wallet = await createRadiusWallet(
{
rpcUrl: process.env.RPC_PROVIDER_URL,
privateKey: process.env.WALLET_PRIVATE_KEY
},
true // Enable batch transactions
);
// Send a batch of transactions
const result = await wallet.sendBatchOfTransactions([
{ to: "0x123...", value: parseEther("0.1") },
{ to: "0x456...", value: parseEther("0.2") }
]);
// Read from a contract
const result = await wallet.read({
address: "0xContractAddress",
functionName: "balanceOf",
args: ["0xUserAddress"],
abi: [...] // Contract ABI
});
// Write to a contract
const tx = await wallet.sendTransaction({
to: "0xContractAddress",
functionName: "transfer",
args: ["0xRecipient", parseEther("1.0")],
abi: [...] // Contract ABI
});
For a complete example integrating this package with AI frameworks, see:
- @radiustechsystems/ai-agent-core: Core abstractions and base classes
- @radiustechsystems/ai-agent-plugin-erc20: ERC20 token operations
- @radiustechsystems/ai-agent-plugin-contracts: Smart contract interactions
Please see the Contributing Guide for detailed information about contributing to this toolkit.
This project is licensed under the MIT License.