sei-agent-kit
Version:
A package for building AI agents on the SEI blockchain
40 lines (39 loc) • 1.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SeiERC721BalanceTool = void 0;
const tools_1 = require("langchain/tools");
const zod_1 = require("zod");
const SeiERC721BalanceInputSchema = zod_1.z.object({
tokenAddress: zod_1.z.string(),
});
class SeiERC721BalanceTool extends tools_1.StructuredTool {
constructor(seiKit) {
super();
this.seiKit = seiKit;
this.name = "sei_erc721_balance";
this.description = `Get the balance of ERC721 tokens (NFTs) for the connected wallet.
Parameters:
- tokenAddress: The contract address of the NFT collection.`;
this.schema = SeiERC721BalanceInputSchema;
}
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",
});
}
}
}
exports.SeiERC721BalanceTool = SeiERC721BalanceTool;
//# sourceMappingURL=balance.js.map