@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.
- package/README.md +19 -11
- package/dist/index.js +44 -100
- package/dist/schema/query/index.js +1 -1
- package/dist/schema-query/index.d.ts +29 -0
- package/dist/schema-query/index.js +149 -0
- package/dist/schemas/account_operation.schema.json +255 -0
- package/dist/schemas/guard2file.schema.json +71 -0
- package/dist/schemas/index.json +139 -0
- package/dist/schemas/local_info_operation.schema.json +142 -0
- package/dist/schemas/local_mark_operation.schema.json +119 -0
- package/dist/schemas/machineNode2file.schema.json +71 -0
- package/dist/schemas/messenger_operation.schema.json +1393 -0
- package/dist/schemas/onchain_events.schema.json +113 -0
- package/dist/schemas/onchain_operations.schema.json +376 -0
- package/dist/schemas/onchain_operations_allocation.schema.json +914 -0
- package/dist/schemas/onchain_operations_arbitration.schema.json +1166 -0
- package/dist/schemas/onchain_operations_contact.schema.json +853 -0
- package/dist/schemas/onchain_operations_demand.schema.json +984 -0
- package/dist/schemas/onchain_operations_gen_passport.schema.json +1141 -0
- package/dist/schemas/onchain_operations_guard.schema.json +713 -0
- package/dist/schemas/onchain_operations_machine.schema.json +1347 -0
- package/dist/schemas/onchain_operations_order.schema.json +830 -0
- package/dist/schemas/onchain_operations_payment.schema.json +717 -0
- package/dist/schemas/onchain_operations_permission.schema.json +1088 -0
- package/dist/schemas/onchain_operations_personal.schema.json +1282 -0
- package/dist/schemas/onchain_operations_progress.schema.json +751 -0
- package/dist/schemas/onchain_operations_repository.schema.json +1572 -0
- package/dist/schemas/onchain_operations_reward.schema.json +955 -0
- package/dist/schemas/onchain_operations_service.schema.json +1411 -0
- package/dist/schemas/onchain_operations_treasury.schema.json +1155 -0
- package/dist/schemas/onchain_table_data.schema.json +35 -0
- package/dist/schemas/query_toolkit.schema.json +32 -0
- package/dist/schemas/schema_query.schema.json +33 -0
- package/dist/schemas/wip_file.schema.json +27 -0
- package/dist/schemas/wowok_buildin_info.schema.json +487 -0
- package/package.json +7 -5
- package/dist/docs/index.d.ts +0 -3
- package/dist/docs/index.js +0 -2
- package/dist/docs/loader.d.ts +0 -12
- package/dist/docs/loader.js +0 -177
- package/dist/docs/search.d.ts +0 -17
- package/dist/docs/search.js +0 -325
- package/dist/docs/types.d.ts +0 -55
- package/dist/docs/types.js +0 -1
- package/docs/README.md +0 -249
- package/docs/WIP.md +0 -388
- package/docs/WTS.md +0 -536
- package/docs/docs/account.md +0 -914
- package/docs/docs/allocation.md +0 -635
- package/docs/docs/arbitration.md +0 -1804
- package/docs/docs/arbitration_state_machine.md +0 -270
- package/docs/docs/contact.md +0 -709
- package/docs/docs/demand.md +0 -948
- package/docs/docs/guard.md +0 -1465
- package/docs/docs/localinfo.md +0 -432
- package/docs/docs/localmark.md +0 -583
- package/docs/docs/machine.md +0 -2490
- package/docs/docs/messenger.md +0 -2098
- package/docs/docs/onchain_events.md +0 -267
- package/docs/docs/order.md +0 -1001
- package/docs/docs/payment.md +0 -512
- package/docs/docs/permission.md +0 -1438
- package/docs/docs/personal.md +0 -742
- package/docs/docs/progress.md +0 -1748
- package/docs/docs/query.md +0 -467
- package/docs/docs/repository.md +0 -1043
- package/docs/docs/reward.md +0 -833
- package/docs/docs/service.md +0 -2130
- package/docs/docs/stage-01-introduction.md +0 -243
- package/docs/docs/stage-02-trust.md +0 -302
- package/docs/docs/stage-03-collaboration.md +0 -337
- package/docs/docs/stage-04-transaction.md +0 -277
- package/docs/docs/stage-05-business.md +0 -151
- package/docs/docs/stage-06-personal.md +0 -203
- package/docs/docs/stage-07-query.md +0 -572
- package/docs/docs/stage-08-examples.md +0 -184
- package/docs/docs/treasury.md +0 -1149
- package/docs/docs/wowok_buildin_info.md +0 -740
- package/docs/examples/Insurance/Insurance.md +0 -594
- package/docs/examples/Insurance/Insurance_TestResults.md +0 -481
- package/docs/examples/Insurance/insurance_complete_guard_v1.json +0 -50
- package/docs/examples/MyShop/MyShop.md +0 -1353
- package/docs/examples/MyShop/MyShop_TestResults.md +0 -1003
- package/docs/examples/MyShop_Advanced/MyShop_Advanced.md +0 -1898
- package/docs/examples/MyShop_Advanced/MyShop_Advanced_MerchantSystem_TestResults.md +0 -1297
- package/docs/examples/MyShop_Advanced/MyShop_Advanced_OrderFlow_TestResults.md +0 -743
- package/docs/examples/MyShop_Advanced/machine_nodes.json +0 -222
- package/docs/examples/ThreeBody_Signature/ThreeBody_Signature.md +0 -776
- package/docs/examples/ThreeBody_Signature/ThreeBody_Signature_TestResults.md +0 -599
- package/docs/examples/Travel/Travel.md +0 -1157
- package/docs/examples/Travel/Travel_TestResults.md +0 -743
- package/docs/examples/Travel/calc-weather-timestamps.js +0 -8
- package/docs/examples/Travel/travel_machine_v2_export.json +0 -104
- package/docs/examples/Travel/weather_check_guard_v1.json +0 -51
- package/docs/skills/WOWOK.md +0 -650
- package/docs/skills/onchain_operations/_common.md +0 -406
- package/docs/skills/onchain_operations/_index.md +0 -196
- package/docs/skills/onchain_operations/allocation.md +0 -28
- package/docs/skills/onchain_operations/arbitration.md +0 -106
- package/docs/skills/onchain_operations/contact.md +0 -40
- package/docs/skills/onchain_operations/demand.md +0 -53
- package/docs/skills/onchain_operations/gen_passport.md +0 -23
- package/docs/skills/onchain_operations/guard.md +0 -56
- package/docs/skills/onchain_operations/machine.md +0 -89
- package/docs/skills/onchain_operations/order.md +0 -56
- package/docs/skills/onchain_operations/payment.md +0 -24
- package/docs/skills/onchain_operations/permission.md +0 -68
- package/docs/skills/onchain_operations/personal.md +0 -58
- package/docs/skills/onchain_operations/progress.md +0 -38
- package/docs/skills/onchain_operations/repository.md +0 -70
- package/docs/skills/onchain_operations/reward.md +0 -38
- package/docs/skills/onchain_operations/service.md +0 -78
- package/docs/skills/onchain_operations/treasury.md +0 -68
- package/docs/skills/schema-account_operation.md +0 -402
- package/docs/skills/schema-guard2file.md +0 -153
- package/docs/skills/schema-local_info_operation.md +0 -160
- package/docs/skills/schema-local_mark_operation.md +0 -148
- package/docs/skills/schema-machineNode2file.md +0 -155
- package/docs/skills/schema-messenger_operation.md +0 -547
- package/docs/skills/schema-onchain_events.md +0 -201
- package/docs/skills/schema-onchain_table_data.md +0 -334
- package/docs/skills/schema-query_toolkit.md +0 -395
- package/docs/skills/schema-wip_file.md +0 -240
- package/docs/skills/schema-wowok_buildin_info.md +0 -296
- package/docs/wip-examples/three_body.html +0 -57
- package/docs/wip-examples/three_body.wip +0 -30
package/docs/skills/WOWOK.md
DELETED
|
@@ -1,650 +0,0 @@
|
|
|
1
|
-
# WoWok AI Skill Framework
|
|
2
|
-
|
|
3
|
-
> Master guidance for AI agents operating the WoWok MCP Server (@wowok/agent-mcp). This document provides core principles, design patterns, and operational rules. For detailed tool schemas, see `schema-<tool_name>.md` files in this directory.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Table of Contents
|
|
8
|
-
|
|
9
|
-
1. [Core Principles](#1-core-principles)
|
|
10
|
-
2. [Common Schemas & Patterns](#2-common-schemas--patterns)
|
|
11
|
-
3. [Tool Selection Guide](#3-tool-selection-guide)
|
|
12
|
-
4. [Object Creation Order (Dependency Chain)](#4-object-creation-order-dependency-chain)
|
|
13
|
-
5. [Guard Design Rules](#5-guard-design-rules)
|
|
14
|
-
6. [Machine Workflow Patterns](#6-machine-workflow-patterns)
|
|
15
|
-
7. [Operational Best Practices](#7-operational-best-practices)
|
|
16
|
-
8. [Appendix: Value Types](#8-appendix-value-types)
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## 1. Core Principles
|
|
21
|
-
|
|
22
|
-
### 1.1 Security & Safety
|
|
23
|
-
|
|
24
|
-
- **Hot Wallet Usage**: WoWok never exposes private keys. Treat it as a spending account for transfers, receipts, and commerce. Flag large transactions for explicit user confirmation.
|
|
25
|
-
- **Amount-Sensitive Operations**: Any token transfer, payment, or reward distribution MUST be verbally confirmed with the user before execution. Use `Payment` objects for commercial transfers when possible (they offer Guard validation and purpose tracking).
|
|
26
|
-
- **LOCAL vs ON-CHAIN**: Tools marked `LOCAL ONLY` (`account_operation`, `local_mark_operation`, `local_info_operation`) never touch the blockchain and consume no gas.
|
|
27
|
-
- **Default Account**: Empty string `""` means the default account. Always use the default when the user does not specify an account.
|
|
28
|
-
|
|
29
|
-
### 1.2 Network & Token Defaults
|
|
30
|
-
|
|
31
|
-
| Parameter | Default Value | Notes |
|
|
32
|
-
|-----------|---------------|-------|
|
|
33
|
-
| Network | `testnet` | Override via `env.network` |
|
|
34
|
-
| Token | `0x2::wow::WOW` | 9 decimals (1 WOW = 1_000_000_000) |
|
|
35
|
-
|
|
36
|
-
- **Multi-Token Support**: All operations support custom `token_type`. ALWAYS query precision via `query_toolkit (token_list)` first. Never assume decimals.
|
|
37
|
-
- **Amount Formats**:
|
|
38
|
-
- With unit: `"2WOW"`, `"10.5USDT"` — auto-converted using token precision.
|
|
39
|
-
- Plain number: internal unit (e.g., `1000000000` = 1 WOW). Always clarify with users when displaying plain numbers.
|
|
40
|
-
|
|
41
|
-
### 1.3 Query-First Pattern
|
|
42
|
-
|
|
43
|
-
- **Query before mutate**: Always query current state before modifications. Use `query_toolkit` with filters.
|
|
44
|
-
- **Pagination**: All on-chain list queries (events, tables, received) support `cursor`/`limit`. Loop for large datasets.
|
|
45
|
-
- **Cache control**: Use `no_cache: true` for time-sensitive reads.
|
|
46
|
-
|
|
47
|
-
### 1.4 Naming Conventions (Mandatory for Complex Builds)
|
|
48
|
-
|
|
49
|
-
When users request complex systems (multiple objects, Guards, Machines, Services) without naming, propose a naming scheme:
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
<projectPrefix>_<type>_<purpose>_<version>
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
- **Project prefix**: e.g., `shopFunny_` — prevents cross-project collisions.
|
|
56
|
-
- **Type prefix**: e.g., `shopFunny_machine_`, `shopFunny_guard_` — clarifies object type.
|
|
57
|
-
- **Purpose suffix**: e.g., `shopFunny_guard_serviceWithdraw_v2` — describes function.
|
|
58
|
-
- **Version suffix**: e.g., `_v2` — enables iteration.
|
|
59
|
-
- **Tags**: Always provide `tags` on object creation for filtering and management.
|
|
60
|
-
- **Address display**: Use short form (`0x1234...def`). Use names as primary identifiers.
|
|
61
|
-
|
|
62
|
-
### 1.5 `replaceExistName` Flag
|
|
63
|
-
|
|
64
|
-
The `replaceExistName` boolean flag appears in **name configuration objects** (e.g., `name.replaceExistName` inside `MarkParam` and `AccountOperation.gen`). It controls whether a name collision causes an error or silently reclaims the name from an existing object.
|
|
65
|
-
|
|
66
|
-
**Schema Hierarchy**
|
|
67
|
-
```
|
|
68
|
-
OperationInput
|
|
69
|
-
└── name: object
|
|
70
|
-
├── value: string // The desired name
|
|
71
|
-
└── replaceExistName: boolean (optional, default: false)
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
**Behavior**
|
|
75
|
-
| `replaceExistName` | Effect |
|
|
76
|
-
|--------------------|--------|
|
|
77
|
-
| `false` (default) | Throws an error if the name is already in use. |
|
|
78
|
-
| `true` | Steals the name from the existing object and assigns it to the new one. The old object becomes unnamed. |
|
|
79
|
-
|
|
80
|
-
**Why It Matters**
|
|
81
|
-
- **Repeatable testing**: In iterative build-and-test workflows, you can reuse a fixed name (e.g., `testGuard_v1`) without manually cleaning up old objects first.
|
|
82
|
-
- **Deterministic references**: Scripts and documentation can refer to objects by stable names instead of unpredictable addresses.
|
|
83
|
-
- **Safe default**: Default `false` prevents accidental name hijacking in production; set `true` only when you explicitly intend to overwrite.
|
|
84
|
-
|
|
85
|
-
### 1.6 Guard Submission Mechanism
|
|
86
|
-
|
|
87
|
-
When an on-chain operation requires Guard validation and the Guard's table contains entries with **`b_submission: true`** (meaning user-submitted data is required for verification), the operation does NOT immediately return a transaction result. Instead, it returns a **`type: "submission"`** response containing the Guard's data requirements.
|
|
88
|
-
|
|
89
|
-
**Two-Step Flow**:
|
|
90
|
-
|
|
91
|
-
```
|
|
92
|
-
Step 1 — Initial Call
|
|
93
|
-
├── onchain_operations (service/machine/progress/order/etc.)
|
|
94
|
-
└── Response: type="submission"
|
|
95
|
-
├── guard: [{ object, impack }] — Guards to verify
|
|
96
|
-
└── submission: [{ guard, submission: [{ identifier, value_type, value?, name }] }]
|
|
97
|
-
↑ You ONLY fill the `value` field based on `value_type`. Do NOT modify other fields.
|
|
98
|
-
|
|
99
|
-
Step 2 — Re-submit with Data
|
|
100
|
-
├── Same operation data
|
|
101
|
-
└── Add top-level `submission` field:
|
|
102
|
-
{
|
|
103
|
-
"type": "submission",
|
|
104
|
-
"guard": [{ "object": "guard_name", "impack": true }],
|
|
105
|
-
"submission": [{
|
|
106
|
-
"guard": "guard_name",
|
|
107
|
-
"submission": [
|
|
108
|
-
{ "identifier": 0, "value_type": "String", "value": "your_data_here" }
|
|
109
|
-
]
|
|
110
|
-
}]
|
|
111
|
-
}
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
**Critical Rules**:
|
|
115
|
-
- **Only fill `value`**: The returned submission template has `identifier`, `value_type`, `name` pre-filled. You ONLY add the `value` field matching the `value_type`. Never modify `identifier`, `value_type`, or `name`.
|
|
116
|
-
- **Value type matching**: `value_type` indicates the expected type (String, Address, U64, Bool, etc.). The `value` must match this type exactly.
|
|
117
|
-
- **Impack flag**: `impack: true` means this Guard's verification result affects the final outcome. All `impack=true` Guards must pass for the operation to proceed.
|
|
118
|
-
- **Multiple Guards**: If multiple Guards require submission, include all in the `submission` array.
|
|
119
|
-
|
|
120
|
-
**Operations Supporting Submission** (non-exhaustive):
|
|
121
|
-
`service`, `machine`, `progress`, `repository`, `arbitration`, `treasury`, `reward`, `allocation`, `demand`, `order`, `gen_passport`
|
|
122
|
-
|
|
123
|
-
**Common Submission Scenarios**:
|
|
124
|
-
- **Merkle Root proof**: `value_type: "String"`, value = 64-char hex string.
|
|
125
|
-
- **Progress/Order address**: `value_type: "Address"`, value = object name or ID.
|
|
126
|
-
- **Time verification**: `value_type: "Address"`, value = Progress address (for time-elapsed Guards).
|
|
127
|
-
- **Node set validation**: `value_type: "U64"` or custom type depending on Guard design.
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
## 1.7 User-Friendly Display Conventions
|
|
132
|
-
|
|
133
|
-
When displaying addresses, IDs, or object references to users, follow these naming priority and formatting rules for optimal readability.
|
|
134
|
-
|
|
135
|
-
### 1.7.1 Name Resolution Priority
|
|
136
|
-
|
|
137
|
-
| Priority | Source | Display Format | Example |
|
|
138
|
-
|----------|--------|----------------|---------|
|
|
139
|
-
| 1 (Highest) | `local_mark_operation` (local mark) | `{local_mark_name} (localmark)` | `my_service (localmark)` |
|
|
140
|
-
| 2 | `account_operation` (account name) | `{account_name}` | `alice_wallet` |
|
|
141
|
-
| 3 (Fallback) | None / Unnamed | `{first6}...{last3}` | `0x3a2f...8c1` |
|
|
142
|
-
|
|
143
|
-
**Rules**:
|
|
144
|
-
- Always prefer the **local mark name** if one exists. Append `(localmark)` to indicate the source.
|
|
145
|
-
- If no local mark exists, use the **account name** if available. Append `(account)` to indicate the source.
|
|
146
|
-
- Only fall back to the truncated address format when no name is found.
|
|
147
|
-
- Unless the user explicitly specifies a different priority, follow the order above.
|
|
148
|
-
|
|
149
|
-
### 1.7.2 Address Truncation Format
|
|
150
|
-
|
|
151
|
-
For unnamed addresses, use the compact format:
|
|
152
|
-
|
|
153
|
-
```
|
|
154
|
-
{first_6_chars}...{last_3_chars}
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
- Include the `0x` prefix in the character count if present.
|
|
158
|
-
- Use exactly **three dots** (`...`) as the separator.
|
|
159
|
-
- Example: `0x3a2f...8c1`
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
## 2. Common Schemas & Patterns
|
|
164
|
-
|
|
165
|
-
### 2.1 CallEnv
|
|
166
|
-
|
|
167
|
-
Environment configuration for on-chain operations.
|
|
168
|
-
|
|
169
|
-
```typescript
|
|
170
|
-
CallEnv {
|
|
171
|
-
account?: string; // Operating account (empty = default)
|
|
172
|
-
permission_guard?: string[]; // Permission Guard ID list for extended permissions
|
|
173
|
-
no_cache?: boolean; // Disable cache for fresh chain state
|
|
174
|
-
network?: "localnet" | "testnet"; // Target network
|
|
175
|
-
referrer?: string; // Referrer ID
|
|
176
|
-
}
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
**Important**: When building multiple interdependent objects, **set `env.no_cache: true`** on every operation to ensure fresh state.
|
|
180
|
-
|
|
181
|
-
### 2.2 NamedObject Pattern
|
|
182
|
-
|
|
183
|
-
Naming configuration for new objects.
|
|
184
|
-
|
|
185
|
-
```typescript
|
|
186
|
-
NamedObject {
|
|
187
|
-
name?: string; // Object name (max 64 chars)
|
|
188
|
-
tags?: string[]; // Tags for organization
|
|
189
|
-
onChain?: boolean; // Whether to sync name to blockchain (PUBLIC if true)
|
|
190
|
-
replaceExistName?: boolean; // Force claim existing name (default: false)
|
|
191
|
-
}
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
**Important**: By default (`onChain: false` or undefined), names are stored LOCALLY ONLY. Set `onChain: true` to create a PUBLIC on-chain identity.
|
|
195
|
-
|
|
196
|
-
### 2.3 Object Reference Patterns
|
|
197
|
-
|
|
198
|
-
Most object fields support two formats:
|
|
199
|
-
|
|
200
|
-
| Format | Type | Usage |
|
|
201
|
-
|--------|------|-------|
|
|
202
|
-
| String | `NameOrAddressSchema` | Reference EXISTING object by name or ID |
|
|
203
|
-
| Object | `NamedObjectSchema` | CREATE NEW object with name/tags |
|
|
204
|
-
|
|
205
|
-
Example:
|
|
206
|
-
```json
|
|
207
|
-
// Reference existing
|
|
208
|
-
{ "object": "my_existing_service" }
|
|
209
|
-
|
|
210
|
-
// Create new
|
|
211
|
-
{ "object": { "name": "my_new_service", "tags": ["v1"] } }
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
### 2.4 CoinParam
|
|
215
|
-
|
|
216
|
-
Token amount specification.
|
|
217
|
-
|
|
218
|
-
```typescript
|
|
219
|
-
CoinParam =
|
|
220
|
-
| { balance: string | number } // Amount with optional unit (e.g., "10WOW" = 10_000_000_000)
|
|
221
|
-
| { coin: string }; // Specific coin object ID
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
---
|
|
225
|
-
|
|
226
|
-
## 3. Tool Selection Guide
|
|
227
|
-
|
|
228
|
-
| User Intent | Correct Tool | Notes |
|
|
229
|
-
|------------|--------------|-------|
|
|
230
|
-
| Create service listing | `onchain_operations` (service) | Marketplace listings with pricing |
|
|
231
|
-
| Send coins to address | `onchain_operations` (payment) | Direct wallet-to-wallet transfer |
|
|
232
|
-
| Check my balance | `query_toolkit` (account_balance) | Read-only query |
|
|
233
|
-
| Manage local wallet | `account_operation` | LOCAL ONLY |
|
|
234
|
-
| Export Guard for edit | `guard2file` | Export to JSON/Markdown |
|
|
235
|
-
| Send encrypted message | `messenger_operation` | End-to-end encryption |
|
|
236
|
-
| Create workflow template | `onchain_operations` (machine) | State machine definition |
|
|
237
|
-
| Store my phone number | `local_info_operation` | LOCAL ONLY |
|
|
238
|
-
| Buy service | `onchain_operations` (order) | Creates Order from Service |
|
|
239
|
-
| Apply for arbitration | `onchain_operations` (order) | Order manages Arb lifecycle |
|
|
240
|
-
| Create reward pool | `onchain_operations` (reward) | Marketing incentives |
|
|
241
|
-
| Claim rewards | `onchain_operations` (reward) | Guard-verified claiming |
|
|
242
|
-
| Create fund allocation | `onchain_operations` (allocation) | Auto-distribution plans |
|
|
243
|
-
| Create access control | `onchain_operations` (permission) | Permission indices |
|
|
244
|
-
| Create validation rules | `onchain_operations` (guard) | Programmable boolean logic |
|
|
245
|
-
|
|
246
|
-
### 3.1 Local vs On-chain Operations
|
|
247
|
-
|
|
248
|
-
**LOCAL ONLY** (Never touch blockchain):
|
|
249
|
-
- `account_operation`
|
|
250
|
-
- `local_mark_operation`
|
|
251
|
-
- `local_info_operation`
|
|
252
|
-
|
|
253
|
-
**ON-CHAIN** (Blockchain transactions):
|
|
254
|
-
- `onchain_operations`
|
|
255
|
-
- `messenger_operation` (some operations)
|
|
256
|
-
- `wip_file` (sign operation)
|
|
257
|
-
|
|
258
|
-
**QUERY** (Read-only):
|
|
259
|
-
- `query_toolkit`
|
|
260
|
-
- `onchain_table_data`
|
|
261
|
-
- `onchain_events`
|
|
262
|
-
- `wowok_buildin_info`
|
|
263
|
-
- `guard2file`
|
|
264
|
-
- `machineNode2file`
|
|
265
|
-
- `documents_and_learn`
|
|
266
|
-
|
|
267
|
-
---
|
|
268
|
-
|
|
269
|
-
## 4. Object Creation Order (Dependency Chain)
|
|
270
|
-
|
|
271
|
-
### 4.1 Canonical Service Build Order
|
|
272
|
-
|
|
273
|
-
> ⚠️ **Important**: When building multiple interdependent objects in one session, **set `env.no_cache: true`** on every operation. Local cache may lag behind chain state — creating Service → Guard referencing Service → Machine referencing Guard requires fresh reads at each step. Pure queries and single-step operations may omit `no_cache`.
|
|
274
|
-
|
|
275
|
-
```
|
|
276
|
-
1. Permission (infrastructure; reusable across projects)
|
|
277
|
-
2. Service (create empty, publish=false)
|
|
278
|
-
3. Machine (create workflow, publish=false)
|
|
279
|
-
4. Guard (reference Service and Machine for validation)
|
|
280
|
-
5. order_allocators (fund distribution rules)
|
|
281
|
-
6. Arbitration (bind before Service publish)
|
|
282
|
-
7. Reward (depends on published Service + Guard)
|
|
283
|
-
8. Publish Machine → Bind Machine/Objects to Service → Publish Service
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
### 4.2 Critical Constraints
|
|
287
|
-
|
|
288
|
-
- **Machine publish=true**: Node structure becomes immutable. Export via `machineNode2file` and confirm with user before publishing.
|
|
289
|
-
- **Service publish=true**: Machine, Arbitration, Reward bindings become immutable. Export full info and confirm before publishing.
|
|
290
|
-
- **Machine nodes**: Initial node name is `""` (empty string). Each node has `pairs` (prior_node → forwards). Each forward has `weight`, `permissionIndex` OR `namedOperator` (required), and optional `guard`.
|
|
291
|
-
- **CRITICAL**: At least one node MUST have a pair with `prev_node: ""` (empty string). This defines the entry point from the initial state. Without such a node, Progress cannot advance from its initial empty state.
|
|
292
|
-
- `permissionIndex`: Shared across all Progress instances (internal roles).
|
|
293
|
-
- `namedOperator`: Per-Progress namespace (external roles). Order user operations MUST use `namedOperator("")`.
|
|
294
|
-
- **Progress advancement**: Sum of completed forward weights ≥ threshold → session moves to history, next node becomes current.
|
|
295
|
-
- Order users advance via `Order` object.
|
|
296
|
-
- Non-order users advance via `Progress` object directly.
|
|
297
|
-
|
|
298
|
-
### 4.3 Object Dependencies Summary
|
|
299
|
-
|
|
300
|
-
| Object | Depends On | Can Be Bound To | Immutable When |
|
|
301
|
-
|--------|-----------|-----------------|----------------|
|
|
302
|
-
| Permission | None | All other objects | Never (always editable) |
|
|
303
|
-
| Service | Permission | Machine, Allocation, Arbitration | `bPublished: true` |
|
|
304
|
-
| Machine | Permission | Service | `bPublished: true` |
|
|
305
|
-
| Guard | None | Service, Machine, Order, Treasury, etc. | Never (always editable) |
|
|
306
|
-
| Allocation | Permission, Guard | Service | `bPublished: true` (via Service) |
|
|
307
|
-
| Arbitration | Permission, Guard | Service | `bPublished: true` (via Service) |
|
|
308
|
-
| Order | Service, Permission | Progress, Allocation | After creation (some fields) |
|
|
309
|
-
| Progress | Machine, Order | None | During advancement |
|
|
310
|
-
|
|
311
|
-
### 4.4 Common Mistakes to Avoid
|
|
312
|
-
|
|
313
|
-
1. **Publishing too early**: Once published, Service and Machine cannot be modified. Always test thoroughly before publishing.
|
|
314
|
-
2. **Forgetting no_cache**: When creating interdependent objects, always set `env.no_cache: true` to ensure fresh state.
|
|
315
|
-
3. **Wrong order of operations**: Create Permission → Service (unpublished) → Machine (unpublished) → Guards → Allocation → Arbitration → Bind → Publish.
|
|
316
|
-
4. **Missing permission indices**: When creating Machine forwards, ensure the permission indices exist in the Permission object.
|
|
317
|
-
5. **Not exporting before publish**: Use `guard2file` and `machineNode2file` to export and review Guard and Machine definitions before publishing.
|
|
318
|
-
|
|
319
|
-
### 4.5 Privacy & Consensus via Messenger
|
|
320
|
-
|
|
321
|
-
Sensitive logistics and customer data flow through Messenger's end-to-end encryption (never on-chain, AI-automatable). Guard consensus follows: **who performs the key action, submits the proof; the other party confirms**.
|
|
322
|
-
|
|
323
|
-
| Scenario | Action | Proof Submission |
|
|
324
|
-
|----------|--------|------------------|
|
|
325
|
-
| Merchant ships | Receives address via Messenger, replies tracking number | Merchant submits Merkle Root to Guard |
|
|
326
|
-
| Customer returns | Sends return tracking via Messenger | Customer submits Merkle Root to Guard |
|
|
327
|
-
| Mutual confirmation | Both parties sign | Both submit confirmation proofs |
|
|
328
|
-
|
|
329
|
-
### 4.6 Payments & Refunds
|
|
330
|
-
|
|
331
|
-
- **Service purchase**: Always pay through `Service`. Name the generated `Order`, `Progress`, and `Allocation` via `namedNew*` fields for easy management.
|
|
332
|
-
- **Order operations**: All order user operations MUST go through `Order` object.
|
|
333
|
-
- **Refunds/withdrawals**: Users satisfy `Allocation` Guard conditions to withdraw instantly.
|
|
334
|
-
- **Arbitration claims**: Compensation payouts go through `Order`.
|
|
335
|
-
- **Alternative payments**:
|
|
336
|
-
- `account_operation (transfer)`: Direct wallet-to-wallet.
|
|
337
|
-
- `onchain_operations (payment)`: Payment object with commercial features (purpose, Guard validation).
|
|
338
|
-
|
|
339
|
-
---
|
|
340
|
-
|
|
341
|
-
## 5. Guard Design Rules
|
|
342
|
-
|
|
343
|
-
Guard is WoWok's on-chain validation engine. Every Guard object is a pure function tree that evaluates to `Bool` (pass/fail). Designing Guards correctly requires strict adherence to type safety, node constraints, and data flow rules.
|
|
344
|
-
|
|
345
|
-
### 5.1 The Root Node MUST Return Bool
|
|
346
|
-
|
|
347
|
-
The `root` field is mandatory. It defines the validation logic as a computational tree:
|
|
348
|
-
|
|
349
|
-
- `root.type = "node"`: Provide a `GuardNode` computational tree directly.
|
|
350
|
-
- `root.type = "file"`: Load the tree from a JSON/Markdown file (useful for complex Guards).
|
|
351
|
-
|
|
352
|
-
**The root node MUST return a `Bool` value (ValueType = 0).** This is the final pass/fail verdict. Any non-bool return type at the root is invalid and will cause Guard creation to fail.
|
|
353
|
-
|
|
354
|
-
### 5.2 Strong Typing Throughout
|
|
355
|
-
|
|
356
|
-
Guard validation is **strongly typed** from node design to user submission. Every node declares its return type, and child nodes must match the parent node's expected input types.
|
|
357
|
-
|
|
358
|
-
**Supported Value Types**:
|
|
359
|
-
|
|
360
|
-
| Type | ID | Description |
|
|
361
|
-
|------|-----|-------------|
|
|
362
|
-
| Bool | 0 | Boolean true/false |
|
|
363
|
-
| Address | 1 | Object or account address |
|
|
364
|
-
| String | 2 | UTF-8 string |
|
|
365
|
-
| U8 | 3 | 8-bit unsigned integer (0-255) |
|
|
366
|
-
| U16 | 4 | 16-bit unsigned integer (0-65535) |
|
|
367
|
-
| U32 | 5 | 32-bit unsigned integer |
|
|
368
|
-
| U64 | 6 | 64-bit unsigned integer |
|
|
369
|
-
| U128 | 7 | 128-bit unsigned integer |
|
|
370
|
-
| U256 | 8 | 256-bit unsigned integer |
|
|
371
|
-
| VecBool | 9 | Vector of booleans |
|
|
372
|
-
| VecAddress | 10 | Vector of addresses |
|
|
373
|
-
| VecString | 11 | Vector of strings |
|
|
374
|
-
| VecU8 | 12 | Vector of U8 |
|
|
375
|
-
| VecU16 | 13 | Vector of U16 |
|
|
376
|
-
| VecU32 | 14 | Vector of U32 |
|
|
377
|
-
| VecU64 | 15 | Vector of U64 |
|
|
378
|
-
| VecU128 | 16 | Vector of U128 |
|
|
379
|
-
| VecU256 | 17 | Vector of U256 |
|
|
380
|
-
| VecVecU8 | 18 | Vector of VecU8 |
|
|
381
|
-
| Value | 19 | **Internal dynamic type. Do NOT use directly.** |
|
|
382
|
-
|
|
383
|
-
**Guard Table Items** define the data schema:
|
|
384
|
-
|
|
385
|
-
```typescript
|
|
386
|
-
{
|
|
387
|
-
identifier: number, // 0-255, unique index in Guard table
|
|
388
|
-
b_submission: boolean, // true = user must submit this value; false = must provide default value
|
|
389
|
-
value_type: ValueType, // MUST match the expected type
|
|
390
|
-
value?: SupportedValue, // Required when b_submission=false; omit when b_submission=true
|
|
391
|
-
name: string // Description of this data field
|
|
392
|
-
}
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
- When `b_submission: true`: The value is provided by the user at verification time. Do NOT set a default `value`.
|
|
396
|
-
- When `b_submission: false`: A default `value` MUST be provided, and it must exactly match the declared `value_type`.
|
|
397
|
-
- Type mismatches between `value_type` and actual `value` (whether submitted or default) cause Guard evaluation to abort with failure.
|
|
398
|
-
|
|
399
|
-
### 5.3 Node Operand Constraints
|
|
400
|
-
|
|
401
|
-
Each node type enforces strict rules on the **number** and **types** of its child nodes (operands).
|
|
402
|
-
|
|
403
|
-
**Multi-Operand Nodes** (2 to 8 children, via `nodes` array):
|
|
404
|
-
|
|
405
|
-
| Node Type | Return Type | Child Node Requirements |
|
|
406
|
-
|-----------|-------------|------------------------|
|
|
407
|
-
| `logic_and` / `logic_or` | Bool | 2-8 Bool nodes |
|
|
408
|
-
| `logic_equal` | Bool | 2-8 nodes of any type (type + value must match) |
|
|
409
|
-
| `logic_as_u256_greater_or_equal` | Bool | 2-8 numeric nodes (U8, U16, U32, U64, U128, U256) |
|
|
410
|
-
| `logic_as_u256_lesser_or_equal` | Bool | 2-8 numeric nodes |
|
|
411
|
-
| `logic_as_u256_greater` | Bool | 2-8 numeric nodes |
|
|
412
|
-
| `logic_as_u256_lesser` | Bool | 2-8 numeric nodes |
|
|
413
|
-
| `logic_as_u256_equal` | Bool | 2-8 numeric nodes |
|
|
414
|
-
| `logic_string_contains` | Bool | 2-8 String nodes |
|
|
415
|
-
| `logic_string_nocase_contains` | Bool | 2-8 String nodes |
|
|
416
|
-
| `logic_string_nocase_equal` | Bool | 2-8 String nodes |
|
|
417
|
-
| `calc_number_add` | U256 | 2-8 numeric nodes |
|
|
418
|
-
| `calc_number_multiply` | U256 | 2-8 numeric nodes |
|
|
419
|
-
| `calc_number_subtract` | U256 | 2-8 numeric nodes |
|
|
420
|
-
| `calc_number_divide` | U256 | 2-8 numeric nodes (divisor != 0) |
|
|
421
|
-
| `calc_number_mod` | U256 | 2-8 numeric nodes (divisor != 0) |
|
|
422
|
-
| `calc_string_nocase_contains` | Bool | 2-8 String nodes |
|
|
423
|
-
| `calc_string_nocase_equal` | Bool | 2-8 String nodes |
|
|
424
|
-
| `calc_string_contains` | Bool | 2-8 String nodes |
|
|
425
|
-
| `vec_contains_bool` | Bool | 2-8 nodes. First: VecBool or Value. Rest: Bool or Value. |
|
|
426
|
-
| `vec_contains_address` | Bool | 2-8 nodes. First: VecAddress or Value. Rest: Address or Value. |
|
|
427
|
-
| `vec_contains_string` | Bool | 2-8 nodes. First: VecString or Value. Rest: String or Value. |
|
|
428
|
-
| `vec_contains_string_nocase` | Bool | 2-8 nodes. First: VecString or Value. Rest: String or Value. |
|
|
429
|
-
| `vec_contains_number` | Bool | 2-8 nodes. First: VecU8-VecU256 or Value. Rest: U8-U256 or Value. |
|
|
430
|
-
|
|
431
|
-
**Single-Operand Nodes** (1 child, via `node`):
|
|
432
|
-
|
|
433
|
-
| Node Type | Return Type | Child Requirement |
|
|
434
|
-
|-----------|-------------|-------------------|
|
|
435
|
-
| `logic_not` | Bool | 1 Bool node |
|
|
436
|
-
| `calc_string_length` | U64 | 1 String node |
|
|
437
|
-
| `convert_number_address` | Address | 1 numeric node |
|
|
438
|
-
| `convert_address_number` | U256 | 1 Address node |
|
|
439
|
-
| `convert_number_string` | String | 1 numeric node |
|
|
440
|
-
| `convert_string_number` | U256 | 1 String node (must be valid number) |
|
|
441
|
-
| `convert_safe_u8` | U8 | 1 numeric node (0-255) |
|
|
442
|
-
| `convert_safe_u16` | U16 | 1 numeric node (0-65535) |
|
|
443
|
-
| `convert_safe_u32` | U32 | 1 numeric node |
|
|
444
|
-
| `convert_safe_u64` | U64 | 1 numeric node |
|
|
445
|
-
| `convert_safe_u128` | U128 | 1 numeric node |
|
|
446
|
-
| `convert_safe_u256` | U256 | 1 numeric node |
|
|
447
|
-
| `value_type` | U8 | 1 node of any type |
|
|
448
|
-
| `vec_length` | U64 | 1 Vec* node |
|
|
449
|
-
|
|
450
|
-
**Dual-Operand Nodes** (2 children, via `nodeLeft` + `nodeRight`):
|
|
451
|
-
|
|
452
|
-
| Node Type | Return Type | Left Requirement | Right Requirement |
|
|
453
|
-
|-----------|-------------|------------------|-------------------|
|
|
454
|
-
| `calc_string_indexof` | U64 | String | String |
|
|
455
|
-
| `calc_string_nocase_indexof` | U64 | String | String |
|
|
456
|
-
| `vec_indexof_bool` | U64 | VecBool or Value | Bool or Value |
|
|
457
|
-
| `vec_indexof_address` | U64 | VecAddress or Value | Address or Value |
|
|
458
|
-
| `vec_indexof_string` | U64 | VecString or Value | String or Value |
|
|
459
|
-
| `vec_indexof_string_nocase` | U64 | VecString or Value | String or Value |
|
|
460
|
-
| `vec_indexof_number` | U64 | VecU8-VecU256 or Value | U8-U256 or Value |
|
|
461
|
-
|
|
462
|
-
**Special Nodes**:
|
|
463
|
-
|
|
464
|
-
| Node Type | Return Type | Description |
|
|
465
|
-
|-----------|-------------|-------------|
|
|
466
|
-
| `identifier` | Declared type | Returns constant or submitted value from Guard table |
|
|
467
|
-
| `query` | Query-dependent | Executes data query on specified object |
|
|
468
|
-
| `context` | Signer: Address, Clock: U64, Guard: Address | System context values |
|
|
469
|
-
| `query_reward_record_find` | U64 | Finds first/last reward record index by recipient + filters. Returns index if found. **Throws error if not found** (Guard validation fails). |
|
|
470
|
-
| `query_reward_record_count` | U64 | Counts reward records matching filters |
|
|
471
|
-
| `query_reward_record_exists` | Bool | Checks if any reward record exists matching filters |
|
|
472
|
-
| `query_progress_history_find` | U64 | Finds first/last history entry index. Returns index if found. **Throws error if not found** (Guard validation fails). |
|
|
473
|
-
| `query_progress_history_session_find` | U64 | Finds first/last session index within history. Returns index if found. **Throws error if not found** (Guard validation fails). |
|
|
474
|
-
| `query_progress_history_session_forward_find` | U64 | Finds first/last forward index within session. Returns index if found. **Throws error if not found** (Guard validation fails). |
|
|
475
|
-
| `query_progress_history_session_count` | U64 | Counts sessions within history entry |
|
|
476
|
-
| `query_progress_history_session_forward_count` | U64 | Counts forwards within session |
|
|
477
|
-
| `query_progress_history_session_forward_retained_submission_count` | U64 | Counts retained submissions within forward |
|
|
478
|
-
|
|
479
|
-
### 5.4 Query Nodes and `convert_witness`
|
|
480
|
-
|
|
481
|
-
The `query` node is powerful: it fetches on-chain data dynamically during Guard evaluation. Its structure:
|
|
482
|
-
|
|
483
|
-
```typescript
|
|
484
|
-
{
|
|
485
|
-
type: "query",
|
|
486
|
-
query: number | string, // Guard query ID or name (e.g., 1001 or "permission.description")
|
|
487
|
-
object: {
|
|
488
|
-
identifier: number, // Reference to object address in Guard table
|
|
489
|
-
convert_witness?: number // Optional: fetch from associated object instead
|
|
490
|
-
},
|
|
491
|
-
parameters: GuardNode[] // Must match query's expected parameter types
|
|
492
|
-
}
|
|
493
|
-
```
|
|
494
|
-
|
|
495
|
-
**`convert_witness` — Cross-Object Data Retrieval**:
|
|
496
|
-
|
|
497
|
-
This is one of the most commonly used features. When querying an object, `convert_witness` allows you to fetch data from an **associated object** instead of the object itself.
|
|
498
|
-
|
|
499
|
-
| Witness Type | Value | Description |
|
|
500
|
-
|--------------|-------|-------------|
|
|
501
|
-
| TypeOrderProgress | 100 | From Order, get its Progress |
|
|
502
|
-
| TypeOrderMachine | 101 | From Order, get its Machine |
|
|
503
|
-
| TypeOrderService | 102 | From Order, get its Service |
|
|
504
|
-
| TypeProgressMachine | 103 | From Progress, get its Machine |
|
|
505
|
-
| TypeArbOrder | 104 | From Arb, get its Order |
|
|
506
|
-
| TypeArbArbitration | 105 | From Arb, get its Arbitration |
|
|
507
|
-
| TypeArbProgress | 106 | From Arb, get its Progress |
|
|
508
|
-
| TypeArbMachine | 107 | From Arb, get its Machine |
|
|
509
|
-
| TypeArbService | 108 | From Arb, get its Service |
|
|
510
|
-
|
|
511
|
-
**Example**: To verify that an Order's Progress is at a specific node, query the Order with `convert_witness = 100` (TypeOrderProgress) to fetch the Progress object, then query the Progress's current node name.
|
|
512
|
-
|
|
513
|
-
### 5.5 Discovering Query Instructions via `wowok_buildin_info`
|
|
514
|
-
|
|
515
|
-
Before using `query` nodes, you MUST discover available query instructions and their signatures:
|
|
516
|
-
|
|
517
|
-
```typescript
|
|
518
|
-
// Query all Guard instructions and object queries
|
|
519
|
-
{
|
|
520
|
-
info: "guard instructions",
|
|
521
|
-
filter: {
|
|
522
|
-
scope: "all", // "instruct" | "object query" | "all"
|
|
523
|
-
objectType?: string, // Filter by object type (for object queries)
|
|
524
|
-
returnType?: string, // Filter by return type
|
|
525
|
-
paramCount?: number, // Filter by parameter count
|
|
526
|
-
name?: string // Case-insensitive name filter
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
```
|
|
530
|
-
|
|
531
|
-
This returns a list of all available operations with:
|
|
532
|
-
- `id`: Numeric operation ID
|
|
533
|
-
- `name`: Human-readable name (e.g., "machine.description")
|
|
534
|
-
- `objectType`: Target object type
|
|
535
|
-
- `parameters`: Array of expected parameter types
|
|
536
|
-
- `return`: Return value type
|
|
537
|
-
- `description`: Detailed usage description
|
|
538
|
-
|
|
539
|
-
**Best Practice**: Always query `guard instructions` before designing complex Guards. This ensures you use the correct query IDs, parameter types, and return types.
|
|
540
|
-
|
|
541
|
-
---
|
|
542
|
-
|
|
543
|
-
## 6. Machine Workflow Patterns
|
|
544
|
-
|
|
545
|
-
Machine defines order processing state machines. Each node represents a state with executable forwards.
|
|
546
|
-
|
|
547
|
-
### 6.1 Node Structure
|
|
548
|
-
|
|
549
|
-
```typescript
|
|
550
|
-
MachineNode {
|
|
551
|
-
name: string; // Node name (initial node is "")
|
|
552
|
-
pairs: NodePair[]; // Prior node → forwards mappings
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
NodePair {
|
|
556
|
-
prior_node: string; // Previous node name ("" for entry)
|
|
557
|
-
forwards: Forward[]; // Available operations
|
|
558
|
-
threshold?: number; // Weight threshold to advance
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
Forward {
|
|
562
|
-
name: string; // Forward name
|
|
563
|
-
namedOperator?: string; // Per-Progress namespace
|
|
564
|
-
permissionIndex?: number; // Shared permission index
|
|
565
|
-
weight: number; // Forward weight
|
|
566
|
-
guard?: string; // Optional Guard
|
|
567
|
-
}
|
|
568
|
-
```
|
|
569
|
-
|
|
570
|
-
### 6.2 Critical Constraints
|
|
571
|
-
|
|
572
|
-
- **Initial node**: At least one node MUST have `prior_node: ""` (empty string).
|
|
573
|
-
- **Forward requirements**: Each forward MUST specify either `permissionIndex` OR `namedOperator` (both are supported).
|
|
574
|
-
- **Order user operations**: MUST use `namedOperator("")` for customer operations.
|
|
575
|
-
- **Publish immutability**: After `publish=true`, node structure is immutable.
|
|
576
|
-
|
|
577
|
-
### 6.3 Guard in Forwards
|
|
578
|
-
|
|
579
|
-
The optional `guard` field in a Forward is used to validate critical operation results before allowing the forward to complete. Common use cases include:
|
|
580
|
-
|
|
581
|
-
- **Repository submission validation**: Verify that required data was successfully submitted to a specified Repository object
|
|
582
|
-
- **Supply chain commitment validation**: Confirm that sub-order commitments in the supply chain were fulfilled
|
|
583
|
-
- **External condition checks**: Validate any external state or conditions that must be met before proceeding
|
|
584
|
-
|
|
585
|
-
When a forward has a Guard, the Guard's logic is evaluated when a user attempts to execute that forward. If the Guard returns `false`, the forward cannot be completed.
|
|
586
|
-
|
|
587
|
-
### 6.4 Progress Advancement
|
|
588
|
-
|
|
589
|
-
Sum of completed forward weights ≥ threshold → session completes → next node becomes current.
|
|
590
|
-
|
|
591
|
-
---
|
|
592
|
-
|
|
593
|
-
## 7. Operational Best Practices
|
|
594
|
-
|
|
595
|
-
### 7.1 Incremental Object Building
|
|
596
|
-
|
|
597
|
-
For complex objects with many fields (Service, Machine), use **incremental building** instead of creating everything in one call:
|
|
598
|
-
|
|
599
|
-
**Benefits**:
|
|
600
|
-
- Each step can be verified before proceeding
|
|
601
|
-
- Errors are isolated to specific fields
|
|
602
|
-
- Easier to retry failed steps without re-executing successful ones
|
|
603
|
-
- Better user feedback at each stage
|
|
604
|
-
|
|
605
|
-
### 7.2 Error Patterns
|
|
606
|
-
|
|
607
|
-
- **Guard validation failures**: After re-submitting with `submission`, if Guard logic evaluates to false, the transaction fails with a specific error. Review the Guard's rule tree (via `guard2file`) and the submitted data values.
|
|
608
|
-
- **File parsing failures** (`machineNode2file`, `guard2file`): Include line/column information in error messages. Check file format and schema compliance.
|
|
609
|
-
- **Cache stale reads**: If sequential operations fail unexpectedly (e.g., "object not found" when you just created it), retry with `env.no_cache: true`.
|
|
610
|
-
- **Permission denied**: The operating account lacks the required Permission index for this operation. Check the object's Permission configuration.
|
|
611
|
-
|
|
612
|
-
### 7.3 Testing & Validation Workflow
|
|
613
|
-
|
|
614
|
-
1. **Design Phase**: Use `wowok_buildin_info` to discover available permissions and Guard instructions
|
|
615
|
-
2. **Export & Review**: Before publishing, use `guard2file` and `machineNode2file` to export and review definitions
|
|
616
|
-
3. **Incremental Testing**: Build objects step-by-step, verifying each step
|
|
617
|
-
4. **Final Validation**: Test all Guard conditions and Machine transitions before publishing
|
|
618
|
-
5. **Publish**: Only after thorough testing, publish Service and Machine
|
|
619
|
-
|
|
620
|
-
---
|
|
621
|
-
|
|
622
|
-
## 8. Appendix: Value Types
|
|
623
|
-
|
|
624
|
-
### 8.1 Complete Value Type Reference
|
|
625
|
-
|
|
626
|
-
| Type | ID | String Form | Description |
|
|
627
|
-
|------|-----|-------------|-------------|
|
|
628
|
-
| Bool | 0 | "Bool" | Boolean true/false |
|
|
629
|
-
| Address | 1 | "Address" | WoWok address (0x + 64 hex) |
|
|
630
|
-
| String | 2 | "String" | UTF-8 string |
|
|
631
|
-
| U8 | 3 | "U8" | 8-bit unsigned (0-255) |
|
|
632
|
-
| U16 | 4 | "U16" | 16-bit unsigned (0-65535) |
|
|
633
|
-
| U32 | 5 | "U32" | 32-bit unsigned |
|
|
634
|
-
| U64 | 6 | "U64" | 64-bit unsigned |
|
|
635
|
-
| U128 | 7 | "U128" | 128-bit unsigned |
|
|
636
|
-
| U256 | 8 | "U256" | 256-bit unsigned |
|
|
637
|
-
| VecBool | 9 | "VecBool" | Vector of booleans |
|
|
638
|
-
| VecAddress | 10 | "VecAddress" | Vector of addresses |
|
|
639
|
-
| VecString | 11 | "VecString" | Vector of strings |
|
|
640
|
-
| VecU8 | 12 | "VecU8" | Vector of U8 |
|
|
641
|
-
| VecU16 | 13 | "VecU16" | Vector of U16 |
|
|
642
|
-
| VecU32 | 14 | "VecU32" | Vector of U32 |
|
|
643
|
-
| VecU64 | 15 | "VecU64" | Vector of U64 |
|
|
644
|
-
| VecU128 | 16 | "VecU128" | Vector of U128 |
|
|
645
|
-
| VecU256 | 17 | "VecU256" | Vector of U256 |
|
|
646
|
-
| VecVecU8 | 18 | "VecVecU8" | Vector of VecU8 |
|
|
647
|
-
|
|
648
|
-
### 8.2 Type Compatibility
|
|
649
|
-
- **Vector types**: Must match exactly (VecU8 ≠ VecU16).
|
|
650
|
-
- **Address**: Can be converted to/from U256 using `convert_address_number` / `convert_number_address`.
|