@wowok/agent-mcp 2.5.5 → 2.6.1

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 (146) hide show
  1. package/README.md +5 -3
  2. package/dist/config/runtime.js +3 -6
  3. package/dist/extensions/capability-manifest.d.ts +125 -0
  4. package/dist/extensions/capability-manifest.js +594 -0
  5. package/dist/extensions/constraint-registry.d.ts +24 -0
  6. package/dist/extensions/constraint-registry.js +196 -0
  7. package/dist/extensions/index.d.ts +12 -0
  8. package/dist/extensions/index.js +6 -0
  9. package/dist/extensions/metric-registry.d.ts +26 -0
  10. package/dist/extensions/metric-registry.js +257 -0
  11. package/dist/extensions/mode-evaluator.d.ts +15 -0
  12. package/dist/extensions/mode-evaluator.js +170 -0
  13. package/dist/extensions/modes.d.ts +2 -0
  14. package/dist/extensions/modes.js +407 -0
  15. package/dist/extensions/registry.d.ts +48 -0
  16. package/dist/extensions/registry.js +629 -0
  17. package/dist/extensions/types.d.ts +218 -0
  18. package/dist/extensions/types.js +1 -0
  19. package/dist/harness/checkpoint.js +2 -2
  20. package/dist/knowledge/deployment-scanner.d.ts +3 -0
  21. package/dist/knowledge/deployment-scanner.js +64 -3
  22. package/dist/knowledge/flywheel-loop.js +2 -5
  23. package/dist/knowledge/guard-risk.d.ts +13 -0
  24. package/dist/knowledge/guard-risk.js +57 -0
  25. package/dist/knowledge/guard-templates.js +278 -0
  26. package/dist/knowledge/machine-templates.js +20 -1
  27. package/dist/knowledge/overrides-loader.js +2 -4
  28. package/dist/knowledge/progress-ledger.js +3 -0
  29. package/dist/knowledge/progress-translation.js +5 -1
  30. package/dist/knowledge/service-confirm.d.ts +14 -5
  31. package/dist/knowledge/service-confirm.js +116 -8
  32. package/dist/knowledge/tool-constraints.js +6 -2
  33. package/dist/loop-engineering/improve.js +2 -4
  34. package/dist/project/deployment-bridge.d.ts +5 -0
  35. package/dist/project/deployment-bridge.js +119 -0
  36. package/dist/project/deployment-doc.d.ts +3 -0
  37. package/dist/project/deployment-doc.js +72 -10
  38. package/dist/project/evaluation.d.ts +2 -0
  39. package/dist/project/evaluation.js +578 -86
  40. package/dist/project/graph-builder.d.ts +4 -1
  41. package/dist/project/graph-builder.js +141 -63
  42. package/dist/project/graph.d.ts +1 -0
  43. package/dist/project/handlers.d.ts +221 -5
  44. package/dist/project/handlers.js +933 -14
  45. package/dist/project/index.js +2 -6
  46. package/dist/project/project-store.js +2 -5
  47. package/dist/project/stage-gate.d.ts +4 -0
  48. package/dist/project/stage-gate.js +64 -5
  49. package/dist/project/task-tracker.d.ts +26 -0
  50. package/dist/project/task-tracker.js +78 -0
  51. package/dist/safety/preview.js +16 -0
  52. package/dist/schema/call/allocation.d.ts +16 -16
  53. package/dist/schema/call/base.d.ts +21 -13
  54. package/dist/schema/call/base.js +27 -6
  55. package/dist/schema/call/bridge.d.ts +5 -5
  56. package/dist/schema/call/bridge.js +3 -1
  57. package/dist/schema/call/demand.d.ts +23 -31
  58. package/dist/schema/call/guard.js +1 -1
  59. package/dist/schema/call/machine.d.ts +402 -376
  60. package/dist/schema/call/order.d.ts +149 -228
  61. package/dist/schema/call/order.js +7 -3
  62. package/dist/schema/call/payment.d.ts +183 -3
  63. package/dist/schema/call/payment.js +21 -3
  64. package/dist/schema/call/personal.d.ts +241 -52
  65. package/dist/schema/call/progress.d.ts +53 -61
  66. package/dist/schema/call/progress.js +18 -4
  67. package/dist/schema/call/repository.d.ts +23 -31
  68. package/dist/schema/call/semantic.d.ts +1 -1
  69. package/dist/schema/call/semantic.js +30 -1
  70. package/dist/schema/call/service.d.ts +95 -119
  71. package/dist/schema/call/service.js +22 -1
  72. package/dist/schema/common/index.d.ts +11 -2
  73. package/dist/schema/common/index.js +43 -14
  74. package/dist/schema/config/index.d.ts +12 -12
  75. package/dist/schema/local/index.d.ts +140 -143
  76. package/dist/schema/local/index.js +44 -23
  77. package/dist/schema/messenger/index.d.ts +290 -62
  78. package/dist/schema/messenger/index.js +2 -2
  79. package/dist/schema/operations.d.ts +680 -545
  80. package/dist/schema/operations.js +22 -0
  81. package/dist/schema/project/index.d.ts +2064 -84
  82. package/dist/schema/project/index.js +354 -12
  83. package/dist/schema/query/index.d.ts +715 -354
  84. package/dist/schema/query/index.js +164 -31
  85. package/dist/schema/schema-query/index.d.ts +15 -3
  86. package/dist/schema/schema-query/index.js +23 -5
  87. package/dist/schema/trust/index.d.ts +8 -8
  88. package/dist/schema/utils/node-parser.js +7 -4
  89. package/dist/schema-query/index.d.ts +7 -1
  90. package/dist/schema-query/index.js +204 -4
  91. package/dist/schemas/account_operation.output.json +14 -22
  92. package/dist/schemas/account_operation.schema.json +11 -25
  93. package/dist/schemas/bridge_operation.output.json +6 -0
  94. package/dist/schemas/bridge_operation.schema.json +1 -1
  95. package/dist/schemas/guard-templates.json +379 -0
  96. package/dist/schemas/guard2file.schema.json +1 -1
  97. package/dist/schemas/index.json +1 -1
  98. package/dist/schemas/local_info_operation.output.json +6 -0
  99. package/dist/schemas/local_mark_operation.output.json +7 -1
  100. package/dist/schemas/local_mark_operation.schema.json +1 -1
  101. package/dist/schemas/machineNode2file.schema.json +1 -1
  102. package/dist/schemas/messenger_operation.schema.json +10 -10
  103. package/dist/schemas/onchain_events.output.json +1 -1
  104. package/dist/schemas/onchain_operations.schema.json +348 -296
  105. package/dist/schemas/onchain_operations_allocation.schema.json +34 -25
  106. package/dist/schemas/onchain_operations_arbitration.schema.json +8 -8
  107. package/dist/schemas/onchain_operations_contact.schema.json +8 -8
  108. package/dist/schemas/onchain_operations_demand.schema.json +8 -8
  109. package/dist/schemas/onchain_operations_gen_passport.schema.json +14 -14
  110. package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -2
  111. package/dist/schemas/onchain_operations_guard.schema.json +1 -1
  112. package/dist/schemas/onchain_operations_machine.schema.json +41 -33
  113. package/dist/schemas/onchain_operations_order.schema.json +71 -77
  114. package/dist/schemas/onchain_operations_payment.schema.json +141 -111
  115. package/dist/schemas/onchain_operations_permission.schema.json +2 -2
  116. package/dist/schemas/onchain_operations_personal.schema.json +7 -7
  117. package/dist/schemas/onchain_operations_progress.schema.json +8 -8
  118. package/dist/schemas/onchain_operations_proof.schema.json +7 -7
  119. package/dist/schemas/onchain_operations_repository.schema.json +8 -8
  120. package/dist/schemas/onchain_operations_reward.schema.json +10 -10
  121. package/dist/schemas/onchain_operations_service.schema.json +46 -35
  122. package/dist/schemas/onchain_operations_treasury.schema.json +8 -8
  123. package/dist/schemas/onchain_table_data.output.json +33 -25
  124. package/dist/schemas/onchain_table_data.schema.json +12 -12
  125. package/dist/schemas/project_operation.output.json +1352 -20
  126. package/dist/schemas/project_operation.schema.json +53 -4
  127. package/dist/schemas/query_toolkit.output.json +111 -82
  128. package/dist/schemas/query_toolkit.schema.json +9 -13
  129. package/dist/schemas/schema_query.output.json +7 -3
  130. package/dist/schemas/schema_query.schema.json +17 -3
  131. package/dist/telemetry/storage.js +2 -2
  132. package/dist/tools/handlers/local.js +20 -5
  133. package/dist/tools/handlers/onchain.js +36 -0
  134. package/dist/tools/handlers/project.js +72 -1
  135. package/dist/tools/handlers/query.js +27 -0
  136. package/dist/tools/handlers/schema-query.js +19 -0
  137. package/dist/tools/handlers/task-status.d.ts +170 -0
  138. package/dist/tools/handlers/task-status.js +55 -0
  139. package/dist/tools/handlers/wip.js +47 -1
  140. package/dist/tools/index.js +212 -8
  141. package/dist/tools/retry.d.ts +8 -0
  142. package/dist/tools/retry.js +85 -0
  143. package/dist/tools/wip-deploy-assist.d.ts +28 -0
  144. package/dist/tools/wip-deploy-assist.js +278 -0
  145. package/package.json +2 -2
  146. package/dist/schemas/guard-node-examples.md +0 -199
