const BASE_URL = "https://api.rugcheck.xyz/v1" /** * Fetches a summary report for a specific token. * @async * @param {string} mint - The mint address of the token. * @returns {Promise} The token summary report. * @throws {Error} If the API call fails. */ export async function fetchTokenReportSummary(mint) { try { const response = await fetch(`${BASE_URL}/tokens/${mint}/report/summary`) if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`) } return await response.json() } catch (error) { console.error( `Error fetching report summary for token ${mint}:`, error.message ) throw new Error(`Failed to fetch report summary for token ${mint}.`) } } /** * Fetches a detailed report for a specific token. * @async * @param {string} mint - The mint address of the token. * @returns {Promise} The detailed token report. * @throws {Error} If the API call fails. */ export async function fetchTokenDetailedReport(mint) { try { const response = await fetch(`${BASE_URL}/tokens/${mint}/report`) if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`) } return await response.json() } catch (error) { console.error( `Error fetching detailed report for token ${mint}:`, error.message ) throw new Error(`Failed to fetch detailed report for token ${mint}.`) } }