@wowok/skills 1.1.0 → 1.1.2
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 +16 -20
- package/dist/cli.js +114 -19
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/skills.d.ts +46 -1
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +154 -16
- package/dist/skills.js.map +1 -1
- package/dist/types.d.ts +31 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -8
- package/scripts/install.js +5 -3
- package/wowok-arbitrator/SKILL.md +279 -0
- package/wowok-guard/SKILL.md +143 -167
- package/wowok-machine/SKILL.md +167 -279
- package/wowok-order/SKILL.md +336 -424
- package/wowok-provider/SKILL.md +453 -0
- package/wowok-safety/SKILL.md +42 -20
- package/wowok-tools/SKILL.md +328 -343
- package/schemas/onchain_operations/_common.md +0 -406
- package/schemas/onchain_operations/_index.md +0 -196
- package/schemas/onchain_operations/allocation.md +0 -28
- package/schemas/onchain_operations/arbitration.md +0 -106
- package/schemas/onchain_operations/contact.md +0 -40
- package/schemas/onchain_operations/demand.md +0 -53
- package/schemas/onchain_operations/gen_passport.md +0 -23
- package/schemas/onchain_operations/guard.md +0 -56
- package/schemas/onchain_operations/machine.md +0 -89
- package/schemas/onchain_operations/order.md +0 -56
- package/schemas/onchain_operations/payment.md +0 -24
- package/schemas/onchain_operations/permission.md +0 -68
- package/schemas/onchain_operations/personal.md +0 -58
- package/schemas/onchain_operations/progress.md +0 -38
- package/schemas/onchain_operations/repository.md +0 -70
- package/schemas/onchain_operations/reward.md +0 -38
- package/schemas/onchain_operations/service.md +0 -78
- package/schemas/onchain_operations/treasury.md +0 -68
- package/schemas/schema-account_operation.md +0 -402
- package/schemas/schema-guard2file.md +0 -153
- package/schemas/schema-local_info_operation.md +0 -160
- package/schemas/schema-local_mark_operation.md +0 -148
- package/schemas/schema-machineNode2file.md +0 -155
- package/schemas/schema-messenger_operation.md +0 -547
- package/schemas/schema-onchain_events.md +0 -201
- package/schemas/schema-onchain_table_data.md +0 -334
- package/schemas/schema-query_toolkit.md +0 -395
- package/schemas/schema-wip_file.md +0 -240
- package/schemas/schema-wowok_buildin_info.md +0 -296
- package/wowok-build/SKILL.md +0 -139
package/wowok-order/SKILL.md
CHANGED
|
@@ -1,533 +1,445 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wowok-order
|
|
3
3
|
description: |
|
|
4
|
-
WoWok
|
|
5
|
-
|
|
6
|
-
resolution. Includes order splitting (Allocation), incentive distribution
|
|
7
|
-
(Reward), and arbitration patterns.
|
|
4
|
+
WoWok Customer Guide — complete order lifecycle for buyers: service evaluation,
|
|
5
|
+
consensus building, order creation, progress tracking, and dispute resolution.
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
order
|
|
7
|
+
Covers the full buyer journey: pre-purchase due diligence based on on-chain objects, consensus establishment with Messenger as off-chain
|
|
8
|
+
but self-verifiable evidence supplement, order operations, progress advancement
|
|
9
|
+
with game theory, and arbitration when needed.
|
|
11
10
|
when_to_use:
|
|
12
|
-
- User
|
|
13
|
-
- User
|
|
14
|
-
- User needs to
|
|
15
|
-
- User
|
|
16
|
-
- User wants to
|
|
11
|
+
- User is a customer/buyer placing or managing orders
|
|
12
|
+
- User wants to evaluate services before purchasing
|
|
13
|
+
- User needs to communicate with sellers via Messenger
|
|
14
|
+
- User asks about order progress, payments, or refunds
|
|
15
|
+
- User wants to file disputes or arbitration claims
|
|
16
|
+
- User mentions "buy", "order", "purchase", "refund", "dispute", "arbitration"
|
|
17
17
|
---
|
|
18
18
|
|
|
19
|
-
# WoWok
|
|
19
|
+
# WoWok Customer Guide
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Complete guide for buyers on WoWok — from service discovery to order completion.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
> **Role**: Customer (Buyer/Order Holder)
|
|
24
|
+
> **Provider Guide**: See [wowok-provider](../wowok-provider/SKILL.md)
|
|
25
|
+
> **Arbitration Guide**: See [wowok-arbitrator](../wowok-arbitrator/SKILL.md)
|
|
26
|
+
> **Messenger**: See [wowok-messenger](../wowok-messenger/SKILL.md) for encrypted communication
|
|
27
|
+
> **Tools**: See [wowok-tools](../wowok-tools/SKILL.md)
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|--------|-----------|---------|
|
|
27
|
-
| **Order** | User purchase | Order management and escrow |
|
|
28
|
-
| **Progress** | Order creation | Workflow state tracking |
|
|
29
|
-
| **Allocation** | Order completion | Fund distribution per consensus |
|
|
30
|
-
| **Arb(s)** | Dispute request | Arbitration for compensation |
|
|
29
|
+
---
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
User Purchase
|
|
34
|
-
↓
|
|
35
|
-
Service ──→ Order ──→ Progress ──→ Allocation
|
|
36
|
-
↓ ↓
|
|
37
|
-
Payment Node Transitions
|
|
38
|
-
(escrow) (Guard validated)
|
|
39
|
-
↓
|
|
40
|
-
Completion
|
|
41
|
-
↓
|
|
42
|
-
Fund Distribution
|
|
43
|
-
```
|
|
31
|
+
## Core Concepts
|
|
44
32
|
|
|
45
|
-
|
|
33
|
+
### Order Lifecycle Objects
|
|
46
34
|
|
|
47
|
-
|
|
48
|
-
Demand → Order → Payment → Progress → Completion
|
|
49
|
-
↓
|
|
50
|
-
Arbitration (disputes)
|
|
51
|
-
```
|
|
35
|
+
When you purchase from a Service, three runtime objects are created:
|
|
52
36
|
|
|
53
|
-
|
|
37
|
+
| Object | Purpose | Key Points |
|
|
38
|
+
|--------|---------|------------|
|
|
39
|
+
| **Order** | Fund escrow & ownership | You are the `builder` (owner). Agents can help operate but **only you can withdraw funds**. |
|
|
40
|
+
| **Progress** | Workflow state tracking | Tracks which Machine node you're at. Advanced via Order operations. |
|
|
41
|
+
| **Allocation** | Fund distribution engine | Executes the winning allocator strategy when reaching exit nodes. |
|
|
54
42
|
|
|
55
|
-
|
|
56
|
-
Service (marketplace)
|
|
57
|
-
├── Machine (workflow template)
|
|
58
|
-
├── Allocation (order splitting rules)
|
|
59
|
-
├── Reward (incentive pool)
|
|
60
|
-
└── Treasury (team fund)
|
|
61
|
-
|
|
62
|
-
Order (instance)
|
|
63
|
-
├── references Service
|
|
64
|
-
├── references Machine (for workflow)
|
|
65
|
-
├── Payment (funds transfer)
|
|
66
|
-
└── Progress (workflow tracking)
|
|
67
|
-
```
|
|
43
|
+
### Allocators vs Allocation
|
|
68
44
|
|
|
69
|
-
|
|
45
|
+
- **Allocators** (Service level): Multiple distribution strategies defined by seller, each with a Guard condition
|
|
46
|
+
- **Allocation** (Order level): Auto-created execution engine that evaluates all allocator Guards and runs the strategy whose Guard returns `true`
|
|
70
47
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
service: "<service_name_or_id>",
|
|
77
|
-
machine: "<machine_name_or_id>",
|
|
78
|
-
buyer: "<buyer_address>",
|
|
79
|
-
seller: "<seller_address>",
|
|
80
|
-
price: "<amount>",
|
|
81
|
-
token_type: "<token_type>",
|
|
82
|
-
...
|
|
83
|
-
}
|
|
84
|
-
})
|
|
85
|
-
```
|
|
48
|
+
**When Allocation Executes**:
|
|
49
|
+
- Allocation evaluates **whenever the Progress reaches a node** that triggers fund distribution
|
|
50
|
+
- **Any node** (not just exit nodes) can be configured to trigger Allocation evaluation
|
|
51
|
+
- The winning allocator is the one whose Guard validates `true` for the current state
|
|
52
|
+
- Guards can check: Progress node, time elapsed, signatures, or any on-chain data
|
|
86
53
|
|
|
87
|
-
|
|
54
|
+
**Consensus Principle**: Allocators and their Guard conditions are immutable and transparent. Both parties see the same rules, but choose different paths based on their interests.
|
|
88
55
|
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
onchain_operations({
|
|
92
|
-
operation_type: "payment",
|
|
93
|
-
data: {
|
|
94
|
-
op: "send",
|
|
95
|
-
from: "<sender_account>",
|
|
96
|
-
to: "<recipient_address>",
|
|
97
|
-
amount: "<amount>",
|
|
98
|
-
token_type: "<token_type>"
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
```
|
|
56
|
+
---
|
|
102
57
|
|
|
103
|
-
|
|
104
|
-
Orders can hold funds in escrow. Payment is released when order progresses through the Machine workflow.
|
|
58
|
+
## Phase 1: Service Evaluation (Pre-Purchase)
|
|
105
59
|
|
|
106
|
-
|
|
60
|
+
Thoroughly investigate before committing funds.
|
|
107
61
|
|
|
108
|
-
|
|
62
|
+
### 1.1 Query Service Configuration
|
|
109
63
|
|
|
110
|
-
|
|
111
|
-
```
|
|
112
|
-
onchain_operations({
|
|
113
|
-
operation_type: "allocation",
|
|
114
|
-
data: {
|
|
115
|
-
op: "create",
|
|
116
|
-
name: "<allocation_name>",
|
|
117
|
-
service: "<service_id>",
|
|
118
|
-
rules: [
|
|
119
|
-
{
|
|
120
|
-
recipient: "<address_or_guard>",
|
|
121
|
-
share: <percentage_or_fixed>,
|
|
122
|
-
discount_type: "RATES" // or "FIXED"
|
|
123
|
-
}
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
})
|
|
127
|
-
```
|
|
64
|
+
**Tool**: Use `query_toolkit` with `onchain_objects` query type to retrieve Service configuration.
|
|
128
65
|
|
|
129
|
-
|
|
130
|
-
| Type | Description |
|
|
131
|
-
|------|-------------|
|
|
132
|
-
| `RATES` | Percentage-based split (e.g., 30% = 30/100) |
|
|
133
|
-
| `FIXED` | Fixed amount split |
|
|
66
|
+
**Schema Reference**: `schema_query({ action: "get", name: "query_toolkit" })`
|
|
134
67
|
|
|
135
|
-
|
|
68
|
+
**Key Fields to Analyze**:
|
|
136
69
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
70
|
+
| Field | What to Check | Risk Signals |
|
|
71
|
+
|-------|---------------|--------------|
|
|
72
|
+
| `sales` | Pricing, stock, WIP files | No `wip_hash` = unverified product claims |
|
|
73
|
+
| `machine` | Workflow complexity | Overly complex = higher dispute risk |
|
|
74
|
+
| `allocators` | Fund distribution rules | Unfair splits = reconsider purchase |
|
|
75
|
+
| `arbitrations` | Available dispute resolution | None available = higher risk |
|
|
76
|
+
| `compensation_fund` | Arbitration payout capacity | Low balance = limited recourse |
|
|
144
77
|
|
|
145
|
-
**
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
{ recipient: "<seller>", share: 70, discount_type: "RATES" },
|
|
150
|
-
{ recipient: "<affiliate>", share: 27, discount_type: "RATES" }
|
|
151
|
-
]
|
|
152
|
-
```
|
|
78
|
+
**WIP File Verification**:
|
|
79
|
+
- `wip`: URL to product description/images
|
|
80
|
+
- `wip_hash`: Integrity hash (if empty, auto-verified; if provided, must match)
|
|
81
|
+
- **This is the seller's immutable commitment on-chain** — serves as arbitration evidence
|
|
153
82
|
|
|
154
|
-
|
|
83
|
+
### 1.2 Evaluate Service Reputation
|
|
155
84
|
|
|
156
|
-
|
|
85
|
+
Query the Service's EntityLinker for community endorsement data.
|
|
157
86
|
|
|
158
|
-
|
|
159
|
-
```
|
|
160
|
-
onchain_operations({
|
|
161
|
-
operation_type: "reward",
|
|
162
|
-
data: {
|
|
163
|
-
op: "create",
|
|
164
|
-
name: "<reward_name>",
|
|
165
|
-
service: "<service_id>",
|
|
166
|
-
...
|
|
167
|
-
}
|
|
168
|
-
})
|
|
169
|
-
```
|
|
87
|
+
**Tool**: `query_toolkit` with `onchain_table_item_entity_linker` query type.
|
|
170
88
|
|
|
171
|
-
|
|
172
|
-
1. User meets Reward conditions (validated by Guard)
|
|
173
|
-
2. User claims reward → `onchain_table_data` query `onchain_table_item_reward_record`
|
|
174
|
-
3. Tokens are distributed from the Reward pool
|
|
89
|
+
**Key Metrics to Calculate**:
|
|
175
90
|
|
|
176
|
-
|
|
91
|
+
| Metric | How to Calculate | Good Sign |
|
|
92
|
+
|--------|------------------|-----------|
|
|
93
|
+
| **Completion Rate** | % orders reaching terminal nodes | >90% |
|
|
94
|
+
| **Arbitration Rate** | % orders with non-empty `dispute` | <5% |
|
|
95
|
+
| **Avg Resolution Time** | Time from creation to completion | Short |
|
|
96
|
+
| **Repeat Customer Rate** | % builders appearing multiple times | High |
|
|
97
|
+
| **Community Sentiment** | likes vs dislikes in EntityLinker | Positive |
|
|
177
98
|
|
|
178
|
-
|
|
99
|
+
---
|
|
179
100
|
|
|
180
|
-
|
|
181
|
-
```
|
|
182
|
-
onchain_operations({
|
|
183
|
-
operation_type: "treasury",
|
|
184
|
-
data: {
|
|
185
|
-
op: "deposit",
|
|
186
|
-
service: "<service_id>",
|
|
187
|
-
amount: "<amount>",
|
|
188
|
-
token_type: "<token_type>"
|
|
189
|
-
}
|
|
190
|
-
})
|
|
191
|
-
```
|
|
101
|
+
## Phase 2: Consensus Building (CRITICAL)
|
|
192
102
|
|
|
193
|
-
|
|
194
|
-
```
|
|
195
|
-
onchain_operations({
|
|
196
|
-
operation_type: "treasury",
|
|
197
|
-
data: {
|
|
198
|
-
op: "withdraw",
|
|
199
|
-
service: "<service_id>",
|
|
200
|
-
amount: "<amount>",
|
|
201
|
-
token_type: "<token_type>",
|
|
202
|
-
recipient: "<address>"
|
|
203
|
-
}
|
|
204
|
-
})
|
|
205
|
-
```
|
|
103
|
+
Establish mutual understanding with seller BEFORE purchasing. Consensus is built on **immutable on-chain data** (Guard, Machine, Allocators), with Messenger serving as **off-chain but self-verifiable evidence supplement**.
|
|
206
104
|
|
|
207
|
-
###
|
|
208
|
-
```
|
|
209
|
-
onchain_table_data({
|
|
210
|
-
query_type: "onchain_table_item_treasury_history",
|
|
211
|
-
parent: "<treasury_id>",
|
|
212
|
-
address: "<payment_id>"
|
|
213
|
-
})
|
|
214
|
-
```
|
|
105
|
+
### Consensus Layers
|
|
215
106
|
|
|
216
|
-
|
|
107
|
+
| Layer | Source | Immutability | Purpose |
|
|
108
|
+
|-------|--------|--------------|---------|
|
|
109
|
+
| **On-Chain Foundation** | Service.machine, order_allocators, Guards | Immutable after publish | Transparent rules both parties agree to |
|
|
110
|
+
| **Off-Chain Supplement** | Messenger WTS files | Self-verifiable via signatures | Clarification, negotiation, evidence |
|
|
217
111
|
|
|
218
|
-
|
|
112
|
+
> **Core Principle**: On-chain data (Machine workflow, Allocator rules, Guard conditions) forms the **immutable consensus foundation**. Messenger communication provides **clarification and evidence** but cannot override on-chain rules.
|
|
219
113
|
|
|
220
|
-
|
|
221
|
-
```
|
|
222
|
-
onchain_operations({
|
|
223
|
-
operation_type: "arbitration",
|
|
224
|
-
data: {
|
|
225
|
-
op: "create",
|
|
226
|
-
name: "<arbitration_name>",
|
|
227
|
-
...
|
|
228
|
-
}
|
|
229
|
-
})
|
|
230
|
-
```
|
|
114
|
+
> **Full Messenger Guide**: See [wowok-messenger](../wowok-messenger/SKILL.md) for complete messaging operations, WTS evidence generation, and list management.
|
|
231
115
|
|
|
232
|
-
###
|
|
233
|
-
```
|
|
234
|
-
onchain_events({
|
|
235
|
-
type: "arbitration",
|
|
236
|
-
cursor: null,
|
|
237
|
-
limit: 20
|
|
238
|
-
})
|
|
239
|
-
```
|
|
116
|
+
### 2.1 Verify On-Chain Consensus First
|
|
240
117
|
|
|
241
|
-
|
|
118
|
+
Before contacting seller, thoroughly understand the immutable rules:
|
|
242
119
|
|
|
243
|
-
|
|
120
|
+
**Tool**: `query_toolkit` with `onchain_objects` query type to retrieve Service data.
|
|
244
121
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
op: "create",
|
|
251
|
-
service: "<service_id>",
|
|
252
|
-
description: "<request_description>",
|
|
253
|
-
...
|
|
254
|
-
}
|
|
255
|
-
})
|
|
256
|
-
```
|
|
122
|
+
**Key On-Chain Consensus Elements**:
|
|
123
|
+
- **Machine**: Workflow nodes and transitions — defines how order progresses
|
|
124
|
+
- **Allocators**: Fund distribution strategies — defines who gets what under which conditions
|
|
125
|
+
- **Guards**: Validation logic — determines which allocator executes
|
|
126
|
+
- **Arbitrations**: Available dispute resolution services
|
|
257
127
|
|
|
258
|
-
###
|
|
259
|
-
```
|
|
260
|
-
onchain_table_data({
|
|
261
|
-
query_type: "onchain_table_item_demand_presenter",
|
|
262
|
-
parent: "<demand_id>",
|
|
263
|
-
address: "<presenter_address>"
|
|
264
|
-
})
|
|
265
|
-
```
|
|
128
|
+
### 2.2 Get Service Contact
|
|
266
129
|
|
|
267
|
-
|
|
130
|
+
**Steps**:
|
|
131
|
+
1. Query Service object to extract `um` field (Contact object ID)
|
|
132
|
+
2. Query Contact object to retrieve `ims[]` array (Messenger addresses)
|
|
268
133
|
|
|
269
|
-
|
|
270
|
-
```
|
|
271
|
-
Permission → Guard → Service → Machine → Allocation → Reward
|
|
272
|
-
```
|
|
134
|
+
**Tool**: `query_toolkit` with `onchain_objects` query type.
|
|
273
135
|
|
|
274
|
-
### 2.
|
|
275
|
-
```
|
|
276
|
-
1. Buyer creates Order referencing Service + Machine
|
|
277
|
-
2. Buyer sends Payment to Order (escrow)
|
|
278
|
-
3. Seller advances Progress through Machine nodes
|
|
279
|
-
4. On completion, Allocation splits payment automatically
|
|
280
|
-
5. Reward distributes incentives if conditions met
|
|
281
|
-
```
|
|
136
|
+
### 2.3 Send Encrypted Messages
|
|
282
137
|
|
|
283
|
-
|
|
284
|
-
```
|
|
285
|
-
1. Either party initiates Arbitration
|
|
286
|
-
2. Arbiter reviews evidence
|
|
287
|
-
3. Arbiter resolves → funds released per resolution
|
|
288
|
-
```
|
|
138
|
+
Use Messenger to clarify on-chain rules and negotiate specifics.
|
|
289
139
|
|
|
290
|
-
|
|
140
|
+
**Tool**: `messenger_operation` with `send_message` operation.
|
|
291
141
|
|
|
292
|
-
|
|
293
|
-
```
|
|
294
|
-
query_toolkit({
|
|
295
|
-
query_type: "onchain_objects",
|
|
296
|
-
objects: ["<order_name_or_id>"]
|
|
297
|
-
})
|
|
298
|
-
```
|
|
142
|
+
**Schema Reference**: `schema_query({ action: "get", name: "messenger_operation" })`
|
|
299
143
|
|
|
300
|
-
|
|
301
|
-
```
|
|
302
|
-
onchain_table_data({
|
|
303
|
-
query_type: "onchain_table",
|
|
304
|
-
parent: "<progress_id>"
|
|
305
|
-
})
|
|
306
|
-
```
|
|
144
|
+
**Evidence Closure Principle**: Messages only become valid evidence when the recipient **explicitly confirms** (ARK signature). One-sided claims are not evidence.
|
|
307
145
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
})
|
|
314
|
-
```
|
|
146
|
+
**Why Messenger Matters** (as consensus supplement):
|
|
147
|
+
- ✅ End-to-end encrypted (NOT on-chain) — privacy for negotiations
|
|
148
|
+
- ✅ Creates tamper-proof audit trail (WTS files) — see [wowok-messenger](../wowok-messenger/SKILL.md) for WTS generation
|
|
149
|
+
- ✅ Clarifies on-chain rules without modifying them
|
|
150
|
+
- ✅ Generates arbitration evidence for off-chain commitments
|
|
315
151
|
|
|
316
|
-
|
|
152
|
+
**AI Should Proactively Suggest Clarifying**:
|
|
153
|
+
- Exact deliverables and acceptance criteria
|
|
154
|
+
- Timeline and milestones
|
|
155
|
+
- Edge case handling
|
|
156
|
+
- Refund/cancellation terms
|
|
157
|
+
- Delivery logistics (address, phone)
|
|
158
|
+
- Custom requirements
|
|
317
159
|
|
|
318
|
-
|
|
319
|
-
|-------|-------|-----|
|
|
320
|
-
| "service not found" | Service doesn't exist | Create Service first |
|
|
321
|
-
| "machine not found" | Machine doesn't exist | Create Machine first |
|
|
322
|
-
| "insufficient balance" | Not enough tokens | Check balance with account_balance |
|
|
323
|
-
| "allocation failed" | Invalid split rules | Check total shares = 100% |
|
|
324
|
-
| "progress blocked" | Guard condition not met | Check forward Guard logic |
|
|
325
|
-
| "arbitration not found" | No Arbiter configured | Create Arbitration object |
|
|
160
|
+
**Request Explicit Confirmation**: Ensure the seller responds and confirms understanding before proceeding. Unconfirmed messages have limited evidentiary value.
|
|
326
161
|
|
|
327
|
-
|
|
162
|
+
---
|
|
328
163
|
|
|
329
|
-
|
|
164
|
+
## Phase 3: Order Creation
|
|
330
165
|
|
|
331
|
-
|
|
166
|
+
Once consensus is reached, create the order through Service operation.
|
|
332
167
|
|
|
333
|
-
|
|
168
|
+
### 3.1 Key Parameters
|
|
334
169
|
|
|
335
|
-
|
|
336
|
-
order_allocators: {
|
|
337
|
-
description: "Insurance order revenue allocation",
|
|
338
|
-
threshold: 0,
|
|
339
|
-
allocators: [{
|
|
340
|
-
guard: "insurance_withdraw_guard_v1",
|
|
341
|
-
sharing: [{ who: { Signer: "signer" }, sharing: 10000, mode: "Rate" }]
|
|
342
|
-
}]
|
|
343
|
-
}
|
|
344
|
-
```
|
|
170
|
+
**Operation**: `onchain_operations` with `operation_type: "service"`
|
|
345
171
|
|
|
346
|
-
|
|
172
|
+
**Schema Reference**: `schema_query({ action: "get", name: "onchain_operations_service" })`
|
|
347
173
|
|
|
348
|
-
**
|
|
174
|
+
**Key Parameters**:
|
|
349
175
|
|
|
350
|
-
|
|
176
|
+
| Parameter | Purpose | Notes |
|
|
177
|
+
|-----------|---------|-------|
|
|
178
|
+
| `buy.items` | Products to purchase | Reference `Service.sales` |
|
|
179
|
+
| `buy.total_pay` | Payment budget | **Excess automatically refunded** |
|
|
180
|
+
| `buy.discount` | Coupon object ID | Optional — see 3.1.1 below |
|
|
181
|
+
| `agents` | Delegated operators | Can operate order but **CANNOT withdraw funds** |
|
|
351
182
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
183
|
+
#### 3.1.1 Using Discount Coupons
|
|
184
|
+
|
|
185
|
+
When creating an order via the `buy` operation, you can apply a discount coupon by including the `discount` field with the coupon name/ID.
|
|
186
|
+
|
|
187
|
+
**Finding Available Discounts**:
|
|
188
|
+
|
|
189
|
+
Discount coupons are separate objects that you receive (usually transferred from Service marketing campaigns or other users). To find discounts applicable to the current Service:
|
|
190
|
+
|
|
191
|
+
**Step 1: Query all Discount objects you own**
|
|
192
|
+
|
|
193
|
+
Use `query_toolkit` with `onchain_received` query type to get all Discount objects:
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"query_type": "onchain_received",
|
|
198
|
+
"name_or_address": "your_account_name",
|
|
199
|
+
"type": "0x2::service::Discount", // Discount type on-chain
|
|
200
|
+
"cursor": null,
|
|
201
|
+
"limit": 50
|
|
366
202
|
}
|
|
367
203
|
```
|
|
368
204
|
|
|
369
|
-
|
|
205
|
+
This returns `ReceivedNormal[]` where each item's `content_raw` contains Discount fields:
|
|
206
|
+
- `name`: Discount name
|
|
207
|
+
- `discount_type`: "rate" (percentage) or "fixed" (absolute amount)
|
|
208
|
+
- `benchmark`: Minimum order amount required
|
|
209
|
+
- `off`: Discount value (e.g., 1000 for 10% if rate, or 100 for 100 units if fixed)
|
|
210
|
+
- `time_start` / `time_end`: Validity period
|
|
211
|
+
- `service`: Parent Service object ID (which Service this discount belongs to)
|
|
212
|
+
- `transferable`: Whether it can be transferred to others
|
|
370
213
|
|
|
371
|
-
|
|
214
|
+
**Step 2: Filter discounts for the current Service**
|
|
372
215
|
|
|
373
|
-
|
|
216
|
+
Each Discount has a `service` field indicating which Service it can be used with. Filter the received Discount objects by comparing each Discount's `service` field with the target Service object ID you're purchasing from. Only Discounts where `service` matches the target Service can be applied to that Service.
|
|
374
217
|
|
|
375
|
-
|
|
218
|
+
**Step 3: Validate discount applicability**
|
|
376
219
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
220
|
+
Before using a discount, verify:
|
|
221
|
+
1. **Time validity**: `time_start` ≤ current_time ≤ `time_end`
|
|
222
|
+
2. **Minimum amount**: Order total ≥ `benchmark`
|
|
223
|
+
3. **Service match**: Discount's `service` field matches the Service being purchased
|
|
224
|
+
|
|
225
|
+
**Step 4: Apply discount in order creation**
|
|
226
|
+
|
|
227
|
+
Include the selected Discount object ID in the `buy.discount` field:
|
|
228
|
+
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"operation_type": "service",
|
|
232
|
+
"data": {
|
|
233
|
+
"buy": {
|
|
234
|
+
"items": [...],
|
|
235
|
+
"total_pay": "10000",
|
|
236
|
+
"discount": "discount_object_id_here"
|
|
388
237
|
}
|
|
389
238
|
}
|
|
390
|
-
}
|
|
239
|
+
}
|
|
391
240
|
```
|
|
392
241
|
|
|
393
|
-
**
|
|
242
|
+
**Discount Calculation**:
|
|
243
|
+
- If `discount_type` is "rate": Discount = `total_pay` × (`off` / 10000)
|
|
244
|
+
- If `discount_type` is "fixed": Discount = min(`off`, `total_pay`)
|
|
245
|
+
- Final payment = `total_pay` - Discount
|
|
394
246
|
|
|
395
|
-
|
|
247
|
+
| `namedNewOrder` | Local name for Order | Recommended for easy reference |
|
|
248
|
+
| `namedNewProgress` | Local name for Progress | Recommended |
|
|
249
|
+
| `namedNewAllocation` | Local name for Allocation | Recommended |
|
|
396
250
|
|
|
397
|
-
|
|
398
|
-
order_new: {
|
|
399
|
-
buy: {
|
|
400
|
-
items: [{ name: "Iceland Adventure", stock: 1 }],
|
|
401
|
-
total_pay: { balance: 200000000 }
|
|
402
|
-
},
|
|
403
|
-
namedNewOrder: { name: "alice_travel_order_v1" }
|
|
404
|
-
}
|
|
405
|
-
```
|
|
251
|
+
### 3.2 Private Information Handling
|
|
406
252
|
|
|
407
|
-
|
|
253
|
+
If Service requires private info (`customer_required`):
|
|
408
254
|
|
|
409
|
-
**
|
|
255
|
+
1. **NEVER put on-chain** — send via Messenger
|
|
256
|
+
2. Include order ID in the message
|
|
257
|
+
3. Confirm receipt with seller
|
|
410
258
|
|
|
411
|
-
|
|
259
|
+
**Tool**: `messenger_operation` with `send_message` operation.
|
|
412
260
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
{
|
|
434
|
-
guard: "reward_shipping_timeout_v2",
|
|
435
|
-
recipient: { Signer: "signer" },
|
|
436
|
-
amount: { type: "Fixed", value: 30000 },
|
|
437
|
-
expiration_time: null
|
|
438
|
-
}
|
|
439
|
-
]
|
|
440
|
-
}
|
|
441
|
-
})
|
|
442
|
-
```
|
|
261
|
+
### 3.3 Post-Creation Notification
|
|
262
|
+
|
|
263
|
+
**Mandatory**: Notify Service customer service via Messenger with order ID and submitted info reference.
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Phase 4: Order Operations
|
|
268
|
+
|
|
269
|
+
All operations use `operation_type: "order"`.
|
|
270
|
+
|
|
271
|
+
**Schema Reference**: `schema_query({ action: "get", name: "onchain_operations_order" })`
|
|
272
|
+
|
|
273
|
+
### 4.1 Permission Hierarchy
|
|
274
|
+
|
|
275
|
+
| Role | Can Do | Cannot Do |
|
|
276
|
+
|------|--------|-----------|
|
|
277
|
+
| **Builder** (You) | Everything + withdraw funds | — |
|
|
278
|
+
| **Agents** | Operate progress, arbitration, cancel | **Withdraw funds** |
|
|
279
|
+
|
|
280
|
+
> **Critical**: You maintain ultimate financial control. Agents assist but cannot access funds.
|
|
443
281
|
|
|
444
|
-
|
|
445
|
-
- `reward_wonderful_v2`: order at "Wonderful" node → 10000 reward
|
|
446
|
-
- `reward_lost_v2`: order at "Lost" node → 20000 compensation
|
|
447
|
-
- `reward_shipping_timeout_v2`: order at "Shipping" node > 2 days → 30000 compensation
|
|
282
|
+
### 4.2 Progress Advancement
|
|
448
283
|
|
|
449
|
-
|
|
284
|
+
**Key Rule**: As the order holder (builder), you advance progress **through the Order object**.
|
|
450
285
|
|
|
451
|
-
|
|
286
|
+
The Machine workflow defines who can operate each forward transition:
|
|
287
|
+
- **Order-operable forwards**: `namedOperator === ""` — you can execute via `order.progress`
|
|
288
|
+
- **Permission-operable forwards**: Require specific namespace permission — typically for Service Provider or collaborators
|
|
452
289
|
|
|
453
|
-
|
|
290
|
+
**Steps**:
|
|
291
|
+
1. Query Order object to get `progress` (Progress ID) and `machine` (Machine ID)
|
|
292
|
+
2. Query Progress object to get `current_node`
|
|
293
|
+
3. Query Machine table to find valid transitions from current node
|
|
294
|
+
|
|
295
|
+
**Tools**:
|
|
296
|
+
- `query_toolkit` with `onchain_objects` query type
|
|
297
|
+
- `query_toolkit` with `onchain_table` query type
|
|
298
|
+
|
|
299
|
+
> **Note**: Service Providers or their collaborators may operate other forwards directly via Progress if the Machine design grants them permission. The Machine consensus is immutable — both parties operate within the same transparent rules.
|
|
300
|
+
|
|
301
|
+
### 4.3 Path Selection & Game Theory
|
|
302
|
+
|
|
303
|
+
**Core Principle**: Same transparent rules, different optimal paths based on interests.
|
|
304
|
+
|
|
305
|
+
**Example Scenario**:
|
|
454
306
|
|
|
455
307
|
```
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
308
|
+
Current Node: "delivery_pending"
|
|
309
|
+
├── Path A → "delivery_confirmed"
|
|
310
|
+
│ ├── Guard: buyer signs receipt
|
|
311
|
+
│ └── Allocation: 95% seller, 5% platform
|
|
312
|
+
│
|
|
313
|
+
├── Path B → "dispute_filed"
|
|
314
|
+
│ ├── Guard: arbitration requested
|
|
315
|
+
│ └── Allocation: funds frozen
|
|
316
|
+
│
|
|
317
|
+
└── Path C → "return_initiated"
|
|
318
|
+
├── Guard: within return window
|
|
319
|
+
└── Allocation: 90% refund, 10% fee
|
|
465
320
|
```
|
|
466
321
|
|
|
467
|
-
|
|
322
|
+
**AI Decision Framework**:
|
|
323
|
+
|
|
324
|
+
1. **Query all valid paths** from current node
|
|
325
|
+
2. **Evaluate Guard conditions** for each path
|
|
326
|
+
3. **Assess Allocation impact** (query `service.order_allocators`)
|
|
327
|
+
4. **Present options** with consequences:
|
|
328
|
+
|
|
329
|
+
| Path | Guard Required | Financial Outcome | Best For |
|
|
330
|
+
|------|----------------|-------------------|----------|
|
|
331
|
+
| A | Sign receipt | Pay seller 95% | Satisfied customer |
|
|
332
|
+
| B | Request arbitration | Frozen | Disputed order |
|
|
333
|
+
| C | Return in window | 90% refund | Unsatisfied customer |
|
|
334
|
+
|
|
335
|
+
**AI Guidance**:
|
|
336
|
+
- Always present ALL available paths
|
|
337
|
+
- Explain Guard requirements
|
|
338
|
+
- Map to Allocation consequences
|
|
339
|
+
- Recommend based on user's goals and evidence
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## Phase 5: Arbitration (When Needed)
|
|
344
|
+
|
|
345
|
+
When disputes cannot be resolved directly, use third-party Arbitration.
|
|
346
|
+
|
|
347
|
+
### 5.1 Arbitration Process
|
|
348
|
+
|
|
349
|
+
| Step | Operation | Key Points |
|
|
350
|
+
|------|-----------|------------|
|
|
351
|
+
| 1 | `arbitration.dispute` | Create Arb object, **pay fee separately** (NOT from Order) |
|
|
352
|
+
| 2 | Generate WTS | Export Messenger history as tamper-proof evidence |
|
|
353
|
+
| 3 | Send evidence | Via Messenger to Arbitration's contact (encrypted) |
|
|
354
|
+
| 4 | `order.arb_confirm` | Signal "all evidence submitted" |
|
|
355
|
+
| 5 | Wait for voting | Arbitration organizes voters |
|
|
356
|
+
| 6 | `order.arb_objection` | (Optional) Object to unfavorable result |
|
|
357
|
+
| 7 | `order.arb_claim_compensation` | Claim payout from `service.compensation_fund` |
|
|
468
358
|
|
|
469
|
-
|
|
359
|
+
**Schema References**:
|
|
360
|
+
- `schema_query({ action: "get", name: "onchain_operations_arbitration" })`
|
|
361
|
+
- `schema_query({ action: "get", name: "onchain_operations_order" })`
|
|
362
|
+
- `schema_query({ action: "get", name: "messenger_operation" })`
|
|
470
363
|
|
|
471
|
-
|
|
364
|
+
### 5.2 Key Rules
|
|
472
365
|
|
|
473
|
-
|
|
366
|
+
- **Multiple Arb Objects**: Can arbitrate on multiple services simultaneously
|
|
367
|
+
- **One Compensation**: Only ONE claim per Order (choose best result)
|
|
368
|
+
- **Time Sensitivity**: Long arbitration may exceed order deadlines — discuss timelines pre-purchase
|
|
369
|
+
- **Evidence Privacy**: WTS files verify authenticity via `messenger_operation` with `verify_wts` operation
|
|
370
|
+
|
|
371
|
+
### 5.3 Arb Object Lifecycle
|
|
474
372
|
|
|
475
373
|
```
|
|
476
|
-
|
|
477
|
-
onchain_operations({
|
|
478
|
-
operation_type: "arbitration",
|
|
479
|
-
data: {
|
|
480
|
-
object: { name: "travel_arbitration_v1", permission: "travel_permission_v1" },
|
|
481
|
-
description: "Arbitration for Iceland travel service disputes"
|
|
482
|
-
}
|
|
483
|
-
})
|
|
484
|
-
|
|
485
|
-
// Bind during Service update:
|
|
486
|
-
onchain_operations({
|
|
487
|
-
operation_type: "service",
|
|
488
|
-
data: {
|
|
489
|
-
object: "travel_service_v1",
|
|
490
|
-
arbitrations: { op: "add", objects: ["travel_arbitration_v1"] }
|
|
491
|
-
}
|
|
492
|
-
})
|
|
374
|
+
Principal_confirming → Arbitrator_confirming → Voting → Arbitrated → Objectionable → Finished/Withdrawn
|
|
493
375
|
```
|
|
494
376
|
|
|
495
|
-
|
|
377
|
+
---
|
|
496
378
|
|
|
497
|
-
|
|
379
|
+
## Fund Management
|
|
498
380
|
|
|
499
|
-
|
|
381
|
+
### Receiving Funds (`order.receive`)
|
|
500
382
|
|
|
501
|
-
|
|
383
|
+
Extract funds sent to Order (compensation, penalties, rewards) to your wallet.
|
|
502
384
|
|
|
503
|
-
|
|
385
|
+
**Operation**: `onchain_operations` with `operation_type: "order"` and `receive` field.
|
|
504
386
|
|
|
505
|
-
|
|
506
|
-
1. SERVICE SETUP (one-time)
|
|
507
|
-
Permission → Guard(s) → Machine → Service (with allocation) → Publish
|
|
387
|
+
**Schema Reference**: `schema_query({ action: "get", name: "onchain_operations_order" })`
|
|
508
388
|
|
|
509
|
-
|
|
510
|
-
|
|
389
|
+
**Sources**:
|
|
390
|
+
- Arbitration compensation (from `service.compensation_fund`)
|
|
391
|
+
- Service penalties (late delivery, quality issues)
|
|
392
|
+
- Collaboration payments
|
|
393
|
+
- Direct transfers
|
|
511
394
|
|
|
512
|
-
|
|
513
|
-
onchain_operations(operation_type: "progress", data: { object, order, node: { name, forward } })
|
|
395
|
+
**Who Can Execute**: Builder and agents (but only builder receives).
|
|
514
396
|
|
|
515
|
-
|
|
516
|
-
Allocation fires → Payment split per allocator Guards
|
|
397
|
+
### Ownership Transfer (`order.transfer_to`)
|
|
517
398
|
|
|
518
|
-
|
|
519
|
-
Reward Guard validates → tokens distributed to claimant
|
|
399
|
+
Transfer order ownership to new address. Requires builder permission.
|
|
520
400
|
|
|
521
|
-
|
|
522
|
-
Arbitration → arb_confirm/arb_objection → resolution
|
|
523
|
-
```
|
|
401
|
+
**Operation**: `onchain_operations` with `operation_type: "order"` and `transfer_to` field.
|
|
524
402
|
|
|
525
403
|
---
|
|
526
404
|
|
|
527
|
-
##
|
|
405
|
+
## Quick Reference
|
|
406
|
+
|
|
407
|
+
### Essential Schemas
|
|
408
|
+
|
|
409
|
+
| Purpose | Schema Name |
|
|
410
|
+
|---------|-------------|
|
|
411
|
+
| Service operations (purchase) | `onchain_operations_service` |
|
|
412
|
+
| Order operations (progress, arbitration, receive) | `onchain_operations_order` |
|
|
413
|
+
| Arbitration operations (dispute) | `onchain_operations_arbitration` |
|
|
414
|
+
| Messenger (encrypted communication) | `messenger_operation` |
|
|
415
|
+
| Query toolkit (object data, tables) | `query_toolkit` |
|
|
416
|
+
|
|
417
|
+
**Query Schema**: `schema_query({ action: "get", name: "<schema_name>" })`
|
|
418
|
+
|
|
419
|
+
### Common Workflows
|
|
420
|
+
|
|
421
|
+
**Evaluate → Communicate → Purchase → Track → Complete/Dispute**
|
|
422
|
+
|
|
423
|
+
1. Query Service → Check sales, machine, allocators, arbitrations
|
|
424
|
+
2. Messenger contact → Clarify terms, save WTS
|
|
425
|
+
3. Service operation → Create order with named objects
|
|
426
|
+
4. Order operations → Advance progress, choose paths
|
|
427
|
+
5. Receive funds or arbitration → Extract to wallet
|
|
428
|
+
|
|
429
|
+
---
|
|
528
430
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
-
|
|
533
|
-
-
|
|
431
|
+
## Safety Checklist
|
|
432
|
+
|
|
433
|
+
Before purchasing:
|
|
434
|
+
- [ ] Verified WIP file and product claims
|
|
435
|
+
- [ ] Reviewed allocators (fair distribution?)
|
|
436
|
+
- [ ] Checked available arbitrations
|
|
437
|
+
- [ ] Established Messenger contact with seller
|
|
438
|
+
- [ ] Clarified deliverables, timeline, refund policy
|
|
439
|
+
- [ ] Saved conversation as WTS evidence
|
|
440
|
+
|
|
441
|
+
Before advancing progress:
|
|
442
|
+
- [ ] Understand ALL available paths
|
|
443
|
+
- [ ] Know Guard requirements for chosen path
|
|
444
|
+
- [ ] Aware of Allocation consequences
|
|
445
|
+
- [ ] Have required evidence/proof ready
|