Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add logs to the fetch clanker call #593

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/common/data/queries/clanker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,24 @@ export async function fetchClankerByAddress(
address: Address,
): Promise<ClankerToken | null> {
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;
}
}