@@ -28,9 +28,15 @@
28
28
  "refresh_objects",
29
29
  "get_object_diff",
30
30
  "delete_project",
31
- "assemble_context"
31
+ "assemble_context",
32
+ "get_machine_graph",
33
+ "generate_deployment_doc",
34
+ "pre_evaluate_check",
35
+ "verify_deployment",
36
+ "clone_project_to_network",
37
+ "migrate_network"
32
38
  ],
33
- "description": "Action to perform. Two categories:\n1. Project Entity + Evaluation (15, GLM6): list_projects, create_project, create_project_from_onchain, update_project, get_project_detail, add_object, remove_object, create_version, build_graph, get_graph, evaluate_project, save_evaluation, compare_projects, refresh_objects, get_object_diff. Projects are first-class entities with SQLite persistence, rigid project-object relationships, three-pathway graph construction, and a dual rule-based + LLM-assisted evaluation engine.\n2. Context Assembly (1): assemble_context (query on-chain object states + extract embedded history + optional events, and assemble a structured semantic context for LLM consumption). Required input: context_objects (array of object IDs/names). Optional: include_events (query recent state-transition events)."
39
+ "description": "Action to perform. Two categories:\n1. Project Entity + Evaluation (15, GLM6): list_projects, create_project, create_project_from_onchain, update_project, get_project_detail, add_object, remove_object, create_version, build_graph, get_graph, evaluate_project, save_evaluation, compare_projects, refresh_objects, get_object_diff. Projects are first-class entities with SQLite persistence, rigid project-object relationships, three-pathway graph construction, and a dual rule-based + LLM-assisted evaluation engine.\n2. Context Assembly (1): assemble_context (query on-chain object states + extract embedded history + optional events, and assemble a structured semantic context for LLM consumption). Required input: context_objects (array of object IDs/names). Optional: include_events (query recent state-transition events).\n3. Cross-Network Migration (FIX-012): clone_project_to_network (or its alias migrate_network) copies a source project's object metadata to a new project bound to target_network. The 5-step migration workflow: 1) call clone_project_to_network (or migrate_network) with target_network to copy metadata, 2) re-run onchain_operations with env.network=target_network to deploy objects on-chain, 3) re-register LocalMark names with the SAME names on the target network (FIX-011 cross-network consistency), 4) update_project to set service_address on the new project, 5) build_graph to construct the new project's relationship graph."
34
40
  },
35
41
  "project": {
36
42
  "type": "string",
@@ -111,7 +117,7 @@
111
117
  "subscription",
112
118
  "custom"
113
119
  ],
114
- "description": "Industry tag for create_project. Drives template defaults."
120
+ "description": "Industry tag for create_project. Drives template defaults — when set (and not 'general'), the system auto-applies an industry blueprint with ~10 draft objects (Permission, Service, Machine, Guard, Treasury, Allocation, etc.) + graph edges, ready for deployment. Supported industries: 'general' (no template), 'retail', 'service', 'rental', 'freelance', 'education', 'travel', 'subscription', 'custom'. Each industry preset embeds risk constraints (e.g., 'freelance' does NOT require compensation_fund, while 'rental'/'travel' do). Example: project_industry='freelance' creates a freelance-style blueprint with setting_locked_time ≥ 7d. Set skip_templates=true to bypass template application."
115
121
  },
116
122
  "project_perspective": {
117
123
  "type": "string",
@@ -141,6 +147,10 @@
141
147
  ],
