@wowok/agent-mcp 2.2.11 → 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/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 +12 -0
- package/dist/index.js +146 -39
- 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,1297 @@
|
|
|
1
|
+
# MyShop Advanced Merchant System Test Results
|
|
2
|
+
|
|
3
|
+
## Test execution started: 2026-04-26
|
|
4
|
+
|
|
5
|
+
## Summary
|
|
6
|
+
|
|
7
|
+
This document contains test results for **Part 2: Merchant System Setup** with proper machine binding before service publishing. All tests have been executed successfully.
|
|
8
|
+
|
|
9
|
+
### Completed Test Items
|
|
10
|
+
|
|
11
|
+
| Step | Description | Status |
|
|
12
|
+
|------|-------------|--------|
|
|
13
|
+
| 1 | Create Permission Object | Success |
|
|
14
|
+
| 1b | Add Permission Indexes (1000, 1001) | Success |
|
|
15
|
+
| 2 | Create Empty Service Object | Success |
|
|
16
|
+
| 3 | Create Machine Guards (4 guards) | Success |
|
|
17
|
+
| 4 | Create Service Guards (2 guards) | Success |
|
|
18
|
+
| 5 | Create Machine with Guards | Success |
|
|
19
|
+
| 6 | Publish Machine | Success |
|
|
20
|
+
| 7 | Bind Machine to Service | Success |
|
|
21
|
+
| 8 | Create Arbitration Object | Success |
|
|
22
|
+
| 9 | Update Service and Publish | Success |
|
|
23
|
+
| 10 | Create Reward Object | Success |
|
|
24
|
+
| 11 | Create Reward Guards (3 guards) | Success |
|
|
25
|
+
| 12 | Add Reward Guards to Reward | Success |
|
|
26
|
+
|
|
27
|
+
### Machine Guards (4 total)
|
|
28
|
+
|
|
29
|
+
| # | Guard Name | Purpose |
|
|
30
|
+
|---|------------|---------|
|
|
31
|
+
| 1 | `machine_merkle_root_v2` | Verify Merkle Root string length = 64 |
|
|
32
|
+
| 2 | `machine_service_order_v2` | Verify order belongs to Service and node is valid |
|
|
33
|
+
| 3 | `machine_time_10d_v2` | Verify 10-day timeout (864000000 ms) |
|
|
34
|
+
| 4 | `machine_time_2d_v2` | Verify 2-day timeout (172800000 ms) |
|
|
35
|
+
|
|
36
|
+
### Service Guards (2 total)
|
|
37
|
+
|
|
38
|
+
| # | Guard Name | Purpose |
|
|
39
|
+
|---|------------|---------|
|
|
40
|
+
| 5 | `service_merchant_win_v2` | Verify merchant winning nodes (Order Complete, Wonderful, Return Fail) |
|
|
41
|
+
| 6 | `service_customer_win_v2` | Verify customer winning nodes (Lost, Return Complete) |
|
|
42
|
+
|
|
43
|
+
### Reward Guards (3 total)
|
|
44
|
+
|
|
45
|
+
| # | Guard Name | Purpose | Reward Amount |
|
|
46
|
+
|---|------------|---------|---------------|
|
|
47
|
+
| 7 | `reward_wonderful_v2` | Verify order at Wonderful node | 10000 |
|
|
48
|
+
| 8 | `reward_lost_v2` | Verify order at Lost node | 20000 |
|
|
49
|
+
| 9 | `reward_shipping_timeout_v2` | Verify order at Shipping node > 2 days | 30000 |
|
|
50
|
+
|
|
51
|
+
### Key Objects
|
|
52
|
+
|
|
53
|
+
| Object Type | Object Name |
|
|
54
|
+
|-------------|-------------|
|
|
55
|
+
| Permission | `myshop_permission_v2` |
|
|
56
|
+
| Service | `three_body_signature_service_v2` |
|
|
57
|
+
| Machine | `myshop_advanced_machine_v2` |
|
|
58
|
+
| Arbitration | `myshop_arbitration_v2` |
|
|
59
|
+
| Reward | `myshop_reward_v2` |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Part 2: Merchant System Setup
|
|
64
|
+
|
|
65
|
+
### Prerequisites
|
|
66
|
+
- Account: `myshop_merchant` (store owner)
|
|
67
|
+
- Account: `myshop_customer` (customer)
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### Step 1: Create Permission Object
|
|
72
|
+
|
|
73
|
+
**Request:**
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"operation_type": "permission",
|
|
77
|
+
"data": {
|
|
78
|
+
"object": {
|
|
79
|
+
"name": "myshop_permission_v2",
|
|
80
|
+
"replaceExistName": true
|
|
81
|
+
},
|
|
82
|
+
"description": "Permission for MyShop Advanced v2 - Multi-path order processing with delivery confirmation and return handling"
|
|
83
|
+
},
|
|
84
|
+
"env": {
|
|
85
|
+
"account": "myshop_merchant",
|
|
86
|
+
"network": "testnet",
|
|
87
|
+
"no_cache": true
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Response:**
|
|
93
|
+
- Permission object created: `myshop_permission_v2`
|
|
94
|
+
- Name: `myshop_permission_v2` (with replaceExistName=true)
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### Step 1b: Add Permission Indexes to Permission Object
|
|
99
|
+
|
|
100
|
+
Grant permission indexes 1000 and 1001 to `myshop_merchant`:
|
|
101
|
+
|
|
102
|
+
**Request:**
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"operation_type": "permission",
|
|
106
|
+
"data": {
|
|
107
|
+
"object": "myshop_permission_v2",
|
|
108
|
+
"table": {
|
|
109
|
+
"op": "add perm by entity",
|
|
110
|
+
"entity": {
|
|
111
|
+
"name_or_address": "myshop_merchant"
|
|
112
|
+
},
|
|
113
|
+
"index": [1000, 1001]
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"env": {
|
|
117
|
+
"account": "myshop_merchant",
|
|
118
|
+
"network": "testnet",
|
|
119
|
+
"no_cache": true
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Response:**
|
|
125
|
+
- Permission indexes 1000 and 1001 granted to `myshop_merchant`
|
|
126
|
+
- **Note**: These permission indexes are used in Machine node forwards:
|
|
127
|
+
- `permissionIndex: 1000` - Used for Order Confirmed and Order Cancel nodes
|
|
128
|
+
- `permissionIndex: 1001` - Used for all other merchant operations (Shipping, Delivery Complete, etc.)
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
### Step 2: Create Empty Service Object (Get Address First)
|
|
133
|
+
|
|
134
|
+
**Request:**
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"operation_type": "service",
|
|
138
|
+
"data": {
|
|
139
|
+
"object": {
|
|
140
|
+
"name": "three_body_signature_service_v2",
|
|
141
|
+
"replaceExistName": true,
|
|
142
|
+
"permission": "myshop_permission_v2"
|
|
143
|
+
},
|
|
144
|
+
"description": "Three-Body Problem Signature Edition - Limited collector's item with WIP verification",
|
|
145
|
+
"publish": false
|
|
146
|
+
},
|
|
147
|
+
"env": {
|
|
148
|
+
"account": "myshop_merchant",
|
|
149
|
+
"network": "testnet",
|
|
150
|
+
"no_cache": true
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Response:**
|
|
156
|
+
- Service object created: `three_body_signature_service_v2`
|
|
157
|
+
- Name: `three_body_signature_service_v2` (with replaceExistName=true)
|
|
158
|
+
- Permission: `myshop_permission_v2`
|
|
159
|
+
- Published: false (intentionally left unpublished for guard creation)
|
|
160
|
+
|
|
161
|
+
**Note**: Service name can be used for Guard creation.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
### Step 3: Create Guards
|
|
166
|
+
|
|
167
|
+
Create 9 guards total: 4 Machine guards, 2 Service guards, 3 Reward guards.
|
|
168
|
+
|
|
169
|
+
#### Guard 1: machine_merkle_root_v2
|
|
170
|
+
|
|
171
|
+
**Request:**
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"operation_type": "guard",
|
|
175
|
+
"data": {
|
|
176
|
+
"namedNew": {
|
|
177
|
+
"name": "machine_merkle_root_v2",
|
|
178
|
+
"replaceExistName": true
|
|
179
|
+
},
|
|
180
|
+
"description": "Verify Merkle Root string length equals 64 characters",
|
|
181
|
+
"table": [
|
|
182
|
+
{
|
|
183
|
+
"identifier": 0,
|
|
184
|
+
"b_submission": true,
|
|
185
|
+
"value_type": "String",
|
|
186
|
+
"name": "merkle_root"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"identifier": 1,
|
|
190
|
+
"b_submission": false,
|
|
191
|
+
"value_type": "U64",
|
|
192
|
+
"value": 64,
|
|
193
|
+
"name": "length_64"
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
"root": {
|
|
197
|
+
"type": "node",
|
|
198
|
+
"node": {
|
|
199
|
+
"type": "logic_equal",
|
|
200
|
+
"nodes": [
|
|
201
|
+
{
|
|
202
|
+
"type": "calc_string_length",
|
|
203
|
+
"node": {
|
|
204
|
+
"type": "identifier",
|
|
205
|
+
"identifier": 0
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"type": "identifier",
|
|
210
|
+
"identifier": 1
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
"env": {
|
|
217
|
+
"account": "myshop_merchant",
|
|
218
|
+
"network": "testnet",
|
|
219
|
+
"no_cache": true
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Response:**
|
|
225
|
+
- Guard created: `0x647c43c3b731dc3481ed9dba43b9a401102465685cc8172c44ef824b539b40b9`
|
|
226
|
+
|
|
227
|
+
#### Guard 2: machine_service_order_v2
|
|
228
|
+
|
|
229
|
+
**Request:**
|
|
230
|
+
```json
|
|
231
|
+
{
|
|
232
|
+
"operation_type": "guard",
|
|
233
|
+
"data": {
|
|
234
|
+
"namedNew": {
|
|
235
|
+
"name": "machine_service_order_v2",
|
|
236
|
+
"replaceExistName": true
|
|
237
|
+
},
|
|
238
|
+
"description": "Verify order belongs to Service and current node is valid",
|
|
239
|
+
"table": [
|
|
240
|
+
{
|
|
241
|
+
"identifier": 0,
|
|
242
|
+
"b_submission": true,
|
|
243
|
+
"value_type": "Address",
|
|
244
|
+
"name": "progress_address"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"identifier": 1,
|
|
248
|
+
"b_submission": false,
|
|
249
|
+
"value_type": "Address",
|
|
250
|
+
"value": "0xaa141f310000095b1bd1fd86586d15af866048fcbb68fbb321e1aec6ab56493d",
|
|
251
|
+
"name": "service_address"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"identifier": 2,
|
|
255
|
+
"b_submission": false,
|
|
256
|
+
"value_type": "String",
|
|
257
|
+
"value": "Shipping",
|
|
258
|
+
"name": "node_name"
|
|
259
|
+
}
|
|
260
|
+
],
|
|
261
|
+
"root": {
|
|
262
|
+
"type": "node",
|
|
263
|
+
"node": {
|
|
264
|
+
"type": "logic_and",
|
|
265
|
+
"nodes": [
|
|
266
|
+
{
|
|
267
|
+
"type": "node",
|
|
268
|
+
"node": {
|
|
269
|
+
"type": "logic_equal",
|
|
270
|
+
"nodes": [
|
|
271
|
+
{
|
|
272
|
+
"type": "query",
|
|
273
|
+
"query": "order.service",
|
|
274
|
+
"object": {
|
|
275
|
+
"identifier": 0,
|
|
276
|
+
"convert_witness": 100
|
|
277
|
+
},
|
|
278
|
+
"parameters": []
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"type": "identifier",
|
|
282
|
+
"identifier": 1
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"type": "node",
|
|
289
|
+
"node": {
|
|
290
|
+
"type": "logic_equal",
|
|
291
|
+
"nodes": [
|
|
292
|
+
{
|
|
293
|
+
"type": "query",
|
|
294
|
+
"query": "progress.current",
|
|
295
|
+
"object": {
|
|
296
|
+
"identifier": 0,
|
|
297
|
+
"convert_witness": 100
|
|
298
|
+
},
|
|
299
|
+
"parameters": []
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"type": "identifier",
|
|
303
|
+
"identifier": 2
|
|
304
|
+
}
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
]
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
"env": {
|
|
313
|
+
"account": "myshop_merchant",
|
|
314
|
+
"network": "testnet",
|
|
315
|
+
"no_cache": true
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**Response:**
|
|
321
|
+
- Guard created: `0xba43345b0af09e61758729850cfe1dc32ceed7899e7cb41c6b15b96c35f5dcc8`
|
|
322
|
+
|
|
323
|
+
#### Guard 3: machine_time_10d_v2
|
|
324
|
+
|
|
325
|
+
**Request:**
|
|
326
|
+
```json
|
|
327
|
+
{
|
|
328
|
+
"operation_type": "guard",
|
|
329
|
+
"data": {
|
|
330
|
+
"namedNew": {
|
|
331
|
+
"name": "machine_time_10d_v2",
|
|
332
|
+
"replaceExistName": true
|
|
333
|
+
},
|
|
334
|
+
"description": "Verify order has been in current node for at least 10 days (864000000 ms)",
|
|
335
|
+
"table": [
|
|
336
|
+
{
|
|
337
|
+
"identifier": 0,
|
|
338
|
+
"b_submission": true,
|
|
339
|
+
"value_type": "Address",
|
|
340
|
+
"name": "progress_address"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"identifier": 1,
|
|
344
|
+
"b_submission": false,
|
|
345
|
+
"value_type": "U64",
|
|
346
|
+
"value": 864000000,
|
|
347
|
+
"name": "ten_days_ms"
|
|
348
|
+
}
|
|
349
|
+
],
|
|
350
|
+
"root": {
|
|
351
|
+
"type": "node",
|
|
352
|
+
"node": {
|
|
353
|
+
"type": "logic_as_u256_greater_or_equal",
|
|
354
|
+
"nodes": [
|
|
355
|
+
{
|
|
356
|
+
"type": "calc_number_subtract",
|
|
357
|
+
"nodes": [
|
|
358
|
+
{
|
|
359
|
+
"type": "context",
|
|
360
|
+
"context": "Clock"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"type": "query",
|
|
364
|
+
"query": 1315,
|
|
365
|
+
"object": {
|
|
366
|
+
"identifier": 0,
|
|
367
|
+
"convert_witness": 100
|
|
368
|
+
},
|
|
369
|
+
"parameters": []
|
|
370
|
+
}
|
|
371
|
+
]
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"type": "identifier",
|
|
375
|
+
"identifier": 1
|
|
376
|
+
}
|
|
377
|
+
]
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
"env": {
|
|
382
|
+
"account": "myshop_merchant",
|
|
383
|
+
"network": "testnet",
|
|
384
|
+
"no_cache": true
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
**Response:**
|
|
390
|
+
- Guard created: `0x24d263baf75888c6de698c6f8e7b024184876db9484e4a25915b868605973535`
|
|
391
|
+
|
|
392
|
+
#### Guard 4: machine_time_2d_v2
|
|
393
|
+
|
|
394
|
+
**Request:**
|
|
395
|
+
```json
|
|
396
|
+
{
|
|
397
|
+
"operation_type": "guard",
|
|
398
|
+
"data": {
|
|
399
|
+
"namedNew": {
|
|
400
|
+
"name": "machine_time_2d_v2",
|
|
401
|
+
"replaceExistName": true
|
|
402
|
+
},
|
|
403
|
+
"description": "Verify order has been in current node for at least 2 days (172800000 ms)",
|
|
404
|
+
"table": [
|
|
405
|
+
{
|
|
406
|
+
"identifier": 0,
|
|
407
|
+
"b_submission": true,
|
|
408
|
+
"value_type": "Address",
|
|
409
|
+
"name": "progress_address"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"identifier": 1,
|
|
413
|
+
"b_submission": false,
|
|
414
|
+
"value_type": "U64",
|
|
415
|
+
"value": 172800000,
|
|
416
|
+
"name": "two_days_ms"
|
|
417
|
+
}
|
|
418
|
+
],
|
|
419
|
+
"root": {
|
|
420
|
+
"type": "node",
|
|
421
|
+
"node": {
|
|
422
|
+
"type": "logic_as_u256_greater_or_equal",
|
|
423
|
+
"nodes": [
|
|
424
|
+
{
|
|
425
|
+
"type": "calc_number_subtract",
|
|
426
|
+
"nodes": [
|
|
427
|
+
{
|
|
428
|
+
"type": "context",
|
|
429
|
+
"context": "Clock"
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"type": "query",
|
|
433
|
+
"query": 1315,
|
|
434
|
+
"object": {
|
|
435
|
+
"identifier": 0,
|
|
436
|
+
"convert_witness": 100
|
|
437
|
+
},
|
|
438
|
+
"parameters": []
|
|
439
|
+
}
|
|
440
|
+
]
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"type": "identifier",
|
|
444
|
+
"identifier": 1
|
|
445
|
+
}
|
|
446
|
+
]
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
"env": {
|
|
451
|
+
"account": "myshop_merchant",
|
|
452
|
+
"network": "testnet",
|
|
453
|
+
"no_cache": true
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
**Response:**
|
|
459
|
+
- Guard created: `0x6465313f91b2a09a4da85e3e2db267f7789db3e2c050ced62b356142268d4abc`
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
### Step 4: Create Machine with Guards
|
|
464
|
+
|
|
465
|
+
**Request:**
|
|
466
|
+
```json
|
|
467
|
+
{
|
|
468
|
+
"operation_type": "machine",
|
|
469
|
+
"data": {
|
|
470
|
+
"object": {
|
|
471
|
+
"name": "myshop_advanced_machine_v2",
|
|
472
|
+
"replaceExistName": true,
|
|
473
|
+
"permission": "myshop_permission_v2"
|
|
474
|
+
},
|
|
475
|
+
"description": "Multi-path order processing with delivery confirmation, wonderful rating, lost handling and return processing - Complete workflow with guards",
|
|
476
|
+
"node": {
|
|
477
|
+
"op": "add",
|
|
478
|
+
"nodes": [
|
|
479
|
+
{
|
|
480
|
+
"name": "Order Confirmed",
|
|
481
|
+
"pairs": [
|
|
482
|
+
{
|
|
483
|
+
"prev_node": "",
|
|
484
|
+
"threshold": 1,
|
|
485
|
+
"forwards": [
|
|
486
|
+
{
|
|
487
|
+
"name": "Submit Messenger Merkle Root",
|
|
488
|
+
"permissionIndex": 1000,
|
|
489
|
+
"weight": 1,
|
|
490
|
+
"guard": { "guard": "machine_merkle_root_v2" }
|
|
491
|
+
}
|
|
492
|
+
]
|
|
493
|
+
}
|
|
494
|
+
]
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
"name": "Order Cancel",
|
|
498
|
+
"pairs": [
|
|
499
|
+
{
|
|
500
|
+
"prev_node": "",
|
|
501
|
+
"threshold": 1,
|
|
502
|
+
"forwards": [
|
|
503
|
+
{
|
|
504
|
+
"name": "Submit Cancellation Merkle Root",
|
|
505
|
+
"permissionIndex": 1000,
|
|
506
|
+
"weight": 1,
|
|
507
|
+
"guard": { "guard": "machine_merkle_root_v2" }
|
|
508
|
+
}
|
|
509
|
+
]
|
|
510
|
+
}
|
|
511
|
+
]
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
"name": "Shipping",
|
|
515
|
+
"pairs": [
|
|
516
|
+
{
|
|
517
|
+
"prev_node": "Order Confirmed",
|
|
518
|
+
"threshold": 1,
|
|
519
|
+
"forwards": [
|
|
520
|
+
{
|
|
521
|
+
"name": "Confirm Signature and Submit Merkle Root",
|
|
522
|
+
"permissionIndex": 1001,
|
|
523
|
+
"weight": 1,
|
|
524
|
+
"guard": { "guard": "machine_service_order_v2" }
|
|
525
|
+
}
|
|
526
|
+
]
|
|
527
|
+
}
|
|
528
|
+
]
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
"name": "Delivery Complete",
|
|
532
|
+
"pairs": [
|
|
533
|
+
{
|
|
534
|
+
"prev_node": "Shipping",
|
|
535
|
+
"threshold": 1,
|
|
536
|
+
"forwards": [
|
|
537
|
+
{
|
|
538
|
+
"name": "Confirm Receipt",
|
|
539
|
+
"permissionIndex": 1001,
|
|
540
|
+
"weight": 1
|
|
541
|
+
}
|
|
542
|
+
]
|
|
543
|
+
}
|
|
544
|
+
]
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
"name": "Wonderful",
|
|
548
|
+
"pairs": [
|
|
549
|
+
{
|
|
550
|
+
"prev_node": "Shipping",
|
|
551
|
+
"threshold": 1,
|
|
552
|
+
"forwards": [
|
|
553
|
+
{
|
|
554
|
+
"name": "Rate Wonderful",
|
|
555
|
+
"permissionIndex": 1001,
|
|
556
|
+
"weight": 1
|
|
557
|
+
}
|
|
558
|
+
]
|
|
559
|
+
}
|
|
560
|
+
]
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
"name": "Order Complete",
|
|
564
|
+
"pairs": [
|
|
565
|
+
{
|
|
566
|
+
"prev_node": "Shipping",
|
|
567
|
+
"threshold": 1,
|
|
568
|
+
"forwards": [
|
|
569
|
+
{
|
|
570
|
+
"name": "Auto Complete from Shipping",
|
|
571
|
+
"permissionIndex": 1001,
|
|
572
|
+
"weight": 1,
|
|
573
|
+
"guard": { "guard": "machine_time_10d_v2" }
|
|
574
|
+
}
|
|
575
|
+
]
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
"prev_node": "Delivery Complete",
|
|
579
|
+
"threshold": 1,
|
|
580
|
+
"forwards": [
|
|
581
|
+
{
|
|
582
|
+
"name": "Auto Complete from Delivery",
|
|
583
|
+
"permissionIndex": 1001,
|
|
584
|
+
"weight": 1,
|
|
585
|
+
"guard": { "guard": "machine_time_2d_v2" }
|
|
586
|
+
}
|
|
587
|
+
]
|
|
588
|
+
}
|
|
589
|
+
]
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
"name": "Lost",
|
|
593
|
+
"pairs": [
|
|
594
|
+
{
|
|
595
|
+
"prev_node": "Shipping",
|
|
596
|
+
"threshold": 2,
|
|
597
|
+
"forwards": [
|
|
598
|
+
{
|
|
599
|
+
"name": "Report Lost",
|
|
600
|
+
"permissionIndex": 1001,
|
|
601
|
+
"weight": 1
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
"name": "Confirm Lost with Merkle Root",
|
|
605
|
+
"permissionIndex": 1001,
|
|
606
|
+
"weight": 1,
|
|
607
|
+
"guard": { "guard": "machine_merkle_root_v2" }
|
|
608
|
+
}
|
|
609
|
+
]
|
|
610
|
+
}
|
|
611
|
+
]
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
"name": "Non-receipt Return",
|
|
615
|
+
"pairs": [
|
|
616
|
+
{
|
|
617
|
+
"prev_node": "Shipping",
|
|
618
|
+
"threshold": 2,
|
|
619
|
+
"forwards": [
|
|
620
|
+
{
|
|
621
|
+
"name": "Request Return",
|
|
622
|
+
"permissionIndex": 1001,
|
|
623
|
+
"weight": 1
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
"name": "Confirm Return with Merkle Root",
|
|
627
|
+
"permissionIndex": 1001,
|
|
628
|
+
"weight": 1,
|
|
629
|
+
"guard": { "guard": "machine_merkle_root_v2" }
|
|
630
|
+
}
|
|
631
|
+
]
|
|
632
|
+
}
|
|
633
|
+
]
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
"name": "Receipt Return",
|
|
637
|
+
"pairs": [
|
|
638
|
+
{
|
|
639
|
+
"prev_node": "Delivery Complete",
|
|
640
|
+
"threshold": 2,
|
|
641
|
+
"forwards": [
|
|
642
|
+
{
|
|
643
|
+
"name": "Request Return with Receipt",
|
|
644
|
+
"permissionIndex": 1001,
|
|
645
|
+
"weight": 1
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
"name": "Confirm Return Address with Merkle Root",
|
|
649
|
+
"permissionIndex": 1001,
|
|
650
|
+
"weight": 1,
|
|
651
|
+
"guard": { "guard": "machine_merkle_root_v2" }
|
|
652
|
+
}
|
|
653
|
+
]
|
|
654
|
+
}
|
|
655
|
+
]
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
"name": "Return Fail",
|
|
659
|
+
"pairs": [
|
|
660
|
+
{
|
|
661
|
+
"prev_node": "Receipt Return",
|
|
662
|
+
"threshold": 1,
|
|
663
|
+
"forwards": [
|
|
664
|
+
{
|
|
665
|
+
"name": "Timeout Return Not Received",
|
|
666
|
+
"permissionIndex": 1001,
|
|
667
|
+
"weight": 1,
|
|
668
|
+
"guard": { "guard": "machine_time_10d_v2" }
|
|
669
|
+
}
|
|
670
|
+
]
|
|
671
|
+
}
|
|
672
|
+
]
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
"name": "Return Complete",
|
|
676
|
+
"pairs": [
|
|
677
|
+
{
|
|
678
|
+
"prev_node": "Receipt Return",
|
|
679
|
+
"threshold": 2,
|
|
680
|
+
"forwards": [
|
|
681
|
+
{
|
|
682
|
+
"name": "Submit Return Merkle Root",
|
|
683
|
+
"permissionIndex": 1001,
|
|
684
|
+
"weight": 1,
|
|
685
|
+
"guard": { "guard": "machine_merkle_root_v2" }
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
"name": "Confirm Return Received",
|
|
689
|
+
"permissionIndex": 1001,
|
|
690
|
+
"weight": 1
|
|
691
|
+
}
|
|
692
|
+
]
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
"prev_node": "Non-receipt Return",
|
|
696
|
+
"threshold": 2,
|
|
697
|
+
"forwards": [
|
|
698
|
+
{
|
|
699
|
+
"name": "Submit Return Merkle Root",
|
|
700
|
+
"permissionIndex": 1001,
|
|
701
|
+
"weight": 1,
|
|
702
|
+
"guard": { "guard": "machine_merkle_root_v2" }
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
"name": "Confirm Return Received",
|
|
706
|
+
"permissionIndex": 1001,
|
|
707
|
+
"weight": 1
|
|
708
|
+
}
|
|
709
|
+
]
|
|
710
|
+
}
|
|
711
|
+
]
|
|
712
|
+
}
|
|
713
|
+
]
|
|
714
|
+
}
|
|
715
|
+
},
|
|
716
|
+
"env": {
|
|
717
|
+
"account": "myshop_merchant",
|
|
718
|
+
"network": "testnet",
|
|
719
|
+
"no_cache": true
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
**Response:**
|
|
725
|
+
- Machine object created: `myshop_advanced_machine_v2`
|
|
726
|
+
- Name: `myshop_advanced_machine_v2` (with replaceExistName=true)
|
|
727
|
+
- Permission: `myshop_permission_v2`
|
|
728
|
+
- Nodes added: 11 nodes with guards for multi-path workflow
|
|
729
|
+
- Published: true
|
|
730
|
+
|
|
731
|
+
---
|
|
732
|
+
|
|
733
|
+
### Step 5: Bind Machine to Service
|
|
734
|
+
|
|
735
|
+
**Request:**
|
|
736
|
+
```json
|
|
737
|
+
{
|
|
738
|
+
"operation_type": "service",
|
|
739
|
+
"data": {
|
|
740
|
+
"object": "three_body_signature_service_v2",
|
|
741
|
+
"machine": "myshop_advanced_machine_v2"
|
|
742
|
+
},
|
|
743
|
+
"env": {
|
|
744
|
+
"account": "myshop_merchant",
|
|
745
|
+
"network": "testnet",
|
|
746
|
+
"no_cache": true
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
```
|
|
750
|
+
|
|
751
|
+
**Response:**
|
|
752
|
+
- Machine bound successfully to Service
|
|
753
|
+
- Service: `three_body_signature_service_v2`
|
|
754
|
+
- Machine: `myshop_advanced_machine_v2`
|
|
755
|
+
|
|
756
|
+
**Response:**
|
|
757
|
+
- Machine bound successfully
|
|
758
|
+
- Service: `three_body_signature_service_v2`
|
|
759
|
+
- Machine: `myshop_advanced_machine_v2`
|
|
760
|
+
|
|
761
|
+
**Verification:**
|
|
762
|
+
```json
|
|
763
|
+
{
|
|
764
|
+
"query_type": "onchain_objects",
|
|
765
|
+
"objects": ["three_body_signature_service_v2"]
|
|
766
|
+
}
|
|
767
|
+
```
|
|
768
|
+
|
|
769
|
+
**Result:**
|
|
770
|
+
- Service machine field: `0xa0b47cbec8cdb8f5358e4b3c2569de3fecb05161d2bce487cd564efa70bf81c0`
|
|
771
|
+
- bPublished: false
|
|
772
|
+
|
|
773
|
+
---
|
|
774
|
+
|
|
775
|
+
### Step 6: Create Additional Guards for Service
|
|
776
|
+
|
|
777
|
+
Created 4 additional guards for Service order_allocators:
|
|
778
|
+
|
|
779
|
+
#### Guard 9: guard_merchant_win_v2
|
|
780
|
+
**Request:**
|
|
781
|
+
```json
|
|
782
|
+
{
|
|
783
|
+
"operation_type": "guard",
|
|
784
|
+
"data": {
|
|
785
|
+
"namedNew": {
|
|
786
|
+
"name": "guard_merchant_win_v2",
|
|
787
|
+
"tags": ["ecommerce", "allocation", "merchant"],
|
|
788
|
+
"replaceExistName": true
|
|
789
|
+
},
|
|
790
|
+
"description": "Verify order is at Order Complete, Wonderful, or Return Fail node (merchant wins)",
|
|
791
|
+
"table": [
|
|
792
|
+
{
|
|
793
|
+
"identifier": 0,
|
|
794
|
+
"b_submission": true,
|
|
795
|
+
"value_type": "Address",
|
|
796
|
+
"name": "progress_address"
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
"identifier": 1,
|
|
800
|
+
"b_submission": false,
|
|
801
|
+
"value_type": "String",
|
|
802
|
+
"value": "Order Complete",
|
|
803
|
+
"name": "order_complete_node"
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
"identifier": 2,
|
|
807
|
+
"b_submission": false,
|
|
808
|
+
"value_type": "String",
|
|
809
|
+
"value": "Wonderful",
|
|
810
|
+
"name": "wonderful_node"
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
"identifier": 3,
|
|
814
|
+
"b_submission": false,
|
|
815
|
+
"value_type": "String",
|
|
816
|
+
"value": "Return Fail",
|
|
817
|
+
"name": "return_fail_node"
|
|
818
|
+
}
|
|
819
|
+
],
|
|
820
|
+
"root": {
|
|
821
|
+
"type": "node",
|
|
822
|
+
"node": {
|
|
823
|
+
"type": "logic_or",
|
|
824
|
+
"nodes": [
|
|
825
|
+
{
|
|
826
|
+
"type": "logic_equal",
|
|
827
|
+
"nodes": [
|
|
828
|
+
{
|
|
829
|
+
"type": "query",
|
|
830
|
+
"query": 1253,
|
|
831
|
+
"object": {"identifier": 0},
|
|
832
|
+
"parameters": []
|
|
833
|
+
},
|
|
834
|
+
{"type": "identifier", "identifier": 1}
|
|
835
|
+
]
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
"type": "logic_equal",
|
|
839
|
+
"nodes": [
|
|
840
|
+
{
|
|
841
|
+
"type": "query",
|
|
842
|
+
"query": 1253,
|
|
843
|
+
"object": {"identifier": 0},
|
|
844
|
+
"parameters": []
|
|
845
|
+
},
|
|
846
|
+
{"type": "identifier", "identifier": 2}
|
|
847
|
+
]
|
|
848
|
+
},
|
|
849
|
+
{
|
|
850
|
+
"type": "logic_equal",
|
|
851
|
+
"nodes": [
|
|
852
|
+
{
|
|
853
|
+
"type": "query",
|
|
854
|
+
"query": 1253,
|
|
855
|
+
"object": {"identifier": 0},
|
|
856
|
+
"parameters": []
|
|
857
|
+
},
|
|
858
|
+
{"type": "identifier", "identifier": 3}
|
|
859
|
+
]
|
|
860
|
+
}
|
|
861
|
+
]
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
},
|
|
865
|
+
"env": {
|
|
866
|
+
"account": "myshop_merchant",
|
|
867
|
+
"network": "testnet"
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
```
|
|
871
|
+
|
|
872
|
+
**Response:**
|
|
873
|
+
- Guard created: `0xece766c71360200d805abb128f1fb3bf3c9e3eae366352c5de176ab5dd82c1b2`
|
|
874
|
+
- Name: `guard_merchant_win_v2` (with replaceExistName=true)
|
|
875
|
+
|
|
876
|
+
---
|
|
877
|
+
|
|
878
|
+
#### Guard 10: guard_customer_win_v2
|
|
879
|
+
**Request:**
|
|
880
|
+
```json
|
|
881
|
+
{
|
|
882
|
+
"operation_type": "guard",
|
|
883
|
+
"data": {
|
|
884
|
+
"namedNew": {
|
|
885
|
+
"name": "guard_customer_win_v2",
|
|
886
|
+
"tags": ["ecommerce", "allocation", "customer"],
|
|
887
|
+
"replaceExistName": true
|
|
888
|
+
},
|
|
889
|
+
"description": "Verify order is at Lost or Return Complete node (customer wins)",
|
|
890
|
+
"table": [
|
|
891
|
+
{
|
|
892
|
+
"identifier": 0,
|
|
893
|
+
"b_submission": true,
|
|
894
|
+
"value_type": "Address",
|
|
895
|
+
"name": "progress_address"
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
"identifier": 1,
|
|
899
|
+
"b_submission": false,
|
|
900
|
+
"value_type": "String",
|
|
901
|
+
"value": "Lost",
|
|
902
|
+
"name": "lost_node"
|
|
903
|
+
},
|
|
904
|
+
{
|
|
905
|
+
"identifier": 2,
|
|
906
|
+
"b_submission": false,
|
|
907
|
+
"value_type": "String",
|
|
908
|
+
"value": "Return Complete",
|
|
909
|
+
"name": "return_complete_node"
|
|
910
|
+
}
|
|
911
|
+
],
|
|
912
|
+
"root": {
|
|
913
|
+
"type": "node",
|
|
914
|
+
"node": {
|
|
915
|
+
"type": "logic_or",
|
|
916
|
+
"nodes": [
|
|
917
|
+
{
|
|
918
|
+
"type": "logic_equal",
|
|
919
|
+
"nodes": [
|
|
920
|
+
{
|
|
921
|
+
"type": "query",
|
|
922
|
+
"query": 1253,
|
|
923
|
+
"object": {"identifier": 0},
|
|
924
|
+
"parameters": []
|
|
925
|
+
},
|
|
926
|
+
{"type": "identifier", "identifier": 1}
|
|
927
|
+
]
|
|
928
|
+
},
|
|
929
|
+
{
|
|
930
|
+
"type": "logic_equal",
|
|
931
|
+
"nodes": [
|
|
932
|
+
{
|
|
933
|
+
"type": "query",
|
|
934
|
+
"query": 1253,
|
|
935
|
+
"object": {"identifier": 0},
|
|
936
|
+
"parameters": []
|
|
937
|
+
},
|
|
938
|
+
{"type": "identifier", "identifier": 2}
|
|
939
|
+
]
|
|
940
|
+
}
|
|
941
|
+
]
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
},
|
|
945
|
+
"env": {
|
|
946
|
+
"account": "myshop_merchant",
|
|
947
|
+
"network": "testnet"
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
```
|
|
951
|
+
|
|
952
|
+
**Response:**
|
|
953
|
+
- Guard created: `0x9e6ce67f66c3e96df6b7bb5873da3d5076b3a15bb1d12e9182419f905cebbd15`
|
|
954
|
+
- Name: `guard_customer_win_v2` (with replaceExistName=true)
|
|
955
|
+
|
|
956
|
+
---
|
|
957
|
+
|
|
958
|
+
#### Guard 11: guard_time_10d_v2
|
|
959
|
+
**Request:**
|
|
960
|
+
```json
|
|
961
|
+
{
|
|
962
|
+
"operation_type": "guard",
|
|
963
|
+
"data": {
|
|
964
|
+
"namedNew": {
|
|
965
|
+
"name": "guard_time_10d_v2",
|
|
966
|
+
"tags": ["ecommerce", "time", "10days"],
|
|
967
|
+
"replaceExistName": true
|
|
968
|
+
},
|
|
969
|
+
"description": "Verify at least 10 days (864000000 ms) have passed since node entry",
|
|
970
|
+
"table": [
|
|
971
|
+
{
|
|
972
|
+
"identifier": 0,
|
|
973
|
+
"b_submission": true,
|
|
974
|
+
"value_type": "U64",
|
|
975
|
+
"name": "start_time"
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
"identifier": 1,
|
|
979
|
+
"b_submission": false,
|
|
980
|
+
"value_type": "U64",
|
|
981
|
+
"value": "864000000",
|
|
982
|
+
"name": "ten_days_ms"
|
|
983
|
+
}
|
|
984
|
+
],
|
|
985
|
+
"root": {
|
|
986
|
+
"type": "node",
|
|
987
|
+
"node": {
|
|
988
|
+
"type": "logic_as_u256_greater_or_equal",
|
|
989
|
+
"nodes": [
|
|
990
|
+
{
|
|
991
|
+
"type": "calc_number_subtract",
|
|
992
|
+
"nodes": [
|
|
993
|
+
{"type": "context", "context": "Clock"},
|
|
994
|
+
{"type": "identifier", "identifier": 0}
|
|
995
|
+
]
|
|
996
|
+
},
|
|
997
|
+
{"type": "identifier", "identifier": 1}
|
|
998
|
+
]
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
},
|
|
1002
|
+
"env": {
|
|
1003
|
+
"account": "myshop_merchant",
|
|
1004
|
+
"network": "testnet"
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
```
|
|
1008
|
+
|
|
1009
|
+
**Response:**
|
|
1010
|
+
- Guard created: `0x51b290507808df00021825bb436184d34b1be27aed3590493f3d13003e0a3cb1`
|
|
1011
|
+
- Name: `guard_time_10d_v2` (with replaceExistName=true)
|
|
1012
|
+
|
|
1013
|
+
---
|
|
1014
|
+
|
|
1015
|
+
#### Guard 12: guard_time_2d_v2
|
|
1016
|
+
**Request:**
|
|
1017
|
+
```json
|
|
1018
|
+
{
|
|
1019
|
+
"operation_type": "guard",
|
|
1020
|
+
"data": {
|
|
1021
|
+
"namedNew": {
|
|
1022
|
+
"name": "guard_time_2d_v2",
|
|
1023
|
+
"tags": ["ecommerce", "time", "2days"],
|
|
1024
|
+
"replaceExistName": true
|
|
1025
|
+
},
|
|
1026
|
+
"description": "Verify at least 2 days (172800000 ms) have passed since node entry",
|
|
1027
|
+
"table": [
|
|
1028
|
+
{
|
|
1029
|
+
"identifier": 0,
|
|
1030
|
+
"b_submission": true,
|
|
1031
|
+
"value_type": "U64",
|
|
1032
|
+
"name": "start_time"
|
|
1033
|
+
},
|
|
1034
|
+
{
|
|
1035
|
+
"identifier": 1,
|
|
1036
|
+
"b_submission": false,
|
|
1037
|
+
"value_type": "U64",
|
|
1038
|
+
"value": "172800000",
|
|
1039
|
+
"name": "two_days_ms"
|
|
1040
|
+
}
|
|
1041
|
+
],
|
|
1042
|
+
"root": {
|
|
1043
|
+
"type": "node",
|
|
1044
|
+
"node": {
|
|
1045
|
+
"type": "logic_as_u256_greater_or_equal",
|
|
1046
|
+
"nodes": [
|
|
1047
|
+
{
|
|
1048
|
+
"type": "calc_number_subtract",
|
|
1049
|
+
"nodes": [
|
|
1050
|
+
{"type": "context", "context": "Clock"},
|
|
1051
|
+
{"type": "identifier", "identifier": 0}
|
|
1052
|
+
]
|
|
1053
|
+
},
|
|
1054
|
+
{"type": "identifier", "identifier": 1}
|
|
1055
|
+
]
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
},
|
|
1059
|
+
"env": {
|
|
1060
|
+
"account": "myshop_merchant",
|
|
1061
|
+
"network": "testnet"
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
```
|
|
1065
|
+
|
|
1066
|
+
**Response:**
|
|
1067
|
+
- Guard created: `0x7c69cfae4c0dd64f5e4ce6fedc9053ce3b664e4f3a82d69614649d97459329c4`
|
|
1068
|
+
- Name: `guard_time_2d_v2` (with replaceExistName=true)
|
|
1069
|
+
|
|
1070
|
+
---
|
|
1071
|
+
|
|
1072
|
+
### Step 7: Create Arbitration Object
|
|
1073
|
+
|
|
1074
|
+
**Request:**
|
|
1075
|
+
```json
|
|
1076
|
+
{
|
|
1077
|
+
"operation_type": "arbitration",
|
|
1078
|
+
"data": {
|
|
1079
|
+
"object": {
|
|
1080
|
+
"name": "myshop_arbitration_v2",
|
|
1081
|
+
"replaceExistName": true
|
|
1082
|
+
},
|
|
1083
|
+
"description": "Arbitration for MyShop Advanced - protects customer rights in disputes",
|
|
1084
|
+
"fee": 100000000
|
|
1085
|
+
},
|
|
1086
|
+
"env": {
|
|
1087
|
+
"account": "myshop_merchant",
|
|
1088
|
+
"network": "testnet"
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
```
|
|
1092
|
+
|
|
1093
|
+
**Response:**
|
|
1094
|
+
- Arbitration object created: `0x538d...78cb`
|
|
1095
|
+
- Name: `myshop_arbitration_v2` (with replaceExistName=true)
|
|
1096
|
+
- Fee: 100000000
|
|
1097
|
+
|
|
1098
|
+
---
|
|
1099
|
+
|
|
1100
|
+
### Step 7: Update Service and Publish
|
|
1101
|
+
|
|
1102
|
+
**Request:**
|
|
1103
|
+
```json
|
|
1104
|
+
{
|
|
1105
|
+
"operation_type": "service",
|
|
1106
|
+
"data": {
|
|
1107
|
+
"object": "three_body_signature_service_v2",
|
|
1108
|
+
"description": "The Three-Body Problem book with author signature service - Advanced e-commerce with multi-path workflow",
|
|
1109
|
+
"sales": {
|
|
1110
|
+
"op": "add",
|
|
1111
|
+
"sales": [
|
|
1112
|
+
{
|
|
1113
|
+
"name": "The Three-Body Problem + Author Signature",
|
|
1114
|
+
"price": 5000000000,
|
|
1115
|
+
"stock": 100,
|
|
1116
|
+
"suspension": false,
|
|
1117
|
+
"wip": "https://wowok.net/test/three_body.wip",
|
|
1118
|
+
"wip_hash": "sha256:1db6dc86d8be68bafb33418628a30e7bfcbce48de9c099d3d9cb21def3af8b43"
|
|
1119
|
+
}
|
|
1120
|
+
]
|
|
1121
|
+
},
|
|
1122
|
+
"arbitrations": {
|
|
1123
|
+
"op": "add",
|
|
1124
|
+
"objects": ["myshop_arbitration_v2"]
|
|
1125
|
+
},
|
|
1126
|
+
"customer_required": ["phone", "email", "shipping_address"],
|
|
1127
|
+
"order_allocators": {
|
|
1128
|
+
"description": "Order fund allocators for MyShop Advanced",
|
|
1129
|
+
"threshold": 0,
|
|
1130
|
+
"allocators": [
|
|
1131
|
+
{
|
|
1132
|
+
"guard": "service_merchant_win_v2",
|
|
1133
|
+
"sharing": [
|
|
1134
|
+
{
|
|
1135
|
+
"who": {"Signer": "signer"},
|
|
1136
|
+
"sharing": 10000,
|
|
1137
|
+
"mode": "Rate"
|
|
1138
|
+
}
|
|
1139
|
+
]
|
|
1140
|
+
},
|
|
1141
|
+
{
|
|
1142
|
+
"guard": "service_customer_win_v2",
|
|
1143
|
+
"sharing": [
|
|
1144
|
+
{
|
|
1145
|
+
"who": {"GuardIdentifier": 0},
|
|
1146
|
+
"sharing": 10000,
|
|
1147
|
+
"mode": "Rate"
|
|
1148
|
+
}
|
|
1149
|
+
]
|
|
1150
|
+
}
|
|
1151
|
+
]
|
|
1152
|
+
},
|
|
1153
|
+
"publish": true
|
|
1154
|
+
},
|
|
1155
|
+
"env": {
|
|
1156
|
+
"account": "myshop_merchant",
|
|
1157
|
+
"network": "testnet",
|
|
1158
|
+
"no_cache": true
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
```
|
|
1162
|
+
|
|
1163
|
+
**Response:**
|
|
1164
|
+
- Service updated and published: `three_body_signature_service_v2`
|
|
1165
|
+
- Machine: `myshop_advanced_machine_v2` (already bound)
|
|
1166
|
+
- Published: true
|
|
1167
|
+
- Added:
|
|
1168
|
+
- Sales: "The Three-Body Problem + Author Signature"
|
|
1169
|
+
- Arbitrations: `myshop_arbitration_v2`
|
|
1170
|
+
- Order allocators: `service_merchant_win_v2`, `service_customer_win_v2`
|
|
1171
|
+
- Customer required: `phone`, `email`, `shipping_address`
|
|
1172
|
+
|
|
1173
|
+
---
|
|
1174
|
+
|
|
1175
|
+
### Step 8: Create Reward Object
|
|
1176
|
+
|
|
1177
|
+
**Request:**
|
|
1178
|
+
```json
|
|
1179
|
+
{
|
|
1180
|
+
"operation_type": "reward",
|
|
1181
|
+
"data": {
|
|
1182
|
+
"object": {
|
|
1183
|
+
"name": "myshop_reward_v2",
|
|
1184
|
+
"replaceExistName": true
|
|
1185
|
+
},
|
|
1186
|
+
"description": "Reward pool for MyShop advanced - Wonderful rewards (10000), Lost compensation (20000), Shipping timeout compensation (20000)",
|
|
1187
|
+
"coin_add": {
|
|
1188
|
+
"balance": 150000000
|
|
1189
|
+
}
|
|
1190
|
+
},
|
|
1191
|
+
"env": {
|
|
1192
|
+
"account": "myshop_merchant",
|
|
1193
|
+
"network": "testnet"
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
```
|
|
1197
|
+
|
|
1198
|
+
**Response:**
|
|
1199
|
+
- Reward object created: (address)
|
|
1200
|
+
- Name: `myshop_reward_v2` (with replaceExistName=true)
|
|
1201
|
+
- Initial balance: 150000000
|
|
1202
|
+
|
|
1203
|
+
---
|
|
1204
|
+
|
|
1205
|
+
### Step 9: Add Reward Guards
|
|
1206
|
+
|
|
1207
|
+
#### Reward Guard 1: Wonderful Node
|
|
1208
|
+
**Request:**
|
|
1209
|
+
```json
|
|
1210
|
+
{
|
|
1211
|
+
"operation_type": "reward",
|
|
1212
|
+
"data": {
|
|
1213
|
+
"object": "myshop_reward_v2",
|
|
1214
|
+
"guard_add": [
|
|
1215
|
+
{
|
|
1216
|
+
"guard": "guard_wonderful_v2",
|
|
1217
|
+
"recipient": {"Signer": "signer"},
|
|
1218
|
+
"amount": 10000
|
|
1219
|
+
}
|
|
1220
|
+
]
|
|
1221
|
+
},
|
|
1222
|
+
"env": {
|
|
1223
|
+
"account": "myshop_merchant",
|
|
1224
|
+
"network": "testnet"
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
```
|
|
1228
|
+
|
|
1229
|
+
**Response:**
|
|
1230
|
+
- Reward guard added: `guard_wonderful_v2` (10000 reward)
|
|
1231
|
+
|
|
1232
|
+
---
|
|
1233
|
+
|
|
1234
|
+
#### Reward Guard 2: Lost Node
|
|
1235
|
+
**Request:**
|
|
1236
|
+
```json
|
|
1237
|
+
{
|
|
1238
|
+
"operation_type": "reward",
|
|
1239
|
+
"data": {
|
|
1240
|
+
"object": "myshop_reward_v2",
|
|
1241
|
+
"guard_add": [
|
|
1242
|
+
{
|
|
1243
|
+
"guard": "guard_lost_v2",
|
|
1244
|
+
"recipient": {"Signer": "signer"},
|
|
1245
|
+
"amount": 20000
|
|
1246
|
+
}
|
|
1247
|
+
]
|
|
1248
|
+
},
|
|
1249
|
+
"env": {
|
|
1250
|
+
"account": "myshop_merchant",
|
|
1251
|
+
"network": "testnet"
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
```
|
|
1255
|
+
|
|
1256
|
+
**Response:**
|
|
1257
|
+
- Reward guard added: `guard_lost_v2` (20000 compensation)
|
|
1258
|
+
|
|
1259
|
+
---
|
|
1260
|
+
|
|
1261
|
+
#### Reward Guard 3: Shipping Timeout
|
|
1262
|
+
**Request:**
|
|
1263
|
+
```json
|
|
1264
|
+
{
|
|
1265
|
+
"operation_type": "reward",
|
|
1266
|
+
"data": {
|
|
1267
|
+
"object": "myshop_reward_v2",
|
|
1268
|
+
"guard_add": [
|
|
1269
|
+
{
|
|
1270
|
+
"guard": "guard_shipping_timeout_v2",
|
|
1271
|
+
"recipient": {"Signer": "signer"},
|
|
1272
|
+
"amount": 20000
|
|
1273
|
+
}
|
|
1274
|
+
]
|
|
1275
|
+
},
|
|
1276
|
+
"env": {
|
|
1277
|
+
"account": "myshop_merchant",
|
|
1278
|
+
"network": "testnet"
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
```
|
|
1282
|
+
|
|
1283
|
+
**Response:**
|
|
1284
|
+
- Reward guard added: `guard_shipping_timeout_v2` (20000 compensation)
|
|
1285
|
+
|
|
1286
|
+
---
|
|
1287
|
+
|
|
1288
|
+
## Part 2 Completed
|
|
1289
|
+
|
|
1290
|
+
Merchant system setup is complete:
|
|
1291
|
+
- Permission object created: `myshop_permission_v2`
|
|
1292
|
+
- Machine object created: `myshop_advanced_machine_v2` with 11 nodes
|
|
1293
|
+
- Service object created and published: `three_body_signature_service_v2`
|
|
1294
|
+
- 13 Guard objects created (8 for Machine + 4 for Service + 1 for Reward)
|
|
1295
|
+
- Arbitration object created: `myshop_arbitration_v2`
|
|
1296
|
+
- Reward pool created: `myshop_reward_v2` with initial balance 150000000
|
|
1297
|
+
- 3 reward guards added
|