@wowok/agent-mcp 2.2.13 → 2.2.14
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/dist/index.js +42 -98
- 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/operations/guard.json +163 -0
- package/dist/schemas/operations/permission.json +22 -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
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
# Stage 1: Getting Started ⭐
|
|
2
|
-
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
**[← Return to Main Directory](../README.md) | [Stage 2: Trust Management →](stage-02-trust.md)**
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 📚 Learning Content
|
|
10
|
-
|
|
11
|
-
### 1.1 Account 🔐
|
|
12
|
-
|
|
13
|
-
**Why do we need Account?**
|
|
14
|
-
|
|
15
|
-
In WoWok, all on-chain operations need to be signed and initiated through Account. Account is the foundation of your digital identity.
|
|
16
|
-
|
|
17
|
-
> **📢 Important Notice:** WoWok will never expose your private key to AI under any circumstances. You can use WoWok as a regular hot wallet. We recommend keeping significant assets in your cold wallet.
|
|
18
|
-
|
|
19
|
-
**Core Features:**
|
|
20
|
-
- ✅ Generate new wallet accounts
|
|
21
|
-
- ✅ Get test coins (for test network)
|
|
22
|
-
- ✅ Suspend and resume accounts
|
|
23
|
-
- ✅ Transfer between accounts
|
|
24
|
-
- ✅ Query account information
|
|
25
|
-
- ✅ Sign data
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
**→ [View Account Detailed Documentation →](account.md)**
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
### 1.2 LocalMark (Local Address Book 📇)
|
|
33
|
-
|
|
34
|
-
**Why do we need LocalMark?**
|
|
35
|
-
|
|
36
|
-
Blockchain addresses are usually long strings of characters that are hard to remember. LocalMark allows you to give these addresses memorable names and tags.
|
|
37
|
-
|
|
38
|
-
**Core Features:**
|
|
39
|
-
- ✅ Add address marks (name + tags)
|
|
40
|
-
- ✅ Filter addresses by tags, names, and recent usage
|
|
41
|
-
- ✅ Remove address marks
|
|
42
|
-
- ✅ Clear all marks
|
|
43
|
-
|
|
44
|
-
**Important Notes:**
|
|
45
|
-
- ⚠️ Only stored on local device!
|
|
46
|
-
- ⚠️ Will not be uploaded to the chain!
|
|
47
|
-
- ⚠️ Can be modified and deleted at will!
|
|
48
|
-
|
|
49
|
-
**→ [View LocalMark Detailed Documentation →](localmark.md)**
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## 🎓 Practice Exercises
|
|
54
|
-
|
|
55
|
-
### Exercise 1: Create Your First Account
|
|
56
|
-
|
|
57
|
-
**💬 You**: Generate a new account named "my_first_account".
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
**🤖 AI Generated Request JSON:**
|
|
62
|
-
|
|
63
|
-
```json
|
|
64
|
-
{
|
|
65
|
-
"gen": {
|
|
66
|
-
"name": "my_first_account"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
**✅ Execution Successful:**
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
Account successfully generated!
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
**📤 Return Result:**
|
|
78
|
-
|
|
79
|
-
```json
|
|
80
|
-
{
|
|
81
|
-
"gen": {
|
|
82
|
-
"address": "...",
|
|
83
|
-
"name": "my_first_account"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
---
|
|
89
|
-
|
|
90
|
-
### Exercise 2: Get Test Coins
|
|
91
|
-
|
|
92
|
-
**💬 You**: Please claim faucet test tokens for my_first_account from testnet.
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
**🤖 AI Generated Request JSON:**
|
|
97
|
-
|
|
98
|
-
```json
|
|
99
|
-
{
|
|
100
|
-
"faucet": {
|
|
101
|
-
"name_or_address": "my_first_account",
|
|
102
|
-
"network": "testnet"
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
**✅ Execution Successful:**
|
|
108
|
-
|
|
109
|
-
```
|
|
110
|
-
Successfully claimed test tokens from testnet!
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
**📤 Return Result:**
|
|
114
|
-
|
|
115
|
-
```json
|
|
116
|
-
{
|
|
117
|
-
"faucet": {
|
|
118
|
-
"name_or_address": "my_first_account",
|
|
119
|
-
"result": [...]
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
```
|
|
123
|
-
---
|
|
124
|
-
|
|
125
|
-
### Exercise 3: Add Address Mark
|
|
126
|
-
|
|
127
|
-
**💬 You**: Add a mark to my_first_account named "Chat Account" with tag "Chat".
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
**🤖 AI Generated Request JSON:**
|
|
132
|
-
|
|
133
|
-
```json
|
|
134
|
-
{
|
|
135
|
-
"add": {
|
|
136
|
-
"op": "add",
|
|
137
|
-
"data": [
|
|
138
|
-
{
|
|
139
|
-
"name": { "value": "Chat Account" },
|
|
140
|
-
"address": "...",
|
|
141
|
-
"tags": ["Chat"]
|
|
142
|
-
}
|
|
143
|
-
]
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
**✅ Execution Successful:**
|
|
149
|
-
|
|
150
|
-
```
|
|
151
|
-
Successfully added mark for my_first_account!
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
**📤 Return Result:**
|
|
155
|
-
|
|
156
|
-
```json
|
|
157
|
-
{
|
|
158
|
-
"add": [
|
|
159
|
-
{
|
|
160
|
-
"name": "Chat Account",
|
|
161
|
-
"address": "...",
|
|
162
|
-
"tags": ["Chat"],
|
|
163
|
-
"createdAt": ...,
|
|
164
|
-
"updatedAt": ...
|
|
165
|
-
}
|
|
166
|
-
]
|
|
167
|
-
}
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
---
|
|
171
|
-
|
|
172
|
-
### Exercise 4: Add a Friend Address
|
|
173
|
-
|
|
174
|
-
**💬 You**: Name the address "0x731f779a62d5f7a883e1111586fe260cb9fa558911e4223d073ff8c49347d4aa" as "Alice" with tag: "My Friend".
|
|
175
|
-
|
|
176
|
-
---
|
|
177
|
-
|
|
178
|
-
**🤖 AI Generated Request JSON:**
|
|
179
|
-
|
|
180
|
-
```json
|
|
181
|
-
{
|
|
182
|
-
"add": {
|
|
183
|
-
"op": "add",
|
|
184
|
-
"data": [
|
|
185
|
-
{
|
|
186
|
-
"name": { "value": "Alice" },
|
|
187
|
-
"address": "0x731f779a62d5f7a883e1111586fe260cb9fa558911e4223d073ff8c49347d4aa",
|
|
188
|
-
"tags": ["My Friend"]
|
|
189
|
-
}
|
|
190
|
-
]
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
**✅ Execution Successful:**
|
|
196
|
-
|
|
197
|
-
```
|
|
198
|
-
Done! Successfully added mark for this address.
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
**📤 Return Result:**
|
|
202
|
-
|
|
203
|
-
```json
|
|
204
|
-
{
|
|
205
|
-
"add": [
|
|
206
|
-
{
|
|
207
|
-
"name": "Alice",
|
|
208
|
-
"address": "0x731f779a62d5f7a883e1111586fe260cb9fa558911e4223d073ff8c49347d4aa",
|
|
209
|
-
"tags": ["My Friend"],
|
|
210
|
-
"createdAt": ...,
|
|
211
|
-
"updatedAt": ...
|
|
212
|
-
}
|
|
213
|
-
]
|
|
214
|
-
}
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
---
|
|
218
|
-
|
|
219
|
-
## 🏆 Stage Checklist
|
|
220
|
-
|
|
221
|
-
Before moving to the next stage, please confirm that you have:
|
|
222
|
-
|
|
223
|
-
- [ ] Understood WoWok's core concepts
|
|
224
|
-
- [ ] Learned about WoWok's system architecture
|
|
225
|
-
- [ ] Understood the six pillars of the trust network
|
|
226
|
-
- [ ] Configured AI client
|
|
227
|
-
- [ ] Verified successful installation
|
|
228
|
-
- [ ] Successfully created at least one account
|
|
229
|
-
- [ ] Obtained test coins on test network
|
|
230
|
-
- [ ] Added several address marks
|
|
231
|
-
- [ ] Understood the difference between local operations and on-chain operations
|
|
232
|
-
|
|
233
|
-
---
|
|
234
|
-
|
|
235
|
-
## 🎉 Congratulations!
|
|
236
|
-
|
|
237
|
-
You have completed Stage 1! Now you have mastered WoWok's basic operations and can move on to the next stage to learn about trust management!
|
|
238
|
-
|
|
239
|
-
**[→ Go to Stage 2: Trust Management 🔐 →](stage-02-trust.md)**
|
|
240
|
-
|
|
241
|
-
---
|
|
242
|
-
|
|
243
|
-
**[← Return to Main Directory](../README.md)**
|
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
# Stage 2: Trust Management 🔐
|
|
2
|
-
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
**[← Stage 1: Getting Started](stage-01-introduction.md) | [Stage 3: Open Collaboration →](stage-03-collaboration.md)**
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 🎯 Stage Objectives
|
|
10
|
-
|
|
11
|
-
In this stage, you will learn about trust management mechanisms in WoWok, including:
|
|
12
|
-
|
|
13
|
-
- How to manage who can do what through Permission
|
|
14
|
-
- How to create programmable trust rules through Guard
|
|
15
|
-
- Understanding WoWok's permission index system
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## 📚 Learning Content
|
|
20
|
-
|
|
21
|
-
### 2.1 Permission (Permission Management 🔑)
|
|
22
|
-
|
|
23
|
-
**Why do we need Permission?**
|
|
24
|
-
|
|
25
|
-
In a decentralized world, we need to clearly define: **who can perform what operations on what objects**. Permission is WoWok's permission management system.
|
|
26
|
-
|
|
27
|
-
**Core Concepts:**
|
|
28
|
-
- 👤 **Subject (Who)** - Who (account address or Guard ID)
|
|
29
|
-
- 📦 **Object (What)** - On-chain objects (all objects that have set this Permission)
|
|
30
|
-
- 🎯 **Action (How)** - What to do (permission index)
|
|
31
|
-
|
|
32
|
-
> **📢 Notice:** Users can perform operations with specified permissions on specified objects through their account or by completing specified Guard verification.
|
|
33
|
-
|
|
34
|
-
**Built-in Permission Indexes:**
|
|
35
|
-
```
|
|
36
|
-
SERVICE_NEW = 300 - Create service
|
|
37
|
-
SERVICE_DESCRIPTION = 301 - Modify service description
|
|
38
|
-
MACHINE_NEW = 500 - Create workflow
|
|
39
|
-
REPOSITORY_NEW = 700 - Create data repository
|
|
40
|
-
... etc
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
**Core Features:**
|
|
44
|
-
- ✅ Add/Remove permissions
|
|
45
|
-
- ✅ Remove permissions for accounts or Guard IDs
|
|
46
|
-
- ✅ Exchange, copy, and transfer permissions
|
|
47
|
-
- ✅ Query built-in permissions
|
|
48
|
-
|
|
49
|
-
**→ [View Permission Detailed Documentation →](permission.md)**
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
### 2.2 Guard (Trust Verification Engine 🛡️)
|
|
54
|
-
|
|
55
|
-
**Why do we need Guard?**
|
|
56
|
-
|
|
57
|
-
Permission is like permission management for specific groups and internal organization personnel, while Guard acts like a "guard" that can verify and authorize operations for unknown crowds, such as:
|
|
58
|
-
- If you have purchased a certain service before a certain time, you can claim $20 reward from the Reward object
|
|
59
|
-
- If you recommend a service approved by the user to their Demand, you can get $40 reward
|
|
60
|
-
- If a courier's delivery time in a certain process is less than 20 minutes, they can get 10 points
|
|
61
|
-
- etc.
|
|
62
|
-
|
|
63
|
-
**Core Concepts:**
|
|
64
|
-
- Guard can be defined in Markdown or JSON format
|
|
65
|
-
- Supports complex conditional verification logic
|
|
66
|
-
- Can interact with Reward, Machine, and other components
|
|
67
|
-
|
|
68
|
-
**Core Features:**
|
|
69
|
-
- ✅ Create Guard (Markdown format)
|
|
70
|
-
- ✅ Create Guard (JSON format)
|
|
71
|
-
- ✅ Query built-in Guard instructions
|
|
72
|
-
- ✅ Link Guard to other objects
|
|
73
|
-
|
|
74
|
-
**→ [View Guard Detailed Documentation →](guard.md)**
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## 🎓 Practice Exercises
|
|
79
|
-
|
|
80
|
-
### Exercise 1: Create a Permission
|
|
81
|
-
|
|
82
|
-
**💬 You**: On testnet, using my_first_account, create a new Permission object. And:
|
|
83
|
-
1. Add description: "Test Permission";
|
|
84
|
-
2. Add permissions for alice: create Service, and all permissions related to Machine;
|
|
85
|
-
3. Name this new object P1
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
**🤖 AI Generated Request JSON:**
|
|
90
|
-
|
|
91
|
-
```json
|
|
92
|
-
{
|
|
93
|
-
"data": {
|
|
94
|
-
"description": "Test Permission",
|
|
95
|
-
"object": {
|
|
96
|
-
"name": "P1"
|
|
97
|
-
},
|
|
98
|
-
"table": {
|
|
99
|
-
"op": "add perm by entity",
|
|
100
|
-
"entity": {
|
|
101
|
-
"name_or_address": "alice"
|
|
102
|
-
},
|
|
103
|
-
"index": [
|
|
104
|
-
300,
|
|
105
|
-
200,
|
|
106
|
-
201,
|
|
107
|
-
203,
|
|
108
|
-
204,
|
|
109
|
-
205,
|
|
110
|
-
206,
|
|
111
|
-
207,
|
|
112
|
-
208
|
|
113
|
-
]
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
"operation_type": "permission",
|
|
117
|
-
"env": {
|
|
118
|
-
"account": "my_first_account",
|
|
119
|
-
"network": "testnet"
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
**✅ Transaction executed successfully:**
|
|
125
|
-
|
|
126
|
-
```
|
|
127
|
-
Transaction completed successfully...
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
**📤 Return Result:**
|
|
131
|
-
|
|
132
|
-
```json
|
|
133
|
-
[
|
|
134
|
-
{
|
|
135
|
-
"type": "Permission",
|
|
136
|
-
"type_raw": "0x2::permission::Permission",
|
|
137
|
-
"object": "...",
|
|
138
|
-
"version": "149",
|
|
139
|
-
"owner": {
|
|
140
|
-
"Shared": {
|
|
141
|
-
"initial_shared_version": 149
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
"change": "created"
|
|
145
|
-
}
|
|
146
|
-
]
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### Exercise 2: Create a Guard that Anyone Can Pass
|
|
150
|
-
|
|
151
|
-
**💬 You**: Create a Guard named "simple_guard": "Anyone can pass the verification".
|
|
152
|
-
|
|
153
|
-
---
|
|
154
|
-
|
|
155
|
-
**🤖 AI Generated Request JSON:**
|
|
156
|
-
|
|
157
|
-
```json
|
|
158
|
-
{
|
|
159
|
-
"data": {
|
|
160
|
-
"description": "Anyone can pass the verification",
|
|
161
|
-
"namedNew": {
|
|
162
|
-
"name": "simple_guard"
|
|
163
|
-
},
|
|
164
|
-
"table": [
|
|
165
|
-
{
|
|
166
|
-
"b_submission": false,
|
|
167
|
-
"identifier": 0,
|
|
168
|
-
"value": true,
|
|
169
|
-
"value_type": 0
|
|
170
|
-
}
|
|
171
|
-
],
|
|
172
|
-
"root": {
|
|
173
|
-
"node": {
|
|
174
|
-
"type": "identifier",
|
|
175
|
-
"identifier": 0
|
|
176
|
-
},
|
|
177
|
-
"type": "node"
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
"operation_type": "guard"
|
|
181
|
-
}
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
**✅ Transaction executed successfully:**
|
|
186
|
-
|
|
187
|
-
```
|
|
188
|
-
Transaction completed successfully
|
|
189
|
-
[
|
|
190
|
-
{
|
|
191
|
-
"type": "Guard",
|
|
192
|
-
"type_raw": "0x2::guard::Guard",
|
|
193
|
-
"object": "...",
|
|
194
|
-
"version": "12687712",
|
|
195
|
-
"owner": "Immutable",
|
|
196
|
-
"change": "created"
|
|
197
|
-
}
|
|
198
|
-
]
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
---
|
|
203
|
-
|
|
204
|
-
### Exercise 3: Create a Guard that Only User alice Can Pass
|
|
205
|
-
|
|
206
|
-
**💬 You**: Create a new Guard object named G1 (mandatory). It needs to verify:
|
|
207
|
-
The signer has permission to create service objects in P1 object.
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
|
|
211
|
-
**🤖 AI Generated Request JSON:**
|
|
212
|
-
|
|
213
|
-
```json
|
|
214
|
-
{
|
|
215
|
-
"data": {
|
|
216
|
-
"description": "Verify that the signer has permission to create service in P1 object",
|
|
217
|
-
"namedNew": {
|
|
218
|
-
"name": "G1",
|
|
219
|
-
"replaceExistName": true
|
|
220
|
-
},
|
|
221
|
-
"table": [
|
|
222
|
-
{
|
|
223
|
-
"identifier": 0,
|
|
224
|
-
"b_submission": false,
|
|
225
|
-
"value_type": 1,
|
|
226
|
-
"value": "P1"
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
"identifier": 1,
|
|
230
|
-
"b_submission": false,
|
|
231
|
-
"value_type": 4,
|
|
232
|
-
"value": 300
|
|
233
|
-
}
|
|
234
|
-
],
|
|
235
|
-
"root": {
|
|
236
|
-
"type": "node",
|
|
237
|
-
"node": {
|
|
238
|
-
"query": "permission.entity.perm has",
|
|
239
|
-
"type": "query",
|
|
240
|
-
"object": {
|
|
241
|
-
"identifier": 0
|
|
242
|
-
},
|
|
243
|
-
"parameters": [
|
|
244
|
-
{
|
|
245
|
-
"context": "Signer",
|
|
246
|
-
"type": "context"
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
"identifier": 1,
|
|
250
|
-
"type": "identifier"
|
|
251
|
-
}
|
|
252
|
-
]
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
"operation_type": "guard"
|
|
257
|
-
}
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
**✅ Transaction executed successfully:**
|
|
262
|
-
|
|
263
|
-
```
|
|
264
|
-
Transaction completed successfully
|
|
265
|
-
|
|
266
|
-
[
|
|
267
|
-
{
|
|
268
|
-
"type": "Guard",
|
|
269
|
-
"type_raw": "0x2::guard::Guard",
|
|
270
|
-
"object": "...",
|
|
271
|
-
"version": "12685347",
|
|
272
|
-
"owner": "Immutable",
|
|
273
|
-
"change": "created"
|
|
274
|
-
}
|
|
275
|
-
]
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
---
|
|
280
|
-
|
|
281
|
-
## 🏆 Stage Checklist
|
|
282
|
-
|
|
283
|
-
Before moving to the next stage, please confirm that you have:
|
|
284
|
-
|
|
285
|
-
- [ ] Understood the three core elements of Permission (Who, What, How)
|
|
286
|
-
- [ ] Know how to query built-in permission indexes
|
|
287
|
-
- [ ] Created at least one Permission
|
|
288
|
-
- [ ] Understood the role of Guard
|
|
289
|
-
- [ ] Created at least one Guard
|
|
290
|
-
- [ ] Understood the combined use of Permission and Guard
|
|
291
|
-
|
|
292
|
-
---
|
|
293
|
-
|
|
294
|
-
## 🎉 Congratulations!
|
|
295
|
-
|
|
296
|
-
You have completed Stage 2! Now you have mastered WoWok's trust management mechanisms and can move on to the next stage to learn about open collaboration!
|
|
297
|
-
|
|
298
|
-
**[→ Go to Stage 3: Open Collaboration 🤝 →](stage-03-collaboration.md)**
|
|
299
|
-
|
|
300
|
-
---
|
|
301
|
-
|
|
302
|
-
**[← Return to Main Directory](../README.md)**
|