Examples
// Define constants
const API_URL = 'https://pro.circular.bot/market/tokens';
const API_KEY = 'your-api-key'; // Replace by your API Key
const requestOptions = {
headers: {
'Content-Type': 'application/json',
'x-api-key': API_KEY,
},
params: {
maxTokensList: 10,
maxTimeRange: 900,
excludeTokens: [
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC
"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB" // USDT
].join(','),
provider: "JITO", // Optional
token: "So11111111111111111111111111111111111111112",
},
};
const getTokensMintList = async () => {
try {
const response = await axios.get(API_URL, requestOptions);
console.log('Mints: ', response?.data);
} catch (error) {
console.log('Error: ', error?.response?.data);
}
};
getTokensMintList();
// Define constants
const API_URL: string = 'https://pro.circular.bot/market/tokens';
const API_KEY: string = 'your-api-key'; // Replace with your API Key
// Define interfaces for request options
interface RequestOptions {
headers: {
'Content-Type': string;
'x-api-key': string;
};
params: {
maxTokensList: number;
maxTimeRange: number;
excludeTokens: string; // Comma-separated string of tokens
token: string;
provider?: string;
};
}
// Define the response structure (adjust as needed)
interface TokenMintListResponse {
mints: string[]; // Assuming the response contains an array of mints
}
// Request options
const requestOptions: RequestOptions = {
headers: {
'Content-Type': 'application/json',
'x-api-key': API_KEY,
},
params: {
maxTokensList: 10,
maxTimeRange: 900,
excludeTokens: [
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC
"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", // USDT
].join(','), // Convert array to comma-separated string
provider: "JITO", // Optional
token: "So11111111111111111111111111111111111111112",
},
};
// Function to fetch tokens mint list
const getTokensMintList = async (): Promise<void> => {
try {
const response: AxiosResponse<TokenMintListResponse> = await axios.get(
API_URL,
requestOptions as AxiosRequestConfig
);
console.log('Mints:', response.data);
} catch (error: any) {
console.error('Error:', error?.response?.data || error.message);
}
};
// Execute the function
getTokensMintList();
# Define constants
API_URL = "https://pro.circular.bot/market/tokens"
API_KEY = "your-api-key" # Replace with your API Key
# Request headers and parameters
headers = {
"Content-Type": "application/json",
"x-api-key": API_KEY,
}
params = {
"maxTokensList": 10,
"maxTimeRange": 900,
"excludeTokens": ",".join([
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", # USDC
"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", # USDT
]),
"provider": "JITO",
"token": "So11111111111111111111111111111111111111112",
}
# Function to fetch tokens mint list
def get_tokens_mint_list():
try:
response = requests.get(API_URL, headers=headers, params=params)
response.raise_for_status() # Raise an exception for HTTP errors
print("Mints:", response.json())
except requests.exceptions.RequestException as error:
print("Error:", error.response.json() if error.response else str(error))
# Execute the function
get_tokens_mint_list()
// Define constants
const API_URL: &str = "https://pro.circular.bot/market/tokens";
const API_KEY: &str = "your-api-key"; // Replace with your API key
// Define the response structure
#[derive(Deserialize, Debug)]
struct TokenMintListResponse {
mints: Vec<String>, // Assuming the response contains an array of mints
}
// Function to fetch tokens mint list
async fn get_tokens_mint_list() -> Result<(), Box<dyn std::error::Error>> {
// Create a client
let client = reqwest::Client::new();
// Set up headers
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
headers.insert("x-api-key", HeaderValue::from_static(API_KEY));
// Define parameters
let exclude_tokens = vec![
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC
"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", // USDT
]
.join(","); // Convert array to comma-separated string
let query_params = [
("maxTokensList", "10"),
("maxTimeRange", "900"),
("excludeTokens", &exclude_tokens),
("provider", "JITO"),
("token", "So11111111111111111111111111111111111111112"),
];
// Send the GET request
let response = client
.get(API_URL)
.headers(headers)
.query(&query_params)
.send()
.await?;
if response.status().is_success() {
let mints: TokenMintListResponse = response.json().await?;
println!("Mints: {:#?}", mints);
} else {
eprintln!(
"Error: {}",
response.text().await.unwrap_or_else(|_| "Unknown error".to_string())
);
}
Ok(())
}
// Main function
#[tokio::main]
async fn main() {
if let Err(err) = get_tokens_mint_list().await {
eprintln!("An error occurred: {}", err);
}
}
Last updated