-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rugcheck API Integrated [Latest] (#109)
# Pull Request Description Provides a streamlined integration with the RugCheck API for Solana tokens, allowing developers to access and interact with key features like token reports, statistics, and voting functionality. ## Related Issue Fixes # (issue number) #17 and it's a followm up and latest pull for this PR #90 ## Changes Made This PR adds the following changes: <!-- List the key changes made in this PR --> Integrated Endpoints and Methods : **GET** `/tokens/{mint}/report/summary`: Generate a summary report for a specific token. **GET** `/tokens/{mint}/report`: Fetch a detailed report for a specific token. ## Implementation Details <!-- Provide technical details about the implementation --> This integration enables efficient access to RugCheck's token data and analytics, making it a valuable tool for developers. **Features** : - Generate a summary report for a specific token. - Retrieve a detailed report for a specific token. ## Transaction executed by agent <!-- If applicable, provide example usage, transactions, or screenshots --> Example transaction: ## Prompt Used <!-- If relevant, include the prompt or configuration used --> ``` ``` ## Additional Notes <!-- Any additional information that reviewers should know --> ## Checklist - [x] I have tested these changes locally - [ ] I have updated the documentation - [ ] I have added a transaction link - [ ] I have added the prompt used to test it
- Loading branch information
Showing
8 changed files
with
184 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { TokenCheck } from "../types"; | ||
|
||
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<TokenCheck>} The token summary report. | ||
* @throws {Error} If the API call fails. | ||
*/ | ||
export async function fetchTokenReportSummary( | ||
mint: string, | ||
): Promise<TokenCheck> { | ||
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: any) { | ||
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<TokenCheck>} The detailed token report. | ||
* @throws {Error} If the API call fails. | ||
*/ | ||
export async function fetchTokenDetailedReport( | ||
mint: string, | ||
): Promise<TokenCheck> { | ||
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: any) { | ||
console.error( | ||
`Error fetching detailed report for token ${mint}:`, | ||
error.message, | ||
); | ||
throw new Error(`Failed to fetch detailed report for token ${mint}.`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters