wowok_agent 2.1.40 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1237 -1
- package/dist/schema/call/allocation.js +24 -1
- package/dist/schema/call/arbitration.js +92 -1
- package/dist/schema/call/base.js +134 -1
- package/dist/schema/call/contact.js +37 -1
- package/dist/schema/call/demand.js +47 -1
- package/dist/schema/call/guard.js +58 -1
- package/dist/schema/call/handler.js +171 -1
- package/dist/schema/call/index.js +18 -1
- package/dist/schema/call/machine.js +152 -1
- package/dist/schema/call/order.js +34 -1
- package/dist/schema/call/payment.js +17 -1
- package/dist/schema/call/permission.js +105 -1
- package/dist/schema/call/personal.js +68 -1
- package/dist/schema/call/progress.js +26 -1
- package/dist/schema/call/proof.js +27 -1
- package/dist/schema/call/repository.js +76 -1
- package/dist/schema/call/reward.js +42 -1
- package/dist/schema/call/service.js +82 -1
- package/dist/schema/call/treasury.js +71 -1
- package/dist/schema/common/index.js +345 -1
- package/dist/schema/index.js +7 -1
- package/dist/schema/local/index.js +855 -1
- package/dist/schema/local/wip.js +187 -1
- package/dist/schema/messenger/index.js +446 -1
- package/dist/schema/query/index.js +1265 -1
- package/dist/schema/utils/guard-parser.js +401 -1
- package/dist/schema/utils/guard-query-utils.js +22 -1
- package/dist/schema/utils/node-parser.js +353 -1
- package/dist/schema/utils/permission-index-utils.js +7 -1
- package/package.json +3 -6
|
@@ -1 +1,68 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AccountOrMark_AddressAISchema, AccountOrMark_AddressSchema, DescriptionSchema, ManyAccountOrMark_AddressAISchema, NameSchema } from "../common/index.js";
|
|
3
|
+
import { RecordsInEntitySchema } from "../query/index.js";
|
|
4
|
+
import { CallEnvSchema } from "./base.js";
|
|
5
|
+
export const InformationAddSchema = z.object({
|
|
6
|
+
op: z.literal("add"),
|
|
7
|
+
data: z.array(RecordsInEntitySchema)
|
|
8
|
+
}).strict().describe("PUBLIC: Add personal info on-chain. Safe: social handles, URLs, public email. NEVER: phone, address, private keys.");
|
|
9
|
+
export const InformationRemoveSchema = z.object({
|
|
10
|
+
op: z.literal("remove"),
|
|
11
|
+
name: z.array(NameSchema)
|
|
12
|
+
}).strict().describe("PUBLIC: Remove specified personal info records from your public profile.");
|
|
13
|
+
export const InformationClearSchema = z.object({
|
|
14
|
+
op: z.literal("clear")
|
|
15
|
+
}).strict().describe("PUBLIC: Clear ALL personal info from your public profile.");
|
|
16
|
+
export const InformationSchema = z.discriminatedUnion("op", [
|
|
17
|
+
InformationAddSchema,
|
|
18
|
+
InformationRemoveSchema,
|
|
19
|
+
InformationClearSchema
|
|
20
|
+
]);
|
|
21
|
+
export const MarkAddSchema = z.object({
|
|
22
|
+
op: z.literal("add"),
|
|
23
|
+
data: z.array(z.object({
|
|
24
|
+
address: AccountOrMark_AddressAISchema,
|
|
25
|
+
name: NameSchema.optional(),
|
|
26
|
+
tags: z.array(NameSchema).optional()
|
|
27
|
+
}).strict()),
|
|
28
|
+
}).strict().describe("PUBLIC: Add ID name and tags on-chain for public identity. For private marks, use 'local' tool.");
|
|
29
|
+
export const MarkRemoveSchema = z.object({
|
|
30
|
+
op: z.literal("remove"),
|
|
31
|
+
data: z.array(z.object({
|
|
32
|
+
address: AccountOrMark_AddressAISchema,
|
|
33
|
+
tags: z.array(NameSchema).optional()
|
|
34
|
+
}).strict())
|
|
35
|
+
}).strict().describe("PUBLIC: Remove specified tags from your on-chain identity mark.");
|
|
36
|
+
export const MarkClearSchema = z.object({
|
|
37
|
+
op: z.literal("clear"),
|
|
38
|
+
address: ManyAccountOrMark_AddressAISchema
|
|
39
|
+
}).strict().describe("PUBLIC: Clear ALL tags from specified on-chain identity marks.");
|
|
40
|
+
export const MarkTransferSchema = z.object({
|
|
41
|
+
op: z.literal("transfer"),
|
|
42
|
+
to: AccountOrMark_AddressAISchema
|
|
43
|
+
}).strict().describe("PUBLIC: Transfer your on-chain identity mark to another address.");
|
|
44
|
+
export const MarkReplaceSchema = z.object({
|
|
45
|
+
op: z.literal("replace"),
|
|
46
|
+
new_mark_object: z.string().describe("New personal ID tag object ID.")
|
|
47
|
+
}).strict().describe("PUBLIC: Replace your on-chain identity mark with a new object.");
|
|
48
|
+
export const MarkDestroySchema = z.object({
|
|
49
|
+
op: z.literal("destroy")
|
|
50
|
+
}).strict().describe("PUBLIC: Destroy your on-chain identity mark permanently.");
|
|
51
|
+
export const MarkSchema = z.discriminatedUnion("op", [
|
|
52
|
+
MarkAddSchema,
|
|
53
|
+
MarkRemoveSchema,
|
|
54
|
+
MarkClearSchema,
|
|
55
|
+
MarkTransferSchema,
|
|
56
|
+
MarkReplaceSchema,
|
|
57
|
+
MarkDestroySchema
|
|
58
|
+
]);
|
|
59
|
+
export const CallPersonal_DataSchema = z.object({
|
|
60
|
+
description: DescriptionSchema.optional(),
|
|
61
|
+
referrer: z.union([z.string(), AccountOrMark_AddressSchema, z.null()]).optional().describe("Referrer ID (name or address) for joining the on-chain network."),
|
|
62
|
+
information: InformationSchema.optional().describe("PUBLIC: Personal info on-chain. Safe: social handles, URLs. NEVER: phone, address, private keys."),
|
|
63
|
+
mark: MarkSchema.optional().describe("PUBLIC: On-chain identity mark. For PRIVATE marks, use 'local' tool.")
|
|
64
|
+
}).strict();
|
|
65
|
+
export const CallPersonal_InputSchema = z.object({
|
|
66
|
+
data: CallPersonal_DataSchema,
|
|
67
|
+
env: CallEnvSchema.optional(),
|
|
68
|
+
}).strict();
|
|
@@ -1 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CallEnvSchema, SubmissionCallSchema, ObjectsSchema } from "./base.js";
|
|
3
|
+
import { ProgressNamedOperatorSchema } from "./machine.js";
|
|
4
|
+
import { NameOrAddressSchema, NameSchema } from "../common/index.js";
|
|
5
|
+
export const ProgressNextSchema = z.object({
|
|
6
|
+
next_node_name: NameSchema.describe("Next node name."),
|
|
7
|
+
forward: NameSchema.describe("Next forward name."),
|
|
8
|
+
}).strict().describe("Specify a specific operation between current node and next node.");
|
|
9
|
+
export const OperateSchema = z.object({
|
|
10
|
+
operation: ProgressNextSchema,
|
|
11
|
+
hold: z.boolean().optional().describe("Whether to lock operation permission. When true, locks the permission; when false or omitted, submits operation result directly."),
|
|
12
|
+
adminUnhold: z.boolean().optional().describe("Whether to allow admin to force unlock. Only applicable when hold is true."),
|
|
13
|
+
message: z.string().optional().describe("Operation result message."),
|
|
14
|
+
}).strict().describe("Advance Progress object: lock operation permission (hold=true) or submit operation result (hold=false or omitted).");
|
|
15
|
+
export const CallProgress_DataSchema = z.object({
|
|
16
|
+
object: NameOrAddressSchema.describe("Progress object ID or name."),
|
|
17
|
+
task: NameOrAddressSchema.optional().describe("Task ID. Cannot be changed after setting."),
|
|
18
|
+
repository: ObjectsSchema.optional().describe("Consensus data Repository object list."),
|
|
19
|
+
progress_namedOperator: ProgressNamedOperatorSchema.optional().describe("Manage operators for Progress permission namespace."),
|
|
20
|
+
operate: OperateSchema.optional().describe("Advance Progress object. Can be locking operation permission (to avoid competition for the same permission) or submitting operation result."),
|
|
21
|
+
}).strict().describe("On-chain, operate an existing Progress object.");
|
|
22
|
+
export const CallProgress_InputSchema = z.object({
|
|
23
|
+
data: CallProgress_DataSchema,
|
|
24
|
+
env: CallEnvSchema.optional(),
|
|
25
|
+
submission: SubmissionCallSchema.optional(),
|
|
26
|
+
}).strict();
|
|
@@ -1 +1,27 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CallEnvSchema, NamedObjectSchema } from './base.js';
|
|
3
|
+
import { DescriptionSchema } from '../common/index.js';
|
|
4
|
+
export const CallProof_DataSchema = z.object({
|
|
5
|
+
namedNew: NamedObjectSchema.optional(),
|
|
6
|
+
description: DescriptionSchema.optional(),
|
|
7
|
+
proof: z.string().max(10240).describe("Proof content. e.g. merkle tree root"),
|
|
8
|
+
server_pubkey: z.string().max(1024).describe("Server public key"),
|
|
9
|
+
server_signature: z.string().max(40480).describe("Server signature"),
|
|
10
|
+
proof_type: z.union([z.number().int().min(0), z.string()]).describe("Proof type. 1: WTS proof; 1-100 reserved."),
|
|
11
|
+
item_count: z.union([z.number().int().min(0), z.string(), z.null()]).optional().describe("Item count. e.g. number of items in the merkle tree"),
|
|
12
|
+
about_address: z.union([NamedObjectSchema, z.null()]).optional().describe("About address. e.g. address of the entity being proved"),
|
|
13
|
+
}).strict().describe("On-chain Proof creation. USAGE: Set 'namedNew' field with {name, tag?} to create a named Proof. Proof is an immutable object - it can only be created, not modified. The 'namedNew' field is CRITICAL and REQUIRED.");
|
|
14
|
+
export const CallProof_InputSchema = z.object({
|
|
15
|
+
data: CallProof_DataSchema,
|
|
16
|
+
env: CallEnvSchema.optional(),
|
|
17
|
+
}).strict().describe("On-chain, create a new Proof object");
|
|
18
|
+
export const CallGenProof_InputSchema = z.object({
|
|
19
|
+
proof: z.string().max(10240).describe("Proof content. e.g. merkle tree root"),
|
|
20
|
+
server_pubkey: z.string().max(1024).describe("Server public key"),
|
|
21
|
+
server_signature: z.string().max(40480).describe("Server signature"),
|
|
22
|
+
proof_type: z.union([z.number().int().min(0), z.string()]).describe("Proof type. 1: WTS proof; 1-100 reserved."),
|
|
23
|
+
description: DescriptionSchema.optional(),
|
|
24
|
+
item_count: z.union([z.number().int().min(0), z.string(), z.null()]).optional().describe("Item count. e.g. number of items in the merkle tree"),
|
|
25
|
+
about_address: z.union([NamedObjectSchema, z.null()]).optional().describe("About address. e.g. address of the entity being proved"),
|
|
26
|
+
env: CallEnvSchema.optional(),
|
|
27
|
+
}).strict().describe("Generate a new Proof object on-chain");
|
|
@@ -1 +1,76 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { WithPermissionObjectSchema, ObjectsSchema, CallEnvSchema, SubmissionCallSchema, } from "./base.js";
|
|
3
|
+
import { AccountOrMark_AddressSchema, DescriptionSchema, NameOrAddressSchema, NameSchema, ReceivedObjectsOrRecentlySchema } from "../common/index.js";
|
|
4
|
+
import { PolicyRuleSchema } from "../query/index.js";
|
|
5
|
+
import { SupportedValueSchema } from "../common/index.js";
|
|
6
|
+
export const RepositoryIdSchema = z.union([
|
|
7
|
+
AccountOrMark_AddressSchema,
|
|
8
|
+
z.number().int(),
|
|
9
|
+
]).describe("Data item ID. If a number (such as time) is specified, it will be automatically converted to an address or ID type.");
|
|
10
|
+
export const KeyDataSchema = z.object({
|
|
11
|
+
id: RepositoryIdSchema,
|
|
12
|
+
data: SupportedValueSchema,
|
|
13
|
+
}).strict().describe("Data ID and value.");
|
|
14
|
+
export const RepDataItemSchema = z.object({
|
|
15
|
+
data: z.array(KeyDataSchema).describe("Data item list."),
|
|
16
|
+
write_guard: NameOrAddressSchema.optional().describe("Guard ID or name. Used to specify the policy write permissions and rules corresponding to this Guard."),
|
|
17
|
+
}).strict().describe("List of data items to write.");
|
|
18
|
+
export const SignerOrClockBaseSchema = z.object({
|
|
19
|
+
name: NameSchema.describe("Data item name."),
|
|
20
|
+
write_guard: NameOrAddressSchema.optional().describe("Guard ID or name. Used to specify the policy write permissions and rules corresponding to this Guard."),
|
|
21
|
+
}).strict().describe("Specify data items by name and ID. ID is the on-chain timestamp or signer ID (depending on how write_guard specifies the ID source).");
|
|
22
|
+
export const SignerOrClockSchema = z.object({
|
|
23
|
+
name: NameSchema.describe("Data item name."),
|
|
24
|
+
write_guard: NameOrAddressSchema.optional().describe("Guard ID or name. Used to specify the policy write permissions and rules corresponding to this Guard."),
|
|
25
|
+
data: SupportedValueSchema,
|
|
26
|
+
}).strict().describe("Specify data items by name and data. ID is the on-chain timestamp or signer ID (depending on how write_guard specifies the ID source).");
|
|
27
|
+
export const DataRemoveItemSchema = z.object({
|
|
28
|
+
id: z.array(RepositoryIdSchema).describe("Data item ID list."),
|
|
29
|
+
write_guard: NameOrAddressSchema.optional().describe("Guard ID or name. Used to verify permission to delete data."),
|
|
30
|
+
}).strict().describe("Delete data items by name and ID list.");
|
|
31
|
+
export const PoliciesAddSetSchema = z.object({
|
|
32
|
+
op: z.enum(["add", "set"]),
|
|
33
|
+
policy: z.array(PolicyRuleSchema).describe("Policy rule list."),
|
|
34
|
+
}).strict().describe("Add or set policy rules.");
|
|
35
|
+
export const PoliciesRemoveSchema = z.object({
|
|
36
|
+
op: z.literal("remove"),
|
|
37
|
+
policy: z.array(NameSchema).describe("Policy rule name list."),
|
|
38
|
+
}).strict().describe("Remove policy rules.");
|
|
39
|
+
export const PoliciesClearSchema = z.object({
|
|
40
|
+
op: z.literal("clear"),
|
|
41
|
+
}).strict().describe("Clear policy rules.");
|
|
42
|
+
export const PoliciesSchema = z.discriminatedUnion("op", [
|
|
43
|
+
PoliciesAddSetSchema,
|
|
44
|
+
PoliciesRemoveSchema,
|
|
45
|
+
PoliciesClearSchema,
|
|
46
|
+
]);
|
|
47
|
+
export const DataAddWithItemsSchema = z.object({
|
|
48
|
+
name: NameSchema.describe("Data item name. Must match the name in PolicyRule."),
|
|
49
|
+
items: z.array(RepDataItemSchema).describe("List of data items to add. Each data item contains name, ID, and data parts, where name and ID together form the unique key for the data."),
|
|
50
|
+
}).strict().describe("Add data by name and data item list. Each data item contains name, ID, and data parts, where name and ID together form the unique key for the data.");
|
|
51
|
+
export const DataAddSchema = z.union([
|
|
52
|
+
SignerOrClockSchema,
|
|
53
|
+
DataAddWithItemsSchema,
|
|
54
|
+
]);
|
|
55
|
+
export const DataRemoveSchema = z.union([
|
|
56
|
+
SignerOrClockBaseSchema,
|
|
57
|
+
z.object({
|
|
58
|
+
name: NameSchema.describe("Data item name. Must match the name in PolicyRule."),
|
|
59
|
+
items: z.array(DataRemoveItemSchema).describe("List of data items to delete."),
|
|
60
|
+
}).strict(),
|
|
61
|
+
]);
|
|
62
|
+
export const CallRepository_DataSchema = z.object({
|
|
63
|
+
object: WithPermissionObjectSchema,
|
|
64
|
+
description: DescriptionSchema.optional(),
|
|
65
|
+
policies: PoliciesSchema.optional().describe("Policy list. Used to define data item write permissions and rules, as well as data item read permissions."),
|
|
66
|
+
data_add: DataAddSchema.optional().describe("Add data items"),
|
|
67
|
+
data_remove: DataRemoveSchema.optional().describe("Delete data items"),
|
|
68
|
+
rewards: ObjectsSchema.optional().describe("Reward object list. Used for data contribution incentives."),
|
|
69
|
+
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."),
|
|
70
|
+
um: z.union([NameOrAddressSchema, z.null()]).optional().describe("Contact object."),
|
|
71
|
+
}).strict().describe("On-chain Repository operations. USAGE: (1) CREATE NEW: Set 'object' field with OBJECT format {name, permission, ...} to create a Repository. 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.");
|
|
72
|
+
export const CallRepository_InputSchema = z.object({
|
|
73
|
+
data: CallRepository_DataSchema,
|
|
74
|
+
env: CallEnvSchema.optional(),
|
|
75
|
+
submission: SubmissionCallSchema.optional(),
|
|
76
|
+
}).strict();
|
|
@@ -1 +1,42 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TypedPermissionObjectSchema, CoinParamSchema, CallEnvSchema, SubmissionCallSchema, } from "./base.js";
|
|
3
|
+
import { RewardGuardSchema } from "../query/index.js";
|
|
4
|
+
import { BalanceTypeSchema, ReceivedObjectsOrRecentlySchema, ReceivedBalanceOrRecentlySchema, NameOrAddressSchema, GuardIdentifierSchema, DescriptionSchema } from "../common/index.js";
|
|
5
|
+
export const RecipientGuardIdentifierSchema = z.object({
|
|
6
|
+
type: z.literal("GuardIdentifier"),
|
|
7
|
+
GuardIdentifier: GuardIdentifierSchema,
|
|
8
|
+
}).strict().describe("Get recipient ID from specified data index in Guard table. The ID must be of address type.");
|
|
9
|
+
export const RecipientEntitySchema = z.object({
|
|
10
|
+
type: z.literal("Entity"),
|
|
11
|
+
Entity: NameOrAddressSchema,
|
|
12
|
+
}).strict().describe("Fixed entity ID");
|
|
13
|
+
export const RecipientSignerSchema = z.object({
|
|
14
|
+
type: z.literal("Signer"),
|
|
15
|
+
Signer: z.boolean(),
|
|
16
|
+
}).strict().describe("Signer ID");
|
|
17
|
+
export const RewardRecordSchema = z.object({
|
|
18
|
+
amount: BalanceTypeSchema,
|
|
19
|
+
time: z.number().int(),
|
|
20
|
+
}).strict().describe("Reward amount and time");
|
|
21
|
+
export const RecipientRecordSchema = z.object({
|
|
22
|
+
guard: NameOrAddressSchema,
|
|
23
|
+
total: BalanceTypeSchema,
|
|
24
|
+
amount: z.array(RewardRecordSchema),
|
|
25
|
+
}).strict().describe("Reward recipient record");
|
|
26
|
+
export const CallReward_DataSchema = z.object({
|
|
27
|
+
object: TypedPermissionObjectSchema,
|
|
28
|
+
claim: NameOrAddressSchema.optional().describe("Guard object ID. Used to verify Guard and start the reward distribution process corresponding to this Guard."),
|
|
29
|
+
description: DescriptionSchema.optional(),
|
|
30
|
+
coin_add: CoinParamSchema.optional().describe("Add amount to Reward object."),
|
|
31
|
+
receive: ReceivedBalanceOrRecentlySchema.optional().describe("Unwrap CoinWrapper objects received by Reward object and store them in pending balance."),
|
|
32
|
+
guard_add: z.array(RewardGuardSchema).optional().describe("Add Guard to Reward object."),
|
|
33
|
+
guard_remove_expired: z.boolean().optional().describe("Whether to remove expired Guard."),
|
|
34
|
+
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."),
|
|
35
|
+
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."),
|
|
36
|
+
um: z.union([NameOrAddressSchema, z.null()]).optional().describe("Contact object."),
|
|
37
|
+
}).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.");
|
|
38
|
+
export const CallReward_InputSchema = z.object({
|
|
39
|
+
data: CallReward_DataSchema,
|
|
40
|
+
env: CallEnvSchema.optional(),
|
|
41
|
+
submission: SubmissionCallSchema.optional(),
|
|
42
|
+
}).strict();
|
|
@@ -1 +1,82 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TypedPermissionObjectSchema, CoinParamSchema, NamedObjectSchema, ObjectsSchema, CallEnvSchema, SubmissionCallSchema } from "./base.js";
|
|
3
|
+
import { AllocatorsSchema, DiscountTypeSchema, ServiceSaleSchema } from "../query/index.js";
|
|
4
|
+
import { AccountOrMark_AddressSchema, DescriptionSchema, LongNameSchema, ManyAccountOrMark_AddressSchema, NameOrAddressSchema, NotEmptyNameSchema, ReceivedBalanceOrRecentlySchema, ReceivedObjectsOrRecentlySchema } from "../common/index.js";
|
|
5
|
+
import { BalanceTypeSchema } from "../common/index.js";
|
|
6
|
+
export const ServiceBuyItemSchema = z.object({
|
|
7
|
+
name: LongNameSchema.describe("Name of the product or service to purchase"),
|
|
8
|
+
stock: BalanceTypeSchema.describe("Quantity of the product or service to purchase"),
|
|
9
|
+
wip_hash: z.string().describe("WIP file hash of the item"),
|
|
10
|
+
}).strict();
|
|
11
|
+
export const BuySchema = z.object({
|
|
12
|
+
items: z.array(ServiceBuyItemSchema).describe("List of products or services to purchase"),
|
|
13
|
+
total_pay: CoinParamSchema.describe("Actual payment amount"),
|
|
14
|
+
discount: z.string().optional().describe("Discount object ID or name"),
|
|
15
|
+
payment_remark: z.string().optional().describe("Payment remark"),
|
|
16
|
+
payment_index: z.number().optional().describe("Payment index"),
|
|
17
|
+
}).strict();
|
|
18
|
+
export const DiscountSchema = z.object({
|
|
19
|
+
name: z.string().describe("Discount name"),
|
|
20
|
+
discount_type: DiscountTypeSchema.describe("Discount type"),
|
|
21
|
+
discount_value: BalanceTypeSchema.describe("Discount value"),
|
|
22
|
+
benchmark: z.union([z.number(), z.string()]).optional().describe("Discount benchmark value. Discount is only applied if the amount exceeds this value"),
|
|
23
|
+
time_ms_start: z.number().optional().describe("Discount start time (milliseconds)"),
|
|
24
|
+
time_ms_end: z.number().optional().describe("Discount end time (milliseconds)"),
|
|
25
|
+
count: z.number().optional().describe("Discount usage count"),
|
|
26
|
+
recipient: ManyAccountOrMark_AddressSchema.describe("Discount recipient"),
|
|
27
|
+
transferable: z.boolean().optional().describe("Whether the discount object recipient can transfer the discount object"),
|
|
28
|
+
}).strict();
|
|
29
|
+
export const OrderNewSchema = z.object({
|
|
30
|
+
buy: BuySchema,
|
|
31
|
+
agents: ManyAccountOrMark_AddressSchema.optional().describe("Order agents. Agents can operate the order, such as canceling the order, modifying the order status, etc.; but cannot receive the funds received by the order."),
|
|
32
|
+
order_required_info: z.string().optional().describe("Contact object ID or WTS Proof object"),
|
|
33
|
+
transfer: AccountOrMark_AddressSchema.optional().describe("Set the new owner of the order. Requires order owner permission to set."),
|
|
34
|
+
namedNewOrder: NamedObjectSchema.optional().describe("Set the local name of the order object."),
|
|
35
|
+
namedNewAllocation: NamedObjectSchema.optional().describe("Set the local name of the order's Allocation object."),
|
|
36
|
+
namedNewProgress: NamedObjectSchema.optional().describe("Set the local name of the order's Progress object."),
|
|
37
|
+
}).strict();
|
|
38
|
+
export const SalesSchema = z.discriminatedUnion("op", [
|
|
39
|
+
z.object({
|
|
40
|
+
op: z.literal("add"),
|
|
41
|
+
sales: z.array(ServiceSaleSchema),
|
|
42
|
+
}).strict().describe("Add new sales products or services."),
|
|
43
|
+
z.object({
|
|
44
|
+
op: z.literal("set"),
|
|
45
|
+
sales: z.array(ServiceSaleSchema),
|
|
46
|
+
}).strict().describe("Set sales products or services."),
|
|
47
|
+
z.object({
|
|
48
|
+
op: z.literal("remove"),
|
|
49
|
+
sales_name: z.array(LongNameSchema.describe("Sales name")),
|
|
50
|
+
}).strict().describe("Remove existing sales products or services."),
|
|
51
|
+
z.object({
|
|
52
|
+
op: z.literal("clear"),
|
|
53
|
+
}).strict().describe("Clear all sales products or services."),
|
|
54
|
+
]);
|
|
55
|
+
export const CallService_DataSchema = z.object({
|
|
56
|
+
object: TypedPermissionObjectSchema,
|
|
57
|
+
order_new: OrderNewSchema.optional().describe("Create new order."),
|
|
58
|
+
description: DescriptionSchema.optional(),
|
|
59
|
+
location: LongNameSchema.optional().describe("Location of the Service"),
|
|
60
|
+
sales: SalesSchema.optional().describe("Service sales products or services list."),
|
|
61
|
+
repositories: ObjectsSchema.optional().describe("Service Repository object list."),
|
|
62
|
+
rewards: ObjectsSchema.optional().describe("Service Reward object list."),
|
|
63
|
+
arbitrations: ObjectsSchema.optional().describe("Service Arbitration object list."),
|
|
64
|
+
machine: z.union([NameOrAddressSchema, z.null()]).optional().describe("Service Machine object ID or name. The Machine object must be in published state."),
|
|
65
|
+
discount: DiscountSchema.optional().describe("Issue discount."),
|
|
66
|
+
discount_destroy: z.array(NameOrAddressSchema).optional().describe("Destroy existing discount object ID list."),
|
|
67
|
+
customer_required: z.array(NotEmptyNameSchema).optional().describe("Customer required information. Such as phone, email, etc."),
|
|
68
|
+
order_allocators: z.union([AllocatorsSchema, z.null()]).optional().describe("Order fund allocator."),
|
|
69
|
+
buy_guard: z.union([NameOrAddressSchema, z.null()]).optional().describe("Buy guard object ID or name."),
|
|
70
|
+
compensation_fund_add: CoinParamSchema.optional().describe("Compensation fund. Used to claim compensation based on the arbitration result of the Arb object when resolving order disputes."),
|
|
71
|
+
compensation_locked_time_add: z.number().optional().describe("Lock time for compensation funds added to orders (milliseconds)."),
|
|
72
|
+
compensation_fund_receive: ReceivedBalanceOrRecentlySchema.optional().describe("Receive order compensation funds."),
|
|
73
|
+
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."),
|
|
74
|
+
um: z.union([NameOrAddressSchema, z.null()]).optional().describe("Contact object ID or name."),
|
|
75
|
+
pause: z.boolean().optional().describe("Whether to pause accepting new orders."),
|
|
76
|
+
publish: z.boolean().optional().describe("Whether to publish the Service. After publishing, customers can place orders; at the same time, service commitments such as machine, order_allocators, arbitrations, etc. will be immutable."),
|
|
77
|
+
}).strict().describe("On-chain Service operations. USAGE: (1) CREATE NEW: Set 'object' field with OBJECT format {name, type_parameter, permission, ...} to create a Service. 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.");
|
|
78
|
+
export const CallService_InputSchema = z.object({
|
|
79
|
+
data: CallService_DataSchema,
|
|
80
|
+
env: CallEnvSchema.optional(),
|
|
81
|
+
submission: SubmissionCallSchema.optional(),
|
|
82
|
+
}).strict();
|
|
@@ -1 +1,71 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TypedPermissionObjectSchema, CoinParamSchema, NamedObjectSchema, SubmissionCallSchema, CallEnvSchema } from "./base.js";
|
|
3
|
+
import { AmountFromDepositGuardSchema, AmountFromWithdrawGuardSchema, PaymentInfoSchema } from "../query/index.js";
|
|
4
|
+
import { AccountOrMark_AddressSchema, DescriptionSchema, ReceivedBalanceOrRecentlySchema, ReceivedObjectsOrRecentlySchema, NameOrAddressSchema } from "../common/index.js";
|
|
5
|
+
import { BalanceTypeSchema } from "../common/index.js";
|
|
6
|
+
export const DepositSchema = z.object({
|
|
7
|
+
coin: CoinParamSchema.describe("Asset to deposit"),
|
|
8
|
+
by_external_deposit_guard: z.string().optional().describe("Deposit by verifying the specified Guard object ID or name; if not specified, deposit through Permission"),
|
|
9
|
+
payment_info: PaymentInfoSchema,
|
|
10
|
+
namedNewPayment: NamedObjectSchema.optional().describe("After deposit, create a new Payment object. You can specify a name for this object"),
|
|
11
|
+
}).strict();
|
|
12
|
+
export const WithdrawSchema = z.object({
|
|
13
|
+
amount: z.union([
|
|
14
|
+
z.object({ fixed: BalanceTypeSchema
|
|
15
|
+
}).strict().describe("Fixed withdrawal amount, this method can only withdraw through Permission"),
|
|
16
|
+
z.object({ by_external_withdraw_guard: z.string().describe("Withdraw by verifying the specified Guard object ID or name (the amount is the value of the index number corresponding to the Guard object); if not specified, withdraw through Permission") }).strict(),
|
|
17
|
+
]).describe("Withdrawal amount"),
|
|
18
|
+
recipient: AccountOrMark_AddressSchema.describe("ID or account to receive assets"),
|
|
19
|
+
payment_info: PaymentInfoSchema,
|
|
20
|
+
namedNewPayment: NamedObjectSchema.optional().describe("After withdrawal, create a new Payment object. You can specify a name for this object"),
|
|
21
|
+
}).strict();
|
|
22
|
+
export const ExternalDepositGuardSchema = z.discriminatedUnion("op", [
|
|
23
|
+
z.object({
|
|
24
|
+
op: z.literal("add"),
|
|
25
|
+
guards: z.array(AmountFromDepositGuardSchema),
|
|
26
|
+
}).strict(),
|
|
27
|
+
z.object({
|
|
28
|
+
op: z.literal("set"),
|
|
29
|
+
guards: z.array(AmountFromDepositGuardSchema),
|
|
30
|
+
}).strict(),
|
|
31
|
+
z.object({
|
|
32
|
+
op: z.literal("remove"),
|
|
33
|
+
guards: z.array(NameOrAddressSchema).describe("List of Guard object IDs or names to remove"),
|
|
34
|
+
}).strict(),
|
|
35
|
+
z.object({
|
|
36
|
+
op: z.literal("clear"),
|
|
37
|
+
}).strict(),
|
|
38
|
+
]);
|
|
39
|
+
export const ExternalWithdrawGuardSchema = z.discriminatedUnion("op", [
|
|
40
|
+
z.object({
|
|
41
|
+
op: z.literal("add"),
|
|
42
|
+
guards: z.array(AmountFromWithdrawGuardSchema),
|
|
43
|
+
}).strict(),
|
|
44
|
+
z.object({
|
|
45
|
+
op: z.literal("set"),
|
|
46
|
+
guards: z.array(AmountFromWithdrawGuardSchema),
|
|
47
|
+
}).strict(),
|
|
48
|
+
z.object({
|
|
49
|
+
op: z.literal("remove"),
|
|
50
|
+
guards: z.array(NameOrAddressSchema).describe("List of Guard object IDs or names to remove"),
|
|
51
|
+
}).strict(),
|
|
52
|
+
z.object({
|
|
53
|
+
op: z.literal("clear"),
|
|
54
|
+
}).strict(),
|
|
55
|
+
]);
|
|
56
|
+
export const CallTreasury_DataSchema = z.object({
|
|
57
|
+
object: TypedPermissionObjectSchema,
|
|
58
|
+
description: DescriptionSchema.optional(),
|
|
59
|
+
receive: ReceivedBalanceOrRecentlySchema.optional().describe("Receive CoinWrapper objects received by the object and deposit them into its balance."),
|
|
60
|
+
deposit: DepositSchema.optional().describe("Deposit to Treasury object"),
|
|
61
|
+
withdraw: WithdrawSchema.optional().describe("Withdraw from Treasury object"),
|
|
62
|
+
external_deposit_guard: ExternalDepositGuardSchema.optional().describe("Set external deposit Guard for Treasury object"),
|
|
63
|
+
external_withdraw_guard: ExternalWithdrawGuardSchema.optional().describe("Set external withdrawal Guard for Treasury object"),
|
|
64
|
+
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."),
|
|
65
|
+
um: z.union([NamedObjectSchema, z.null()]).optional().describe("Contact object."),
|
|
66
|
+
}).strict().describe("On-chain Treasury operations. USAGE: (1) CREATE NEW: Set 'object' field with OBJECT format {name, type_parameter, permission, ...} to create a Treasury. 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.");
|
|
67
|
+
export const CallTreasury_InputSchema = z.object({
|
|
68
|
+
data: CallTreasury_DataSchema,
|
|
69
|
+
env: CallEnvSchema.optional(),
|
|
70
|
+
submission: SubmissionCallSchema.optional(),
|
|
71
|
+
}).strict();
|