UNPKG

@coinbase/agentkit

Version:

Coinbase AgentKit core primitives

56 lines (55 loc) 1.92 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SushiQuoteSchema = exports.SushiSwapSchema = void 0; const zod_1 = require("zod"); /** * Input schema for asset swap action */ exports.SushiSwapSchema = zod_1.z .object({ fromAssetAddress: zod_1.z .string() .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format") .transform(val => val) .describe("The Ethereum address of the input asset"), amount: zod_1.z .string() .regex(/^\d+(\.\d+)?$/, "Invalid number format") .describe("The amount of the input asset to swap, in the human readable format"), toAssetAddress: zod_1.z .string() .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format") .transform(val => val) .describe("The Ethereum address of the output asset"), maxSlippage: zod_1.z .number() .min(0) .max(1) .optional() .default(0.005) // 0.05% .describe("The maximum slippage allowed for the swap, where 0 is 0% and 1 is 100%"), }) .strip() .describe("Instructions for trading assets"); /** * Input schema for quote action */ exports.SushiQuoteSchema = zod_1.z .object({ fromAssetAddress: zod_1.z .string() .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format") .transform(val => val) .describe("The Ethereum address of the input asset"), amount: zod_1.z .string() .regex(/^\d+(\.\d+)?$/, "Invalid number format") .describe("The amount of the input asset to get a quote for"), toAssetAddress: zod_1.z .string() .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format") .transform(val => val) .describe("The Ethereum address of the output asset"), }) .strip() .describe("Instructions for fetching a quote for a trade");