@wowok/skills 1.0.6 → 1.1.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.
- package/README.md +26 -30
- package/dist/cli.js +114 -19
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/skills.d.ts +46 -1
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +154 -16
- package/dist/skills.js.map +1 -1
- package/dist/types.d.ts +31 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -4
- package/scripts/install.js +5 -3
- package/wowok-arbitrator/SKILL.md +279 -0
- package/wowok-guard/SKILL.md +166 -139
- package/wowok-machine/SKILL.md +215 -280
- package/wowok-order/SKILL.md +290 -404
- package/wowok-provider/SKILL.md +453 -0
- package/wowok-safety/SKILL.md +176 -279
- package/wowok-tools/SKILL.md +329 -344
- package/schemas/onchain_operations/_common.md +0 -236
- package/schemas/onchain_operations/_index.md +0 -22
- package/schemas/onchain_operations/allocation.md +0 -50
- package/schemas/onchain_operations/arbitration.md +0 -95
- package/schemas/onchain_operations/contact.md +0 -36
- package/schemas/onchain_operations/demand.md +0 -52
- package/schemas/onchain_operations/gen_passport.md +0 -43
- package/schemas/onchain_operations/guard.md +0 -136
- package/schemas/onchain_operations/machine.md +0 -70
- package/schemas/onchain_operations/order.md +0 -57
- package/schemas/onchain_operations/payment.md +0 -32
- package/schemas/onchain_operations/permission.md +0 -57
- package/schemas/onchain_operations/personal.md +0 -59
- package/schemas/onchain_operations/progress.md +0 -35
- package/schemas/onchain_operations/repository.md +0 -81
- package/schemas/onchain_operations/reward.md +0 -40
- package/schemas/onchain_operations/service.md +0 -104
- package/schemas/onchain_operations/treasury.md +0 -74
- package/schemas/schema-account_operation.md +0 -402
- package/schemas/schema-guard2file.md +0 -153
- package/schemas/schema-local_info_operation.md +0 -160
- package/schemas/schema-local_mark_operation.md +0 -148
- package/schemas/schema-machineNode2file.md +0 -155
- package/schemas/schema-messenger_operation.md +0 -547
- package/schemas/schema-onchain_events.md +0 -201
- package/schemas/schema-onchain_table_data.md +0 -334
- package/schemas/schema-query_toolkit.md +0 -375
- package/schemas/schema-wip_file.md +0 -240
- package/schemas/schema-wowok_buildin_info.md +0 -296
- package/wowok-build/SKILL.md +0 -606
package/wowok-safety/SKILL.md
CHANGED
|
@@ -1,98 +1,49 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
2
|
name: wowok-safety
|
|
3
3
|
description: |
|
|
4
|
-
WoWok safety and
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
This skill is AUTOMATICALLY triggered before any on-chain write operation.
|
|
10
|
-
It ensures the AI never executes transactions without explicit user approval.
|
|
4
|
+
WoWok operational safety and best practices — ensures AI follows correct
|
|
5
|
+
conventions for security, transaction confirmation, object building workflow,
|
|
6
|
+
and common mistake prevention.
|
|
7
|
+
|
|
8
|
+
This skill is AUTOMATICALLY triggered before any on-chain operation.
|
|
11
9
|
when_to_use:
|
|
12
|
-
- AI is about to execute an
|
|
13
|
-
- AI is about to publish a Service or Machine
|
|
10
|
+
- AI is about to execute an on-chain write operation
|
|
14
11
|
- AI is about to transfer funds or modify financial parameters
|
|
15
|
-
- AI is about to
|
|
16
|
-
-
|
|
12
|
+
- AI is about to publish a Service or Machine
|
|
13
|
+
- AI is building multiple interdependent objects
|
|
14
|
+
- User mentions "confirm", "approve", "safe", "warning", "best practice"
|
|
17
15
|
always: true
|
|
18
16
|
---
|
|
19
17
|
|
|
20
|
-
# WoWok Safety &
|
|
21
|
-
|
|
22
|
-
## Core Safety Principle
|
|
23
|
-
|
|
24
|
-
**NEVER execute an on-chain write without explicit user confirmation.**
|
|
25
|
-
|
|
26
|
-
WoWok operations involve real blockchain transactions with real economic consequences. The AI MUST always:
|
|
27
|
-
1. Preview what will happen (dry run)
|
|
28
|
-
2. Present the preview clearly to the user
|
|
29
|
-
3. Wait for explicit confirmation
|
|
30
|
-
4. Only then execute
|
|
31
|
-
|
|
32
|
-
## Mandatory Two-Phase Pattern
|
|
33
|
-
|
|
34
|
-
### Phase 1: Dry Run (ALWAYS first)
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
onchain_operations({
|
|
38
|
-
operation_type: "<type>",
|
|
39
|
-
data: { op: "<action>", ... }
|
|
40
|
-
// NO submission field → dry run only
|
|
41
|
-
})
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
The dry run validates parameters, checks permissions, and returns a preview of what will happen. **No state is changed.**
|
|
45
|
-
|
|
46
|
-
### Phase 2: Execute (ONLY after user confirms)
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
onchain_operations({
|
|
50
|
-
operation_type: "<type>",
|
|
51
|
-
data: { op: "<action>", ... },
|
|
52
|
-
submission: {
|
|
53
|
-
sender: "<account_name>",
|
|
54
|
-
gas_budget: "<amount>"
|
|
55
|
-
}
|
|
56
|
-
})
|
|
57
|
-
```
|
|
18
|
+
# WoWok Safety & Best Practices
|
|
58
19
|
|
|
59
|
-
##
|
|
20
|
+
## 1. Core Principles
|
|
60
21
|
|
|
61
|
-
###
|
|
22
|
+
### 1.1 Security & Safety
|
|
62
23
|
|
|
63
|
-
|
|
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).
|
|
64
26
|
|
|
65
|
-
|
|
66
|
-
|-----------|------|---------------------------|
|
|
67
|
-
| `payment` (send coins) | Direct fund transfer | ✅ Show amount, recipient, token type |
|
|
68
|
-
| `treasury` (deposit/withdraw) | Team fund changes | ✅ Show amount, operation type |
|
|
69
|
-
| `reward` (create/modify) | Incentive pool changes | ✅ Show reward rules, amounts |
|
|
70
|
-
| `allocation` (create/modify) | Auto-distribution rules | ✅ Show split percentages, recipients |
|
|
71
|
-
| `order` (create/confirm) | Order with payment | ✅ Show price, service, parties |
|
|
27
|
+
### 1.2 LOCAL vs ON-CHAIN
|
|
72
28
|
|
|
73
|
-
|
|
29
|
+
| Type | Tools | Gas | Confirmation |
|
|
30
|
+
|------|-------|-----|--------------|
|
|
31
|
+
| **LOCAL ONLY** | `account_operation`, `local_mark_operation`, `local_info_operation` | None | Not needed |
|
|
32
|
+
| **ON-CHAIN** | `onchain_operations`, `messenger_operation` (some ops), `wip_file` (sign) | Yes | Required |
|
|
33
|
+
| **QUERY** | `query_toolkit`, `onchain_table_data`, `onchain_events`, `guard2file`, `machineNode2file` | Read-only | Not needed |
|
|
34
|
+
| **ENCRYPTED** | `messenger_operation` (watch/send messages) | Local encryption | Not needed |
|
|
74
35
|
|
|
75
|
-
|
|
36
|
+
### 1.3 Default Account
|
|
76
37
|
|
|
77
|
-
|
|
78
|
-
|-----------|------|----------------------|
|
|
79
|
-
| `service` (publish) | Makes service public | ✅ Confirm publish intent |
|
|
80
|
-
| `machine` (publish) | Makes workflow public | ✅ Confirm publish intent |
|
|
81
|
-
| `guard` (create/modify) | Changes validation rules | ✅ Show Guard logic summary |
|
|
82
|
-
| `permission` (modify) | Changes access control | ✅ Show permission changes |
|
|
38
|
+
Empty string `""` means the default account. Always use `""` when the user does not specify an account.
|
|
83
39
|
|
|
84
|
-
|
|
40
|
+
---
|
|
85
41
|
|
|
86
|
-
|
|
87
|
-
- All `query_toolkit` operations
|
|
88
|
-
- All `onchain_table_data` operations
|
|
89
|
-
- `wowok_buildin_info`
|
|
90
|
-
- `documents_and_learn`
|
|
91
|
-
- `guard2file`, `machineNode2file` (export only)
|
|
42
|
+
## 2. Transaction Confirmation Protocol
|
|
92
43
|
|
|
93
|
-
|
|
44
|
+
**Core rule**: NEVER execute an on-chain write without explicit user confirmation.
|
|
94
45
|
|
|
95
|
-
|
|
46
|
+
### 2.1 Confirmation Template
|
|
96
47
|
|
|
97
48
|
```
|
|
98
49
|
📋 **Operation Preview**
|
|
@@ -102,280 +53,226 @@ When presenting a dry-run result for confirmation, ALWAYS use this format:
|
|
|
102
53
|
| Operation | {operation_type} — {op} |
|
|
103
54
|
| Object | {object_name} |
|
|
104
55
|
| Network | {network} |
|
|
105
|
-
|
|
|
56
|
+
| Account | {account} |
|
|
106
57
|
|
|
107
58
|
⚠️ **This will {describe_what_will_happen}**
|
|
108
59
|
|
|
109
60
|
Proceed with execution?
|
|
110
61
|
```
|
|
111
62
|
|
|
112
|
-
|
|
63
|
+
### 2.2 Amount Verification
|
|
64
|
+
|
|
65
|
+
- Always display amounts with token symbol (e.g., "10 WOW" not "10000000000").
|
|
66
|
+
- Query token decimals first if unsure.
|
|
113
67
|
|
|
114
|
-
|
|
68
|
+
**Tool**: `query_toolkit` with `query_type: "token_list"`.
|
|
115
69
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
query_toolkit({ query_type: "token_list" })
|
|
120
|
-
```
|
|
121
|
-
3. **Show both the raw amount and the human-readable amount**
|
|
122
|
-
4. **For allocations**: Show each recipient's percentage and estimated amount
|
|
123
|
-
5. **For rewards**: Show total pool size and distribution rules
|
|
70
|
+
- **Amounts in operations are ALWAYS submitted as U64 integers**. If the user specifies "2 WOW", do NOT submit the string "2 WOW". Instead, calculate and submit `2000000000` (2 × 10^9, where 9 is WOW's decimals).
|
|
71
|
+
- **Never assume token decimals**. If the token's decimals cannot be queried, HALT the amount submission and alert the user. Do not proceed with hardcoded or guessed precision.
|
|
72
|
+
- Show both raw and human-readable amounts when clarifying with users.
|
|
124
73
|
|
|
125
|
-
|
|
74
|
+
### 2.3 Publish Confirmation
|
|
126
75
|
|
|
127
|
-
|
|
76
|
+
Before publishing a Service or Machine:
|
|
128
77
|
|
|
129
|
-
1. **
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
78
|
+
1. **Export and review**:
|
|
79
|
+
- Use `guard2file` to export Guard definitions
|
|
80
|
+
- Use `machineNode2file` to export Machine nodes
|
|
81
|
+
|
|
82
|
+
2. **Verify logic**: Confirm Guards and Machine nodes match user intent
|
|
83
|
+
|
|
84
|
+
3. **Warn about immutability**: Once published, many fields become locked
|
|
133
85
|
|
|
134
86
|
```
|
|
135
87
|
⚠️ PUBLISH CONFIRMATION REQUIRED
|
|
136
88
|
|
|
137
89
|
You are about to publish:
|
|
138
|
-
- Service: {name}
|
|
90
|
+
- {Service|Machine}: {name}
|
|
139
91
|
- This will make it publicly accessible on-chain
|
|
140
|
-
-
|
|
141
|
-
- Machine workflow: {summary} (if applicable)
|
|
92
|
+
- After publish: {list what becomes immutable}
|
|
142
93
|
|
|
143
94
|
This action cannot be easily undone. Proceed?
|
|
144
95
|
```
|
|
145
96
|
|
|
146
|
-
|
|
97
|
+
---
|
|
147
98
|
|
|
148
|
-
|
|
149
|
-
- **Never share private keys or sensitive data** — these are local-only
|
|
150
|
-
- **Always confirm which account is being used** as the sender for transactions
|
|
151
|
-
- **Check account balance** before operations that require gas
|
|
99
|
+
## 3. Common Mistakes to Avoid
|
|
152
100
|
|
|
153
|
-
|
|
101
|
+
| Mistake | Why It Happens | Prevention |
|
|
102
|
+
|---------|---------------|------------|
|
|
103
|
+
| **Forgetting no_cache** | Cache lag in dependency chain | Set `env.no_cache: true` on all operations when building multiple objects |
|
|
104
|
+
| **Missing permission indices** | Machine forwards reference non-existent indices | Verify Permission object has required indices before creating Machine |
|
|
154
105
|
|
|
155
|
-
|
|
156
|
-
2. ✅ Always get explicit confirmation before executing
|
|
157
|
-
3. ✅ Always show amounts with token symbols
|
|
158
|
-
4. ✅ Always warn before publishing
|
|
159
|
-
5. ✅ Always confirm the sender account
|
|
160
|
-
6. ✅ Always check for sufficient gas balance
|
|
106
|
+
---
|
|
161
107
|
|
|
162
|
-
##
|
|
108
|
+
## 4. Naming Conventions
|
|
163
109
|
|
|
164
|
-
|
|
165
|
-
2. ❌ Never skip the dry-run phase
|
|
166
|
-
3. ❌ Never hide or obscure financial amounts
|
|
167
|
-
4. ❌ Never publish without explicit user request
|
|
168
|
-
5. ❌ Never use a different account than what the user specified
|
|
169
|
-
6. ❌ Never proceed if the dry run shows errors
|
|
110
|
+
When users request complex systems without naming, propose this scheme:
|
|
170
111
|
|
|
171
|
-
|
|
112
|
+
```
|
|
113
|
+
<projectPrefix>_<type>_<purpose>_<version>
|
|
114
|
+
```
|
|
172
115
|
|
|
173
|
-
|
|
116
|
+
| Part | Example | Purpose |
|
|
117
|
+
|------|---------|---------|
|
|
118
|
+
| Project prefix | `shopFunny_` | Prevents cross-project collisions |
|
|
119
|
+
| Type prefix | `machine_`, `guard_`, `service_` | Clarifies object type |
|
|
120
|
+
| Purpose suffix | `serviceWithdraw` | Describes function |
|
|
121
|
+
| Version suffix | `_v2` | Enables iteration |
|
|
174
122
|
|
|
175
|
-
|
|
123
|
+
- Always provide `tags` on object creation for filtering and management
|
|
124
|
+
- Use short address form (`0x1234...def`); use names as primary identifiers
|
|
176
125
|
|
|
177
|
-
|
|
126
|
+
### 4.1 `replaceExistName` Flag
|
|
178
127
|
|
|
179
|
-
|
|
180
|
-
// Phase 1: Validate (no submission → no state change)
|
|
181
|
-
onchain_operations({
|
|
182
|
-
operation_type: "<type>",
|
|
183
|
-
data: { ... },
|
|
184
|
-
env: { account: "<name>", network: "testnet" }
|
|
185
|
-
})
|
|
186
|
-
→ Review the returned preview. Check: object IDs, guard logic, amounts.
|
|
187
|
-
|
|
188
|
-
// Phase 2: Execute (only after user confirms)
|
|
189
|
-
onchain_operations({
|
|
190
|
-
operation_type: "<type>",
|
|
191
|
-
data: { ... },
|
|
192
|
-
env: { account: "<name>", network: "testnet" },
|
|
193
|
-
submission: { sender: "<name>", gas_budget: "10000000" }
|
|
194
|
-
})
|
|
195
|
-
```
|
|
128
|
+
Controls name collision behavior:
|
|
196
129
|
|
|
197
|
-
|
|
130
|
+
| Value | Effect |
|
|
131
|
+
|-------|--------|
|
|
132
|
+
| `false` (default) | Throws error if name is in use — safe default |
|
|
133
|
+
| `true` | Steals name from existing object; old object becomes unnamed |
|
|
198
134
|
|
|
199
|
-
|
|
135
|
+
- Use `true` during development to reuse fixed names without cleanup
|
|
136
|
+
- Default to `false` in production to prevent accidental name hijacking
|
|
137
|
+
- Prefer versioned names (`_v1`, `_v2`) over `replaceExistName` for production
|
|
200
138
|
|
|
201
|
-
|
|
139
|
+
### 4.2 Address Display Rules
|
|
202
140
|
|
|
203
|
-
|
|
204
|
-
```
|
|
205
|
-
guard2file({ guard: "insurance_complete_guard_v1", file_path: "./guard_review.json", format: "json" })
|
|
206
|
-
```
|
|
207
|
-
2. Test the Guard logic with `gen_passport`:
|
|
208
|
-
```
|
|
209
|
-
onchain_operations({
|
|
210
|
-
operation_type: "gen_passport",
|
|
211
|
-
data: { guard: "insurance_complete_guard_v1" },
|
|
212
|
-
info: { name: "guard_test", b_submission: true }
|
|
213
|
-
})
|
|
214
|
-
```
|
|
215
|
-
This submits runtime values to the Guard and returns pass/fail — without any state change.
|
|
141
|
+
When displaying an address (0x prefix + 64 hex characters) to the user:
|
|
216
142
|
|
|
217
|
-
|
|
143
|
+
1. **Query local mark first**:
|
|
218
144
|
|
|
219
|
-
|
|
220
|
-
- The Guard queries `weather_repo_v2` for a given date
|
|
221
|
-
- Test with `gen_passport`, submitting a timestamp that maps to "sunny" → should pass
|
|
222
|
-
- Test with a timestamp that maps to "rainy" → should fail
|
|
223
|
-
- This validates the Guard BEFORE it protects real funds in an Allocation
|
|
145
|
+
**Tool**: `query_toolkit` with `query_type: "local_mark_list"` and filter by address.
|
|
224
146
|
|
|
225
|
-
|
|
147
|
+
2. **Display format**:
|
|
148
|
+
- If local mark exists: `{name} ({short_address})`
|
|
149
|
+
- If no local mark: `{first8}...{last3}` (e.g., `0x3a2f8e1...8c1`)
|
|
226
150
|
|
|
227
|
-
|
|
228
|
-
1. Export each Guard with `guard2file`
|
|
229
|
-
2. Test with `gen_passport`, submitting mock order progress data
|
|
230
|
-
3. Verify: correct node → pass, wrong node → fail
|
|
231
|
-
4. Only then bind to Service's `order_allocators`
|
|
151
|
+
3. **Short address format**: Include `0x` prefix, take first 8 chars + `...` + last 3 chars
|
|
232
152
|
|
|
233
|
-
|
|
153
|
+
---
|
|
234
154
|
|
|
235
|
-
|
|
155
|
+
## 5. Network & Token Defaults
|
|
236
156
|
|
|
237
|
-
|
|
157
|
+
| Parameter | Default Value | Notes |
|
|
158
|
+
|-----------|---------------|-------|
|
|
159
|
+
| Network | `testnet` | Override via `env.network` |
|
|
160
|
+
| Token | `0x2::wow::WOW` | 9 decimals (1 WOW = 1_000_000_000) |
|
|
238
161
|
|
|
239
|
-
|
|
240
|
-
PUBLISH CHECKLIST
|
|
241
|
-
├─ Machine publish:
|
|
242
|
-
│ ├─ ✅ All nodes defined and reviewed (machineNode2file)
|
|
243
|
-
│ ├─ ✅ All forward guards created and tested (gen_passport)
|
|
244
|
-
│ ├─ ✅ Permission indexes assigned to correct accounts
|
|
245
|
-
│ └─ ⚠️ After publish: nodes become IMMUTABLE
|
|
246
|
-
│
|
|
247
|
-
├─ Service publish:
|
|
248
|
-
│ ├─ ✅ Machine bound to Service (machine field set)
|
|
249
|
-
│ ├─ ✅ Allocation rules finalized (order_allocators)
|
|
250
|
-
│ ├─ ✅ Sales/products defined (sales)
|
|
251
|
-
│ ├─ ✅ Guards tested (buy_guard, sell_guard)
|
|
252
|
-
│ └─ ⚠️ After publish: machine + allocation LOCKED
|
|
253
|
-
│
|
|
254
|
-
└─ Reward (post-publish):
|
|
255
|
-
└─ ✅ Can be added after Service publish (not locked)
|
|
256
|
-
```
|
|
162
|
+
### 5.1 Multi-Token Support & Amount Formats
|
|
257
163
|
|
|
258
|
-
|
|
164
|
+
- **Multi-Token**: All operations support custom `token_type`. ALWAYS query precision via `query_toolkit` with `query_type: "token_list"` first. Never assume decimals.
|
|
165
|
+
- **Amount Formats**:
|
|
166
|
+
- With unit: `"2WOW"`, `"10.5USDT"` — auto-converted using token precision.
|
|
167
|
+
- Plain number: internal unit (e.g., `1000000000` = 1 WOW). Always clarify with users when displaying plain numbers.
|
|
168
|
+
- **U64 integers**: Amounts in operations are ALWAYS submitted as U64 integers. If the user specifies "2 WOW", do NOT submit the string "2 WOW" — calculate and submit `2000000000` (2 × 10^9).
|
|
169
|
+
- **Never assume token decimals**: If the token's decimals cannot be queried, HALT the amount submission and alert the user.
|
|
259
170
|
|
|
260
|
-
|
|
171
|
+
### 5.2 Payment Objects for Commercial Transfers
|
|
261
172
|
|
|
262
|
-
|
|
173
|
+
Use `Payment` objects for commercial transfers when possible — they offer Guard validation and purpose tracking beyond a simple `account_operation (transfer)`.
|
|
263
174
|
|
|
264
|
-
|
|
265
|
-
- `weather_provider_v1` creates and manages `weather_repo_v2`
|
|
266
|
-
- `travel_provider_v1` creates and manages `travel_service_v1`
|
|
175
|
+
---
|
|
267
176
|
|
|
268
|
-
|
|
269
|
-
- The weather check Guard references `"weather_repo_v2"` by name
|
|
270
|
-
- The MCP server resolves names to addresses automatically
|
|
177
|
+
## 6. Query-First Pattern
|
|
271
178
|
|
|
272
|
-
|
|
273
|
-
- Weather Repository + data exists before the Guard that queries it
|
|
274
|
-
- Insurance Service exists before Travel creates sub-orders on it
|
|
179
|
+
- **Query before mutate**: Always query current state before modifications.
|
|
275
180
|
|
|
276
|
-
|
|
181
|
+
**Tool**: `query_toolkit` with appropriate filters.
|
|
277
182
|
|
|
278
|
-
**
|
|
183
|
+
- **Pagination**: All on-chain list queries (events, tables, received) support `cursor`/`limit`. Loop for large datasets.
|
|
184
|
+
- **Cache control**: Use `no_cache: true` for time-sensitive reads.
|
|
279
185
|
|
|
280
|
-
|
|
186
|
+
---
|
|
281
187
|
|
|
282
|
-
|
|
283
|
-
|-----------|--------------|-------------|
|
|
284
|
-
| `service.sales[].price` | Raw integer (smallest unit) | Verify with: `wowok_buildin_info({ info_type: "token_list" })` |
|
|
285
|
-
| `order.buy.total_pay.balance` | Raw integer | Confirm matches sales price × quantity |
|
|
286
|
-
| `reward.coin_add` | Raw integer | Confirm pool size against expected payouts |
|
|
287
|
-
| `allocation.sharing[].sharing` | Integer (Rate mode: basis points) | 10000 = 100%, 500 = 5% |
|
|
188
|
+
## 7. Name Resolution & Display
|
|
288
189
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
190
|
+
### 7.1 Name Resolution Priority
|
|
191
|
+
|
|
192
|
+
| Priority | Source | Display Format | Example |
|
|
193
|
+
|----------|--------|----------------|---------|
|
|
194
|
+
| 1 (Highest) | `local_mark_operation` | `{local_mark_name} (localmark)` | `my_service (localmark)` |
|
|
195
|
+
| 2 | `account_operation` (account name) | `{account_name}` | `alice_wallet` |
|
|
196
|
+
| 3 (Fallback) | None / Unnamed | `{first6}...{last3}` | `0x3a2f...8c1` |
|
|
197
|
+
|
|
198
|
+
### 7.2 Address Resolution & Display Format
|
|
199
|
+
|
|
200
|
+
**Resolve addresses to names** via `query_toolkit`:
|
|
201
|
+
|
|
202
|
+
**Tool**: `query_toolkit` with `query_type: "local_names"` and `addresses` array parameter.
|
|
203
|
+
|
|
204
|
+
- Each address must be a valid WOW ID: `0x` prefix + **64 hex characters**.
|
|
205
|
+
- Returns resolved account name and/or local mark name for each address.
|
|
206
|
+
- Name priority follows [7.1](#71-name-resolution-priority): `local_mark` > `account`.
|
|
207
|
+
|
|
208
|
+
**Address truncation** (for display):
|
|
294
209
|
|
|
295
|
-
**From [MyShop Advanced](../examples/MyShop_Advanced/MyShop_Advanced.md):**
|
|
296
210
|
```
|
|
297
|
-
|
|
298
|
-
// 10000 in Rate mode = 100% allocation
|
|
211
|
+
{first_6_chars}...{last_3_chars}
|
|
299
212
|
```
|
|
300
213
|
|
|
301
|
-
|
|
214
|
+
- Include the `0x` prefix in the character count.
|
|
215
|
+
- Use exactly **three dots** (`...`) as the separator.
|
|
216
|
+
- Example: `0x3a2f...8c1`
|
|
302
217
|
|
|
303
|
-
**
|
|
218
|
+
**Combined display**: human-readable name + truncated address in parentheses.
|
|
304
219
|
|
|
305
|
-
|
|
220
|
+
| Name Source | Display Format | Example |
|
|
221
|
+
|-------------|----------------|---------|
|
|
222
|
+
| local_mark | `{local_mark} ({first6}...{last3})` | `my_service (0x3a2f...8c1)` |
|
|
223
|
+
| account | `{account_name} ({first6}...{last3})` | `alice_wallet (0x3a2f...8c1)` |
|
|
224
|
+
| none (fallback) | `{first6}...{last3}` | `0x3a2f...8c1` |
|
|
306
225
|
|
|
307
|
-
|
|
308
|
-
// After creating a Permission:
|
|
309
|
-
onchain_operations({ operation_type: "permission", data: { object: { name: "myshop_permission_v2", ... } }, env: { ... } })
|
|
226
|
+
---
|
|
310
227
|
|
|
311
|
-
|
|
312
|
-
query_toolkit({ query_type: "onchain_objects", objects: ["myshop_permission_v2"], no_cache: true })
|
|
313
|
-
```
|
|
228
|
+
## 8. Error Patterns
|
|
314
229
|
|
|
315
|
-
|
|
230
|
+
| Error | Likely Cause |
|
|
231
|
+
|-------|-------------|
|
|
232
|
+
| Guard validation failure | After re-submitting with `submission`, Guard logic evaluated to false. Review Guard's rule tree via `guard2file` and submitted data values. |
|
|
233
|
+
| File parsing failure | `machineNode2file` or `guard2file` output format error. Check file format and schema compliance. |
|
|
234
|
+
| Cache stale reads | Sequential operations fail unexpectedly (e.g., "object not found" when just created). Retry with `env.no_cache: true`. |
|
|
235
|
+
| Permission denied | Operating account lacks the required Permission index. Check the object's Permission configuration. |
|
|
316
236
|
|
|
317
|
-
|
|
237
|
+
---
|
|
318
238
|
|
|
319
|
-
|
|
239
|
+
## 9. Testing & Validation Workflow
|
|
320
240
|
|
|
321
|
-
|
|
241
|
+
1. **Design Phase**: Use `wowok_buildin_info` to discover available permissions and Guard instructions
|
|
322
242
|
|
|
323
|
-
|
|
324
|
-
data: {
|
|
325
|
-
object: { name: "myshop_permission_v2", replaceExistName: true, ... }
|
|
326
|
-
}
|
|
327
|
-
```
|
|
243
|
+
**Tool**: `wowok_buildin_info` with `info_type: "permissions"` or `info_type: "guard_instructions"`.
|
|
328
244
|
|
|
329
|
-
|
|
245
|
+
2. **Export & Review**: Before publishing, use `guard2file` and `machineNode2file` to export and review definitions
|
|
330
246
|
|
|
331
|
-
|
|
247
|
+
3. **Incremental Testing**: Build objects step-by-step, verifying each step
|
|
332
248
|
|
|
333
|
-
**
|
|
249
|
+
4. **Final Validation**: Test all Guard conditions and Machine transitions before publishing
|
|
334
250
|
|
|
335
|
-
|
|
251
|
+
5. **Publish**: Only after thorough testing, publish Service and Machine
|
|
336
252
|
|
|
337
|
-
|
|
338
|
-
```
|
|
339
|
-
onchain_operations({
|
|
340
|
-
operation_type: "machine",
|
|
341
|
-
data: {
|
|
342
|
-
object: { name: "insurance_machine_v1", permission: "..." },
|
|
343
|
-
node: { op: "add", nodes: [...] }, // nodes in same call
|
|
344
|
-
publish: true // publish in same call
|
|
345
|
-
}
|
|
346
|
-
})
|
|
347
|
-
```
|
|
253
|
+
---
|
|
348
254
|
|
|
349
|
-
|
|
350
|
-
```
|
|
351
|
-
// Step 1: Create machine (no nodes)
|
|
352
|
-
onchain_operations({ operation_type: "machine", data: { object: {...} } })
|
|
353
|
-
// Step 2: Add nodes (may not persist)
|
|
354
|
-
onchain_operations({ operation_type: "machine", data: { object: "...", node: { op: "add", nodes: [...] } } })
|
|
355
|
-
// Step 3: Publish
|
|
356
|
-
onchain_operations({ operation_type: "machine", data: { object: "...", publish: true } })
|
|
357
|
-
```
|
|
255
|
+
## 10. Incremental Object Building
|
|
358
256
|
|
|
359
|
-
|
|
257
|
+
For complex objects with many fields (Service, Machine), use **incremental building** instead of creating everything in one call:
|
|
360
258
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
```
|
|
259
|
+
- Each step can be verified before proceeding
|
|
260
|
+
- Errors are isolated to specific fields
|
|
261
|
+
- Easier to retry failed steps without re-executing successful ones
|
|
262
|
+
- Better user feedback at each stage
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Schema Reference
|
|
267
|
+
|
|
268
|
+
| Purpose | Schema Name |
|
|
269
|
+
|---------|-------------|
|
|
270
|
+
| Query toolkit | `query_toolkit` |
|
|
271
|
+
| Token list | `query_toolkit` with `query_type: "token_list"` |
|
|
272
|
+
| Guard export | `guard2file` |
|
|
273
|
+
| Machine export | `machineNode2file` |
|
|
274
|
+
| Build-in info | `wowok_buildin_info` |
|
|
275
|
+
|
|
276
|
+
**Query Schema**: `schema_query({ action: "get", name: "<schema_name>" })`
|
|
277
|
+
|
|
278
|
+
**Related Skills**: [wowok-tools](../wowok-tools/SKILL.md) | [wowok-guard](../wowok-guard/SKILL.md) | [wowok-machine](../wowok-machine/SKILL.md)
|