UNPKG

sei-agent-kit

Version:

A package for building AI agents on the SEI blockchain

45 lines (44 loc) 1.42 kB
import { StructuredTool } from "langchain/tools"; import { z } from "zod"; const SeiERC721MintInputSchema = z.object({ recipient: z.string(), tokenAddress: z.string(), tokenId: z.string().or(z.number()), }); export class SeiERC721MintTool extends StructuredTool { seiKit; name = "sei_erc721_mint"; 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.`; schema = SeiERC721MintInputSchema; constructor(seiKit) { super(); this.seiKit = seiKit; } 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", }); } } } //# sourceMappingURL=mint.js.map