Skip to content

Commit

Permalink
chore(api): move raydium api url to consts.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
armyhaylenko committed Jan 28, 2025
1 parent 39c0457 commit ed93329
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion nft_ingester/src/api/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub async fn start_api(

let addr = SocketAddr::from(([0, 0, 0, 0], port));
let token_price_fetcher = Arc::new(RaydiumTokenPriceFetcher::new(
"https://api-v3.raydium.io".to_string(),
crate::consts::RAYDIUM_API_HOST.to_string(),
crate::raydium_price_fetcher::CACHE_TTL,
red_metrics,
));
Expand Down
1 change: 1 addition & 0 deletions nft_ingester/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pub mod batch_mint;
pub mod buffer;
pub mod cleaners;
pub mod config;
pub mod consts;
pub mod error;
pub mod flatbuffer_mapper;
pub mod gapfiller;
Expand Down
10 changes: 4 additions & 6 deletions nft_ingester/src/raydium_price_fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct RaydiumTokenPriceFetcher {

impl Default for RaydiumTokenPriceFetcher {
fn default() -> Self {
Self::new("https://api-v3.raydium.io".to_string(), CACHE_TTL, None)
Self::new(crate::consts::RAYDIUM_API_HOST.to_string(), CACHE_TTL, None)
}
}

Expand Down Expand Up @@ -138,11 +138,9 @@ impl TokenPriceFetcher for RaydiumTokenPriceFetcher {
))
})?;

for maybe_token_data in tokens_data {
if let Some(MintIdsItem { address, symbol }) = maybe_token_data {
self.symbol_cache.insert(address.clone(), symbol.clone()).await;
result.insert(address, symbol);
}
for MintIdsItem { address, symbol } in tokens_data.into_iter().flatten() {
self.symbol_cache.insert(address.clone(), symbol.clone()).await;
result.insert(address, symbol);
}
}

Expand Down

0 comments on commit ed93329

Please sign in to comment.