21 lines
499 B
JavaScript
21 lines
499 B
JavaScript
import { Tool } from "langchain/tools"
|
|
|
|
export class SolanaTPSCalculatorTool extends Tool {
|
|
name = "solana_get_tps"
|
|
description = "Get the current TPS of the Solana network"
|
|
|
|
constructor(solanaKit) {
|
|
super()
|
|
this.solanaKit = solanaKit
|
|
}
|
|
|
|
async _call(_input) {
|
|
try {
|
|
const tps = await this.solanaKit.getTPS()
|
|
return `Solana (mainnet-beta) current transactions per second: ${tps}`
|
|
} catch (error) {
|
|
return `Error fetching TPS: ${error.message}`
|
|
}
|
|
}
|
|
}
|