142
148
  "description": "Network the project is bound to. A Service deployed to different networks are different projects. Defaults to 'testnet'."
143
149
  },
150
+ "skip_templates": {
151
+ "type": "boolean",
152
+ "description": "When true, create_project skips applying the industry template (no draft:* blueprint objects). Use this when you want a clean project with no pre-filled blueprint objects — useful for custom architectures that do not match any industry mode, or to avoid draft objects appearing in build_graph / evaluate_project before deployment. Defaults to false (templates applied)."
153
+ },
144
154
  "project_id": {
145
155
  "type": "string",
146
156
  "description": "Project UUID for update_project / get_project_detail / add_object / remove_object / create_version / build_graph / evaluate_project / refresh_objects. Takes precedence over 'project' (prefix) when both are given."
@@ -155,9 +165,17 @@
155
165
  ],
156
166
  "description": "New status for update_project. 'active' projects are live, 'archived' are read-only."
157
167
  },
168
+ "target_network": {
169
+ "type": "string",
170
+ "enum": [
171
+ "testnet",
172
+ "mainnet"
173
+ ],
174
+ "description": "Target network for clone_project_to_network (or its alias migrate_network). The source project's objects are copied to a new project bound to this network. The new project's prefix is '<source_prefix>_<target_network>' to avoid collision. See the action description for the full 5-step migration workflow (FIX-012)."
175
+ },
158
176
  "object_address": {
159
177
  "type": "string",
160
- "description": "On-chain object address (0x...) for add_object / remove_object. For add_object, alternatively use object_name to resolve via LocalMark."
178
+ "description": "On-chain object address (0x followed by 32-64 hex chars) for add_object / remove_object. Also accepts the internal 'draft:<name>' sentinel used by create_project for blueprint objects not yet on-chain. For add_object, alternatively use object_name_add to resolve via LocalMark. H-06 fix: invalid formats are rejected at the handler level with a descriptive error."
161
179
  },
162
180
  "object_name_add": {
163
181
  "type": "string",
@@ -248,6 +266,12 @@
248
266
  "maximum": 5,
249
267
  "description": "Max recursion depth for Pathway 1 (internal reference derivation) in build_graph. Default 3."
250
268
  },
269
+ "depth": {
270
+ "type": "integer",
271
+ "minimum": 1,
272
+ "maximum": 5,
273
+ "description": "Alias for max_depth (build_graph). When both are set, max_depth takes precedence. Default 3."
274
+ },
251
275
  "enable_registrar": {
252
276
  "type": "boolean",
253
277
  "description": "Enable Pathway 2 (Registrar inbound query) in build_graph. Default true."
@@ -256,6 +280,10 @@
256
280
  "type": "boolean",
257
281
  "description": "Enable Pathway 3 (potential relationship detection) in build_graph. Default false."
258
282
  },
283
+ "async_mode": {
284
+ "type": "boolean",
285
+ "description": "When true, build_graph / evaluate_project runs in the background and returns { task_id } immediately. Poll query_task_status(task_id) to check progress and retrieve the result. Default false (synchronous). Use async_mode=true for large projects with enable_potential=true where build may take >10s."
286
+ },
259
287
  "evaluation_type": {
260
288
  "type": "string",
261
289
  "enum": [
@@ -306,6 +334,27 @@
306
334
  "diff_to_time": {
307
335
  "type": "integer",
308
336
  "description": "End timestamp (ms) for get_object_diff."
337
+ },
338
+ "network": {
339
+ "type": "string",
340
+ "enum": [
341
+ "testnet",
342
+ "mainnet"
343
+ ],
344
+ "description": "Target network for generate_deployment_doc. Required when action='generate_deployment_doc'."
345
+ },
346
+ "save": {
347
+ "type": "boolean",
348
+ "description": "When true (default), persist the generated MD to SQLite project_documents table for generate_deployment_doc."
349
+ },
350
+ "detail_level": {
351
+ "type": "string",
352
+ "enum": [
353
+ "summary",
354
+ "detailed",
355
+ "full"
356
+ ],
357
+ "description": "P2-03: Deployment document detail level (only for generate_deployment_doc). 'summary' (default): object name + type + key bindings (machine, permission, buy_guard, order_allocators). 'detailed': adds sale list, arbitration list, reward list. 'full': complete fields including stock, price, wip_hash, all config. Use 'summary' for quick review; request 'detailed' or 'full' only when deeper inspection is needed."
309
358
  }
310
359
  },
311
360
  "required": [
@@ -535,7 +535,7 @@
535
535
  "address"
536
536
  ],
537
537
  "additionalProperties": false,
538
- "description": "LOCAL PRIVATE: Local mark data structure for storing address names and tags privately on your device. This data is NEVER published to the blockchain."
538
+ "description": "LOCAL PRIVATE: Local mark data structure for storing address names and tags privately on your device. This data is NEVER published to the blockchain. CROSS-NETWORK ISOLATION (DOC-02): LocalMark names are scoped per network — the same name 'my-service' can map to different addresses on testnet vs mainnet. When switching networks (e.g., testnet→mainnet deployment), re-create marks with the same names pointing to the new mainnet addresses. This enables name-based object references that work identically across networks without code changes."
539
539
  },
540
540
  "description": "Local mark list"
541
541
  },
@@ -572,12 +572,13 @@
572
572
  "type": "number",
573
573
  "description": "Timestamp when account was last updated"
574
574
  },
575
- "m": {
576
- "type": [
577
- "string",
578
- "null"
579
- ],
580
- "description": "Messenger name, indicates this account has messenger enabled"
575
+ "messenger": {
576
+ "type": "boolean",
577
+ "description": "Whether messenger is enabled for this account"
578
+ },
579
+ "suspendedName": {
580
+ "type": "string",
581
+ "description": "Name before suspension (set by suspend, cleared by resume)"
581
582
  }
582
583
  },
583
584
  "required": [
@@ -2647,11 +2648,11 @@
2647
2648
  },
2648
2649
  "wip": {
2649
2650
  "type": "string",
2650
- "description": "HTTP URL of wip file"
2651
+ "description": "WIP file URL. EMPTY string \"\" skips verification (TESTING ONLY). Production MUST use a real HTTP URL pointing to a .wip file generated by the wip_file tool. Example: \"https://cdn.example.com/products/phone_v1.wip\""
2651
2652
  },
