Skip to content

Commit ebbb975

Browse files
committed
fmt
1 parent 102d35d commit ebbb975

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

crates/server/src/handlers/static.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ impl StaticHandler {
392392

393393
let metadata: serde_json::Value =
394394
serde_json::from_str(&query_result.0).context("Failed to parse token metadata")?;
395-
395+
396396
Ok((metadata, query_result.1))
397397
}
398398

@@ -526,7 +526,7 @@ impl StaticHandler {
526526
db_timestamp: Option<&str>,
527527
) -> anyhow::Result<String> {
528528
let is_contract = !token_id.contains(':');
529-
529+
530530
// For both tokens and contracts, we can use the same query since contract address is the ID for contracts
531531
let query_str = format!("SELECT metadata FROM {TOKENS_TABLE} WHERE id = ?");
532532
let query_result = sqlx::query_as::<_, (String,)>(&query_str)
@@ -539,14 +539,15 @@ impl StaticHandler {
539539
Ok(result) => {
540540
let metadata: serde_json::Value =
541541
serde_json::from_str(&result.0).context("Failed to parse metadata")?;
542-
542+
543543
// Check if image field exists
544544
if metadata.get("image").is_some() {
545545
metadata
546546
} else if is_contract {
547547
// Fallback: try to find first token with this contract address
548548
debug!(target: LOG_TARGET, contract_address = %token_id, "No image found in contract metadata, searching for first token");
549-
let (fallback_metadata, fallback_token_id) = self.get_first_token_metadata(token_id).await?;
549+
let (fallback_metadata, fallback_token_id) =
550+
self.get_first_token_metadata(token_id).await?;
550551
debug!(target: LOG_TARGET, contract_address = %token_id, fallback_token = %fallback_token_id, "Using fallback token image");
551552
fallback_metadata
552553
} else {
@@ -556,12 +557,16 @@ impl StaticHandler {
556557
Err(_) if is_contract => {
557558
// Fallback: try to find first token with this contract address
558559
debug!(target: LOG_TARGET, contract_address = %token_id, "Contract metadata not found, searching for first token");
559-
let (fallback_metadata, fallback_token_id) = self.get_first_token_metadata(token_id).await?;
560+
let (fallback_metadata, fallback_token_id) =
561+
self.get_first_token_metadata(token_id).await?;
560562
debug!(target: LOG_TARGET, contract_address = %token_id, fallback_token = %fallback_token_id, "Using fallback token image");
561563
fallback_metadata
562564
}
563565
Err(e) => {
564-
return Err(anyhow::anyhow!("Failed to fetch metadata from database: {}", e));
566+
return Err(anyhow::anyhow!(
567+
"Failed to fetch metadata from database: {}",
568+
e
569+
));
565570
}
566571
};
567572

0 commit comments

Comments
 (0)