UNPKG

sei-agent-kit

Version:

A package for building AI agents on the SEI blockchain

37 lines (36 loc) 1.16 kB
import { StructuredTool } from "langchain/tools"; import { z } from "zod"; const SeiERC721BalanceInputSchema = z.object({ tokenAddress: z.string(), }); export class SeiERC721BalanceTool extends StructuredTool { seiKit; name = "sei_erc721_balance"; description = `Get the balance of ERC721 tokens (NFTs) for the connected wallet. Parameters: - tokenAddress: The contract address of the NFT collection.`; schema = SeiERC721BalanceInputSchema; constructor(seiKit) { super(); this.seiKit = seiKit; } async _call(input) { try { /**There was a comment here saying CHANGE THIS */ const balance = await this.seiKit.getERC721Balance(input.tokenAddress); return JSON.stringify({ status: "success", balance, tokenAddress: input.tokenAddress, }); } catch (error) { return JSON.stringify({ status: "error", message: error.message, code: error.code || "UNKNOWN_ERROR", }); } } } //# sourceMappingURL=balance.js.map