2652
2653
  "wip_hash": {
2653
2654
  "type": "string",
2654
- "description": "Hash of WIP. If EMPTY string, the hash within wip will be automatically used; else, the consistency of the hash within wip will be verified with the provided hash."
2655
+ "description": "WIP file hash (hex string). EMPTY string \"\" skips hash comparison (TESTING ONLY). Production: fill with the hash you saw when viewing the product, to prevent merchant replacing the WIP file before order."
2655
2656
  }
2656
2657
  },
2657
2658
  "required": [
@@ -2715,7 +2716,7 @@
2715
2716
  "number",
2716
2717
  "string"
2717
2718
  ],
2718
- "description": "Compensation fund pool for arbitration results. Order users can receive compensation from this fund based on arbitration results."
2719
+ "description": "Compensation fund BALANCE (NOT a Treasury address). This field reports the total amount of funds currently held in the Service's compensation pool. To ADD funds, use `service.compensation_fund_add`. To RECEIVE funds (as order owner after arbitration), use `service.compensation_fund_receive`. P2-03 clarification: this is a balance value (e.g. {balance: '1000000000', token_type: '0x2::wow::WOW'}), NOT the Treasury object address. The Treasury address (if bound) is queried separately via the Service's `repositories` or `order_allocators` configuration."
2719
2720
  },
2720
2721
  "paused_time": {
2721
2722
  "type": [
@@ -2746,7 +2747,7 @@
2746
2747
  "number",
2747
2748
  "string"
2748
2749
  ],
2749
- "description": "Threshold. If defined, fund allocation will be triggered when amount in Allocation object reaches this threshold.",
2750
+ "description": "Minimum balance required for allocation to fire. When the Allocation object's balance < threshold, allocation aborts with EINSUFFICIENT_BALANCE=7. Also: when an Allocator has only Amount items (no Rate, no Surplus), the sum of Amount items must be >= threshold (EAMOUNT_BELOW_THRESHOLD=12). Set to 0 (default) to allow any balance.",
2750
2751
  "default": 0
2751
2752
  },
2752
2753
  "allocators": {
@@ -2756,7 +2757,7 @@
2756
2757
  "properties": {
2757
2758
  "guard": {
2758
2759
  "type": "string",
2759
- "description": "Guard object ID. If Guard verification passes, fund allocation will start automatically."
2760
+ "description": "Guard object ID or name. If Guard verification passes (via Passport), fund allocation for THIS Allocator fires. Each Allocator in an Allocators list can have a different Guard — the first Allocator whose Guard returns true wins. This enables mutually exclusive allocation paths (e.g., refund Guard on 'return_approved' node vs damage Guard on 'damage_confirmed' node)."
2760
2761
  },
2761
2762
  "sharing": {
2762
2763
  "type": "array",
@@ -2804,7 +2805,7 @@
2804
2805
  "Entity"
2805
2806
  ],
2806
2807
  "additionalProperties": false,
2807
- "description": "Determined ID"
2808
+ "description": "Static address resolved via LocalMark. Format: {Entity: {name_or_address: 'mark_name'}} — NOTE: Entity is an OBJECT with name_or_address field, NOT a bare string."
2808
2809
  },
2809
2810
  {
2810
2811
  "type": "object",
@@ -2821,23 +2822,32 @@
2821
2822
  "description": "Current transaction signer ID"
2822
2823
  }
2823
2824
  ],
2824
- "description": "Recipient ID"
2825
+ "description": "Recipient of this allocation. Three forms:\n• { GuardIdentifier: u8 } — resolved from Passport at allocation time. Use 0 for Order owner in Service-integrated mode (Customer who created the Order). The identifier must match a Guard table entry with b_submission=true. If Passport has no matching submission, contract aborts with E_VERIFY_FAILED.\n• { Entity: { name_or_address: '...' } } — static address resolved via LocalMark. Use for known recipients (e.g., 'turo_host', or a Treasury object address).\n• 'Signer' — the transaction sender (tx_context::sender). Use when the recipient is the current signer (e.g., self-refund scenarios)."
2825
2826
  },
2826
2827
  "sharing": {
2827
2828
  "type": [
2828
2829
  "number",
2829
2830
  "string"
2830
2831
  ],
2831
- "description": "Reward allocation value"
2832
+ "description": "Allocation value. SEMANTICS DEPEND ON `mode`:\n• mode='Amount': absolute amount in smallest unit (e.g., '750000000' for 0.75 WOW, '250000000' for 0.25 WOW). Allocated first; sum of Amount items cached as `fix`.\n• mode='Rate': basis-points rate, 10000 = 100% (e.g., '7500' for 75%, '2500' for 25%). When no Surplus in same Allocator, sum MUST == 10000; when Surplus present, sum MUST <= 10000.\n• mode='Surplus': IGNORED (contract forces to 0). Set to '0' for clarity. Receives remaining balance after Amount + Rate allocations."
2832
2833
  },
2833
2834
  "mode": {
2834
- "type": "string",
2835
- "enum": [
2836
- "Amount",
2837
- "Rate",
2838
- "Surplus"
2835
+ "anyOf": [
2836
+ {
2837
+ "type": "string",
2838
+ "enum": [
2839
+ "Amount",
2840
+ "Rate",
2841
+ "Surplus"
2842
+ ]
2843
+ },
2844
+ {
2845
+ "type": "integer",
2846
+ "minimum": 0,
2847
+ "maximum": 2
2848
+ }
2839
2849
  ],
2840
- "description": "Reward allocation mode"
2850
+ "description": "Allocation mode — determines how the `sharing` field is interpreted. Three modes can be used individually OR combined within a single Allocator; when combined, allocation order is strictly: Amount first, then Rate, then Surplus. Understanding these modes allows modeling almost any fund distribution pattern.\n• Amount (0): `sharing` is a FIXED amount in smallest unit (e.g., '750000000' = 0.75 WOW). Allocated FIRST; sum of all Amount items is cached as `fix` by the contract. Validation: when no Rate and no Surplus items exist, sum of Amount items must be >= allocators.threshold (EAMOUNT_BELOW_THRESHOLD=12); when `max` is set, sum of Amount items must be <= max (EAMOUNT_EXCEEDS_MAX=13).\n• Rate (1): `sharing` is a basis-points rate (10000 = 100%). Allocated AFTER Amount; formula: allocated = (sharing × total_rates) / 10000, where total_rates = balance - fix (or max - fix if `max` is set). Validation: when no Surplus items exist, sum of all Rate items must be EXACTLY 10000 (ERATE_NOT_10000=4); when Surplus items exist, sum of all Rate items must be <= 10000 (ERATE_EXCEEDS_10000=6).\n• Surplus (2): `sharing` is IGNORED (contract forces it to 0). Allocated LAST; receives the remaining balance after Amount + Rate allocations. Validation: MAX ONE Surplus item per Allocator (EMULTIPLE_SURPLUS=5). When Surplus exists, Rate sum constraint relaxes from == 10000 to <= 10000.\nALLOCATION ORDER (strict): Amount items (fixed, cached as fix) → Rate items (proportional to balance-fix) → Surplus item (remaining).\nRECOMMENDATION: Use Amount mode for known fixed amounts (clearer, no sum constraint). Use Rate mode for proportional splits (requires sum == 10000 unless Surplus present). Use Surplus to capture remainder (e.g., platform fee + host gets rest). Accepts string ('Amount'/'Rate'/'Surplus', recommended) or number (0/1/2)."
2841
2851
  }
2842
2852
  },
