| Crates.io | yldfi-common |
| lib.rs | yldfi-common |
| version | 0.1.2 |
| created_at | 2026-01-17 08:01:42.569439+00 |
| updated_at | 2026-01-23 23:35:39.425813+00 |
| description | Shared utilities for yldfi-rs API clients |
| homepage | |
| repository | https://github.com/yldfi/yldfi-rs |
| max_upload_size | |
| id | 2050120 |
| size | 138,245 |
Shared utilities for yldfi-rs API clients
use yldfi_common::{with_retry, RetryConfig, RetryableError};
// Implement RetryableError for your error type
impl RetryableError for MyError {
fn is_retryable(&self) -> bool { true }
}
async fn example() {
let config = RetryConfig::default();
let result = with_retry(&config, || async {
Ok::<_, MyError>("success")
}).await;
}
use yldfi_common::eth::{is_valid_address, normalize_address};
assert!(is_valid_address("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"));
use yldfi_common::chains::Chain;
let chain = Chain::from_id(1);
assert_eq!(chain, Chain::Ethereum);
assert_eq!(chain.name(), "ethereum");
use yldfi_common::units::{to_wei, from_wei};
// Convert 1.5 ETH to wei
let wei = to_wei("1.5", 18).unwrap();
[dependencies]
yldfi-common = "0.1"
MIT