@goodz-core/sdk 0.3.4 → 0.3.6
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 +29 -9
- package/dist/{chunk-GH33FPMY.js → chunk-BMJFLMIR.js} +11 -2
- package/dist/chunk-BMJFLMIR.js.map +1 -0
- package/dist/{chunk-SWD7BJQ7.js → chunk-JXQNSQRK.js} +8 -2
- package/dist/chunk-JXQNSQRK.js.map +1 -0
- package/dist/{chunk-DSWHCVKV.js → chunk-U4JS2SP3.js} +7 -7
- package/dist/chunk-U4JS2SP3.js.map +1 -0
- package/dist/commerce/index.d.ts +76 -11
- package/dist/commerce/index.js +1 -1
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +3 -3
- package/dist/exchange/index.d.ts +135 -10
- package/dist/exchange/index.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-DSWHCVKV.js.map +0 -1
- package/dist/chunk-GH33FPMY.js.map +0 -1
- package/dist/chunk-SWD7BJQ7.js.map +0 -1
package/README.md
CHANGED
|
@@ -100,9 +100,9 @@ The SDK is built on three principles:
|
|
|
100
100
|
```ts
|
|
101
101
|
interface GoodZClientConfig {
|
|
102
102
|
coreUrl?: string; // Default: "https://goodzcore.manus.space"
|
|
103
|
-
commerceUrl?: string; // Default: "https://
|
|
104
|
-
exchangeUrl?: string; // Default: "https://
|
|
105
|
-
aliveUrl?: string; // Default: "https://
|
|
103
|
+
commerceUrl?: string; // Default: "https://goodz-commerce.manus.space"
|
|
104
|
+
exchangeUrl?: string; // Default: "https://goodz-exchange.manus.space"
|
|
105
|
+
aliveUrl?: string; // Default: "https://goodz-alive.manus.space"
|
|
106
106
|
accessToken?: string; // Static JWT token
|
|
107
107
|
getAccessToken?: () => string | Promise<string>; // Dynamic token provider
|
|
108
108
|
headers?: Record<string, string>; // Custom headers for every request
|
|
@@ -191,7 +191,7 @@ For commercial transactions, always use `zcoin.commercialTransfer` or `zcoin.min
|
|
|
191
191
|
|
|
192
192
|
## API Reference — Commerce Namespace
|
|
193
193
|
|
|
194
|
-
Commerce methods communicate via MCP JSON-RPC with `
|
|
194
|
+
Commerce methods communicate via MCP JSON-RPC with `goodz-commerce.manus.space`. This namespace covers shop management, product assembly, campaigns, purchases, wholesale, and settlement.
|
|
195
195
|
|
|
196
196
|
### Shop & Product Assembly
|
|
197
197
|
|
|
@@ -219,7 +219,10 @@ Commerce methods communicate via MCP JSON-RPC with `goodzcommerce.manus.space`.
|
|
|
219
219
|
| Method | Description |
|
|
220
220
|
|--------|-------------|
|
|
221
221
|
| `executePurchase(input)` | Execute a purchase (direct or gacha draw) |
|
|
222
|
-
| `getMyOrders()` | User's order history |
|
|
222
|
+
| `getMyOrders(input?)` | User's order history (paginated: `page`, `page_size`) |
|
|
223
|
+
| `getOrderDetail(input)` | Get order detail by `order_id` or `order_no` |
|
|
224
|
+
| `refundOrder(input)` | Refund a confirmed/paid order (shop owner only) |
|
|
225
|
+
| `cancelOrder(input)` | Cancel a pending order (shop owner only) |
|
|
223
226
|
|
|
224
227
|
### Wholesale
|
|
225
228
|
|
|
@@ -238,6 +241,12 @@ Commerce methods communicate via MCP JSON-RPC with `goodzcommerce.manus.space`.
|
|
|
238
241
|
| `mintToInventory(input)` | Mint + register in one step |
|
|
239
242
|
| `redeemPhysical(input)` | Redeem a physical item |
|
|
240
243
|
|
|
244
|
+
### Wallet / Balance
|
|
245
|
+
|
|
246
|
+
| Method | Description |
|
|
247
|
+
|--------|-------------|
|
|
248
|
+
| `getMyBalance(input?)` | Query user's real Z-coin balance from Core (single source of truth) |
|
|
249
|
+
|
|
241
250
|
### Settlement & Discovery
|
|
242
251
|
|
|
243
252
|
| Method | Description |
|
|
@@ -268,30 +277,33 @@ const result = await goodz.commerce.rawTool("some_new_tool", { key: "value" });
|
|
|
268
277
|
|
|
269
278
|
## API Reference — Exchange Namespace
|
|
270
279
|
|
|
271
|
-
Exchange methods communicate via MCP JSON-RPC with `
|
|
280
|
+
Exchange methods communicate via MCP JSON-RPC with `goodz-exchange.manus.space`. This namespace covers the secondary market: listings, auctions, want-to-buy requests, P2P trades, and market data.
|
|
272
281
|
|
|
273
282
|
### Marketplace & Listings
|
|
274
283
|
|
|
275
284
|
| Method | Description |
|
|
276
285
|
|--------|-------------|
|
|
277
|
-
| `browseMarketplace(input?)` | Browse active listings with filters |
|
|
286
|
+
| `browseMarketplace(input?)` | Browse active listings with filters (type, GoodZ, condition, price, sort) |
|
|
278
287
|
| `getListingDetail(input)` | Get listing details |
|
|
279
288
|
| `createListing(input)` | Create listing (fixed_price or auction). Core locks the instance |
|
|
280
289
|
| `cancelListing(input)` | Cancel listing. Core unlocks the instance |
|
|
290
|
+
| `getMyListings(input?)` | Get your own listings (active, sold, cancelled, expired) |
|
|
281
291
|
|
|
282
|
-
### Purchase & Bidding
|
|
292
|
+
### Purchase & Bidding & Orders
|
|
283
293
|
|
|
284
294
|
| Method | Description |
|
|
285
295
|
|--------|-------------|
|
|
286
296
|
| `buyListing(input)` | Buy a fixed-price listing. Z-coin debit + ownership transfer |
|
|
287
297
|
| `placeBid(input)` | Bid on auction. If meets buy-now price → instant purchase |
|
|
288
298
|
| `getBids(input)` | All bids for an auction (highest first) |
|
|
299
|
+
| `getMyOrders(input?)` | Your order history (as buyer and/or seller, filterable by `role`) |
|
|
289
300
|
|
|
290
301
|
### Want-to-Buy (WTB)
|
|
291
302
|
|
|
292
303
|
| Method | Description |
|
|
293
304
|
|--------|-------------|
|
|
294
305
|
| `createWtb(input)` | Post a want-to-buy request |
|
|
306
|
+
| `browseWtb(input?)` | Browse active WTB requests (filter by GoodZ, franchise, series, condition, price) |
|
|
295
307
|
| `fulfillWtb(input)` | Fulfill a WTB by offering your item |
|
|
296
308
|
| `cancelWtb(input)` | Cancel your WTB request |
|
|
297
309
|
|
|
@@ -310,6 +322,14 @@ Exchange methods communicate via MCP JSON-RPC with `goodzexchange.manus.space`.
|
|
|
310
322
|
| `addToWatchlist(input)` | Add to watchlist |
|
|
311
323
|
| `removeFromWatchlist(input)` | Remove from watchlist |
|
|
312
324
|
| `getMarketData(input)` | Price history, floor price, volume, trends |
|
|
325
|
+
| `getCollectionStats(input)` | Collection stats: floor price, listings, 24h/7d volume, avg price |
|
|
326
|
+
|
|
327
|
+
### Batch Lookup & User Profile
|
|
328
|
+
|
|
329
|
+
| Method | Description |
|
|
330
|
+
|--------|-------------|
|
|
331
|
+
| `getInstancesBatch(input)` | Batch lookup card instances by IDs (max 100) with full metadata |
|
|
332
|
+
| `getUserProfile(input)` | Get a user's public profile (displayName, avatar, role) |
|
|
313
333
|
|
|
314
334
|
### Exchange Escape Hatch
|
|
315
335
|
|
|
@@ -319,7 +339,7 @@ const result = await goodz.exchange.rawTool("some_new_tool", { key: "value" });
|
|
|
319
339
|
|
|
320
340
|
## API Reference — Alive Namespace
|
|
321
341
|
|
|
322
|
-
Alive methods communicate via MCP JSON-RPC with `
|
|
342
|
+
Alive methods communicate via MCP JSON-RPC with `goodz-alive.manus.space`. This namespace powers AI companion interactions: memory, intimacy, context building, and conversation.
|
|
323
343
|
|
|
324
344
|
| Method | Description |
|
|
325
345
|
|--------|-------------|
|
|
@@ -10,12 +10,16 @@ function createExchangeNamespace(transport) {
|
|
|
10
10
|
// Listing Management
|
|
11
11
|
createListing: tool("create_listing"),
|
|
12
12
|
cancelListing: tool("cancel_listing"),
|
|
13
|
+
getMyListings: tool("get_my_listings"),
|
|
13
14
|
// Purchase & Bidding
|
|
14
15
|
buyListing: tool("buy_listing"),
|
|
15
16
|
placeBid: tool("place_bid"),
|
|
16
17
|
getBids: tool("get_bids"),
|
|
18
|
+
// Orders
|
|
19
|
+
getMyOrders: tool("get_my_orders"),
|
|
17
20
|
// WTB
|
|
18
21
|
createWtb: tool("create_wtb"),
|
|
22
|
+
browseWtb: tool("browse_wtb"),
|
|
19
23
|
fulfillWtb: tool("fulfill_wtb"),
|
|
20
24
|
cancelWtb: tool("cancel_wtb"),
|
|
21
25
|
// P2P Trade
|
|
@@ -27,11 +31,16 @@ function createExchangeNamespace(transport) {
|
|
|
27
31
|
removeFromWatchlist: tool("remove_from_watchlist"),
|
|
28
32
|
// Market Data
|
|
29
33
|
getMarketData: tool("get_market_data"),
|
|
34
|
+
getCollectionStats: tool("get_collection_stats"),
|
|
35
|
+
// Batch Lookup
|
|
36
|
+
getInstancesBatch: tool("get_instances_batch"),
|
|
37
|
+
// User Profile
|
|
38
|
+
getUserProfile: tool("get_user_profile"),
|
|
30
39
|
// Raw escape hatch
|
|
31
40
|
rawTool: (toolName, args) => callMcpTool(transport, toolName, args)
|
|
32
41
|
};
|
|
33
42
|
}
|
|
34
43
|
|
|
35
44
|
export { createExchangeNamespace };
|
|
36
|
-
//# sourceMappingURL=chunk-
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
45
|
+
//# sourceMappingURL=chunk-BMJFLMIR.js.map
|
|
46
|
+
//# sourceMappingURL=chunk-BMJFLMIR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/exchange/index.ts"],"names":[],"mappings":";;;AAmIO,SAAS,wBAAwB,SAAA,EAA+C;AACrF,EAAA,MAAM,IAAA,GAAO,CAAmC,IAAA,KAC9C,CAAC,UAAc,WAAA,CAAkB,SAAA,EAAW,MAAM,KAAU,CAAA;AAE9D,EAAA,OAAO;AAAA;AAAA,IAEL,iBAAA,EAAmB,KAAwD,oBAAoB,CAAA;AAAA,IAC/F,gBAAA,EAAkB,KAAqD,oBAAoB,CAAA;AAAA;AAAA,IAG3F,aAAA,EAAe,KAA8D,gBAAgB,CAAA;AAAA,IAC7F,aAAA,EAAe,KAAsC,gBAAgB,CAAA;AAAA,IACrE,aAAA,EAAe,KAAoD,iBAAiB,CAAA;AAAA;AAAA,IAGpF,UAAA,EAAY,KAAwD,aAAa,CAAA;AAAA,IACjF,QAAA,EAAU,KAAoD,WAAW,CAAA;AAAA,IACzE,OAAA,EAAS,KAA0C,UAAU,CAAA;AAAA;AAAA,IAG7D,WAAA,EAAa,KAAgD,eAAe,CAAA;AAAA;AAAA,IAG5E,SAAA,EAAW,KAA0C,YAAY,CAAA;AAAA,IACjE,SAAA,EAAW,KAA4C,YAAY,CAAA;AAAA,IACnE,UAAA,EAAY,KAAwD,aAAa,CAAA;AAAA,IACjF,SAAA,EAAW,KAAkC,YAAY,CAAA;AAAA;AAAA,IAGzD,YAAA,EAAc,KAAuD,eAAe,CAAA;AAAA,IACpF,cAAA,EAAgB,KAAgE,kBAAkB,CAAA;AAAA;AAAA,IAGlG,YAAA,EAAc,KAAqD,eAAe,CAAA;AAAA,IAClF,cAAA,EAAgB,KAAyD,kBAAkB,CAAA;AAAA,IAC3F,mBAAA,EAAqB,KAA4C,uBAAuB,CAAA;AAAA;AAAA,IAGxF,aAAA,EAAe,KAAqD,iBAAiB,CAAA;AAAA,IACrF,kBAAA,EAAoB,KAA+D,sBAAsB,CAAA;AAAA;AAAA,IAGzG,iBAAA,EAAmB,KAA+D,qBAAqB,CAAA;AAAA;AAAA,IAGvG,cAAA,EAAgB,KAAuD,kBAAkB,CAAA;AAAA;AAAA,IAGzF,SAAS,CAAU,QAAA,EAAkB,SACnC,WAAA,CAAoC,SAAA,EAAW,UAAU,IAAI;AAAA,GACjE;AACF","file":"chunk-BMJFLMIR.js","sourcesContent":["/**\n * @goodz-core/sdk — Exchange Namespace\n *\n * Provides typed access to GoodZ.Exchange MCP tools:\n * marketplace listings, auctions, WTB, P2P trades,\n * watchlist, market data, collection stats, and user profiles.\n *\n * All prices are in hundredths (100 = 1.00 Z-coin).\n *\n * Aligned with Exchange MCP as of 2026-03-20 (23 tools).\n *\n * @module\n */\n\nimport { callMcpTool } from \"../mcp-transport\";\nimport type { TransportConfig } from \"../mcp-transport\";\nimport type {\n ExchangeBrowseMarketplaceInput,\n ExchangeListing,\n ExchangeGetListingDetailInput,\n ExchangeCreateListingInput,\n ExchangeCreateListingOutput,\n ExchangeCancelListingInput,\n ExchangeGetMyListingsInput,\n ExchangeBuyListingInput,\n ExchangeBuyListingOutput,\n ExchangePlaceBidInput,\n ExchangePlaceBidOutput,\n ExchangeGetBidsInput,\n ExchangeBid,\n ExchangeGetMyOrdersInput,\n ExchangeOrder,\n ExchangeCreateWtbInput,\n ExchangeWtb,\n ExchangeBrowseWtbInput,\n ExchangeFulfillWtbInput,\n ExchangeFulfillWtbOutput,\n ExchangeCancelWtbInput,\n ExchangeProposeTradeInput,\n ExchangeTradeProposal,\n ExchangeRespondToTradeInput,\n ExchangeRespondToTradeOutput,\n ExchangeAddToWatchlistInput,\n ExchangeWatchlistItem,\n ExchangeRemoveFromWatchlistInput,\n ExchangeGetMarketDataInput,\n ExchangeMarketData,\n ExchangeGetCollectionStatsInput,\n ExchangeCollectionStats,\n ExchangeGetInstancesBatchInput,\n ExchangeInstanceDetail,\n ExchangeGetUserProfileInput,\n ExchangeUserProfile,\n} from \"../types-exchange\";\n\n// Re-export all Exchange types\nexport type * from \"../types-exchange\";\n\n// ─── Namespace interface ────────────────────────────────────\n\nexport interface ExchangeNamespace {\n // Marketplace\n /** Browse active marketplace listings with filters for type, GoodZ, condition, price, and sort. */\n browseMarketplace(input?: ExchangeBrowseMarketplaceInput): Promise<ExchangeListing[]>;\n /** Get detailed info about a specific listing. */\n getListingDetail(input: ExchangeGetListingDetailInput): Promise<ExchangeListing>;\n\n // Listing Management\n /** Create a new listing (fixed_price or auction). Core locks the instance atomically. */\n createListing(input: ExchangeCreateListingInput): Promise<ExchangeCreateListingOutput>;\n /** Cancel an active listing. Core unlocks the instance. */\n cancelListing(input: ExchangeCancelListingInput): Promise<any>;\n /** Get your own listings (active, sold, cancelled, expired). */\n getMyListings(input?: ExchangeGetMyListingsInput): Promise<ExchangeListing[]>;\n\n // Purchase & Bidding\n /** Buy a fixed-price listing. Z-coin debit + ownership transfer via Core settlement. */\n buyListing(input: ExchangeBuyListingInput): Promise<ExchangeBuyListingOutput>;\n /** Place a bid on an auction. If bid meets buy-now price, immediate purchase is executed. */\n placeBid(input: ExchangePlaceBidInput): Promise<ExchangePlaceBidOutput>;\n /** Get all bids for an auction listing (highest first). */\n getBids(input: ExchangeGetBidsInput): Promise<ExchangeBid[]>;\n\n // Orders\n /** Get your order history (as buyer and/or seller). */\n getMyOrders(input?: ExchangeGetMyOrdersInput): Promise<ExchangeOrder[]>;\n\n // Want-to-Buy\n /** Create a WTB request — announce what you're looking for. */\n createWtb(input: ExchangeCreateWtbInput): Promise<ExchangeWtb>;\n /** Browse active WTB requests. Sellers can find buyers looking for specific GoodZ. */\n browseWtb(input?: ExchangeBrowseWtbInput): Promise<ExchangeWtb[]>;\n /** Fulfill a WTB request by offering your item. Settlement via Core. */\n fulfillWtb(input: ExchangeFulfillWtbInput): Promise<ExchangeFulfillWtbOutput>;\n /** Cancel your own WTB request. */\n cancelWtb(input: ExchangeCancelWtbInput): Promise<any>;\n\n // P2P Trade\n /** Propose a trade/swap with another user. Optional Z-coin compensation. */\n proposeTrade(input: ExchangeProposeTradeInput): Promise<ExchangeTradeProposal>;\n /** Accept or reject a trade proposal. If accepted, all items transfer via Core. */\n respondToTrade(input: ExchangeRespondToTradeInput): Promise<ExchangeRespondToTradeOutput>;\n\n // Watchlist\n /** Get your watchlist. */\n getWatchlist(): Promise<ExchangeWatchlistItem[]>;\n /** Add a GoodZ or listing to your watchlist. */\n addToWatchlist(input: ExchangeAddToWatchlistInput): Promise<ExchangeWatchlistItem>;\n /** Remove an item from your watchlist. */\n removeFromWatchlist(input: ExchangeRemoveFromWatchlistInput): Promise<any>;\n\n // Market Data\n /** Get market data: price history, floor price, volume, trends. */\n getMarketData(input: ExchangeGetMarketDataInput): Promise<ExchangeMarketData>;\n /** Get marketplace statistics for a specific GoodZ collection. */\n getCollectionStats(input: ExchangeGetCollectionStatsInput): Promise<ExchangeCollectionStats>;\n\n // Batch Lookup\n /** Batch lookup card instances by IDs (max 100). Returns full instance details. */\n getInstancesBatch(input: ExchangeGetInstancesBatchInput): Promise<ExchangeInstanceDetail[]>;\n\n // User Profile\n /** Get a user's public profile. No authentication required. */\n getUserProfile(input: ExchangeGetUserProfileInput): Promise<ExchangeUserProfile>;\n\n /** Call a raw MCP tool by name. Escape hatch for tools not yet in the typed API. */\n rawTool<T = any>(toolName: string, args?: Record<string, any>): Promise<T>;\n}\n\n// ─── Factory ────────────────────────────────────────────────\n\nexport function createExchangeNamespace(transport: TransportConfig): ExchangeNamespace {\n const tool = <I extends Record<string, any>, O>(name: string) =>\n (input?: I) => callMcpTool<I, O>(transport, name, input as I);\n\n return {\n // Marketplace\n browseMarketplace: tool<ExchangeBrowseMarketplaceInput, ExchangeListing[]>(\"browse_marketplace\"),\n getListingDetail: tool<ExchangeGetListingDetailInput, ExchangeListing>(\"get_listing_detail\"),\n\n // Listing Management\n createListing: tool<ExchangeCreateListingInput, ExchangeCreateListingOutput>(\"create_listing\"),\n cancelListing: tool<ExchangeCancelListingInput, any>(\"cancel_listing\"),\n getMyListings: tool<ExchangeGetMyListingsInput, ExchangeListing[]>(\"get_my_listings\"),\n\n // Purchase & Bidding\n buyListing: tool<ExchangeBuyListingInput, ExchangeBuyListingOutput>(\"buy_listing\"),\n placeBid: tool<ExchangePlaceBidInput, ExchangePlaceBidOutput>(\"place_bid\"),\n getBids: tool<ExchangeGetBidsInput, ExchangeBid[]>(\"get_bids\"),\n\n // Orders\n getMyOrders: tool<ExchangeGetMyOrdersInput, ExchangeOrder[]>(\"get_my_orders\"),\n\n // WTB\n createWtb: tool<ExchangeCreateWtbInput, ExchangeWtb>(\"create_wtb\"),\n browseWtb: tool<ExchangeBrowseWtbInput, ExchangeWtb[]>(\"browse_wtb\"),\n fulfillWtb: tool<ExchangeFulfillWtbInput, ExchangeFulfillWtbOutput>(\"fulfill_wtb\"),\n cancelWtb: tool<ExchangeCancelWtbInput, any>(\"cancel_wtb\"),\n\n // P2P Trade\n proposeTrade: tool<ExchangeProposeTradeInput, ExchangeTradeProposal>(\"propose_trade\"),\n respondToTrade: tool<ExchangeRespondToTradeInput, ExchangeRespondToTradeOutput>(\"respond_to_trade\"),\n\n // Watchlist\n getWatchlist: tool<Record<string, never>, ExchangeWatchlistItem[]>(\"get_watchlist\"),\n addToWatchlist: tool<ExchangeAddToWatchlistInput, ExchangeWatchlistItem>(\"add_to_watchlist\"),\n removeFromWatchlist: tool<ExchangeRemoveFromWatchlistInput, any>(\"remove_from_watchlist\"),\n\n // Market Data\n getMarketData: tool<ExchangeGetMarketDataInput, ExchangeMarketData>(\"get_market_data\"),\n getCollectionStats: tool<ExchangeGetCollectionStatsInput, ExchangeCollectionStats>(\"get_collection_stats\"),\n\n // Batch Lookup\n getInstancesBatch: tool<ExchangeGetInstancesBatchInput, ExchangeInstanceDetail[]>(\"get_instances_batch\"),\n\n // User Profile\n getUserProfile: tool<ExchangeGetUserProfileInput, ExchangeUserProfile>(\"get_user_profile\"),\n\n // Raw escape hatch\n rawTool: <T = any>(toolName: string, args?: Record<string, any>) =>\n callMcpTool<Record<string, any>, T>(transport, toolName, args),\n };\n}\n"]}
|
|
@@ -20,7 +20,13 @@ function createCommerceNamespace(transport) {
|
|
|
20
20
|
getCampaignItems: tool("get_campaign_items"),
|
|
21
21
|
// Purchase
|
|
22
22
|
executePurchase: tool("execute_purchase"),
|
|
23
|
+
// Orders
|
|
23
24
|
getMyOrders: tool("get_my_orders"),
|
|
25
|
+
getOrderDetail: tool("get_order_detail"),
|
|
26
|
+
refundOrder: tool("refund_order"),
|
|
27
|
+
cancelOrder: tool("cancel_order"),
|
|
28
|
+
// Wallet / Balance
|
|
29
|
+
getMyBalance: tool("get_my_balance"),
|
|
24
30
|
// Wholesale
|
|
25
31
|
publishToWholesale: tool("publish_to_wholesale"),
|
|
26
32
|
browseWholesale: tool("browse_wholesale_market"),
|
|
@@ -52,5 +58,5 @@ function createCommerceNamespace(transport) {
|
|
|
52
58
|
}
|
|
53
59
|
|
|
54
60
|
export { createCommerceNamespace };
|
|
55
|
-
//# sourceMappingURL=chunk-
|
|
56
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-JXQNSQRK.js.map
|
|
62
|
+
//# sourceMappingURL=chunk-JXQNSQRK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commerce/index.ts"],"names":[],"mappings":";;;AA2KO,SAAS,wBAAwB,SAAA,EAA+C;AACrF,EAAA,MAAM,IAAA,GAAO,CAAmC,IAAA,KAC9C,CAAC,UAAc,WAAA,CAAkB,SAAA,EAAW,MAAM,KAAU,CAAA;AAE9D,EAAA,OAAO;AAAA;AAAA,IAEL,UAAA,EAAY,KAA4C,aAAa,CAAA;AAAA,IACrE,gBAAA,EAAkB,KAA2D,oBAAoB,CAAA;AAAA;AAAA,IAGjG,WAAA,EAAa,KAA8C,gBAAgB,CAAA;AAAA,IAC3E,eAAA,EAAiB,KAAsD,mBAAmB,CAAA;AAAA;AAAA,IAG1F,cAAA,EAAgB,KAAoD,uBAAuB,CAAA;AAAA,IAC3F,gBAAA,EAAkB,KAAsD,mBAAmB,CAAA;AAAA,IAC3F,aAAA,EAAe,KAAmD,gBAAgB,CAAA;AAAA,IAClF,WAAA,EAAa,KAAiD,cAAc,CAAA;AAAA,IAC5E,cAAA,EAAgB,KAAoD,iBAAiB,CAAA;AAAA,IACrF,eAAA,EAAiB,KAAwC,mBAAmB,CAAA;AAAA,IAC5E,gBAAA,EAAkB,KAA4D,oBAAoB,CAAA;AAAA;AAAA,IAGlG,eAAA,EAAiB,KAAuD,kBAAkB,CAAA;AAAA;AAAA,IAG1F,WAAA,EAAa,KAAgD,eAAe,CAAA;AAAA,IAC5E,cAAA,EAAgB,KAAuD,kBAAkB,CAAA;AAAA,IACzF,WAAA,EAAa,KAAoC,cAAc,CAAA;AAAA,IAC/D,WAAA,EAAa,KAAoC,cAAc,CAAA;AAAA;AAAA,IAG/D,YAAA,EAAc,KAAiD,gBAAgB,CAAA;AAAA;AAAA,IAG/E,kBAAA,EAAoB,KAA2C,sBAAsB,CAAA;AAAA,IACrF,eAAA,EAAiB,KAA+D,yBAAyB,CAAA;AAAA,IACzG,YAAA,EAAc,KAAqC,eAAe,CAAA;AAAA;AAAA,IAGlE,eAAA,EAAiB,KAAwC,kBAAkB,CAAA;AAAA,IAC3E,iBAAA,EAAmB,KAA0C,oBAAoB,CAAA;AAAA,IACjF,eAAA,EAAiB,KAAwC,mBAAmB,CAAA;AAAA;AAAA,IAG5E,mBAAA,EAAqB,KAA4C,uBAAuB,CAAA;AAAA;AAAA,IAGxF,iBAAA,EAAmB,KAA4C,oBAAoB,CAAA;AAAA,IACnF,mBAAA,EAAqB,KAA8C,wBAAwB,CAAA;AAAA;AAAA,IAG3F,cAAA,EAAgB,KAAuC,uBAAuB,CAAA;AAAA;AAAA,IAG9E,eAAA,EAAiB,KAAoD,kBAAkB,CAAA;AAAA,IACvF,YAAA,EAAc,KAA+C,eAAe,CAAA;AAAA,IAC5E,WAAA,EAAa,KAAoC,cAAc,CAAA;AAAA,IAC/D,aAAA,EAAe,KAAsC,gBAAgB,CAAA;AAAA;AAAA,IAGrE,WAAA,EAAa,KAAoC,cAAc,CAAA;AAAA,IAC/D,SAAA,EAAW,KAAkC,YAAY,CAAA;AAAA,IACzD,UAAA,EAAY,KAAqC,cAAc,CAAA;AAAA,IAC/D,UAAA,EAAY,KAA+C,cAAc,CAAA;AAAA;AAAA,IAGzE,SAAS,CAAU,QAAA,EAAkB,SACnC,WAAA,CAAoC,SAAA,EAAW,UAAU,IAAI;AAAA,GACjE;AACF","file":"chunk-JXQNSQRK.js","sourcesContent":["/**\n * @goodz-core/sdk — Commerce / Shops Namespace\n *\n * Provides typed access to GoodZ.Commerce MCP tools:\n * shop management, batches, gacha pools, campaigns,\n * wholesale, purchases, orders, settlement, webhooks, and wallet.\n *\n * Aligned with Commerce MCP as of 2026-03-20 (38 tools).\n *\n * @module\n */\n\nimport { callMcpTool } from \"../mcp-transport\";\nimport type { TransportConfig } from \"../mcp-transport\";\nimport type {\n CommerceCreateShopInput,\n CommerceShop,\n CommerceGetShopDashboardInput,\n CommerceShopDashboard,\n CommerceCreateBatchInput,\n CommerceBatch,\n CommerceCreateGachaPoolInput,\n CommerceGachaPool,\n CommerceLaunchCampaignInput,\n CommerceCampaign,\n CommerceActivateCampaignInput,\n CommercePauseCampaignInput,\n CommerceEndCampaignInput,\n CommerceUpdateCampaignInput,\n CommerceGetCampaignInfoInput,\n CommerceGetCampaignItemsInput,\n CommerceCampaignItem,\n CommerceExecutePurchaseInput,\n CommerceDrawResult,\n CommerceGetMyOrdersInput,\n CommerceOrder,\n CommerceGetOrderDetailInput,\n CommerceOrderDetail,\n CommerceRefundOrderInput,\n CommerceCancelOrderInput,\n CommerceGetMyBalanceInput,\n CommerceBalance,\n CommercePublishToWholesaleInput,\n CommerceBrowseWholesaleInput,\n CommerceWholesaleListing,\n CommerceProcureBatchInput,\n CommerceManageInventoryInput,\n CommerceRegisterInstancesInput,\n CommerceMintToInventoryInput,\n CommerceGetSettlementReportInput,\n CommerceSearchMarketplaceInput,\n CommerceGetShopsByBlueprintInput,\n CommerceRedeemPhysicalInput,\n CommerceRegisterWebhookInput,\n CommerceWebhook,\n CommerceTestWebhookInput,\n CommerceDeleteWebhookInput,\n CommerceRegisterAppInput,\n CommerceUpdateAppInput,\n CommerceListMyAppsInput,\n CommerceGetAuthUrlInput,\n} from \"../types-commerce\";\n\n// Re-export all Commerce types\nexport type * from \"../types-commerce\";\n\n// ─── Namespace interface ────────────────────────────────────\n\nexport interface CommerceNamespace {\n // Shop Management\n /** Create a new shop. */\n createShop(input: CommerceCreateShopInput): Promise<CommerceShop>;\n /** Get shop dashboard with stats, revenue, and recent orders. */\n getShopDashboard(input?: CommerceGetShopDashboardInput): Promise<CommerceShopDashboard>;\n\n // Product Assembly\n /** Create a batch (product assembly with tiers). Supports blind_box, ichiban_kuji, direct_sale. */\n createBatch(input: CommerceCreateBatchInput): Promise<CommerceBatch>;\n /** Create a gacha pool with weighted probabilities and optional pity mechanics. */\n createGachaPool(input: CommerceCreateGachaPoolInput): Promise<CommerceGachaPool>;\n\n // Campaign Lifecycle\n /** Launch a sales campaign in draft status. Connect a Batch or Gacha pool to the storefront. */\n launchCampaign(input: CommerceLaunchCampaignInput): Promise<CommerceCampaign>;\n /** Activate a draft/paused campaign — makes it live and purchasable. */\n activateCampaign(input: CommerceActivateCampaignInput): Promise<CommerceCampaign>;\n /** Pause an active campaign. Existing orders unaffected. */\n pauseCampaign(input: CommercePauseCampaignInput): Promise<CommerceCampaign>;\n /** Permanently end a campaign (terminal state). */\n endCampaign(input: CommerceEndCampaignInput): Promise<CommerceCampaign>;\n /** Update campaign configuration (editable fields depend on status). */\n updateCampaign(input: CommerceUpdateCampaignInput): Promise<CommerceCampaign>;\n /** Get detailed campaign info including batch/gacha config and tiers. */\n getCampaignInfo(input: CommerceGetCampaignInfoInput): Promise<any>;\n /** Get unified campaign items list (works for both batch and gacha campaigns). */\n getCampaignItems(input: CommerceGetCampaignItemsInput): Promise<CommerceCampaignItem[]>;\n\n // Purchase / Draw\n /** Execute a purchase or draw. Handles payment, draw mechanics, settlement, and ownership transfer. */\n executePurchase(input: CommerceExecutePurchaseInput): Promise<CommerceDrawResult>;\n\n // Orders\n /** Get the authenticated user's order history (paginated). */\n getMyOrders(input?: CommerceGetMyOrdersInput): Promise<CommerceOrder[]>;\n /** Get detailed information about a single order by ID or order number. */\n getOrderDetail(input: CommerceGetOrderDetailInput): Promise<CommerceOrderDetail>;\n /** Refund a confirmed/paid order. Only the shop owner can refund. */\n refundOrder(input: CommerceRefundOrderInput): Promise<any>;\n /** Cancel a pending order. Only the shop owner can cancel. */\n cancelOrder(input: CommerceCancelOrderInput): Promise<any>;\n\n // Wallet / Balance\n /** Query the user's real Z-coin balance from Core (single source of truth). */\n getMyBalance(input?: CommerceGetMyBalanceInput): Promise<CommerceBalance>;\n\n // Wholesale\n /** Publish a batch to the wholesale market for other shopkeepers to procure. */\n publishToWholesale(input: CommercePublishToWholesaleInput): Promise<any>;\n /** Browse available wholesale listings. */\n browseWholesale(input?: CommerceBrowseWholesaleInput): Promise<CommerceWholesaleListing[]>;\n /** Procure goods from the wholesale market. */\n procureBatch(input: CommerceProcureBatchInput): Promise<any>;\n\n // Inventory\n /** View and manage shop inventory (list or sync from Core). */\n manageInventory(input?: CommerceManageInventoryInput): Promise<any>;\n /** Register existing Core instances into shop inventory. */\n registerInstances(input: CommerceRegisterInstancesInput): Promise<any>;\n /** Mint new instances directly into shop inventory. */\n mintToInventory(input: CommerceMintToInventoryInput): Promise<any>;\n\n // Settlement\n /** Get settlement report with revenue breakdown. */\n getSettlementReport(input?: CommerceGetSettlementReportInput): Promise<any>;\n\n // Discovery\n /** Search the marketplace for campaigns. */\n searchMarketplace(input?: CommerceSearchMarketplaceInput): Promise<any[]>;\n /** Find shops selling a specific GoodZ card. */\n getShopsByBlueprint(input: CommerceGetShopsByBlueprintInput): Promise<any[]>;\n\n // Physical Redemption\n /** Request physical redemption for a purchased item. */\n redeemPhysical(input: CommerceRedeemPhysicalInput): Promise<any>;\n\n // Webhooks\n /** Register a webhook URL to receive shop event notifications. */\n registerWebhook(input: CommerceRegisterWebhookInput): Promise<CommerceWebhook>;\n /** List all registered webhook endpoints. */\n listWebhooks(): Promise<CommerceWebhook[]>;\n /** Send a test ping to a webhook endpoint. */\n testWebhook(input: CommerceTestWebhookInput): Promise<any>;\n /** Delete a webhook endpoint. */\n deleteWebhook(input: CommerceDeleteWebhookInput): Promise<any>;\n\n // OAuth App Management\n /** Register a new OAuth application with Commerce scopes. */\n registerApp(input: CommerceRegisterAppInput): Promise<any>;\n /** Update an existing OAuth application. */\n updateApp(input: CommerceUpdateAppInput): Promise<any>;\n /** List all OAuth applications owned by the user. */\n listMyApps(input?: CommerceListMyAppsInput): Promise<any[]>;\n /** Generate an OAuth authorization URL. */\n getAuthUrl(input?: CommerceGetAuthUrlInput): Promise<{ url: string }>;\n\n /** Call a raw MCP tool by name. Escape hatch for tools not yet in the typed API. */\n rawTool<T = any>(toolName: string, args?: Record<string, any>): Promise<T>;\n}\n\n// ─── Factory ────────────────────────────────────────────────\n\nexport function createCommerceNamespace(transport: TransportConfig): CommerceNamespace {\n const tool = <I extends Record<string, any>, O>(name: string) =>\n (input?: I) => callMcpTool<I, O>(transport, name, input as I);\n\n return {\n // Shop\n createShop: tool<CommerceCreateShopInput, CommerceShop>(\"create_shop\"),\n getShopDashboard: tool<CommerceGetShopDashboardInput, CommerceShopDashboard>(\"get_shop_dashboard\"),\n\n // Product Assembly\n createBatch: tool<CommerceCreateBatchInput, CommerceBatch>(\"assemble_batch\"),\n createGachaPool: tool<CommerceCreateGachaPoolInput, CommerceGachaPool>(\"create_gacha_pool\"),\n\n // Campaign Lifecycle\n launchCampaign: tool<CommerceLaunchCampaignInput, CommerceCampaign>(\"launch_sales_campaign\"),\n activateCampaign: tool<CommerceActivateCampaignInput, CommerceCampaign>(\"activate_campaign\"),\n pauseCampaign: tool<CommercePauseCampaignInput, CommerceCampaign>(\"pause_campaign\"),\n endCampaign: tool<CommerceEndCampaignInput, CommerceCampaign>(\"end_campaign\"),\n updateCampaign: tool<CommerceUpdateCampaignInput, CommerceCampaign>(\"update_campaign\"),\n getCampaignInfo: tool<CommerceGetCampaignInfoInput, any>(\"get_campaign_info\"),\n getCampaignItems: tool<CommerceGetCampaignItemsInput, CommerceCampaignItem[]>(\"get_campaign_items\"),\n\n // Purchase\n executePurchase: tool<CommerceExecutePurchaseInput, CommerceDrawResult>(\"execute_purchase\"),\n\n // Orders\n getMyOrders: tool<CommerceGetMyOrdersInput, CommerceOrder[]>(\"get_my_orders\"),\n getOrderDetail: tool<CommerceGetOrderDetailInput, CommerceOrderDetail>(\"get_order_detail\"),\n refundOrder: tool<CommerceRefundOrderInput, any>(\"refund_order\"),\n cancelOrder: tool<CommerceCancelOrderInput, any>(\"cancel_order\"),\n\n // Wallet / Balance\n getMyBalance: tool<CommerceGetMyBalanceInput, CommerceBalance>(\"get_my_balance\"),\n\n // Wholesale\n publishToWholesale: tool<CommercePublishToWholesaleInput, any>(\"publish_to_wholesale\"),\n browseWholesale: tool<CommerceBrowseWholesaleInput, CommerceWholesaleListing[]>(\"browse_wholesale_market\"),\n procureBatch: tool<CommerceProcureBatchInput, any>(\"procure_batch\"),\n\n // Inventory\n manageInventory: tool<CommerceManageInventoryInput, any>(\"manage_inventory\"),\n registerInstances: tool<CommerceRegisterInstancesInput, any>(\"register_instances\"),\n mintToInventory: tool<CommerceMintToInventoryInput, any>(\"mint_to_inventory\"),\n\n // Settlement\n getSettlementReport: tool<CommerceGetSettlementReportInput, any>(\"get_settlement_report\"),\n\n // Discovery\n searchMarketplace: tool<CommerceSearchMarketplaceInput, any[]>(\"search_marketplace\"),\n getShopsByBlueprint: tool<CommerceGetShopsByBlueprintInput, any[]>(\"get_shops_by_blueprint\"),\n\n // Physical Redemption\n redeemPhysical: tool<CommerceRedeemPhysicalInput, any>(\"redeem_physical_goodz\"),\n\n // Webhooks\n registerWebhook: tool<CommerceRegisterWebhookInput, CommerceWebhook>(\"register_webhook\"),\n listWebhooks: tool<Record<string, never>, CommerceWebhook[]>(\"list_webhooks\"),\n testWebhook: tool<CommerceTestWebhookInput, any>(\"test_webhook\"),\n deleteWebhook: tool<CommerceDeleteWebhookInput, any>(\"delete_webhook\"),\n\n // OAuth App\n registerApp: tool<CommerceRegisterAppInput, any>(\"register_app\"),\n updateApp: tool<CommerceUpdateAppInput, any>(\"update_app\"),\n listMyApps: tool<CommerceListMyAppsInput, any[]>(\"list_my_apps\"),\n getAuthUrl: tool<CommerceGetAuthUrlInput, { url: string }>(\"get_auth_url\"),\n\n // Raw escape hatch\n rawTool: <T = any>(toolName: string, args?: Record<string, any>) =>\n callMcpTool<Record<string, any>, T>(transport, toolName, args),\n };\n}\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { createCommerceNamespace } from './chunk-
|
|
2
|
-
import { createExchangeNamespace } from './chunk-
|
|
1
|
+
import { createCommerceNamespace } from './chunk-JXQNSQRK.js';
|
|
2
|
+
import { createExchangeNamespace } from './chunk-BMJFLMIR.js';
|
|
3
3
|
import { createAliveNamespace } from './chunk-KP7DP5LP.js';
|
|
4
4
|
import { createMcpTransportConfig, callMutation, callQuery } from './chunk-ORUFMYZB.js';
|
|
5
5
|
|
|
6
6
|
// src/core/index.ts
|
|
7
7
|
var DEFAULT_CORE_URL = "https://goodzcore.manus.space";
|
|
8
|
-
var DEFAULT_COMMERCE_URL = "https://
|
|
9
|
-
var DEFAULT_EXCHANGE_URL = "https://
|
|
10
|
-
var DEFAULT_ALIVE_URL = "https://
|
|
8
|
+
var DEFAULT_COMMERCE_URL = "https://goodz-commerce.manus.space";
|
|
9
|
+
var DEFAULT_EXCHANGE_URL = "https://goodz-exchange.manus.space";
|
|
10
|
+
var DEFAULT_ALIVE_URL = "https://goodz-alive.manus.space";
|
|
11
11
|
function createGoodZClient(config = {}) {
|
|
12
12
|
const {
|
|
13
13
|
coreUrl = DEFAULT_CORE_URL,
|
|
@@ -99,5 +99,5 @@ function createGoodZClient(config = {}) {
|
|
|
99
99
|
var createUserClient = createGoodZClient;
|
|
100
100
|
|
|
101
101
|
export { createGoodZClient, createUserClient };
|
|
102
|
-
//# sourceMappingURL=chunk-
|
|
103
|
-
//# sourceMappingURL=chunk-
|
|
102
|
+
//# sourceMappingURL=chunk-U4JS2SP3.js.map
|
|
103
|
+
//# sourceMappingURL=chunk-U4JS2SP3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;AA0HA,IAAM,gBAAA,GAAmB,+BAAA;AACzB,IAAM,oBAAA,GAAuB,oCAAA;AAC7B,IAAM,oBAAA,GAAuB,oCAAA;AAC7B,IAAM,iBAAA,GAAoB,iCAAA;AAuSnB,SAAS,iBAAA,CAAkB,MAAA,GAA4B,EAAC,EAAgB;AAC7E,EAAA,MAAM;AAAA,IACJ,OAAA,GAAU,gBAAA;AAAA,IACV,WAAA,GAAc,oBAAA;AAAA,IACd,WAAA,GAAc,oBAAA;AAAA,IACd,QAAA,GAAW,iBAAA;AAAA,IACX,WAAA;AAAA,IACA,cAAA;AAAA,IACA,OAAA,EAAS;AAAA,GACX,GAAI,MAAA;AAGJ,EAAA,MAAM,eAAe,YAA6C;AAChE,IAAA,MAAM,CAAA,GAA4B,EAAE,GAAG,aAAA,EAAc;AACrD,IAAA,MAAM,KAAA,GAAQ,cAAA,GAAiB,MAAM,cAAA,EAAe,GAAI,WAAA;AACxD,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,CAAA,CAAE,eAAe,CAAA,GAAI,CAAA,OAAA,EAAU,KAAK,CAAA,CAAA;AAAA,IACtC;AACA,IAAA,OAAO,CAAA;AAAA,EACT,CAAA;AAGA,EAAA,MAAM,aAAA,GAAiC;AAAA,IACrC,OAAA,EAAS,OAAA,CAAQ,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAA;AAAA,IAClC,UAAA,EAAY;AAAA,GACd;AAGA,EAAA,MAAM,iBAAA,GAAoB,wBAAA,CAAyB,WAAA,EAAa,YAAY,CAAA;AAC5E,EAAA,MAAM,iBAAA,GAAoB,wBAAA,CAAyB,WAAA,EAAa,YAAY,CAAA;AAC5E,EAAA,MAAM,cAAA,GAAiB,wBAAA,CAAyB,QAAA,EAAU,YAAY,CAAA;AAGtE,EAAA,MAAM,CAAA,GAAI,CAAO,IAAA,KAAiB,CAAC,UAAc,SAAA,CAAgB,aAAA,EAAe,MAAM,KAAK,CAAA;AAC3F,EAAA,MAAM,CAAA,GAAI,CAAO,IAAA,KAAiB,CAAC,UAAc,YAAA,CAAmB,aAAA,EAAe,MAAM,KAAK,CAAA;AAE9F,EAAA,OAAO;AAAA;AAAA,IAEL,KAAA,EAAO;AAAA,MACL,YAAA,EAAc,EAAiC,oBAAoB,CAAA;AAAA,MACnE,YAAA,EAAc,EAAiC,oBAAoB,CAAA;AAAA,MACnE,kBAAA,EAAoB,EAAuD,0BAA0B,CAAA;AAAA,MACrG,kBAAA,EAAoB,EAA+D,0BAA0B,CAAA;AAAA,MAC7G,gBAAA,EAAkB,EAA2D,wBAAwB,CAAA;AAAA,MACrG,aAAA,EAAe,EAAqD,qBAAqB,CAAA;AAAA,MACzF,kBAAA,EAAoB,EAA+D,0BAA0B,CAAA;AAAA,MAC7G,aAAA,EAAe,EAAqD,qBAAqB,CAAA;AAAA,MACzF,UAAA,EAAY,EAA+C,kBAAkB,CAAA;AAAA,MAC7E,yBAAA,EAA2B,EAA6E,iCAAiC;AAAA,KAC3I;AAAA;AAAA,IAGA,SAAA,EAAW;AAAA,MACT,gBAAA,EAAkB,EAAmD,4BAA4B,CAAA;AAAA,MACjG,gBAAA,EAAkB,EAAmE,4BAA4B,CAAA;AAAA,MACjH,IAAA,EAAM,EAA2C,gBAAgB,CAAA;AAAA,MACjE,QAAA,EAAU,EAAmD,oBAAoB,CAAA;AAAA,MACjF,cAAA,EAAgB,EAA+D,0BAA0B,CAAA;AAAA,MACzG,aAAA,EAAe,EAAoC,yBAAyB,CAAA;AAAA,MAC5E,eAAA,EAAiB,EAAwC,2BAA2B;AAAA,KACtF;AAAA;AAAA,IAGA,WAAA,EAAa;AAAA,MACX,eAAA,EAAiB,EAAwC,6BAA6B,CAAA;AAAA,MACtF,iBAAA,EAAmB,EAA0C,+BAA+B,CAAA;AAAA,MAC5F,uBAAA,EAAyB,EAAkD,qCAAqC,CAAA;AAAA,MAChH,cAAA,EAAgB,EAAuC,4BAA4B,CAAA;AAAA,MACnF,gBAAA,EAAkB,EAAyC,8BAA8B;AAAA,KAC3F;AAAA;AAAA,IAGA,IAAA,EAAM;AAAA,MACJ,gBAAA,EAAkB,EAAgD,uBAAuB,CAAA;AAAA,MACzF,oBAAA,EAAsB,EAAoD,2BAA2B;AAAA,KACvG;AAAA;AAAA,IAGA,IAAA,EAAM;AAAA,MACJ,EAAA,EAAI,EAAyB,SAAS,CAAA;AAAA,MACtC,eAAA,EAAiB,EAAqD,sBAAsB;AAAA,KAC9F;AAAA;AAAA,IAGA,EAAA,EAAI;AAAA,MACF,YAAA,EAAc,EAA0B,eAAe,CAAA;AAAA,MACvD,SAAA,EAAW,EAAuB,YAAY,CAAA;AAAA,MAC9C,qBAAA,EAAuB,EAAqC,wBAAwB,CAAA;AAAA,MACpF,OAAA,EAAS,EAAqB,UAAU,CAAA;AAAA,MACxC,iBAAA,EAAmB,EAAgC,mBAAmB;AAAA,KACxE;AAAA;AAAA,IAGA,QAAA,EAAU,wBAAwB,iBAAiB,CAAA;AAAA;AAAA,IAGnD,QAAA,EAAU,wBAAwB,iBAAiB,CAAA;AAAA;AAAA,IAGnD,KAAA,EAAO,qBAAqB,cAAc,CAAA;AAAA;AAAA,IAG1C,UAAU,CAAU,IAAA,EAAc,UAAgB,SAAA,CAAkB,aAAA,EAAe,MAAM,KAAK,CAAA;AAAA,IAC9F,aAAa,CAAU,IAAA,EAAc,UAAgB,YAAA,CAAqB,aAAA,EAAe,MAAM,KAAK;AAAA,GACtG;AACF;AAMO,IAAM,gBAAA,GAAmB","file":"chunk-U4JS2SP3.js","sourcesContent":["/**\n * @goodz-core/sdk/core — Unified GoodZ API Client\n *\n * One client, all services. Stripe-style namespace architecture:\n * goodz.zcoin.* → Core settlement & Z-coin\n * goodz.inventory.* → Core instance management\n * goodz.collectible.* → Core card queries\n * goodz.user.* → Core user profiles\n * goodz.auth.* → Core auth\n * goodz.ip.* → Core IP (franchise/series/card)\n * goodz.commerce.* → Commerce/Shops (MCP)\n * goodz.exchange.* → Exchange marketplace (MCP)\n * goodz.alive.* → Alive companions (MCP)\n *\n * Core uses tRPC HTTP wire protocol; sub-sites use MCP JSON-RPC 2.0.\n * The client handles routing transparently.\n *\n * @example\n * ```ts\n * import { createGoodZClient } from \"@goodz-core/sdk\";\n *\n * const goodz = createGoodZClient({\n * accessToken: \"your-jwt-token\",\n * });\n *\n * // Core APIs\n * const balance = await goodz.zcoin.getMyBalance();\n * const result = await goodz.zcoin.commercialTransfer({ ... });\n *\n * // Commerce APIs\n * const shop = await goodz.commerce.createShop({ name: \"My Shop\" });\n * const order = await goodz.commerce.executePurchase({ campaignId: 1, quantity: 1 });\n *\n * // Exchange APIs\n * const listing = await goodz.exchange.createListing({ ... });\n * const data = await goodz.exchange.getMarketData({ coreGoodzId: 42 });\n *\n * // Alive APIs\n * const chat = await goodz.alive.sendMessage({ instanceId: 1, userId: 1, message: \"Hello!\" });\n * const memories = await goodz.alive.recallMemories({ instanceId: 1, userId: 1, query: \"birthday\" });\n * ```\n *\n * @module\n */\n\nimport { callQuery, callMutation, GoodZApiError } from \"../transport\";\nimport type { TransportConfig } from \"../transport\";\nimport { createMcpTransportConfig } from \"../mcp-transport\";\nimport { createCommerceNamespace } from \"../commerce/index\";\nimport type { CommerceNamespace } from \"../commerce/index\";\nimport { createExchangeNamespace } from \"../exchange/index\";\nimport type { ExchangeNamespace } from \"../exchange/index\";\nimport { createAliveNamespace } from \"../alive/index\";\nimport type { AliveNamespace } from \"../alive/index\";\nimport type {\n // zcoin\n ZcoinGetMyBalanceOutput,\n ZcoinGetMyHistoryInput,\n ZcoinCommercialTransferInput,\n ZcoinCommercialTransferOutput,\n ZcoinMintAndChargeInput,\n ZcoinMintAndChargeOutput,\n ZcoinChargeUserInput,\n ZcoinChargeUserOutput,\n ZcoinCreateDirectPurchaseOrderInput,\n ZcoinCreateDirectPurchaseOrderOutput,\n ZcoinGetDepositPackagesInput,\n ZcoinDepositPackage,\n ZcoinCreateDepositOrderInput,\n ZcoinCreateDepositOrderOutput,\n ZcoinGetDepositStatusInput,\n ZcoinGetDepositStatusOutput,\n ZcoinGetDepositUrlInput,\n ZcoinGetDepositUrlOutput,\n // inventory\n InventoryGetUserInventoryInput,\n InventoryItem,\n InventoryConfirmOwnershipInput,\n InventoryConfirmOwnershipOutput,\n InventoryMintInput,\n InventoryMintOutput,\n InventoryTransferInput,\n InventoryTransferOutput,\n InventoryTransferByCardInput,\n InventoryTransferByCardOutput,\n InventoryGrantMintAuthInput,\n InventoryTransferHistoryInput,\n // collectible\n CollectibleGetInstanceByIdInput,\n CollectibleGetPublicInstanceInput,\n CollectibleGetPublicInstancesBatchInput,\n CollectibleGetCardProfileInput,\n CollectibleGetShellImageUrlInput,\n // user\n UserGetPublicProfileInput,\n UserPublicProfile,\n UserGetPublicProfileByIdInput,\n // auth\n AuthGetOAuthAppInfoInput,\n AuthOAuthAppInfo,\n AuthUser,\n // ip\n FranchiseGetInput,\n SeriesGetInput,\n SeriesListByFranchiseInput,\n CardGetInput,\n CardListBySeriesInput,\n} from \"../types\";\n\n// ─── Re-export types and error class ─────────────────────────\n\nexport { GoodZApiError } from \"../transport\";\nexport type * from \"../types\";\nexport type * from \"../types-commerce\";\nexport type * from \"../types-exchange\";\nexport type * from \"../types-alive\";\nexport type { CommerceNamespace } from \"../commerce/index\";\nexport type { ExchangeNamespace } from \"../exchange/index\";\nexport type { AliveNamespace } from \"../alive/index\";\n\n// ─── Default sub-site URLs ──────────────────────────────────\n\nconst DEFAULT_CORE_URL = \"https://goodzcore.manus.space\";\nconst DEFAULT_COMMERCE_URL = \"https://goodz-commerce.manus.space\";\nconst DEFAULT_EXCHANGE_URL = \"https://goodz-exchange.manus.space\";\nconst DEFAULT_ALIVE_URL = \"https://goodz-alive.manus.space\";\n\n// ─── Client config ───────────────────────────────────────────\n\nexport interface GoodZClientConfig {\n /**\n * GoodZ.Core base URL.\n * @default \"https://goodzcore.manus.space\"\n */\n coreUrl?: string;\n\n /**\n * GoodZ.Commerce (Shops) base URL.\n * @default \"https://goodz-commerce.manus.space\"\n */\n commerceUrl?: string;\n\n /**\n * GoodZ.Exchange base URL.\n * @default \"https://goodz-exchange.manus.space\"\n */\n exchangeUrl?: string;\n\n /**\n * GoodZ.Alive base URL.\n * @default \"https://goodz-alive.manus.space\"\n */\n aliveUrl?: string;\n\n /**\n * Static access token (JWT) for authentication.\n * For server-to-server calls, obtain this via OAuth client_credentials flow.\n * For user-context calls, pass the user's access token.\n */\n accessToken?: string;\n\n /**\n * Dynamic token provider — called before every request.\n * Use this when tokens may rotate (e.g., auto-refresh).\n * Takes precedence over `accessToken` if both are set.\n */\n getAccessToken?: () => string | Promise<string>;\n\n /**\n * Custom headers to include in every request.\n * Useful for passing app identifiers or tracing headers.\n */\n headers?: Record<string, string>;\n}\n\n// ─── Core namespace interfaces (tRPC) ───────────────────────\n\nexport interface ZcoinNamespace {\n /** Get the authenticated user's Z-coin balance. */\n getMyBalance(): Promise<ZcoinGetMyBalanceOutput>;\n\n /** Get the authenticated user's Z-coin transaction history. */\n getMyHistory(input?: ZcoinGetMyHistoryInput): Promise<any[]>;\n\n /** Get available Z-coin deposit packages with pricing. */\n getDepositPackages(input?: ZcoinGetDepositPackagesInput): Promise<ZcoinDepositPackage[]>;\n\n /** Create a Stripe checkout session for Z-coin deposit. */\n createDepositOrder(input: ZcoinCreateDepositOrderInput): Promise<ZcoinCreateDepositOrderOutput>;\n\n /** Check the status of a deposit checkout session. */\n getDepositStatus(input: ZcoinGetDepositStatusInput): Promise<ZcoinGetDepositStatusOutput>;\n\n /**\n * Generate a deposit deep link URL for Z-coin top-up.\n * Returns a URL that redirects users to Core's deposit page.\n * After completing the deposit, the user is redirected back to returnUrl.\n *\n * No authentication required — anyone can generate a deposit URL.\n *\n * @example\n * ```ts\n * const { url } = await goodz.zcoin.getDepositUrl({\n * amount: 100,\n * returnUrl: \"https://myapp.com/shop\",\n * appId: \"od_myapp\",\n * });\n * window.open(url, \"_blank\");\n * ```\n */\n getDepositUrl(input?: ZcoinGetDepositUrlInput): Promise<ZcoinGetDepositUrlOutput>;\n\n /**\n * Atomic commercial transfer: Z-coin payment + ownership transfer in one transaction.\n * This is the primary API for Commerce and Exchange purchase flows.\n *\n * Idempotent via referenceId — duplicate calls return the same result.\n *\n * @throws {GoodZApiError} INSUFFICIENT_BALANCE — use `e.isInsufficientBalance()` to detect,\n * `e.depositUrl` to get the top-up redirect URL\n * @throws {GoodZApiError} CONFLICT — version conflict (retry)\n * @throws {GoodZApiError} FORBIDDEN — seller doesn't own instance\n */\n commercialTransfer(input: ZcoinCommercialTransferInput): Promise<ZcoinCommercialTransferOutput>;\n\n /**\n * Mint a new card instance and charge the buyer in one atomic transaction.\n * Used by Commerce for gacha and direct-from-creator purchases.\n *\n * Requires mint authorization (granted via inventory.grantMintAuth).\n * Idempotent via referenceId.\n *\n * @throws {GoodZApiError} FORBIDDEN — no mint authorization\n * @throws {GoodZApiError} INSUFFICIENT_BALANCE — use `e.isInsufficientBalance()` to detect,\n * `e.depositUrl` to get the top-up redirect URL\n */\n mintAndCharge(input: ZcoinMintAndChargeInput): Promise<ZcoinMintAndChargeOutput>;\n\n /**\n * Charge a user's Z-coin balance for an in-app purchase.\n * Used by apps that sell non-GoodZ digital goods/services.\n *\n * Idempotent via appOrderId.\n *\n * @throws {GoodZApiError} INSUFFICIENT_BALANCE — use `e.isInsufficientBalance()` to detect,\n * `e.depositUrl` to get the top-up redirect URL\n * @throws {GoodZApiError} CONFLICT — version conflict\n */\n chargeUser(input: ZcoinChargeUserInput): Promise<ZcoinChargeUserOutput>;\n\n /**\n * Create a direct purchase checkout session (fiat → Z-coin → transfer).\n * Transparent intermediation: user sees fiat price, Core handles conversion.\n */\n createDirectPurchaseOrder(input: ZcoinCreateDirectPurchaseOrderInput): Promise<ZcoinCreateDirectPurchaseOrderOutput>;\n}\n\nexport interface InventoryNamespace {\n /** Get a user's inventory (owned card instances). */\n getUserInventory(input: InventoryGetUserInventoryInput): Promise<InventoryItem[]>;\n\n /** Check if a user owns at least one instance of a specific card. */\n confirmOwnership(input: InventoryConfirmOwnershipInput): Promise<InventoryConfirmOwnershipOutput>;\n\n /**\n * Mint new card instances. Requires franchise ownership or admin role.\n * For Commerce/Exchange, use zcoin.mintAndCharge instead (includes payment).\n */\n mint(input: InventoryMintInput): Promise<InventoryMintOutput>;\n\n /**\n * Transfer a specific card instance to another user.\n * For commercial transfers, use zcoin.commercialTransfer instead.\n *\n * @deprecated for reason=\"purchase\"|\"trade\" — use commercialTransfer\n */\n transfer(input: InventoryTransferInput): Promise<InventoryTransferOutput>;\n\n /**\n * Transfer card instances by cardId (transfers oldest instances).\n * For commercial transfers, use zcoin.commercialTransfer instead.\n *\n * @deprecated for reason=\"purchase\"|\"trade\" — use commercialTransfer\n */\n transferByCard(input: InventoryTransferByCardInput): Promise<InventoryTransferByCardOutput>;\n\n /**\n * Grant mint authorization to another user/app for a specific card.\n * Required before Commerce can call zcoin.mintAndCharge for that card.\n */\n grantMintAuth(input: InventoryGrantMintAuthInput): Promise<any>;\n\n /** Get transfer/ownership history for an instance, card, or user. */\n transferHistory(input: InventoryTransferHistoryInput): Promise<any[]>;\n}\n\nexport interface CollectibleNamespace {\n /** Get a card instance by its numeric ID. Returns full instance data with card chain. */\n getInstanceById(input: CollectibleGetInstanceByIdInput): Promise<any>;\n\n /** Get a card instance by its instance code (public-facing identifier). */\n getPublicInstance(input: CollectibleGetPublicInstanceInput): Promise<any>;\n\n /** Batch-fetch multiple card instances by their IDs (max 100). */\n getPublicInstancesBatch(input: CollectibleGetPublicInstancesBatchInput): Promise<any[]>;\n\n /** Get the card profile (metadata, rarity, series info). */\n getCardProfile(input: CollectibleGetCardProfileInput): Promise<any>;\n\n /** Get the shell (packaging) image URL for a card. */\n getShellImageUrl(input: CollectibleGetShellImageUrlInput): Promise<any>;\n}\n\nexport interface UserNamespace {\n /** Get a user's public profile by openId. */\n getPublicProfile(input: UserGetPublicProfileInput): Promise<UserPublicProfile>;\n\n /** Get a user's public profile by internal userId. */\n getPublicProfileById(input: UserGetPublicProfileByIdInput): Promise<UserPublicProfile>;\n}\n\nexport interface AuthNamespace {\n /** Get the authenticated user's profile. Returns null if not authenticated. */\n me(): Promise<AuthUser | null>;\n\n /** Get public info about an OAuth app by its client ID. */\n getOAuthAppInfo(input: AuthGetOAuthAppInfoInput): Promise<AuthOAuthAppInfo | null>;\n}\n\nexport interface IpNamespace {\n /** Get a franchise by ID or slug. */\n getFranchise(input: FranchiseGetInput): Promise<any>;\n\n /** Get a series by ID or slug. */\n getSeries(input: SeriesGetInput): Promise<any>;\n\n /** List all series in a franchise. */\n listSeriesByFranchise(input: SeriesListByFranchiseInput): Promise<any[]>;\n\n /** Get a card by ID. */\n getCard(input: CardGetInput): Promise<any>;\n\n /** List all cards in a series. */\n listCardsBySeries(input: CardListBySeriesInput): Promise<any[]>;\n}\n\n// ─── GoodZClient type ────────────────────────────────────────\n\nexport interface GoodZClient {\n // ── Core namespaces (tRPC) ──\n readonly zcoin: ZcoinNamespace;\n readonly inventory: InventoryNamespace;\n readonly collectible: CollectibleNamespace;\n readonly user: UserNamespace;\n readonly auth: AuthNamespace;\n readonly ip: IpNamespace;\n\n // ── Sub-site namespaces (MCP) ──\n readonly commerce: CommerceNamespace;\n readonly exchange: ExchangeNamespace;\n readonly alive: AliveNamespace;\n\n /**\n * Make a raw tRPC query call to Core. Use this for routes not yet covered\n * by the typed namespaces.\n */\n rawQuery<T = any>(path: string, input?: any): Promise<T>;\n\n /**\n * Make a raw tRPC mutation call to Core. Use this for routes not yet covered\n * by the typed namespaces.\n */\n rawMutation<T = any>(path: string, input?: any): Promise<T>;\n}\n\n// ─── Client factory ──────────────────────────────────────────\n\n/**\n * Create a unified GoodZ API client — one client for all services.\n *\n * @example Server-to-server with static token\n * ```ts\n * const goodz = createGoodZClient({\n * accessToken: process.env.CORE_ACCESS_TOKEN,\n * });\n *\n * // Core\n * const balance = await goodz.zcoin.getMyBalance();\n *\n * // Commerce\n * const shop = await goodz.commerce.createShop({ name: \"My Shop\" });\n *\n * // Exchange\n * const listings = await goodz.exchange.browseMarketplace();\n *\n * // Alive\n * const chat = await goodz.alive.sendMessage({ instanceId: 1, userId: 1, message: \"Hi!\" });\n * ```\n *\n * @example With dynamic token provider (auto-refresh)\n * ```ts\n * const goodz = createGoodZClient({\n * getAccessToken: async () => {\n * const token = await refreshTokenIfNeeded();\n * return token;\n * },\n * });\n * ```\n *\n * @example Custom sub-site URLs (e.g., staging environment)\n * ```ts\n * const goodz = createGoodZClient({\n * accessToken: \"...\",\n * coreUrl: \"https://staging-core.goodz.dev\",\n * commerceUrl: \"https://staging-commerce.goodz.dev\",\n * exchangeUrl: \"https://staging-exchange.goodz.dev\",\n * aliveUrl: \"https://staging-alive.goodz.dev\",\n * });\n * ```\n */\nexport function createGoodZClient(config: GoodZClientConfig = {}): GoodZClient {\n const {\n coreUrl = DEFAULT_CORE_URL,\n commerceUrl = DEFAULT_COMMERCE_URL,\n exchangeUrl = DEFAULT_EXCHANGE_URL,\n aliveUrl = DEFAULT_ALIVE_URL,\n accessToken,\n getAccessToken,\n headers: customHeaders,\n } = config;\n\n // Shared header builder — used by both tRPC and MCP transports\n const buildHeaders = async (): Promise<Record<string, string>> => {\n const h: Record<string, string> = { ...customHeaders };\n const token = getAccessToken ? await getAccessToken() : accessToken;\n if (token) {\n h[\"Authorization\"] = `Bearer ${token}`;\n }\n return h;\n };\n\n // ── Core transport (tRPC) ──\n const coreTransport: TransportConfig = {\n baseUrl: coreUrl.replace(/\\/$/, \"\"),\n getHeaders: buildHeaders,\n };\n\n // ── Sub-site transports (MCP) ──\n const commerceTransport = createMcpTransportConfig(commerceUrl, buildHeaders);\n const exchangeTransport = createMcpTransportConfig(exchangeUrl, buildHeaders);\n const aliveTransport = createMcpTransportConfig(aliveUrl, buildHeaders);\n\n // Helper shortcuts for Core tRPC\n const q = <I, O>(path: string) => (input?: I) => callQuery<I, O>(coreTransport, path, input);\n const m = <I, O>(path: string) => (input?: I) => callMutation<I, O>(coreTransport, path, input);\n\n return {\n // ── zcoin ──────────────────────────────────────────────\n zcoin: {\n getMyBalance: q<void, ZcoinGetMyBalanceOutput>(\"zcoin.getMyBalance\"),\n getMyHistory: q<ZcoinGetMyHistoryInput, any[]>(\"zcoin.getMyHistory\"),\n getDepositPackages: q<ZcoinGetDepositPackagesInput, ZcoinDepositPackage[]>(\"zcoin.getDepositPackages\"),\n createDepositOrder: m<ZcoinCreateDepositOrderInput, ZcoinCreateDepositOrderOutput>(\"zcoin.createDepositOrder\"),\n getDepositStatus: q<ZcoinGetDepositStatusInput, ZcoinGetDepositStatusOutput>(\"zcoin.getDepositStatus\"),\n getDepositUrl: q<ZcoinGetDepositUrlInput, ZcoinGetDepositUrlOutput>(\"zcoin.getDepositUrl\"),\n commercialTransfer: m<ZcoinCommercialTransferInput, ZcoinCommercialTransferOutput>(\"zcoin.commercialTransfer\"),\n mintAndCharge: m<ZcoinMintAndChargeInput, ZcoinMintAndChargeOutput>(\"zcoin.mintAndCharge\"),\n chargeUser: m<ZcoinChargeUserInput, ZcoinChargeUserOutput>(\"zcoin.chargeUser\"),\n createDirectPurchaseOrder: m<ZcoinCreateDirectPurchaseOrderInput, ZcoinCreateDirectPurchaseOrderOutput>(\"zcoin.createDirectPurchaseOrder\"),\n },\n\n // ── inventory ──────────────────────────────────────────\n inventory: {\n getUserInventory: q<InventoryGetUserInventoryInput, InventoryItem[]>(\"inventory.getUserInventory\"),\n confirmOwnership: q<InventoryConfirmOwnershipInput, InventoryConfirmOwnershipOutput>(\"inventory.confirmOwnership\"),\n mint: m<InventoryMintInput, InventoryMintOutput>(\"inventory.mint\"),\n transfer: m<InventoryTransferInput, InventoryTransferOutput>(\"inventory.transfer\"),\n transferByCard: m<InventoryTransferByCardInput, InventoryTransferByCardOutput>(\"inventory.transferByCard\"),\n grantMintAuth: m<InventoryGrantMintAuthInput, any>(\"inventory.grantMintAuth\"),\n transferHistory: q<InventoryTransferHistoryInput, any[]>(\"inventory.transferHistory\"),\n },\n\n // ── collectible ────────────────────────────────────────\n collectible: {\n getInstanceById: q<CollectibleGetInstanceByIdInput, any>(\"collectible.getInstanceById\"),\n getPublicInstance: q<CollectibleGetPublicInstanceInput, any>(\"collectible.getPublicInstance\"),\n getPublicInstancesBatch: q<CollectibleGetPublicInstancesBatchInput, any[]>(\"collectible.getPublicInstancesBatch\"),\n getCardProfile: q<CollectibleGetCardProfileInput, any>(\"collectible.getCardProfile\"),\n getShellImageUrl: q<CollectibleGetShellImageUrlInput, any>(\"collectible.getShellImageUrl\"),\n },\n\n // ── user ───────────────────────────────────────────────\n user: {\n getPublicProfile: q<UserGetPublicProfileInput, UserPublicProfile>(\"user.getPublicProfile\"),\n getPublicProfileById: q<UserGetPublicProfileByIdInput, UserPublicProfile>(\"user.getPublicProfileById\"),\n },\n\n // ── auth ───────────────────────────────────────────────\n auth: {\n me: q<void, AuthUser | null>(\"auth.me\"),\n getOAuthAppInfo: q<AuthGetOAuthAppInfoInput, AuthOAuthAppInfo | null>(\"auth.getOAuthAppInfo\"),\n },\n\n // ── ip (franchise/series/card) ─────────────────────────\n ip: {\n getFranchise: q<FranchiseGetInput, any>(\"franchise.get\"),\n getSeries: q<SeriesGetInput, any>(\"series.get\"),\n listSeriesByFranchise: q<SeriesListByFranchiseInput, any[]>(\"series.listByFranchise\"),\n getCard: q<CardGetInput, any>(\"card.get\"),\n listCardsBySeries: q<CardListBySeriesInput, any[]>(\"card.listBySeries\"),\n },\n\n // ── commerce (MCP) ─────────────────────────────────────\n commerce: createCommerceNamespace(commerceTransport),\n\n // ── exchange (MCP) ─────────────────────────────────────\n exchange: createExchangeNamespace(exchangeTransport),\n\n // ── alive (MCP) ────────────────────────────────────────\n alive: createAliveNamespace(aliveTransport),\n\n // ── raw escape hatches (Core tRPC only) ────────────────\n rawQuery: <T = any>(path: string, input?: any) => callQuery<any, T>(coreTransport, path, input),\n rawMutation: <T = any>(path: string, input?: any) => callMutation<any, T>(coreTransport, path, input),\n };\n}\n\n/**\n * Alias for createGoodZClient — creates a client acting on behalf of a user.\n * Semantically identical, but makes the intent clearer in server-to-server code.\n */\nexport const createUserClient = createGoodZClient;\n"]}
|
package/dist/commerce/index.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ import { $ as TransportConfig } from '../transport-BSpGsxyt.js';
|
|
|
5
5
|
*
|
|
6
6
|
* Hand-crafted types mirroring the GoodZ.Commerce MCP tool surface.
|
|
7
7
|
* These cover shop management, batches, gacha pools, campaigns,
|
|
8
|
-
* wholesale, purchases, and
|
|
8
|
+
* wholesale, purchases, orders, settlement, webhooks, and wallet.
|
|
9
9
|
*
|
|
10
|
-
* Aligned with Commerce MCP as of 2026-03-20.
|
|
10
|
+
* Aligned with Commerce MCP as of 2026-03-20 (38 tools).
|
|
11
11
|
*
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
@@ -63,12 +63,12 @@ interface CommerceCreateBatchInput {
|
|
|
63
63
|
tiers: CommerceBatchTier[];
|
|
64
64
|
/** Core goods ID to link the batch to a specific IP/card blueprint */
|
|
65
65
|
coreGoodsId?: number;
|
|
66
|
-
/** Whether this batch has limited supply */
|
|
67
|
-
isLimited
|
|
68
|
-
/** Total supply across all tiers */
|
|
66
|
+
/** Whether this batch has limited supply (required) */
|
|
67
|
+
isLimited: boolean;
|
|
68
|
+
/** Total supply across all tiers (required if isLimited is true) */
|
|
69
69
|
totalSupply?: number;
|
|
70
|
-
/** Retail price in cents (
|
|
71
|
-
retailPriceCents
|
|
70
|
+
/** Retail price per unit in cents (required) */
|
|
71
|
+
retailPriceCents: number;
|
|
72
72
|
/** Number of units per box (for blind-box sale mode) */
|
|
73
73
|
unitsPerBox?: number;
|
|
74
74
|
/** Number of boxes per batch */
|
|
@@ -211,7 +211,10 @@ interface CommerceDrawResult {
|
|
|
211
211
|
}
|
|
212
212
|
interface CommerceGetMyOrdersInput {
|
|
213
213
|
userId?: number;
|
|
214
|
-
|
|
214
|
+
/** Page number (1-based, default: 1) */
|
|
215
|
+
page?: number;
|
|
216
|
+
/** Items per page (default: 20, max: 100) */
|
|
217
|
+
page_size?: number;
|
|
215
218
|
}
|
|
216
219
|
interface CommerceOrder {
|
|
217
220
|
id: number;
|
|
@@ -223,6 +226,54 @@ interface CommerceOrder {
|
|
|
223
226
|
createdAt: string;
|
|
224
227
|
items: any[];
|
|
225
228
|
}
|
|
229
|
+
interface CommerceGetOrderDetailInput {
|
|
230
|
+
/** The order ID (provide either order_id or order_no) */
|
|
231
|
+
order_id?: number;
|
|
232
|
+
/** The order number string (provide either order_id or order_no) */
|
|
233
|
+
order_no?: string;
|
|
234
|
+
}
|
|
235
|
+
interface CommerceOrderDetail {
|
|
236
|
+
id: number;
|
|
237
|
+
orderNo: string;
|
|
238
|
+
campaignId: number;
|
|
239
|
+
campaignName: string;
|
|
240
|
+
quantity: number;
|
|
241
|
+
totalPaid: number;
|
|
242
|
+
status: string;
|
|
243
|
+
createdAt: string;
|
|
244
|
+
items: Array<{
|
|
245
|
+
id: number;
|
|
246
|
+
coreCardId: number;
|
|
247
|
+
cardName: string | null;
|
|
248
|
+
imageUrl: string | null;
|
|
249
|
+
instanceId: number | null;
|
|
250
|
+
instanceCode: string | null;
|
|
251
|
+
confirmationStatus: string;
|
|
252
|
+
rarity: string | null;
|
|
253
|
+
tierName: string | null;
|
|
254
|
+
}>;
|
|
255
|
+
}
|
|
256
|
+
interface CommerceRefundOrderInput {
|
|
257
|
+
/** The order ID to refund (required) */
|
|
258
|
+
order_id: number;
|
|
259
|
+
/** Optional reason for the refund */
|
|
260
|
+
reason?: string;
|
|
261
|
+
}
|
|
262
|
+
interface CommerceCancelOrderInput {
|
|
263
|
+
/** The order ID to cancel (required) */
|
|
264
|
+
order_id: number;
|
|
265
|
+
/** Optional reason for the cancellation */
|
|
266
|
+
reason?: string;
|
|
267
|
+
}
|
|
268
|
+
interface CommerceGetMyBalanceInput {
|
|
269
|
+
userId?: number;
|
|
270
|
+
}
|
|
271
|
+
interface CommerceBalance {
|
|
272
|
+
/** Balance in hundredths (internal unit, 100 = 1.00 Z-coin) */
|
|
273
|
+
balance_hundredths: number;
|
|
274
|
+
/** User-facing display string (e.g. "50.00") */
|
|
275
|
+
balance_display: string;
|
|
276
|
+
}
|
|
226
277
|
interface CommercePublishToWholesaleInput {
|
|
227
278
|
batchId: number;
|
|
228
279
|
wholesalePriceCents?: number;
|
|
@@ -332,6 +383,10 @@ interface CommerceRegisterWebhookInput {
|
|
|
332
383
|
url: string;
|
|
333
384
|
events: string[];
|
|
334
385
|
shop_id?: number;
|
|
386
|
+
/** Optional: filter which events get delivered based on resource IDs */
|
|
387
|
+
event_filter?: {
|
|
388
|
+
campaign_ids?: number[];
|
|
389
|
+
};
|
|
335
390
|
}
|
|
336
391
|
interface CommerceWebhook {
|
|
337
392
|
id: number;
|
|
@@ -384,7 +439,9 @@ interface CommerceGetAuthUrlInput {
|
|
|
384
439
|
*
|
|
385
440
|
* Provides typed access to GoodZ.Commerce MCP tools:
|
|
386
441
|
* shop management, batches, gacha pools, campaigns,
|
|
387
|
-
* wholesale, purchases, settlement, and
|
|
442
|
+
* wholesale, purchases, orders, settlement, webhooks, and wallet.
|
|
443
|
+
*
|
|
444
|
+
* Aligned with Commerce MCP as of 2026-03-20 (38 tools).
|
|
388
445
|
*
|
|
389
446
|
* @module
|
|
390
447
|
*/
|
|
@@ -414,8 +471,16 @@ interface CommerceNamespace {
|
|
|
414
471
|
getCampaignItems(input: CommerceGetCampaignItemsInput): Promise<CommerceCampaignItem[]>;
|
|
415
472
|
/** Execute a purchase or draw. Handles payment, draw mechanics, settlement, and ownership transfer. */
|
|
416
473
|
executePurchase(input: CommerceExecutePurchaseInput): Promise<CommerceDrawResult>;
|
|
417
|
-
/** Get the authenticated user's order history. */
|
|
474
|
+
/** Get the authenticated user's order history (paginated). */
|
|
418
475
|
getMyOrders(input?: CommerceGetMyOrdersInput): Promise<CommerceOrder[]>;
|
|
476
|
+
/** Get detailed information about a single order by ID or order number. */
|
|
477
|
+
getOrderDetail(input: CommerceGetOrderDetailInput): Promise<CommerceOrderDetail>;
|
|
478
|
+
/** Refund a confirmed/paid order. Only the shop owner can refund. */
|
|
479
|
+
refundOrder(input: CommerceRefundOrderInput): Promise<any>;
|
|
480
|
+
/** Cancel a pending order. Only the shop owner can cancel. */
|
|
481
|
+
cancelOrder(input: CommerceCancelOrderInput): Promise<any>;
|
|
482
|
+
/** Query the user's real Z-coin balance from Core (single source of truth). */
|
|
483
|
+
getMyBalance(input?: CommerceGetMyBalanceInput): Promise<CommerceBalance>;
|
|
419
484
|
/** Publish a batch to the wholesale market for other shopkeepers to procure. */
|
|
420
485
|
publishToWholesale(input: CommercePublishToWholesaleInput): Promise<any>;
|
|
421
486
|
/** Browse available wholesale listings. */
|
|
@@ -459,4 +524,4 @@ interface CommerceNamespace {
|
|
|
459
524
|
}
|
|
460
525
|
declare function createCommerceNamespace(transport: TransportConfig): CommerceNamespace;
|
|
461
526
|
|
|
462
|
-
export { type AuthorizationMode, type CampaignStatus, type CommerceActivateCampaignInput, type CommerceBatch, type CommerceBatchTier, type CommerceBrowseWholesaleInput, type CommerceCampaign, type CommerceCampaignItem, type CommerceCreateBatchInput, type CommerceCreateGachaPoolInput, type CommerceCreateShopInput, type CommerceDeleteWebhookInput, type CommerceDrawResult, type CommerceEndCampaignInput, type CommerceExecutePurchaseInput, type CommerceGachaItem, type CommerceGachaPool, type CommerceGetAuthUrlInput, type CommerceGetCampaignInfoInput, type CommerceGetCampaignItemsInput, type CommerceGetMyOrdersInput, type CommerceGetSettlementReportInput, type CommerceGetShopDashboardInput, type CommerceGetShopsByBlueprintInput, type CommerceLaunchCampaignInput, type CommerceListMyAppsInput, type CommerceManageInventoryInput, type CommerceMintToInventoryInput, type CommerceNamespace, type CommerceOrder, type CommercePauseCampaignInput, type CommercePityConfig, type CommerceProcureBatchInput, type CommercePublishToWholesaleInput, type CommerceRedeemPhysicalInput, type CommerceRegisterAppInput, type CommerceRegisterInstancesInput, type CommerceRegisterWebhookInput, type CommerceSearchMarketplaceInput, type CommerceShop, type CommerceShopDashboard, type CommerceTestWebhookInput, type CommerceUpdateAppInput, type CommerceUpdateCampaignInput, type CommerceWebhook, type CommerceWholesaleListing, type IntegrationMode, type SaleMode, createCommerceNamespace };
|
|
527
|
+
export { type AuthorizationMode, type CampaignStatus, type CommerceActivateCampaignInput, type CommerceBalance, type CommerceBatch, type CommerceBatchTier, type CommerceBrowseWholesaleInput, type CommerceCampaign, type CommerceCampaignItem, type CommerceCancelOrderInput, type CommerceCreateBatchInput, type CommerceCreateGachaPoolInput, type CommerceCreateShopInput, type CommerceDeleteWebhookInput, type CommerceDrawResult, type CommerceEndCampaignInput, type CommerceExecutePurchaseInput, type CommerceGachaItem, type CommerceGachaPool, type CommerceGetAuthUrlInput, type CommerceGetCampaignInfoInput, type CommerceGetCampaignItemsInput, type CommerceGetMyBalanceInput, type CommerceGetMyOrdersInput, type CommerceGetOrderDetailInput, type CommerceGetSettlementReportInput, type CommerceGetShopDashboardInput, type CommerceGetShopsByBlueprintInput, type CommerceLaunchCampaignInput, type CommerceListMyAppsInput, type CommerceManageInventoryInput, type CommerceMintToInventoryInput, type CommerceNamespace, type CommerceOrder, type CommerceOrderDetail, type CommercePauseCampaignInput, type CommercePityConfig, type CommerceProcureBatchInput, type CommercePublishToWholesaleInput, type CommerceRedeemPhysicalInput, type CommerceRefundOrderInput, type CommerceRegisterAppInput, type CommerceRegisterInstancesInput, type CommerceRegisterWebhookInput, type CommerceSearchMarketplaceInput, type CommerceShop, type CommerceShopDashboard, type CommerceTestWebhookInput, type CommerceUpdateAppInput, type CommerceUpdateCampaignInput, type CommerceWebhook, type CommerceWholesaleListing, type IntegrationMode, type SaleMode, createCommerceNamespace };
|
package/dist/commerce/index.js
CHANGED
package/dist/core/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CommerceNamespace } from '../commerce/index.js';
|
|
2
|
-
export { AuthorizationMode, CampaignStatus, CommerceActivateCampaignInput, CommerceBatch, CommerceBatchTier, CommerceBrowseWholesaleInput, CommerceCampaign, CommerceCampaignItem, CommerceCreateBatchInput, CommerceCreateGachaPoolInput, CommerceCreateShopInput, CommerceDeleteWebhookInput, CommerceDrawResult, CommerceEndCampaignInput, CommerceExecutePurchaseInput, CommerceGachaItem, CommerceGachaPool, CommerceGetAuthUrlInput, CommerceGetCampaignInfoInput, CommerceGetCampaignItemsInput, CommerceGetMyOrdersInput, CommerceGetSettlementReportInput, CommerceGetShopDashboardInput, CommerceGetShopsByBlueprintInput, CommerceLaunchCampaignInput, CommerceListMyAppsInput, CommerceManageInventoryInput, CommerceMintToInventoryInput, CommerceOrder, CommercePauseCampaignInput, CommercePityConfig, CommerceProcureBatchInput, CommercePublishToWholesaleInput, CommerceRedeemPhysicalInput, CommerceRegisterAppInput, CommerceRegisterInstancesInput, CommerceRegisterWebhookInput, CommerceSearchMarketplaceInput, CommerceShop, CommerceShopDashboard, CommerceTestWebhookInput, CommerceUpdateAppInput, CommerceUpdateCampaignInput, CommerceWebhook, CommerceWholesaleListing, IntegrationMode, SaleMode } from '../commerce/index.js';
|
|
2
|
+
export { AuthorizationMode, CampaignStatus, CommerceActivateCampaignInput, CommerceBalance, CommerceBatch, CommerceBatchTier, CommerceBrowseWholesaleInput, CommerceCampaign, CommerceCampaignItem, CommerceCancelOrderInput, CommerceCreateBatchInput, CommerceCreateGachaPoolInput, CommerceCreateShopInput, CommerceDeleteWebhookInput, CommerceDrawResult, CommerceEndCampaignInput, CommerceExecutePurchaseInput, CommerceGachaItem, CommerceGachaPool, CommerceGetAuthUrlInput, CommerceGetCampaignInfoInput, CommerceGetCampaignItemsInput, CommerceGetMyBalanceInput, CommerceGetMyOrdersInput, CommerceGetOrderDetailInput, CommerceGetSettlementReportInput, CommerceGetShopDashboardInput, CommerceGetShopsByBlueprintInput, CommerceLaunchCampaignInput, CommerceListMyAppsInput, CommerceManageInventoryInput, CommerceMintToInventoryInput, CommerceOrder, CommerceOrderDetail, CommercePauseCampaignInput, CommercePityConfig, CommerceProcureBatchInput, CommercePublishToWholesaleInput, CommerceRedeemPhysicalInput, CommerceRefundOrderInput, CommerceRegisterAppInput, CommerceRegisterInstancesInput, CommerceRegisterWebhookInput, CommerceSearchMarketplaceInput, CommerceShop, CommerceShopDashboard, CommerceTestWebhookInput, CommerceUpdateAppInput, CommerceUpdateCampaignInput, CommerceWebhook, CommerceWholesaleListing, IntegrationMode, SaleMode } from '../commerce/index.js';
|
|
3
3
|
import { ExchangeNamespace } from '../exchange/index.js';
|
|
4
|
-
export { CompensationDirection, ExchangeAddToWatchlistInput, ExchangeBid, ExchangeBrowseMarketplaceInput, ExchangeBuyListingInput, ExchangeBuyListingOutput, ExchangeCancelListingInput, ExchangeCancelWtbInput, ExchangeCreateListingInput, ExchangeCreateListingOutput, ExchangeCreateWtbInput, ExchangeFulfillWtbInput, ExchangeFulfillWtbOutput, ExchangeGetBidsInput, ExchangeGetListingDetailInput, ExchangeGetMarketDataInput, ExchangeListing, ExchangeMarketData, ExchangePlaceBidInput, ExchangePlaceBidOutput, ExchangePricePoint, ExchangeProposeTradeInput, ExchangeRemoveFromWatchlistInput, ExchangeRespondToTradeInput, ExchangeRespondToTradeOutput, ExchangeTradeItem, ExchangeTradeProposal, ExchangeWatchlistItem, ExchangeWtb, ListingCondition, ListingType } from '../exchange/index.js';
|
|
4
|
+
export { CompensationDirection, ExchangeAddToWatchlistInput, ExchangeBid, ExchangeBrowseMarketplaceInput, ExchangeBrowseWtbInput, ExchangeBuyListingInput, ExchangeBuyListingOutput, ExchangeCancelListingInput, ExchangeCancelWtbInput, ExchangeCollectionStats, ExchangeCreateListingInput, ExchangeCreateListingOutput, ExchangeCreateWtbInput, ExchangeFulfillWtbInput, ExchangeFulfillWtbOutput, ExchangeGetBidsInput, ExchangeGetCollectionStatsInput, ExchangeGetInstancesBatchInput, ExchangeGetListingDetailInput, ExchangeGetMarketDataInput, ExchangeGetMyListingsInput, ExchangeGetMyOrdersInput, ExchangeGetUserProfileInput, ExchangeInstanceDetail, ExchangeListing, ExchangeMarketData, ExchangeOrder, ExchangePlaceBidInput, ExchangePlaceBidOutput, ExchangePricePoint, ExchangeProposeTradeInput, ExchangeRemoveFromWatchlistInput, ExchangeRespondToTradeInput, ExchangeRespondToTradeOutput, ExchangeSortBy, ExchangeTradeItem, ExchangeTradeProposal, ExchangeUserProfile, ExchangeWatchlistItem, ExchangeWtb, ListingCondition, ListingStatus, ListingType, OrderRole } from '../exchange/index.js';
|
|
5
5
|
import { AliveNamespace } from '../alive/index.js';
|
|
6
6
|
export { AliveBuildContextInput, AliveChatResponse, AliveClassifiedIntent, AliveClassifyIntentInput, AliveContext, AliveForgetMemoryInput, AliveGetIntimacyInput, AliveIntimacy, AliveMemory, AliveRecallMemoriesInput, AliveSendMessageInput, AliveStoreMemoryInput, AliveUpdateIntimacyInput, IntentCategory, MemoryType, MoodState } from '../alive/index.js';
|
|
7
7
|
import { b as AuthUser, A as AuthGetOAuthAppInfoInput, a as AuthOAuthAppInfo, e as CollectibleGetInstanceByIdInput, f as CollectibleGetPublicInstanceInput, g as CollectibleGetPublicInstancesBatchInput, d as CollectibleGetCardProfileInput, h as CollectibleGetShellImageUrlInput, V as ZcoinGetMyBalanceOutput, W as ZcoinGetMyHistoryInput, M as ZcoinGetDepositPackagesInput, L as ZcoinDepositPackage, E as ZcoinCreateDepositOrderInput, H as ZcoinCreateDepositOrderOutput, N as ZcoinGetDepositStatusInput, O as ZcoinGetDepositStatusOutput, Q as ZcoinGetDepositUrlInput, R as ZcoinGetDepositUrlOutput, B as ZcoinCommercialTransferInput, D as ZcoinCommercialTransferOutput, X as ZcoinMintAndChargeInput, Y as ZcoinMintAndChargeOutput, Z as ZcoinChargeUserInput, z as ZcoinChargeUserOutput, J as ZcoinCreateDirectPurchaseOrderInput, K as ZcoinCreateDirectPurchaseOrderOutput, l as InventoryGetUserInventoryInput, n as InventoryItem, I as InventoryConfirmOwnershipInput, k as InventoryConfirmOwnershipOutput, o as InventoryMintInput, p as InventoryMintOutput, t as InventoryTransferInput, u as InventoryTransferOutput, q as InventoryTransferByCardInput, r as InventoryTransferByCardOutput, m as InventoryGrantMintAuthInput, s as InventoryTransferHistoryInput, x as UserGetPublicProfileInput, y as UserPublicProfile, U as UserGetPublicProfileByIdInput, F as FranchiseGetInput, v as SeriesGetInput, w as SeriesListByFranchiseInput, C as CardGetInput, c as CardListBySeriesInput } from '../transport-BSpGsxyt.js';
|
|
@@ -60,17 +60,17 @@ interface GoodZClientConfig {
|
|
|
60
60
|
coreUrl?: string;
|
|
61
61
|
/**
|
|
62
62
|
* GoodZ.Commerce (Shops) base URL.
|
|
63
|
-
* @default "https://
|
|
63
|
+
* @default "https://goodz-commerce.manus.space"
|
|
64
64
|
*/
|
|
65
65
|
commerceUrl?: string;
|
|
66
66
|
/**
|
|
67
67
|
* GoodZ.Exchange base URL.
|
|
68
|
-
* @default "https://
|
|
68
|
+
* @default "https://goodz-exchange.manus.space"
|
|
69
69
|
*/
|
|
70
70
|
exchangeUrl?: string;
|
|
71
71
|
/**
|
|
72
72
|
* GoodZ.Alive base URL.
|
|
73
|
-
* @default "https://
|
|
73
|
+
* @default "https://goodz-alive.manus.space"
|
|
74
74
|
*/
|
|
75
75
|
aliveUrl?: string;
|
|
76
76
|
/**
|
package/dist/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { createGoodZClient, createUserClient } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { createGoodZClient, createUserClient } from '../chunk-U4JS2SP3.js';
|
|
2
|
+
import '../chunk-JXQNSQRK.js';
|
|
3
|
+
import '../chunk-BMJFLMIR.js';
|
|
4
4
|
import '../chunk-KP7DP5LP.js';
|
|
5
5
|
export { GoodZApiError } from '../chunk-ORUFMYZB.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/dist/exchange/index.d.ts
CHANGED
|
@@ -5,17 +5,32 @@ import { $ as TransportConfig } from '../transport-BSpGsxyt.js';
|
|
|
5
5
|
*
|
|
6
6
|
* Hand-crafted types mirroring the GoodZ.Exchange MCP tool surface.
|
|
7
7
|
* Covers marketplace listings, auctions, WTB, P2P trades, watchlist,
|
|
8
|
-
* and
|
|
8
|
+
* market data, collection stats, and user profiles.
|
|
9
9
|
*
|
|
10
|
-
* All prices are in
|
|
10
|
+
* All prices are in hundredths (100 = 1.00 Z-coin).
|
|
11
|
+
*
|
|
12
|
+
* Aligned with Exchange MCP as of 2026-03-20 (23 tools).
|
|
11
13
|
*
|
|
12
14
|
* @module
|
|
13
15
|
*/
|
|
14
16
|
type ListingType = "fixed_price" | "auction";
|
|
15
17
|
type ListingCondition = "mint" | "near_mint" | "excellent" | "good" | "fair" | "poor";
|
|
18
|
+
type ListingStatus = "active" | "sold" | "cancelled" | "expired";
|
|
16
19
|
type CompensationDirection = "initiator_pays" | "receiver_pays";
|
|
20
|
+
type ExchangeSortBy = "newest" | "price_asc" | "price_desc" | "ending_soon";
|
|
21
|
+
type OrderRole = "buyer" | "seller";
|
|
17
22
|
interface ExchangeBrowseMarketplaceInput {
|
|
18
23
|
listingType?: ListingType;
|
|
24
|
+
/** Filter by specific GoodZ type (Core GoodZ ID) */
|
|
25
|
+
coreGoodzId?: number;
|
|
26
|
+
/** Filter by condition(s). Multi-select, e.g. ['mint', 'near_mint'] */
|
|
27
|
+
condition?: ListingCondition[];
|
|
28
|
+
/** Minimum price in hundredths (inclusive). 100 = 1.00 Z-coin */
|
|
29
|
+
priceMin?: number;
|
|
30
|
+
/** Maximum price in hundredths (inclusive). 100 = 1.00 Z-coin */
|
|
31
|
+
priceMax?: number;
|
|
32
|
+
/** Sort order. 'ending_soon' only applies to auctions. Default: newest */
|
|
33
|
+
sortBy?: ExchangeSortBy;
|
|
19
34
|
limit?: number;
|
|
20
35
|
offset?: number;
|
|
21
36
|
}
|
|
@@ -42,13 +57,13 @@ interface ExchangeCreateListingInput {
|
|
|
42
57
|
coreInstanceId: number;
|
|
43
58
|
coreGoodzId?: number;
|
|
44
59
|
listingType: ListingType;
|
|
45
|
-
/** Price in
|
|
60
|
+
/** Price in hundredths (required for fixed_price). 100 = 1.00 Z-coin */
|
|
46
61
|
priceZcoin?: number;
|
|
47
|
-
/** Starting price in
|
|
62
|
+
/** Starting price in hundredths (required for auction). 100 = 1.00 Z-coin */
|
|
48
63
|
startPriceZcoin?: number;
|
|
49
|
-
/** Buy-now price in
|
|
64
|
+
/** Buy-now price in hundredths (optional for auction). 100 = 1.00 Z-coin */
|
|
50
65
|
buyNowPriceZcoin?: number;
|
|
51
|
-
/**
|
|
66
|
+
/** Min bid increment in hundredths. Default: 1 (= 0.01 Z-coin) */
|
|
52
67
|
minBidIncrementZcoin?: number;
|
|
53
68
|
/** ISO 8601 date string (required for auction) */
|
|
54
69
|
auctionEndsAt?: string;
|
|
@@ -63,6 +78,14 @@ interface ExchangeCreateListingOutput {
|
|
|
63
78
|
interface ExchangeCancelListingInput {
|
|
64
79
|
listingId: number;
|
|
65
80
|
}
|
|
81
|
+
interface ExchangeGetMyListingsInput {
|
|
82
|
+
/** Filter by listing status. Omit for all statuses. */
|
|
83
|
+
status?: ListingStatus;
|
|
84
|
+
/** Max results (1-100, default 20) */
|
|
85
|
+
limit?: number;
|
|
86
|
+
/** Pagination offset */
|
|
87
|
+
offset?: number;
|
|
88
|
+
}
|
|
66
89
|
interface ExchangeBuyListingInput {
|
|
67
90
|
listingId: number;
|
|
68
91
|
}
|
|
@@ -95,6 +118,27 @@ interface ExchangeBid {
|
|
|
95
118
|
createdAt: string;
|
|
96
119
|
isWinning: boolean;
|
|
97
120
|
}
|
|
121
|
+
interface ExchangeGetMyOrdersInput {
|
|
122
|
+
/** Filter by your role. Omit for all orders. */
|
|
123
|
+
role?: OrderRole;
|
|
124
|
+
/** Max results (1-100, default 20) */
|
|
125
|
+
limit?: number;
|
|
126
|
+
/** Pagination offset */
|
|
127
|
+
offset?: number;
|
|
128
|
+
}
|
|
129
|
+
interface ExchangeOrder {
|
|
130
|
+
id: number;
|
|
131
|
+
listingId: number;
|
|
132
|
+
buyerId: number;
|
|
133
|
+
sellerId: number;
|
|
134
|
+
priceZcoin: number;
|
|
135
|
+
platformFee: number;
|
|
136
|
+
sellerProceeds: number;
|
|
137
|
+
/** Your role in this order: 'buyer' or 'seller' */
|
|
138
|
+
role: OrderRole;
|
|
139
|
+
status: string;
|
|
140
|
+
createdAt: string;
|
|
141
|
+
}
|
|
98
142
|
interface ExchangeCreateWtbInput {
|
|
99
143
|
title: string;
|
|
100
144
|
coreGoodzId?: number;
|
|
@@ -114,6 +158,26 @@ interface ExchangeWtb {
|
|
|
114
158
|
status: string;
|
|
115
159
|
createdAt: string;
|
|
116
160
|
}
|
|
161
|
+
interface ExchangeBrowseWtbInput {
|
|
162
|
+
/** Filter by specific GoodZ type */
|
|
163
|
+
coreGoodzId?: number;
|
|
164
|
+
/** Filter by franchise */
|
|
165
|
+
franchiseId?: number;
|
|
166
|
+
/** Filter by series */
|
|
167
|
+
seriesId?: number;
|
|
168
|
+
/** Filter by minimum acceptable condition */
|
|
169
|
+
conditionMin?: ListingCondition;
|
|
170
|
+
/** Minimum offered price in hundredths (100 = 1.00 Z-coin) */
|
|
171
|
+
priceMin?: number;
|
|
172
|
+
/** Maximum offered price in hundredths (100 = 1.00 Z-coin) */
|
|
173
|
+
priceMax?: number;
|
|
174
|
+
/** Sort order. Default: newest */
|
|
175
|
+
sortBy?: "newest" | "price_asc" | "price_desc";
|
|
176
|
+
/** Max results (1-100, default 20) */
|
|
177
|
+
limit?: number;
|
|
178
|
+
/** Pagination offset */
|
|
179
|
+
offset?: number;
|
|
180
|
+
}
|
|
117
181
|
interface ExchangeFulfillWtbInput {
|
|
118
182
|
wtbId: number;
|
|
119
183
|
coreGoodzId: number;
|
|
@@ -198,21 +262,70 @@ interface ExchangeMarketData {
|
|
|
198
262
|
totalVolume: number;
|
|
199
263
|
priceHistory: ExchangePricePoint[];
|
|
200
264
|
}
|
|
265
|
+
interface ExchangeGetCollectionStatsInput {
|
|
266
|
+
/** The Core GoodZ ID to get stats for */
|
|
267
|
+
coreGoodzId: number;
|
|
268
|
+
}
|
|
269
|
+
interface ExchangeCollectionStats {
|
|
270
|
+
coreGoodzId: number;
|
|
271
|
+
/** Floor price in hundredths (100 = 1.00 Z-coin) */
|
|
272
|
+
floorPrice: number | null;
|
|
273
|
+
/** Total active listings */
|
|
274
|
+
totalListings: number;
|
|
275
|
+
/** 24-hour trade volume in hundredths */
|
|
276
|
+
volume24h: number;
|
|
277
|
+
/** 24-hour sales count */
|
|
278
|
+
sales24h: number;
|
|
279
|
+
/** 7-day trade volume in hundredths */
|
|
280
|
+
volume7d: number;
|
|
281
|
+
/** 7-day sales count */
|
|
282
|
+
sales7d: number;
|
|
283
|
+
/** 7-day average sale price in hundredths */
|
|
284
|
+
avgPrice7d: number | null;
|
|
285
|
+
}
|
|
286
|
+
interface ExchangeGetInstancesBatchInput {
|
|
287
|
+
/** Array of instance IDs to look up (max 100) */
|
|
288
|
+
instanceIds: number[];
|
|
289
|
+
}
|
|
290
|
+
interface ExchangeInstanceDetail {
|
|
291
|
+
instanceId: number;
|
|
292
|
+
coreGoodzId: number;
|
|
293
|
+
cardName: string | null;
|
|
294
|
+
seriesName: string | null;
|
|
295
|
+
franchiseName: string | null;
|
|
296
|
+
imageUrl: string | null;
|
|
297
|
+
rarity: string | null;
|
|
298
|
+
instanceCode: string | null;
|
|
299
|
+
}
|
|
300
|
+
interface ExchangeGetUserProfileInput {
|
|
301
|
+
/** User's openId (cross-service identifier) */
|
|
302
|
+
openId?: string;
|
|
303
|
+
/** User's numeric ID (alternative to openId) */
|
|
304
|
+
userId?: number;
|
|
305
|
+
}
|
|
306
|
+
interface ExchangeUserProfile {
|
|
307
|
+
displayName: string;
|
|
308
|
+
avatarUrl: string | null;
|
|
309
|
+
joinedAt: string;
|
|
310
|
+
role: string;
|
|
311
|
+
}
|
|
201
312
|
|
|
202
313
|
/**
|
|
203
314
|
* @goodz-core/sdk — Exchange Namespace
|
|
204
315
|
*
|
|
205
316
|
* Provides typed access to GoodZ.Exchange MCP tools:
|
|
206
317
|
* marketplace listings, auctions, WTB, P2P trades,
|
|
207
|
-
* watchlist, and
|
|
318
|
+
* watchlist, market data, collection stats, and user profiles.
|
|
319
|
+
*
|
|
320
|
+
* All prices are in hundredths (100 = 1.00 Z-coin).
|
|
208
321
|
*
|
|
209
|
-
*
|
|
322
|
+
* Aligned with Exchange MCP as of 2026-03-20 (23 tools).
|
|
210
323
|
*
|
|
211
324
|
* @module
|
|
212
325
|
*/
|
|
213
326
|
|
|
214
327
|
interface ExchangeNamespace {
|
|
215
|
-
/** Browse active marketplace listings. */
|
|
328
|
+
/** Browse active marketplace listings with filters for type, GoodZ, condition, price, and sort. */
|
|
216
329
|
browseMarketplace(input?: ExchangeBrowseMarketplaceInput): Promise<ExchangeListing[]>;
|
|
217
330
|
/** Get detailed info about a specific listing. */
|
|
218
331
|
getListingDetail(input: ExchangeGetListingDetailInput): Promise<ExchangeListing>;
|
|
@@ -220,14 +333,20 @@ interface ExchangeNamespace {
|
|
|
220
333
|
createListing(input: ExchangeCreateListingInput): Promise<ExchangeCreateListingOutput>;
|
|
221
334
|
/** Cancel an active listing. Core unlocks the instance. */
|
|
222
335
|
cancelListing(input: ExchangeCancelListingInput): Promise<any>;
|
|
336
|
+
/** Get your own listings (active, sold, cancelled, expired). */
|
|
337
|
+
getMyListings(input?: ExchangeGetMyListingsInput): Promise<ExchangeListing[]>;
|
|
223
338
|
/** Buy a fixed-price listing. Z-coin debit + ownership transfer via Core settlement. */
|
|
224
339
|
buyListing(input: ExchangeBuyListingInput): Promise<ExchangeBuyListingOutput>;
|
|
225
340
|
/** Place a bid on an auction. If bid meets buy-now price, immediate purchase is executed. */
|
|
226
341
|
placeBid(input: ExchangePlaceBidInput): Promise<ExchangePlaceBidOutput>;
|
|
227
342
|
/** Get all bids for an auction listing (highest first). */
|
|
228
343
|
getBids(input: ExchangeGetBidsInput): Promise<ExchangeBid[]>;
|
|
344
|
+
/** Get your order history (as buyer and/or seller). */
|
|
345
|
+
getMyOrders(input?: ExchangeGetMyOrdersInput): Promise<ExchangeOrder[]>;
|
|
229
346
|
/** Create a WTB request — announce what you're looking for. */
|
|
230
347
|
createWtb(input: ExchangeCreateWtbInput): Promise<ExchangeWtb>;
|
|
348
|
+
/** Browse active WTB requests. Sellers can find buyers looking for specific GoodZ. */
|
|
349
|
+
browseWtb(input?: ExchangeBrowseWtbInput): Promise<ExchangeWtb[]>;
|
|
231
350
|
/** Fulfill a WTB request by offering your item. Settlement via Core. */
|
|
232
351
|
fulfillWtb(input: ExchangeFulfillWtbInput): Promise<ExchangeFulfillWtbOutput>;
|
|
233
352
|
/** Cancel your own WTB request. */
|
|
@@ -244,9 +363,15 @@ interface ExchangeNamespace {
|
|
|
244
363
|
removeFromWatchlist(input: ExchangeRemoveFromWatchlistInput): Promise<any>;
|
|
245
364
|
/** Get market data: price history, floor price, volume, trends. */
|
|
246
365
|
getMarketData(input: ExchangeGetMarketDataInput): Promise<ExchangeMarketData>;
|
|
366
|
+
/** Get marketplace statistics for a specific GoodZ collection. */
|
|
367
|
+
getCollectionStats(input: ExchangeGetCollectionStatsInput): Promise<ExchangeCollectionStats>;
|
|
368
|
+
/** Batch lookup card instances by IDs (max 100). Returns full instance details. */
|
|
369
|
+
getInstancesBatch(input: ExchangeGetInstancesBatchInput): Promise<ExchangeInstanceDetail[]>;
|
|
370
|
+
/** Get a user's public profile. No authentication required. */
|
|
371
|
+
getUserProfile(input: ExchangeGetUserProfileInput): Promise<ExchangeUserProfile>;
|
|
247
372
|
/** Call a raw MCP tool by name. Escape hatch for tools not yet in the typed API. */
|
|
248
373
|
rawTool<T = any>(toolName: string, args?: Record<string, any>): Promise<T>;
|
|
249
374
|
}
|
|
250
375
|
declare function createExchangeNamespace(transport: TransportConfig): ExchangeNamespace;
|
|
251
376
|
|
|
252
|
-
export { type CompensationDirection, type ExchangeAddToWatchlistInput, type ExchangeBid, type ExchangeBrowseMarketplaceInput, type ExchangeBuyListingInput, type ExchangeBuyListingOutput, type ExchangeCancelListingInput, type ExchangeCancelWtbInput, type ExchangeCreateListingInput, type ExchangeCreateListingOutput, type ExchangeCreateWtbInput, type ExchangeFulfillWtbInput, type ExchangeFulfillWtbOutput, type ExchangeGetBidsInput, type ExchangeGetListingDetailInput, type ExchangeGetMarketDataInput, type ExchangeListing, type ExchangeMarketData, type ExchangeNamespace, type ExchangePlaceBidInput, type ExchangePlaceBidOutput, type ExchangePricePoint, type ExchangeProposeTradeInput, type ExchangeRemoveFromWatchlistInput, type ExchangeRespondToTradeInput, type ExchangeRespondToTradeOutput, type ExchangeTradeItem, type ExchangeTradeProposal, type ExchangeWatchlistItem, type ExchangeWtb, type ListingCondition, type ListingType, createExchangeNamespace };
|
|
377
|
+
export { type CompensationDirection, type ExchangeAddToWatchlistInput, type ExchangeBid, type ExchangeBrowseMarketplaceInput, type ExchangeBrowseWtbInput, type ExchangeBuyListingInput, type ExchangeBuyListingOutput, type ExchangeCancelListingInput, type ExchangeCancelWtbInput, type ExchangeCollectionStats, type ExchangeCreateListingInput, type ExchangeCreateListingOutput, type ExchangeCreateWtbInput, type ExchangeFulfillWtbInput, type ExchangeFulfillWtbOutput, type ExchangeGetBidsInput, type ExchangeGetCollectionStatsInput, type ExchangeGetInstancesBatchInput, type ExchangeGetListingDetailInput, type ExchangeGetMarketDataInput, type ExchangeGetMyListingsInput, type ExchangeGetMyOrdersInput, type ExchangeGetUserProfileInput, type ExchangeInstanceDetail, type ExchangeListing, type ExchangeMarketData, type ExchangeNamespace, type ExchangeOrder, type ExchangePlaceBidInput, type ExchangePlaceBidOutput, type ExchangePricePoint, type ExchangeProposeTradeInput, type ExchangeRemoveFromWatchlistInput, type ExchangeRespondToTradeInput, type ExchangeRespondToTradeOutput, type ExchangeSortBy, type ExchangeTradeItem, type ExchangeTradeProposal, type ExchangeUserProfile, type ExchangeWatchlistItem, type ExchangeWtb, type ListingCondition, type ListingStatus, type ListingType, type OrderRole, createExchangeNamespace };
|
package/dist/exchange/index.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { AuthNamespace, CollectibleNamespace, GoodZClient, GoodZClientConfig, InventoryNamespace, IpNamespace, UserNamespace, ZcoinNamespace, createGoodZClient, createUserClient } from './core/index.js';
|
|
2
2
|
export { A as AuthGetOAuthAppInfoInput, a as AuthOAuthAppInfo, b as AuthUser, C as CardGetInput, c as CardListBySeriesInput, d as CollectibleGetCardProfileInput, e as CollectibleGetInstanceByIdInput, f as CollectibleGetPublicInstanceInput, g as CollectibleGetPublicInstancesBatchInput, h as CollectibleGetShellImageUrlInput, F as FranchiseGetInput, G as GoodZApiError, i as GoodZApiFieldError, j as GoodZErrorV2, I as InventoryConfirmOwnershipInput, k as InventoryConfirmOwnershipOutput, l as InventoryGetUserInventoryInput, m as InventoryGrantMintAuthInput, n as InventoryItem, o as InventoryMintInput, p as InventoryMintOutput, q as InventoryTransferByCardInput, r as InventoryTransferByCardOutput, s as InventoryTransferHistoryInput, t as InventoryTransferInput, u as InventoryTransferOutput, P as PurchaseChannel, S as SaleType, v as SeriesGetInput, w as SeriesListByFranchiseInput, T as TransferReason, U as UserGetPublicProfileByIdInput, x as UserGetPublicProfileInput, y as UserPublicProfile, Z as ZcoinChargeUserInput, z as ZcoinChargeUserOutput, B as ZcoinCommercialTransferInput, D as ZcoinCommercialTransferOutput, E as ZcoinCreateDepositOrderInput, H as ZcoinCreateDepositOrderOutput, J as ZcoinCreateDirectPurchaseOrderInput, K as ZcoinCreateDirectPurchaseOrderOutput, L as ZcoinDepositPackage, M as ZcoinGetDepositPackagesInput, N as ZcoinGetDepositStatusInput, O as ZcoinGetDepositStatusOutput, Q as ZcoinGetDepositUrlInput, R as ZcoinGetDepositUrlOutput, V as ZcoinGetMyBalanceOutput, W as ZcoinGetMyHistoryInput, X as ZcoinMintAndChargeInput, Y as ZcoinMintAndChargeOutput, _ as ZcoinTxType } from './transport-BSpGsxyt.js';
|
|
3
|
-
export { AuthorizationMode, CampaignStatus, CommerceActivateCampaignInput, CommerceBatch, CommerceBatchTier, CommerceBrowseWholesaleInput, CommerceCampaign, CommerceCampaignItem, CommerceCreateBatchInput, CommerceCreateGachaPoolInput, CommerceCreateShopInput, CommerceDeleteWebhookInput, CommerceDrawResult, CommerceEndCampaignInput, CommerceExecutePurchaseInput, CommerceGachaItem, CommerceGachaPool, CommerceGetAuthUrlInput, CommerceGetCampaignInfoInput, CommerceGetCampaignItemsInput, CommerceGetMyOrdersInput, CommerceGetSettlementReportInput, CommerceGetShopDashboardInput, CommerceGetShopsByBlueprintInput, CommerceLaunchCampaignInput, CommerceListMyAppsInput, CommerceManageInventoryInput, CommerceMintToInventoryInput, CommerceNamespace, CommerceOrder, CommercePauseCampaignInput, CommercePityConfig, CommerceProcureBatchInput, CommercePublishToWholesaleInput, CommerceRedeemPhysicalInput, CommerceRegisterAppInput, CommerceRegisterInstancesInput, CommerceRegisterWebhookInput, CommerceSearchMarketplaceInput, CommerceShop, CommerceShopDashboard, CommerceTestWebhookInput, CommerceUpdateAppInput, CommerceUpdateCampaignInput, CommerceWebhook, CommerceWholesaleListing, IntegrationMode, SaleMode } from './commerce/index.js';
|
|
4
|
-
export { CompensationDirection, ExchangeAddToWatchlistInput, ExchangeBid, ExchangeBrowseMarketplaceInput, ExchangeBuyListingInput, ExchangeBuyListingOutput, ExchangeCancelListingInput, ExchangeCancelWtbInput, ExchangeCreateListingInput, ExchangeCreateListingOutput, ExchangeCreateWtbInput, ExchangeFulfillWtbInput, ExchangeFulfillWtbOutput, ExchangeGetBidsInput, ExchangeGetListingDetailInput, ExchangeGetMarketDataInput, ExchangeListing, ExchangeMarketData, ExchangeNamespace, ExchangePlaceBidInput, ExchangePlaceBidOutput, ExchangePricePoint, ExchangeProposeTradeInput, ExchangeRemoveFromWatchlistInput, ExchangeRespondToTradeInput, ExchangeRespondToTradeOutput, ExchangeTradeItem, ExchangeTradeProposal, ExchangeWatchlistItem, ExchangeWtb, ListingCondition, ListingType } from './exchange/index.js';
|
|
3
|
+
export { AuthorizationMode, CampaignStatus, CommerceActivateCampaignInput, CommerceBalance, CommerceBatch, CommerceBatchTier, CommerceBrowseWholesaleInput, CommerceCampaign, CommerceCampaignItem, CommerceCancelOrderInput, CommerceCreateBatchInput, CommerceCreateGachaPoolInput, CommerceCreateShopInput, CommerceDeleteWebhookInput, CommerceDrawResult, CommerceEndCampaignInput, CommerceExecutePurchaseInput, CommerceGachaItem, CommerceGachaPool, CommerceGetAuthUrlInput, CommerceGetCampaignInfoInput, CommerceGetCampaignItemsInput, CommerceGetMyBalanceInput, CommerceGetMyOrdersInput, CommerceGetOrderDetailInput, CommerceGetSettlementReportInput, CommerceGetShopDashboardInput, CommerceGetShopsByBlueprintInput, CommerceLaunchCampaignInput, CommerceListMyAppsInput, CommerceManageInventoryInput, CommerceMintToInventoryInput, CommerceNamespace, CommerceOrder, CommerceOrderDetail, CommercePauseCampaignInput, CommercePityConfig, CommerceProcureBatchInput, CommercePublishToWholesaleInput, CommerceRedeemPhysicalInput, CommerceRefundOrderInput, CommerceRegisterAppInput, CommerceRegisterInstancesInput, CommerceRegisterWebhookInput, CommerceSearchMarketplaceInput, CommerceShop, CommerceShopDashboard, CommerceTestWebhookInput, CommerceUpdateAppInput, CommerceUpdateCampaignInput, CommerceWebhook, CommerceWholesaleListing, IntegrationMode, SaleMode } from './commerce/index.js';
|
|
4
|
+
export { CompensationDirection, ExchangeAddToWatchlistInput, ExchangeBid, ExchangeBrowseMarketplaceInput, ExchangeBrowseWtbInput, ExchangeBuyListingInput, ExchangeBuyListingOutput, ExchangeCancelListingInput, ExchangeCancelWtbInput, ExchangeCollectionStats, ExchangeCreateListingInput, ExchangeCreateListingOutput, ExchangeCreateWtbInput, ExchangeFulfillWtbInput, ExchangeFulfillWtbOutput, ExchangeGetBidsInput, ExchangeGetCollectionStatsInput, ExchangeGetInstancesBatchInput, ExchangeGetListingDetailInput, ExchangeGetMarketDataInput, ExchangeGetMyListingsInput, ExchangeGetMyOrdersInput, ExchangeGetUserProfileInput, ExchangeInstanceDetail, ExchangeListing, ExchangeMarketData, ExchangeNamespace, ExchangeOrder, ExchangePlaceBidInput, ExchangePlaceBidOutput, ExchangePricePoint, ExchangeProposeTradeInput, ExchangeRemoveFromWatchlistInput, ExchangeRespondToTradeInput, ExchangeRespondToTradeOutput, ExchangeSortBy, ExchangeTradeItem, ExchangeTradeProposal, ExchangeUserProfile, ExchangeWatchlistItem, ExchangeWtb, ListingCondition, ListingStatus, ListingType, OrderRole } from './exchange/index.js';
|
|
5
5
|
export { AliveBuildContextInput, AliveChatResponse, AliveClassifiedIntent, AliveClassifyIntentInput, AliveContext, AliveForgetMemoryInput, AliveGetIntimacyInput, AliveIntimacy, AliveMemory, AliveNamespace, AliveRecallMemoriesInput, AliveSendMessageInput, AliveStoreMemoryInput, AliveUpdateIntimacyInput, IntentCategory, MemoryType, MoodState } from './alive/index.js';
|
|
6
6
|
export { OAuthUrlConfig, TokenManager, TokenManagerConfig, TokenPair, buildAuthorizationUrl, exchangeCode } from './auth/index.js';
|
|
7
7
|
export { ZCOIN_PRECISION, formatZcoin, formatZcoinWithSymbol, toDisplay, toHundredths } from './zcoin-utils.js';
|
|
@@ -46,6 +46,6 @@ import 'react';
|
|
|
46
46
|
* @module
|
|
47
47
|
*/
|
|
48
48
|
|
|
49
|
-
declare const SDK_VERSION = "0.3.
|
|
49
|
+
declare const SDK_VERSION = "0.3.5";
|
|
50
50
|
|
|
51
51
|
export { SDK_VERSION };
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { createGoodZClient, createUserClient } from './chunk-
|
|
1
|
+
export { createGoodZClient, createUserClient } from './chunk-U4JS2SP3.js';
|
|
2
2
|
export { TokenManager, buildAuthorizationUrl, exchangeCode } from './chunk-EUKUN4JF.js';
|
|
3
3
|
export { ZCOIN_PRECISION, formatZcoin, formatZcoinWithSymbol, toDisplay, toHundredths } from './chunk-2ZETOE2X.js';
|
|
4
4
|
export { FORM_FACTORS, GoodZCardFocus, getAspectRatioCSS, getFormFactorSpec } from './chunk-K6IFJWLB.js';
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
5
|
+
import './chunk-JXQNSQRK.js';
|
|
6
|
+
import './chunk-BMJFLMIR.js';
|
|
7
7
|
import './chunk-KP7DP5LP.js';
|
|
8
8
|
export { GoodZApiError } from './chunk-ORUFMYZB.js';
|
|
9
9
|
|
|
10
10
|
// src/index.ts
|
|
11
|
-
var SDK_VERSION = "0.3.
|
|
11
|
+
var SDK_VERSION = "0.3.5";
|
|
12
12
|
|
|
13
13
|
export { SDK_VERSION };
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;AAqGO,IAAM,WAAA,GAAc","file":"index.js","sourcesContent":["/**\n * @goodz-core/sdk — Official SDK for the GoodZ Ecosystem\n *\n * One package, all services. Stripe-style unified client.\n *\n * ```ts\n * import { createGoodZClient } from \"@goodz-core/sdk\";\n *\n * const goodz = createGoodZClient({ accessToken: \"...\" });\n *\n * // Core\n * await goodz.zcoin.getMyBalance();\n * await goodz.inventory.mint({ ... });\n *\n * // Commerce\n * await goodz.commerce.createShop({ name: \"My Shop\" });\n * await goodz.commerce.executePurchase({ campaignId: 1, quantity: 1 });\n *\n * // Exchange\n * await goodz.exchange.createListing({ ... });\n * await goodz.exchange.getMarketData({ coreGoodzId: 42 });\n *\n * // Alive\n * await goodz.alive.sendMessage({ instanceId: 1, userId: 1, message: \"Hello!\" });\n * ```\n *\n * For tree-shaking, prefer importing from specific subpaths:\n *\n * ```ts\n * import { createGoodZClient } from \"@goodz-core/sdk/core\";\n * import { TokenManager } from \"@goodz-core/sdk/auth\";\n * import { GoodZCardFocus } from \"@goodz-core/sdk/ui\";\n * ```\n *\n * @module\n */\n\n// Core client (includes all namespace types)\nexport {\n createGoodZClient,\n createUserClient,\n GoodZApiError,\n type GoodZClient,\n type GoodZClientConfig,\n // Core namespaces\n type ZcoinNamespace,\n type InventoryNamespace,\n type CollectibleNamespace,\n type UserNamespace,\n type AuthNamespace,\n type IpNamespace,\n // Sub-site namespaces\n type CommerceNamespace,\n type ExchangeNamespace,\n type AliveNamespace,\n} from \"./core/index\";\n\n// All API types — Core\nexport type * from \"./types\";\n\n// All API types — Commerce\nexport type * from \"./types-commerce\";\n\n// All API types — Exchange\nexport type * from \"./types-exchange\";\n\n// All API types — Alive\nexport type * from \"./types-alive\";\n\n// Auth helpers\nexport {\n TokenManager,\n buildAuthorizationUrl,\n exchangeCode,\n type TokenManagerConfig,\n type TokenPair,\n type OAuthUrlConfig,\n} from \"./auth/index\";\n\n// Z-coin utilities\nexport {\n ZCOIN_PRECISION,\n toHundredths,\n toDisplay,\n formatZcoin,\n formatZcoinWithSymbol,\n} from \"./zcoin-utils\";\n\n// UI components (React 18+)\n// Note: Import from \"@goodz-core/sdk/ui\" for tree-shaking\nexport {\n GoodZCardFocus,\n type GoodZCardFocusProps,\n type FormFactorKey,\n type FormFactorSpec,\n FORM_FACTORS,\n getFormFactorSpec,\n getAspectRatioCSS,\n} from \"./ui/index\";\n\n// SDK version\nexport const SDK_VERSION = \"0.3.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;AAqGO,IAAM,WAAA,GAAc","file":"index.js","sourcesContent":["/**\n * @goodz-core/sdk — Official SDK for the GoodZ Ecosystem\n *\n * One package, all services. Stripe-style unified client.\n *\n * ```ts\n * import { createGoodZClient } from \"@goodz-core/sdk\";\n *\n * const goodz = createGoodZClient({ accessToken: \"...\" });\n *\n * // Core\n * await goodz.zcoin.getMyBalance();\n * await goodz.inventory.mint({ ... });\n *\n * // Commerce\n * await goodz.commerce.createShop({ name: \"My Shop\" });\n * await goodz.commerce.executePurchase({ campaignId: 1, quantity: 1 });\n *\n * // Exchange\n * await goodz.exchange.createListing({ ... });\n * await goodz.exchange.getMarketData({ coreGoodzId: 42 });\n *\n * // Alive\n * await goodz.alive.sendMessage({ instanceId: 1, userId: 1, message: \"Hello!\" });\n * ```\n *\n * For tree-shaking, prefer importing from specific subpaths:\n *\n * ```ts\n * import { createGoodZClient } from \"@goodz-core/sdk/core\";\n * import { TokenManager } from \"@goodz-core/sdk/auth\";\n * import { GoodZCardFocus } from \"@goodz-core/sdk/ui\";\n * ```\n *\n * @module\n */\n\n// Core client (includes all namespace types)\nexport {\n createGoodZClient,\n createUserClient,\n GoodZApiError,\n type GoodZClient,\n type GoodZClientConfig,\n // Core namespaces\n type ZcoinNamespace,\n type InventoryNamespace,\n type CollectibleNamespace,\n type UserNamespace,\n type AuthNamespace,\n type IpNamespace,\n // Sub-site namespaces\n type CommerceNamespace,\n type ExchangeNamespace,\n type AliveNamespace,\n} from \"./core/index\";\n\n// All API types — Core\nexport type * from \"./types\";\n\n// All API types — Commerce\nexport type * from \"./types-commerce\";\n\n// All API types — Exchange\nexport type * from \"./types-exchange\";\n\n// All API types — Alive\nexport type * from \"./types-alive\";\n\n// Auth helpers\nexport {\n TokenManager,\n buildAuthorizationUrl,\n exchangeCode,\n type TokenManagerConfig,\n type TokenPair,\n type OAuthUrlConfig,\n} from \"./auth/index\";\n\n// Z-coin utilities\nexport {\n ZCOIN_PRECISION,\n toHundredths,\n toDisplay,\n formatZcoin,\n formatZcoinWithSymbol,\n} from \"./zcoin-utils\";\n\n// UI components (React 18+)\n// Note: Import from \"@goodz-core/sdk/ui\" for tree-shaking\nexport {\n GoodZCardFocus,\n type GoodZCardFocusProps,\n type FormFactorKey,\n type FormFactorSpec,\n FORM_FACTORS,\n getFormFactorSpec,\n getAspectRatioCSS,\n} from \"./ui/index\";\n\n// SDK version\nexport const SDK_VERSION = \"0.3.5\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodz-core/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Official SDK for the GoodZ Ecosystem — unified API client for Core, Commerce, Exchange, and Alive. Includes OAuth helpers, Z-coin utilities, and React UI components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;AA0HA,IAAM,gBAAA,GAAmB,+BAAA;AACzB,IAAM,oBAAA,GAAuB,mCAAA;AAC7B,IAAM,oBAAA,GAAuB,mCAAA;AAC7B,IAAM,iBAAA,GAAoB,gCAAA;AAuSnB,SAAS,iBAAA,CAAkB,MAAA,GAA4B,EAAC,EAAgB;AAC7E,EAAA,MAAM;AAAA,IACJ,OAAA,GAAU,gBAAA;AAAA,IACV,WAAA,GAAc,oBAAA;AAAA,IACd,WAAA,GAAc,oBAAA;AAAA,IACd,QAAA,GAAW,iBAAA;AAAA,IACX,WAAA;AAAA,IACA,cAAA;AAAA,IACA,OAAA,EAAS;AAAA,GACX,GAAI,MAAA;AAGJ,EAAA,MAAM,eAAe,YAA6C;AAChE,IAAA,MAAM,CAAA,GAA4B,EAAE,GAAG,aAAA,EAAc;AACrD,IAAA,MAAM,KAAA,GAAQ,cAAA,GAAiB,MAAM,cAAA,EAAe,GAAI,WAAA;AACxD,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,CAAA,CAAE,eAAe,CAAA,GAAI,CAAA,OAAA,EAAU,KAAK,CAAA,CAAA;AAAA,IACtC;AACA,IAAA,OAAO,CAAA;AAAA,EACT,CAAA;AAGA,EAAA,MAAM,aAAA,GAAiC;AAAA,IACrC,OAAA,EAAS,OAAA,CAAQ,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAA;AAAA,IAClC,UAAA,EAAY;AAAA,GACd;AAGA,EAAA,MAAM,iBAAA,GAAoB,wBAAA,CAAyB,WAAA,EAAa,YAAY,CAAA;AAC5E,EAAA,MAAM,iBAAA,GAAoB,wBAAA,CAAyB,WAAA,EAAa,YAAY,CAAA;AAC5E,EAAA,MAAM,cAAA,GAAiB,wBAAA,CAAyB,QAAA,EAAU,YAAY,CAAA;AAGtE,EAAA,MAAM,CAAA,GAAI,CAAO,IAAA,KAAiB,CAAC,UAAc,SAAA,CAAgB,aAAA,EAAe,MAAM,KAAK,CAAA;AAC3F,EAAA,MAAM,CAAA,GAAI,CAAO,IAAA,KAAiB,CAAC,UAAc,YAAA,CAAmB,aAAA,EAAe,MAAM,KAAK,CAAA;AAE9F,EAAA,OAAO;AAAA;AAAA,IAEL,KAAA,EAAO;AAAA,MACL,YAAA,EAAc,EAAiC,oBAAoB,CAAA;AAAA,MACnE,YAAA,EAAc,EAAiC,oBAAoB,CAAA;AAAA,MACnE,kBAAA,EAAoB,EAAuD,0BAA0B,CAAA;AAAA,MACrG,kBAAA,EAAoB,EAA+D,0BAA0B,CAAA;AAAA,MAC7G,gBAAA,EAAkB,EAA2D,wBAAwB,CAAA;AAAA,MACrG,aAAA,EAAe,EAAqD,qBAAqB,CAAA;AAAA,MACzF,kBAAA,EAAoB,EAA+D,0BAA0B,CAAA;AAAA,MAC7G,aAAA,EAAe,EAAqD,qBAAqB,CAAA;AAAA,MACzF,UAAA,EAAY,EAA+C,kBAAkB,CAAA;AAAA,MAC7E,yBAAA,EAA2B,EAA6E,iCAAiC;AAAA,KAC3I;AAAA;AAAA,IAGA,SAAA,EAAW;AAAA,MACT,gBAAA,EAAkB,EAAmD,4BAA4B,CAAA;AAAA,MACjG,gBAAA,EAAkB,EAAmE,4BAA4B,CAAA;AAAA,MACjH,IAAA,EAAM,EAA2C,gBAAgB,CAAA;AAAA,MACjE,QAAA,EAAU,EAAmD,oBAAoB,CAAA;AAAA,MACjF,cAAA,EAAgB,EAA+D,0BAA0B,CAAA;AAAA,MACzG,aAAA,EAAe,EAAoC,yBAAyB,CAAA;AAAA,MAC5E,eAAA,EAAiB,EAAwC,2BAA2B;AAAA,KACtF;AAAA;AAAA,IAGA,WAAA,EAAa;AAAA,MACX,eAAA,EAAiB,EAAwC,6BAA6B,CAAA;AAAA,MACtF,iBAAA,EAAmB,EAA0C,+BAA+B,CAAA;AAAA,MAC5F,uBAAA,EAAyB,EAAkD,qCAAqC,CAAA;AAAA,MAChH,cAAA,EAAgB,EAAuC,4BAA4B,CAAA;AAAA,MACnF,gBAAA,EAAkB,EAAyC,8BAA8B;AAAA,KAC3F;AAAA;AAAA,IAGA,IAAA,EAAM;AAAA,MACJ,gBAAA,EAAkB,EAAgD,uBAAuB,CAAA;AAAA,MACzF,oBAAA,EAAsB,EAAoD,2BAA2B;AAAA,KACvG;AAAA;AAAA,IAGA,IAAA,EAAM;AAAA,MACJ,EAAA,EAAI,EAAyB,SAAS,CAAA;AAAA,MACtC,eAAA,EAAiB,EAAqD,sBAAsB;AAAA,KAC9F;AAAA;AAAA,IAGA,EAAA,EAAI;AAAA,MACF,YAAA,EAAc,EAA0B,eAAe,CAAA;AAAA,MACvD,SAAA,EAAW,EAAuB,YAAY,CAAA;AAAA,MAC9C,qBAAA,EAAuB,EAAqC,wBAAwB,CAAA;AAAA,MACpF,OAAA,EAAS,EAAqB,UAAU,CAAA;AAAA,MACxC,iBAAA,EAAmB,EAAgC,mBAAmB;AAAA,KACxE;AAAA;AAAA,IAGA,QAAA,EAAU,wBAAwB,iBAAiB,CAAA;AAAA;AAAA,IAGnD,QAAA,EAAU,wBAAwB,iBAAiB,CAAA;AAAA;AAAA,IAGnD,KAAA,EAAO,qBAAqB,cAAc,CAAA;AAAA;AAAA,IAG1C,UAAU,CAAU,IAAA,EAAc,UAAgB,SAAA,CAAkB,aAAA,EAAe,MAAM,KAAK,CAAA;AAAA,IAC9F,aAAa,CAAU,IAAA,EAAc,UAAgB,YAAA,CAAqB,aAAA,EAAe,MAAM,KAAK;AAAA,GACtG;AACF;AAMO,IAAM,gBAAA,GAAmB","file":"chunk-DSWHCVKV.js","sourcesContent":["/**\n * @goodz-core/sdk/core — Unified GoodZ API Client\n *\n * One client, all services. Stripe-style namespace architecture:\n * goodz.zcoin.* → Core settlement & Z-coin\n * goodz.inventory.* → Core instance management\n * goodz.collectible.* → Core card queries\n * goodz.user.* → Core user profiles\n * goodz.auth.* → Core auth\n * goodz.ip.* → Core IP (franchise/series/card)\n * goodz.commerce.* → Commerce/Shops (MCP)\n * goodz.exchange.* → Exchange marketplace (MCP)\n * goodz.alive.* → Alive companions (MCP)\n *\n * Core uses tRPC HTTP wire protocol; sub-sites use MCP JSON-RPC 2.0.\n * The client handles routing transparently.\n *\n * @example\n * ```ts\n * import { createGoodZClient } from \"@goodz-core/sdk\";\n *\n * const goodz = createGoodZClient({\n * accessToken: \"your-jwt-token\",\n * });\n *\n * // Core APIs\n * const balance = await goodz.zcoin.getMyBalance();\n * const result = await goodz.zcoin.commercialTransfer({ ... });\n *\n * // Commerce APIs\n * const shop = await goodz.commerce.createShop({ name: \"My Shop\" });\n * const order = await goodz.commerce.executePurchase({ campaignId: 1, quantity: 1 });\n *\n * // Exchange APIs\n * const listing = await goodz.exchange.createListing({ ... });\n * const data = await goodz.exchange.getMarketData({ coreGoodzId: 42 });\n *\n * // Alive APIs\n * const chat = await goodz.alive.sendMessage({ instanceId: 1, userId: 1, message: \"Hello!\" });\n * const memories = await goodz.alive.recallMemories({ instanceId: 1, userId: 1, query: \"birthday\" });\n * ```\n *\n * @module\n */\n\nimport { callQuery, callMutation, GoodZApiError } from \"../transport\";\nimport type { TransportConfig } from \"../transport\";\nimport { createMcpTransportConfig } from \"../mcp-transport\";\nimport { createCommerceNamespace } from \"../commerce/index\";\nimport type { CommerceNamespace } from \"../commerce/index\";\nimport { createExchangeNamespace } from \"../exchange/index\";\nimport type { ExchangeNamespace } from \"../exchange/index\";\nimport { createAliveNamespace } from \"../alive/index\";\nimport type { AliveNamespace } from \"../alive/index\";\nimport type {\n // zcoin\n ZcoinGetMyBalanceOutput,\n ZcoinGetMyHistoryInput,\n ZcoinCommercialTransferInput,\n ZcoinCommercialTransferOutput,\n ZcoinMintAndChargeInput,\n ZcoinMintAndChargeOutput,\n ZcoinChargeUserInput,\n ZcoinChargeUserOutput,\n ZcoinCreateDirectPurchaseOrderInput,\n ZcoinCreateDirectPurchaseOrderOutput,\n ZcoinGetDepositPackagesInput,\n ZcoinDepositPackage,\n ZcoinCreateDepositOrderInput,\n ZcoinCreateDepositOrderOutput,\n ZcoinGetDepositStatusInput,\n ZcoinGetDepositStatusOutput,\n ZcoinGetDepositUrlInput,\n ZcoinGetDepositUrlOutput,\n // inventory\n InventoryGetUserInventoryInput,\n InventoryItem,\n InventoryConfirmOwnershipInput,\n InventoryConfirmOwnershipOutput,\n InventoryMintInput,\n InventoryMintOutput,\n InventoryTransferInput,\n InventoryTransferOutput,\n InventoryTransferByCardInput,\n InventoryTransferByCardOutput,\n InventoryGrantMintAuthInput,\n InventoryTransferHistoryInput,\n // collectible\n CollectibleGetInstanceByIdInput,\n CollectibleGetPublicInstanceInput,\n CollectibleGetPublicInstancesBatchInput,\n CollectibleGetCardProfileInput,\n CollectibleGetShellImageUrlInput,\n // user\n UserGetPublicProfileInput,\n UserPublicProfile,\n UserGetPublicProfileByIdInput,\n // auth\n AuthGetOAuthAppInfoInput,\n AuthOAuthAppInfo,\n AuthUser,\n // ip\n FranchiseGetInput,\n SeriesGetInput,\n SeriesListByFranchiseInput,\n CardGetInput,\n CardListBySeriesInput,\n} from \"../types\";\n\n// ─── Re-export types and error class ─────────────────────────\n\nexport { GoodZApiError } from \"../transport\";\nexport type * from \"../types\";\nexport type * from \"../types-commerce\";\nexport type * from \"../types-exchange\";\nexport type * from \"../types-alive\";\nexport type { CommerceNamespace } from \"../commerce/index\";\nexport type { ExchangeNamespace } from \"../exchange/index\";\nexport type { AliveNamespace } from \"../alive/index\";\n\n// ─── Default sub-site URLs ──────────────────────────────────\n\nconst DEFAULT_CORE_URL = \"https://goodzcore.manus.space\";\nconst DEFAULT_COMMERCE_URL = \"https://goodzcommerce.manus.space\";\nconst DEFAULT_EXCHANGE_URL = \"https://goodzexchange.manus.space\";\nconst DEFAULT_ALIVE_URL = \"https://goodzalive.manus.space\";\n\n// ─── Client config ───────────────────────────────────────────\n\nexport interface GoodZClientConfig {\n /**\n * GoodZ.Core base URL.\n * @default \"https://goodzcore.manus.space\"\n */\n coreUrl?: string;\n\n /**\n * GoodZ.Commerce (Shops) base URL.\n * @default \"https://goodzcommerce.manus.space\"\n */\n commerceUrl?: string;\n\n /**\n * GoodZ.Exchange base URL.\n * @default \"https://goodzexchange.manus.space\"\n */\n exchangeUrl?: string;\n\n /**\n * GoodZ.Alive base URL.\n * @default \"https://goodzalive.manus.space\"\n */\n aliveUrl?: string;\n\n /**\n * Static access token (JWT) for authentication.\n * For server-to-server calls, obtain this via OAuth client_credentials flow.\n * For user-context calls, pass the user's access token.\n */\n accessToken?: string;\n\n /**\n * Dynamic token provider — called before every request.\n * Use this when tokens may rotate (e.g., auto-refresh).\n * Takes precedence over `accessToken` if both are set.\n */\n getAccessToken?: () => string | Promise<string>;\n\n /**\n * Custom headers to include in every request.\n * Useful for passing app identifiers or tracing headers.\n */\n headers?: Record<string, string>;\n}\n\n// ─── Core namespace interfaces (tRPC) ───────────────────────\n\nexport interface ZcoinNamespace {\n /** Get the authenticated user's Z-coin balance. */\n getMyBalance(): Promise<ZcoinGetMyBalanceOutput>;\n\n /** Get the authenticated user's Z-coin transaction history. */\n getMyHistory(input?: ZcoinGetMyHistoryInput): Promise<any[]>;\n\n /** Get available Z-coin deposit packages with pricing. */\n getDepositPackages(input?: ZcoinGetDepositPackagesInput): Promise<ZcoinDepositPackage[]>;\n\n /** Create a Stripe checkout session for Z-coin deposit. */\n createDepositOrder(input: ZcoinCreateDepositOrderInput): Promise<ZcoinCreateDepositOrderOutput>;\n\n /** Check the status of a deposit checkout session. */\n getDepositStatus(input: ZcoinGetDepositStatusInput): Promise<ZcoinGetDepositStatusOutput>;\n\n /**\n * Generate a deposit deep link URL for Z-coin top-up.\n * Returns a URL that redirects users to Core's deposit page.\n * After completing the deposit, the user is redirected back to returnUrl.\n *\n * No authentication required — anyone can generate a deposit URL.\n *\n * @example\n * ```ts\n * const { url } = await goodz.zcoin.getDepositUrl({\n * amount: 100,\n * returnUrl: \"https://myapp.com/shop\",\n * appId: \"od_myapp\",\n * });\n * window.open(url, \"_blank\");\n * ```\n */\n getDepositUrl(input?: ZcoinGetDepositUrlInput): Promise<ZcoinGetDepositUrlOutput>;\n\n /**\n * Atomic commercial transfer: Z-coin payment + ownership transfer in one transaction.\n * This is the primary API for Commerce and Exchange purchase flows.\n *\n * Idempotent via referenceId — duplicate calls return the same result.\n *\n * @throws {GoodZApiError} INSUFFICIENT_BALANCE — use `e.isInsufficientBalance()` to detect,\n * `e.depositUrl` to get the top-up redirect URL\n * @throws {GoodZApiError} CONFLICT — version conflict (retry)\n * @throws {GoodZApiError} FORBIDDEN — seller doesn't own instance\n */\n commercialTransfer(input: ZcoinCommercialTransferInput): Promise<ZcoinCommercialTransferOutput>;\n\n /**\n * Mint a new card instance and charge the buyer in one atomic transaction.\n * Used by Commerce for gacha and direct-from-creator purchases.\n *\n * Requires mint authorization (granted via inventory.grantMintAuth).\n * Idempotent via referenceId.\n *\n * @throws {GoodZApiError} FORBIDDEN — no mint authorization\n * @throws {GoodZApiError} INSUFFICIENT_BALANCE — use `e.isInsufficientBalance()` to detect,\n * `e.depositUrl` to get the top-up redirect URL\n */\n mintAndCharge(input: ZcoinMintAndChargeInput): Promise<ZcoinMintAndChargeOutput>;\n\n /**\n * Charge a user's Z-coin balance for an in-app purchase.\n * Used by apps that sell non-GoodZ digital goods/services.\n *\n * Idempotent via appOrderId.\n *\n * @throws {GoodZApiError} INSUFFICIENT_BALANCE — use `e.isInsufficientBalance()` to detect,\n * `e.depositUrl` to get the top-up redirect URL\n * @throws {GoodZApiError} CONFLICT — version conflict\n */\n chargeUser(input: ZcoinChargeUserInput): Promise<ZcoinChargeUserOutput>;\n\n /**\n * Create a direct purchase checkout session (fiat → Z-coin → transfer).\n * Transparent intermediation: user sees fiat price, Core handles conversion.\n */\n createDirectPurchaseOrder(input: ZcoinCreateDirectPurchaseOrderInput): Promise<ZcoinCreateDirectPurchaseOrderOutput>;\n}\n\nexport interface InventoryNamespace {\n /** Get a user's inventory (owned card instances). */\n getUserInventory(input: InventoryGetUserInventoryInput): Promise<InventoryItem[]>;\n\n /** Check if a user owns at least one instance of a specific card. */\n confirmOwnership(input: InventoryConfirmOwnershipInput): Promise<InventoryConfirmOwnershipOutput>;\n\n /**\n * Mint new card instances. Requires franchise ownership or admin role.\n * For Commerce/Exchange, use zcoin.mintAndCharge instead (includes payment).\n */\n mint(input: InventoryMintInput): Promise<InventoryMintOutput>;\n\n /**\n * Transfer a specific card instance to another user.\n * For commercial transfers, use zcoin.commercialTransfer instead.\n *\n * @deprecated for reason=\"purchase\"|\"trade\" — use commercialTransfer\n */\n transfer(input: InventoryTransferInput): Promise<InventoryTransferOutput>;\n\n /**\n * Transfer card instances by cardId (transfers oldest instances).\n * For commercial transfers, use zcoin.commercialTransfer instead.\n *\n * @deprecated for reason=\"purchase\"|\"trade\" — use commercialTransfer\n */\n transferByCard(input: InventoryTransferByCardInput): Promise<InventoryTransferByCardOutput>;\n\n /**\n * Grant mint authorization to another user/app for a specific card.\n * Required before Commerce can call zcoin.mintAndCharge for that card.\n */\n grantMintAuth(input: InventoryGrantMintAuthInput): Promise<any>;\n\n /** Get transfer/ownership history for an instance, card, or user. */\n transferHistory(input: InventoryTransferHistoryInput): Promise<any[]>;\n}\n\nexport interface CollectibleNamespace {\n /** Get a card instance by its numeric ID. Returns full instance data with card chain. */\n getInstanceById(input: CollectibleGetInstanceByIdInput): Promise<any>;\n\n /** Get a card instance by its instance code (public-facing identifier). */\n getPublicInstance(input: CollectibleGetPublicInstanceInput): Promise<any>;\n\n /** Batch-fetch multiple card instances by their IDs (max 100). */\n getPublicInstancesBatch(input: CollectibleGetPublicInstancesBatchInput): Promise<any[]>;\n\n /** Get the card profile (metadata, rarity, series info). */\n getCardProfile(input: CollectibleGetCardProfileInput): Promise<any>;\n\n /** Get the shell (packaging) image URL for a card. */\n getShellImageUrl(input: CollectibleGetShellImageUrlInput): Promise<any>;\n}\n\nexport interface UserNamespace {\n /** Get a user's public profile by openId. */\n getPublicProfile(input: UserGetPublicProfileInput): Promise<UserPublicProfile>;\n\n /** Get a user's public profile by internal userId. */\n getPublicProfileById(input: UserGetPublicProfileByIdInput): Promise<UserPublicProfile>;\n}\n\nexport interface AuthNamespace {\n /** Get the authenticated user's profile. Returns null if not authenticated. */\n me(): Promise<AuthUser | null>;\n\n /** Get public info about an OAuth app by its client ID. */\n getOAuthAppInfo(input: AuthGetOAuthAppInfoInput): Promise<AuthOAuthAppInfo | null>;\n}\n\nexport interface IpNamespace {\n /** Get a franchise by ID or slug. */\n getFranchise(input: FranchiseGetInput): Promise<any>;\n\n /** Get a series by ID or slug. */\n getSeries(input: SeriesGetInput): Promise<any>;\n\n /** List all series in a franchise. */\n listSeriesByFranchise(input: SeriesListByFranchiseInput): Promise<any[]>;\n\n /** Get a card by ID. */\n getCard(input: CardGetInput): Promise<any>;\n\n /** List all cards in a series. */\n listCardsBySeries(input: CardListBySeriesInput): Promise<any[]>;\n}\n\n// ─── GoodZClient type ────────────────────────────────────────\n\nexport interface GoodZClient {\n // ── Core namespaces (tRPC) ──\n readonly zcoin: ZcoinNamespace;\n readonly inventory: InventoryNamespace;\n readonly collectible: CollectibleNamespace;\n readonly user: UserNamespace;\n readonly auth: AuthNamespace;\n readonly ip: IpNamespace;\n\n // ── Sub-site namespaces (MCP) ──\n readonly commerce: CommerceNamespace;\n readonly exchange: ExchangeNamespace;\n readonly alive: AliveNamespace;\n\n /**\n * Make a raw tRPC query call to Core. Use this for routes not yet covered\n * by the typed namespaces.\n */\n rawQuery<T = any>(path: string, input?: any): Promise<T>;\n\n /**\n * Make a raw tRPC mutation call to Core. Use this for routes not yet covered\n * by the typed namespaces.\n */\n rawMutation<T = any>(path: string, input?: any): Promise<T>;\n}\n\n// ─── Client factory ──────────────────────────────────────────\n\n/**\n * Create a unified GoodZ API client — one client for all services.\n *\n * @example Server-to-server with static token\n * ```ts\n * const goodz = createGoodZClient({\n * accessToken: process.env.CORE_ACCESS_TOKEN,\n * });\n *\n * // Core\n * const balance = await goodz.zcoin.getMyBalance();\n *\n * // Commerce\n * const shop = await goodz.commerce.createShop({ name: \"My Shop\" });\n *\n * // Exchange\n * const listings = await goodz.exchange.browseMarketplace();\n *\n * // Alive\n * const chat = await goodz.alive.sendMessage({ instanceId: 1, userId: 1, message: \"Hi!\" });\n * ```\n *\n * @example With dynamic token provider (auto-refresh)\n * ```ts\n * const goodz = createGoodZClient({\n * getAccessToken: async () => {\n * const token = await refreshTokenIfNeeded();\n * return token;\n * },\n * });\n * ```\n *\n * @example Custom sub-site URLs (e.g., staging environment)\n * ```ts\n * const goodz = createGoodZClient({\n * accessToken: \"...\",\n * coreUrl: \"https://staging-core.goodz.dev\",\n * commerceUrl: \"https://staging-commerce.goodz.dev\",\n * exchangeUrl: \"https://staging-exchange.goodz.dev\",\n * aliveUrl: \"https://staging-alive.goodz.dev\",\n * });\n * ```\n */\nexport function createGoodZClient(config: GoodZClientConfig = {}): GoodZClient {\n const {\n coreUrl = DEFAULT_CORE_URL,\n commerceUrl = DEFAULT_COMMERCE_URL,\n exchangeUrl = DEFAULT_EXCHANGE_URL,\n aliveUrl = DEFAULT_ALIVE_URL,\n accessToken,\n getAccessToken,\n headers: customHeaders,\n } = config;\n\n // Shared header builder — used by both tRPC and MCP transports\n const buildHeaders = async (): Promise<Record<string, string>> => {\n const h: Record<string, string> = { ...customHeaders };\n const token = getAccessToken ? await getAccessToken() : accessToken;\n if (token) {\n h[\"Authorization\"] = `Bearer ${token}`;\n }\n return h;\n };\n\n // ── Core transport (tRPC) ──\n const coreTransport: TransportConfig = {\n baseUrl: coreUrl.replace(/\\/$/, \"\"),\n getHeaders: buildHeaders,\n };\n\n // ── Sub-site transports (MCP) ──\n const commerceTransport = createMcpTransportConfig(commerceUrl, buildHeaders);\n const exchangeTransport = createMcpTransportConfig(exchangeUrl, buildHeaders);\n const aliveTransport = createMcpTransportConfig(aliveUrl, buildHeaders);\n\n // Helper shortcuts for Core tRPC\n const q = <I, O>(path: string) => (input?: I) => callQuery<I, O>(coreTransport, path, input);\n const m = <I, O>(path: string) => (input?: I) => callMutation<I, O>(coreTransport, path, input);\n\n return {\n // ── zcoin ──────────────────────────────────────────────\n zcoin: {\n getMyBalance: q<void, ZcoinGetMyBalanceOutput>(\"zcoin.getMyBalance\"),\n getMyHistory: q<ZcoinGetMyHistoryInput, any[]>(\"zcoin.getMyHistory\"),\n getDepositPackages: q<ZcoinGetDepositPackagesInput, ZcoinDepositPackage[]>(\"zcoin.getDepositPackages\"),\n createDepositOrder: m<ZcoinCreateDepositOrderInput, ZcoinCreateDepositOrderOutput>(\"zcoin.createDepositOrder\"),\n getDepositStatus: q<ZcoinGetDepositStatusInput, ZcoinGetDepositStatusOutput>(\"zcoin.getDepositStatus\"),\n getDepositUrl: q<ZcoinGetDepositUrlInput, ZcoinGetDepositUrlOutput>(\"zcoin.getDepositUrl\"),\n commercialTransfer: m<ZcoinCommercialTransferInput, ZcoinCommercialTransferOutput>(\"zcoin.commercialTransfer\"),\n mintAndCharge: m<ZcoinMintAndChargeInput, ZcoinMintAndChargeOutput>(\"zcoin.mintAndCharge\"),\n chargeUser: m<ZcoinChargeUserInput, ZcoinChargeUserOutput>(\"zcoin.chargeUser\"),\n createDirectPurchaseOrder: m<ZcoinCreateDirectPurchaseOrderInput, ZcoinCreateDirectPurchaseOrderOutput>(\"zcoin.createDirectPurchaseOrder\"),\n },\n\n // ── inventory ──────────────────────────────────────────\n inventory: {\n getUserInventory: q<InventoryGetUserInventoryInput, InventoryItem[]>(\"inventory.getUserInventory\"),\n confirmOwnership: q<InventoryConfirmOwnershipInput, InventoryConfirmOwnershipOutput>(\"inventory.confirmOwnership\"),\n mint: m<InventoryMintInput, InventoryMintOutput>(\"inventory.mint\"),\n transfer: m<InventoryTransferInput, InventoryTransferOutput>(\"inventory.transfer\"),\n transferByCard: m<InventoryTransferByCardInput, InventoryTransferByCardOutput>(\"inventory.transferByCard\"),\n grantMintAuth: m<InventoryGrantMintAuthInput, any>(\"inventory.grantMintAuth\"),\n transferHistory: q<InventoryTransferHistoryInput, any[]>(\"inventory.transferHistory\"),\n },\n\n // ── collectible ────────────────────────────────────────\n collectible: {\n getInstanceById: q<CollectibleGetInstanceByIdInput, any>(\"collectible.getInstanceById\"),\n getPublicInstance: q<CollectibleGetPublicInstanceInput, any>(\"collectible.getPublicInstance\"),\n getPublicInstancesBatch: q<CollectibleGetPublicInstancesBatchInput, any[]>(\"collectible.getPublicInstancesBatch\"),\n getCardProfile: q<CollectibleGetCardProfileInput, any>(\"collectible.getCardProfile\"),\n getShellImageUrl: q<CollectibleGetShellImageUrlInput, any>(\"collectible.getShellImageUrl\"),\n },\n\n // ── user ───────────────────────────────────────────────\n user: {\n getPublicProfile: q<UserGetPublicProfileInput, UserPublicProfile>(\"user.getPublicProfile\"),\n getPublicProfileById: q<UserGetPublicProfileByIdInput, UserPublicProfile>(\"user.getPublicProfileById\"),\n },\n\n // ── auth ───────────────────────────────────────────────\n auth: {\n me: q<void, AuthUser | null>(\"auth.me\"),\n getOAuthAppInfo: q<AuthGetOAuthAppInfoInput, AuthOAuthAppInfo | null>(\"auth.getOAuthAppInfo\"),\n },\n\n // ── ip (franchise/series/card) ─────────────────────────\n ip: {\n getFranchise: q<FranchiseGetInput, any>(\"franchise.get\"),\n getSeries: q<SeriesGetInput, any>(\"series.get\"),\n listSeriesByFranchise: q<SeriesListByFranchiseInput, any[]>(\"series.listByFranchise\"),\n getCard: q<CardGetInput, any>(\"card.get\"),\n listCardsBySeries: q<CardListBySeriesInput, any[]>(\"card.listBySeries\"),\n },\n\n // ── commerce (MCP) ─────────────────────────────────────\n commerce: createCommerceNamespace(commerceTransport),\n\n // ── exchange (MCP) ─────────────────────────────────────\n exchange: createExchangeNamespace(exchangeTransport),\n\n // ── alive (MCP) ────────────────────────────────────────\n alive: createAliveNamespace(aliveTransport),\n\n // ── raw escape hatches (Core tRPC only) ────────────────\n rawQuery: <T = any>(path: string, input?: any) => callQuery<any, T>(coreTransport, path, input),\n rawMutation: <T = any>(path: string, input?: any) => callMutation<any, T>(coreTransport, path, input),\n };\n}\n\n/**\n * Alias for createGoodZClient — creates a client acting on behalf of a user.\n * Semantically identical, but makes the intent clearer in server-to-server code.\n */\nexport const createUserClient = createGoodZClient;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/exchange/index.ts"],"names":[],"mappings":";;;AAqGO,SAAS,wBAAwB,SAAA,EAA+C;AACrF,EAAA,MAAM,IAAA,GAAO,CAAmC,IAAA,KAC9C,CAAC,UAAc,WAAA,CAAkB,SAAA,EAAW,MAAM,KAAU,CAAA;AAE9D,EAAA,OAAO;AAAA;AAAA,IAEL,iBAAA,EAAmB,KAAwD,oBAAoB,CAAA;AAAA,IAC/F,gBAAA,EAAkB,KAAqD,oBAAoB,CAAA;AAAA;AAAA,IAG3F,aAAA,EAAe,KAA8D,gBAAgB,CAAA;AAAA,IAC7F,aAAA,EAAe,KAAsC,gBAAgB,CAAA;AAAA;AAAA,IAGrE,UAAA,EAAY,KAAwD,aAAa,CAAA;AAAA,IACjF,QAAA,EAAU,KAAoD,WAAW,CAAA;AAAA,IACzE,OAAA,EAAS,KAA0C,UAAU,CAAA;AAAA;AAAA,IAG7D,SAAA,EAAW,KAA0C,YAAY,CAAA;AAAA,IACjE,UAAA,EAAY,KAAwD,aAAa,CAAA;AAAA,IACjF,SAAA,EAAW,KAAkC,YAAY,CAAA;AAAA;AAAA,IAGzD,YAAA,EAAc,KAAuD,eAAe,CAAA;AAAA,IACpF,cAAA,EAAgB,KAAgE,kBAAkB,CAAA;AAAA;AAAA,IAGlG,YAAA,EAAc,KAAqD,eAAe,CAAA;AAAA,IAClF,cAAA,EAAgB,KAAyD,kBAAkB,CAAA;AAAA,IAC3F,mBAAA,EAAqB,KAA4C,uBAAuB,CAAA;AAAA;AAAA,IAGxF,aAAA,EAAe,KAAqD,iBAAiB,CAAA;AAAA;AAAA,IAGrF,SAAS,CAAU,QAAA,EAAkB,SACnC,WAAA,CAAoC,SAAA,EAAW,UAAU,IAAI;AAAA,GACjE;AACF","file":"chunk-GH33FPMY.js","sourcesContent":["/**\n * @goodz-core/sdk — Exchange Namespace\n *\n * Provides typed access to GoodZ.Exchange MCP tools:\n * marketplace listings, auctions, WTB, P2P trades,\n * watchlist, and market data.\n *\n * All prices are in Z-coin (1 Z-coin = $0.10 USD).\n *\n * @module\n */\n\nimport { callMcpTool } from \"../mcp-transport\";\nimport type { TransportConfig } from \"../mcp-transport\";\nimport type {\n ExchangeBrowseMarketplaceInput,\n ExchangeListing,\n ExchangeGetListingDetailInput,\n ExchangeCreateListingInput,\n ExchangeCreateListingOutput,\n ExchangeCancelListingInput,\n ExchangeBuyListingInput,\n ExchangeBuyListingOutput,\n ExchangePlaceBidInput,\n ExchangePlaceBidOutput,\n ExchangeGetBidsInput,\n ExchangeBid,\n ExchangeCreateWtbInput,\n ExchangeWtb,\n ExchangeFulfillWtbInput,\n ExchangeFulfillWtbOutput,\n ExchangeCancelWtbInput,\n ExchangeProposeTradeInput,\n ExchangeTradeProposal,\n ExchangeRespondToTradeInput,\n ExchangeRespondToTradeOutput,\n ExchangeAddToWatchlistInput,\n ExchangeWatchlistItem,\n ExchangeRemoveFromWatchlistInput,\n ExchangeGetMarketDataInput,\n ExchangeMarketData,\n} from \"../types-exchange\";\n\n// Re-export all Exchange types\nexport type * from \"../types-exchange\";\n\n// ─── Namespace interface ────────────────────────────────────\n\nexport interface ExchangeNamespace {\n // Marketplace\n /** Browse active marketplace listings. */\n browseMarketplace(input?: ExchangeBrowseMarketplaceInput): Promise<ExchangeListing[]>;\n /** Get detailed info about a specific listing. */\n getListingDetail(input: ExchangeGetListingDetailInput): Promise<ExchangeListing>;\n\n // Listing Management\n /** Create a new listing (fixed_price or auction). Core locks the instance atomically. */\n createListing(input: ExchangeCreateListingInput): Promise<ExchangeCreateListingOutput>;\n /** Cancel an active listing. Core unlocks the instance. */\n cancelListing(input: ExchangeCancelListingInput): Promise<any>;\n\n // Purchase & Bidding\n /** Buy a fixed-price listing. Z-coin debit + ownership transfer via Core settlement. */\n buyListing(input: ExchangeBuyListingInput): Promise<ExchangeBuyListingOutput>;\n /** Place a bid on an auction. If bid meets buy-now price, immediate purchase is executed. */\n placeBid(input: ExchangePlaceBidInput): Promise<ExchangePlaceBidOutput>;\n /** Get all bids for an auction listing (highest first). */\n getBids(input: ExchangeGetBidsInput): Promise<ExchangeBid[]>;\n\n // Want-to-Buy\n /** Create a WTB request — announce what you're looking for. */\n createWtb(input: ExchangeCreateWtbInput): Promise<ExchangeWtb>;\n /** Fulfill a WTB request by offering your item. Settlement via Core. */\n fulfillWtb(input: ExchangeFulfillWtbInput): Promise<ExchangeFulfillWtbOutput>;\n /** Cancel your own WTB request. */\n cancelWtb(input: ExchangeCancelWtbInput): Promise<any>;\n\n // P2P Trade\n /** Propose a trade/swap with another user. Optional Z-coin compensation. */\n proposeTrade(input: ExchangeProposeTradeInput): Promise<ExchangeTradeProposal>;\n /** Accept or reject a trade proposal. If accepted, all items transfer via Core. */\n respondToTrade(input: ExchangeRespondToTradeInput): Promise<ExchangeRespondToTradeOutput>;\n\n // Watchlist\n /** Get your watchlist. */\n getWatchlist(): Promise<ExchangeWatchlistItem[]>;\n /** Add a GoodZ or listing to your watchlist. */\n addToWatchlist(input: ExchangeAddToWatchlistInput): Promise<ExchangeWatchlistItem>;\n /** Remove an item from your watchlist. */\n removeFromWatchlist(input: ExchangeRemoveFromWatchlistInput): Promise<any>;\n\n // Market Data\n /** Get market data: price history, floor price, volume, trends. */\n getMarketData(input: ExchangeGetMarketDataInput): Promise<ExchangeMarketData>;\n\n /** Call a raw MCP tool by name. Escape hatch for tools not yet in the typed API. */\n rawTool<T = any>(toolName: string, args?: Record<string, any>): Promise<T>;\n}\n\n// ─── Factory ────────────────────────────────────────────────\n\nexport function createExchangeNamespace(transport: TransportConfig): ExchangeNamespace {\n const tool = <I extends Record<string, any>, O>(name: string) =>\n (input?: I) => callMcpTool<I, O>(transport, name, input as I);\n\n return {\n // Marketplace\n browseMarketplace: tool<ExchangeBrowseMarketplaceInput, ExchangeListing[]>(\"browse_marketplace\"),\n getListingDetail: tool<ExchangeGetListingDetailInput, ExchangeListing>(\"get_listing_detail\"),\n\n // Listing Management\n createListing: tool<ExchangeCreateListingInput, ExchangeCreateListingOutput>(\"create_listing\"),\n cancelListing: tool<ExchangeCancelListingInput, any>(\"cancel_listing\"),\n\n // Purchase & Bidding\n buyListing: tool<ExchangeBuyListingInput, ExchangeBuyListingOutput>(\"buy_listing\"),\n placeBid: tool<ExchangePlaceBidInput, ExchangePlaceBidOutput>(\"place_bid\"),\n getBids: tool<ExchangeGetBidsInput, ExchangeBid[]>(\"get_bids\"),\n\n // WTB\n createWtb: tool<ExchangeCreateWtbInput, ExchangeWtb>(\"create_wtb\"),\n fulfillWtb: tool<ExchangeFulfillWtbInput, ExchangeFulfillWtbOutput>(\"fulfill_wtb\"),\n cancelWtb: tool<ExchangeCancelWtbInput, any>(\"cancel_wtb\"),\n\n // P2P Trade\n proposeTrade: tool<ExchangeProposeTradeInput, ExchangeTradeProposal>(\"propose_trade\"),\n respondToTrade: tool<ExchangeRespondToTradeInput, ExchangeRespondToTradeOutput>(\"respond_to_trade\"),\n\n // Watchlist\n getWatchlist: tool<Record<string, never>, ExchangeWatchlistItem[]>(\"get_watchlist\"),\n addToWatchlist: tool<ExchangeAddToWatchlistInput, ExchangeWatchlistItem>(\"add_to_watchlist\"),\n removeFromWatchlist: tool<ExchangeRemoveFromWatchlistInput, any>(\"remove_from_watchlist\"),\n\n // Market Data\n getMarketData: tool<ExchangeGetMarketDataInput, ExchangeMarketData>(\"get_market_data\"),\n\n // Raw escape hatch\n rawTool: <T = any>(toolName: string, args?: Record<string, any>) =>\n callMcpTool<Record<string, any>, T>(transport, toolName, args),\n };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commerce/index.ts"],"names":[],"mappings":";;;AAuJO,SAAS,wBAAwB,SAAA,EAA+C;AACrF,EAAA,MAAM,IAAA,GAAO,CAAmC,IAAA,KAC9C,CAAC,UAAc,WAAA,CAAkB,SAAA,EAAW,MAAM,KAAU,CAAA;AAE9D,EAAA,OAAO;AAAA;AAAA,IAEL,UAAA,EAAY,KAA4C,aAAa,CAAA;AAAA,IACrE,gBAAA,EAAkB,KAA2D,oBAAoB,CAAA;AAAA;AAAA,IAGjG,WAAA,EAAa,KAA8C,gBAAgB,CAAA;AAAA,IAC3E,eAAA,EAAiB,KAAsD,mBAAmB,CAAA;AAAA;AAAA,IAG1F,cAAA,EAAgB,KAAoD,uBAAuB,CAAA;AAAA,IAC3F,gBAAA,EAAkB,KAAsD,mBAAmB,CAAA;AAAA,IAC3F,aAAA,EAAe,KAAmD,gBAAgB,CAAA;AAAA,IAClF,WAAA,EAAa,KAAiD,cAAc,CAAA;AAAA,IAC5E,cAAA,EAAgB,KAAoD,iBAAiB,CAAA;AAAA,IACrF,eAAA,EAAiB,KAAwC,mBAAmB,CAAA;AAAA,IAC5E,gBAAA,EAAkB,KAA4D,oBAAoB,CAAA;AAAA;AAAA,IAGlG,eAAA,EAAiB,KAAuD,kBAAkB,CAAA;AAAA,IAC1F,WAAA,EAAa,KAAgD,eAAe,CAAA;AAAA;AAAA,IAG5E,kBAAA,EAAoB,KAA2C,sBAAsB,CAAA;AAAA,IACrF,eAAA,EAAiB,KAA+D,yBAAyB,CAAA;AAAA,IACzG,YAAA,EAAc,KAAqC,eAAe,CAAA;AAAA;AAAA,IAGlE,eAAA,EAAiB,KAAwC,kBAAkB,CAAA;AAAA,IAC3E,iBAAA,EAAmB,KAA0C,oBAAoB,CAAA;AAAA,IACjF,eAAA,EAAiB,KAAwC,mBAAmB,CAAA;AAAA;AAAA,IAG5E,mBAAA,EAAqB,KAA4C,uBAAuB,CAAA;AAAA;AAAA,IAGxF,iBAAA,EAAmB,KAA4C,oBAAoB,CAAA;AAAA,IACnF,mBAAA,EAAqB,KAA8C,wBAAwB,CAAA;AAAA;AAAA,IAG3F,cAAA,EAAgB,KAAuC,uBAAuB,CAAA;AAAA;AAAA,IAG9E,eAAA,EAAiB,KAAoD,kBAAkB,CAAA;AAAA,IACvF,YAAA,EAAc,KAA+C,eAAe,CAAA;AAAA,IAC5E,WAAA,EAAa,KAAoC,cAAc,CAAA;AAAA,IAC/D,aAAA,EAAe,KAAsC,gBAAgB,CAAA;AAAA;AAAA,IAGrE,WAAA,EAAa,KAAoC,cAAc,CAAA;AAAA,IAC/D,SAAA,EAAW,KAAkC,YAAY,CAAA;AAAA,IACzD,UAAA,EAAY,KAAqC,cAAc,CAAA;AAAA,IAC/D,UAAA,EAAY,KAA+C,cAAc,CAAA;AAAA;AAAA,IAGzE,SAAS,CAAU,QAAA,EAAkB,SACnC,WAAA,CAAoC,SAAA,EAAW,UAAU,IAAI;AAAA,GACjE;AACF","file":"chunk-SWD7BJQ7.js","sourcesContent":["/**\n * @goodz-core/sdk — Commerce / Shops Namespace\n *\n * Provides typed access to GoodZ.Commerce MCP tools:\n * shop management, batches, gacha pools, campaigns,\n * wholesale, purchases, settlement, and webhooks.\n *\n * @module\n */\n\nimport { callMcpTool } from \"../mcp-transport\";\nimport type { TransportConfig } from \"../mcp-transport\";\nimport type {\n CommerceCreateShopInput,\n CommerceShop,\n CommerceGetShopDashboardInput,\n CommerceShopDashboard,\n CommerceCreateBatchInput,\n CommerceBatch,\n CommerceCreateGachaPoolInput,\n CommerceGachaPool,\n CommerceLaunchCampaignInput,\n CommerceCampaign,\n CommerceActivateCampaignInput,\n CommercePauseCampaignInput,\n CommerceEndCampaignInput,\n CommerceUpdateCampaignInput,\n CommerceGetCampaignInfoInput,\n CommerceGetCampaignItemsInput,\n CommerceCampaignItem,\n CommerceExecutePurchaseInput,\n CommerceDrawResult,\n CommerceGetMyOrdersInput,\n CommerceOrder,\n CommercePublishToWholesaleInput,\n CommerceBrowseWholesaleInput,\n CommerceWholesaleListing,\n CommerceProcureBatchInput,\n CommerceManageInventoryInput,\n CommerceRegisterInstancesInput,\n CommerceMintToInventoryInput,\n CommerceGetSettlementReportInput,\n CommerceSearchMarketplaceInput,\n CommerceGetShopsByBlueprintInput,\n CommerceRedeemPhysicalInput,\n CommerceRegisterWebhookInput,\n CommerceWebhook,\n CommerceTestWebhookInput,\n CommerceDeleteWebhookInput,\n CommerceRegisterAppInput,\n CommerceUpdateAppInput,\n CommerceListMyAppsInput,\n CommerceGetAuthUrlInput,\n} from \"../types-commerce\";\n\n// Re-export all Commerce types\nexport type * from \"../types-commerce\";\n\n// ─── Namespace interface ────────────────────────────────────\n\nexport interface CommerceNamespace {\n // Shop Management\n /** Create a new shop. */\n createShop(input: CommerceCreateShopInput): Promise<CommerceShop>;\n /** Get shop dashboard with stats, revenue, and recent orders. */\n getShopDashboard(input?: CommerceGetShopDashboardInput): Promise<CommerceShopDashboard>;\n\n // Product Assembly\n /** Create a batch (product assembly with tiers). Supports blind_box, ichiban_kuji, direct_sale. */\n createBatch(input: CommerceCreateBatchInput): Promise<CommerceBatch>;\n /** Create a gacha pool with weighted probabilities and optional pity mechanics. */\n createGachaPool(input: CommerceCreateGachaPoolInput): Promise<CommerceGachaPool>;\n\n // Campaign Lifecycle\n /** Launch a sales campaign in draft status. Connect a Batch or Gacha pool to the storefront. */\n launchCampaign(input: CommerceLaunchCampaignInput): Promise<CommerceCampaign>;\n /** Activate a draft/paused campaign — makes it live and purchasable. */\n activateCampaign(input: CommerceActivateCampaignInput): Promise<CommerceCampaign>;\n /** Pause an active campaign. Existing orders unaffected. */\n pauseCampaign(input: CommercePauseCampaignInput): Promise<CommerceCampaign>;\n /** Permanently end a campaign (terminal state). */\n endCampaign(input: CommerceEndCampaignInput): Promise<CommerceCampaign>;\n /** Update campaign configuration (editable fields depend on status). */\n updateCampaign(input: CommerceUpdateCampaignInput): Promise<CommerceCampaign>;\n /** Get detailed campaign info including batch/gacha config and tiers. */\n getCampaignInfo(input: CommerceGetCampaignInfoInput): Promise<any>;\n /** Get unified campaign items list (works for both batch and gacha campaigns). */\n getCampaignItems(input: CommerceGetCampaignItemsInput): Promise<CommerceCampaignItem[]>;\n\n // Purchase / Draw\n /** Execute a purchase or draw. Handles payment, draw mechanics, settlement, and ownership transfer. */\n executePurchase(input: CommerceExecutePurchaseInput): Promise<CommerceDrawResult>;\n /** Get the authenticated user's order history. */\n getMyOrders(input?: CommerceGetMyOrdersInput): Promise<CommerceOrder[]>;\n\n // Wholesale\n /** Publish a batch to the wholesale market for other shopkeepers to procure. */\n publishToWholesale(input: CommercePublishToWholesaleInput): Promise<any>;\n /** Browse available wholesale listings. */\n browseWholesale(input?: CommerceBrowseWholesaleInput): Promise<CommerceWholesaleListing[]>;\n /** Procure goods from the wholesale market. */\n procureBatch(input: CommerceProcureBatchInput): Promise<any>;\n\n // Inventory\n /** View and manage shop inventory (list or sync from Core). */\n manageInventory(input?: CommerceManageInventoryInput): Promise<any>;\n /** Register existing Core instances into shop inventory. */\n registerInstances(input: CommerceRegisterInstancesInput): Promise<any>;\n /** Mint new instances directly into shop inventory. */\n mintToInventory(input: CommerceMintToInventoryInput): Promise<any>;\n\n // Settlement\n /** Get settlement report with revenue breakdown. */\n getSettlementReport(input?: CommerceGetSettlementReportInput): Promise<any>;\n\n // Discovery\n /** Search the marketplace for campaigns. */\n searchMarketplace(input?: CommerceSearchMarketplaceInput): Promise<any[]>;\n /** Find shops selling a specific GoodZ card. */\n getShopsByBlueprint(input: CommerceGetShopsByBlueprintInput): Promise<any[]>;\n\n // Physical Redemption\n /** Request physical redemption for a purchased item. */\n redeemPhysical(input: CommerceRedeemPhysicalInput): Promise<any>;\n\n // Webhooks\n /** Register a webhook URL to receive shop event notifications. */\n registerWebhook(input: CommerceRegisterWebhookInput): Promise<CommerceWebhook>;\n /** List all registered webhook endpoints. */\n listWebhooks(): Promise<CommerceWebhook[]>;\n /** Send a test ping to a webhook endpoint. */\n testWebhook(input: CommerceTestWebhookInput): Promise<any>;\n /** Delete a webhook endpoint. */\n deleteWebhook(input: CommerceDeleteWebhookInput): Promise<any>;\n\n // OAuth App Management\n /** Register a new OAuth application with Commerce scopes. */\n registerApp(input: CommerceRegisterAppInput): Promise<any>;\n /** Update an existing OAuth application. */\n updateApp(input: CommerceUpdateAppInput): Promise<any>;\n /** List all OAuth applications owned by the user. */\n listMyApps(input?: CommerceListMyAppsInput): Promise<any[]>;\n /** Generate an OAuth authorization URL. */\n getAuthUrl(input?: CommerceGetAuthUrlInput): Promise<{ url: string }>;\n\n /** Call a raw MCP tool by name. Escape hatch for tools not yet in the typed API. */\n rawTool<T = any>(toolName: string, args?: Record<string, any>): Promise<T>;\n}\n\n// ─── Factory ────────────────────────────────────────────────\n\nexport function createCommerceNamespace(transport: TransportConfig): CommerceNamespace {\n const tool = <I extends Record<string, any>, O>(name: string) =>\n (input?: I) => callMcpTool<I, O>(transport, name, input as I);\n\n return {\n // Shop\n createShop: tool<CommerceCreateShopInput, CommerceShop>(\"create_shop\"),\n getShopDashboard: tool<CommerceGetShopDashboardInput, CommerceShopDashboard>(\"get_shop_dashboard\"),\n\n // Product Assembly\n createBatch: tool<CommerceCreateBatchInput, CommerceBatch>(\"assemble_batch\"),\n createGachaPool: tool<CommerceCreateGachaPoolInput, CommerceGachaPool>(\"create_gacha_pool\"),\n\n // Campaign Lifecycle\n launchCampaign: tool<CommerceLaunchCampaignInput, CommerceCampaign>(\"launch_sales_campaign\"),\n activateCampaign: tool<CommerceActivateCampaignInput, CommerceCampaign>(\"activate_campaign\"),\n pauseCampaign: tool<CommercePauseCampaignInput, CommerceCampaign>(\"pause_campaign\"),\n endCampaign: tool<CommerceEndCampaignInput, CommerceCampaign>(\"end_campaign\"),\n updateCampaign: tool<CommerceUpdateCampaignInput, CommerceCampaign>(\"update_campaign\"),\n getCampaignInfo: tool<CommerceGetCampaignInfoInput, any>(\"get_campaign_info\"),\n getCampaignItems: tool<CommerceGetCampaignItemsInput, CommerceCampaignItem[]>(\"get_campaign_items\"),\n\n // Purchase\n executePurchase: tool<CommerceExecutePurchaseInput, CommerceDrawResult>(\"execute_purchase\"),\n getMyOrders: tool<CommerceGetMyOrdersInput, CommerceOrder[]>(\"get_my_orders\"),\n\n // Wholesale\n publishToWholesale: tool<CommercePublishToWholesaleInput, any>(\"publish_to_wholesale\"),\n browseWholesale: tool<CommerceBrowseWholesaleInput, CommerceWholesaleListing[]>(\"browse_wholesale_market\"),\n procureBatch: tool<CommerceProcureBatchInput, any>(\"procure_batch\"),\n\n // Inventory\n manageInventory: tool<CommerceManageInventoryInput, any>(\"manage_inventory\"),\n registerInstances: tool<CommerceRegisterInstancesInput, any>(\"register_instances\"),\n mintToInventory: tool<CommerceMintToInventoryInput, any>(\"mint_to_inventory\"),\n\n // Settlement\n getSettlementReport: tool<CommerceGetSettlementReportInput, any>(\"get_settlement_report\"),\n\n // Discovery\n searchMarketplace: tool<CommerceSearchMarketplaceInput, any[]>(\"search_marketplace\"),\n getShopsByBlueprint: tool<CommerceGetShopsByBlueprintInput, any[]>(\"get_shops_by_blueprint\"),\n\n // Physical Redemption\n redeemPhysical: tool<CommerceRedeemPhysicalInput, any>(\"redeem_physical_goodz\"),\n\n // Webhooks\n registerWebhook: tool<CommerceRegisterWebhookInput, CommerceWebhook>(\"register_webhook\"),\n listWebhooks: tool<Record<string, never>, CommerceWebhook[]>(\"list_webhooks\"),\n testWebhook: tool<CommerceTestWebhookInput, any>(\"test_webhook\"),\n deleteWebhook: tool<CommerceDeleteWebhookInput, any>(\"delete_webhook\"),\n\n // OAuth App\n registerApp: tool<CommerceRegisterAppInput, any>(\"register_app\"),\n updateApp: tool<CommerceUpdateAppInput, any>(\"update_app\"),\n listMyApps: tool<CommerceListMyAppsInput, any[]>(\"list_my_apps\"),\n getAuthUrl: tool<CommerceGetAuthUrlInput, { url: string }>(\"get_auth_url\"),\n\n // Raw escape hatch\n rawTool: <T = any>(toolName: string, args?: Record<string, any>) =>\n callMcpTool<Record<string, any>, T>(transport, toolName, args),\n };\n}\n"]}
|