sei-agent-kit
Version:
A package for building AI agents on the SEI blockchain
36 lines (35 loc) • 1.11 kB
JavaScript
import { StructuredTool } from "langchain/tools";
import { z } from "zod";
const GetTokenAddressInputSchema = z.object({
ticker: z.string().min(1),
});
export class SeiGetTokenAddressTool extends StructuredTool {
seiKit;
name = "get_token_address_from_ticker";
description = `Retrieve a token's contract address by its ticker/symbol.
Parameters:
- ticker: The token ticker/symbol (e.g., "USDC", "ETH").`;
schema = GetTokenAddressInputSchema;
constructor(seiKit) {
super();
this.seiKit = seiKit;
}
async _call(input) {
try {
const tokenAddress = await this.seiKit.getTokenAddressFromTicker(input.ticker);
return JSON.stringify({
status: "success",
tokenAddress,
ticker: input.ticker,
});
}
catch (error) {
return JSON.stringify({
status: "error",
message: error.message,
code: error.code || "UNKNOWN_ERROR",
});
}
}
}
//# sourceMappingURL=getTokenAddress.js.map