@wowok/agent-mcp 2.2.13 → 2.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +42 -98
- package/dist/schema-query/index.d.ts +29 -0
- package/dist/schema-query/index.js +149 -0
- package/dist/schemas/account_operation.schema.json +255 -0
- package/dist/schemas/guard2file.schema.json +71 -0
- package/dist/schemas/index.json +139 -0
- package/dist/schemas/local_info_operation.schema.json +142 -0
- package/dist/schemas/local_mark_operation.schema.json +119 -0
- package/dist/schemas/machineNode2file.schema.json +71 -0
- package/dist/schemas/messenger_operation.schema.json +1393 -0
- package/dist/schemas/onchain_events.schema.json +113 -0
- package/dist/schemas/onchain_operations.schema.json +376 -0
- package/dist/schemas/onchain_operations_allocation.schema.json +914 -0
- package/dist/schemas/onchain_operations_arbitration.schema.json +1166 -0
- package/dist/schemas/onchain_operations_contact.schema.json +853 -0
- package/dist/schemas/onchain_operations_demand.schema.json +984 -0
- package/dist/schemas/onchain_operations_gen_passport.schema.json +1141 -0
- package/dist/schemas/onchain_operations_guard.schema.json +713 -0
- package/dist/schemas/onchain_operations_machine.schema.json +1347 -0
- package/dist/schemas/onchain_operations_order.schema.json +830 -0
- package/dist/schemas/onchain_operations_payment.schema.json +717 -0
- package/dist/schemas/onchain_operations_permission.schema.json +1088 -0
- package/dist/schemas/onchain_operations_personal.schema.json +1282 -0
- package/dist/schemas/onchain_operations_progress.schema.json +751 -0
- package/dist/schemas/onchain_operations_repository.schema.json +1572 -0
- package/dist/schemas/onchain_operations_reward.schema.json +955 -0
- package/dist/schemas/onchain_operations_service.schema.json +1411 -0
- package/dist/schemas/onchain_operations_treasury.schema.json +1155 -0
- package/dist/schemas/onchain_table_data.schema.json +35 -0
- package/dist/schemas/operations/guard.json +163 -0
- package/dist/schemas/operations/permission.json +22 -0
- package/dist/schemas/query_toolkit.schema.json +32 -0
- package/dist/schemas/schema_query.schema.json +33 -0
- package/dist/schemas/wip_file.schema.json +27 -0
- package/dist/schemas/wowok_buildin_info.schema.json +487 -0
- package/package.json +7 -5
- package/dist/docs/index.d.ts +0 -3
- package/dist/docs/index.js +0 -2
- package/dist/docs/loader.d.ts +0 -12
- package/dist/docs/loader.js +0 -177
- package/dist/docs/search.d.ts +0 -17
- package/dist/docs/search.js +0 -325
- package/dist/docs/types.d.ts +0 -55
- package/dist/docs/types.js +0 -1
- package/docs/README.md +0 -249
- package/docs/WIP.md +0 -388
- package/docs/WTS.md +0 -536
- package/docs/docs/account.md +0 -914
- package/docs/docs/allocation.md +0 -635
- package/docs/docs/arbitration.md +0 -1804
- package/docs/docs/arbitration_state_machine.md +0 -270
- package/docs/docs/contact.md +0 -709
- package/docs/docs/demand.md +0 -948
- package/docs/docs/guard.md +0 -1465
- package/docs/docs/localinfo.md +0 -432
- package/docs/docs/localmark.md +0 -583
- package/docs/docs/machine.md +0 -2490
- package/docs/docs/messenger.md +0 -2098
- package/docs/docs/onchain_events.md +0 -267
- package/docs/docs/order.md +0 -1001
- package/docs/docs/payment.md +0 -512
- package/docs/docs/permission.md +0 -1438
- package/docs/docs/personal.md +0 -742
- package/docs/docs/progress.md +0 -1748
- package/docs/docs/query.md +0 -467
- package/docs/docs/repository.md +0 -1043
- package/docs/docs/reward.md +0 -833
- package/docs/docs/service.md +0 -2130
- package/docs/docs/stage-01-introduction.md +0 -243
- package/docs/docs/stage-02-trust.md +0 -302
- package/docs/docs/stage-03-collaboration.md +0 -337
- package/docs/docs/stage-04-transaction.md +0 -277
- package/docs/docs/stage-05-business.md +0 -151
- package/docs/docs/stage-06-personal.md +0 -203
- package/docs/docs/stage-07-query.md +0 -572
- package/docs/docs/stage-08-examples.md +0 -184
- package/docs/docs/treasury.md +0 -1149
- package/docs/docs/wowok_buildin_info.md +0 -740
- package/docs/examples/Insurance/Insurance.md +0 -594
- package/docs/examples/Insurance/Insurance_TestResults.md +0 -481
- package/docs/examples/Insurance/insurance_complete_guard_v1.json +0 -50
- package/docs/examples/MyShop/MyShop.md +0 -1353
- package/docs/examples/MyShop/MyShop_TestResults.md +0 -1003
- package/docs/examples/MyShop_Advanced/MyShop_Advanced.md +0 -1898
- package/docs/examples/MyShop_Advanced/MyShop_Advanced_MerchantSystem_TestResults.md +0 -1297
- package/docs/examples/MyShop_Advanced/MyShop_Advanced_OrderFlow_TestResults.md +0 -743
- package/docs/examples/MyShop_Advanced/machine_nodes.json +0 -222
- package/docs/examples/ThreeBody_Signature/ThreeBody_Signature.md +0 -776
- package/docs/examples/ThreeBody_Signature/ThreeBody_Signature_TestResults.md +0 -599
- package/docs/examples/Travel/Travel.md +0 -1157
- package/docs/examples/Travel/Travel_TestResults.md +0 -743
- package/docs/examples/Travel/calc-weather-timestamps.js +0 -8
- package/docs/examples/Travel/travel_machine_v2_export.json +0 -104
- package/docs/examples/Travel/weather_check_guard_v1.json +0 -51
- package/docs/skills/WOWOK.md +0 -650
- package/docs/skills/onchain_operations/_common.md +0 -406
- package/docs/skills/onchain_operations/_index.md +0 -196
- package/docs/skills/onchain_operations/allocation.md +0 -28
- package/docs/skills/onchain_operations/arbitration.md +0 -106
- package/docs/skills/onchain_operations/contact.md +0 -40
- package/docs/skills/onchain_operations/demand.md +0 -53
- package/docs/skills/onchain_operations/gen_passport.md +0 -23
- package/docs/skills/onchain_operations/guard.md +0 -56
- package/docs/skills/onchain_operations/machine.md +0 -89
- package/docs/skills/onchain_operations/order.md +0 -56
- package/docs/skills/onchain_operations/payment.md +0 -24
- package/docs/skills/onchain_operations/permission.md +0 -68
- package/docs/skills/onchain_operations/personal.md +0 -58
- package/docs/skills/onchain_operations/progress.md +0 -38
- package/docs/skills/onchain_operations/repository.md +0 -70
- package/docs/skills/onchain_operations/reward.md +0 -38
- package/docs/skills/onchain_operations/service.md +0 -78
- package/docs/skills/onchain_operations/treasury.md +0 -68
- package/docs/skills/schema-account_operation.md +0 -402
- package/docs/skills/schema-guard2file.md +0 -153
- package/docs/skills/schema-local_info_operation.md +0 -160
- package/docs/skills/schema-local_mark_operation.md +0 -148
- package/docs/skills/schema-machineNode2file.md +0 -155
- package/docs/skills/schema-messenger_operation.md +0 -547
- package/docs/skills/schema-onchain_events.md +0 -201
- package/docs/skills/schema-onchain_table_data.md +0 -334
- package/docs/skills/schema-query_toolkit.md +0 -395
- package/docs/skills/schema-wip_file.md +0 -240
- package/docs/skills/schema-wowok_buildin_info.md +0 -296
- package/docs/wip-examples/three_body.html +0 -57
- package/docs/wip-examples/three_body.wip +0 -30
|
@@ -1,481 +0,0 @@
|
|
|
1
|
-
# Insurance Service Example - Test Results
|
|
2
|
-
|
|
3
|
-
This document records the actual execution results of the Insurance example on the WoWok testnet.
|
|
4
|
-
|
|
5
|
-
## Test Environment
|
|
6
|
-
- **Network**: testnet
|
|
7
|
-
- **Test Date**: 2026-05-03
|
|
8
|
-
- **SDK Version**: WoWok TypeScript SDK (local build)
|
|
9
|
-
|
|
10
|
-
## Overview
|
|
11
|
-
|
|
12
|
-
This example demonstrates an outdoor accident insurance service with time-lock completion guards. The service uses a simple two-node workflow (Start -> Complete) where the completion requires a time-lock guard to prevent premature order finalization.
|
|
13
|
-
|
|
14
|
-
## Key Object Addresses
|
|
15
|
-
|
|
16
|
-
| Object Type | Name | Object Address |
|
|
17
|
-
|-------------|------|----------------|
|
|
18
|
-
| Permission | insurance_permission_v1 | 0x93221f078e5aff1bab5f6486f9a0922268c3734a1ed5a9535109439bb7dd17e4 |
|
|
19
|
-
| Guard (Complete) | insurance_complete_guard_v1 | 0x3c07695d6f01c875c718bef8fae78cdf9ee19bcb174a9b35bb6213c29816f200 |
|
|
20
|
-
| Guard (Withdraw) | insurance_withdraw_guard_v1 | 0xc736a8296bd502aeae7802aadaf9a8d194ce2d498f5a1ed8fe63c33981f523b3 |
|
|
21
|
-
| Machine | insurance_machine_v1 | 0xd66d95bc0ed855ba0c0a650368f025871f817ca2145d6ea09b9566a2f17f74b3 |
|
|
22
|
-
| Service | insurance_service_v1 | 0x161b4a7398dd2fca54559e924c7f1619169f88e81c36bbad06ebb2931f5f2e32 |
|
|
23
|
-
| Test Order | test_insurance_order_v1 | 0xf0809ed1ee30e4d7cf1e8fc91c00e70e2d219f6d447aaa633b28a8d83f9ea243 |
|
|
24
|
-
| Progress | - | 0x5d06b916e8d6ce8fb75ad2b46426335c297d890d60a99cdbc8c59c6616ab0f8c |
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## Part 1: Merchant System Setup - Actual Execution Results
|
|
29
|
-
|
|
30
|
-
### Create Merchant Account and Get Test Tokens
|
|
31
|
-
|
|
32
|
-
**Create Account:**
|
|
33
|
-
```json
|
|
34
|
-
{
|
|
35
|
-
"gen": {
|
|
36
|
-
"name": "insurance_provider_v1",
|
|
37
|
-
"replaceExistName": true
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
**Execution Result:**
|
|
43
|
-
```json
|
|
44
|
-
{
|
|
45
|
-
"gen": {
|
|
46
|
-
"address": "0xda54ebfdbeecec5cae8ae8cdb2d0bf741dfc4e1051c0b4c7bb9968b441067e02",
|
|
47
|
-
"name": "insurance_provider_v1"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
**Get Test Tokens:**
|
|
53
|
-
```json
|
|
54
|
-
{
|
|
55
|
-
"faucet": {
|
|
56
|
-
"network": "testnet",
|
|
57
|
-
"name_or_address": "insurance_provider_v1"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
**Execution Result:** Successfully received 5 WOW tokens (5,000,000,000 MIST).
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
### Step 1: Create Permission Object
|
|
67
|
-
|
|
68
|
-
**Prompt:**
|
|
69
|
-
```json
|
|
70
|
-
{
|
|
71
|
-
"operation_type": "permission",
|
|
72
|
-
"data": {
|
|
73
|
-
"object": {
|
|
74
|
-
"name": "insurance_permission_v1",
|
|
75
|
-
"tags": ["insurance", "outdoor", "accident"],
|
|
76
|
-
"replaceExistName": true
|
|
77
|
-
},
|
|
78
|
-
"description": "Permission for outdoor accident insurance service"
|
|
79
|
-
},
|
|
80
|
-
"env": {
|
|
81
|
-
"account": "insurance_provider_v1",
|
|
82
|
-
"network": "testnet"
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
**Execution Result:**
|
|
88
|
-
- **Object Address**: 0x93221f078e5aff1bab5f6486f9a0922268c3734a1ed5a9535109439bb7dd17e4
|
|
89
|
-
- **Transaction**: 58gPUwgwM6npS7cs5XbpmCg7SVoTodE8PpTCMLYAMt6m
|
|
90
|
-
- **Status**: Success
|
|
91
|
-
|
|
92
|
-
---
|
|
93
|
-
|
|
94
|
-
### Step 2: Create Insurance Complete Guard (Time-Lock)
|
|
95
|
-
|
|
96
|
-
**Guard Definition** (`insurance_complete_guard_v1.json`):
|
|
97
|
-
```json
|
|
98
|
-
{
|
|
99
|
-
"namedNew": {
|
|
100
|
-
"name": "insurance_complete_guard_v1",
|
|
101
|
-
"tags": ["insurance", "complete", "time-lock"],
|
|
102
|
-
"replaceExistName": true
|
|
103
|
-
},
|
|
104
|
-
"description": "Time-lock guard for insurance claim completion",
|
|
105
|
-
"table": [
|
|
106
|
-
{
|
|
107
|
-
"identifier": 0,
|
|
108
|
-
"b_submission": true,
|
|
109
|
-
"value_type": "Address",
|
|
110
|
-
"name": "Order ID (submitted at runtime)"
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
"identifier": 1,
|
|
114
|
-
"b_submission": false,
|
|
115
|
-
"value_type": "U64",
|
|
116
|
-
"value": "1000",
|
|
117
|
-
"name": "Time-lock duration in ms"
|
|
118
|
-
}
|
|
119
|
-
],
|
|
120
|
-
"root": {
|
|
121
|
-
"type": "logic_as_u256_greater",
|
|
122
|
-
"nodes": [
|
|
123
|
-
{
|
|
124
|
-
"type": "context",
|
|
125
|
-
"context": "Clock"
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
"type": "calc_number_add",
|
|
129
|
-
"nodes": [
|
|
130
|
-
{
|
|
131
|
-
"type": "query",
|
|
132
|
-
"query": "progress.current_time",
|
|
133
|
-
"object": {
|
|
134
|
-
"identifier": 0,
|
|
135
|
-
"convert_witness": 100
|
|
136
|
-
},
|
|
137
|
-
"parameters": []
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
"type": "identifier",
|
|
141
|
-
"identifier": 1
|
|
142
|
-
}
|
|
143
|
-
]
|
|
144
|
-
}
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
**Key Design Pattern**: Uses `convert_witness: 100` (WitnessType.TypeOrderProgress) to convert the submitted Order ID to access its associated Progress object's `current_time` field.
|
|
151
|
-
|
|
152
|
-
**Execution Result:**
|
|
153
|
-
- **Object Address**: 0x3c07695d6f01c875c718bef8fae78cdf9ee19bcb174a9b35bb6213c29816f200
|
|
154
|
-
- **Transaction**: Bi6ykn7kewLsAjhUGLMKeErVJ9J7yvm8UsW78Y7F9We1
|
|
155
|
-
- **Status**: Success
|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
### Step 3: Create Insurance Withdraw Guard
|
|
160
|
-
|
|
161
|
-
**Guard Definition** (`insurance_withdraw_guard_v1.json`):
|
|
162
|
-
```json
|
|
163
|
-
{
|
|
164
|
-
"namedNew": {
|
|
165
|
-
"name": "insurance_withdraw_guard_v1",
|
|
166
|
-
"tags": ["insurance", "withdraw"],
|
|
167
|
-
"replaceExistName": true
|
|
168
|
-
},
|
|
169
|
-
"description": "Allow insurance provider to withdraw funds after order is completed.",
|
|
170
|
-
"table": [
|
|
171
|
-
{
|
|
172
|
-
"identifier": 0,
|
|
173
|
-
"b_submission": true,
|
|
174
|
-
"value_type": "Address",
|
|
175
|
-
"name": "order_id"
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
"identifier": 1,
|
|
179
|
-
"b_submission": false,
|
|
180
|
-
"value_type": "String",
|
|
181
|
-
"value": "Complete",
|
|
182
|
-
"name": "complete_node"
|
|
183
|
-
}
|
|
184
|
-
],
|
|
185
|
-
"root": {
|
|
186
|
-
"type": "logic_equal",
|
|
187
|
-
"nodes": [
|
|
188
|
-
{
|
|
189
|
-
"type": "query",
|
|
190
|
-
"query": "progress.current",
|
|
191
|
-
"object": {
|
|
192
|
-
"identifier": 0,
|
|
193
|
-
"convert_witness": 100
|
|
194
|
-
},
|
|
195
|
-
"parameters": []
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
"type": "identifier",
|
|
199
|
-
"identifier": 1
|
|
200
|
-
}
|
|
201
|
-
]
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
**Execution Result:**
|
|
207
|
-
- **Object Address**: 0xc736a8296bd502aeae7802aadaf9a8d194ce2d498f5a1ed8fe63c33981f523b3
|
|
208
|
-
- **Transaction**: FrL3z1jExLrs652vFr12faL9Xb5XMzh9vT9hZWPdgJyz
|
|
209
|
-
- **Status**: Success
|
|
210
|
-
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
### Step 4: Create Insurance Machine
|
|
214
|
-
|
|
215
|
-
**Prompt:**
|
|
216
|
-
```json
|
|
217
|
-
{
|
|
218
|
-
"operation_type": "machine",
|
|
219
|
-
"data": {
|
|
220
|
-
"object": {
|
|
221
|
-
"name": "insurance_machine_v1",
|
|
222
|
-
"permission": "insurance_permission_v1",
|
|
223
|
-
"replaceExistName": true
|
|
224
|
-
},
|
|
225
|
-
"description": "Insurance claim processing workflow: Start -> Complete (with time-lock guard)",
|
|
226
|
-
"node": {
|
|
227
|
-
"op": "add",
|
|
228
|
-
"data": [
|
|
229
|
-
{
|
|
230
|
-
"name": "Start",
|
|
231
|
-
"pairs": [
|
|
232
|
-
{
|
|
233
|
-
"prev_node": "",
|
|
234
|
-
"forwards": [
|
|
235
|
-
{
|
|
236
|
-
"name": "claim",
|
|
237
|
-
"guard": [],
|
|
238
|
-
"next_node_name": "Complete"
|
|
239
|
-
}
|
|
240
|
-
]
|
|
241
|
-
}
|
|
242
|
-
]
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
"name": "Complete",
|
|
246
|
-
"pairs": [
|
|
247
|
-
{
|
|
248
|
-
"prev_node": "Start",
|
|
249
|
-
"forwards": [
|
|
250
|
-
{
|
|
251
|
-
"name": "complete_claim",
|
|
252
|
-
"guard": ["insurance_complete_guard_v1"],
|
|
253
|
-
"next_node_name": ""
|
|
254
|
-
}
|
|
255
|
-
]
|
|
256
|
-
}
|
|
257
|
-
]
|
|
258
|
-
}
|
|
259
|
-
]
|
|
260
|
-
},
|
|
261
|
-
"publish": true
|
|
262
|
-
},
|
|
263
|
-
"env": {
|
|
264
|
-
"account": "insurance_provider_v1",
|
|
265
|
-
"network": "testnet"
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
**Execution Result:**
|
|
271
|
-
- **Object Address**: 0xd66d95bc0ed855ba0c0a650368f025871f817ca2145d6ea09b9566a2f17f74b3
|
|
272
|
-
- **Transaction**: BBjtFHkZQc7ag4uHziGNmB719g9w4vMNRX4j1AB4EQMq
|
|
273
|
-
- **Status**: Success
|
|
274
|
-
- **Node Count**: 2
|
|
275
|
-
- **Published**: Yes
|
|
276
|
-
|
|
277
|
-
---
|
|
278
|
-
|
|
279
|
-
### Step 5: Create Insurance Service
|
|
280
|
-
|
|
281
|
-
**Prompt:**
|
|
282
|
-
```json
|
|
283
|
-
{
|
|
284
|
-
"operation_type": "service",
|
|
285
|
-
"data": {
|
|
286
|
-
"object": {
|
|
287
|
-
"name": "insurance_service_v1",
|
|
288
|
-
"permission": "insurance_permission_v1",
|
|
289
|
-
"replaceExistName": true
|
|
290
|
-
},
|
|
291
|
-
"description": "Outdoor accident insurance for Iceland travel. Provides coverage for ice scooting and other outdoor activities.",
|
|
292
|
-
"machine": "insurance_machine_v1",
|
|
293
|
-
"sales": [
|
|
294
|
-
{
|
|
295
|
-
"name": "Outdoor Accident Insurance",
|
|
296
|
-
"price": "100000000",
|
|
297
|
-
"stock": "999"
|
|
298
|
-
}
|
|
299
|
-
],
|
|
300
|
-
"order_allocators": {
|
|
301
|
-
"description": "Insurance order revenue allocation",
|
|
302
|
-
"threshold": "0",
|
|
303
|
-
"allocators": [
|
|
304
|
-
{
|
|
305
|
-
"guard": "insurance_withdraw_guard_v1",
|
|
306
|
-
"sharing": [
|
|
307
|
-
{
|
|
308
|
-
"who": "Signer",
|
|
309
|
-
"sharing": "10000",
|
|
310
|
-
"mode": 1
|
|
311
|
-
}
|
|
312
|
-
],
|
|
313
|
-
"fix": "0",
|
|
314
|
-
"max": null
|
|
315
|
-
}
|
|
316
|
-
]
|
|
317
|
-
},
|
|
318
|
-
"publish": true
|
|
319
|
-
},
|
|
320
|
-
"env": {
|
|
321
|
-
"account": "insurance_provider_v1",
|
|
322
|
-
"network": "testnet"
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
**Execution Result:**
|
|
328
|
-
- **Object Address**: 0x161b4a7398dd2fca54559e924c7f1619169f88e81c36bbad06ebb2931f5f2e32
|
|
329
|
-
- **Transaction**: ju5K75sakrHsWnSLDv42kNTE37Q9LKF3Ue9ML9c2taT
|
|
330
|
-
- **Status**: Success
|
|
331
|
-
- **Published**: Yes
|
|
332
|
-
- **Paused**: No
|
|
333
|
-
|
|
334
|
-
---
|
|
335
|
-
|
|
336
|
-
### Step 6: Unpause Service
|
|
337
|
-
|
|
338
|
-
The service was already unpaused after creation. Verified configuration:
|
|
339
|
-
- **Service Status**: Active
|
|
340
|
-
- **Machine Bound**: insurance_machine_v1
|
|
341
|
-
- **Sales**: 1 item available
|
|
342
|
-
- **Order Allocators**: 1 allocator configured
|
|
343
|
-
|
|
344
|
-
---
|
|
345
|
-
|
|
346
|
-
## Part 2: Order Workflow Test
|
|
347
|
-
|
|
348
|
-
### Test Order Creation
|
|
349
|
-
|
|
350
|
-
**Prompt:**
|
|
351
|
-
```json
|
|
352
|
-
{
|
|
353
|
-
"operation_type": "order",
|
|
354
|
-
"data": {
|
|
355
|
-
"object": {
|
|
356
|
-
"name": "test_insurance_order_v1",
|
|
357
|
-
"replaceExistName": true
|
|
358
|
-
},
|
|
359
|
-
"service": "insurance_service_v1",
|
|
360
|
-
"item": {
|
|
361
|
-
"name": "Outdoor Accident Insurance",
|
|
362
|
-
"price": "100000000",
|
|
363
|
-
"quantity": 1
|
|
364
|
-
}
|
|
365
|
-
},
|
|
366
|
-
"env": {
|
|
367
|
-
"account": "insurance_provider_v1",
|
|
368
|
-
"network": "testnet"
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
**Execution Result:**
|
|
374
|
-
- **Order Address**: 0xf0809ed1ee30e4d7cf1e8fc91c00e70e2d219f6d447aaa633b28a8d83f9ea243
|
|
375
|
-
- **Progress Address**: 0x5d06b916e8d6ce8fb75ad2b46426335c297d890d60a99cdbc8c59c6616ab0f8c
|
|
376
|
-
- **Transaction**: ju5K75sakrHsWnSLDv42kNTE37Q9LKF3Ue9ML9c2taT
|
|
377
|
-
- **Amount**: 100,000,000 MIST (0.1 WOW)
|
|
378
|
-
|
|
379
|
-
---
|
|
380
|
-
|
|
381
|
-
### Progress Workflow Test
|
|
382
|
-
|
|
383
|
-
#### Initial -> Start
|
|
384
|
-
**Prompt:**
|
|
385
|
-
```json
|
|
386
|
-
{
|
|
387
|
-
"operation_type": "progress",
|
|
388
|
-
"data": {
|
|
389
|
-
"object": "test_insurance_order_v1",
|
|
390
|
-
"operate": {
|
|
391
|
-
"operation": {
|
|
392
|
-
"next_node_name": "Start",
|
|
393
|
-
"forward": "claim"
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
},
|
|
397
|
-
"env": {
|
|
398
|
-
"account": "insurance_provider_v1",
|
|
399
|
-
"network": "testnet"
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
**Result**: Success - Progress moved from "" to "Start"
|
|
405
|
-
|
|
406
|
-
#### Start -> Complete (Time-Lock Test)
|
|
407
|
-
|
|
408
|
-
**Attempt 1 (Immediate - Should Fail):**
|
|
409
|
-
```json
|
|
410
|
-
{
|
|
411
|
-
"operation_type": "progress",
|
|
412
|
-
"data": {
|
|
413
|
-
"object": "test_insurance_order_v1",
|
|
414
|
-
"operate": {
|
|
415
|
-
"operation": {
|
|
416
|
-
"next_node_name": "Complete",
|
|
417
|
-
"forward": "complete_claim"
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
},
|
|
421
|
-
"submission": {
|
|
422
|
-
"type": "submission",
|
|
423
|
-
"guard": [{"object": "insurance_complete_guard_v1", "impack": true}],
|
|
424
|
-
"submission": [{
|
|
425
|
-
"guard": "insurance_complete_guard_v1",
|
|
426
|
-
"submission": [{
|
|
427
|
-
"identifier": 0,
|
|
428
|
-
"b_submission": true,
|
|
429
|
-
"value_type": "Address",
|
|
430
|
-
"value": "0xf0809ed1ee30e4d7cf1e8fc91c00e70e2d219f6d447aaa633b28a8d83f9ea243"
|
|
431
|
-
}]
|
|
432
|
-
}]
|
|
433
|
-
},
|
|
434
|
-
"env": {
|
|
435
|
-
"account": "insurance_provider_v1",
|
|
436
|
-
"network": "testnet"
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
**Result**: Guard validation failed - Time-lock not yet expired (expected behavior)
|
|
442
|
-
|
|
443
|
-
**Attempt 2 (After 1.5s - Should Succeed):**
|
|
444
|
-
|
|
445
|
-
Waited 1.5 seconds and retried the same operation.
|
|
446
|
-
|
|
447
|
-
**Result**: Success - Progress moved from "Start" to "Complete"
|
|
448
|
-
- **Transaction**: mqLXfDYKwGwJPg3jytvzC9NnPeykSkioV6nKqKgvmFt
|
|
449
|
-
- **Current Node**: Complete
|
|
450
|
-
- **History Count**: 2
|
|
451
|
-
|
|
452
|
-
---
|
|
453
|
-
|
|
454
|
-
## Summary
|
|
455
|
-
|
|
456
|
-
### Test Results
|
|
457
|
-
|
|
458
|
-
| Test Case | Expected | Actual | Status |
|
|
459
|
-
|-----------|----------|--------|--------|
|
|
460
|
-
| Account Creation | Success | Success | ✅ |
|
|
461
|
-
| Permission Creation | Success | Success | ✅ |
|
|
462
|
-
| Guard Creation (Complete) | Success | Success | ✅ |
|
|
463
|
-
| Guard Creation (Withdraw) | Success | Success | ✅ |
|
|
464
|
-
| Machine Creation | Success | Success | ✅ |
|
|
465
|
-
| Service Creation | Success | Success | ✅ |
|
|
466
|
-
| Order Creation | Success | Success | ✅ |
|
|
467
|
-
| Progress: Initial -> Start | Success | Success | ✅ |
|
|
468
|
-
| Progress: Start -> Complete (Immediate) | Fail (Time-Lock) | Failed as expected | ✅ |
|
|
469
|
-
| Progress: Start -> Complete (After 1.5s) | Success | Success | ✅ |
|
|
470
|
-
|
|
471
|
-
### Key Learnings
|
|
472
|
-
|
|
473
|
-
1. **Time-Lock Implementation**: The `convert_witness: 100` (TypeOrderProgress) is essential for accessing Progress data from an Order ID submission.
|
|
474
|
-
|
|
475
|
-
2. **Guard Submission Schema**: Guard submissions require `b_submission` and `value_type` fields to be explicitly specified.
|
|
476
|
-
|
|
477
|
-
3. **Machine Node Structure**: The `prev_node: ""` (empty string) defines the entry point from the initial Progress state.
|
|
478
|
-
|
|
479
|
-
4. **Submission Parameter Location**: Guard submissions must be passed as a top-level `submission` parameter, not nested within `data.operate`.
|
|
480
|
-
|
|
481
|
-
---
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"namedNew": {
|
|
3
|
-
"name": "insurance_complete_guard_v1",
|
|
4
|
-
"tags": ["insurance", "time-lock", "complete"],
|
|
5
|
-
"replaceExistName": true
|
|
6
|
-
},
|
|
7
|
-
"description": "Time-lock guard for insurance claim completion. Requires clock > progress.current_time + 1000ms.",
|
|
8
|
-
"table": [
|
|
9
|
-
{
|
|
10
|
-
"identifier": 0,
|
|
11
|
-
"b_submission": true,
|
|
12
|
-
"value_type": "Address",
|
|
13
|
-
"name": "Order ID (submitted at runtime)"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"identifier": 1,
|
|
17
|
-
"b_submission": false,
|
|
18
|
-
"value_type": "U64",
|
|
19
|
-
"value": 1000,
|
|
20
|
-
"name": "Time-lock duration in ms"
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
"root": {
|
|
24
|
-
"type": "logic_as_u256_greater",
|
|
25
|
-
"nodes": [
|
|
26
|
-
{
|
|
27
|
-
"type": "context",
|
|
28
|
-
"context": "Clock"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"type": "calc_number_add",
|
|
32
|
-
"nodes": [
|
|
33
|
-
{
|
|
34
|
-
"type": "query",
|
|
35
|
-
"query": 1272,
|
|
36
|
-
"object": {
|
|
37
|
-
"identifier": 0,
|
|
38
|
-
"convert_witness": 100
|
|
39
|
-
},
|
|
40
|
-
"parameters": []
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"type": "identifier",
|
|
44
|
-
"identifier": 1
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
}
|