Expand description
§riglr-evm-tools
A comprehensive suite of tools for interacting with EVM-compatible blockchains.
This crate provides ready-to-use tools for building EVM-native AI agents, including:
- Balance Tools: Check ETH and ERC20 token balances
- Transaction Tools: Send ETH and token transfers
- DeFi Tools: Interact with Uniswap, Sushiswap, and other DEXs
- Contract Tools: Deploy and interact with smart contracts
- Network Tools: Query blockchain state and transaction details
All tools are built with the #[tool] macro for seamless integration with rig agents
and include comprehensive error handling and retry logic.
Re-exports§
pub use balance::get_erc20_balance;pub use balance::get_eth_balance;pub use balance::get_token_decimals;pub use balance::get_token_name;pub use balance::get_token_symbol;pub use balance::EthBalance;pub use balance::TokenBalance;pub use error::EvmToolError;pub use provider::execute_evm_transaction;pub use provider::make_provider;pub use provider::EvmProvider;pub use signer::LocalEvmSigner;pub use swap::get_uniswap_quote;pub use swap::SwapQuote;pub use contract::*;pub use network::*;pub use transaction::*;
Modules§
- balance
- Balance checking tools for EVM chains
- contract
- Generic smart contract interaction tools
- error
- Error types for EVM tools
- known_
addresses - Common Ethereum addresses for reference
- network
- Network and blockchain query tools for EVM chains
- provider
- EVM provider utilities
- signer
- EVM transaction signer implementation using Alloy
- swap
- DEX integration tools for EVM chains
- transaction
- Transaction tools for EVM chains
Structs§
- Chain
Info - Chain information structure
- EvmAccount
- Common EVM account metadata
- EvmConfig
- Configuration for EVM operations shared across crates
- EvmToken
- Token information for ERC20 and native tokens
- EvmTransaction
Data - EVM transaction data for cross-chain operations
- Signer
Context - The SignerContext provides thread-local signer management for secure multi-tenant operation.
Enums§
- EvmCommon
Error - Error types for EVM operations shared across crates
Constants§
- VERSION
- Current version of riglr-evm-tools
Traits§
- Unified
Signer - Unified signer trait that can represent any type of signer This is used as the primary trait for SignerContext
Functions§
- chain_
id_ to_ name - Convert chain ID to human-readable name
- chain_
id_ to_ rpc_ url - Maps chain IDs to RPC URLs using convention-based environment variable lookup. Uses format: RPC_URL_{CHAIN_ID}
- chain_
name_ to_ id - Convert chain name to chain ID
- ensure_
0x_ prefix - Ensure address has 0x prefix
- eth_
to_ wei - Convert ETH to wei (f64 version - default)
- format_
address - Format an address for display with EIP-55 checksumming
- format_
address_ string - Format an address string with EIP-55 checksumming
- format_
gas_ price_ gwei - Format gas price in gwei
- format_
token_ amount - Format token amount with decimals
- format_
wei_ to_ eth - Format wei amount to ETH with specified decimal places
- get_
address_ url - Get address URL for viewing an address in block explorer
- get_
block_ explorer_ url - Get block explorer URL for a chain
- get_
chain_ info - Get chain information by chain ID
- get_
supported_ chains - Get list of all supported chain IDs
- get_
transaction_ url - Get transaction URL for a specific transaction
- gwei_
to_ wei - Convert gwei to wei (f64 version - default)
- is_
checksummed - Check if an address string is already checksummed according to EIP-55
- is_
supported_ chain - Check if a chain is supported (has RPC URL configured or has default)
- parse_
evm_ address - Parse an EVM address string into an Alloy Address type
- smallest_
unit_ to_ token - Convert smallest unit to token amount based on decimals (f64 version - default)
- strip_
0x_ prefix - Extract the address portion without 0x prefix
- token_
to_ smallest_ unit - Convert token amount to smallest unit based on decimals (f64 version - default)
- truncate_
address - Truncate address for display
- validate_
chain_ id - Validate chain ID is supported
- validate_
evm_ address - Validate an EVM address string format
- validate_
gas_ params - Validate gas parameters
- wei_
to_ eth - Convert wei to ETH (f64 version - default)
- wei_
to_ gwei - Convert wei to gwei (f64 version - default)
Type Aliases§
- EvmResult
- Result type alias using EvmCommonError