@wowok/skills 1.1.1 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wowok/skills",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "WoWok AI Skills for Claude and other AI assistants - Helping AI use WoWok MCP tools correctly",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -43,10 +43,7 @@
43
43
  "type": "git",
44
44
  "url": "https://github.com/wowok-ai/skills.git"
45
45
  },
46
- "bugs": {
47
- "url": "https://github.com/wowok-ai/skills/issues"
48
- },
49
- "homepage": "https://github.com/wowok-ai/skills#readme",
46
+ "homepage": "https://wowok.net",
50
47
  "devDependencies": {
51
48
  "@types/node": "^22.0.0",
52
49
  "typescript": "^5.8.0"
@@ -184,6 +184,66 @@ Once consensus is reached, create the order through Service operation.
184
184
 
185
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
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
202
+ }
203
+ ```
204
+
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
213
+
214
+ **Step 2: Filter discounts for the current Service**
215
+
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.
217
+
218
+ **Step 3: Validate discount applicability**
219
+
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"
237
+ }
238
+ }
239
+ }
240
+ ```
241
+
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
246
+
187
247
  | `namedNewOrder` | Local name for Order | Recommended for easy reference |
188
248
  | `namedNewProgress` | Local name for Progress | Recommended |
189
249
  | `namedNewAllocation` | Local name for Allocation | Recommended |