wowok_agent
Version:
Making It Easy for AI Agents to Communicate, Collaborate, Trade, and Trust.
93 lines (92 loc) • 5.66 kB
JavaScript
import { z } from "zod";
import { TypedPermissionObjectSchema, CoinParamSchema, NamedObjectSchema, CallEnvSchema, SubmissionCallSchema } from "./base.js";
import { VotingGuardSchema } from "../query/index.js";
import { BalanceTypeSchema, DescriptionSchema, LongNameSchema, NameOrAddressSchema, NameSchema, ReceivedObjectsOrRecentlySchema } from "../common/index.js";
export const DisputeSchema = z.object({
order: NameOrAddressSchema.describe("Order ID or name."),
description: DescriptionSchema.optional().describe("Dispute description."),
proposition: z.array(LongNameSchema).describe("List of dispute propositions."),
fee: CoinParamSchema.describe("Dispute processing fee."),
namedArb: NamedObjectSchema.optional().describe("Name for the newly created arbitration object.")
}).strict();
export const ConfirmSchema = z.object({
arb: NameOrAddressSchema,
voting_deadline: z.union([z.number().int().min(0), z.null()])
}).strict();
export const VotingDeadlineChangeSchema = z.object({
arb: NameOrAddressSchema,
voting_deadline: z.union([z.number(), z.null()])
}).strict();
export const VoteSchema = z.object({
arb: NameOrAddressSchema,
votes: z.array(z.number().int().min(0).max(255)),
voting_guard: NameOrAddressSchema.optional()
}).strict();
export const FeedbackSchema = z.object({
arb: NameOrAddressSchema,
feedback: DescriptionSchema.describe("Arbitration feedback."),
}).strict();
export const ArbitrationActionSchema = z.object({
arb: NameOrAddressSchema,
feedback: DescriptionSchema.describe("Arbitration feedback."),
indemnity: z.number().int().min(0)
}).strict();
export const ResetSchema = z.object({
arb: NameOrAddressSchema,
feedback: DescriptionSchema.describe("Arbitration feedback."),
}).strict();
export const ArbWithdrawSchema = z.object({
arb: NameOrAddressSchema,
}).strict();
export const FeesTransferToSchema = z.union([
z.object({
allocation: NameOrAddressSchema.describe("Allocation object ID or name.")
}).strict(),
z.object({
treasury: NameOrAddressSchema.describe("Treasury object ID or name.")
}).strict()
]);
export const FeesTransferSchema = z.object({
to: FeesTransferToSchema.describe("Transfer arbitration fees to the specified Allocation object or Treasury object."),
payment_remark: NameSchema.describe("Payment remark."),
payment_index: z.number().int().min(0).describe("Payment index."),
newPayment: NamedObjectSchema.optional().describe("Name for the newly created payment object.")
}).strict();
export const VotingGuardActionSchema = z.discriminatedUnion("op", [
z.object({
op: z.enum(["add", "set"]),
guards: z.array(VotingGuardSchema)
}).strict(),
z.object({
op: z.literal("remove"),
guards: z.array(NameOrAddressSchema)
}).strict(),
z.object({
op: z.literal("clear")
}).strict()
]);
export const CallArbitration_DataSchema = z.object({
object: TypedPermissionObjectSchema,
dispute: DisputeSchema.optional().describe("Create a new Arb object for the order."),
description: DescriptionSchema.optional().describe("Introduction of the Arbitration object."),
location: LongNameSchema.optional().describe("Arbitration location."),
fee: BalanceTypeSchema.optional().describe("Arbitration fee."),
pause: z.boolean().optional().describe("Whether to pause arbitration."),
confirm: ConfirmSchema.optional().describe("Confirm the materials submitted by the user for arbitration."),
voting_deadline_change: VotingDeadlineChangeSchema.optional().describe("Change the voting deadline."),
vote: VoteSchema.optional().describe("Vote on user propositions."),
feedback: FeedbackSchema.optional().describe("Arbitration feedback for the Arb object."),
arbitration: ArbitrationActionSchema.optional().describe("Provide a definitive arbitration result."),
reset: ResetSchema.optional().describe("User applies to resubmit materials and restart arbitration."),
arb_withdraw: ArbWithdrawSchema.optional().describe("Withdraw arbitration fees from the Arb object."),
fees_transfer: FeesTransferSchema.optional().describe("Distribute the withdrawn arbitration fees."),
usage_guard: z.union([NameOrAddressSchema, z.null()]).optional().describe("Set Guard for verification when users apply for arbitration; if Guard verification fails, users will not be able to apply for arbitration."),
voting_guard: VotingGuardActionSchema.optional().describe("Set Guard for verification during arbitration voting; if Guard verification fails, arbitration voting will fail."),
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 Arbitration operations. USAGE: (1) CREATE NEW: Set 'object' field with OBJECT format {name, type_parameter, permission, ...} to create an Arbitration. 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 CallArbitration_InputSchema = z.object({
data: CallArbitration_DataSchema,
env: CallEnvSchema.optional(),
submission: SubmissionCallSchema.optional(),
}).strict();