Skip to main content

Crate riglr_evm_tools

Crate riglr_evm_tools 

Source
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§

ChainInfo
Chain information structure
EvmAccount
Common EVM account metadata
EvmConfig
Configuration for EVM operations shared across crates
EvmToken
Token information for ERC20 and native tokens
EvmTransactionData
EVM transaction data for cross-chain operations
SignerContext
The SignerContext provides thread-local signer management for secure multi-tenant operation.

Enums§

EvmCommonError
Error types for EVM operations shared across crates

Constants§

VERSION
Current version of riglr-evm-tools

Traits§

UnifiedSigner
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