2843
2853
  "required": [
@@ -2846,13 +2856,13 @@
2846
2856
  "mode"
2847
2857
  ],
2848
2858
  "additionalProperties": false,
2849
- "description": "Fund allocation item"
2859
+ "description": "Fund allocation item — one recipient's share of the Allocation balance. The `sharing` value's meaning depends on `mode` (see AllocationModeSchema). Multiple items in the same Allocator are evaluated together: Amount items first, Rate items second, Surplus last."
2850
2860
  },
2851
- "description": "Fund allocation item list. Each item represents a recipient and their corresponding reward allocation value."
2861
+ "description": "Fund allocation item list. Each item specifies a recipient (who), a value (sharing), and a mode. Items can mix modes (Amount + Rate + Surplus) within the same Allocator. ALLOCATION ORDER: Amount items first (cached as fix) → Rate items (proportional to balance - fix) → Surplus item (remaining). CONSTRAINTS: max ONE Surplus item per Allocator; Rate sum must == 10000 (no Surplus) or <= 10000 (with Surplus); Amount sum must >= threshold (no Rate and no Surplus) and <= max (if max set)."
2852
2862
  },
2853
2863
  "fix": {
2854
2864
  "$ref": "#/definitions/object_service/properties/order_allocators/anyOf/0/properties/threshold",
2855
- "description": "Fixed allocation amount. If specified, all recipients will receive the fixed allocation amount."
2865
+ "description": "OUTPUT-ONLY (query result). Cached sum of all Amount-mode `sharing` values in this Allocator. Computed by the contract during `allocator_add` — DO NOT set this field at creation. Used internally to compute `total_rates = balance - fix` for Rate allocation."
2856
2866
  },
2857
2867
  "max": {
2858
2868
  "anyOf": [
@@ -2863,7 +2873,7 @@
2863
2873
  "type": "null"
2864
2874
  }
2865
2875
  ],
2866
- "description": "Maximum allocation amount. If specified, allocation amount cannot exceed maximum allocation amount."
2876
+ "description": "Maximum allocation cap (optional). Has THREE effects:\n1. Construction: sum of Amount items must be <= max (EAMOUNT_EXCEEDS_MAX=13)\n2. Rate execution: total_rates = max - fix (instead of balance - fix)\n3. Surplus execution: surplus_amount = max - alloced_amount (instead of balance - alloced_amount)\nUse when you want to cap total allocation regardless of Order balance (e.g., cap payout to declared amount)."
2867
2877
  }
2868
2878
  },
2869
2879
  "required": [
@@ -2871,9 +2881,9 @@
2871
2881
  "sharing"
2872
2882
  ],
2873
2883
  "additionalProperties": false,
2874
- "description": "Fund allocator"
2884
+ "description": "Fund allocator — a complete allocation strategy triggered by a Guard. Contains a sharing[] array where items can mix Amount/Rate/Surplus modes. When the Guard passes, the contract allocates funds in strict order: Amount → Rate → Surplus."
2875
2885
  },
2876
- "description": "Fund allocator list. Each fund allocator represents a fund allocation strategy."
2886
+ "description": "Fund allocator list. Each allocator is evaluated in order; the FIRST allocator whose Guard passes wins. This enables mutually exclusive allocation paths (e.g., 3 allocators for 3 forward paths: refund / damage-deduct / arbitrate)."
2877
2887
  }
2878
2888
  },
2879
2889
  "required": [
@@ -2881,7 +2891,7 @@
2881
2891
  "allocators"
2882
2892
  ],
2883
2893
  "additionalProperties": false,
2884
- "description": "Fund allocator list"
2894
+ "description": "Fund allocator list — the top-level allocation configuration attached to an Order. Contains a threshold and a list of Allocators. When funds arrive at the Order, the first Allocator whose Guard passes executes its sharing[] in strict order: Amount → Rate → Surplus. MULTI-TIER ALLOCATION (DOC-04): Each Order binds ONE Allocators template (set on Service.order_allocators before publish). For multi-tier distribution (e.g., customer→agency→suppliers), use a two-phase approach: (1) Tier-1 Allocators on the customer's Order (allocates to agency + refund fund); (2) Tier-2 Allocators on a NEW Order created by the agency (allocates agency's received funds to suppliers). Each tier's Rate-mode sharing[] must independently sum to 10000 (or <= 10000 with Surplus)."
2885
2895
  },
2886
2896
  {
2887
2897
  "type": "null"
@@ -4878,7 +4888,7 @@
4878
4888
  "properties": {
4879
4889
  "guard": {
4880
4890
  "type": "string",
4881
- "description": "Guard object ID. If Guard verification passes, fund allocation will start automatically."
4891
+ "description": "Guard object ID or name. If Guard verification passes (via Passport), fund allocation for THIS Allocator fires. Each Allocator in an Allocators list can have a different Guard — the first Allocator whose Guard returns true wins. This enables mutually exclusive allocation paths (e.g., refund Guard on 'return_approved' node vs damage Guard on 'damage_confirmed' node)."
4882
4892
  },
4883
4893
  "sharing": {
4884
4894
  "type": "array",
@@ -4926,7 +4936,7 @@
4926
4936
  "Entity"
4927
4937
  ],
4928
4938
  "additionalProperties": false,
4929
- "description": "Determined ID"
4939
+ "description": "Static address resolved via LocalMark. Format: {Entity: {name_or_address: 'mark_name'}} — NOTE: Entity is an OBJECT with name_or_address field, NOT a bare string."
4930
4940
  },
4931
4941
  {
4932
4942
  "type": "object",
@@ -4943,23 +4953,32 @@
4943
4953
  "description": "Current transaction signer ID"
4944
4954
  }
4945
4955
  ],
