UNPKG

wowok_agent

Version:

Making It Easy for AI Agents to Communicate, Collaborate, Trade, and Trust.

31 lines (30 loc) 2.64 kB
import { z } from "zod"; import { TypedPermissionObjectSchema, CoinParamSchema, CallEnvSchema, SubmissionCallSchema, } from "./base.js"; import { RewardGuardSchema } from "../query/index.js"; import { BalanceTypeSchema, ReceivedObjectsOrRecentlySchema, ReceivedBalanceOrRecentlySchema, NameOrAddressSchema, DescriptionSchema } from "../common/index.js"; export const RewardRecordSchema = z.object({ amount: BalanceTypeSchema, time: z.number().int(), }).strict().describe("Reward amount and time"); export const RecipientRecordSchema = z.object({ guard: NameOrAddressSchema, total: BalanceTypeSchema, amount: z.array(RewardRecordSchema), }).strict().describe("Reward recipient record"); export const CallReward_DataSchema = z.object({ object: TypedPermissionObjectSchema, claim: NameOrAddressSchema.optional().describe("Guard object ID. Used to verify Guard and start the reward distribution process corresponding to this Guard."), description: DescriptionSchema.optional(), coin_add: CoinParamSchema.optional().describe("Add amount to Reward object."), receive: ReceivedBalanceOrRecentlySchema.optional().describe("Unwrap CoinWrapper objects received by Reward object and store them in pending balance."), guard_add: z.array(RewardGuardSchema).optional().describe("Add Guard to Reward object."), guard_remove_expired: z.boolean().optional().describe("Whether to remove expired Guard."), guard_expiration_time: z.union([z.number().int().min(1), z.null()]).optional().describe("Add expiration time(ms). Before this time expires, new Guard and fund allocation rules cannot be added."), owner_receive: ReceivedObjectsOrRecentlySchema.optional().describe("Unwrap CoinWrapper objects and other objects received by this object and send them to the owner of its Permission object."), um: z.union([NameOrAddressSchema, z.null()]).optional().describe("Contact object."), }).strict().describe("On-chain Reward operations. USAGE: (1) CREATE NEW: Set 'object' field with OBJECT format {name, type_parameter, permission, ...} to create a Reward. NOTE: 'name' goes INSIDE 'object', NOT at the data root level.'permission' can be a new Permission object or reference an existing one - check 'object' field description for details. (2) OPERATE EXISTING: Set 'object' field with STRING format (object ID or name). The 'object' field is CRITICAL and REQUIRED in both cases. STRING for existing, OBJECT for new creation."); export const CallReward_InputSchema = z.object({ data: CallReward_DataSchema, env: CallEnvSchema.optional(), submission: SubmissionCallSchema.optional(), }).strict();