@wowok/skills 1.1.2 → 1.1.4
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 +46 -7
- package/dist/cli.js +150 -35
- package/dist/cli.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -1
- package/examples/MyShop_Advanced/MyShop_Advanced.md +220 -228
- package/examples/MyShop_Advanced/three_body_signature.wip +30 -0
- package/package.json +3 -1
- package/scripts/install.js +126 -15
- package/wowok-arbitrator/SKILL.md +192 -192
- package/wowok-guard/SKILL.md +189 -285
- package/wowok-machine/SKILL.md +167 -328
- package/wowok-messenger/SKILL.md +293 -0
- package/wowok-order/SKILL.md +6 -6
- package/wowok-output/SKILL.md +142 -0
- package/wowok-provider/SKILL.md +3 -1
- package/wowok-safety/SKILL.md +23 -59
- package/wowok-tools/SKILL.md +140 -537
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
An advanced e-commerce example demonstrating escrow with multiple order fund allocation modes, multi-party allocation, arbitration with voting guards, and WIP-based product verification.
|
|
4
4
|
|
|
5
|
-
> **
|
|
6
|
-
> - **Merchant System Setup**: See [MyShop\_Advanced\_MerchantSystem\_TestResults.md](MyShop_Advanced_MerchantSystem_TestResults.md) for service construction test results
|
|
7
|
-
> - **Customer Order Flow**: See [MyShop\_Advanced\_OrderFlow\_TestResults.md](MyShop_Advanced_OrderFlow_TestResults.md) for order testing results
|
|
5
|
+
> **Complete Example**: This document contains all necessary JSON examples for setting up the MyShop Advanced e-commerce system.
|
|
8
6
|
|
|
9
7
|
***
|
|
10
8
|
|
|
@@ -360,7 +358,7 @@ Create a new permission object for the advanced shop.
|
|
|
360
358
|
|
|
361
359
|
Add custom permission indexes for advanced operations.
|
|
362
360
|
|
|
363
|
-
**Permission Index
|
|
361
|
+
**Permission Index 1000**: Order Confirmed + Order Cancel (Merchant operations for order confirmation/cancellation)
|
|
364
362
|
|
|
365
363
|
```json
|
|
366
364
|
{
|
|
@@ -369,12 +367,12 @@ Add custom permission indexes for advanced operations.
|
|
|
369
367
|
"object": "myshop_permission_v2",
|
|
370
368
|
"remark": {
|
|
371
369
|
"op": "set",
|
|
372
|
-
"index":
|
|
370
|
+
"index": 1000,
|
|
373
371
|
"remark": "Order Confirmed and Order Cancel - Merchant confirms or cancels order with Merkle Root"
|
|
374
372
|
},
|
|
375
373
|
"table": {
|
|
376
374
|
"op": "add perm by index",
|
|
377
|
-
"index":
|
|
375
|
+
"index": 1000,
|
|
378
376
|
"entity": {
|
|
379
377
|
"entities": [{"name_or_address": "myshop_merchant"}]
|
|
380
378
|
}
|
|
@@ -387,7 +385,7 @@ Add custom permission indexes for advanced operations.
|
|
|
387
385
|
}
|
|
388
386
|
```
|
|
389
387
|
|
|
390
|
-
**Permission Index
|
|
388
|
+
**Permission Index 1001**: Shipping + Order Complete + Lost + Return (Merchant logistics operations)
|
|
391
389
|
|
|
392
390
|
```json
|
|
393
391
|
{
|
|
@@ -396,12 +394,12 @@ Add custom permission indexes for advanced operations.
|
|
|
396
394
|
"object": "myshop_permission_v2",
|
|
397
395
|
"remark": {
|
|
398
396
|
"op": "set",
|
|
399
|
-
"index":
|
|
400
|
-
"remark": "Shipping
|
|
397
|
+
"index": 1001,
|
|
398
|
+
"remark": "Shipping, Order Complete, Lost, Return operations - Merchant logistics operations with Merkle Root"
|
|
401
399
|
},
|
|
402
400
|
"table": {
|
|
403
401
|
"op": "add perm by index",
|
|
404
|
-
"index":
|
|
402
|
+
"index": 1001,
|
|
405
403
|
"entity": {
|
|
406
404
|
"entities": [{"name_or_address": "myshop_merchant"}]
|
|
407
405
|
}
|
|
@@ -414,52 +412,24 @@ Add custom permission indexes for advanced operations.
|
|
|
414
412
|
}
|
|
415
413
|
```
|
|
416
414
|
|
|
417
|
-
|
|
415
|
+
***
|
|
418
416
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
"data": {
|
|
423
|
-
"object": "myshop_permission_v2",
|
|
424
|
-
"remark": {
|
|
425
|
-
"op": "set",
|
|
426
|
-
"index": 1012,
|
|
427
|
-
"remark": "Delivery Complete - Customer confirms receipt"
|
|
428
|
-
},
|
|
429
|
-
"table": {
|
|
430
|
-
"op": "add perm by index",
|
|
431
|
-
"index": 1012,
|
|
432
|
-
"entity": {
|
|
433
|
-
"entities": [{"name_or_address": "myshop_customer"}]
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
},
|
|
437
|
-
"env": {
|
|
438
|
-
"account": "myshop_merchant",
|
|
439
|
-
"network": "testnet"
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
```
|
|
417
|
+
### Step 3: Create Service (Unpublished)
|
|
418
|
+
|
|
419
|
+
Create the Service without publishing to obtain its address for Guard creation.
|
|
443
420
|
|
|
444
|
-
**
|
|
421
|
+
**Prompt**: Create Service "three\_body\_signature\_service\_v2" with permission "myshop\_permission\_v2", do not publish.
|
|
445
422
|
|
|
446
423
|
```json
|
|
447
424
|
{
|
|
448
|
-
"operation_type": "
|
|
425
|
+
"operation_type": "service",
|
|
449
426
|
"data": {
|
|
450
|
-
"object":
|
|
451
|
-
|
|
452
|
-
"
|
|
453
|
-
"index": 1013,
|
|
454
|
-
"remark": "Wonderful - Customer rates order as wonderful"
|
|
427
|
+
"object": {
|
|
428
|
+
"name": "three_body_signature_service_v2",
|
|
429
|
+
"permission": "myshop_permission_v2"
|
|
455
430
|
},
|
|
456
|
-
"
|
|
457
|
-
|
|
458
|
-
"index": 1013,
|
|
459
|
-
"entity": {
|
|
460
|
-
"entities": [{"name_or_address": "myshop_customer"}]
|
|
461
|
-
}
|
|
462
|
-
}
|
|
431
|
+
"description": "Three-Body Problem Signature Edition - Limited collector's item with WIP verification",
|
|
432
|
+
"publish": false
|
|
463
433
|
},
|
|
464
434
|
"env": {
|
|
465
435
|
"account": "myshop_merchant",
|
|
@@ -468,51 +438,43 @@ Add custom permission indexes for advanced operations.
|
|
|
468
438
|
}
|
|
469
439
|
```
|
|
470
440
|
|
|
471
|
-
**
|
|
441
|
+
**Record the Service address** - it will be needed for Guard creation.
|
|
472
442
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
"data": {
|
|
477
|
-
"object": "myshop_permission_v2",
|
|
478
|
-
"remark": {
|
|
479
|
-
"op": "set",
|
|
480
|
-
"index": 1014,
|
|
481
|
-
"remark": "Lost - Customer reports lost, Merchant confirms"
|
|
482
|
-
},
|
|
483
|
-
"table": {
|
|
484
|
-
"op": "add perm by index",
|
|
485
|
-
"index": 1014,
|
|
486
|
-
"entity": {
|
|
487
|
-
"entities": [{"name_or_address": "myshop_customer"}]
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
},
|
|
491
|
-
"env": {
|
|
492
|
-
"account": "myshop_merchant",
|
|
493
|
-
"network": "testnet"
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
```
|
|
443
|
+
***
|
|
444
|
+
|
|
445
|
+
### Step 4: Create Guards (Machine Guards)
|
|
497
446
|
|
|
498
|
-
|
|
447
|
+
Create Guards using the Service address. Guards verify order state and service ownership.
|
|
448
|
+
|
|
449
|
+
**Guard 1: machine_merkle_root_v2** - Verify Merkle Root string length = 64
|
|
499
450
|
|
|
500
451
|
```json
|
|
501
452
|
{
|
|
502
|
-
"operation_type": "
|
|
453
|
+
"operation_type": "guard",
|
|
503
454
|
"data": {
|
|
504
|
-
"object":
|
|
505
|
-
|
|
506
|
-
"
|
|
507
|
-
"index": 1015,
|
|
508
|
-
"remark": "Non-receipt Return - Customer requests return before receipt"
|
|
455
|
+
"object": {
|
|
456
|
+
"name": "machine_merkle_root_v2",
|
|
457
|
+
"replaceExistName": true
|
|
509
458
|
},
|
|
510
|
-
"
|
|
511
|
-
|
|
512
|
-
"
|
|
513
|
-
"
|
|
514
|
-
|
|
515
|
-
|
|
459
|
+
"description": "Verify Merkle Root string length is 64 characters",
|
|
460
|
+
"root": {
|
|
461
|
+
"type": "logic_as_u256_equal",
|
|
462
|
+
"nodes": [
|
|
463
|
+
{
|
|
464
|
+
"type": "string_length",
|
|
465
|
+
"nodes": [
|
|
466
|
+
{
|
|
467
|
+
"type": "identifier",
|
|
468
|
+
"identifier": 0
|
|
469
|
+
}
|
|
470
|
+
]
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
"type": "constant",
|
|
474
|
+
"value": 64,
|
|
475
|
+
"value_type": "U256"
|
|
476
|
+
}
|
|
477
|
+
]
|
|
516
478
|
}
|
|
517
479
|
},
|
|
518
480
|
"env": {
|
|
@@ -522,24 +484,38 @@ Add custom permission indexes for advanced operations.
|
|
|
522
484
|
}
|
|
523
485
|
```
|
|
524
486
|
|
|
525
|
-
**
|
|
487
|
+
**Guard 2: machine_time_10d_v2** - Verify 10-day timeout (864000000 ms)
|
|
526
488
|
|
|
527
489
|
```json
|
|
528
490
|
{
|
|
529
|
-
"operation_type": "
|
|
491
|
+
"operation_type": "guard",
|
|
530
492
|
"data": {
|
|
531
|
-
"object":
|
|
532
|
-
|
|
533
|
-
"
|
|
534
|
-
"index": 1016,
|
|
535
|
-
"remark": "Receipt Return - Customer requests return after receipt"
|
|
493
|
+
"object": {
|
|
494
|
+
"name": "machine_time_10d_v2",
|
|
495
|
+
"replaceExistName": true
|
|
536
496
|
},
|
|
537
|
-
"
|
|
538
|
-
|
|
539
|
-
"
|
|
540
|
-
"
|
|
541
|
-
|
|
542
|
-
|
|
497
|
+
"description": "Verify time elapsed >= 10 days (864000000 ms)",
|
|
498
|
+
"root": {
|
|
499
|
+
"type": "logic_as_u256_greater_or_equal",
|
|
500
|
+
"nodes": [
|
|
501
|
+
{
|
|
502
|
+
"type": "calc_number_subtract",
|
|
503
|
+
"nodes": [
|
|
504
|
+
{
|
|
505
|
+
"type": "context",
|
|
506
|
+
"context": "Clock"
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
"type": "identifier",
|
|
510
|
+
"identifier": 0
|
|
511
|
+
}
|
|
512
|
+
]
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
"type": "identifier",
|
|
516
|
+
"identifier": 1
|
|
517
|
+
}
|
|
518
|
+
]
|
|
543
519
|
}
|
|
544
520
|
},
|
|
545
521
|
"env": {
|
|
@@ -549,24 +525,60 @@ Add custom permission indexes for advanced operations.
|
|
|
549
525
|
}
|
|
550
526
|
```
|
|
551
527
|
|
|
552
|
-
**
|
|
528
|
+
**Guard 3: service_merchant_win_v2** - Verify node in [Order Complete, Wonderful, Return Fail]
|
|
553
529
|
|
|
554
530
|
```json
|
|
555
531
|
{
|
|
556
|
-
"operation_type": "
|
|
532
|
+
"operation_type": "guard",
|
|
557
533
|
"data": {
|
|
558
|
-
"object":
|
|
559
|
-
|
|
560
|
-
"
|
|
561
|
-
"index": 1017,
|
|
562
|
-
"remark": "Return Complete - Merchant confirms return received"
|
|
534
|
+
"object": {
|
|
535
|
+
"name": "service_merchant_win_v2",
|
|
536
|
+
"replaceExistName": true
|
|
563
537
|
},
|
|
564
|
-
"
|
|
565
|
-
|
|
566
|
-
"
|
|
567
|
-
"
|
|
568
|
-
|
|
569
|
-
|
|
538
|
+
"description": "Verify order at merchant win nodes: Order Complete, Wonderful, Return Fail",
|
|
539
|
+
"root": {
|
|
540
|
+
"type": "logic_or",
|
|
541
|
+
"nodes": [
|
|
542
|
+
{
|
|
543
|
+
"type": "logic_as_string_equal",
|
|
544
|
+
"nodes": [
|
|
545
|
+
{
|
|
546
|
+
"type": "progress_current_node"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"type": "constant",
|
|
550
|
+
"value": "Order Complete",
|
|
551
|
+
"value_type": "String"
|
|
552
|
+
}
|
|
553
|
+
]
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
"type": "logic_as_string_equal",
|
|
557
|
+
"nodes": [
|
|
558
|
+
{
|
|
559
|
+
"type": "progress_current_node"
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
"type": "constant",
|
|
563
|
+
"value": "Wonderful",
|
|
564
|
+
"value_type": "String"
|
|
565
|
+
}
|
|
566
|
+
]
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
"type": "logic_as_string_equal",
|
|
570
|
+
"nodes": [
|
|
571
|
+
{
|
|
572
|
+
"type": "progress_current_node"
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
"type": "constant",
|
|
576
|
+
"value": "Return Fail",
|
|
577
|
+
"value_type": "String"
|
|
578
|
+
}
|
|
579
|
+
]
|
|
580
|
+
}
|
|
581
|
+
]
|
|
570
582
|
}
|
|
571
583
|
},
|
|
572
584
|
"env": {
|
|
@@ -576,24 +588,48 @@ Add custom permission indexes for advanced operations.
|
|
|
576
588
|
}
|
|
577
589
|
```
|
|
578
590
|
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
### Step 3: Create Service (Unpublished)
|
|
582
|
-
|
|
583
|
-
Create the Service without publishing to obtain its address for Guard creation.
|
|
584
|
-
|
|
585
|
-
**Prompt**: Create Service "three\_body\_signature\_service\_v2" with permission "myshop\_permission\_v2", do not publish.
|
|
591
|
+
**Guard 4: service_customer_win_v2** - Verify node in [Lost, Return Complete]
|
|
586
592
|
|
|
587
593
|
```json
|
|
588
594
|
{
|
|
589
|
-
"operation_type": "
|
|
595
|
+
"operation_type": "guard",
|
|
590
596
|
"data": {
|
|
591
597
|
"object": {
|
|
592
|
-
"name": "
|
|
593
|
-
"
|
|
598
|
+
"name": "service_customer_win_v2",
|
|
599
|
+
"replaceExistName": true
|
|
594
600
|
},
|
|
595
|
-
"description": "
|
|
596
|
-
"
|
|
601
|
+
"description": "Verify order at customer win nodes: Lost, Return Complete",
|
|
602
|
+
"root": {
|
|
603
|
+
"type": "logic_or",
|
|
604
|
+
"nodes": [
|
|
605
|
+
{
|
|
606
|
+
"type": "logic_as_string_equal",
|
|
607
|
+
"nodes": [
|
|
608
|
+
{
|
|
609
|
+
"type": "progress_current_node"
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
"type": "constant",
|
|
613
|
+
"value": "Lost",
|
|
614
|
+
"value_type": "String"
|
|
615
|
+
}
|
|
616
|
+
]
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
"type": "logic_as_string_equal",
|
|
620
|
+
"nodes": [
|
|
621
|
+
{
|
|
622
|
+
"type": "progress_current_node"
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
"type": "constant",
|
|
626
|
+
"value": "Return Complete",
|
|
627
|
+
"value_type": "String"
|
|
628
|
+
}
|
|
629
|
+
]
|
|
630
|
+
}
|
|
631
|
+
]
|
|
632
|
+
}
|
|
597
633
|
},
|
|
598
634
|
"env": {
|
|
599
635
|
"account": "myshop_merchant",
|
|
@@ -602,26 +638,6 @@ Create the Service without publishing to obtain its address for Guard creation.
|
|
|
602
638
|
}
|
|
603
639
|
```
|
|
604
640
|
|
|
605
|
-
**Record the Service address** - it will be needed for Guard creation.
|
|
606
|
-
|
|
607
|
-
***
|
|
608
|
-
|
|
609
|
-
### Step 4: Create Guards (4 Guards for Machine)
|
|
610
|
-
|
|
611
|
-
Create 4 Guards using the Service address. Guards verify order state and service ownership.
|
|
612
|
-
|
|
613
|
-
**Guard List:**
|
|
614
|
-
|
|
615
|
-
| # | Guard Name | Purpose |
|
|
616
|
-
|---|------------|---------|
|
|
617
|
-
| 1 | `machine_merkle_root_v2` | Verify Merkle Root string length = 64 |
|
|
618
|
-
| 2 | `machine_service_order_v2` | Verify order belongs to Service and current node is valid |
|
|
619
|
-
| 3 | `machine_time_10d_v2` | Verify 10-day timeout (864000000 ms) for auto-completion |
|
|
620
|
-
| 4 | `machine_time_2d_v2` | Verify 2-day timeout (172800000 ms) for auto-completion |
|
|
621
|
-
|
|
622
|
-
> **Note**: See [MyShop_Advanced_MerchantSystem_TestResults.md](MyShop_Advanced_MerchantSystem_TestResults.md) for detailed guard creation examples.
|
|
623
|
-
```
|
|
624
|
-
|
|
625
641
|
***
|
|
626
642
|
|
|
627
643
|
### Step 5: Create Machine (Multi-Path Workflow)
|
|
@@ -651,10 +667,9 @@ Create Machine with all nodes and guards in a single operation.
|
|
|
651
667
|
"threshold": 1,
|
|
652
668
|
"forwards": [
|
|
653
669
|
{
|
|
654
|
-
"name": "
|
|
670
|
+
"name": "Confirm Order",
|
|
655
671
|
"permissionIndex": 1000,
|
|
656
|
-
"weight": 1
|
|
657
|
-
"guard": { "guard": "machine_merkle_root_v2" }
|
|
672
|
+
"weight": 1
|
|
658
673
|
}
|
|
659
674
|
]
|
|
660
675
|
}
|
|
@@ -664,14 +679,13 @@ Create Machine with all nodes and guards in a single operation.
|
|
|
664
679
|
"name": "Order Cancel",
|
|
665
680
|
"pairs": [
|
|
666
681
|
{
|
|
667
|
-
"prev_node": "",
|
|
682
|
+
"prev_node": "Order Confirmed",
|
|
668
683
|
"threshold": 1,
|
|
669
684
|
"forwards": [
|
|
670
685
|
{
|
|
671
|
-
"name": "
|
|
686
|
+
"name": "Cancel Order",
|
|
672
687
|
"permissionIndex": 1000,
|
|
673
|
-
"weight": 1
|
|
674
|
-
"guard": { "guard": "machine_merkle_root_v2" }
|
|
688
|
+
"weight": 1
|
|
675
689
|
}
|
|
676
690
|
]
|
|
677
691
|
}
|
|
@@ -688,7 +702,7 @@ Create Machine with all nodes and guards in a single operation.
|
|
|
688
702
|
"name": "Confirm Signature and Submit Merkle Root",
|
|
689
703
|
"permissionIndex": 1001,
|
|
690
704
|
"weight": 1,
|
|
691
|
-
"guard": { "guard": "
|
|
705
|
+
"guard": { "guard": "machine_merkle_root_v2" }
|
|
692
706
|
}
|
|
693
707
|
]
|
|
694
708
|
}
|
|
@@ -714,11 +728,11 @@ Create Machine with all nodes and guards in a single operation.
|
|
|
714
728
|
"name": "Wonderful",
|
|
715
729
|
"pairs": [
|
|
716
730
|
{
|
|
717
|
-
"prev_node": "
|
|
731
|
+
"prev_node": "Delivery Complete",
|
|
718
732
|
"threshold": 1,
|
|
719
733
|
"forwards": [
|
|
720
734
|
{
|
|
721
|
-
"name": "Rate Wonderful",
|
|
735
|
+
"name": "Rate as Wonderful",
|
|
722
736
|
"permissionIndex": 1001,
|
|
723
737
|
"weight": 1
|
|
724
738
|
}
|
|
@@ -730,26 +744,25 @@ Create Machine with all nodes and guards in a single operation.
|
|
|
730
744
|
"name": "Order Complete",
|
|
731
745
|
"pairs": [
|
|
732
746
|
{
|
|
733
|
-
"prev_node": "
|
|
747
|
+
"prev_node": "Delivery Complete",
|
|
734
748
|
"threshold": 1,
|
|
735
749
|
"forwards": [
|
|
736
750
|
{
|
|
737
|
-
"name": "
|
|
751
|
+
"name": "Complete Order",
|
|
738
752
|
"permissionIndex": 1001,
|
|
739
|
-
"weight": 1
|
|
740
|
-
"guard": { "guard": "machine_time_10d_v2" }
|
|
753
|
+
"weight": 1
|
|
741
754
|
}
|
|
742
755
|
]
|
|
743
756
|
},
|
|
744
757
|
{
|
|
745
|
-
"prev_node": "
|
|
758
|
+
"prev_node": "Shipping",
|
|
746
759
|
"threshold": 1,
|
|
747
760
|
"forwards": [
|
|
748
761
|
{
|
|
749
|
-
"name": "Auto Complete from
|
|
762
|
+
"name": "Auto Complete from Shipping",
|
|
750
763
|
"permissionIndex": 1001,
|
|
751
764
|
"weight": 1,
|
|
752
|
-
"guard": { "guard": "
|
|
765
|
+
"guard": { "guard": "machine_time_10d_v2" }
|
|
753
766
|
}
|
|
754
767
|
]
|
|
755
768
|
}
|
|
@@ -889,7 +902,27 @@ Create Machine with all nodes and guards in a single operation.
|
|
|
889
902
|
|
|
890
903
|
***
|
|
891
904
|
|
|
892
|
-
### Step 6:
|
|
905
|
+
### Step 6: Publish Machine
|
|
906
|
+
|
|
907
|
+
Machine must be published before binding to Service.
|
|
908
|
+
|
|
909
|
+
```json
|
|
910
|
+
{
|
|
911
|
+
"operation_type": "machine",
|
|
912
|
+
"data": {
|
|
913
|
+
"object": "myshop_advanced_machine_v2",
|
|
914
|
+
"publish": true
|
|
915
|
+
},
|
|
916
|
+
"env": {
|
|
917
|
+
"account": "myshop_merchant",
|
|
918
|
+
"network": "testnet"
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
```
|
|
922
|
+
|
|
923
|
+
***
|
|
924
|
+
|
|
925
|
+
### Step 7: Bind Machine to Service
|
|
893
926
|
|
|
894
927
|
Bind the Machine to the Service. **Important**: The Service must be unpublished when binding the Machine.
|
|
895
928
|
|
|
@@ -913,9 +946,9 @@ Bind the Machine to the Service. **Important**: The Service must be unpublished
|
|
|
913
946
|
|
|
914
947
|
***
|
|
915
948
|
|
|
916
|
-
### Step
|
|
949
|
+
### Step 8: Create Service Guards (Optional)
|
|
917
950
|
|
|
918
|
-
Create
|
|
951
|
+
Create guards for Service order_allocators (if needed).
|
|
919
952
|
|
|
920
953
|
**Guard List:**
|
|
921
954
|
|
|
@@ -924,14 +957,16 @@ Create 2 guards for Service order_allocators.
|
|
|
924
957
|
| 5 | `service_merchant_win_v2` | Verify node in [Order Complete, Wonderful, Return Fail] |
|
|
925
958
|
| 6 | `service_customer_win_v2` | Verify node in [Lost, Return Complete] |
|
|
926
959
|
|
|
927
|
-
|
|
960
|
+
|
|
928
961
|
|
|
929
962
|
***
|
|
930
963
|
|
|
931
|
-
### Step
|
|
964
|
+
### Step 9: Create Arbitration Object
|
|
932
965
|
|
|
933
966
|
Create an Arbitration object as the final on-chain mechanism for protecting user rights.
|
|
934
967
|
|
|
968
|
+
**IMPORTANT**: Arbitration `voting_guard` must use object format with `op` and `guards` array.
|
|
969
|
+
|
|
935
970
|
**Prompt**: Create arbitration object "myshop\_arbitration\_v2".
|
|
936
971
|
|
|
937
972
|
```json
|
|
@@ -943,7 +978,17 @@ Create an Arbitration object as the final on-chain mechanism for protecting user
|
|
|
943
978
|
"replaceExistName": true
|
|
944
979
|
},
|
|
945
980
|
"description": "Arbitration for MyShop Advanced - Final dispute resolution mechanism",
|
|
946
|
-
"
|
|
981
|
+
"voting_guard": {
|
|
982
|
+
"op": "add",
|
|
983
|
+
"guards": [
|
|
984
|
+
{
|
|
985
|
+
"guard": "machine_merkle_root_v2",
|
|
986
|
+
"vote_weight": {
|
|
987
|
+
"FixedValue": 1
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
]
|
|
991
|
+
}
|
|
947
992
|
},
|
|
948
993
|
"env": {
|
|
949
994
|
"account": "myshop_merchant",
|
|
@@ -954,61 +999,21 @@ Create an Arbitration object as the final on-chain mechanism for protecting user
|
|
|
954
999
|
|
|
955
1000
|
***
|
|
956
1001
|
|
|
957
|
-
### Step
|
|
1002
|
+
### Step 10: Update Service with Arbitration and Publish
|
|
958
1003
|
|
|
959
|
-
Update Service with
|
|
1004
|
+
Update Service with arbitration binding, and publish.
|
|
960
1005
|
|
|
961
|
-
**Prompt**: Update service "three\_body\_signature\_service\_v2" with
|
|
1006
|
+
**Prompt**: Update service "three\_body\_signature\_service\_v2" with arbitration and publish.
|
|
962
1007
|
|
|
963
1008
|
```json
|
|
964
1009
|
{
|
|
965
1010
|
"operation_type": "service",
|
|
966
1011
|
"data": {
|
|
967
1012
|
"object": "three_body_signature_service_v2",
|
|
968
|
-
"order_allocators": {
|
|
969
|
-
"description": "Order fund allocators for MyShop Advanced",
|
|
970
|
-
"threshold": 0,
|
|
971
|
-
"allocators": [
|
|
972
|
-
{
|
|
973
|
-
"guard": "service_merchant_win_v2",
|
|
974
|
-
"sharing": [
|
|
975
|
-
{
|
|
976
|
-
"who": {"Signer": "signer"},
|
|
977
|
-
"sharing": 10000,
|
|
978
|
-
"mode": "Rate"
|
|
979
|
-
}
|
|
980
|
-
]
|
|
981
|
-
},
|
|
982
|
-
{
|
|
983
|
-
"guard": "service_customer_win_v2",
|
|
984
|
-
"sharing": [
|
|
985
|
-
{
|
|
986
|
-
"who": {"GuardIdentifier": 0},
|
|
987
|
-
"sharing": 10000,
|
|
988
|
-
"mode": "Rate"
|
|
989
|
-
}
|
|
990
|
-
]
|
|
991
|
-
}
|
|
992
|
-
]
|
|
993
|
-
},
|
|
994
|
-
"sales": {
|
|
995
|
-
"op": "add",
|
|
996
|
-
"sales": [
|
|
997
|
-
{
|
|
998
|
-
"name": "The Three-Body Problem + Author Signature",
|
|
999
|
-
"price": 5000000000,
|
|
1000
|
-
"stock": 100,
|
|
1001
|
-
"suspension": false,
|
|
1002
|
-
"wip": "https://wowok.net/test/three_body.wip",
|
|
1003
|
-
"wip_hash": "sha256:1db6dc86d8be68bafb33418628a30e7bfcbce48de9c099d3d9cb21def3af8b43"
|
|
1004
|
-
}
|
|
1005
|
-
]
|
|
1006
|
-
},
|
|
1007
1013
|
"arbitrations": {
|
|
1008
1014
|
"op": "add",
|
|
1009
1015
|
"objects": ["myshop_arbitration_v2"]
|
|
1010
1016
|
},
|
|
1011
|
-
"customer_required": ["phone", "email", "shipping_address"],
|
|
1012
1017
|
"publish": true
|
|
1013
1018
|
},
|
|
1014
1019
|
"env": {
|
|
@@ -1020,7 +1025,7 @@ Update Service with order\_allocators, sales, arbitration binding, and publish.
|
|
|
1020
1025
|
|
|
1021
1026
|
***
|
|
1022
1027
|
|
|
1023
|
-
### Step
|
|
1028
|
+
### Step 11: Create Reward Pool (Optional)
|
|
1024
1029
|
|
|
1025
1030
|
Create reward pool with initial balance for rewards and compensation.
|
|
1026
1031
|
|
|
@@ -1049,9 +1054,9 @@ Create reward pool with initial balance for rewards and compensation.
|
|
|
1049
1054
|
|
|
1050
1055
|
***
|
|
1051
1056
|
|
|
1052
|
-
### Step
|
|
1057
|
+
### Step 12: Create Reward Guards (Optional)
|
|
1053
1058
|
|
|
1054
|
-
Create
|
|
1059
|
+
Create guards for reward verification:
|
|
1055
1060
|
|
|
1056
1061
|
| # | Guard Name | Purpose | Reward Amount |
|
|
1057
1062
|
|---|------------|---------|---------------|
|
|
@@ -1059,11 +1064,9 @@ Create 3 guards for reward verification:
|
|
|
1059
1064
|
| 8 | `reward_lost_v2` | Verify order at Lost node | 20000 |
|
|
1060
1065
|
| 9 | `reward_shipping_timeout_v2` | Verify order at Shipping node > 2 days | 30000 |
|
|
1061
1066
|
|
|
1062
|
-
> **Note**: See [MyShop_Advanced_MerchantSystem_TestResults.md](MyShop_Advanced_MerchantSystem_TestResults.md) for detailed guard creation examples.
|
|
1063
|
-
|
|
1064
1067
|
***
|
|
1065
1068
|
|
|
1066
|
-
### Step
|
|
1069
|
+
### Step 13: Add Reward Guards (Optional)
|
|
1067
1070
|
|
|
1068
1071
|
Add reward guards for Wonderful (10000), Lost (20000), and Shipping timeout (30000) compensation.
|
|
1069
1072
|
|
|
@@ -1097,11 +1100,6 @@ Add reward guards for Wonderful (10000), Lost (20000), and Shipping timeout (300
|
|
|
1097
1100
|
"network": "testnet"
|
|
1098
1101
|
}
|
|
1099
1102
|
}
|
|
1100
|
-
```
|
|
1101
|
-
|
|
1102
|
-
> **Note**: See [MyShop_Advanced_MerchantSystem_TestResults.md](MyShop_Advanced_MerchantSystem_TestResults.md) for Guard 4-5 detailed creation examples.
|
|
1103
|
-
|
|
1104
|
-
> **Note**: See [MyShop_Advanced_MerchantSystem_TestResults.md](MyShop_Advanced_MerchantSystem_TestResults.md) for Guard 6-10 detailed creation examples.
|
|
1105
1103
|
|
|
1106
1104
|
***
|
|
1107
1105
|
|
|
@@ -1890,9 +1888,3 @@ This advanced e-commerce example demonstrates:
|
|
|
1890
1888
|
8. **Flexible Fund Allocation**: Clear rules for merchant win (Order Complete, Wonderful, Return Fail) vs customer win (Lost, Return Complete)
|
|
1891
1889
|
|
|
1892
1890
|
The system ensures accountability through the "Who Completes the Key Action, Who Submits the Proof" principle, creating a clear audit trail for all critical actions.
|
|
1893
|
-
|
|
1894
|
-
***
|
|
1895
|
-
|
|
1896
|
-
> **View Actual Execution Results**:
|
|
1897
|
-
> - **Merchant System Setup**: See [MyShop\_Advanced\_MerchantSystem\_TestResults.md](MyShop_Advanced_MerchantSystem_TestResults.md) for service construction test results
|
|
1898
|
-
> - **Customer Order Flow**: See [MyShop\_Advanced\_OrderFlow\_TestResults.md](MyShop_Advanced_OrderFlow_TestResults.md) for order testing results
|