4946
- "description": "Recipient ID"
4956
+ "description": "Recipient of this allocation. Three forms:\n• { GuardIdentifier: u8 } — resolved from Passport at allocation time. Use 0 for Order owner in Service-integrated mode (Customer who created the Order). The identifier must match a Guard table entry with b_submission=true. If Passport has no matching submission, contract aborts with E_VERIFY_FAILED.\n• { Entity: { name_or_address: '...' } } — static address resolved via LocalMark. Use for known recipients (e.g., 'turo_host', or a Treasury object address).\n• 'Signer' — the transaction sender (tx_context::sender). Use when the recipient is the current signer (e.g., self-refund scenarios)."
4947
4957
  },
4948
4958
  "sharing": {
4949
4959
  "type": [
4950
4960
  "number",
4951
4961
  "string"
4952
4962
  ],
4953
- "description": "Reward allocation value"
4963
+ "description": "Allocation value. SEMANTICS DEPEND ON `mode`:\n• mode='Amount': absolute amount in smallest unit (e.g., '750000000' for 0.75 WOW, '250000000' for 0.25 WOW). Allocated first; sum of Amount items cached as `fix`.\n• mode='Rate': basis-points rate, 10000 = 100% (e.g., '7500' for 75%, '2500' for 25%). When no Surplus in same Allocator, sum MUST == 10000; when Surplus present, sum MUST <= 10000.\n• mode='Surplus': IGNORED (contract forces to 0). Set to '0' for clarity. Receives remaining balance after Amount + Rate allocations."
4954
4964
  },
4955
4965
  "mode": {
4956
- "type": "string",
4957
- "enum": [
4958
- "Amount",
4959
- "Rate",
4960
- "Surplus"
4966
+ "anyOf": [
4967
+ {
4968
+ "type": "string",
4969
+ "enum": [
4970
+ "Amount",
4971
+ "Rate",
4972
+ "Surplus"
4973
+ ]
4974
+ },
4975
+ {
4976
+ "type": "integer",
4977
+ "minimum": 0,
4978
+ "maximum": 2
4979
+ }
4961
4980
  ],
4962
- "description": "Reward allocation mode"
4981
+ "description": "Allocation mode — determines how the `sharing` field is interpreted. Three modes can be used individually OR combined within a single Allocator; when combined, allocation order is strictly: Amount first, then Rate, then Surplus. Understanding these modes allows modeling almost any fund distribution pattern.\n• Amount (0): `sharing` is a FIXED amount in smallest unit (e.g., '750000000' = 0.75 WOW). Allocated FIRST; sum of all Amount items is cached as `fix` by the contract. Validation: when no Rate and no Surplus items exist, sum of Amount items must be >= allocators.threshold (EAMOUNT_BELOW_THRESHOLD=12); when `max` is set, sum of Amount items must be <= max (EAMOUNT_EXCEEDS_MAX=13).\n• Rate (1): `sharing` is a basis-points rate (10000 = 100%). Allocated AFTER Amount; formula: allocated = (sharing × total_rates) / 10000, where total_rates = balance - fix (or max - fix if `max` is set). Validation: when no Surplus items exist, sum of all Rate items must be EXACTLY 10000 (ERATE_NOT_10000=4); when Surplus items exist, sum of all Rate items must be <= 10000 (ERATE_EXCEEDS_10000=6).\n• Surplus (2): `sharing` is IGNORED (contract forces it to 0). Allocated LAST; receives the remaining balance after Amount + Rate allocations. Validation: MAX ONE Surplus item per Allocator (EMULTIPLE_SURPLUS=5). When Surplus exists, Rate sum constraint relaxes from == 10000 to <= 10000.\nALLOCATION ORDER (strict): Amount items (fixed, cached as fix) → Rate items (proportional to balance-fix) → Surplus item (remaining).\nRECOMMENDATION: Use Amount mode for known fixed amounts (clearer, no sum constraint). Use Rate mode for proportional splits (requires sum == 10000 unless Surplus present). Use Surplus to capture remainder (e.g., platform fee + host gets rest). Accepts string ('Amount'/'Rate'/'Surplus', recommended) or number (0/1/2)."
4963
4982
  }
4964
4983
  },
4965
4984
  "required": [
@@ -4968,16 +4987,16 @@
4968
4987
  "mode"
4969
4988
  ],
4970
4989
  "additionalProperties": false,
4971
- "description": "Fund allocation item"
4990
+ "description": "Fund allocation item — one recipient's share of the Allocation balance. The `sharing` value's meaning depends on `mode` (see AllocationModeSchema). Multiple items in the same Allocator are evaluated together: Amount items first, Rate items second, Surplus last."
4972
4991
  },
4973
- "description": "Fund allocation item list. Each item represents a recipient and their corresponding reward allocation value."
4992
+ "description": "Fund allocation item list. Each item specifies a recipient (who), a value (sharing), and a mode. Items can mix modes (Amount + Rate + Surplus) within the same Allocator. ALLOCATION ORDER: Amount items first (cached as fix) → Rate items (proportional to balance - fix) → Surplus item (remaining). CONSTRAINTS: max ONE Surplus item per Allocator; Rate sum must == 10000 (no Surplus) or <= 10000 (with Surplus); Amount sum must >= threshold (no Rate and no Surplus) and <= max (if max set)."
4974
4993
  },
4975
4994
  "fix": {
4976
4995
  "type": [
4977
4996
  "number",
4978
4997
  "string"
4979
4998
  ],
4980
- "description": "Fixed allocation amount. If specified, all recipients will receive the fixed allocation amount."
4999
+ "description": "OUTPUT-ONLY (query result). Cached sum of all Amount-mode `sharing` values in this Allocator. Computed by the contract during `allocator_add` — DO NOT set this field at creation. Used internally to compute `total_rates = balance - fix` for Rate allocation."
4981
5000
  },
4982
5001
  "max": {
4983
5002
  "anyOf": [
@@ -4988,7 +5007,7 @@
4988
5007
  "type": "null"
4989
5008
  }
4990
5009
  ],
4991
- "description": "Maximum allocation amount. If specified, allocation amount cannot exceed maximum allocation amount."
5010
+ "description": "Maximum allocation cap (optional). Has THREE effects:\n1. Construction: sum of Amount items must be <= max (EAMOUNT_EXCEEDS_MAX=13)\n2. Rate execution: total_rates = max - fix (instead of balance - fix)\n3. Surplus execution: surplus_amount = max - alloced_amount (instead of balance - alloced_amount)\nUse when you want to cap total allocation regardless of Order balance (e.g., cap payout to declared amount)."
4992
5011
  }
