pub struct TokenSearchManager;Implementations§
Source§impl TokenSearchManager
impl TokenSearchManager
Sourcepub async fn get_token_by_symbol(
client: Arc<Aptos>,
symbol: &str,
) -> Result<Vec<TokenSearchResult>, String>
pub async fn get_token_by_symbol( client: Arc<Aptos>, symbol: &str, ) -> Result<Vec<TokenSearchResult>, String>
get token by symbol
§Params
client - aptos client symbol - token symbol
§Example
use std::sync::Arc;
use crate::{Aptos, token::TokenSearchManager};
use crate::global::rpc::APTOS_MAINNET_URL;
async fn example() -> Result<(), String> {
let client = Arc::new(Aptos::new(APTOS_MAINNET_URL));
let results = TokenSearchManager::get_token_by_symbol(client, "USDC").await?;
for token in results {
println!("Found token: {} ({})", token.symbol, token.address);
}
Ok(())
}Sourcepub async fn get_top_token_vec(
client: Arc<Aptos>,
) -> Result<Vec<TopToken>, String>
pub async fn get_top_token_vec( client: Arc<Aptos>, ) -> Result<Vec<TopToken>, String>
get top token vec
§Params
client - aptos client
§Example
use std::sync::Arc;
use crate::{Aptos, token::TokenSearchManager};
use crate::global::rpc::APTOS_MAINNET_URL;
async fn example() -> Result<(), String> {
let client = Arc::new(Aptos::new(APTOS_MAINNET_URL));
let top_tokens = TokenSearchManager::get_top_token_vec(client).await?;
for token in top_tokens {
println!("{}: ${} (24h volume: {})", token.symbol, token.price, token.volume_24h);
}
Ok(())
}Sourcepub async fn get_token_trading_pairs(
client: Arc<Aptos>,
token_address: &str,
) -> Result<Vec<TradePair>, String>
pub async fn get_token_trading_pairs( client: Arc<Aptos>, token_address: &str, ) -> Result<Vec<TradePair>, String>
get token trading pairs
§Params
client - aptos client token_address - token address
§Example
use std::sync::Arc;
use crate::{Aptos, token::TokenSearchManager};
use crate::global::rpc::APTOS_MAINNET_URL;
async fn example() -> Result<(), String> {
let client = Arc::new(Aptos::new(APTOS_MAINNET_URL));
let token_address = "0x1::aptos_coin::AptosCoin";
let pairs = TokenSearchManager::get_token_trading_pairs(client, token_address).await?;
for pair in pairs {
println!("{} - {} on {:?}", pair.token_a, pair.token_b, pair.dexes);
}
Ok(())
}Auto Trait Implementations§
impl Freeze for TokenSearchManager
impl RefUnwindSafe for TokenSearchManager
impl Send for TokenSearchManager
impl Sync for TokenSearchManager
impl Unpin for TokenSearchManager
impl UnwindSafe for TokenSearchManager
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more