@wowok/skills 1.1.8 → 1.1.10
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/LICENSE +36 -0
- package/README.md +1 -8
- package/examples/Insurance/Insurance.md +218 -90
- package/examples/MyShop/MyShop.md +513 -245
- package/examples/MyShop/myshop_machine_nodes.json +87 -0
- package/examples/MyShop_Advanced/MyShop_Advanced.md +633 -228
- package/examples/ThreeBody_Signature/ThreeBody_Signature.md +195 -202
- package/examples/Travel/Travel.md +775 -487
- package/examples/Travel/calc-weather-timestamps.js +9 -5
- package/package.json +4 -3
- package/wowok-tools/SKILL.md +85 -0
- package/examples/Insurance/Insurance_TestResults.md +0 -481
- package/examples/Insurance/insurance_complete_guard_v1.json +0 -50
- package/examples/MyShop/MyShop_TestResults.md +0 -1003
- package/examples/MyShop_Advanced/MyShop_Advanced_MerchantSystem_TestResults.md +0 -1297
- package/examples/MyShop_Advanced/MyShop_Advanced_OrderFlow_TestResults.md +0 -743
- package/examples/MyShop_Advanced/machine_nodes.json +0 -222
- package/examples/MyShop_Advanced/three_body_signature.wip +0 -30
- package/examples/ThreeBody_Signature/ThreeBody_Signature_TestResults.md +0 -599
- package/examples/Travel/Travel_TestResults.md +0 -743
- package/examples/Travel/travel_machine_v2_export.json +0 -104
- package/examples/Travel/weather_check_guard_v1.json +0 -51
|
@@ -8,7 +8,7 @@ A complete example demonstrating how to create a service for book signing by the
|
|
|
8
8
|
|
|
9
9
|
This example demonstrates:
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
**Service with Buy Guard**: The buy_guard allows you to define various conditions for users to purchase products, such as identity verification, completing KYC, or being on an allowlist. In this example, only the service creator (author) can purchase this service.
|
|
12
12
|
|
|
13
13
|
### Key Design Decisions
|
|
14
14
|
|
|
@@ -33,17 +33,45 @@ Before running this example, ensure you have:
|
|
|
33
33
|
{
|
|
34
34
|
"query_type": "account_balance",
|
|
35
35
|
"name_or_address": "three_body_author",
|
|
36
|
+
"balance": true,
|
|
36
37
|
"network": "testnet"
|
|
37
38
|
}
|
|
38
39
|
```
|
|
39
40
|
|
|
40
|
-
**
|
|
41
|
+
**Expected Result** (if account has balance):
|
|
41
42
|
```json
|
|
42
43
|
{
|
|
43
|
-
"address": "
|
|
44
|
+
"address": "0x...",
|
|
44
45
|
"balance": {
|
|
45
46
|
"coinType": "0x2::wow::WOW",
|
|
46
|
-
"totalBalance": "
|
|
47
|
+
"totalBalance": "1000000000"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**If no balance, use Faucet**:
|
|
53
|
+
|
|
54
|
+
**Request**:
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"faucet": {
|
|
58
|
+
"network": "testnet",
|
|
59
|
+
"name_or_address": "three_body_author"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Expected Result**:
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"faucet": {
|
|
68
|
+
"name_or_address": "three_body_author",
|
|
69
|
+
"result": [
|
|
70
|
+
{"amount": 1000000000, "id": "0x..."},
|
|
71
|
+
{"amount": 1000000000, "id": "0x..."},
|
|
72
|
+
{"amount": 1000000000, "id": "0x..."}
|
|
73
|
+
],
|
|
74
|
+
"network": "testnet"
|
|
47
75
|
}
|
|
48
76
|
}
|
|
49
77
|
```
|
|
@@ -60,10 +88,10 @@ Create a Permission object to manage the service.
|
|
|
60
88
|
"operation_type": "permission",
|
|
61
89
|
"data": {
|
|
62
90
|
"object": {
|
|
63
|
-
"name": "
|
|
91
|
+
"name": "three_body_permission",
|
|
64
92
|
"replaceExistName": true
|
|
65
93
|
},
|
|
66
|
-
"description": "Permission for Three-Body Signature Service
|
|
94
|
+
"description": "Permission for Three-Body Signature Service",
|
|
67
95
|
"table": {
|
|
68
96
|
"op": "add perm by entity",
|
|
69
97
|
"entity": {"name_or_address": "three_body_author"},
|
|
@@ -77,12 +105,12 @@ Create a Permission object to manage the service.
|
|
|
77
105
|
}
|
|
78
106
|
```
|
|
79
107
|
|
|
80
|
-
**
|
|
108
|
+
**Expected Result**:
|
|
81
109
|
```json
|
|
82
110
|
[{
|
|
83
111
|
"type": "Permission",
|
|
84
|
-
"object": "
|
|
85
|
-
"version": "
|
|
112
|
+
"object": "0x...",
|
|
113
|
+
"version": "...",
|
|
86
114
|
"change": "created"
|
|
87
115
|
}]
|
|
88
116
|
```
|
|
@@ -99,7 +127,7 @@ Create a Guard that verifies the buyer is the service creator (author). This ens
|
|
|
99
127
|
"operation_type": "guard",
|
|
100
128
|
"data": {
|
|
101
129
|
"namedNew": {
|
|
102
|
-
"name": "
|
|
130
|
+
"name": "three_body_buy_guard",
|
|
103
131
|
"tags": ["signature", "book", "buy-guard"],
|
|
104
132
|
"replaceExistName": true
|
|
105
133
|
},
|
|
@@ -109,25 +137,22 @@ Create a Guard that verifies the buyer is the service creator (author). This ens
|
|
|
109
137
|
"identifier": 0,
|
|
110
138
|
"b_submission": false,
|
|
111
139
|
"value_type": "Address",
|
|
112
|
-
"value": "
|
|
113
|
-
"name": "
|
|
140
|
+
"value": "three_body_author",
|
|
141
|
+
"name": "Author address"
|
|
114
142
|
}
|
|
115
143
|
],
|
|
116
144
|
"root": {
|
|
117
|
-
"type": "
|
|
118
|
-
"
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
]
|
|
130
|
-
}
|
|
145
|
+
"type": "logic_equal",
|
|
146
|
+
"nodes": [
|
|
147
|
+
{
|
|
148
|
+
"type": "context",
|
|
149
|
+
"context": "Signer"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"type": "identifier",
|
|
153
|
+
"identifier": 0
|
|
154
|
+
}
|
|
155
|
+
]
|
|
131
156
|
}
|
|
132
157
|
},
|
|
133
158
|
"env": {
|
|
@@ -137,12 +162,14 @@ Create a Guard that verifies the buyer is the service creator (author). This ens
|
|
|
137
162
|
}
|
|
138
163
|
```
|
|
139
164
|
|
|
140
|
-
**
|
|
165
|
+
> **Note**: The Guard uses a `table` to define constant values with identifiers, then references them in the `root` logic using `identifier` node type. The `root` is a direct GuardNode (no wrapper).
|
|
166
|
+
|
|
167
|
+
**Expected Result**:
|
|
141
168
|
```json
|
|
142
169
|
[{
|
|
143
170
|
"type": "Guard",
|
|
144
|
-
"object": "
|
|
145
|
-
"version": "
|
|
171
|
+
"object": "0x...",
|
|
172
|
+
"version": "...",
|
|
146
173
|
"change": "created"
|
|
147
174
|
}]
|
|
148
175
|
```
|
|
@@ -161,11 +188,11 @@ Create a Machine to define the service workflow: Book Delivery → Signature Com
|
|
|
161
188
|
"operation_type": "machine",
|
|
162
189
|
"data": {
|
|
163
190
|
"object": {
|
|
164
|
-
"name": "
|
|
165
|
-
"permission": "
|
|
191
|
+
"name": "three_body_machine",
|
|
192
|
+
"permission": "three_body_permission",
|
|
166
193
|
"replaceExistName": true
|
|
167
194
|
},
|
|
168
|
-
"description": "Three-Body signature service workflow
|
|
195
|
+
"description": "Three-Body signature service workflow: Book Delivery -> Signature Completion",
|
|
169
196
|
"node": {
|
|
170
197
|
"op": "add",
|
|
171
198
|
"nodes": [
|
|
@@ -212,18 +239,16 @@ Create a Machine to define the service workflow: Book Delivery → Signature Com
|
|
|
212
239
|
}
|
|
213
240
|
```
|
|
214
241
|
|
|
215
|
-
**
|
|
242
|
+
**Expected Result**:
|
|
216
243
|
```json
|
|
217
244
|
[{
|
|
218
245
|
"type": "Machine",
|
|
219
|
-
"object": "
|
|
220
|
-
"version": "
|
|
246
|
+
"object": "0x...",
|
|
247
|
+
"version": "...",
|
|
221
248
|
"change": "created"
|
|
222
249
|
}]
|
|
223
250
|
```
|
|
224
251
|
|
|
225
|
-
|
|
226
|
-
|
|
227
252
|
---
|
|
228
253
|
|
|
229
254
|
## Step 4: Create Service (Unpublished)
|
|
@@ -236,12 +261,12 @@ Create the Three-Body signature service without publishing. The Service must be
|
|
|
236
261
|
"operation_type": "service",
|
|
237
262
|
"data": {
|
|
238
263
|
"object": {
|
|
239
|
-
"name": "
|
|
264
|
+
"name": "three_body_signature_service",
|
|
240
265
|
"type_parameter": "0x2::wow::WOW",
|
|
241
|
-
"permission": "
|
|
266
|
+
"permission": "three_body_permission",
|
|
242
267
|
"replaceExistName": true
|
|
243
268
|
},
|
|
244
|
-
"description": "Three-Body author book signature service
|
|
269
|
+
"description": "Three-Body author book signature service. Provide a message up to 10 characters, and the author will sign your book. Process: 1.Book Delivery 2.Signature Completion. Fee: 888.",
|
|
245
270
|
"publish": false
|
|
246
271
|
},
|
|
247
272
|
"env": {
|
|
@@ -251,12 +276,12 @@ Create the Three-Body signature service without publishing. The Service must be
|
|
|
251
276
|
}
|
|
252
277
|
```
|
|
253
278
|
|
|
254
|
-
**
|
|
279
|
+
**Expected Result**:
|
|
255
280
|
```json
|
|
256
281
|
[{
|
|
257
282
|
"type": "Service",
|
|
258
|
-
"object": "
|
|
259
|
-
"version": "
|
|
283
|
+
"object": "0x...",
|
|
284
|
+
"version": "...",
|
|
260
285
|
"change": "created"
|
|
261
286
|
}]
|
|
262
287
|
```
|
|
@@ -272,8 +297,8 @@ Bind the published Machine to the Service. **Important**: The Service must be un
|
|
|
272
297
|
{
|
|
273
298
|
"operation_type": "service",
|
|
274
299
|
"data": {
|
|
275
|
-
"object": "
|
|
276
|
-
"machine": "
|
|
300
|
+
"object": "three_body_signature_service",
|
|
301
|
+
"machine": "three_body_machine"
|
|
277
302
|
},
|
|
278
303
|
"env": {
|
|
279
304
|
"account": "three_body_author",
|
|
@@ -282,24 +307,16 @@ Bind the published Machine to the Service. **Important**: The Service must be un
|
|
|
282
307
|
}
|
|
283
308
|
```
|
|
284
309
|
|
|
285
|
-
**
|
|
310
|
+
**Expected Result**:
|
|
286
311
|
```json
|
|
287
312
|
[{
|
|
288
313
|
"type": "Service",
|
|
289
|
-
"object": "
|
|
290
|
-
"version": "
|
|
314
|
+
"object": "0x...",
|
|
315
|
+
"version": "...",
|
|
291
316
|
"change": "mutated"
|
|
292
317
|
}]
|
|
293
318
|
```
|
|
294
319
|
|
|
295
|
-
**Verification** (with no_cache: true):
|
|
296
|
-
```json
|
|
297
|
-
{
|
|
298
|
-
"machine": "0x8e7e1c3f173c9e2203ca2e1e50b4c634dd1cef06d248ac50e35749adf7499411",
|
|
299
|
-
"bPublished": false
|
|
300
|
-
}
|
|
301
|
-
```
|
|
302
|
-
|
|
303
320
|
---
|
|
304
321
|
|
|
305
322
|
## Step 6: Set Buy Guard
|
|
@@ -311,8 +328,8 @@ Configure the Buy Guard to restrict purchases to the author only.
|
|
|
311
328
|
{
|
|
312
329
|
"operation_type": "service",
|
|
313
330
|
"data": {
|
|
314
|
-
"object": "
|
|
315
|
-
"buy_guard": "
|
|
331
|
+
"object": "three_body_signature_service",
|
|
332
|
+
"buy_guard": "three_body_buy_guard"
|
|
316
333
|
},
|
|
317
334
|
"env": {
|
|
318
335
|
"account": "three_body_author",
|
|
@@ -321,12 +338,12 @@ Configure the Buy Guard to restrict purchases to the author only.
|
|
|
321
338
|
}
|
|
322
339
|
```
|
|
323
340
|
|
|
324
|
-
**
|
|
341
|
+
**Expected Result**:
|
|
325
342
|
```json
|
|
326
343
|
[{
|
|
327
344
|
"type": "Service",
|
|
328
|
-
"object": "
|
|
329
|
-
"version": "
|
|
345
|
+
"object": "0x...",
|
|
346
|
+
"version": "...",
|
|
330
347
|
"change": "mutated"
|
|
331
348
|
}]
|
|
332
349
|
```
|
|
@@ -342,13 +359,13 @@ Set up fund allocation: 100% to the author upon order completion.
|
|
|
342
359
|
{
|
|
343
360
|
"operation_type": "service",
|
|
344
361
|
"data": {
|
|
345
|
-
"object": "
|
|
362
|
+
"object": "three_body_signature_service",
|
|
346
363
|
"order_allocators": {
|
|
347
364
|
"description": "Three-Body signature service fund allocation - 100% to author",
|
|
348
365
|
"threshold": 0,
|
|
349
366
|
"allocators": [
|
|
350
367
|
{
|
|
351
|
-
"guard": "
|
|
368
|
+
"guard": "three_body_buy_guard",
|
|
352
369
|
"sharing": [
|
|
353
370
|
{
|
|
354
371
|
"who": {
|
|
@@ -370,12 +387,12 @@ Set up fund allocation: 100% to the author upon order completion.
|
|
|
370
387
|
}
|
|
371
388
|
```
|
|
372
389
|
|
|
373
|
-
**
|
|
390
|
+
**Expected Result**:
|
|
374
391
|
```json
|
|
375
392
|
[{
|
|
376
393
|
"type": "Service",
|
|
377
|
-
"object": "
|
|
378
|
-
"version": "
|
|
394
|
+
"object": "0x...",
|
|
395
|
+
"version": "...",
|
|
379
396
|
"change": "mutated"
|
|
380
397
|
}]
|
|
381
398
|
```
|
|
@@ -391,7 +408,7 @@ Add sales items and publish the service to make it available for orders.
|
|
|
391
408
|
{
|
|
392
409
|
"operation_type": "service",
|
|
393
410
|
"data": {
|
|
394
|
-
"object": "
|
|
411
|
+
"object": "three_body_signature_service",
|
|
395
412
|
"sales": {
|
|
396
413
|
"op": "add",
|
|
397
414
|
"sales": [
|
|
@@ -414,12 +431,12 @@ Add sales items and publish the service to make it available for orders.
|
|
|
414
431
|
}
|
|
415
432
|
```
|
|
416
433
|
|
|
417
|
-
**
|
|
434
|
+
**Expected Result**:
|
|
418
435
|
```json
|
|
419
436
|
[{
|
|
420
437
|
"type": "Service",
|
|
421
|
-
"object": "
|
|
422
|
-
"version": "
|
|
438
|
+
"object": "0x...",
|
|
439
|
+
"version": "...",
|
|
423
440
|
"change": "mutated"
|
|
424
441
|
}]
|
|
425
442
|
```
|
|
@@ -435,7 +452,7 @@ Unpause the service to allow order creation.
|
|
|
435
452
|
{
|
|
436
453
|
"operation_type": "service",
|
|
437
454
|
"data": {
|
|
438
|
-
"object": "
|
|
455
|
+
"object": "three_body_signature_service",
|
|
439
456
|
"pause": false
|
|
440
457
|
},
|
|
441
458
|
"env": {
|
|
@@ -445,12 +462,12 @@ Unpause the service to allow order creation.
|
|
|
445
462
|
}
|
|
446
463
|
```
|
|
447
464
|
|
|
448
|
-
**
|
|
465
|
+
**Expected Result**:
|
|
449
466
|
```json
|
|
450
467
|
[{
|
|
451
468
|
"type": "Service",
|
|
452
|
-
"object": "
|
|
453
|
-
"version": "
|
|
469
|
+
"object": "0x...",
|
|
470
|
+
"version": "...",
|
|
454
471
|
"change": "mutated"
|
|
455
472
|
}]
|
|
456
473
|
```
|
|
@@ -465,18 +482,18 @@ Query the service to verify all configurations.
|
|
|
465
482
|
```json
|
|
466
483
|
{
|
|
467
484
|
"query_type": "onchain_objects",
|
|
468
|
-
"objects": ["
|
|
485
|
+
"objects": ["three_body_signature_service"],
|
|
469
486
|
"no_cache": true,
|
|
470
487
|
"network": "testnet"
|
|
471
488
|
}
|
|
472
489
|
```
|
|
473
490
|
|
|
474
|
-
**
|
|
491
|
+
**Expected Result**:
|
|
475
492
|
```json
|
|
476
493
|
{
|
|
477
|
-
"object": "
|
|
494
|
+
"object": "three_body_signature_service",
|
|
478
495
|
"type": "Service",
|
|
479
|
-
"description": "Three-Body author book signature service
|
|
496
|
+
"description": "Three-Body author book signature service. Provide a message up to 10 characters, and the author will sign your book. Process: 1.Book Delivery 2.Signature Completion. Fee: 888.",
|
|
480
497
|
"sales": [
|
|
481
498
|
{
|
|
482
499
|
"name": "Three-Body Book Signature",
|
|
@@ -487,12 +504,12 @@ Query the service to verify all configurations.
|
|
|
487
504
|
"wip_hash": ""
|
|
488
505
|
}
|
|
489
506
|
],
|
|
490
|
-
"buy_guard": "
|
|
491
|
-
"machine": "
|
|
507
|
+
"buy_guard": "three_body_buy_guard",
|
|
508
|
+
"machine": "three_body_machine",
|
|
492
509
|
"bPublished": true,
|
|
493
510
|
"bPaused": false,
|
|
494
511
|
"customer_required": ["phone", "email", "shipping_address"],
|
|
495
|
-
"permission": "
|
|
512
|
+
"permission": "three_body_permission"
|
|
496
513
|
}
|
|
497
514
|
```
|
|
498
515
|
|
|
@@ -509,7 +526,7 @@ The author (`three_body_author`) should be able to purchase the service.
|
|
|
509
526
|
{
|
|
510
527
|
"operation_type": "service",
|
|
511
528
|
"data": {
|
|
512
|
-
"object": "
|
|
529
|
+
"object": "three_body_signature_service",
|
|
513
530
|
"order_new": {
|
|
514
531
|
"buy": {
|
|
515
532
|
"items": [
|
|
@@ -524,11 +541,15 @@ The author (`three_body_author`) should be able to purchase the service.
|
|
|
524
541
|
}
|
|
525
542
|
},
|
|
526
543
|
"namedNewOrder": {
|
|
527
|
-
"name": "
|
|
544
|
+
"name": "three_body_order",
|
|
528
545
|
"replaceExistName": true
|
|
529
546
|
},
|
|
530
547
|
"namedNewProgress": {
|
|
531
|
-
"name": "
|
|
548
|
+
"name": "three_body_progress",
|
|
549
|
+
"replaceExistName": true
|
|
550
|
+
},
|
|
551
|
+
"namedNewAllocation": {
|
|
552
|
+
"name": "three_body_allocation",
|
|
532
553
|
"replaceExistName": true
|
|
533
554
|
}
|
|
534
555
|
}
|
|
@@ -540,6 +561,30 @@ The author (`three_body_author`) should be able to purchase the service.
|
|
|
540
561
|
}
|
|
541
562
|
```
|
|
542
563
|
|
|
564
|
+
**Expected Result**:
|
|
565
|
+
```json
|
|
566
|
+
[
|
|
567
|
+
{
|
|
568
|
+
"type": "Progress",
|
|
569
|
+
"object": "three_body_progress",
|
|
570
|
+
"version": "...",
|
|
571
|
+
"change": "created"
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
"type": "Order",
|
|
575
|
+
"object": "three_body_order",
|
|
576
|
+
"version": "...",
|
|
577
|
+
"change": "created"
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
"type": "Allocation",
|
|
581
|
+
"object": "three_body_allocation",
|
|
582
|
+
"version": "...",
|
|
583
|
+
"change": "created"
|
|
584
|
+
}
|
|
585
|
+
]
|
|
586
|
+
```
|
|
587
|
+
|
|
543
588
|
---
|
|
544
589
|
|
|
545
590
|
### Test 2: Non-Author Purchase (Should Fail)
|
|
@@ -551,7 +596,7 @@ Any other account attempting to purchase should fail with Buy Guard verification
|
|
|
551
596
|
{
|
|
552
597
|
"operation_type": "service",
|
|
553
598
|
"data": {
|
|
554
|
-
"object": "
|
|
599
|
+
"object": "three_body_signature_service",
|
|
555
600
|
"order_new": {
|
|
556
601
|
"buy": {
|
|
557
602
|
"items": [
|
|
@@ -568,12 +613,19 @@ Any other account attempting to purchase should fail with Buy Guard verification
|
|
|
568
613
|
}
|
|
569
614
|
},
|
|
570
615
|
"env": {
|
|
571
|
-
"account": "
|
|
616
|
+
"account": "three_body_customer",
|
|
572
617
|
"network": "testnet"
|
|
573
618
|
}
|
|
574
619
|
}
|
|
575
620
|
```
|
|
576
621
|
|
|
622
|
+
**Expected Result** (Error):
|
|
623
|
+
```json
|
|
624
|
+
{
|
|
625
|
+
"error": "Transaction resolution failed: MoveAbort in 8th command, abort code: 7 (Verify failed), in '0x2::passport::result_for_guard'"
|
|
626
|
+
}
|
|
627
|
+
```
|
|
628
|
+
|
|
577
629
|
---
|
|
578
630
|
|
|
579
631
|
## Workflow Execution
|
|
@@ -589,10 +641,12 @@ The author confirms the book has been delivered.
|
|
|
589
641
|
{
|
|
590
642
|
"operation_type": "progress",
|
|
591
643
|
"data": {
|
|
592
|
-
"object": "
|
|
593
|
-
"
|
|
594
|
-
"
|
|
595
|
-
|
|
644
|
+
"object": "three_body_progress",
|
|
645
|
+
"operate": {
|
|
646
|
+
"operation": {
|
|
647
|
+
"next_node_name": "Book Delivered",
|
|
648
|
+
"forward": "Confirm Delivery"
|
|
649
|
+
}
|
|
596
650
|
}
|
|
597
651
|
},
|
|
598
652
|
"env": {
|
|
@@ -602,28 +656,53 @@ The author confirms the book has been delivered.
|
|
|
602
656
|
}
|
|
603
657
|
```
|
|
604
658
|
|
|
659
|
+
**Expected Result**:
|
|
660
|
+
```json
|
|
661
|
+
[{
|
|
662
|
+
"type": "Progress",
|
|
663
|
+
"object": "three_body_progress",
|
|
664
|
+
"version": "...",
|
|
665
|
+
"change": "mutated"
|
|
666
|
+
}]
|
|
667
|
+
```
|
|
668
|
+
|
|
605
669
|
### Node 2: Signature Completed
|
|
606
670
|
|
|
607
671
|
The author completes the signature.
|
|
608
672
|
|
|
673
|
+
> **Important**: Use `no_cache: true` in the `env` for sequential Progress operations on the same object. This ensures the SDK reads the latest on-chain state (including the updated `current` node) instead of using a cached version.
|
|
674
|
+
|
|
609
675
|
**Request**:
|
|
610
676
|
```json
|
|
611
677
|
{
|
|
612
678
|
"operation_type": "progress",
|
|
613
679
|
"data": {
|
|
614
|
-
"object": "
|
|
615
|
-
"
|
|
616
|
-
"
|
|
617
|
-
|
|
680
|
+
"object": "three_body_progress",
|
|
681
|
+
"operate": {
|
|
682
|
+
"operation": {
|
|
683
|
+
"next_node_name": "Signature Completed",
|
|
684
|
+
"forward": "Complete Signature"
|
|
685
|
+
}
|
|
618
686
|
}
|
|
619
687
|
},
|
|
620
688
|
"env": {
|
|
621
689
|
"account": "three_body_author",
|
|
622
|
-
"network": "testnet"
|
|
690
|
+
"network": "testnet",
|
|
691
|
+
"no_cache": true
|
|
623
692
|
}
|
|
624
693
|
}
|
|
625
694
|
```
|
|
626
695
|
|
|
696
|
+
**Expected Result**:
|
|
697
|
+
```json
|
|
698
|
+
[{
|
|
699
|
+
"type": "Progress",
|
|
700
|
+
"object": "three_body_progress",
|
|
701
|
+
"version": "...",
|
|
702
|
+
"change": "mutated"
|
|
703
|
+
}]
|
|
704
|
+
```
|
|
705
|
+
|
|
627
706
|
---
|
|
628
707
|
|
|
629
708
|
## Summary
|
|
@@ -635,17 +714,17 @@ This example demonstrates:
|
|
|
635
714
|
3. **WIP Files Optional**: Sales items can use WIP files or empty strings
|
|
636
715
|
4. **Service Configuration**: Complete setup from creation to publication
|
|
637
716
|
|
|
638
|
-
### Key
|
|
717
|
+
### Key Objects
|
|
639
718
|
|
|
640
|
-
| Object | Name |
|
|
641
|
-
|
|
642
|
-
| Permission |
|
|
643
|
-
| Buy Guard |
|
|
644
|
-
| Machine |
|
|
645
|
-
| Service |
|
|
646
|
-
| Order |
|
|
647
|
-
| Allocation |
|
|
648
|
-
| Progress |
|
|
719
|
+
| Object | Name |
|
|
720
|
+
|--------|------|
|
|
721
|
+
| Permission | three_body_permission |
|
|
722
|
+
| Buy Guard | three_body_buy_guard |
|
|
723
|
+
| Machine | three_body_machine |
|
|
724
|
+
| Service | three_body_signature_service |
|
|
725
|
+
| Order | three_body_order |
|
|
726
|
+
| Allocation | three_body_allocation |
|
|
727
|
+
| Progress | three_body_progress |
|
|
649
728
|
|
|
650
729
|
---
|
|
651
730
|
|
|
@@ -673,104 +752,18 @@ The two-node workflow provides clear tracking:
|
|
|
673
752
|
|
|
674
753
|
Each node transition requires the author's confirmation, ensuring accountability.
|
|
675
754
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
## Execution Experience & Best Practices
|
|
679
|
-
|
|
680
|
-
### 1. Naming Strategy (Critical!)
|
|
681
|
-
|
|
682
|
-
**Always establish naming conventions first** :
|
|
683
|
-
|
|
684
|
-
- **Example**: Use consistent suffixes or no suffixes at all
|
|
685
|
-
- Good: `three_body_permission_v2`, `three_body_buy_guard_v2`, `three_body_machine_v2`
|
|
686
|
-
- Good: All names follow the same pattern
|
|
687
|
-
- Provide naming rules for AI to manage object names automatically; avoid conflicts with other naming conventions such as version/timestamp/random numbers for unique names
|
|
688
|
-
- Strongly recommend using the `replaceExistName` method in `LocalMarkOperationSchema` to enforce name usage (even if already exists)
|
|
689
|
-
- All operations use names instead of addresses (much easier!)
|
|
690
|
-
- Local marks map names to addresses automatically
|
|
691
|
-
- Easier to read, test, and document
|
|
692
|
-
|
|
693
|
-
**Recommendation**:
|
|
694
|
-
1. Decide on naming before starting
|
|
695
|
-
2. Stick to it throughout the entire workflow
|
|
696
|
-
3. Document your naming pattern in the test results
|
|
697
|
-
|
|
698
|
-
### 2. Execution Order Matters (Critical!)
|
|
699
|
-
|
|
700
|
-
**Publish operations lock objects** - plan carefully:
|
|
701
|
-
|
|
702
|
-
#### Correct Order (Must Follow!)
|
|
703
|
-
1. **Permission** first - foundation for all other objects
|
|
704
|
-
2. **Machine** - create workflow before service
|
|
705
|
-
3. **Service (unpublished)** - get address for Guards
|
|
706
|
-
4. **Guards** - need Service address for verification logic
|
|
707
|
-
5. **Configure Service** - add machine, buy_guard, order_allocators
|
|
708
|
-
6. **Publish Service** - LAST! Once published, many changes are blocked
|
|
709
|
-
|
|
710
|
-
### 3. Guard Creation Tips
|
|
711
|
-
|
|
712
|
-
**Guards often depend on other objects**:
|
|
713
|
-
- Buy Guards: May reference Service address
|
|
714
|
-
- Progress Guards: May need Machine or Service information
|
|
715
|
-
- Order Allocator Guards: Should be created before Service publish
|
|
716
|
-
|
|
717
|
-
**Best Practice**:
|
|
718
|
-
1. Create empty Service with name first (unpublished)
|
|
719
|
-
2. Create all required Guards using that name
|
|
720
|
-
3. Configure Service with Guards
|
|
721
|
-
4. Publish Service
|
|
722
|
-
|
|
723
|
-
### 4. Machine Workflow Setup
|
|
724
|
-
|
|
725
|
-
**Machine nodes require permission indexes**:
|
|
726
|
-
- If you use permissionIndex, make sure they exist!
|
|
727
|
-
- Create permission indexes before adding machine nodes
|
|
728
|
-
|
|
729
|
-
**Machine Publish**:
|
|
730
|
-
- Must publish Machine before binding to Service
|
|
731
|
-
- Published Machine can still have nodes added/modified
|
|
732
|
-
|
|
733
|
-
### 5. Service Configuration Flow
|
|
734
|
-
|
|
735
|
-
**Configure everything before publishing**:
|
|
736
|
-
```
|
|
737
|
-
Service Created (unpublished)
|
|
738
|
-
↓
|
|
739
|
-
Add Sales Items
|
|
740
|
-
↓
|
|
741
|
-
Bind Machine
|
|
742
|
-
↓
|
|
743
|
-
Set Buy Guard
|
|
744
|
-
↓
|
|
745
|
-
Configure Order Allocators
|
|
746
|
-
↓
|
|
747
|
-
Set Arbitration (if needed)
|
|
748
|
-
↓
|
|
749
|
-
PUBLISH (LAST STEP!)
|
|
750
|
-
```
|
|
751
|
-
|
|
752
|
-
### 6. Testing Strategy
|
|
753
|
-
|
|
754
|
-
**Test incrementally, not all at once**:
|
|
755
|
-
1. Test each step as you go
|
|
756
|
-
2. Verify object creation with queries
|
|
757
|
-
3. Don't proceed to next step until current one is verified
|
|
758
|
-
4. Keep track of all object IDs in a test results file
|
|
759
|
-
|
|
760
|
-
### 7. Common Pitfalls to Avoid
|
|
761
|
-
|
|
762
|
-
1. **Price Units**: WOW tokens use 9 decimals, but testnet examples often use simple numbers (888 tokens)
|
|
763
|
-
2. **Local Marks**: Verify objects exist with `local_mark_list` queries
|
|
764
|
-
3. **Account Balance**: Always check balance before starting - gas fees add up!
|
|
755
|
+
### Best Practices
|
|
765
756
|
|
|
766
|
-
|
|
757
|
+
1. **Naming Strategy**: Use consistent naming conventions and `replaceExistName: true` to enforce name usage. All operations use names instead of addresses for readability.
|
|
767
758
|
|
|
768
|
-
|
|
759
|
+
2. **Execution Order Matters**: Publish operations lock objects. Follow this order:
|
|
760
|
+
- Permission first (foundation)
|
|
761
|
+
- Machine (create workflow before service)
|
|
762
|
+
- Service (unpublished)
|
|
763
|
+
- Guards (need Service address for verification logic)
|
|
764
|
+
- Configure Service (add machine, buy_guard, order_allocators)
|
|
765
|
+
- Publish Service (LAST - once published, many changes are blocked)
|
|
769
766
|
|
|
770
|
-
**Use
|
|
771
|
-
- Verify objects exist
|
|
772
|
-
- Check configurations
|
|
773
|
-
- Debug issues
|
|
774
|
-
- Confirm state changes
|
|
767
|
+
3. **Use `no_cache: true` for Sequential Operations**: When performing multiple operations on the same object in sequence (especially Progress workflow advancement), always set `no_cache: true` in the `env` to ensure the SDK reads the latest on-chain state.
|
|
775
768
|
|
|
776
|
-
|
|
769
|
+
4. **Query Toolkit is Your Best Friend**: Use queries constantly to verify objects exist, check configurations, debug issues, and confirm state changes.
|