@wowok/agent-mcp 2.2.8 → 2.2.13
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 +5 -5
- package/dist/docs/index.d.ts +3 -0
- package/dist/docs/index.js +2 -0
- package/dist/docs/loader.d.ts +12 -0
- package/dist/docs/loader.js +177 -0
- package/dist/docs/search.d.ts +17 -0
- package/dist/docs/search.js +325 -0
- package/dist/docs/types.d.ts +55 -0
- package/dist/docs/types.js +1 -0
- package/dist/index.d.ts +400 -388
- package/dist/index.js +146 -39
- package/dist/schema/call/allocation.d.ts +23 -23
- package/dist/schema/call/arbitration.d.ts +23 -23
- package/dist/schema/call/base.d.ts +72 -72
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/contact.d.ts +23 -23
- package/dist/schema/call/demand.d.ts +23 -23
- package/dist/schema/call/guard.d.ts +45 -45
- package/dist/schema/call/handler.d.ts +1 -1
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.d.ts +28 -28
- package/dist/schema/call/order.d.ts +23 -23
- package/dist/schema/call/payment.d.ts +5 -5
- package/dist/schema/call/permission.d.ts +23 -23
- package/dist/schema/call/personal.d.ts +31 -31
- package/dist/schema/call/progress.d.ts +23 -23
- package/dist/schema/call/proof.d.ts +10 -10
- package/dist/schema/call/repository.d.ts +49 -49
- package/dist/schema/call/reward.d.ts +23 -23
- package/dist/schema/call/service.d.ts +38 -38
- package/dist/schema/call/treasury.d.ts +23 -23
- package/dist/schema/common/index.d.ts +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/local/index.d.ts +63 -63
- package/dist/schema/messenger/index.d.ts +3 -3
- package/dist/schema/query/index.d.ts +1446 -1446
- package/dist/schema/query/index.js +2 -2
- package/dist/schema/utils/guard-query-utils.d.ts +1 -1
- package/dist/schema/utils/guard-query-utils.js +1 -1
- package/dist/schema/utils/permission-index-utils.js +1 -1
- package/docs/README.md +249 -0
- package/docs/WIP.md +388 -0
- package/docs/WTS.md +536 -0
- package/docs/docs/account.md +914 -0
- package/docs/docs/allocation.md +635 -0
- package/docs/docs/arbitration.md +1804 -0
- package/docs/docs/arbitration_state_machine.md +270 -0
- package/docs/docs/contact.md +709 -0
- package/docs/docs/demand.md +948 -0
- package/docs/docs/guard.md +1465 -0
- package/docs/docs/localinfo.md +432 -0
- package/docs/docs/localmark.md +583 -0
- package/docs/docs/machine.md +2490 -0
- package/docs/docs/messenger.md +2098 -0
- package/docs/docs/onchain_events.md +267 -0
- package/docs/docs/order.md +1001 -0
- package/docs/docs/payment.md +512 -0
- package/docs/docs/permission.md +1438 -0
- package/docs/docs/personal.md +742 -0
- package/docs/docs/progress.md +1748 -0
- package/docs/docs/query.md +467 -0
- package/docs/docs/repository.md +1043 -0
- package/docs/docs/reward.md +833 -0
- package/docs/docs/service.md +2130 -0
- package/docs/docs/stage-01-introduction.md +243 -0
- package/docs/docs/stage-02-trust.md +302 -0
- package/docs/docs/stage-03-collaboration.md +337 -0
- package/docs/docs/stage-04-transaction.md +277 -0
- package/docs/docs/stage-05-business.md +151 -0
- package/docs/docs/stage-06-personal.md +203 -0
- package/docs/docs/stage-07-query.md +572 -0
- package/docs/docs/stage-08-examples.md +184 -0
- package/docs/docs/treasury.md +1149 -0
- package/docs/docs/wowok_buildin_info.md +740 -0
- package/docs/examples/Insurance/Insurance.md +594 -0
- package/docs/examples/Insurance/Insurance_TestResults.md +481 -0
- package/docs/examples/Insurance/insurance_complete_guard_v1.json +50 -0
- package/docs/examples/MyShop/MyShop.md +1353 -0
- package/docs/examples/MyShop/MyShop_TestResults.md +1003 -0
- package/docs/examples/MyShop_Advanced/MyShop_Advanced.md +1898 -0
- package/docs/examples/MyShop_Advanced/MyShop_Advanced_MerchantSystem_TestResults.md +1297 -0
- package/docs/examples/MyShop_Advanced/MyShop_Advanced_OrderFlow_TestResults.md +743 -0
- package/docs/examples/MyShop_Advanced/machine_nodes.json +222 -0
- package/docs/examples/ThreeBody_Signature/ThreeBody_Signature.md +776 -0
- package/docs/examples/ThreeBody_Signature/ThreeBody_Signature_TestResults.md +599 -0
- package/docs/examples/Travel/Travel.md +1157 -0
- package/docs/examples/Travel/Travel_TestResults.md +743 -0
- package/docs/examples/Travel/calc-weather-timestamps.js +8 -0
- package/docs/examples/Travel/travel_machine_v2_export.json +104 -0
- package/docs/examples/Travel/weather_check_guard_v1.json +51 -0
- package/docs/skills/WOWOK.md +650 -0
- package/docs/skills/onchain_operations/_common.md +406 -0
- package/docs/skills/onchain_operations/_index.md +196 -0
- package/docs/skills/onchain_operations/allocation.md +28 -0
- package/docs/skills/onchain_operations/arbitration.md +106 -0
- package/docs/skills/onchain_operations/contact.md +40 -0
- package/docs/skills/onchain_operations/demand.md +53 -0
- package/docs/skills/onchain_operations/gen_passport.md +23 -0
- package/docs/skills/onchain_operations/guard.md +56 -0
- package/docs/skills/onchain_operations/machine.md +89 -0
- package/docs/skills/onchain_operations/order.md +56 -0
- package/docs/skills/onchain_operations/payment.md +24 -0
- package/docs/skills/onchain_operations/permission.md +68 -0
- package/docs/skills/onchain_operations/personal.md +58 -0
- package/docs/skills/onchain_operations/progress.md +38 -0
- package/docs/skills/onchain_operations/repository.md +70 -0
- package/docs/skills/onchain_operations/reward.md +38 -0
- package/docs/skills/onchain_operations/service.md +78 -0
- package/docs/skills/onchain_operations/treasury.md +68 -0
- package/docs/skills/schema-account_operation.md +402 -0
- package/docs/skills/schema-guard2file.md +153 -0
- package/docs/skills/schema-local_info_operation.md +160 -0
- package/docs/skills/schema-local_mark_operation.md +148 -0
- package/docs/skills/schema-machineNode2file.md +155 -0
- package/docs/skills/schema-messenger_operation.md +547 -0
- package/docs/skills/schema-onchain_events.md +201 -0
- package/docs/skills/schema-onchain_table_data.md +334 -0
- package/docs/skills/schema-query_toolkit.md +395 -0
- package/docs/skills/schema-wip_file.md +240 -0
- package/docs/skills/schema-wowok_buildin_info.md +296 -0
- package/docs/wip-examples/three_body.html +57 -0
- package/docs/wip-examples/three_body.wip +30 -0
- package/package.json +3 -2
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
# Stage 3: Open Collaboration 🤝
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
**[← Stage 2: Trust Management](stage-02-trust.md) | [Stage 4: Transaction Execution →](stage-04-transaction.md)**
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🎯 Stage Objectives
|
|
10
|
+
|
|
11
|
+
In this stage, you will learn about open collaboration mechanisms in WoWok, including:
|
|
12
|
+
|
|
13
|
+
- How to use Machine and Progress to define and execute workflows
|
|
14
|
+
- How to use Messenger for secure private communication
|
|
15
|
+
- How to use Contact to manage public contact information
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 📚 Learning Content
|
|
20
|
+
|
|
21
|
+
### 3.1 Machine + Progress (Workflow Engine ⚙️)
|
|
22
|
+
|
|
23
|
+
**Why do we need Machine and Progress?**
|
|
24
|
+
|
|
25
|
+
Collaboration needs to be process-oriented. Machine is the workflow template (defining what to do), and Progress is the workflow instance (tracking execution progress).
|
|
26
|
+
|
|
27
|
+
**Core Concepts:**
|
|
28
|
+
- 📋 **Machine** - Workflow template, defines nodes and transition rules
|
|
29
|
+
- 🔄 **Progress** - Workflow instance, tracks execution status
|
|
30
|
+
- 🎯 **Nodes** - Steps in the workflow (states)
|
|
31
|
+
- 🔗 **Transitions** - Operation rules from one node to another
|
|
32
|
+
|
|
33
|
+
**Core Features:**
|
|
34
|
+
|
|
35
|
+
**Machine Features:**
|
|
36
|
+
- ✅ Create Machine (define nodes and transition rules)
|
|
37
|
+
- ✅ Add/Modify nodes (modifiable before publishing)
|
|
38
|
+
- ✅ Publish Machine (lock nodes, ready for use)
|
|
39
|
+
- ✅ Create Progress (launch workflow instance)
|
|
40
|
+
- ✅ Manage Repository (bind data storage)
|
|
41
|
+
|
|
42
|
+
**Progress Features:**
|
|
43
|
+
- ✅ Advance Progress (execute node transitions)
|
|
44
|
+
- ✅ Manage named operators (dynamic permission assignment)
|
|
45
|
+
- ✅ Set Task ID (associate objects)
|
|
46
|
+
- ✅ Manage context Repository
|
|
47
|
+
|
|
48
|
+
**→ [View Machine Detailed Documentation →](machine.md)**
|
|
49
|
+
**→ [View Progress Detailed Documentation →](progress.md)**
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
### 3.2 Messenger (Private Communication 🔒)
|
|
54
|
+
|
|
55
|
+
**Why do we need Messenger?**
|
|
56
|
+
|
|
57
|
+
Collaboration requires communication. Messenger provides end-to-end encrypted secure communication, supporting WTS verifiable chat records.
|
|
58
|
+
|
|
59
|
+
**Core Concepts:**
|
|
60
|
+
- 🔒 **End-to-End Encryption** - Only communication parties can see the content
|
|
61
|
+
- 📝 **WTS** - Witness Timestamped Signature, verifiable chat records (can be used as legal evidence)
|
|
62
|
+
- 📎 **File Transfer** - Securely send files
|
|
63
|
+
- ⏰ **On-Chain Proof** - Generate on-chain timestamp proof for messages
|
|
64
|
+
|
|
65
|
+
**Core Features:**
|
|
66
|
+
- ✅ View conversation list
|
|
67
|
+
- ✅ Send text messages (end-to-end encrypted)
|
|
68
|
+
- ✅ Send files
|
|
69
|
+
- ✅ View message history
|
|
70
|
+
- ✅ Generate WTS proof
|
|
71
|
+
- ✅ Verify WTS signature
|
|
72
|
+
- ✅ On-chain proof messages
|
|
73
|
+
- ✅ Manage blacklist/friends list/Guard list
|
|
74
|
+
|
|
75
|
+
**→ [View Messenger Detailed Documentation →](messenger.md)**
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### 3.3 Contact (Service Window 📇)
|
|
80
|
+
|
|
81
|
+
**Why do we need Contact?**
|
|
82
|
+
|
|
83
|
+
Collaboration requires contact information. Contact manages public contact information and can be bound to Service.
|
|
84
|
+
|
|
85
|
+
**Core Features:**
|
|
86
|
+
- ✅ Create Contact (set name, description, location)
|
|
87
|
+
- ✅ Manage IM contact list (add/remove/clear)
|
|
88
|
+
- ✅ Set personal status
|
|
89
|
+
- ✅ Receive objects sent to Contact
|
|
90
|
+
- ✅ Bind to Service and other objects (as service contact)
|
|
91
|
+
|
|
92
|
+
**Important Notes:**
|
|
93
|
+
- ⚠️ It is recommended to only place public contact information
|
|
94
|
+
|
|
95
|
+
**→ [View Contact Detailed Documentation →](contact.md)**
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 🎓 Practice Exercises
|
|
100
|
+
|
|
101
|
+
### Exercise 1: Create a Simple Workflow Machine
|
|
102
|
+
|
|
103
|
+
**💬 You**: Create a Machine named "design_workflow" for design service process.
|
|
104
|
+
|
|
105
|
+
**🤖 AI Generated Request:**
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"operation_type": "machine",
|
|
110
|
+
"data": {
|
|
111
|
+
"object": {
|
|
112
|
+
"name": "design_workflow"
|
|
113
|
+
},
|
|
114
|
+
"description": "Design service workflow - complete process from order creation to delivery"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**✅ After successful execution, add nodes:**
|
|
120
|
+
|
|
121
|
+
**💬 You**: Add three nodes to "design_workflow": created (initial node), designing, completed (terminal node).
|
|
122
|
+
|
|
123
|
+
**🤖 AI Generated Request:**
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"operation_type": "machine",
|
|
128
|
+
"data": {
|
|
129
|
+
"object": "design_workflow",
|
|
130
|
+
"node": {
|
|
131
|
+
"op": "add",
|
|
132
|
+
"nodes": [
|
|
133
|
+
{
|
|
134
|
+
"name": "created",
|
|
135
|
+
"pairs": []
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"name": "designing",
|
|
139
|
+
"pairs": [
|
|
140
|
+
{
|
|
141
|
+
"prev_node": "created",
|
|
142
|
+
"threshold": 1,
|
|
143
|
+
"forwards": [
|
|
144
|
+
{
|
|
145
|
+
"name": "start_design",
|
|
146
|
+
"permissionIndex": 1000,
|
|
147
|
+
"weight": 1
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"name": "completed",
|
|
155
|
+
"pairs": [
|
|
156
|
+
{
|
|
157
|
+
"prev_node": "designing",
|
|
158
|
+
"threshold": 1,
|
|
159
|
+
"forwards": [
|
|
160
|
+
{
|
|
161
|
+
"name": "complete_design",
|
|
162
|
+
"permissionIndex": 1001,
|
|
163
|
+
"weight": 1
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**✅ After successful execution, publish Machine:**
|
|
176
|
+
|
|
177
|
+
**💬 You**: Publish "design_workflow" Machine.
|
|
178
|
+
|
|
179
|
+
**🤖 AI Generated Request:**
|
|
180
|
+
|
|
181
|
+
```json
|
|
182
|
+
{
|
|
183
|
+
"operation_type": "machine",
|
|
184
|
+
"data": {
|
|
185
|
+
"object": "design_workflow",
|
|
186
|
+
"publish": true
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
### Exercise 2: Create and Advance Progress
|
|
194
|
+
|
|
195
|
+
**💬 You**: Create a Progress based on "design_workflow", named "my_first_progress".
|
|
196
|
+
|
|
197
|
+
**🤖 AI Generated Request:**
|
|
198
|
+
|
|
199
|
+
```json
|
|
200
|
+
{
|
|
201
|
+
"operation_type": "machine",
|
|
202
|
+
"data": {
|
|
203
|
+
"object": "design_workflow",
|
|
204
|
+
"progress_new": {
|
|
205
|
+
"namedNew": {
|
|
206
|
+
"name": "my_first_progress"
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**✅ After successful execution, advance Progress:**
|
|
214
|
+
|
|
215
|
+
**💬 You**: Advance "my_first_progress" from created node to designing node by executing "start_design" operation.
|
|
216
|
+
|
|
217
|
+
**🤖 AI Generated Request:**
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"operation_type": "progress",
|
|
222
|
+
"data": {
|
|
223
|
+
"object": "my_first_progress",
|
|
224
|
+
"operate": {
|
|
225
|
+
"operation": {
|
|
226
|
+
"next_node_name": "designing",
|
|
227
|
+
"forward": "start_design"
|
|
228
|
+
},
|
|
229
|
+
"hold": false,
|
|
230
|
+
"message": "Start design work"
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
### Exercise 3: Send Encrypted Message
|
|
239
|
+
|
|
240
|
+
**💬 You**: Send an encrypted message "Hello, I would like to inquire about design services" to "alice".
|
|
241
|
+
|
|
242
|
+
**🤖 AI Generated Request:**
|
|
243
|
+
|
|
244
|
+
```json
|
|
245
|
+
{
|
|
246
|
+
"operation": "send_message",
|
|
247
|
+
"to": {
|
|
248
|
+
"name_or_address": "alice"
|
|
249
|
+
},
|
|
250
|
+
"content": "Hello, I would like to inquire about design services"
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
### Exercise 4: View Conversation List
|
|
257
|
+
|
|
258
|
+
**💬 You**: View all my conversation lists.
|
|
259
|
+
|
|
260
|
+
**🤖 AI Generated Request:**
|
|
261
|
+
|
|
262
|
+
```json
|
|
263
|
+
{
|
|
264
|
+
"operation": "watch_conversations"
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
### Exercise 5: Create Contact
|
|
271
|
+
|
|
272
|
+
**💬 You**: Create a Contact named "design_service_contact" with description "Design service contact information".
|
|
273
|
+
|
|
274
|
+
**🤖 AI Generated Request:**
|
|
275
|
+
|
|
276
|
+
```json
|
|
277
|
+
{
|
|
278
|
+
"operation_type": "contact",
|
|
279
|
+
"data": {
|
|
280
|
+
"object": {
|
|
281
|
+
"name": "design_service_contact"
|
|
282
|
+
},
|
|
283
|
+
"description": "Design service contact - 24/7 online support",
|
|
284
|
+
"location": "Online service",
|
|
285
|
+
"ims": {
|
|
286
|
+
"op": "clear"
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
### Exercise 6: Manage Messenger Blacklist
|
|
295
|
+
|
|
296
|
+
**💬 You**: Add address "0x1234...abcd" to my blacklist.
|
|
297
|
+
|
|
298
|
+
**🤖 AI Generated Request:**
|
|
299
|
+
|
|
300
|
+
```json
|
|
301
|
+
{
|
|
302
|
+
"operation": "blacklist",
|
|
303
|
+
"blacklist": {
|
|
304
|
+
"op": "add",
|
|
305
|
+
"users": ["0x1234abcd5678efgh9012ijkl3456mnop7890qrst"]
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## 🏆 Stage Checklist
|
|
313
|
+
|
|
314
|
+
Before moving to the next stage, please confirm that you have:
|
|
315
|
+
|
|
316
|
+
- [ ] Understood the difference between Machine and Progress
|
|
317
|
+
- [ ] Created at least one Machine
|
|
318
|
+
- [ ] Added nodes and transition rules to Machine
|
|
319
|
+
- [ ] Published Machine
|
|
320
|
+
- [ ] Created at least one Progress
|
|
321
|
+
- [ ] Advanced Progress nodes
|
|
322
|
+
- [ ] Sent encrypted messages
|
|
323
|
+
- [ ] Viewed conversation list
|
|
324
|
+
- [ ] Created Contact
|
|
325
|
+
- [ ] Managed IM contacts
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## 🎉 Congratulations!
|
|
330
|
+
|
|
331
|
+
You have completed Stage 3! Now you have mastered WoWok's open collaboration mechanisms and can move on to the next stage to learn about transaction execution!
|
|
332
|
+
|
|
333
|
+
**[→ Go to Stage 4: Transaction Execution 💼 →](stage-04-transaction.md)**
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
**[← Return to Main Directory](../README.md)**
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# Stage 4: Transaction Execution 💼
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
**[← Stage 3: Open Collaboration](stage-03-collaboration.md) | [Stage 5: Business Components →](stage-05-business.md)**
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🎯 Stage Objectives
|
|
10
|
+
|
|
11
|
+
In this stage, you will learn the transaction mechanisms in WoWok, including:
|
|
12
|
+
|
|
13
|
+
- How to use Allocation for automatic fund distribution
|
|
14
|
+
- How to use WIP to describe products and services
|
|
15
|
+
- How to use Service and Order for service sales and order management
|
|
16
|
+
- How to use Arbitration for dispute resolution
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 📚 Learning Content
|
|
21
|
+
|
|
22
|
+
### 4.1 WIP for Product and Service Description (📄 WIP)
|
|
23
|
+
|
|
24
|
+
**Why use WIP for Products and Services?**
|
|
25
|
+
|
|
26
|
+
WIP (Witness Immutable Promise) provides immutable, verifiable product and service descriptions. By deploying WIP files to the network and using their URLs and hashes as product details, both sellers and buyers can establish deterministic commitments.
|
|
27
|
+
|
|
28
|
+
**Core Concepts:**
|
|
29
|
+
- 📄 **Immutable Content** - Product descriptions cannot be altered after creation
|
|
30
|
+
- 🔗 **URL + Hash Verification** - Combines network accessibility with cryptographic integrity
|
|
31
|
+
- ✍️ **Multi-signature Support** - Sellers can sign to establish authenticity
|
|
32
|
+
- ✅ **Verifiable** - Anyone can verify the content matches the promised hash
|
|
33
|
+
|
|
34
|
+
**How WIP Integrates with Service:**
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
38
|
+
│ Service Object │
|
|
39
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ │
|
|
40
|
+
│ │ Product URL │───▶│ WIP File │───▶│ Hash + Signers │ │
|
|
41
|
+
│ │ (Network) │ │ (Immutable)│ │ (Verified) │ │
|
|
42
|
+
│ └─────────────┘ └─────────────┘ └─────────────────┘ │
|
|
43
|
+
│ │ │ │
|
|
44
|
+
│ ▼ ▼ │
|
|
45
|
+
│ User views via URL User verifies integrity │
|
|
46
|
+
│ and trusted content and signers │
|
|
47
|
+
└─────────────────────────────────────────────────────────────┘
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Core Workflow:**
|
|
51
|
+
|
|
52
|
+
1. **Generate WIP** - Create a WIP file describing the product/service with detailed specifications
|
|
53
|
+
2. **Sign WIP** - Sign with the seller's account to establish authenticity
|
|
54
|
+
3. **Deploy to Network** - Upload the signed WIP file to a network location
|
|
55
|
+
4. **Create Service** - Use the WIP URL and hash as the product details in the Service object
|
|
56
|
+
5. **Buyer Verification** - Buyers can view the content via URL and verify hash and signers
|
|
57
|
+
|
|
58
|
+
**Core Features:**
|
|
59
|
+
- ✅ Generate WIP with Markdown text and images
|
|
60
|
+
- ✅ Sign WIP to establish seller identity
|
|
61
|
+
- ✅ Verify hash integrity and signature authenticity
|
|
62
|
+
- ✅ Convert to HTML for display
|
|
63
|
+
|
|
64
|
+
**Important Notes:**
|
|
65
|
+
- ⚠️ **Hash Immutability** - Once a WIP is deployed and its hash is recorded on-chain, the content cannot be changed without changing the hash
|
|
66
|
+
- ⚠️ **Signature Trust** - Only signatures from trusted accounts should be considered valid
|
|
67
|
+
- ⚠️ **URL Accessibility** - The WIP file must remain accessible at the specified URL
|
|
68
|
+
|
|
69
|
+
**→ [View WIP Detailed Documentation →](../WIP.md)**
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### 4.2 Allocation (Automatic Fund Distribution ⚖️)
|
|
74
|
+
|
|
75
|
+
**Why do we need Allocation?**
|
|
76
|
+
|
|
77
|
+
Transactions require profit sharing. Allocation allows you to preset fund distribution rules and automatically distribute to multiple recipients.
|
|
78
|
+
|
|
79
|
+
**Core Concepts:**
|
|
80
|
+
- 👥 **Multiple Recipients** - Support distribution to multiple addresses
|
|
81
|
+
- 📊 **Ratio or Fixed Amount** - Distribute by ratio or fixed amount
|
|
82
|
+
- 🎯 **Auto-execution** - Automatically distribute when triggered
|
|
83
|
+
|
|
84
|
+
**Core Features:**
|
|
85
|
+
- ✅ Add/remove recipients
|
|
86
|
+
- ✅ Set ratio or amount
|
|
87
|
+
- ✅ Set Guard verification
|
|
88
|
+
- ✅ Bind to Service or other objects
|
|
89
|
+
|
|
90
|
+
**→ [View Allocation Detailed Documentation →](allocation.md)**
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### 4.3 Service + Order (Service Sales and Orders 🛒📋)
|
|
95
|
+
|
|
96
|
+
**Why do we need Service and Order?**
|
|
97
|
+
|
|
98
|
+
These are the core transaction components in WoWok! Service is what is sold, and Order is the purchase order.
|
|
99
|
+
|
|
100
|
+
**Core Concepts:**
|
|
101
|
+
- 🛒 **Service** - Service marketplace, publish products or services
|
|
102
|
+
- 📋 **Order** - Order management, handle purchase process
|
|
103
|
+
- 💰 **Price** - Pricing for services
|
|
104
|
+
- 🔗 **Binding Components** - Can bind Machine, Progress, Allocation, Guard, and more
|
|
105
|
+
|
|
106
|
+
**Core Features:**
|
|
107
|
+
- ✅ Create Service (publish product)
|
|
108
|
+
- ✅ Create Order (purchase product)
|
|
109
|
+
- ✅ Manage order status
|
|
110
|
+
- ✅ Bind various components
|
|
111
|
+
|
|
112
|
+
**Important Notes:**
|
|
113
|
+
- ⚠️ Service can bind components such as Machine, Guard, Allocation, Contact, Treasury, Reward, and **WIP**!
|
|
114
|
+
|
|
115
|
+
**Integration with WIP:**
|
|
116
|
+
- The Service object can store the WIP URL and hash as product details
|
|
117
|
+
- Buyers can verify the WIP file to ensure the product matches the promised description
|
|
118
|
+
|
|
119
|
+
**→ [View Service Detailed Documentation →](service.md)**
|
|
120
|
+
**→ [View Order Detailed Documentation →](order.md)**
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### 4.4 Arbitration (Dispute Resolution ⚖️)
|
|
125
|
+
|
|
126
|
+
**Why do we need Arbitration?**
|
|
127
|
+
|
|
128
|
+
Transactions may have disputes. Arbitration provides a fair dispute resolution mechanism.
|
|
129
|
+
|
|
130
|
+
**Core Concepts:**
|
|
131
|
+
- 👨⚖️ **Arbitrator** - Neutral third party
|
|
132
|
+
- 💵 **Compensation Ratio** - Compensation ratio for buyer and seller
|
|
133
|
+
- ⚖️ **Fair Ruling** - Arbitrators can adjust compensation ratio
|
|
134
|
+
|
|
135
|
+
**Core Features:**
|
|
136
|
+
- ✅ Create arbitration object
|
|
137
|
+
- ✅ Add/remove arbitrators
|
|
138
|
+
- ✅ Set compensation ratio
|
|
139
|
+
- ✅ Submit and rule on disputes
|
|
140
|
+
|
|
141
|
+
**→ [View Arbitration Detailed Documentation →](arbitration.md)**
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 🎓 Practice Exercises
|
|
146
|
+
|
|
147
|
+
### Exercise 1: Create a WIP for Product Description
|
|
148
|
+
|
|
149
|
+
Create a WIP file describing a product and sign it with your account
|
|
150
|
+
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"type": "generate",
|
|
154
|
+
"options": {
|
|
155
|
+
"markdown_text": "# Premium Software License\n\n## Product Details\n\n- License Type: Annual Subscription\n- Features: Full access to all modules\n- Support: 24/7 technical support\n- Duration: 12 months\n\n## Terms of Service\n\n1. Non-transferable license\n2. Single user account\n3. Auto-renewal unless cancelled",
|
|
156
|
+
"account": "my_seller_account"
|
|
157
|
+
},
|
|
158
|
+
"outputPath": "./software_license.wip"
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
After generating, deploy to network and use the URL and hash when creating Service.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
### Exercise 2: Create a Service with WIP Product Details
|
|
167
|
+
|
|
168
|
+
Create a Service with sales products that include WIP URL and hash as product details. Each product in the sales list can have its own WIP file for detailed description.
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"operation_type": "service",
|
|
173
|
+
"data": {
|
|
174
|
+
"object": {
|
|
175
|
+
"name": "software_license_service"
|
|
176
|
+
},
|
|
177
|
+
"sales": {
|
|
178
|
+
"op": "add",
|
|
179
|
+
"sales": [
|
|
180
|
+
{
|
|
181
|
+
"name": "Premium Software License",
|
|
182
|
+
"price": "1000000000",
|
|
183
|
+
"stock": "100",
|
|
184
|
+
"suspension": false,
|
|
185
|
+
"wip": "https://example.com/products/software_license.wip",
|
|
186
|
+
"wip_hash": "sha256:abcdef1234567890..."
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Note:** The `wip` and `wip_hash` fields are part of each product in the `sales` array, allowing each product to have its own immutable description file.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
### Exercise 3: Create an Allocation with Profit Sharing
|
|
199
|
+
|
|
200
|
+
Create a distribution rule that splits profits between two recipients
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"operation_type": "allocation",
|
|
205
|
+
"data": {
|
|
206
|
+
"object": {
|
|
207
|
+
"name": "profit_sharing"
|
|
208
|
+
},
|
|
209
|
+
"allocators": {
|
|
210
|
+
"description": "Profit sharing between two partners",
|
|
211
|
+
"threshold": "0",
|
|
212
|
+
"allocators": [
|
|
213
|
+
{
|
|
214
|
+
"guard": "simple_guard",
|
|
215
|
+
"sharing": [
|
|
216
|
+
{
|
|
217
|
+
"who": {
|
|
218
|
+
"Entity": {
|
|
219
|
+
"name_or_address": "partner1_address"
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
"sharing": "5000",
|
|
223
|
+
"mode": "Rate"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"who": {
|
|
227
|
+
"Entity": {
|
|
228
|
+
"name_or_address": "partner2_address"
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
"sharing": "5000",
|
|
232
|
+
"mode": "Rate"
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
},
|
|
238
|
+
"coin": {
|
|
239
|
+
"balance": "0"
|
|
240
|
+
},
|
|
241
|
+
"payment_info": {
|
|
242
|
+
"remark": "Profit sharing payment",
|
|
243
|
+
"index": "0"
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## 🏆 Stage Checklist
|
|
252
|
+
|
|
253
|
+
Before moving to the next stage, please confirm that you have:
|
|
254
|
+
|
|
255
|
+
- [ ] Understood the relationship between WIP and Service
|
|
256
|
+
- [ ] Created a WIP file for product/service description
|
|
257
|
+
- [ ] Signed a WIP file to establish authenticity
|
|
258
|
+
- [ ] Understood how to use WIP URL and hash as product details
|
|
259
|
+
- [ ] Understood the relationship between Service and Order
|
|
260
|
+
- [ ] Created at least one Service
|
|
261
|
+
- [ ] Created at least one Order
|
|
262
|
+
- [ ] Understood Allocation's profit-sharing mechanism
|
|
263
|
+
- [ ] Created at least one Allocation
|
|
264
|
+
- [ ] Understood the role of Arbitration
|
|
265
|
+
- [ ] Know how to combine these components
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## 🎉 Congratulations!
|
|
270
|
+
|
|
271
|
+
You have completed Stage 4! Now you have mastered WoWok's transaction mechanisms and are ready to move on to the next stage to learn about business components!
|
|
272
|
+
|
|
273
|
+
**[→ Go to Stage 5: Business Components 🏪 →](stage-05-business.md)**
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
**[← Return to Main Directory](../README.md)**
|