@coinbase/agentkit
Version:
Coinbase AgentKit core primitives
63 lines (62 loc) • 2.51 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RevokeBaseAccountSpendPermissionSchema = exports.UseBaseAccountSpendPermissionSchema = exports.ListBaseAccountSpendPermissionsSchema = void 0;
const zod_1 = require("zod");
/**
* Input schema for listing Base Account spend permissions action.
*/
exports.ListBaseAccountSpendPermissionsSchema = zod_1.z
.object({
baseAccount: zod_1.z
.string()
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
.describe("The Base Account address to query if it has granted spend permissions"),
})
.strip()
.describe("Instructions for listing spend permissions for a Base Account");
/**
* Input schema for using a Base Account spend permission action.
*/
exports.UseBaseAccountSpendPermissionSchema = zod_1.z
.object({
baseAccount: zod_1.z
.string()
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
.describe("The Base Account address that has granted the spend permission"),
amount: zod_1.z
.number()
.positive()
.optional()
.describe("The amount to spend in whole units of the token (e.g. 4.6 for 4.6 tokens). If not provided, will withdraw the full remaining allowance"),
tokenAddress: zod_1.z
.string()
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
.optional()
.describe("The token contract address. If not provided, will use the first available permission token"),
permissionIndex: zod_1.z
.number()
.int()
.positive()
.optional()
.describe("The index of the permission to use (1-based). If not provided, the first permission will be used"),
})
.strip()
.describe("Instructions for using a Base Account spend permission");
/**
* Input schema for revoking a Base Account spend permission action.
*/
exports.RevokeBaseAccountSpendPermissionSchema = zod_1.z
.object({
baseAccount: zod_1.z
.string()
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
.describe("The Base Account address that has granted the spend permission"),
permissionIndex: zod_1.z
.number()
.int()
.positive()
.optional()
.describe("The index of the permission to revoke (1-based). If not provided, the first permission will be revoked"),
})
.strip()
.describe("Instructions for revoking a Base Account spend permission");