UNPKG

@coinbase/agentkit

Version:

Coinbase AgentKit core primitives

88 lines (87 loc) 3.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GetTokenAddressSchema = exports.AllowanceSchema = exports.ApproveSchema = exports.GetBalanceSchema = exports.TransferSchema = void 0; const zod_1 = require("zod"); /** * Input schema for transfer action. */ exports.TransferSchema = zod_1.z .object({ amount: zod_1.z .string() .describe("The amount of the asset to transfer in whole units (e.g. 1.5 USDC)"), tokenAddress: zod_1.z .string() .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format") .describe("The contract address of the token to transfer"), destinationAddress: zod_1.z .string() .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format") .describe("The destination to transfer the funds"), }) .strip() .describe("Instructions for transferring assets"); /** * Input schema for get balance action. */ exports.GetBalanceSchema = zod_1.z .object({ tokenAddress: zod_1.z .string() .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format") .describe("The contract address of the ERC20 token to get the balance for"), address: zod_1.z .string() .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format") .optional() .describe("The address to check the balance for. If not provided, uses the wallet's address"), }) .strip() .describe("Instructions for getting wallet balance"); /** * Input schema for approve action. */ exports.ApproveSchema = zod_1.z .object({ amount: zod_1.z.string().describe("The amount to approve in whole units (e.g. 100 for 100 USDC)"), tokenAddress: zod_1.z .string() .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format") .describe("The contract address of the token"), spenderAddress: zod_1.z .string() .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format") .describe("The address to approve for spending tokens"), }) .strip() .describe("Instructions for approving token spending"); /** * Input schema for allowance action. */ exports.AllowanceSchema = zod_1.z .object({ tokenAddress: zod_1.z .string() .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format") .describe("The contract address of the token"), spenderAddress: zod_1.z .string() .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format") .describe("The address to check allowance for"), }) .strip() .describe("Instructions for checking token allowance"); /** * Input schema for get token address action. */ exports.GetTokenAddressSchema = zod_1.z .object({ symbol: zod_1.z .string() .min(1) .max(10) .toUpperCase() .describe("The token symbol (e.g., USDC, WETH, DEGEN)"), }) .strip() .describe("Instructions for getting a token's contract address by symbol");