@wowok/agent-mcp 2.2.13 → 2.2.15

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 (126) hide show
  1. package/README.md +19 -11
  2. package/dist/index.js +44 -100
  3. package/dist/schema/query/index.js +1 -1
  4. package/dist/schema-query/index.d.ts +29 -0
  5. package/dist/schema-query/index.js +149 -0
  6. package/dist/schemas/account_operation.schema.json +255 -0
  7. package/dist/schemas/guard2file.schema.json +71 -0
  8. package/dist/schemas/index.json +139 -0
  9. package/dist/schemas/local_info_operation.schema.json +142 -0
  10. package/dist/schemas/local_mark_operation.schema.json +119 -0
  11. package/dist/schemas/machineNode2file.schema.json +71 -0
  12. package/dist/schemas/messenger_operation.schema.json +1393 -0
  13. package/dist/schemas/onchain_events.schema.json +113 -0
  14. package/dist/schemas/onchain_operations.schema.json +376 -0
  15. package/dist/schemas/onchain_operations_allocation.schema.json +914 -0
  16. package/dist/schemas/onchain_operations_arbitration.schema.json +1166 -0
  17. package/dist/schemas/onchain_operations_contact.schema.json +853 -0
  18. package/dist/schemas/onchain_operations_demand.schema.json +984 -0
  19. package/dist/schemas/onchain_operations_gen_passport.schema.json +1141 -0
  20. package/dist/schemas/onchain_operations_guard.schema.json +713 -0
  21. package/dist/schemas/onchain_operations_machine.schema.json +1347 -0
  22. package/dist/schemas/onchain_operations_order.schema.json +830 -0
  23. package/dist/schemas/onchain_operations_payment.schema.json +717 -0
  24. package/dist/schemas/onchain_operations_permission.schema.json +1088 -0
  25. package/dist/schemas/onchain_operations_personal.schema.json +1282 -0
  26. package/dist/schemas/onchain_operations_progress.schema.json +751 -0
  27. package/dist/schemas/onchain_operations_repository.schema.json +1572 -0
  28. package/dist/schemas/onchain_operations_reward.schema.json +955 -0
  29. package/dist/schemas/onchain_operations_service.schema.json +1411 -0
  30. package/dist/schemas/onchain_operations_treasury.schema.json +1155 -0
  31. package/dist/schemas/onchain_table_data.schema.json +35 -0
  32. package/dist/schemas/query_toolkit.schema.json +32 -0
  33. package/dist/schemas/schema_query.schema.json +33 -0
  34. package/dist/schemas/wip_file.schema.json +27 -0
  35. package/dist/schemas/wowok_buildin_info.schema.json +487 -0
  36. package/package.json +7 -5
  37. package/dist/docs/index.d.ts +0 -3
  38. package/dist/docs/index.js +0 -2
  39. package/dist/docs/loader.d.ts +0 -12
  40. package/dist/docs/loader.js +0 -177
  41. package/dist/docs/search.d.ts +0 -17
  42. package/dist/docs/search.js +0 -325
  43. package/dist/docs/types.d.ts +0 -55
  44. package/dist/docs/types.js +0 -1
  45. package/docs/README.md +0 -249
  46. package/docs/WIP.md +0 -388
  47. package/docs/WTS.md +0 -536
  48. package/docs/docs/account.md +0 -914
  49. package/docs/docs/allocation.md +0 -635
  50. package/docs/docs/arbitration.md +0 -1804
  51. package/docs/docs/arbitration_state_machine.md +0 -270
  52. package/docs/docs/contact.md +0 -709
  53. package/docs/docs/demand.md +0 -948
  54. package/docs/docs/guard.md +0 -1465
  55. package/docs/docs/localinfo.md +0 -432
  56. package/docs/docs/localmark.md +0 -583
  57. package/docs/docs/machine.md +0 -2490
  58. package/docs/docs/messenger.md +0 -2098
  59. package/docs/docs/onchain_events.md +0 -267
  60. package/docs/docs/order.md +0 -1001
  61. package/docs/docs/payment.md +0 -512
  62. package/docs/docs/permission.md +0 -1438
  63. package/docs/docs/personal.md +0 -742
  64. package/docs/docs/progress.md +0 -1748
  65. package/docs/docs/query.md +0 -467
  66. package/docs/docs/repository.md +0 -1043
  67. package/docs/docs/reward.md +0 -833
  68. package/docs/docs/service.md +0 -2130
  69. package/docs/docs/stage-01-introduction.md +0 -243
  70. package/docs/docs/stage-02-trust.md +0 -302
  71. package/docs/docs/stage-03-collaboration.md +0 -337
  72. package/docs/docs/stage-04-transaction.md +0 -277
  73. package/docs/docs/stage-05-business.md +0 -151
  74. package/docs/docs/stage-06-personal.md +0 -203
  75. package/docs/docs/stage-07-query.md +0 -572
  76. package/docs/docs/stage-08-examples.md +0 -184
  77. package/docs/docs/treasury.md +0 -1149
  78. package/docs/docs/wowok_buildin_info.md +0 -740
  79. package/docs/examples/Insurance/Insurance.md +0 -594
  80. package/docs/examples/Insurance/Insurance_TestResults.md +0 -481
  81. package/docs/examples/Insurance/insurance_complete_guard_v1.json +0 -50
  82. package/docs/examples/MyShop/MyShop.md +0 -1353
  83. package/docs/examples/MyShop/MyShop_TestResults.md +0 -1003
  84. package/docs/examples/MyShop_Advanced/MyShop_Advanced.md +0 -1898
  85. package/docs/examples/MyShop_Advanced/MyShop_Advanced_MerchantSystem_TestResults.md +0 -1297
  86. package/docs/examples/MyShop_Advanced/MyShop_Advanced_OrderFlow_TestResults.md +0 -743
  87. package/docs/examples/MyShop_Advanced/machine_nodes.json +0 -222
  88. package/docs/examples/ThreeBody_Signature/ThreeBody_Signature.md +0 -776
  89. package/docs/examples/ThreeBody_Signature/ThreeBody_Signature_TestResults.md +0 -599
  90. package/docs/examples/Travel/Travel.md +0 -1157
  91. package/docs/examples/Travel/Travel_TestResults.md +0 -743
  92. package/docs/examples/Travel/calc-weather-timestamps.js +0 -8
  93. package/docs/examples/Travel/travel_machine_v2_export.json +0 -104
  94. package/docs/examples/Travel/weather_check_guard_v1.json +0 -51
  95. package/docs/skills/WOWOK.md +0 -650
  96. package/docs/skills/onchain_operations/_common.md +0 -406
  97. package/docs/skills/onchain_operations/_index.md +0 -196
  98. package/docs/skills/onchain_operations/allocation.md +0 -28
  99. package/docs/skills/onchain_operations/arbitration.md +0 -106
  100. package/docs/skills/onchain_operations/contact.md +0 -40
  101. package/docs/skills/onchain_operations/demand.md +0 -53
  102. package/docs/skills/onchain_operations/gen_passport.md +0 -23
  103. package/docs/skills/onchain_operations/guard.md +0 -56
  104. package/docs/skills/onchain_operations/machine.md +0 -89
  105. package/docs/skills/onchain_operations/order.md +0 -56
  106. package/docs/skills/onchain_operations/payment.md +0 -24
  107. package/docs/skills/onchain_operations/permission.md +0 -68
  108. package/docs/skills/onchain_operations/personal.md +0 -58
  109. package/docs/skills/onchain_operations/progress.md +0 -38
  110. package/docs/skills/onchain_operations/repository.md +0 -70
  111. package/docs/skills/onchain_operations/reward.md +0 -38
  112. package/docs/skills/onchain_operations/service.md +0 -78
  113. package/docs/skills/onchain_operations/treasury.md +0 -68
  114. package/docs/skills/schema-account_operation.md +0 -402
  115. package/docs/skills/schema-guard2file.md +0 -153
  116. package/docs/skills/schema-local_info_operation.md +0 -160
  117. package/docs/skills/schema-local_mark_operation.md +0 -148
  118. package/docs/skills/schema-machineNode2file.md +0 -155
  119. package/docs/skills/schema-messenger_operation.md +0 -547
  120. package/docs/skills/schema-onchain_events.md +0 -201
  121. package/docs/skills/schema-onchain_table_data.md +0 -334
  122. package/docs/skills/schema-query_toolkit.md +0 -395
  123. package/docs/skills/schema-wip_file.md +0 -240
  124. package/docs/skills/schema-wowok_buildin_info.md +0 -296
  125. package/docs/wip-examples/three_body.html +0 -57
  126. package/docs/wip-examples/three_body.wip +0 -30