4993
5012
  },
4994
5013
  "required": [
@@ -4996,7 +5015,7 @@
4996
5015
  "sharing"
4997
5016
  ],
4998
5017
  "additionalProperties": false,
4999
- "description": "Fund allocator"
5018
+ "description": "Fund allocator — a complete allocation strategy triggered by a Guard. Contains a sharing[] array where items can mix Amount/Rate/Surplus modes. When the Guard passes, the contract allocates funds in strict order: Amount → Rate → Surplus."
5000
5019
  },
5001
5020
  "description": "Fund allocation object allocator list"
5002
5021
  },
@@ -5314,7 +5333,7 @@
5314
5333
  "Entity"
5315
5334
  ],
5316
5335
  "additionalProperties": false,
5317
- "description": "Determined ID"
5336
+ "description": "Static address resolved via LocalMark. Format: {Entity: {name_or_address: 'mark_name'}} — NOTE: Entity is an OBJECT with name_or_address field, NOT a bare string."
5318
5337
  },
5319
5338
  {
5320
5339
  "type": "object",
@@ -5331,7 +5350,7 @@
5331
5350
  "description": "Current transaction signer ID"
5332
5351
  }
5333
5352
  ],
5334
- "description": "Recipient ID"
5353
+ "description": "Recipient ID. Three forms:\n - {GuardIdentifier: u8} — resolved from Passport at allocation time\n - {Entity: {name_or_address: 'mark_name'}} — static address via LocalMark (recommended)\n - {Signer: 'signer'} — transaction sender (e.g. self-refund)"
5335
5354
  },
5336
5355
  "amount": {
5337
5356
  "anyOf": [
@@ -5365,7 +5384,7 @@
5365
5384
  "number",
5366
5385
  "string"
5367
5386
  ],
5368
- "description": "Balance type"
5387
+ "description": "A coin/balance amount in the smallest on-chain unit (u64). Accepts a JS number OR a numeric string. PRECISION RULE: for values exceeding 2^53 (e.g. token amounts with 18 decimals), ALWAYS pass a numeric STRING (e.g. \"1000000000000000000\") to preserve precision — JS numbers lose precision above 2^53. UNIT: this is the smallest unit, NOT the display unit. For SUI: 1 SUI = 10^9 MIST, so 10 SUI = 10000000000. For custom tokens: use the token's native smallest unit (decimals from coin metadata). Examples: 10000000000 (10 SUI), \"1000000000000000000\" (1 token with 18 decimals), 500 (500 units of a token with 0 decimals). Used for: Service.sale.price, Service.compensation_fund_add balance, Treasury.deposit, Arbitration.fee, Reward.amount, stock quantities."
5369
5388
  }
5370
5389
  },
5371
5390
  "required": [
@@ -6351,7 +6370,7 @@
6351
6370
  "Entity"
6352
6371
  ],
6353
6372
  "additionalProperties": false,
6354
- "description": "Determined ID"
6373
+ "description": "Static address resolved via LocalMark. Format: {Entity: {name_or_address: 'mark_name'}} — NOTE: Entity is an OBJECT with name_or_address field, NOT a bare string."
6355
6374
  },
6356
6375
  {
6357
6376
  "type": "object",
@@ -6368,14 +6387,14 @@
6368
6387
  "description": "Current transaction signer ID"
6369
6388
  }
6370
6389
  ],
6371
- "description": "Recipient ID"
6390
+ "description": "Recipient ID. Three forms:\n - {GuardIdentifier: u8} — resolved from Passport at allocation time\n - {Entity: {name_or_address: 'mark_name'}} — static address via LocalMark (recommended)\n - {Signer: 'signer'} — transaction sender (e.g. self-refund)"
6372
6391
  },
6373
6392
  "amount": {
6374
6393
  "type": [
6375
6394
  "number",
6376
6395
  "string"
6377
6396
  ],
6378
- "description": "Balance type"
6397
+ "description": "A coin/balance amount in the smallest on-chain unit (u64). Accepts a JS number OR a numeric string. PRECISION RULE: for values exceeding 2^53 (e.g. token amounts with 18 decimals), ALWAYS pass a numeric STRING (e.g. \"1000000000000000000\") to preserve precision — JS numbers lose precision above 2^53. UNIT: this is the smallest unit, NOT the display unit. For SUI: 1 SUI = 10^9 MIST, so 10 SUI = 10000000000. For custom tokens: use the token's native smallest unit (decimals from coin metadata). Examples: 10000000000 (10 SUI), \"1000000000000000000\" (1 token with 18 decimals), 500 (500 units of a token with 0 decimals). Used for: Service.sale.price, Service.compensation_fund_add balance, Treasury.deposit, Arbitration.fee, Reward.amount, stock quantities."
6379
6398
  }
6380
6399
  },
6381
6400
  "required": [
@@ -8405,14 +8424,16 @@
8405
8424
  "discount_type": {
8406
8425
  "anyOf": [
8407
8426
  {
8408
- "type": "number",
8409
- "const": 0,
8410
- "description": "Rate discount type"
8427
+ "type": "string",
8428
+ "enum": [
8429
+ "RATES",
8430
+ "FIXED"
8431
+ ]
8411
8432
  },
8412
8433
  {
8413
- "type": "number",
8414
- "const": 1,
8415
- "description": "Fixed discount type"
8434
+ "type": "integer",
8435
+ "minimum": 0,
8436
+ "maximum": 1
8416
8437
  }
8417
8438
  ],
8418
8439
  "description": "Discount type. If rate(0), discount is based on proportion of product amount (e.g., 1000 means 10% discount); if fixed(1), discount is based on fixed value of product amount (e.g., 100 means 100 yuan discount)."
@@ -8424,7 +8445,7 @@
8424
8445
  "number",
8425
8446
  "string"
8426
8447
  ],
8427
- "description": "Balance type"
8448
+ "description": "A coin/balance amount in the smallest on-chain unit (u64). Accepts a JS number OR a numeric string. PRECISION RULE: for values exceeding 2^53 (e.g. token amounts with 18 decimals), ALWAYS pass a numeric STRING (e.g. \"1000000000000000000\") to preserve precision — JS numbers lose precision above 2^53. UNIT: this is the smallest unit, NOT the display unit. For SUI: 1 SUI = 10^9 MIST, so 10 SUI = 10000000000. For custom tokens: use the token's native smallest unit (decimals from coin metadata). Examples: 10000000000 (10 SUI), \"1000000000000000000\" (1 token with 18 decimals), 500 (500 units of a token with 0 decimals). Used for: Service.sale.price, Service.compensation_fund_add balance, Treasury.deposit, Arbitration.fee, Reward.amount, stock quantities."
8428
8449
  },
