Skip to main content

Radius AI Agent SDK EVM wallet implementation

Project description

Radius AI Agent Toolkit - EVM Wallet

The Radius EVM 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.

Installation

# Install this specific package
pip install radius-ai-agent-sdk-wallet-evm

# Required dependencies
pip install radius-ai-agent-sdk

Prerequisites

  • Python >=3.10
  • Access to a Radius RPC endpoint
  • A funded private key for the Radius network

Usage

from radius_wallets.evm import create_radius_wallet, send_eth
from radius_adapters.langchain import get_on_chain_tools

# Create a Radius wallet
wallet = create_radius_wallet(
    rpc_url=os.environ.get("RPC_PROVIDER_URL"),
    private_key=os.environ.get("WALLET_PRIVATE_KEY")
)

# Get wallet address
address = wallet.get_address()
print(f"Wallet address: {address}")

# Check wallet balance using balance_of method
balance = wallet.balance_of(address)
print(f"Balance: {balance['value']} {balance['symbol']}")

# Create sendETH plugin
send_eth_plugin = send_eth()

# Get the tools provided by the plugin
tools = send_eth_plugin.get_tools(wallet)

# Or create tools for AI agents with the adapter
ai_tools = get_on_chain_tools(
    wallet=wallet,
    plugins=[send_eth()]  # Enable ETH transfers
)

API Reference

create_radius_wallet(rpc_url, private_key, enable_batch=False, logger=None)

Creates a new Radius wallet instance.

Parameters:

  • rpc_url (str): URL of the Radius RPC endpoint
  • private_key (str): Private key for the wallet
  • enable_batch (bool, optional): Whether to enable batch transactions
  • logger (callable, optional): Custom logger function

Returns:

  • An EVMWalletClient instance that can be used with AI agent tools

send_eth()

Creates a plugin that enables ETH transfer functionality for AI agents.

Returns:

  • A plugin that can be used with the get_on_chain_tools function

Wallet Methods

wallet.get_address()

Returns the wallet's address.

wallet.balance_of(address)

Returns the balance info for the specified address, including value, symbol, and other details.

wallet.send_transaction(tx)

Sends a transaction to the network.

wallet.send_batch_of_transactions(txs)

Sends multiple transactions as a batch (if batch mode is enabled).

Advanced Usage

Batch Transactions

# Create a wallet with batch transaction support
wallet = create_radius_wallet(
    rpc_url=os.environ.get("RPC_PROVIDER_URL"),
    private_key=os.environ.get("WALLET_PRIVATE_KEY"),
    enable_batch=True  # Enable batch transactions
)

# Send a batch of transactions
result = wallet.send_batch_of_transactions([
    {"to": "0x123...", "value": 100000000000000000},  # 0.1 ETH in wei
    {"to": "0x456...", "value": 200000000000000000}   # 0.2 ETH in wei
])

Smart Contract Interactions

# Read from a contract
result = wallet.read({
    "address": "0xContractAddress",
    "functionName": "balanceOf",
    "args": ["0xUserAddress"],
    "abi": [...]  # Contract ABI
})

# Write to a contract
tx = wallet.send_transaction({
    "to": "0xContractAddress",
    "functionName": "transfer",
    "args": ["0xRecipient", 1000000000000000000],  # 1.0 ETH in wei
    "abi": [...]  # Contract ABI
})

Integration Examples

For examples integrating this package with AI frameworks, see:

Related Packages

Development Setup

1. Clone the Repository

git clone git@github.com:radiustechsystems/ai-agent-toolkit.git
cd ai-agent-toolkit/python/src/wallets/evm

2. Install Development Dependencies

pip install -e ".[dev]"

3. Build the Package

pip install build
python -m build

Testing

Run tests with pytest:

pytest

Resources

Contributing

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

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

radius_ai_agent_sdk_wallet_evm-1.0.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file radius_ai_agent_sdk_wallet_evm-1.0.0.tar.gz.

File metadata

File hashes

Hashes for radius_ai_agent_sdk_wallet_evm-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a7aa0a77fbd14f24a4aa49b2a908da105f9494f50340a8f6833aa09d1e171675
MD5 247cf87291b3f006853c126366736a8b
BLAKE2b-256 7cb93cf5a000b4681af12a37204d577b9d983b040430a83948635ea5cfc91871

See more details on using hashes here.

File details

Details for the file radius_ai_agent_sdk_wallet_evm-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for radius_ai_agent_sdk_wallet_evm-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b4e52febf618821b2bcd743790ce746f5ee0eeb26ad9602dc857a265c9514353
MD5 d1a9b4bdbaa421f74a7821540bfa6bc1
BLAKE2b-256 16d03acdd5e4eb905a24941f114882bdca7400506fea2a440bfed8f8f9cff8a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page