@@ -1,406 +0,0 @@
1
- # onchain_operations / Common Schemas
2
-
3
- Shared type definitions referenced by all `onchain_operations` operation types. For design principles, execution rules, Guard submission workflow, and Value Types, see [_index.md](./_index.md).
4
-
5
- ---
6
-
7
- ## CallEnv
8
-
9
- ```typescript
10
- CallEnv {
11
- account?: string; // Operating account (empty = default)
12
- permission_guard?: string[]; // Permission Guard ID list
13
- no_cache?: boolean; // Disable cache
14
- network?: "localnet" | "testnet"; // Target network
15
- referrer?: string; // Referrer ID
16
- }
17
- ```
18
-
19
- ## SubmissionCall
20
-
21
- ```typescript
22
- SubmissionCall {
23
- type: "submission";
24
- guard: {
25
- object: string; // Guard object name or ID
26
- impack: boolean; // Whether affects final outcome
27
- }[];
28
- submission: {
29
- guard: string; // Guard object name or ID
30
- submission: {
31
- identifier: number; // 0-255
32
- b_submission: boolean; // Whether user submission is required
33
- value_type: ValueType; // Expected type
34
- value?: SupportedValue; // User-provided value (optional)
35
- name: string; // Name/description (default: "")
36
- object_type?: ObjectType; // Object type when value is Address
37
- }[];
38
- }[];
39
- }
40
- ```
41
-
42
- ---
43
-
44
- ## Common Sub-Schemas
45
-
46
- ### NamedObject
47
-
48
- ```typescript
49
- NamedObject {
50
- name?: string; // Object name (max 64 bcs chars, must not start with '0x')
51
- tags?: string[]; // Tags for discoverability
52
- onChain?: boolean; // Register name on-chain (public)
53
- replaceExistName?: boolean; // Force claim existing name
54
- }
55
- ```
56
-
57
- ### NormalObject
58
-
59
- ```typescript
60
- NormalObject =
61
- | string // Existing object ID or name
62
- | {
63
- name?: string;
64
- tags?: string[];
65
- onChain?: boolean;
66
- replaceExistName?: boolean;
67
- };
68
- ```
69
-
70
- ### DescriptionObject
71
-
72
- ```typescript
73
- DescriptionObject =
74
- | string // Existing object ID or name
75
- | {
76
- name?: string;
77
- tags?: string[];
78
- onChain?: boolean;
79
- replaceExistName?: boolean;
80
- description?: string;
81
- };
82
- ```
83
-
84
- ### TypeNamedObject
85
-
86
- ```typescript
87
- TypeNamedObject =
88
- | string // Existing object ID or name
89
- | {
90
- name?: string;
91
- tags?: string[];
92
- onChain?: boolean;
93
- replaceExistName?: boolean;
94
- type_parameter?: string; // Token type (default: "0x2::wow::WOW")
95
- };
96
- ```
97
-
98
- ### WithPermissionObject
99
-
100
- ```typescript
101
- WithPermissionObject =
102
- | string // Existing object ID or name
103
- | {
104
- name?: string;
105
- tags?: string[];
106
- onChain?: boolean;
107
- replaceExistName?: boolean;
108
- permission?: DescriptionObject;
109
- };
110
- ```
111
-
112
- ### TypedPermissionObject
113
-
114
- ```typescript
115
- TypedPermissionObject =
116
- | string // Object ID or name (existing)
117
- | {
118
- name?: string; // Name for new object
119
- tags?: string[]; // Tags for discoverability
120
- onChain?: boolean; // Register name on-chain
121
- replaceExistName?: boolean; // Force claim existing name
122
- type_parameter: string; // Token type parameter (default: "0x2::wow::WOW")
123
- permission?: DescriptionObject; // Permission for the new object
124
- };
125
- ```
126
-
127
- ### TypedDescriptionObject
128
-
129
- ```typescript
130
- TypedDescriptionObject =
131
- | string // Existing object ID or name
132
- | {
133
- name?: string;
134
- tags?: string[];
135
- onChain?: boolean;
136
- replaceExistName?: boolean;
137
- type_parameter?: string; // Token type (default: "0x2::wow::WOW")
138
- };
139
- ```
140
-
141
- ### CoinParam
142
-
143
- ```typescript
144
- CoinParam =
145
- | { balance: string | number } // Amount (can include unit like "10WOW")
146
- | { coin: string }; // Specific coin object ID
147
- ```
148
-
149
- ### ObjectsOp
150
-
151
- ```typescript
152
- ObjectsOp =
153
- | {
154
- op: "add" | "set";
155
- objects: string[]; // List of object IDs or names
156
- }
157
- | {
158
- op: "remove";
159
- objects: string[]; // List of object IDs or names to remove
160
- }
161
- | {
162
- op: "clear";
163
- };
164
- ```
165
-
166
- ### AccountOrMark_Address
167
-
168
- ```typescript
169
- AccountOrMark_Address {
170
- name_or_address?: string; // Account name, address (0x...), or mark name
171
- local_mark_first?: boolean; // Prioritize local marks first
172
- }
173
- ```
174
-
175
- ### ManyAccountOrMark_Address
176
-
177
- ```typescript
178
- ManyAccountOrMark_Address {
179
- entities: AccountOrMark_Address[]; // Batch of account/address lookups
180
- check_all_founded?: boolean; // Abort if any ID not found
181
- }
182
- ```
183
-
184
- ### GuardTableItem
185
-
186
- ```typescript
187
- GuardTableItem {
188
- identifier: number; // 0-255
189
- b_submission: boolean; // Whether user submission is required
190
- value_type: ValueType; // Expected type
191
- value?: SupportedValue; // Default value (if b_submission=false)
192
- name: string; // Description (default: "")
193
- }
194
-
195
- // Note: GuardTableItem may also include:
196
- // object_type?: ObjectType; // Object type when value is Address
197
- ```
198
-
199
- ### Recipient
200
-
201
- ```typescript
202
- Recipient =
203
- | { GuardIdentifier: number } // Get recipient from Guard table index
204
- | { Entity: AccountOrMark_Address } // Explicit entity ID
205
- | { Signer: "signer" }; // Current transaction signer
206
- ```
207
-
208
- ### Amount
209
-
210
- ```typescript
211
- Amount =
212
- | {
213
- type: "GuardU64Identifier";
214
- value: number; // Guard table identifier (0-255) for u64 amount
215
- }
216
- | {
217
- type: "Fixed";
218
- value: string | number; // Fixed amount value
219
- };
220
- ```
221
-
222
- ### PaymentInfo
223
-
224
- ```typescript
225
- PaymentInfo {
226
- for_object?: string | null; // Payment for a specific object ID
227
- for_guard?: string | null; // Payment to satisfy Guard verification
228
- remark: string; // Payment record remark
229
- index: string | number; // Payment record index
230
- }
231
- ```
232
-
233
- ### ServiceSale
234
-
235
- ```typescript
236
- ServiceSale {
237
- name: string; // Product or service name (max 256 bcs chars)
238
- price: string | number; // Price
239
- stock: string | number; // Stock quantity
240
- suspension: boolean; // Whether suspended
241
- wip: string; // HTTP URL of WIP file
242
- wip_hash: string; // WIP file hash (empty = auto-use WIP hash)
243
- }
244
- ```
245
-
246
- ### ServiceBuyItem
247
-
248
- ```typescript
249
- ServiceBuyItem {
250
- name: string; // Product or service name (max 256 bcs chars)
251
- stock: string | number; // Quantity to purchase
252
- wip_hash: string; // WIP file hash of the item
253
- }
254
- ```
255
-
256
- ### Discount
257
-
258
- ```typescript
259
- Discount {
260
- name: string; // Discount name
261
- discount_type: 0 | 1; // 0 = RATES (percentage), 1 = FIXED
262
- discount_value: string | number; // Discount value
263
- benchmark?: number | string; // Minimum amount for discount to apply
264
- time_ms_start?: number; // Start time (milliseconds)
265
- time_ms_end?: number; // End time (milliseconds)
266
- count?: number; // Usage count limit
267
- recipient: ManyAccountOrMark_Address; // Recipient specification
268
- transferable?: boolean; // Whether recipient can transfer
269
- }
270
- ```
271
-
272
- ### ServiceGuard
273
-
274
- ```typescript
275
- ServiceGuard {
276
- guard: string; // Guard object ID
277
- service_identifier?: number | null; // Guard table identifier for service (0-255)
278
- }
279
- ```
280
-
281
- ### RewardGuard
282
-
283
- ```typescript
284
- RewardGuard {
285
- guard: string; // Guard object ID or name
286
- recipient: Recipient; // Who receives the reward
287
- amount: Amount; // Reward amount
288
- expiration_time?: number; // Expiration time (ms, >= 1 ms)
289
- store_from_id?: number | null; // Guard table index for record storage (0-255)
290
- }
291
- ```
292
-
293
- ### AmountFromDepositGuard
294
-
295
- ```typescript
296
- AmountFromDepositGuard {
297
- guard: string; // Guard object ID or name
298
- identifier?: number | null; // Guard table index for deposit amount limit (null = unlimited)
299
- store_from_id?: number | null; // Guard table index for record storage
300
- }
301
- ```
302
-
303
- ### AmountFromWithdrawGuard
304
-
305
- ```typescript
306
- AmountFromWithdrawGuard {
307
- guard: string; // Guard object ID or name
308
- identifier: number; // Guard table index for withdrawable amount
309
- store_from_id?: number | null; // Guard table index for record storage
310
- }
311
- ```
312
-
313
- ### VotingGuard / VoteWeight
314
-
315
- ```typescript
316
- VoteWeight =
317
- | { GuardIdentifier: number } // Voting weight from Guard table index
318
- | { FixedValue: number }; // Fixed voting weight (0-65535)
319
-
320
- VotingGuard {
321
- guard: string; // Voting Guard object ID
322
- vote_weight: VoteWeight; // Voting weight configuration
323
- }
324
- ```
325
-
326
- ### AllocationSharing
327
-
328
- ```typescript
329
- AllocationSharing {
330
- who: Recipient; // Recipient specification
331
- sharing: string | number; // Allocation amount or rate
332
- mode: "Amount" | "Rate" | "Surplus"; // Allocation mode
333
- }
334
- ```
335
-
336
- ### Allocator
337
-
338
- ```typescript
339
- Allocator {
340
- guard: string; // Guard object ID — allocation triggers on verify
341
- sharing: AllocationSharing[]; // Fund allocation items
342
- fix?: string | number; // Fixed amount per recipient
343
- max?: string | number | null; // Maximum allocation amount
344
- }
345
- ```
346
-
347
- ### Allocators
348
-
349
- ```typescript
350
- Allocators {
351
- description: string; // Allocator list description (max 4000 bcs chars)
352
- threshold: string | number; // Trigger threshold
353
- allocators: Allocator[]; // Fund allocator list
354
- }
355
- ```
356
-
357
- ### ReceivedBalanceOrRecently
358
-
359
- ```typescript
360
- ReceivedBalanceOrRecently =
361
- | {
362
- balance: string | number; // Balance amount
363
- token_type: string; // Token type (e.g., "CoinWrapper<0x2::wow::WOW>")
364
- received: {
365
- id: string; // Received CoinWrapper object ID
366
- balance: string | number; // Amount
367
- payment: string; // Payment object ID
368
- }[];
369
- }
370
- | "recently"; // Shortcut: automatically unwrap most recently received CoinWrapper
371
- ```
372
-
373
- ### ReceivedObjectsOrRecently
374
-
375
- ```typescript
376
- ReceivedObjectsOrRecently =
377
- | {
378
- id: string; // Object ID
379
- type: string; // Object type
380
- content_raw?: any; // Raw content (optional)
381
- }[]
382
- | {
383
- balance: string | number;
384
- token_type: string;
385
- received: { id: string; balance: string | number; payment: string; }[];
386
- }
387
- | "recently";
388
- ```
389
-
390
- ### QueryReceivedResult
391
-
392
- ```typescript
393
- QueryReceivedResult {
394
- result:
395
- | {
396
- balance: string | number;
397
- token_type: string;
398
- received: { id: string; balance: string | number; payment: string; }[];
399
- }
400
- | {
401
- id: string;
402
- type: string;
403
- content_raw?: any;
404
- }[];
405
- }
406
- ```
@@ -1,196 +0,0 @@
1
- # onchain_operations / Index
2
-
3
- > **Structure**: [Operation Table](#operation-table) · [CREATE vs MODIFY](#create-vs-modify-pattern) · [Top-Level Structure](#top-level-structure) · [Guard Submission](#guard-submission-mechanism) · [Field Execution Order](#field-execution-order) · [Value Types](#value-types)
4
- >
5
- > Common schemas (CallEnv, SubmissionCall, sub-schemas like NamedObject, CoinParam, Recipient, etc.) are in [_common.md](./_common.md).
6
-
7
- ## Operation Table
8
-
9
- 16 discriminated operation types. Each links to its schema file.
10
-
11
- | operation_type | File | Description |
12
- |---|---|---|
13
- | `service` | [service.md](./service.md) | Create/manage product listings, pricing, discounts, bind workflows, customer purchases via order_new |
14
- | `machine` | [machine.md](./machine.md) | Design/deploy workflow templates with node/forward structures |
15
- | `progress` | [progress.md](./progress.md) | Track active workflows, advance through nodes |
16
- | `repository` | [repository.md](./repository.md) | Consensus database with typed policies and data read/write |
17
- | `arbitration` | [arbitration.md](./arbitration.md) | Transparent on-chain arbitration, dispute/vote/resolve lifecycle |
18
- | `contact` | [contact.md](./contact.md) | On-chain IM contact profiles |
19
- | `treasury` | [treasury.md](./treasury.md) | Team fund management with deposit/withdraw Guard rules |
20
- | `reward` | [reward.md](./reward.md) | Reward pools with Guard-verified claiming |
21
- | `allocation` | [allocation.md](./allocation.md) | Auto-distribution plans to multiple recipients |
22
- | `permission` | [permission.md](./permission.md) | Access control indices for object operations |
23
- | `guard` | [guard.md](./guard.md) | Programmable boolean validation rules (recursive GuardNode tree) |
24
- | `personal` | [personal.md](./personal.md) | PUBLIC on-chain identity — everything permanently visible |
25
- | `payment` | [payment.md](./payment.md) | Irreversible coin transfers to wallets |
26
- | `demand` | [demand.md](./demand.md) | Service request postings with reward pools |
27
- | `order` | [order.md](./order.md) | Order lifecycle: progress, arbitration, refunds, ownership |
28
- | `gen_passport` | [gen_passport.md](./gen_passport.md) | Immutable verified credentials after Guard validation |
29
-
30
- ---
31
-
32
- ## CREATE vs MODIFY Pattern
33
-
34
- All on-chain object operations use a **unified discriminated pattern** for CREATE vs MODIFY:
35
-
36
- ```typescript
37
- // CREATE: object is an object with configuration
38
- object: {
39
- name?: string; // Optional name for the new object
40
- tags?: string[]; // Optional tags
41
- onChain?: boolean; // Whether to register name on-chain (public)
42
- replaceExistName?: boolean; // Force claim existing name
43
- permission?: DescriptionObject; // Permission (string or new object)
44
- type_parameter?: string; // Token type (e.g., "0x2::wow::WOW")
45
- }
46
-
47
- // MODIFY: object is a string referencing existing object
48
- object: "<object_name_or_id>" // Existing object name (local mark) or on-chain ID
49
- ```
50
-
51
- ### Key Rule
52
-
53
- | Format | Meaning | Example |
54
- |--------|---------|---------|
55
- | **String** | Reference EXISTING object | `object: "my-service"` or `object: "0x1234..."` |
56
- | **Object** | CREATE NEW object | `object: { name: "my-service", permission: "..." }` |
57
-
58
- ### Type Mapping
59
-
60
- | Type | Used By | CREATE Shape | MODIFY Shape |
61
- |------|---------|--------------|--------------|
62
- | `TypedPermissionObject` | `service`, `arbitration`, `treasury`, `reward` | `{ name?, tags?, onChain?, replaceExistName?, type_parameter, permission? }` | `string` |
63
- | `WithPermissionObject` | `machine`, `repository`, `demand`, `contact` | `{ name?, tags?, onChain?, replaceExistName?, permission? }` | `string` |
64
- | `TypedDescriptionObject` | *(not directly used by operations)* | `{ name?, tags?, onChain?, replaceExistName?, type_parameter }` | `string` |
65
- | `TypeNamedObject` | `allocation` (CREATE), `payment` | `{ name?, tags?, onChain?, replaceExistName?, type_parameter? }` | N/A |
66
- | `DescriptionObject` | `permission` field of other types | `{ name?, tags?, onChain?, replaceExistName?, description? }` | `string` |
67
- | `NormalObject` | `permission` | `{ name?, tags?, onChain?, replaceExistName? }` | `string` |
68
- | `NamedObject` | `namedNew*`, `guard.namedNew` | `{ name?, tags?, onChain?, replaceExistName? }` | N/A |
69
-
70
- ### Guard Exception
71
-
72
- `guard` operation is **CREATE-only** and immutable. Guards cannot be modified after creation. Create new Guard to update logic.
73
-
74
- ---
75
-
76
- ## Top-Level Structure
77
-
78
- Most operations follow this standard wrapper:
79
-
80
- ```typescript
81
- OnchainOperations {
82
- operation_type: string; // One of 16 types
83
- data: object; // Type-specific data (required)
84
- env?: CallEnv; // Optional environment
85
- submission?: SubmissionCall; // Optional Guard submission data
86
- }
87
- ```
88
-
89
- ### Exceptions
90
-
91
- | Operation | Structure | Notes |
92
- |-----------|-----------|-------|
93
- | `gen_passport` | `{ guard, info?, env? }` | FLAT — no `data` wrapper, no `submission` |
94
- | `guard` | `{ data, env? }` | No `submission` field |
95
- | `payment` | `{ data, env? }` | No `submission` field |
96
- | `personal` | `{ data, env? }` | No `submission` field |
97
-
98
- ---
99
-
100
- ## Guard Submission Mechanism
101
-
102
- When calling `onchain_operations`, the tool returns one of the following:
103
-
104
- - **Direct Result**: The operation completes immediately. Returns a transaction result, data, or error. No additional steps needed.
105
- - **Submission Required**: Returns `type: "submission"` — the operation triggered a Guard requiring user-provided data. A second call is needed to complete it.
106
-
107
- ### Direct Result Pattern
108
-
109
- Most operations return a direct result when no Guard submission is required:
110
-
111
- ```
112
- onchain_operations({ operation_type: "<type>", data: { ... } })
113
- → Returns transaction result or error directly
114
- ```
115
-
116
- ### Submission Required Pattern
117
-
118
- When the operation triggers a Guard whose table contains entries with **`b_submission: true`**, the tool does **not** return a transaction result immediately. Instead, it returns a **`type: "submission"`** response containing the Guard's data requirements.
119
-
120
- This is the **only scenario** where a second call is required to complete an operation.
121
-
122
- **Two-Step Flow**:
123
-
124
- ```
125
- Step 1 — Initial Call
126
- ├── onchain_operations (e.g., service, machine, progress, order, etc.)
127
- └── Response: { type: "submission", ... }
128
- ├── guard: [{ object, impack }] — Guards requiring verification
129
- └── submission: [{ guard, submission: [{ identifier, value_type, value?, name }] }]
130
- ↑ You ONLY fill the `value` field. Do NOT modify other fields.
131
-
132
- Step 2 — Re-submit with Completed Data
133
- ├── Same operation data (unchanged)
134
- └── Add top-level `submission` field:
135
- {
136
- "type": "submission",
137
- "guard": [{ "object": "guard_name", "impack": true }],
138
- "submission": [{
139
- "guard": "guard_name",
140
- "submission": [
141
- { "identifier": 0, "value_type": "String", "value": "your_data_here" }
142
- ]
143
- }]
144
- }
145
- ```
146
-
147
- **Critical Rules**:
148
- - **Only fill `value`**: The template has `identifier`, `value_type`, `name` pre-filled. You ONLY supply the `value` field matching the `value_type`. Never modify `identifier`, `value_type`, or `name`.
149
- - **Value type matching**: `value_type` indicates the expected type (`String`, `Address`, `U64`, `Bool`, etc.). The `value` must match exactly.
150
- - **Impack flag**: `impack: true` means this Guard's result affects the final outcome. All `impack=true` Guards must pass for the operation to proceed.
151
- - **All fields required**: Fill every entry in the `submission` array. Incomplete submission data causes a validation error.
152
- - **Do not change other fields**: The `data` and `env` portions of the original call must remain identical.
153
-
154
- **Common Submission Scenarios**:
155
- - **Merkle Root proof**: `value_type: "String"`, value = hex string.
156
- - **Progress/Order address**: `value_type: "Address"`, value = object name or ID.
157
-
158
- ---
159
-
160
- ## Field Execution Order
161
-
162
- **Rule**: Schema field order determines execution order, regardless of JSON field order.
163
-
164
- **AI Guidelines**:
165
- 1. Check schema field order against user's intended operation sequence
166
- 2. If schema order conflicts with intent, split into multiple sequential calls
167
- 3. When uncertain, use incremental steps rather than single batch operation
168
- 4. Between incremental steps, verify the previous modification landed on-chain: use `query_toolkit({ query_type: "onchain_objects", objects: ["<name>"], no_cache: true })` to confirm the object's updated state before proceeding to the next call
169
-
170
- ---
171
-
172
- ## Value Types
173
-
174
- All Guard `value_type` fields and `GuardTableItem.value_type` use these types:
175
-
176
- | Type | ID | Description |
177
- |------|-----|-------------|
178
- | Bool | 0 | Boolean true/false |
179
- | Address | 1 | Object or account address |
180
- | String | 2 | UTF-8 string |
181
- | U8 | 3 | 8-bit unsigned integer |
182
- | U16 | 4 | 16-bit unsigned integer |
183
- | U32 | 5 | 32-bit unsigned integer |
184
- | U64 | 6 | 64-bit unsigned integer |
185
- | U128 | 7 | 128-bit unsigned integer |
186
- | U256 | 8 | 256-bit unsigned integer |
187
- | VecBool | 9 | Vector of booleans |
188
- | VecAddress | 10 | Vector of addresses |
189
- | VecString | 11 | Vector of strings |
190
- | VecU8 | 12 | Vector of U8 |
191
- | VecU16 | 13 | Vector of U16 |
192
- | VecU32 | 14 | Vector of U32 |
193
- | VecU64 | 15 | Vector of U64 |
194
- | VecU128 | 16 | Vector of U128 |
195
- | VecU256 | 17 | Vector of U256 |
196
- | VecVecU8 | 18 | Vector of VecU8 |
@@ -1,28 +0,0 @@
1
- # onchain_operations / allocation
2
-
3
- Define token distribution plans with payment scheduling and Guard-triggered distribution.
4
-
5
- > **Schema**: `CallAllocation_Data` is a **union** of two variants — CREATE or OPERATE.
6
-
7
- ## Data Schema
8
-
9
- ```typescript
10
- CallAllocation_Data =
11
- // CREATE: Create a new Allocation object
12
- | {
13
- object: TypeNamedObject; // CREATE with {name, type_parameter?}
14
- allocators: Allocators; // Fund allocator rules
15
- coin: CoinParam; // Asset to allocate
16
- payment_info: PaymentInfo; // Payment record info
17
- }
18
- // OPERATE: Operate on existing Allocation object
19
- | {
20
- object: NameOrAddress; // Allocation object ID or name
21
- received_coins?: ReceivedBalanceOrRecently; // Unwrap received CoinWrappers into pending balance
22
- alloc_by_guard?: NameOrAddress; // Verify Guard and execute fund allocation
23
- };
24
- ```
25
-
26
- ---
27
-
28
- See [_common.md](./_common.md) for shared types: CallEnv, SubmissionCall, TypeNamedObject, Allocators, CoinParam, PaymentInfo, ReceivedBalanceOrRecently.