wowok_agent 2.1.37 → 2.1.39
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.d.ts +45 -2
- package/dist/index.js +1 -1319
- package/dist/schema/call/allocation.js +1 -27
- package/dist/schema/call/arbitration.js +1 -106
- package/dist/schema/call/base.js +1 -152
- package/dist/schema/call/contact.js +1 -41
- package/dist/schema/call/demand.js +1 -51
- package/dist/schema/call/guard.d.ts +6 -6
- package/dist/schema/call/guard.js +1 -67
- package/dist/schema/call/handler.d.ts +0 -45
- package/dist/schema/call/handler.js +1 -214
- package/dist/schema/call/index.js +1 -19
- package/dist/schema/call/machine.js +1 -164
- package/dist/schema/call/order.js +1 -39
- package/dist/schema/call/payment.js +1 -20
- package/dist/schema/call/permission.js +1 -118
- package/dist/schema/call/personal.js +1 -81
- package/dist/schema/call/progress.js +1 -28
- package/dist/schema/call/proof.js +1 -27
- package/dist/schema/call/repository.js +1 -85
- package/dist/schema/call/reward.d.ts +12 -0
- package/dist/schema/call/reward.js +1 -46
- package/dist/schema/call/service.js +1 -88
- package/dist/schema/call/treasury.d.ts +84 -0
- package/dist/schema/call/treasury.js +1 -76
- package/dist/schema/common/index.js +1 -395
- package/dist/schema/index.js +1 -8
- package/dist/schema/local/index.js +1 -913
- package/dist/schema/local/wip.js +1 -230
- package/dist/schema/messenger/index.d.ts +0 -2
- package/dist/schema/messenger/index.js +1 -479
- package/dist/schema/query/index.d.ts +155 -0
- package/dist/schema/query/index.js +1 -1256
- package/dist/schema/utils/guard-parser.js +1 -410
- package/dist/schema/utils/guard-query-utils.js +1 -22
- package/dist/schema/utils/node-parser.d.ts +0 -14
- package/dist/schema/utils/node-parser.js +1 -382
- package/dist/schema/utils/permission-index-utils.js +1 -10
- package/package.json +5 -3
|
@@ -1,76 +1 @@
|
|
|
1
|
-
import { z }
|
|
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
|
-
// Deposit 接口
|
|
7
|
-
export const DepositSchema = z.object({
|
|
8
|
-
coin: CoinParamSchema.describe("Asset to deposit"),
|
|
9
|
-
by_external_deposit_guard: z.string().optional().describe("Deposit by verifying the specified Guard object ID or name; if not specified, deposit through Permission"),
|
|
10
|
-
payment_info: PaymentInfoSchema,
|
|
11
|
-
namedNewPayment: NamedObjectSchema.optional().describe("After deposit, create a new Payment object. You can specify a name for this object"),
|
|
12
|
-
}).strict();
|
|
13
|
-
// Withdraw 接口
|
|
14
|
-
export const WithdrawSchema = z.object({
|
|
15
|
-
amount: z.union([
|
|
16
|
-
z.object({ fixed: BalanceTypeSchema
|
|
17
|
-
}).strict().describe("Fixed withdrawal amount, this method can only withdraw through Permission"),
|
|
18
|
-
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(),
|
|
19
|
-
]).describe("Withdrawal amount"),
|
|
20
|
-
recipient: AccountOrMark_AddressSchema.describe("ID or account to receive assets"),
|
|
21
|
-
payment_info: PaymentInfoSchema,
|
|
22
|
-
namedNewPayment: NamedObjectSchema.optional().describe("After withdrawal, create a new Payment object. You can specify a name for this object"),
|
|
23
|
-
}).strict();
|
|
24
|
-
// ExternalDepositGuard 操作类型
|
|
25
|
-
export const ExternalDepositGuardSchema = z.discriminatedUnion("op", [
|
|
26
|
-
z.object({
|
|
27
|
-
op: z.literal("add"),
|
|
28
|
-
guards: z.array(AmountFromDepositGuardSchema),
|
|
29
|
-
}).strict(),
|
|
30
|
-
z.object({
|
|
31
|
-
op: z.literal("set"),
|
|
32
|
-
guards: z.array(AmountFromDepositGuardSchema),
|
|
33
|
-
}).strict(),
|
|
34
|
-
z.object({
|
|
35
|
-
op: z.literal("remove"),
|
|
36
|
-
guards: z.array(NameOrAddressSchema).describe("List of Guard object IDs or names to remove"),
|
|
37
|
-
}).strict(),
|
|
38
|
-
z.object({
|
|
39
|
-
op: z.literal("clear"),
|
|
40
|
-
}).strict(),
|
|
41
|
-
]);
|
|
42
|
-
// ExternalWithdrawGuard 操作类型
|
|
43
|
-
export const ExternalWithdrawGuardSchema = z.discriminatedUnion("op", [
|
|
44
|
-
z.object({
|
|
45
|
-
op: z.literal("add"),
|
|
46
|
-
guards: z.array(AmountFromWithdrawGuardSchema),
|
|
47
|
-
}).strict(),
|
|
48
|
-
z.object({
|
|
49
|
-
op: z.literal("set"),
|
|
50
|
-
guards: z.array(AmountFromWithdrawGuardSchema),
|
|
51
|
-
}).strict(),
|
|
52
|
-
z.object({
|
|
53
|
-
op: z.literal("remove"),
|
|
54
|
-
guards: z.array(NameOrAddressSchema).describe("List of Guard object IDs or names to remove"),
|
|
55
|
-
}).strict(),
|
|
56
|
-
z.object({
|
|
57
|
-
op: z.literal("clear"),
|
|
58
|
-
}).strict(),
|
|
59
|
-
]);
|
|
60
|
-
// CallTreasury_Data 接口
|
|
61
|
-
export const CallTreasury_DataSchema = z.object({
|
|
62
|
-
object: TypedPermissionObjectSchema,
|
|
63
|
-
description: DescriptionSchema.optional(),
|
|
64
|
-
receive: ReceivedBalanceOrRecentlySchema.optional().describe("Receive CoinWrapper objects received by the object and deposit them into its balance."),
|
|
65
|
-
deposit: DepositSchema.optional().describe("Deposit to Treasury object"),
|
|
66
|
-
withdraw: WithdrawSchema.optional().describe("Withdraw from Treasury object"),
|
|
67
|
-
external_deposit_guard: ExternalDepositGuardSchema.optional().describe("Set external deposit Guard for Treasury object"),
|
|
68
|
-
external_withdraw_guard: ExternalWithdrawGuardSchema.optional().describe("Set external withdrawal Guard for Treasury object"),
|
|
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([NamedObjectSchema, z.null()]).optional().describe("Contact object."),
|
|
71
|
-
}).strict().describe("On-chain Treasury operations. USAGE: (1) CREATE NEW: Set 'object' field with {name, type, 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 object ID or name. The 'object' field is CRITICAL and REQUIRED in both cases.");
|
|
72
|
-
export const CallTreasury_InputSchema = z.object({
|
|
73
|
-
data: CallTreasury_DataSchema,
|
|
74
|
-
env: CallEnvSchema.optional(),
|
|
75
|
-
submission: SubmissionCallSchema.optional(),
|
|
76
|
-
}).strict();
|
|
1
|
+
import{z}from'zod';import{TypedPermissionObjectSchema,CoinParamSchema,NamedObjectSchema,SubmissionCallSchema,CallEnvSchema}from'./base.js';import{AmountFromDepositGuardSchema,AmountFromWithdrawGuardSchema,PaymentInfoSchema}from'../query/index.js';import{AccountOrMark_AddressSchema,DescriptionSchema,ReceivedBalanceOrRecentlySchema,ReceivedObjectsOrRecentlySchema,NameOrAddressSchema}from'../common/index.js';import{BalanceTypeSchema}from'../common/index.js';export const DepositSchema=z['object']({'coin':CoinParamSchema['describe']('Asset\x20to\x20deposit'),'by_external_deposit_guard':z['string']()['optional']()['describe']('Deposit\x20by\x20verifying\x20the\x20specified\x20Guard\x20object\x20ID\x20or\x20name;\x20if\x20not\x20specified,\x20deposit\x20through\x20Permission'),'payment_info':PaymentInfoSchema,'namedNewPayment':NamedObjectSchema['optional']()['describe']('After\x20deposit,\x20create\x20a\x20new\x20Payment\x20object.\x20You\x20can\x20specify\x20a\x20name\x20for\x20this\x20object')})['strict']();export const WithdrawSchema=z['object']({'amount':z['union']([z['object']({'fixed':BalanceTypeSchema})['strict']()['describe']('Fixed\x20withdrawal\x20amount,\x20this\x20method\x20can\x20only\x20withdraw\x20through\x20Permission'),z['object']({'by_external_withdraw_guard':z['string']()['describe']('Withdraw\x20by\x20verifying\x20the\x20specified\x20Guard\x20object\x20ID\x20or\x20name\x20(the\x20amount\x20is\x20the\x20value\x20of\x20the\x20index\x20number\x20corresponding\x20to\x20the\x20Guard\x20object);\x20if\x20not\x20specified,\x20withdraw\x20through\x20Permission')})['strict']()])['describe']('Withdrawal\x20amount'),'recipient':AccountOrMark_AddressSchema['describe']('ID\x20or\x20account\x20to\x20receive\x20assets'),'payment_info':PaymentInfoSchema,'namedNewPayment':NamedObjectSchema['optional']()['describe']('After\x20withdrawal,\x20create\x20a\x20new\x20Payment\x20object.\x20You\x20can\x20specify\x20a\x20name\x20for\x20this\x20object')})['strict']();export const ExternalDepositGuardSchema=z['discriminatedUnion']('op',[z['object']({'op':z['literal']('add'),'guards':z['array'](AmountFromDepositGuardSchema)})['strict'](),z['object']({'op':z['literal']('set'),'guards':z['array'](AmountFromDepositGuardSchema)})['strict'](),z['object']({'op':z['literal']('remove'),'guards':z['array'](NameOrAddressSchema)['describe']('List\x20of\x20Guard\x20object\x20IDs\x20or\x20names\x20to\x20remove')})['strict'](),z['object']({'op':z['literal']('clear')})['strict']()]);export const ExternalWithdrawGuardSchema=z['discriminatedUnion']('op',[z['object']({'op':z['literal']('add'),'guards':z['array'](AmountFromWithdrawGuardSchema)})['strict'](),z['object']({'op':z['literal']('set'),'guards':z['array'](AmountFromWithdrawGuardSchema)})['strict'](),z['object']({'op':z['literal']('remove'),'guards':z['array'](NameOrAddressSchema)['describe']('List\x20of\x20Guard\x20object\x20IDs\x20or\x20names\x20to\x20remove')})['strict'](),z['object']({'op':z['literal']('clear')})['strict']()]);export const CallTreasury_DataSchema=z['object']({'object':TypedPermissionObjectSchema,'description':DescriptionSchema['optional'](),'receive':ReceivedBalanceOrRecentlySchema['optional']()['describe']('Receive\x20CoinWrapper\x20objects\x20received\x20by\x20the\x20object\x20and\x20deposit\x20them\x20into\x20its\x20balance.'),'deposit':DepositSchema['optional']()['describe']('Deposit\x20to\x20Treasury\x20object'),'withdraw':WithdrawSchema['optional']()['describe']('Withdraw\x20from\x20Treasury\x20object'),'external_deposit_guard':ExternalDepositGuardSchema['optional']()['describe']('Set\x20external\x20deposit\x20Guard\x20for\x20Treasury\x20object'),'external_withdraw_guard':ExternalWithdrawGuardSchema['optional']()['describe']('Set\x20external\x20withdrawal\x20Guard\x20for\x20Treasury\x20object'),'owner_receive':ReceivedObjectsOrRecentlySchema['optional']()['describe']('Unwrap\x20CoinWrapper\x20objects\x20and\x20other\x20objects\x20received\x20by\x20this\x20object\x20and\x20send\x20them\x20to\x20the\x20owner\x20of\x20its\x20Permission\x20object.'),'um':z['union']([NamedObjectSchema,z['null']()])['optional']()['describe']('Contact\x20object.')})['strict']()['describe']('On-chain\x20Treasury\x20operations.\x20USAGE:\x20(1)\x20CREATE\x20NEW:\x20Set\x20\x27object\x27\x20field\x20with\x20OBJECT\x20format\x20{name,\x20type_parameter,\x20permission,\x20...}\x20to\x20create\x20a\x20Treasury.\x20NOTE:\x20\x27name\x27\x20goes\x20INSIDE\x20\x27object\x27,\x20NOT\x20at\x20the\x20data\x20root\x20level.\x20\x27permission\x27\x20can\x20be\x20a\x20new\x20Permission\x20object\x20or\x20reference\x20an\x20existing\x20one\x20-\x20check\x20\x27object\x27\x20field\x20description\x20for\x20details.\x20(2)\x20OPERATE\x20EXISTING:\x20Set\x20\x27object\x27\x20field\x20with\x20STRING\x20format\x20(object\x20ID\x20or\x20name).\x20The\x20\x27object\x27\x20field\x20is\x20CRITICAL\x20and\x20REQUIRED\x20in\x20both\x20cases.\x20STRING\x20for\x20existing,\x20OBJECT\x20for\x20new\x20creation.');export const CallTreasury_InputSchema=z['object']({'data':CallTreasury_DataSchema,'env':CallEnvSchema['optional'](),'submission':SubmissionCallSchema['optional']()})['strict']();
|
|
@@ -1,395 +1 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { isValidAddress, ValueType as WowValueType, ObjectType as WowObjectType, ENTRYPOINT, isValidWowAddress, isValidName, isValidDescription, MAX_DESCRIPTION_LENGTH, isValidLongName, MAX_LONG_NAME_LENGTH } from "wowok";
|
|
3
|
-
// ============================================================
|
|
4
|
-
// Address Schema - Address format validation
|
|
5
|
-
// ============================================================
|
|
6
|
-
const isValidMoveIdentifier = (s) => {
|
|
7
|
-
if (s.length === 0)
|
|
8
|
-
return false;
|
|
9
|
-
const firstChar = s[0];
|
|
10
|
-
if (firstChar === '_') {
|
|
11
|
-
return s.length > 1 && /^[a-zA-Z0-9_]+$/.test(s.slice(1));
|
|
12
|
-
}
|
|
13
|
-
if (/^[a-zA-Z]$/.test(firstChar)) {
|
|
14
|
-
return /^[a-zA-Z0-9_]*$/.test(s.slice(1));
|
|
15
|
-
}
|
|
16
|
-
return false;
|
|
17
|
-
};
|
|
18
|
-
export const DescriptionSchema = z
|
|
19
|
-
.string()
|
|
20
|
-
.refine(isValidDescription, {
|
|
21
|
-
message: `Description string (max ${MAX_DESCRIPTION_LENGTH} bcs characters)`
|
|
22
|
-
})
|
|
23
|
-
.describe(`Description string (max ${MAX_DESCRIPTION_LENGTH} bcs characters)`);
|
|
24
|
-
export const LongNameSchema = z
|
|
25
|
-
.string()
|
|
26
|
-
.refine(isValidLongName, {
|
|
27
|
-
message: `max ${MAX_LONG_NAME_LENGTH} bcs characters`
|
|
28
|
-
});
|
|
29
|
-
export const WowAddressSchema = z
|
|
30
|
-
.string()
|
|
31
|
-
.refine(isValidAddress, {
|
|
32
|
-
// or a builtin ID (0x5-0x9, @0xaaa, @0xaab, @0x403, @0xacc, @0xc)
|
|
33
|
-
message: "Invalid ID format: must be '0x' prefix followed by 64 hex characters"
|
|
34
|
-
})
|
|
35
|
-
.describe("Valid ID: 0x prefix + 64 hex characters, or builtin ID (0x5-0x9, @0xaaa, @0xaab, @0x403, @0xacc, @0xc)");
|
|
36
|
-
// ============================================================
|
|
37
|
-
// TokenType Schema - Token type format validation
|
|
38
|
-
// ============================================================
|
|
39
|
-
const WOW_TOKEN_TYPE = "0x2::wow::WOW";
|
|
40
|
-
export const TokenTypeSchema = z
|
|
41
|
-
.string()
|
|
42
|
-
.refine((val) => {
|
|
43
|
-
if (val === WOW_TOKEN_TYPE)
|
|
44
|
-
return true;
|
|
45
|
-
const parts = val.split("::");
|
|
46
|
-
if (parts.length !== 3)
|
|
47
|
-
return false;
|
|
48
|
-
const [address, module, structName] = parts;
|
|
49
|
-
if (!isValidWowAddress(address))
|
|
50
|
-
return false;
|
|
51
|
-
if (!isValidMoveIdentifier(module))
|
|
52
|
-
return false;
|
|
53
|
-
if (!isValidMoveIdentifier(structName))
|
|
54
|
-
return false;
|
|
55
|
-
return true;
|
|
56
|
-
}, {
|
|
57
|
-
message: "Invalid token type format. Expected: {address}::{module}::{struct} where address is 0x+64hex, module/struct are valid Move identifiers, or '0x2::wow::WOW'"
|
|
58
|
-
})
|
|
59
|
-
.describe("Token type in format: {address}::{module}::{struct}. Example: 0x2::wow::WOW");
|
|
60
|
-
export const TokenTypeWithDefaultSchema = TokenTypeSchema
|
|
61
|
-
.default(WOW_TOKEN_TYPE)
|
|
62
|
-
.describe("Token type in format: {address}::{module}::{struct}. Default: 0x2::wow::WOW");
|
|
63
|
-
// ============================================================
|
|
64
|
-
// Name Schema - Name format validation
|
|
65
|
-
// ============================================================
|
|
66
|
-
export const NameSchema = z
|
|
67
|
-
.string()
|
|
68
|
-
.refine(isValidName, "Name string (max 64 bcs characters, must not start with '0x')");
|
|
69
|
-
export const NotEmptyNameSchema = z.string().nonempty()
|
|
70
|
-
.refine(isValidName, "Name string (at least 1 character, max length 64 bcs characters)");
|
|
71
|
-
// ============================================================
|
|
72
|
-
// NameOrAddress Schema - Name or address
|
|
73
|
-
// ============================================================
|
|
74
|
-
export const NameOrAddressSchema = z
|
|
75
|
-
.string()
|
|
76
|
-
.refine((val) => {
|
|
77
|
-
if (isValidWowAddress(val))
|
|
78
|
-
return true;
|
|
79
|
-
if (isValidName(val))
|
|
80
|
-
return true;
|
|
81
|
-
return false;
|
|
82
|
-
}, {
|
|
83
|
-
message: "Invalid ID format: must be '0x' prefix, or a builtin ID (0x5-0x9, @0xaaa, @0xaab, @0x403, @0xacc, @0xc)"
|
|
84
|
-
}).describe("Account/Object name or ID. If specifying an account, use empty string '' for the default account. " +
|
|
85
|
-
"If it starts with '0x', it will be treated as an ID. " +
|
|
86
|
-
"Otherwise, it will be treated as a name (max 64 bcs characters).");
|
|
87
|
-
// Define AccountOrMark_Address schema
|
|
88
|
-
export const AccountOrMark_AddressSchema = z.object({
|
|
89
|
-
name_or_address: NameOrAddressSchema.optional(),
|
|
90
|
-
local_mark_first: z.boolean().optional().describe("Whether to prioritize local marks, if true, prioritize local marks, otherwise prioritize global marks"),
|
|
91
|
-
}).strict().describe("Account or address lookup object. Use this to specify which account to use for an operation. " +
|
|
92
|
-
"EXAMPLE: { name_or_address: 'testor2' } - looks up account by name; " +
|
|
93
|
-
"EXAMPLE: { name_or_address: '0x1234...' } - uses address directly; " +
|
|
94
|
-
"If name_or_address is empty string '', uses the default local account.");
|
|
95
|
-
// Define ManyAccountOrMark_Address schema
|
|
96
|
-
export const ManyAccountOrMark_AddressSchema = z.object({
|
|
97
|
-
entities: z.array(AccountOrMark_AddressSchema),
|
|
98
|
-
check_all_founded: z.boolean().optional().describe("Whether to check all entities are found, if true, all entities must be found (abort and throw exception if any ID not found); if false, only return found IDs"),
|
|
99
|
-
}).strict().describe("Used to batch find account or object IDs by name");
|
|
100
|
-
// AI-friendly AccountOrMark_Address schema - supports string shorthand
|
|
101
|
-
export const AccountOrMark_AddressAISchema = z.union([
|
|
102
|
-
// Simplified form: direct string, defaults to local_mark_first = true
|
|
103
|
-
z.string().describe("Account name, address (0x...), or mark name. " +
|
|
104
|
-
"When using string format, local marks are searched first. " +
|
|
105
|
-
"EXAMPLE: 'alice' - searches local marks first, then global; " +
|
|
106
|
-
"EXAMPLE: '0x1234...' - uses address directly"),
|
|
107
|
-
// Full form: original object structure for explicit control
|
|
108
|
-
AccountOrMark_AddressSchema
|
|
109
|
-
]).describe("Account or address lookup. Can be a simple string (recommended for AI) " +
|
|
110
|
-
"or full object with explicit local_mark_first control");
|
|
111
|
-
// AI-friendly ManyAccountOrMark_Address schema
|
|
112
|
-
export const ManyAccountOrMark_AddressAISchema = z.union([
|
|
113
|
-
// Simplified form: array of strings
|
|
114
|
-
z.array(z.string()).describe("Array of account names, addresses, or mark names. " +
|
|
115
|
-
"Local marks are searched first for each entry"),
|
|
116
|
-
// Full form: original object structure
|
|
117
|
-
ManyAccountOrMark_AddressSchema
|
|
118
|
-
]).describe("Batch account or address lookup. Can be an array of strings (recommended for AI) " +
|
|
119
|
-
"or full object with explicit control");
|
|
120
|
-
// Define ObjectOwner schema
|
|
121
|
-
export const ObjectOwnerSchema = z.union([
|
|
122
|
-
z.object({
|
|
123
|
-
AddressOwner: z.string().describe("Address owner"),
|
|
124
|
-
}).strict(),
|
|
125
|
-
z.object({
|
|
126
|
-
ObjectOwner: z.string().describe("Object owner"),
|
|
127
|
-
}).strict(),
|
|
128
|
-
z.object({
|
|
129
|
-
Shared: z.object({
|
|
130
|
-
initial_shared_version: z.union([z.string(), z.number()]).describe("Version when object became shared"),
|
|
131
|
-
}).strict().describe("Shared object"),
|
|
132
|
-
}).strict(),
|
|
133
|
-
z.literal("Immutable"),
|
|
134
|
-
z.object({
|
|
135
|
-
ConsensusAddressOwner: z.object({
|
|
136
|
-
owner: z.string().describe("Consensus ID owner"),
|
|
137
|
-
start_version: z.union([z.string(), z.number()]).describe("Version when object recently became consensus object"),
|
|
138
|
-
}).strict().describe("Consensus ID owner"),
|
|
139
|
-
}).strict(),
|
|
140
|
-
]).describe("Object owner");
|
|
141
|
-
// Define ValueType string names for user convenience
|
|
142
|
-
const ValueTypeStringNames = [
|
|
143
|
-
"Bool", "Address", "String", "U8", "U16", "U32", "U64", "U128", "U256",
|
|
144
|
-
"VecBool", "VecAddress", "VecString", "VecU8", "VecU16", "VecU32", "VecU64", "VecU128", "VecU256", "VecVecU8"
|
|
145
|
-
];
|
|
146
|
-
// Define user available ValueType enum (supports both number and string)
|
|
147
|
-
export const ValueTypeUserSchema = z.union([
|
|
148
|
-
z.literal(WowValueType.Bool).describe("Bool (0)"),
|
|
149
|
-
z.literal(WowValueType.Address).describe("Address (1)"),
|
|
150
|
-
z.literal(WowValueType.String).describe("String (2)"),
|
|
151
|
-
z.literal(WowValueType.U8).describe("U8 (3)"),
|
|
152
|
-
z.literal(WowValueType.U16).describe("U16 (4)"),
|
|
153
|
-
z.literal(WowValueType.U32).describe("U32 (5)"),
|
|
154
|
-
z.literal(WowValueType.U64).describe("U64 (6)"),
|
|
155
|
-
z.literal(WowValueType.U128).describe("U128 (7)"),
|
|
156
|
-
z.literal(WowValueType.U256).describe("U256 (8)"),
|
|
157
|
-
z.literal(WowValueType.VecBool).describe("VecBool (9)"),
|
|
158
|
-
z.literal(WowValueType.VecAddress).describe("VecAddress (10)"),
|
|
159
|
-
z.literal(WowValueType.VecString).describe("VecString (11)"),
|
|
160
|
-
z.literal(WowValueType.VecU8).describe("VecU8 (12)"),
|
|
161
|
-
z.literal(WowValueType.VecU16).describe("VecU16 (13)"),
|
|
162
|
-
z.literal(WowValueType.VecU32).describe("VecU32 (14)"),
|
|
163
|
-
z.literal(WowValueType.VecU64).describe("VecU64 (15)"),
|
|
164
|
-
z.literal(WowValueType.VecU128).describe("VecU128 (16)"),
|
|
165
|
-
z.literal(WowValueType.VecU256).describe("VecU256 (17)"),
|
|
166
|
-
z.literal(WowValueType.VecVecU8).describe("VecVecU8 (18)"),
|
|
167
|
-
// String representations (all case variants)
|
|
168
|
-
z.literal("Bool").describe("Bool"),
|
|
169
|
-
z.literal("Address").describe("Address"),
|
|
170
|
-
z.literal("String").describe("String"),
|
|
171
|
-
z.literal("U8").describe("U8"),
|
|
172
|
-
z.literal("U16").describe("U16"),
|
|
173
|
-
z.literal("U32").describe("U32"),
|
|
174
|
-
z.literal("U64").describe("U64"),
|
|
175
|
-
z.literal("U128").describe("U128"),
|
|
176
|
-
z.literal("U256").describe("U256"),
|
|
177
|
-
z.literal("VecBool").describe("VecBool"),
|
|
178
|
-
z.literal("VecAddress").describe("VecAddress"),
|
|
179
|
-
z.literal("VecString").describe("VecString"),
|
|
180
|
-
z.literal("VecU8").describe("VecU8"),
|
|
181
|
-
z.literal("VecU16").describe("VecU16"),
|
|
182
|
-
z.literal("VecU32").describe("VecU32"),
|
|
183
|
-
z.literal("VecU64").describe("VecU64"),
|
|
184
|
-
z.literal("VecU128").describe("VecU128"),
|
|
185
|
-
z.literal("VecU256").describe("VecU256"),
|
|
186
|
-
z.literal("VecVecU8").describe("VecVecU8"),
|
|
187
|
-
// Lowercase variants
|
|
188
|
-
z.literal("bool").describe("bool"),
|
|
189
|
-
z.literal("address").describe("address"),
|
|
190
|
-
z.literal("string").describe("string"),
|
|
191
|
-
z.literal("u8").describe("u8"),
|
|
192
|
-
z.literal("u16").describe("u16"),
|
|
193
|
-
z.literal("u32").describe("u32"),
|
|
194
|
-
z.literal("u64").describe("u64"),
|
|
195
|
-
z.literal("u128").describe("u128"),
|
|
196
|
-
z.literal("u256").describe("u256"),
|
|
197
|
-
z.literal("vecbool").describe("vecbool"),
|
|
198
|
-
z.literal("vecaddress").describe("vecaddress"),
|
|
199
|
-
z.literal("vecstring").describe("vecstring"),
|
|
200
|
-
z.literal("vecu8").describe("vecu8"),
|
|
201
|
-
z.literal("vecu16").describe("vecu16"),
|
|
202
|
-
z.literal("vecu32").describe("vecu32"),
|
|
203
|
-
z.literal("vecu64").describe("vecu64"),
|
|
204
|
-
z.literal("vecu128").describe("vecu128"),
|
|
205
|
-
z.literal("vecu256").describe("vecu256"),
|
|
206
|
-
z.literal("vecvecu8").describe("vecvecu8"),
|
|
207
|
-
]).describe("User available value type (number or string, e.g., 6 or 'U64' or 'u64')");
|
|
208
|
-
// Define ValueType enum (system use, includes Value)
|
|
209
|
-
export const ValueTypeSchema = ValueTypeUserSchema.or(z.literal(WowValueType.Value).describe("Value (19)")).or(z.literal("Value").describe("Value"))
|
|
210
|
-
.describe("Value type (number or string, e.g., 6 or 'U64')");
|
|
211
|
-
// Define ObjectType enum
|
|
212
|
-
export const ObjectTypeSchema = z.enum([
|
|
213
|
-
WowObjectType.Permission,
|
|
214
|
-
WowObjectType.Repository,
|
|
215
|
-
WowObjectType.Arb,
|
|
216
|
-
WowObjectType.Arbitration,
|
|
217
|
-
WowObjectType.Service,
|
|
218
|
-
WowObjectType.Machine,
|
|
219
|
-
WowObjectType.Order,
|
|
220
|
-
WowObjectType.Progress,
|
|
221
|
-
WowObjectType.Payment,
|
|
222
|
-
WowObjectType.Treasury,
|
|
223
|
-
WowObjectType.Guard,
|
|
224
|
-
WowObjectType.Demand,
|
|
225
|
-
WowObjectType.Passport,
|
|
226
|
-
WowObjectType.Allocation,
|
|
227
|
-
WowObjectType.Resource,
|
|
228
|
-
WowObjectType.Reward,
|
|
229
|
-
WowObjectType.Discount,
|
|
230
|
-
WowObjectType.EntityRegistrar,
|
|
231
|
-
WowObjectType.EntityLinker,
|
|
232
|
-
WowObjectType.Proof,
|
|
233
|
-
WowObjectType.WReceivedObject,
|
|
234
|
-
WowObjectType.Contact,
|
|
235
|
-
WowObjectType.TableItem_ProgressHistory,
|
|
236
|
-
WowObjectType.TableItem_PermissionPerm,
|
|
237
|
-
WowObjectType.TableItem_DemandPresenter,
|
|
238
|
-
WowObjectType.TableItem_MachineNode,
|
|
239
|
-
WowObjectType.TableItem_TreasuryHistory,
|
|
240
|
-
WowObjectType.TableItem_RepositoryData,
|
|
241
|
-
WowObjectType.TableItem_RewardRecord,
|
|
242
|
-
WowObjectType.TableItem_EntityLinker,
|
|
243
|
-
WowObjectType.TableItem_AddressMark,
|
|
244
|
-
WowObjectType.TableItem_EntityRegistrar,
|
|
245
|
-
]).describe("Wowok object type");
|
|
246
|
-
// Define BalanceType schema
|
|
247
|
-
export const BalanceTypeSchema = z.union([z.number(), z.string()]).describe("Balance type");
|
|
248
|
-
// Define QueryIdSchema
|
|
249
|
-
export const QueryIdSchema = z.number().int().min(0).describe("Query ID");
|
|
250
|
-
// Define CacheExpireType schema
|
|
251
|
-
export const CacheExpireTypeSchema = z.union([z.number(), z.literal("INFINITE")]).describe("Cache expiration time type");
|
|
252
|
-
// Define ValueContainer schema
|
|
253
|
-
export const ValueContainerSchema = z.lazy(() => z.object({
|
|
254
|
-
valueType: ValueTypeSchema.describe("Value type"),
|
|
255
|
-
value: SupportedValueSchema.describe("Value"),
|
|
256
|
-
}).strict().describe("Value container with type and value"));
|
|
257
|
-
// Define user available SupportedValue schema
|
|
258
|
-
export const SupportedValueUserSchema = z.union([
|
|
259
|
-
z.boolean(),
|
|
260
|
-
z.union([AccountOrMark_AddressSchema, z.string()]),
|
|
261
|
-
z.string(),
|
|
262
|
-
z.number(),
|
|
263
|
-
z.array(z.boolean()),
|
|
264
|
-
z.union([ManyAccountOrMark_AddressSchema, z.array(z.string())]),
|
|
265
|
-
z.array(z.string()),
|
|
266
|
-
z.array(z.number()),
|
|
267
|
-
z.array(z.array(z.number())),
|
|
268
|
-
]).describe("User available supported value type");
|
|
269
|
-
// Define SupportedValue schema (system use, includes Value)
|
|
270
|
-
export const SupportedValueSchema = SupportedValueUserSchema.or(ValueContainerSchema).describe("Supported value type");
|
|
271
|
-
export const GuardIdentifierSchema = z.number().int().min(0).max(255).describe("Identifier (0-255) for data lookup in Guard table.");
|
|
272
|
-
export const GuardTableItemBaseSchema = z.object({
|
|
273
|
-
identifier: GuardIdentifierSchema,
|
|
274
|
-
b_submission: z.boolean().describe("Whether user submission is required for this data"),
|
|
275
|
-
value_type: ValueTypeUserSchema.describe("Type of the value"),
|
|
276
|
-
value: SupportedValueUserSchema.optional().describe("The actual value data"),
|
|
277
|
-
name: z.string().default("").describe("Name or description of this data"),
|
|
278
|
-
}).strict().describe("Guard table item");
|
|
279
|
-
export const GuardTableItemSchema = GuardTableItemBaseSchema.extend({
|
|
280
|
-
object_type: ObjectTypeSchema.optional().describe("Object type when value_type is Address and represents a specific object"),
|
|
281
|
-
}).strict().describe("Guard table item");
|
|
282
|
-
// Define Entrypoint schema
|
|
283
|
-
export const EntrypointSchema = z.enum([
|
|
284
|
-
ENTRYPOINT.Localnet,
|
|
285
|
-
ENTRYPOINT.Testnet,
|
|
286
|
-
]).describe("Network entrypoint: Specifies which network the operation occurs on");
|
|
287
|
-
export const FaucetNetworkSchema = z.enum([
|
|
288
|
-
ENTRYPOINT.Localnet,
|
|
289
|
-
ENTRYPOINT.Testnet,
|
|
290
|
-
]).describe("Network entrypoint for Faucet: Specifies which network the operation occurs on");
|
|
291
|
-
// Define ObjectBase schema
|
|
292
|
-
export const ObjectBaseSchema = z.object({
|
|
293
|
-
object: z.string().describe("Object ID"),
|
|
294
|
-
type: ObjectTypeSchema.optional().describe("Object type"),
|
|
295
|
-
type_raw: z.string().optional().describe("Raw object type"),
|
|
296
|
-
owner: z.union([ObjectOwnerSchema, z.null()]).optional().describe("Object owner"),
|
|
297
|
-
version: z.string().optional().describe("Object version"),
|
|
298
|
-
previousTransaction: z.string().optional().describe("Previous transaction ID"),
|
|
299
|
-
cache_expire: CacheExpireTypeSchema.optional().describe("Cache expiration time"),
|
|
300
|
-
query_name: z.string().optional().describe("Original query name or address used to retrieve this object"),
|
|
301
|
-
_guard_node_comments: z.array(z.object({
|
|
302
|
-
type: z.string(),
|
|
303
|
-
description: z.string()
|
|
304
|
-
})).optional().describe("Additional comments for Guard node instructions"),
|
|
305
|
-
}).passthrough().describe("Object base information");
|
|
306
|
-
// ================================================
|
|
307
|
-
// Received related type definitions
|
|
308
|
-
// ================================================
|
|
309
|
-
// Define QueryEnv schema
|
|
310
|
-
export const QueryEnvSchema = z.object({
|
|
311
|
-
no_cache: z.boolean().optional().describe("Whether to disable cache"),
|
|
312
|
-
network: EntrypointSchema.optional(),
|
|
313
|
-
}).strict().describe("Query environment parameters");
|
|
314
|
-
// Define QueryReceived schema
|
|
315
|
-
export const QueryReceivedSchema = QueryEnvSchema.extend({
|
|
316
|
-
object: z.string().describe("Object ID to query"),
|
|
317
|
-
all_type: z.boolean().optional().describe("Whether to query all types of received objects"),
|
|
318
|
-
cursor: z.union([z.string(), z.null()]).optional().describe("Pagination cursor"),
|
|
319
|
-
limit: z.union([z.number(), z.null()]).optional().describe("Number of records returned per page"),
|
|
320
|
-
}).strict().describe("Request parameters for querying object's received objects");
|
|
321
|
-
// Define ReceivedBalanceObject schema
|
|
322
|
-
export const ReceivedBalanceObjectSchema = z.object({
|
|
323
|
-
id: z.string().describe("Received CoinWrapper object ID"),
|
|
324
|
-
balance: BalanceTypeSchema,
|
|
325
|
-
payment: z.string().describe("Payment object ID"),
|
|
326
|
-
}).strict().describe("Received CoinWrapper object record");
|
|
327
|
-
// Define CoinWrapperTokenType schema - supports CoinWrapper<...> format for owner_receive operations
|
|
328
|
-
export const CoinWrapperTokenTypeSchema = z
|
|
329
|
-
.string()
|
|
330
|
-
.refine((val) => {
|
|
331
|
-
// Support CoinWrapper<...> format
|
|
332
|
-
const match = val.match(/^CoinWrapper<(.+)>$/);
|
|
333
|
-
if (match) {
|
|
334
|
-
const inner = match[1];
|
|
335
|
-
if (inner === WOW_TOKEN_TYPE)
|
|
336
|
-
return true;
|
|
337
|
-
const parts = inner.split("::");
|
|
338
|
-
if (parts.length !== 3)
|
|
339
|
-
return false;
|
|
340
|
-
const [address, module, structName] = parts;
|
|
341
|
-
if (!isValidWowAddress(address))
|
|
342
|
-
return false;
|
|
343
|
-
if (!isValidMoveIdentifier(module))
|
|
344
|
-
return false;
|
|
345
|
-
if (!isValidMoveIdentifier(structName))
|
|
346
|
-
return false;
|
|
347
|
-
return true;
|
|
348
|
-
}
|
|
349
|
-
// Also support plain token type format for backward compatibility
|
|
350
|
-
if (val === WOW_TOKEN_TYPE)
|
|
351
|
-
return true;
|
|
352
|
-
const parts = val.split("::");
|
|
353
|
-
if (parts.length !== 3)
|
|
354
|
-
return false;
|
|
355
|
-
const [address, module, structName] = parts;
|
|
356
|
-
if (!isValidWowAddress(address))
|
|
357
|
-
return false;
|
|
358
|
-
if (!isValidMoveIdentifier(module))
|
|
359
|
-
return false;
|
|
360
|
-
if (!isValidMoveIdentifier(structName))
|
|
361
|
-
return false;
|
|
362
|
-
return true;
|
|
363
|
-
}, {
|
|
364
|
-
message: "Invalid token type format. Expected: CoinWrapper<{address}::{module}::{struct}> or {address}::{module}::{struct}. Example: CoinWrapper<0x2::wow::WOW> or 0x2::wow::WOW"
|
|
365
|
-
})
|
|
366
|
-
.describe("Token type in format: CoinWrapper<{address}::{module}::{struct}> or {address}::{module}::{struct}. Example: CoinWrapper<0x2::wow::WOW>");
|
|
367
|
-
// Define ReceivedBalance schema
|
|
368
|
-
export const ReceivedBalanceSchema = z.object({
|
|
369
|
-
balance: BalanceTypeSchema,
|
|
370
|
-
token_type: CoinWrapperTokenTypeSchema.describe("Asset type of Coin objects. Supports CoinWrapper<...> format for order receive operations."),
|
|
371
|
-
received: z.array(ReceivedBalanceObjectSchema).describe("Received records of Coin objects"),
|
|
372
|
-
}).strict().describe("Received record of Coin objects");
|
|
373
|
-
// Define ReceivedBalanceOrRecently schema
|
|
374
|
-
export const ReceivedBalanceOrRecentlySchema = z.union([
|
|
375
|
-
ReceivedBalanceSchema,
|
|
376
|
-
z.literal("recently")
|
|
377
|
-
]).describe("Specified received balance record or all recently received balance record");
|
|
378
|
-
// Define ReceivedNormal schema
|
|
379
|
-
export const ReceivedNormalSchema = z.object({
|
|
380
|
-
id: z.string().nonempty().describe("Received object ID"),
|
|
381
|
-
type: z.string().nonempty().describe("Object type")
|
|
382
|
-
}).strict().describe("Received normal object record");
|
|
383
|
-
// Define ReceivedObjectsOrRecently schema
|
|
384
|
-
export const ReceivedObjectsOrRecentlySchema = z.union([
|
|
385
|
-
z.array(ReceivedNormalSchema),
|
|
386
|
-
ReceivedBalanceSchema,
|
|
387
|
-
z.literal("recently"),
|
|
388
|
-
]).describe("Specified received object records or all recently received object records");
|
|
389
|
-
// Define QueryReceivedResult schema
|
|
390
|
-
export const QueryReceivedResultSchema = z.object({
|
|
391
|
-
result: z.union([
|
|
392
|
-
ReceivedBalanceSchema,
|
|
393
|
-
z.array(ReceivedNormalSchema),
|
|
394
|
-
]).describe("Received CoinWrapper object record or received other objects array")
|
|
395
|
-
}).strict().describe("Query received result");
|
|
1
|
+
import{z}from'zod';import{isValidAddress,ValueType as a20a,ObjectType as a20b,ENTRYPOINT,isValidWowAddress,isValidName,isValidDescription,MAX_DESCRIPTION_LENGTH,isValidLongName,MAX_LONG_NAME_LENGTH}from'wowok';const isValidMoveIdentifier=a=>{if(a['length']===0x0)return![];const b=a[0x0];if(b==='_')return a['length']>0x1&&/^[a-zA-Z0-9_]+$/['test'](a['slice'](0x1));if(/^[a-zA-Z]$/['test'](b))return/^[a-zA-Z0-9_]*$/['test'](a['slice'](0x1));return![];};export const DescriptionSchema=z['string']()['refine'](isValidDescription,{'message':'Description\x20string\x20(max\x20'+MAX_DESCRIPTION_LENGTH+'\x20bcs\x20characters)'})['describe']('Description\x20string\x20(max\x20'+MAX_DESCRIPTION_LENGTH+'\x20bcs\x20characters)');export const LongNameSchema=z['string']()['refine'](isValidLongName,{'message':'max\x20'+MAX_LONG_NAME_LENGTH+'\x20bcs\x20characters'});export const WowAddressSchema=z['string']()['refine'](isValidAddress,{'message':'Invalid\x20ID\x20format:\x20must\x20be\x20\x270x\x27\x20prefix\x20followed\x20by\x2064\x20hex\x20characters'})['describe']('Valid\x20ID:\x200x\x20prefix\x20+\x2064\x20hex\x20characters,\x20or\x20builtin\x20ID\x20(0x5-0x9,\x20@0xaaa,\x20@0xaab,\x20@0x403,\x20@0xacc,\x20@0xc)');const WOW_TOKEN_TYPE='0x2::wow::WOW';export const TokenTypeSchema=z['string']()['refine'](a=>{if(a===WOW_TOKEN_TYPE)return!![];const b=a['split']('::');if(b['length']!==0x3)return![];const [c,d,e]=b;if(!isValidWowAddress(c))return![];if(!isValidMoveIdentifier(d))return![];if(!isValidMoveIdentifier(e))return![];return!![];},{'message':'Invalid\x20token\x20type\x20format.\x20Expected:\x20{address}::{module}::{struct}\x20where\x20address\x20is\x200x+64hex,\x20module/struct\x20are\x20valid\x20Move\x20identifiers,\x20or\x20\x270x2::wow::WOW\x27'})['describe']('Token\x20type\x20in\x20format:\x20{address}::{module}::{struct}.\x20Example:\x200x2::wow::WOW');export const TokenTypeWithDefaultSchema=TokenTypeSchema['default'](WOW_TOKEN_TYPE)['describe']('Token\x20type\x20in\x20format:\x20{address}::{module}::{struct}.\x20Default:\x200x2::wow::WOW');export const NameSchema=z['string']()['refine'](isValidName,'Name\x20string\x20(max\x2064\x20bcs\x20characters,\x20must\x20not\x20start\x20with\x20\x270x\x27)');export const NotEmptyNameSchema=z['string']()['nonempty']()['refine'](isValidName,'Name\x20string\x20(at\x20least\x201\x20character,\x20max\x20length\x2064\x20bcs\x20characters)');export const NameOrAddressSchema=z['string']()['refine'](a=>{if(isValidWowAddress(a))return!![];if(isValidName(a))return!![];return![];},{'message':'Invalid\x20ID\x20format:\x20must\x20be\x20\x270x\x27\x20prefix,\x20or\x20a\x20builtin\x20ID\x20(0x5-0x9,\x20@0xaaa,\x20@0xaab,\x20@0x403,\x20@0xacc,\x20@0xc)'})['describe']('Account/Object\x20name\x20or\x20ID.\x20If\x20specifying\x20an\x20account,\x20use\x20empty\x20string\x20\x27\x27\x20for\x20the\x20default\x20account.\x20'+'If\x20it\x20starts\x20with\x20\x270x\x27,\x20it\x20will\x20be\x20treated\x20as\x20an\x20ID.\x20'+'Otherwise,\x20it\x20will\x20be\x20treated\x20as\x20a\x20name\x20(max\x2064\x20bcs\x20characters).');export const AccountOrMark_AddressSchema=z['object']({'name_or_address':NameOrAddressSchema['optional'](),'local_mark_first':z['boolean']()['optional']()['describe']('Whether\x20to\x20prioritize\x20local\x20marks,\x20if\x20true,\x20prioritize\x20local\x20marks,\x20otherwise\x20prioritize\x20global\x20marks')})['strict']()['describe']('Account\x20or\x20address\x20lookup\x20object.\x20Use\x20this\x20to\x20specify\x20which\x20account\x20to\x20use\x20for\x20an\x20operation.\x20'+'EXAMPLE:\x20{\x20name_or_address:\x20\x27testor2\x27\x20}\x20-\x20looks\x20up\x20account\x20by\x20name;\x20'+'EXAMPLE:\x20{\x20name_or_address:\x20\x270x1234...\x27\x20}\x20-\x20uses\x20address\x20directly;\x20'+'If\x20name_or_address\x20is\x20empty\x20string\x20\x27\x27,\x20uses\x20the\x20default\x20local\x20account.');export const ManyAccountOrMark_AddressSchema=z['object']({'entities':z['array'](AccountOrMark_AddressSchema),'check_all_founded':z['boolean']()['optional']()['describe']('Whether\x20to\x20check\x20all\x20entities\x20are\x20found,\x20if\x20true,\x20all\x20entities\x20must\x20be\x20found\x20(abort\x20and\x20throw\x20exception\x20if\x20any\x20ID\x20not\x20found);\x20if\x20false,\x20only\x20return\x20found\x20IDs')})['strict']()['describe']('Used\x20to\x20batch\x20find\x20account\x20or\x20object\x20IDs\x20by\x20name');export const AccountOrMark_AddressAISchema=z['union']([z['string']()['describe']('Account\x20name,\x20address\x20(0x...),\x20or\x20mark\x20name.\x20'+'When\x20using\x20string\x20format,\x20local\x20marks\x20are\x20searched\x20first.\x20'+'EXAMPLE:\x20\x27alice\x27\x20-\x20searches\x20local\x20marks\x20first,\x20then\x20global;\x20'+'EXAMPLE:\x20\x270x1234...\x27\x20-\x20uses\x20address\x20directly'),AccountOrMark_AddressSchema])['describe']('Account\x20or\x20address\x20lookup.\x20Can\x20be\x20a\x20simple\x20string\x20(recommended\x20for\x20AI)\x20'+'or\x20full\x20object\x20with\x20explicit\x20local_mark_first\x20control');export const ManyAccountOrMark_AddressAISchema=z['union']([z['array'](z['string']())['describe']('Array\x20of\x20account\x20names,\x20addresses,\x20or\x20mark\x20names.\x20'+'Local\x20marks\x20are\x20searched\x20first\x20for\x20each\x20entry'),ManyAccountOrMark_AddressSchema])['describe']('Batch\x20account\x20or\x20address\x20lookup.\x20Can\x20be\x20an\x20array\x20of\x20strings\x20(recommended\x20for\x20AI)\x20'+'or\x20full\x20object\x20with\x20explicit\x20control');export const ObjectOwnerSchema=z['union']([z['object']({'AddressOwner':z['string']()['describe']('Address\x20owner')})['strict'](),z['object']({'ObjectOwner':z['string']()['describe']('Object\x20owner')})['strict'](),z['object']({'Shared':z['object']({'initial_shared_version':z['union']([z['string'](),z['number']()])['describe']('Version\x20when\x20object\x20became\x20shared')})['strict']()['describe']('Shared\x20object')})['strict'](),z['literal']('Immutable'),z['object']({'ConsensusAddressOwner':z['object']({'owner':z['string']()['describe']('Consensus\x20ID\x20owner'),'start_version':z['union']([z['string'](),z['number']()])['describe']('Version\x20when\x20object\x20recently\x20became\x20consensus\x20object')})['strict']()['describe']('Consensus\x20ID\x20owner')})['strict']()])['describe']('Object\x20owner');const ValueTypeStringNames=['Bool','Address','String','U8','U16','U32','U64','U128','U256','VecBool','VecAddress','VecString','VecU8','VecU16','VecU32','VecU64','VecU128','VecU256','VecVecU8'];export const ValueTypeUserSchema=z['union']([z['literal'](a20a['Bool'])['describe']('Bool\x20(0)'),z['literal'](a20a['Address'])['describe']('Address\x20(1)'),z['literal'](a20a['String'])['describe']('String\x20(2)'),z['literal'](a20a['U8'])['describe']('U8\x20(3)'),z['literal'](a20a['U16'])['describe']('U16\x20(4)'),z['literal'](a20a['U32'])['describe']('U32\x20(5)'),z['literal'](a20a['U64'])['describe']('U64\x20(6)'),z['literal'](a20a['U128'])['describe']('U128\x20(7)'),z['literal'](a20a['U256'])['describe']('U256\x20(8)'),z['literal'](a20a['VecBool'])['describe']('VecBool\x20(9)'),z['literal'](a20a['VecAddress'])['describe']('VecAddress\x20(10)'),z['literal'](a20a['VecString'])['describe']('VecString\x20(11)'),z['literal'](a20a['VecU8'])['describe']('VecU8\x20(12)'),z['literal'](a20a['VecU16'])['describe']('VecU16\x20(13)'),z['literal'](a20a['VecU32'])['describe']('VecU32\x20(14)'),z['literal'](a20a['VecU64'])['describe']('VecU64\x20(15)'),z['literal'](a20a['VecU128'])['describe']('VecU128\x20(16)'),z['literal'](a20a['VecU256'])['describe']('VecU256\x20(17)'),z['literal'](a20a['VecVecU8'])['describe']('VecVecU8\x20(18)'),z['literal']('Bool')['describe']('Bool'),z['literal']('Address')['describe']('Address'),z['literal']('String')['describe']('String'),z['literal']('U8')['describe']('U8'),z['literal']('U16')['describe']('U16'),z['literal']('U32')['describe']('U32'),z['literal']('U64')['describe']('U64'),z['literal']('U128')['describe']('U128'),z['literal']('U256')['describe']('U256'),z['literal']('VecBool')['describe']('VecBool'),z['literal']('VecAddress')['describe']('VecAddress'),z['literal']('VecString')['describe']('VecString'),z['literal']('VecU8')['describe']('VecU8'),z['literal']('VecU16')['describe']('VecU16'),z['literal']('VecU32')['describe']('VecU32'),z['literal']('VecU64')['describe']('VecU64'),z['literal']('VecU128')['describe']('VecU128'),z['literal']('VecU256')['describe']('VecU256'),z['literal']('VecVecU8')['describe']('VecVecU8'),z['literal']('bool')['describe']('bool'),z['literal']('address')['describe']('address'),z['literal']('string')['describe']('string'),z['literal']('u8')['describe']('u8'),z['literal']('u16')['describe']('u16'),z['literal']('u32')['describe']('u32'),z['literal']('u64')['describe']('u64'),z['literal']('u128')['describe']('u128'),z['literal']('u256')['describe']('u256'),z['literal']('vecbool')['describe']('vecbool'),z['literal']('vecaddress')['describe']('vecaddress'),z['literal']('vecstring')['describe']('vecstring'),z['literal']('vecu8')['describe']('vecu8'),z['literal']('vecu16')['describe']('vecu16'),z['literal']('vecu32')['describe']('vecu32'),z['literal']('vecu64')['describe']('vecu64'),z['literal']('vecu128')['describe']('vecu128'),z['literal']('vecu256')['describe']('vecu256'),z['literal']('vecvecu8')['describe']('vecvecu8')])['describe']('User\x20available\x20value\x20type\x20(number\x20or\x20string,\x20e.g.,\x206\x20or\x20\x27U64\x27\x20or\x20\x27u64\x27)');export const ValueTypeSchema=ValueTypeUserSchema['or'](z['literal'](a20a['Value'])['describe']('Value\x20(19)'))['or'](z['literal']('Value')['describe']('Value'))['describe']('Value\x20type\x20(number\x20or\x20string,\x20e.g.,\x206\x20or\x20\x27U64\x27)');export const ObjectTypeSchema=z['enum']([a20b['Permission'],a20b['Repository'],a20b['Arb'],a20b['Arbitration'],a20b['Service'],a20b['Machine'],a20b['Order'],a20b['Progress'],a20b['Payment'],a20b['Treasury'],a20b['Guard'],a20b['Demand'],a20b['Passport'],a20b['Allocation'],a20b['Resource'],a20b['Reward'],a20b['Discount'],a20b['EntityRegistrar'],a20b['EntityLinker'],a20b['Proof'],a20b['WReceivedObject'],a20b['Contact'],a20b['TableItem_ProgressHistory'],a20b['TableItem_PermissionPerm'],a20b['TableItem_DemandPresenter'],a20b['TableItem_MachineNode'],a20b['TableItem_TreasuryHistory'],a20b['TableItem_RepositoryData'],a20b['TableItem_RewardRecord'],a20b['TableItem_EntityLinker'],a20b['TableItem_AddressMark'],a20b['TableItem_EntityRegistrar']])['describe']('Wowok\x20object\x20type');export const BalanceTypeSchema=z['union']([z['number'](),z['string']()])['describe']('Balance\x20type');export const QueryIdSchema=z['number']()['int']()['min'](0x0)['describe']('Query\x20ID');export const CacheExpireTypeSchema=z['union']([z['number'](),z['literal']('INFINITE')])['describe']('Cache\x20expiration\x20time\x20type');export const ValueContainerSchema=z['lazy'](()=>z['object']({'valueType':ValueTypeSchema['describe']('Value\x20type'),'value':SupportedValueSchema['describe']('Value')})['strict']()['describe']('Value\x20container\x20with\x20type\x20and\x20value'));export const SupportedValueUserSchema=z['union']([z['boolean'](),z['union']([AccountOrMark_AddressSchema,z['string']()]),z['string'](),z['number'](),z['array'](z['boolean']()),z['union']([ManyAccountOrMark_AddressSchema,z['array'](z['string']())]),z['array'](z['string']()),z['array'](z['number']()),z['array'](z['array'](z['number']()))])['describe']('User\x20available\x20supported\x20value\x20type');export const SupportedValueSchema=SupportedValueUserSchema['or'](ValueContainerSchema)['describe']('Supported\x20value\x20type');export const GuardIdentifierSchema=z['number']()['int']()['min'](0x0)['max'](0xff)['describe']('Identifier\x20(0-255)\x20for\x20data\x20lookup\x20in\x20Guard\x20table.');export const GuardTableItemBaseSchema=z['object']({'identifier':GuardIdentifierSchema,'b_submission':z['boolean']()['describe']('Whether\x20user\x20submission\x20is\x20required\x20for\x20this\x20data'),'value_type':ValueTypeUserSchema['describe']('Type\x20of\x20the\x20value'),'value':SupportedValueUserSchema['optional']()['describe']('The\x20actual\x20value\x20data'),'name':z['string']()['default']('')['describe']('Name\x20or\x20description\x20of\x20this\x20data')})['strict']()['describe']('Guard\x20table\x20item');export const GuardTableItemSchema=GuardTableItemBaseSchema['extend']({'object_type':ObjectTypeSchema['optional']()['describe']('Object\x20type\x20when\x20value_type\x20is\x20Address\x20and\x20represents\x20a\x20specific\x20object')})['strict']()['describe']('Guard\x20table\x20item');export const EntrypointSchema=z['enum']([ENTRYPOINT['Localnet'],ENTRYPOINT['Testnet']])['describe']('Network\x20entrypoint:\x20Specifies\x20which\x20network\x20the\x20operation\x20occurs\x20on');export const FaucetNetworkSchema=z['enum']([ENTRYPOINT['Localnet'],ENTRYPOINT['Testnet']])['describe']('Network\x20entrypoint\x20for\x20Faucet:\x20Specifies\x20which\x20network\x20the\x20operation\x20occurs\x20on');export const ObjectBaseSchema=z['object']({'object':z['string']()['describe']('Object\x20ID'),'type':ObjectTypeSchema['optional']()['describe']('Object\x20type'),'type_raw':z['string']()['optional']()['describe']('Raw\x20object\x20type'),'owner':z['union']([ObjectOwnerSchema,z['null']()])['optional']()['describe']('Object\x20owner'),'version':z['string']()['optional']()['describe']('Object\x20version'),'previousTransaction':z['string']()['optional']()['describe']('Previous\x20transaction\x20ID'),'cache_expire':CacheExpireTypeSchema['optional']()['describe']('Cache\x20expiration\x20time'),'query_name':z['string']()['optional']()['describe']('Original\x20query\x20name\x20or\x20address\x20used\x20to\x20retrieve\x20this\x20object'),'_guard_node_comments':z['array'](z['object']({'type':z['string'](),'description':z['string']()}))['optional']()['describe']('Additional\x20comments\x20for\x20Guard\x20node\x20instructions')})['passthrough']()['describe']('Object\x20base\x20information');export const QueryEnvSchema=z['object']({'no_cache':z['boolean']()['optional']()['describe']('Whether\x20to\x20disable\x20cache'),'network':EntrypointSchema['optional']()})['strict']()['describe']('Query\x20environment\x20parameters');export const QueryReceivedSchema=QueryEnvSchema['extend']({'object':z['string']()['describe']('Object\x20ID\x20to\x20query'),'all_type':z['boolean']()['optional']()['describe']('Whether\x20to\x20query\x20all\x20types\x20of\x20received\x20objects'),'cursor':z['union']([z['string'](),z['null']()])['optional']()['describe']('Pagination\x20cursor'),'limit':z['union']([z['number'](),z['null']()])['optional']()['describe']('Number\x20of\x20records\x20returned\x20per\x20page')})['strict']()['describe']('Request\x20parameters\x20for\x20querying\x20object\x27s\x20received\x20objects');export const ReceivedBalanceObjectSchema=z['object']({'id':z['string']()['describe']('Received\x20CoinWrapper\x20object\x20ID'),'balance':BalanceTypeSchema,'payment':z['string']()['describe']('Payment\x20object\x20ID')})['strict']()['describe']('Received\x20CoinWrapper\x20object\x20record');export const CoinWrapperTokenTypeSchema=z['string']()['refine'](a=>{const b=a['match'](/^CoinWrapper<(.+)>$/);if(b){const g=b[0x1];if(g===WOW_TOKEN_TYPE)return!![];const h=g['split']('::');if(h['length']!==0x3)return![];const [i,j,k]=h;if(!isValidWowAddress(i))return![];if(!isValidMoveIdentifier(j))return![];if(!isValidMoveIdentifier(k))return![];return!![];}if(a===WOW_TOKEN_TYPE)return!![];const c=a['split']('::');if(c['length']!==0x3)return![];const [d,e,f]=c;if(!isValidWowAddress(d))return![];if(!isValidMoveIdentifier(e))return![];if(!isValidMoveIdentifier(f))return![];return!![];},{'message':'Invalid\x20token\x20type\x20format.\x20Expected:\x20CoinWrapper<{address}::{module}::{struct}>\x20or\x20{address}::{module}::{struct}.\x20Example:\x20CoinWrapper<0x2::wow::WOW>\x20or\x200x2::wow::WOW'})['describe']('Token\x20type\x20in\x20format:\x20CoinWrapper<{address}::{module}::{struct}>\x20or\x20{address}::{module}::{struct}.\x20Example:\x20CoinWrapper<0x2::wow::WOW>');export const ReceivedBalanceSchema=z['object']({'balance':BalanceTypeSchema,'token_type':CoinWrapperTokenTypeSchema['describe']('Asset\x20type\x20of\x20Coin\x20objects.\x20Supports\x20CoinWrapper<...>\x20format\x20for\x20order\x20receive\x20operations.'),'received':z['array'](ReceivedBalanceObjectSchema)['describe']('Received\x20records\x20of\x20Coin\x20objects')})['strict']()['describe']('Received\x20record\x20of\x20Coin\x20objects');export const ReceivedBalanceOrRecentlySchema=z['union']([ReceivedBalanceSchema,z['literal']('recently')])['describe']('Specified\x20received\x20balance\x20record\x20or\x20all\x20recently\x20received\x20balance\x20record');export const ReceivedNormalSchema=z['object']({'id':z['string']()['nonempty']()['describe']('Received\x20object\x20ID'),'type':z['string']()['nonempty']()['describe']('Object\x20type')})['strict']()['describe']('Received\x20normal\x20object\x20record');export const ReceivedObjectsOrRecentlySchema=z['union']([z['array'](ReceivedNormalSchema),ReceivedBalanceSchema,z['literal']('recently')])['describe']('Specified\x20received\x20object\x20records\x20or\x20all\x20recently\x20received\x20object\x20records');export const QueryReceivedResultSchema=z['object']({'result':z['union']([ReceivedBalanceSchema,z['array'](ReceivedNormalSchema)])['describe']('Received\x20CoinWrapper\x20object\x20record\x20or\x20received\x20other\x20objects\x20array')})['strict']()['describe']('Query\x20received\x20result');
|
package/dist/schema/index.js
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export * from './call/index.js';
|
|
3
|
-
export * from './query/index.js';
|
|
4
|
-
export * from './local/index.js';
|
|
5
|
-
export * from './messenger/index.js';
|
|
6
|
-
export * from './common/index.js';
|
|
7
|
-
export * from './utils/guard-parser.js';
|
|
8
|
-
export * from './utils/node-parser.js';
|
|
1
|
+
export*from'./call/index.js';export*from'./query/index.js';export*from'./local/index.js';export*from'./messenger/index.js';export*from'./common/index.js';export*from'./utils/guard-parser.js';export*from'./utils/node-parser.js';
|