@coinbase/agentkit
Version:
Coinbase AgentKit core primitives
72 lines (71 loc) • 2.48 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UseSpendPermissionSchema = exports.ListSpendPermissionsSchema = exports.SwapSchema = exports.RequestFaucetFundsV2Schema = void 0;
const zod_1 = require("zod");
/**
* Input schema for request faucet funds action.
*/
exports.RequestFaucetFundsV2Schema = zod_1.z
.object({
assetId: zod_1.z.string().optional().describe("The optional asset ID to request from faucet"),
})
.strip()
.describe("Instructions for requesting faucet funds");
/**
* Input schema for swap tokens action.
*/
exports.SwapSchema = zod_1.z
.object({
fromToken: zod_1.z
.string()
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
.describe("The token contract address to swap from"),
toToken: zod_1.z
.string()
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
.describe("The token contract address to swap to"),
fromAmount: zod_1.z
.string()
.describe("The amount of fromToken to sell in whole units (e.g., 1.5 WETH, 10.5 USDC)"),
slippageBps: zod_1.z
.number()
.int()
.min(0)
.max(10000)
.optional()
.default(100)
.describe("The maximum acceptable slippage in basis points (0-10000, default: 100 = 1%)"),
})
.strip()
.describe("Instructions for swapping tokens");
/**
* Input schema for listing spend permissions action.
*/
exports.ListSpendPermissionsSchema = zod_1.z
.object({
smartAccountAddress: zod_1.z
.string()
.describe("The smart account address that has granted spend permissions"),
network: zod_1.z
.string()
.optional()
.describe("The network to list permissions on (defaults to wallet's network)"),
})
.strip()
.describe("Instructions for listing spend permissions for a smart account");
/**
* Input schema for using a spend permission action.
*/
exports.UseSpendPermissionSchema = zod_1.z
.object({
smartAccountAddress: zod_1.z
.string()
.describe("The smart account address that has granted the spend permission"),
value: zod_1.z.string().describe("The amount to spend (in the token's units)"),
network: zod_1.z
.string()
.optional()
.describe("The network to perform the spend on (defaults to wallet's network)"),
})
.strip()
.describe("Instructions for using a spend permission");