sei-agent-kit
Version:
A package for building AI agents on the SEI blockchain
39 lines (38 loc) • 1.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SeiGetTokenAddressTool = void 0;
const tools_1 = require("langchain/tools");
const zod_1 = require("zod");
const GetTokenAddressInputSchema = zod_1.z.object({
ticker: zod_1.z.string().min(1),
});
class SeiGetTokenAddressTool extends tools_1.StructuredTool {
constructor(seiKit) {
super();
this.seiKit = seiKit;
this.name = "get_token_address_from_ticker";
this.description = `Retrieve a token's contract address by its ticker/symbol.
Parameters:
- ticker: The token ticker/symbol (e.g., "USDC", "ETH").`;
this.schema = GetTokenAddressInputSchema;
}
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",
});
}
}
}
exports.SeiGetTokenAddressTool = SeiGetTokenAddressTool;
//# sourceMappingURL=getTokenAddress.js.map