RugCheck CLI Example
The RugCheck CLI Tool is a command-line interface (CLI) application that allows users to fetch and display RugCheck reports for Solana tokens by entering their Contract Address (CA). The tool uses Agentipy's RugCheckManager
(which wraps the RugCheck API) to provide detailed information about a token's risks, score, and LP lockers.
Features
Fetch RugCheck Reports:
Get a summary report for a token, including its risk score, identified risks, and creator tokens.
Fetch LP Lockers:
Retrieve information about the token's LP (Liquidity Pool) lockers and total locked value.
User-Friendly Output:
Display results in an easy-to-read format.
Error Handling:
Provide clear error messages for invalid inputs or API issues.
Code (rugcheck_cli.py
)
rugcheck_cli.py
)import asyncio
from agentipy.tools.rugcheck import RugCheckManager
async def main():
api_key = "YOUR_API_KEY" # Replace with your actual RugCheck API key
rugcheck = RugCheckManager(api_key)
print("Enter the Contract Address (CA) of the token.")
print("Example CA: So11111111111111111111111111111111111111112 (Wrapped SOL)")
user_input = input("Your input: ").strip()
try:
print("\nFetching RugCheck report...\n")
report = await rugcheck.fetch_token_report_summary(user_input)
print(report.to_user_friendly_string())
lockers = await rugcheck.fetch_token_lp_lockers(user_input)
print("\n" + lockers.to_user_friendly_string())
except Exception as e:
print(f"\nError: {e}")
print("Please ensure you entered a valid Contract Address (CA).")
print("Example CA: So11111111111111111111111111111111111111112 (Wrapped SOL)")
if __name__ == "__main__":
asyncio.run(main())
Note: You need to replace "YOUR_API_KEY"
in the script with your actual RugCheck API key for the example to work. Some RugCheck endpoints might work without an API key but could be rate-limited or offer less data.
Source Files
You can find the source files for this example (including its original readme.md
with setup and usage instructions) on GitHub: https://github.com/niceberginc/agentipy/blob/main/examples/rugCheck/