wowok_agent 1.6.6 → 2.1.9

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.
Files changed (181) hide show
  1. package/README.md +20 -40
  2. package/dist/index.d.ts +6 -27
  3. package/dist/index.js +1026 -27
  4. package/dist/schema/call/allocation.d.ts +8 -0
  5. package/dist/schema/call/allocation.js +27 -0
  6. package/dist/schema/call/arbitration.d.ts +27 -0
  7. package/dist/schema/call/arbitration.js +106 -0
  8. package/dist/schema/call/base.d.ts +41 -0
  9. package/dist/schema/call/base.js +152 -0
  10. package/dist/schema/call/contact.d.ts +9 -0
  11. package/dist/schema/call/contact.js +41 -0
  12. package/dist/schema/call/demand.d.ts +10 -0
  13. package/dist/schema/call/demand.js +51 -0
  14. package/dist/schema/call/guard.d.ts +15 -0
  15. package/dist/schema/call/guard.js +67 -0
  16. package/dist/schema/call/handler.d.ts +80 -0
  17. package/dist/schema/call/handler.js +177 -0
  18. package/dist/schema/call/index.d.ts +18 -0
  19. package/dist/schema/call/index.js +19 -0
  20. package/dist/schema/call/machine.d.ts +23 -0
  21. package/dist/schema/call/machine.js +164 -0
  22. package/dist/schema/call/order.d.ts +11 -0
  23. package/dist/schema/call/order.js +39 -0
  24. package/dist/schema/call/payment.d.ts +7 -0
  25. package/dist/schema/call/payment.js +20 -0
  26. package/dist/schema/call/permission.d.ts +27 -0
  27. package/dist/schema/call/permission.js +118 -0
  28. package/dist/schema/call/personal.d.ts +27 -0
  29. package/dist/schema/call/personal.js +81 -0
  30. package/dist/schema/call/progress.d.ts +6 -0
  31. package/dist/schema/call/progress.js +37 -0
  32. package/dist/schema/call/proof.d.ts +7 -0
  33. package/dist/schema/call/proof.js +27 -0
  34. package/dist/schema/call/repository.d.ts +15 -0
  35. package/dist/schema/call/repository.js +85 -0
  36. package/dist/schema/call/reward.d.ts +7 -0
  37. package/dist/schema/call/reward.js +46 -0
  38. package/dist/schema/call/service.d.ts +7 -0
  39. package/dist/schema/call/service.js +87 -0
  40. package/dist/schema/call/treasury.d.ts +6 -0
  41. package/dist/schema/call/treasury.js +76 -0
  42. package/dist/schema/common/index.d.ts +57 -0
  43. package/dist/schema/common/index.js +331 -0
  44. package/dist/schema/index.d.ts +7 -0
  45. package/dist/schema/index.js +8 -0
  46. package/dist/schema/local/index.d.ts +120 -0
  47. package/dist/schema/local/index.js +913 -0
  48. package/dist/schema/local/wip.d.ts +33 -0
  49. package/dist/schema/local/wip.js +229 -0
  50. package/dist/schema/messenger/index.d.ts +34 -0
  51. package/dist/schema/messenger/index.js +407 -0
  52. package/dist/schema/query/index.d.ts +240 -0
  53. package/dist/schema/query/index.js +1313 -0
  54. package/dist/schema/utils/guard-parser.d.ts +20 -0
  55. package/dist/schema/utils/guard-parser.js +410 -0
  56. package/dist/schema/utils/guard-query-utils.d.ts +5 -0
  57. package/dist/schema/utils/guard-query-utils.js +22 -0
  58. package/dist/schema/utils/node-parser.d.ts +59 -0
  59. package/dist/schema/utils/node-parser.js +382 -0
  60. package/dist/schema/utils/permission-index-utils.d.ts +2 -0
  61. package/dist/schema/utils/permission-index-utils.js +10 -0
  62. package/package.json +31 -49
  63. package/LICENSE +0 -201
  64. package/dist/call/arbitration.d.ts +0 -57
  65. package/dist/call/arbitration.d.ts.map +0 -1
  66. package/dist/call/arbitration.js +0 -245
  67. package/dist/call/arbitration.js.map +0 -1
  68. package/dist/call/base.d.ts +0 -85
  69. package/dist/call/base.d.ts.map +0 -1
  70. package/dist/call/base.js +0 -231
  71. package/dist/call/base.js.map +0 -1
  72. package/dist/call/call.d.ts +0 -95
  73. package/dist/call/call.d.ts.map +0 -1
  74. package/dist/call/call.js +0 -149
  75. package/dist/call/call.js.map +0 -1
  76. package/dist/call/demand.d.ts +0 -46
  77. package/dist/call/demand.d.ts.map +0 -1
  78. package/dist/call/demand.js +0 -201
  79. package/dist/call/demand.js.map +0 -1
  80. package/dist/call/guard.d.ts +0 -53
  81. package/dist/call/guard.d.ts.map +0 -1
  82. package/dist/call/guard.js +0 -386
  83. package/dist/call/guard.js.map +0 -1
  84. package/dist/call/machine.d.ts +0 -97
  85. package/dist/call/machine.d.ts.map +0 -1
  86. package/dist/call/machine.js +0 -342
  87. package/dist/call/machine.js.map +0 -1
  88. package/dist/call/object_permission.d.ts +0 -14
  89. package/dist/call/object_permission.d.ts.map +0 -1
  90. package/dist/call/object_permission.js +0 -59
  91. package/dist/call/object_permission.js.map +0 -1
  92. package/dist/call/permission.d.ts +0 -63
  93. package/dist/call/permission.d.ts.map +0 -1
  94. package/dist/call/permission.js +0 -137
  95. package/dist/call/permission.js.map +0 -1
  96. package/dist/call/personal.d.ts +0 -47
  97. package/dist/call/personal.d.ts.map +0 -1
  98. package/dist/call/personal.js +0 -119
  99. package/dist/call/personal.js.map +0 -1
  100. package/dist/call/repository.d.ts +0 -117
  101. package/dist/call/repository.d.ts.map +0 -1
  102. package/dist/call/repository.js +0 -408
  103. package/dist/call/repository.js.map +0 -1
  104. package/dist/call/service.d.ts +0 -115
  105. package/dist/call/service.d.ts.map +0 -1
  106. package/dist/call/service.js +0 -550
  107. package/dist/call/service.js.map +0 -1
  108. package/dist/call/treasury.d.ts +0 -46
  109. package/dist/call/treasury.d.ts.map +0 -1
  110. package/dist/call/treasury.js +0 -222
  111. package/dist/call/treasury.js.map +0 -1
  112. package/dist/common.d.ts +0 -12
  113. package/dist/common.d.ts.map +0 -1
  114. package/dist/common.js +0 -71
  115. package/dist/common.js.map +0 -1
  116. package/dist/index.d.ts.map +0 -1
  117. package/dist/index.js.map +0 -1
  118. package/dist/local/.d.ts +0 -20
  119. package/dist/local/.d.ts.map +0 -1
  120. package/dist/local/.js +0 -76
  121. package/dist/local/.js.map +0 -1
  122. package/dist/local/account.d.ts +0 -42
  123. package/dist/local/account.d.ts.map +0 -1
  124. package/dist/local/account.js +0 -335
  125. package/dist/local/account.js.map +0 -1
  126. package/dist/local/cache.d.ts +0 -32
  127. package/dist/local/cache.d.ts.map +0 -1
  128. package/dist/local/cache.js +0 -77
  129. package/dist/local/cache.js.map +0 -1
  130. package/dist/local/coin.d.ts +0 -22
  131. package/dist/local/coin.d.ts.map +0 -1
  132. package/dist/local/coin.js +0 -123
  133. package/dist/local/coin.js.map +0 -1
  134. package/dist/local/config.d.ts +0 -20
  135. package/dist/local/config.d.ts.map +0 -1
  136. package/dist/local/config.js +0 -75
  137. package/dist/local/config.js.map +0 -1
  138. package/dist/local/index.d.ts +0 -110
  139. package/dist/local/index.d.ts.map +0 -1
  140. package/dist/local/index.js +0 -122
  141. package/dist/local/index.js.map +0 -1
  142. package/dist/local/local.d.ts +0 -55
  143. package/dist/local/local.d.ts.map +0 -1
  144. package/dist/local/local.js +0 -248
  145. package/dist/local/local.js.map +0 -1
  146. package/dist/query/events.d.ts +0 -65
  147. package/dist/query/events.d.ts.map +0 -1
  148. package/dist/query/events.js +0 -75
  149. package/dist/query/events.js.map +0 -1
  150. package/dist/query/objects.d.ts +0 -346
  151. package/dist/query/objects.d.ts.map +0 -1
  152. package/dist/query/objects.js +0 -472
  153. package/dist/query/objects.js.map +0 -1
  154. package/dist/query/permission.d.ts +0 -15
  155. package/dist/query/permission.d.ts.map +0 -1
  156. package/dist/query/permission.js +0 -45
  157. package/dist/query/permission.js.map +0 -1
  158. package/dist/query/received.d.ts +0 -16
  159. package/dist/query/received.d.ts.map +0 -1
  160. package/dist/query/received.js +0 -16
  161. package/dist/query/received.js.map +0 -1
  162. package/dist/schema/call.d.ts +0 -13005
  163. package/dist/schema/call.d.ts.map +0 -1
  164. package/dist/schema/call.js +0 -997
  165. package/dist/schema/call.js.map +0 -1
  166. package/dist/schema/const.d.ts +0 -254
  167. package/dist/schema/const.d.ts.map +0 -1
  168. package/dist/schema/const.js +0 -305
  169. package/dist/schema/const.js.map +0 -1
  170. package/dist/schema/local.d.ts +0 -702
  171. package/dist/schema/local.d.ts.map +0 -1
  172. package/dist/schema/local.js +0 -150
  173. package/dist/schema/local.js.map +0 -1
  174. package/dist/schema/query.d.ts +0 -1465
  175. package/dist/schema/query.d.ts.map +0 -1
  176. package/dist/schema/query.js +0 -224
  177. package/dist/schema/query.js.map +0 -1
  178. package/dist/schema/util.d.ts +0 -71
  179. package/dist/schema/util.d.ts.map +0 -1
  180. package/dist/schema/util.js +0 -139
  181. package/dist/schema/util.js.map +0 -1
