From ee63417e762a8d80ba81c4b8f518e906ef7cb671 Mon Sep 17 00:00:00 2001 From: Gustavo Kuhl Date: Wed, 22 Jan 2025 16:03:30 -0300 Subject: [PATCH] chore: add logs to the fetch clanker call --- src/common/data/queries/clanker.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/data/queries/clanker.ts b/src/common/data/queries/clanker.ts index 0ab78eb2..0133f699 100644 --- a/src/common/data/queries/clanker.ts +++ b/src/common/data/queries/clanker.ts @@ -21,20 +21,24 @@ export async function fetchClankerByAddress( address: Address, ): Promise { try { + console.log("Fetching Clanker by address:", address); const response = await fetch(`${CLANKER_API_URL}?address=${address}`, { headers: { "x-api-key": process.env.CLANKER_API_KEY!, }, }); + const json = await response.json(); + if (!response.ok) { + console.error("Failed to fetch data:", response.statusText, json); throw new Error(`Failed to fetch data: ${response.statusText}`); } - const json = await response.json(); + console.log("Clanker data:", json.data); return json.data as ClankerToken; } catch (error) { - console.error(error); + console.error("Failed to fetch data:", error); return null; } }