8429
8450
  {
8430
8451
  "type": "null"
@@ -13012,7 +13033,7 @@
13012
13033
  "properties": {
13013
13034
  "prev_node": {
13014
13035
  "type": "string",
13015
- "description": "Previous node name"
13036
+ "description": "Previous node name. Empty string '' means initial entry node (the first node in the workflow)."
13016
13037
  },
13017
13038
  "threshold": {
13018
13039
  "type": [
@@ -13072,38 +13093,46 @@
13072
13093
  "guard": {
13073
13094
  "anyOf": [
13074
13095
  {
13075
- "type": "object",
13076
- "properties": {
13077
- "guard": {
13078
- "type": "string",
13079
- "description": "Guard object ID"
13080
- },
13081
- "retained_submission": {
13082
- "anyOf": [
13083
- {
13084
- "type": "array",
13085
- "items": {
13086
- "$ref": "#/definitions/query_result_onchain_table_item_machine_node/anyOf/0/properties/value/items/properties/threshold"
13087
- }
13096
+ "anyOf": [
13097
+ {
13098
+ "type": "object",
13099
+ "properties": {
13100
+ "guard": {
13101
+ "type": "string",
13102
+ "description": "Guard object name or address (string). Example: 'my_attendance_guard' or '0x1234...'"
13088
13103
  },
13089
- {
13090
- "type": "null"
13104
+ "retained_submission": {
13105
+ "anyOf": [
13106
+ {
13107
+ "type": "array",
13108
+ "items": {
13109
+ "$ref": "#/definitions/query_result_onchain_table_item_machine_node/anyOf/0/properties/value/items/properties/threshold"
13110
+ }
13111
+ },
13112
+ {
13113
+ "type": "null"
13114
+ }
13115
+ ],
13116
+ "description": "Data submitted by user during Guard object verification"
13091
13117
  }
13118
+ },
13119
+ "required": [
13120
+ "guard"
13092
13121
  ],
13093
- "description": "Data submitted by user during Guard object verification"
13122
+ "additionalProperties": false,
13123
+ "description": "OBJECT form: {guard: '<guard_name_or_address>', retained_submission?: number[]}. Use this form when you need to pass retained_submission data alongside the Guard reference."
13124
+ },
13125
+ {
13126
+ "type": "string",
13127
+ "description": "STRING form (shorthand): the Guard object's name or address as a plain string. Auto-wrapped to {guard: <string>} at runtime. Use this when you only need to reference a Guard without retained_submission."
13094
13128
  }
13095
- },
13096
- "required": [
13097
- "guard"
13098
- ],
13099
- "additionalProperties": false,
13100
- "description": "Record of Guard object in MachineForwardGuard object"
13129
+ ]
13101
13130
  },
13102
13131
  {
13103
13132
  "type": "null"
13104
13133
  }
13105
13134
  ],
13106
- "description": "Guard object ID, if defined, Guard verification must also pass to complete Forward (e.g., completed promised supply chain sub-order)."
13135
+ "description": "Guard reference for this forward. Accepts TWO formats:\n• STRING (preferred): \"my_guard_name\" — the Guard's name or address as a plain string.\n• OBJECT (only when retained_submission is needed): {guard: \"my_guard_name\", retained_submission: [1,2,3]}.\nFOLLOW THE SCHEMA FIELD STRUCTURE: A Guard reference is fundamentally a STRING (the Guard object's name or address). Provide a string when you only need to reference a Guard — do NOT wrap a bare string in an object structure. The OBJECT form {guard: \"...\", retained_submission: [...]} exists ONLY to carry additional `retained_submission` data alongside the string reference; inside the object, the `guard` field is STILL a string. In short: string-in for a string reference, object-in only when you need to pass extra data.\nCOGNITIVE PRINCIPLE: Guard validation ALWAYS occurs BEFORE the forward operation. A Guard that queries state of the SAME Progress object this forward operates on (e.g. progress.current) will see the PRE-transition value (source node), NOT the target node. If the Guard checks progress.current == target_node, it will ALWAYS FAIL. Querying a DIFFERENT Progress object (cross-machine) is safe and reasonable — that progress is not modified by this forward. For target-node verification after transition, bind the Guard to the Allocator instead (allocation.alloc runs AFTER the state transition completes)."
13107
13136
  }
13108
13137
  },
13109
13138
  "required": [
@@ -13113,7 +13142,7 @@
13113
13142
  "additionalProperties": false,
13114
13143
  "description": "Forward in Machine object"
13115
13144
  },
13116
- "description": "Forward list"
13145
+ "description": "Forward list — operations to ENTER THIS NODE from prev_node. Example: pair {prev_node:'A', forwards:[{name:'Go'}]} means 'use Go to advance FROM A TO THIS NODE'. For initial node (prev_node=''), forwards are operations to enter this node from the start state. WARNING: forwards belong to the DESTINATION node's pair, NOT the source node. Placing a forward on the wrong pair will cause Progress to get stuck."
13117
13146
  }
13118
13147
  },
13119
13148
  "required": [
@@ -14172,7 +14201,7 @@
14172
14201
  "number",
14173
14202
  "string"
14174
14203
  ],
14175
- "description": "Balance type"
14204
+ "description": "A coin/balance amount in the smallest on-chain unit (u64). Accepts a JS number OR a numeric string. PRECISION RULE: for values exceeding 2^53 (e.g. token amounts with 18 decimals), ALWAYS pass a numeric STRING (e.g. \"1000000000000000000\") to preserve precision — JS numbers lose precision above 2^53. UNIT: this is the smallest unit, NOT the display unit. For SUI: 1 SUI = 10^9 MIST, so 10 SUI = 10000000000. For custom tokens: use the token's native smallest unit (decimals from coin metadata). Examples: 10000000000 (10 SUI), \"1000000000000000000\" (1 token with 18 decimals), 500 (500 units of a token with 0 decimals). Used for: Service.sale.price, Service.compensation_fund_add balance, Treasury.deposit, Arbitration.fee, Reward.amount, stock quantities."
14176
14205
  },
14177
14206
  "token_type": {
14178
14207
  "type": "string",