Skip to main content

riglr_evm_tools/
lib.rs

1//! # riglr-evm-tools
2//!
3//! A comprehensive suite of tools for interacting with EVM-compatible blockchains.
4//!
5//! This crate provides ready-to-use tools for building EVM-native AI agents, including:
6//!
7//! - **Balance Tools**: Check ETH and ERC20 token balances
8//! - **Transaction Tools**: Send ETH and token transfers
9//! - **DeFi Tools**: Interact with Uniswap, Sushiswap, and other DEXs
10//! - **Contract Tools**: Deploy and interact with smart contracts
11//! - **Network Tools**: Query blockchain state and transaction details
12//!
13//! All tools are built with the `#[tool]` macro for seamless integration with rig agents
14//! and include comprehensive error handling and retry logic.
15
16// Existing modules remain unchanged
17pub mod balance;
18pub mod contract;
19pub mod error;
20pub mod network;
21pub mod provider;
22pub mod signer;
23pub mod swap;
24pub mod transaction;
25
26// Import and re-export common functionality from riglr-evm-common
27pub use riglr_evm_common::{
28    // Chain mapping
29    chain_id_to_name,
30    chain_id_to_rpc_url,
31    chain_name_to_id,
32    // Address utilities
33    ensure_0x_prefix,
34    // Conversion utilities
35    eth_to_wei,
36    format_address,
37    format_address_string,
38    // Formatting utilities
39    format_gas_price_gwei,
40    format_token_amount,
41    format_wei_to_eth,
42    get_address_url,
43    get_block_explorer_url,
44    get_chain_info,
45    get_supported_chains,
46    get_transaction_url,
47    gwei_to_wei,
48    is_checksummed,
49    is_supported_chain,
50    known_addresses,
51    parse_evm_address,
52    smallest_unit_to_token,
53    strip_0x_prefix,
54    token_to_smallest_unit,
55    truncate_address,
56    // Validation utilities
57    validate_chain_id,
58    validate_evm_address,
59    validate_gas_params,
60    wei_to_eth,
61    wei_to_gwei,
62    ChainInfo,
63    // Core types
64    EvmAccount,
65    // Error types
66    EvmCommonError,
67    EvmConfig,
68    EvmResult,
69    EvmToken,
70    EvmTransactionData,
71};
72
73// Re-export main functionality
74pub use balance::{
75    get_erc20_balance, get_eth_balance, get_token_decimals, get_token_name, get_token_symbol,
76    EthBalance, TokenBalance,
77};
78pub use contract::*;
79pub use error::EvmToolError;
80pub use network::*;
81pub use provider::{execute_evm_transaction, make_provider, EvmProvider};
82pub use signer::LocalEvmSigner;
83pub use swap::{get_uniswap_quote, SwapQuote};
84pub use transaction::*;
85
86// Re-export from riglr-core for convenience
87pub use riglr_core::{signer::UnifiedSigner, SignerContext};
88
89/// Current version of riglr-evm-tools
90pub const VERSION: &str = env!("CARGO_PKG_VERSION");