33 lines
929 B
JavaScript
33 lines
929 B
JavaScript
import { Tool } from "langchain/tools"
|
|
|
|
export class SolanaFetchTokenDetailedReportTool extends Tool {
|
|
name = "solana_fetch_token_detailed_report"
|
|
description = `Fetches a detailed report for a specific token from RugCheck.
|
|
Inputs:
|
|
- mint: string, the mint address of the token, e.g., "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN" (required).`
|
|
|
|
constructor(solanaKit) {
|
|
super()
|
|
this.solanaKit = solanaKit
|
|
}
|
|
|
|
async _call(input) {
|
|
try {
|
|
const mint = input.trim()
|
|
const detailedReport = await this.solanaKit.fetchTokenDetailedReport(mint)
|
|
|
|
return JSON.stringify({
|
|
status: "success",
|
|
message: "Detailed token report fetched successfully",
|
|
report: detailedReport
|
|
})
|
|
} catch (error) {
|
|
return JSON.stringify({
|
|
status: "error",
|
|
message: error.message,
|
|
code: error.code || "FETCH_TOKEN_DETAILED_REPORT_ERROR"
|
|
})
|
|
}
|
|
}
|
|
}
|