@@ -0,0 +1,76 @@
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 } 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(NamedObjectSchema),
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(NamedObjectSchema),
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,
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();
@@ -0,0 +1,57 @@
1
+ import { z } from "zod";
2
+ export declare const DescriptionSchema: any;
3
+ export declare const LongNameSchema: any;
4
+ export declare const WowAddressSchema: any;
5
+ export declare const TokenTypeSchema: any;
6
+ export declare const TokenTypeWithDefaultSchema: any;
7
+ export declare const NameSchema: any;
8
+ export declare const NotEmptyNameSchema: any;
9
+ export declare const NameOrAddressSchema: any;
10
+ export declare const AccountOrMark_AddressSchema: any;
11
+ export declare const ManyAccountOrMark_AddressSchema: any;
12
+ export declare const ObjectOwnerSchema: any;
13
+ export declare const ValueTypeUserSchema: any;
14
+ export declare const ValueTypeSchema: any;
15
+ export declare const ObjectTypeSchema: any;
16
+ export declare const BalanceTypeSchema: any;
17
+ export declare const QueryIdSchema: any;
18
+ export declare const CacheExpireTypeSchema: any;
19
+ export declare const ValueContainerSchema: z.ZodType<any>;
20
+ export declare const SupportedValueUserSchema: any;
21
+ export declare const SupportedValueSchema: any;
22
+ export declare const GuardIdentifierSchema: any;
23
+ export declare const GuardTableItemBaseSchema: any;
24
+ export declare const GuardTableItemSchema: any;
25
+ export declare const EntrypointSchema: any;
26
+ export declare const FaucetNetworkSchema: any;
27
+ export declare const ObjectBaseSchema: any;
28
+ export declare const QueryEnvSchema: any;
29
+ export declare const QueryReceivedSchema: any;
30
+ export declare const ReceivedBalanceObjectSchema: any;
31
+ export declare const ReceivedBalanceSchema: any;
32
+ export declare const ReceivedBalanceOrRecentlySchema: any;
33
+ export declare const ReceivedNormalSchema: any;
34
+ export declare const ReceivedObjectsOrRecentlySchema: any;
35
+ export declare const QueryReceivedResultSchema: any;
36
+ export type WowAddress = z.infer<typeof WowAddressSchema>;
37
+ export type TokenType = z.infer<typeof TokenTypeSchema>;
38
+ export type Name = z.infer<typeof NameSchema>;
39
+ export type NameOrAddress = z.infer<typeof NameOrAddressSchema>;
40
+ export type AccountOrMark_Address = z.infer<typeof AccountOrMark_AddressSchema>;
41
+ export type ManyAccountOrMark_Address = z.infer<typeof ManyAccountOrMark_AddressSchema>;
42
+ export type ObjectOwner = z.infer<typeof ObjectOwnerSchema>;
43
+ export type ValueType = z.infer<typeof ValueTypeSchema>;
44
+ export type ObjectType = z.infer<typeof ObjectTypeSchema>;
45
+ export type BalanceType = z.infer<typeof BalanceTypeSchema>;
46
+ export type QueryId = z.infer<typeof QueryIdSchema>;
47
+ export type CacheExpireType = z.infer<typeof CacheExpireTypeSchema>;
48
+ export type SupportedValue = z.infer<typeof SupportedValueSchema>;
49
+ export type GuardIdentifier = z.infer<typeof GuardIdentifierSchema>;
50
+ export type GuardTableItem = z.infer<typeof GuardTableItemSchema>;
51
+ export type Entrypoint = z.infer<typeof EntrypointSchema>;
52
+ export type ObjectBase = z.infer<typeof ObjectBaseSchema>;
53
+ export type QueryEnv = z.infer<typeof QueryEnvSchema>;
54
+ export type QueryReceived = z.infer<typeof QueryReceivedSchema>;
55
+ export type ReceivedBalance = z.infer<typeof ReceivedBalanceSchema>;
56
+ export type ReceivedNormal = z.infer<typeof ReceivedNormalSchema>;
57
+ export type QueryReceivedResult = z.infer<typeof QueryReceivedResultSchema>;
@@ -0,0 +1,331 @@
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
+ // Define ObjectOwner schema
101
+ export const ObjectOwnerSchema = z.union([
102
+ z.object({
103
+ AddressOwner: z.string().describe("Address owner"),
104
+ }).strict(),
105
+ z.object({
106
+ ObjectOwner: z.string().describe("Object owner"),
107
+ }).strict(),
108
+ z.object({
109
+ Shared: z.object({
110
+ initial_shared_version: z.union([z.string(), z.number()]).describe("Version when object became shared"),
111
+ }).strict().describe("Shared object"),
112
+ }).strict(),
113
+ z.literal("Immutable"),
114
+ z.object({
115
+ ConsensusAddressOwner: z.object({
116
+ owner: z.string().describe("Consensus ID owner"),
117
+ start_version: z.union([z.string(), z.number()]).describe("Version when object recently became consensus object"),
118
+ }).strict().describe("Consensus ID owner"),
119
+ }).strict(),
120
+ ]).describe("Object owner");
121
+ // Define ValueType string names for user convenience
122
+ const ValueTypeStringNames = [
123
+ "Bool", "Address", "String", "U8", "U16", "U32", "U64", "U128", "U256",
124
+ "VecBool", "VecAddress", "VecString", "VecU8", "VecU16", "VecU32", "VecU64", "VecU128", "VecU256", "VecVecU8"
125
+ ];
126
+ // Define user available ValueType enum (supports both number and string)
127
+ export const ValueTypeUserSchema = z.union([
128
+ z.literal(WowValueType.Bool).describe("Bool (0)"),
129
+ z.literal(WowValueType.Address).describe("Address (1)"),
130
+ z.literal(WowValueType.String).describe("String (2)"),
131
+ z.literal(WowValueType.U8).describe("U8 (3)"),
132
+ z.literal(WowValueType.U16).describe("U16 (4)"),
133
+ z.literal(WowValueType.U32).describe("U32 (5)"),
134
+ z.literal(WowValueType.U64).describe("U64 (6)"),
135
+ z.literal(WowValueType.U128).describe("U128 (7)"),
136
+ z.literal(WowValueType.U256).describe("U256 (8)"),
137
+ z.literal(WowValueType.VecBool).describe("VecBool (9)"),
138
+ z.literal(WowValueType.VecAddress).describe("VecAddress (10)"),
139
+ z.literal(WowValueType.VecString).describe("VecString (11)"),
140
+ z.literal(WowValueType.VecU8).describe("VecU8 (12)"),
141
+ z.literal(WowValueType.VecU16).describe("VecU16 (13)"),
142
+ z.literal(WowValueType.VecU32).describe("VecU32 (14)"),
143
+ z.literal(WowValueType.VecU64).describe("VecU64 (15)"),
144
+ z.literal(WowValueType.VecU128).describe("VecU128 (16)"),
145
+ z.literal(WowValueType.VecU256).describe("VecU256 (17)"),
146
+ z.literal(WowValueType.VecVecU8).describe("VecVecU8 (18)"),
147
+ // String representations (all case variants)
148
+ z.literal("Bool").describe("Bool"),
149
+ z.literal("Address").describe("Address"),
150
+ z.literal("String").describe("String"),
151
+ z.literal("U8").describe("U8"),
152
+ z.literal("U16").describe("U16"),
153
+ z.literal("U32").describe("U32"),
154
+ z.literal("U64").describe("U64"),
155
+ z.literal("U128").describe("U128"),
156
+ z.literal("U256").describe("U256"),
157
+ z.literal("VecBool").describe("VecBool"),
158
+ z.literal("VecAddress").describe("VecAddress"),
159
+ z.literal("VecString").describe("VecString"),
160
+ z.literal("VecU8").describe("VecU8"),
161
+ z.literal("VecU16").describe("VecU16"),
162
+ z.literal("VecU32").describe("VecU32"),
163
+ z.literal("VecU64").describe("VecU64"),
164
+ z.literal("VecU128").describe("VecU128"),
165
+ z.literal("VecU256").describe("VecU256"),
166
+ z.literal("VecVecU8").describe("VecVecU8"),
167
+ // Lowercase 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
+ ]).describe("User available value type (number or string, e.g., 6 or 'U64' or 'u64')");
188
+ // Define ValueType enum (system use, includes Value)
189
+ export const ValueTypeSchema = ValueTypeUserSchema.or(z.literal(WowValueType.Value).describe("Value (19)")).or(z.literal("Value").describe("Value"))
190
+ .describe("Value type (number or string, e.g., 6 or 'U64')");
191
+ // Define ObjectType enum
192
+ export const ObjectTypeSchema = z.enum([
193
+ WowObjectType.Permission,
194
+ WowObjectType.Repository,
195
+ WowObjectType.Arb,
196
+ WowObjectType.Arbitration,
197
+ WowObjectType.Service,
198
+ WowObjectType.Machine,
199
+ WowObjectType.Order,
200
+ WowObjectType.Progress,
201
+ WowObjectType.Payment,
202
+ WowObjectType.Treasury,
203
+ WowObjectType.Guard,
204
+ WowObjectType.Demand,
205
+ WowObjectType.Passport,
206
+ WowObjectType.Allocation,
207
+ WowObjectType.Resource,
208
+ WowObjectType.Reward,
209
+ WowObjectType.Discount,
210
+ WowObjectType.EntityRegistrar,
211
+ WowObjectType.EntityLinker,
212
+ WowObjectType.Proof,
213
+ WowObjectType.WReceivedObject,
214
+ WowObjectType.Contact,
215
+ WowObjectType.TableItem_ProgressHistory,
216
+ WowObjectType.TableItem_PermissionPerm,
217
+ WowObjectType.TableItem_DemandPresenter,
218
+ WowObjectType.TableItem_MachineNode,
219
+ WowObjectType.TableItem_TreasuryHistory,
220
+ WowObjectType.TableItem_RepositoryData,
221
+ WowObjectType.TableItem_RewardRecord,
222
+ WowObjectType.TableItem_EntityLinker,
223
+ WowObjectType.TableItem_AddressMark,
224
+ WowObjectType.TableItem_EntityRegistrar,
225
+ ]).describe("Wowok object type");
226
+ // Define BalanceType schema
227
+ export const BalanceTypeSchema = z.union([z.number(), z.string()]).describe("Balance type");
228
+ // Define QueryIdSchema
229
+ export const QueryIdSchema = z.number().int().min(0).describe("Query ID");
230
+ // Define CacheExpireType schema
231
+ export const CacheExpireTypeSchema = z.union([z.number(), z.literal("INFINITE")]).describe("Cache expiration time type");
232
+ // Define ValueContainer schema
233
+ export const ValueContainerSchema = z.lazy(() => z.object({
234
+ valueType: ValueTypeSchema.describe("Value type"),
235
+ value: SupportedValueSchema.describe("Value"),
236
+ }).strict().describe("Value container with type and value"));
237
+ // Define user available SupportedValue schema
238
+ export const SupportedValueUserSchema = z.union([
239
+ z.boolean(),
240
+ z.union([AccountOrMark_AddressSchema, z.string()]),
241
+ z.string(),
242
+ z.number(),
243
+ z.array(z.boolean()),
244
+ z.union([ManyAccountOrMark_AddressSchema, z.array(z.string())]),
245
+ z.array(z.string()),
246
+ z.array(z.number()),
247
+ z.array(z.array(z.number())),
248
+ ]).describe("User available supported value type");
249
+ // Define SupportedValue schema (system use, includes Value)
250
+ export const SupportedValueSchema = SupportedValueUserSchema.or(ValueContainerSchema).describe("Supported value type");
251
+ export const GuardIdentifierSchema = z.number().int().min(0).max(255).describe("Identifier (0-255) for data lookup in Guard table.");
252
+ export const GuardTableItemBaseSchema = z.object({
253
+ identifier: GuardIdentifierSchema,
254
+ b_submission: z.boolean().describe("Whether user submission is required for this data"),
255
+ value_type: ValueTypeUserSchema.describe("Type of the value"),
256
+ value: SupportedValueUserSchema.optional().describe("The actual value data"),
257
+ name: z.string().default("").describe("Name or description of this data"),
258
+ }).strict().describe("Guard table item");
259
+ export const GuardTableItemSchema = GuardTableItemBaseSchema.extend({
260
+ object_type: ObjectTypeSchema.optional().describe("Object type when value_type is Address and represents a specific object"),
261
+ }).strict().describe("Guard table item");
262
+ // Define Entrypoint schema
263
+ export const EntrypointSchema = z.enum([
264
+ ENTRYPOINT.Localnet,
265
+ ENTRYPOINT.Testnet,
266
+ ]).describe("Network entrypoint: Specifies which network the operation occurs on");
267
+ export const FaucetNetworkSchema = z.enum([
268
+ ENTRYPOINT.Localnet,
269
+ ENTRYPOINT.Testnet,
270
+ ]).describe("Network entrypoint for Faucet: Specifies which network the operation occurs on");
271
+ // Define ObjectBase schema
272
+ export const ObjectBaseSchema = z.object({
273
+ object: z.string().describe("Object ID"),
274
+ type: ObjectTypeSchema.optional().describe("Object type"),
275
+ type_raw: z.string().optional().describe("Raw object type"),
276
+ owner: z.union([ObjectOwnerSchema, z.null()]).optional().describe("Object owner"),
277
+ version: z.string().optional().describe("Object version"),
278
+ previousTransaction: z.string().optional().describe("Previous transaction ID"),
279
+ cache_expire: CacheExpireTypeSchema.optional().describe("Cache expiration time"),
280
+ query_name: z.string().optional().describe("Original query name or address used to retrieve this object"),
281
+ }).strict().describe("Object base information");
282
+ // ================================================
283
+ // Received related type definitions
284
+ // ================================================
285
+ // Define QueryEnv schema
286
+ export const QueryEnvSchema = z.object({
287
+ no_cache: z.boolean().optional().describe("Whether to disable cache"),
288
+ network: EntrypointSchema.optional(),
289
+ }).strict().describe("Query environment parameters");
290
+ // Define QueryReceived schema
291
+ export const QueryReceivedSchema = QueryEnvSchema.extend({
292
+ object: z.string().describe("Object ID to query"),
293
+ all_type: z.boolean().optional().describe("Whether to query all types of received objects"),
294
+ cursor: z.union([z.string(), z.null()]).optional().describe("Pagination cursor"),
295
+ limit: z.union([z.number(), z.null()]).optional().describe("Number of records returned per page"),
296
+ }).strict().describe("Request parameters for querying object's received objects");
297
+ // Define ReceivedBalanceObject schema
298
+ export const ReceivedBalanceObjectSchema = z.object({
299
+ id: z.string().describe("Received CoinWrapper object ID"),
300
+ balance: BalanceTypeSchema,
301
+ payment: z.string().describe("Payment object ID"),
302
+ }).strict().describe("Received CoinWrapper object record");
303
+ // Define ReceivedBalance schema
304
+ export const ReceivedBalanceSchema = z.object({
305
+ balance: BalanceTypeSchema,
306
+ token_type: TokenTypeSchema.describe("Asset type of Coin objects"),
307
+ received: z.array(ReceivedBalanceObjectSchema).describe("Received records of Coin objects"),
308
+ }).strict().describe("Received record of Coin objects");
309
+ // Define ReceivedBalanceOrRecently schema
310
+ export const ReceivedBalanceOrRecentlySchema = z.union([
311
+ ReceivedBalanceSchema,
312
+ z.literal("recently")
313
+ ]).describe("Specified received balance record or all recently received balance record");
314
+ // Define ReceivedNormal schema
315
+ export const ReceivedNormalSchema = z.object({
316
+ id: z.string().nonempty().describe("Received object ID"),
317
+ type: z.string().nonempty().describe("Object type")
318
+ }).strict().describe("Received normal object record");
319
+ // Define ReceivedObjectsOrRecently schema
320
+ export const ReceivedObjectsOrRecentlySchema = z.union([
321
+ z.array(ReceivedNormalSchema),
322
+ ReceivedBalanceSchema,
323
+ z.literal("recently"),
324
+ ]).describe("Specified received object records or all recently received object records");
325
+ // Define QueryReceivedResult schema
326
+ export const QueryReceivedResultSchema = z.object({
327
+ result: z.union([
328
+ ReceivedBalanceSchema,
329
+ z.array(ReceivedNormalSchema),
330
+ ]).describe("Received CoinWrapper object record or received other objects array")
331
+ }).strict().describe("Query received result");
@@ -0,0 +1,7 @@
1
+ export * from './call/index.js';
2
+ export * from './query/index.js';
3
+ export * from './local/index.js';
4
+ export * from './messenger/index.js';
5
+ export * from './common/index.js';
6
+ export * from './utils/guard-parser.js';
7
+ export * from './utils/node-parser.js';
@@ -0,0 +1,8 @@
1
+ // Package entry point
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';
@@ -0,0 +1,120 @@
1
+ import { z } from "zod";
2
+ export declare const LocalMarkConstraints: {
3
+ readonly nameMaxLength: 64;
4
+ readonly tagMaxLength: 64;
5
+ readonly tagMaxCount: 50;
6
+ };
7
+ export declare const LocalInfoConstraints: {
8
+ readonly nameMaxLength: 64;
9
+ readonly contentMaxLength: 300;
10
+ readonly contentMaxCount: 50;
11
+ readonly defaultName: "Address of delivery";
12
+ };
13
+ export declare const AccountConstraints: {
14
+ readonly nameMaxLength: 64;
15
+ };
16
+ export declare const ErrorResultSchema: any;
17
+ export declare const createResultSchema: <T extends z.ZodType>(successSchema: T) => any;
18
+ export declare const CoinBalanceSchema: any;
19
+ export declare const CoinStructSchema: any;
20
+ export declare const PaginatedCoinsSchema: any;
21
+ export declare const FaucetCoinInfoSchema: any;
22
+ export declare const EventIdSchema: any;
23
+ export declare const WowEventSchema: any;
24
+ export declare const BalanceChangeSchema: any;
25
+ export declare const GasCostSummarySchema: any;
26
+ export declare const WowObjectRefSchema: any;
27
+ export declare const OwnedObjectRefSchema: any;
28
+ export declare const TransactionBlockEffectsModifiedAtVersionsSchema: any;
29
+ export declare const WowMoveAbortSchema: any;
30
+ export declare const ExecutionStatusSchema: any;
31
+ export declare const WowGasDataSchema: any;
32
+ export declare const WowTransactionBlockKindSchema: any;
33
+ export declare const TransactionBlockDataSchema: any;
34
+ export declare const WowTransactionBlockSchema: any;
35
+ export declare const WowObjectChangeSchema: any;
36
+ export declare const TransactionEffectsSchema: any;
37
+ export declare const WowTransactionBlockResponseSchema: any;
38
+ export declare const MarkParamSchema: any;
39
+ export declare const MarkDataSchema: any;
40
+ export declare const InfoDataInnerSchema: any;
41
+ export declare const InfoDataSchema: any;
42
+ export declare const LocalMarkFilterSchema: any;
43
+ export declare const LocalInfoFilterSchema: any;
44
+ export declare const QueryLocalInfoListSchema: any;
45
+ export declare const QueryAccountSchema: any;
46
+ export declare const QueryAccountResultSchema: any;
47
+ export declare const AccountOperationSchema: any;
48
+ export declare const AccountOperationResultSchema: any;
49
+ export declare const LocalMarkOperationSchema: any;
50
+ export declare const LocalMarkOperationResultSchema: any;
51
+ export declare const LocalInfoOperationSchema: any;
52
+ export declare const LocalInfoOperationResultSchema: any;
53
+ export declare const FetchTokenInfoOperationSchema: any;
54
+ export declare const QueryLocalMarkListSchema: any;
55
+ export declare const QueryLocalMarkListResultSchema: any;
56
+ export declare const AccountFilterSchema: any;
57
+ export declare const QueryAccountListSchema: any;
58
+ export declare const AccountDataSchema: any;
59
+ export declare const QueryAccountListResultSchema: any;
60
+ export declare const QueryLocalInfoListResultSchema: any;
61
+ export declare const TokenTypeInfoSchema: any;
62
+ export declare const TokenDataFilterSchema: any;
63
+ export declare const QueryLocalTokenListResultSchema: any;
64
+ export declare const AccountOperationOutputSchema: any;
65
+ export declare const AccountOperationOutputWrappedSchema: any;
66
+ export declare const LocalMarkOperationOutputSchema: any;
67
+ export declare const LocalMarkOperationOutputWrappedSchema: any;
68
+ export declare const LocalInfoOperationOutputSchema: any;
69
+ export declare const LocalInfoOperationOutputWrappedSchema: any;
70
+ export type CoinBalance = z.infer<typeof CoinBalanceSchema>;
71
+ export type CoinStruct = z.infer<typeof CoinStructSchema>;
72
+ export type PaginatedCoins = z.infer<typeof PaginatedCoinsSchema>;
73
+ export type FaucetCoinInfo = z.infer<typeof FaucetCoinInfoSchema>;
74
+ export type EventId = z.infer<typeof EventIdSchema>;
75
+ export type WowEvent = z.infer<typeof WowEventSchema>;
76
+ export type BalanceChange = z.infer<typeof BalanceChangeSchema>;
77
+ export type GasCostSummary = z.infer<typeof GasCostSummarySchema>;
78
+ export type WowObjectRef = z.infer<typeof WowObjectRefSchema>;
79
+ export type OwnedObjectRef = z.infer<typeof OwnedObjectRefSchema>;
80
+ export type TransactionBlockEffectsModifiedAtVersions = z.infer<typeof TransactionBlockEffectsModifiedAtVersionsSchema>;
81
+ export type WowMoveAbort = z.infer<typeof WowTransactionBlockSchema>;
82
+ export type ExecutionStatus = z.infer<typeof ExecutionStatusSchema>;
83
+ export type WowGasData = z.infer<typeof WowGasDataSchema>;
84
+ export type WowTransactionBlockKind = z.infer<typeof WowTransactionBlockKindSchema>;
85
+ export type TransactionBlockData = z.infer<typeof TransactionBlockDataSchema>;
86
+ export type WowTransactionBlock = z.infer<typeof WowTransactionBlockSchema>;
87
+ export type WowObjectChange = z.infer<typeof WowObjectChangeSchema>;
88
+ export type TransactionEffects = z.infer<typeof TransactionEffectsSchema>;
89
+ export type WowTransactionBlockResponse = z.infer<typeof WowTransactionBlockSchema>;
90
+ export type MarkParam = z.infer<typeof MarkParamSchema>;
91
+ export type MarkData = z.infer<typeof MarkDataSchema>;
92
+ export type InfoDataInner = z.infer<typeof InfoDataInnerSchema>;
93
+ export type InfoData = z.infer<typeof InfoDataSchema>;
94
+ export type QueryAccount = z.infer<typeof QueryAccountSchema>;
95
+ export type QueryAccountResult = z.infer<typeof QueryAccountResultSchema>;
96
+ export type AccountOperation = z.infer<typeof AccountOperationSchema>;
97
+ export type AccountOperationResult = z.infer<typeof AccountOperationResultSchema>;
98
+ export type LocalMarkOperation = z.infer<typeof LocalMarkOperationSchema>;
99
+ export type LocalMarkOperationResult = z.infer<typeof LocalMarkOperationResultSchema>;
100
+ export type LocalInfoOperation = z.infer<typeof LocalInfoOperationSchema>;
101
+ export type FetchTokenInfoOperation = z.infer<typeof FetchTokenInfoOperationSchema>;
102
+ export type LocalMarkFilter = z.infer<typeof LocalMarkFilterSchema>;
103
+ export type LocalInfoFilter = z.infer<typeof LocalInfoFilterSchema>;
104
+ export type AccountData = z.infer<typeof AccountDataSchema>;
105
+ export type TokenTypeInfo = z.infer<typeof TokenTypeInfoSchema>;
106
+ export type TokenDataFilter = z.infer<typeof TokenDataFilterSchema>;
107
+ export type QueryLocalMarkListResult = z.infer<typeof QueryLocalMarkListResultSchema>;
108
+ export type AccountFilter = z.infer<typeof AccountFilterSchema>;
109
+ export type QueryAccountList = z.infer<typeof QueryAccountListSchema>;
110
+ export type QueryAccountListResult = z.infer<typeof QueryAccountListResultSchema>;
111
+ export type QueryLocalInfoList = z.infer<typeof QueryLocalInfoListSchema>;
112
+ export type QueryLocalInfoListResult = z.infer<typeof QueryLocalInfoListResultSchema>;
113
+ export type QueryLocalTokenListResult = z.infer<typeof QueryLocalTokenListResultSchema>;
114
+ export type AccountOperationOutput = z.infer<typeof AccountOperationOutputSchema>;
115
+ export type AccountOperationOutputWrapped = z.infer<typeof AccountOperationOutputWrappedSchema>;
116
+ export type LocalMarkOperationOutput = z.infer<typeof LocalMarkOperationOutputSchema>;
117
+ export type LocalMarkOperationOutputWrapped = z.infer<typeof LocalMarkOperationOutputWrappedSchema>;
118
+ export type LocalInfoOperationOutput = z.infer<typeof LocalInfoOperationOutputSchema>;
119
+ export type LocalInfoOperationOutputWrapped = z.infer<typeof LocalInfoOperationOutputWrappedSchema>;
120
+ export * from "./wip.js";