UNPKG

sei-agent-kit

Version:

A package for building AI agents on the SEI blockchain

48 lines (47 loc) 1.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SeiERC721MintTool = void 0; const tools_1 = require("langchain/tools"); const zod_1 = require("zod"); const SeiERC721MintInputSchema = zod_1.z.object({ recipient: zod_1.z.string(), tokenAddress: zod_1.z.string(), tokenId: zod_1.z.string().or(zod_1.z.number()), }); class SeiERC721MintTool extends tools_1.StructuredTool { constructor(seiKit) { super(); this.seiKit = seiKit; this.name = "sei_erc721_mint"; this.description = `Mint an NFT (ERC721 token). Parameters: - recipient: The wallet address that will receive the minted NFT. - tokenAddress: The NFT contract address. - tokenId: The ID of the NFT to mint.`; this.schema = SeiERC721MintInputSchema; } async _call(input) { try { const mint = await this.seiKit.ERC721Mint(input.recipient, input.tokenAddress, BigInt(input.tokenId)); if (mint === "") { throw new Error("Minting failed"); } return JSON.stringify({ status: "success", mint, recipient: input.recipient, tokenAddress: input.tokenAddress, tokenId: input.tokenId, }); } catch (error) { return JSON.stringify({ status: "error", message: error.message, code: error.code || "UNKNOWN_ERROR", }); } } } exports.SeiERC721MintTool = SeiERC721MintTool; //# sourceMappingURL=mint.js.map