use dexscreener::Client;
use tokio;
#[tokio::main]
async fn main() {
get_pair().await;
}
async fn get_pair() {
// Create a new client instance
let client = Client::new();
// Define the token addresses
let token_addresses = [
"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",
"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
];
// Get the pairs from the client
let result = client.tokens(token_addresses).await;
// Handle the result
match result {
Ok(response) => {
if let Some(pairs) = response.pairs {
println!("{:?}", pairs);
} else {
println!("No pairs found");
}
}
Err(e) => {
println!("Error occurred: {:?}", e);
}
}
}
The following quite simple code
produces an error