AutoSwappr Rust SDK
A Rust SDK for interacting with the AutoSwappr contract on Starknet.
Features
- 🔄 Execute manual token swaps on Ekubo
- 🦀 Full Rust type safety
- ⚡ Async/await support with Tokio
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
= { = "1", = ["full"] }
All other dependencies (like starknet, axum, etc.) are automatically included.
AutoSwappr Contract Address
0x05582ad635c43b4c14dbfa53cbde0df32266164a0d1b36e5b510e5b34aeb364b
Quick Start
use ;
async
API Reference
AutoSwappr::config
Configure a new AutoSwappr instance.
ekubo_manual_swap
Execute a manual token swap.
pub async
Parameters:
token0: Source token addresstoken1: Destination token addressswap_amount: Amount to swap (in token units, not smallest denomination)
Returns:
Ok(SuccessResponse): Contains transaction hash on successErr(ErrorResponse): Contains error message on failure
Available Token Addresses
use ;
// STRK token
*STRK
// USDC token
*USDC
// ETH token
*ETH
Security Considerations
⚠️ Never expose private keys in your code or version control
- Use environment variables for sensitive data
- Keep private keys secure and encrypted
- Test with small amounts first
Example with Environment Variables
use env;
let rpc_url = var.expect;
let account_address = var.expect;
let private_key = var.expect;
let mut swapper = config.unwrap;
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
Support
For support and questions, please open an issue on GitHub.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Related Projects
- AutoSwappr TypeScript SDK - Original TypeScript implementation