@quantabit/market-sdk 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 QuantaBit Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,125 @@
1
+ # @quantabit/market-sdk
2
+
3
+ > QuantaBit Market SDK - Product listing, auction, matching, and trading
4
+
5
+ ## 📦 Installation
6
+
7
+ ```bash
8
+ npm install @quantabit/market-sdk
9
+ # or
10
+ yarn add @quantabit/market-sdk
11
+ ```
12
+
13
+ ## 🚀 Quick Start
14
+
15
+ ### 1. Setup Provider
16
+
17
+ ```jsx
18
+ import { MarketProvider } from "@quantabit/market-sdk";
19
+ import "@quantabit/market-sdk/styles.css";
20
+
21
+ function App() {
22
+ return (
23
+ <MarketProvider
24
+ apiUrl="https://api.example.com/v1"
25
+ token="your-auth-token"
26
+ language="en"
27
+ onPurchase={(result) => console.log("Purchase successful:", result)}
28
+ onBid={(result) => console.log("Bid placed:", result)}
29
+ >
30
+ <YourComponent />
31
+ </MarketProvider>
32
+ );
33
+ }
34
+ ```
35
+
36
+ ### 2. Using Components
37
+
38
+ ```jsx
39
+ import { ListingCard } from "@quantabit/market-sdk";
40
+
41
+ // Market listing card
42
+ <ListingCard
43
+ listing={listingData}
44
+ onBuy={(result) => console.log("Purchase:", result)}
45
+ onBid={(listing) => openBidModal(listing)}
46
+ onClick={(listing) => navigateToDetail(listing.id)}
47
+ />;
48
+ ```
49
+
50
+ ### 3. Using Hooks
51
+
52
+ ```jsx
53
+ import { useMarket } from "@quantabit/market-sdk";
54
+
55
+ function MyComponent() {
56
+ const {
57
+ listings, // Market listings
58
+ myListings, // My listings
59
+ myPurchases, // My purchases
60
+ loading,
61
+ loadListings, // Load market
62
+ buy, // Buy
63
+ placeBid, // Place bid
64
+ } = useMarket();
65
+
66
+ return <div>...</div>;
67
+ }
68
+ ```
69
+
70
+ ## 📚 Components
71
+
72
+ | Component | Description |
73
+ | ------------- | -------------------------------------------------------------- |
74
+ | `ListingCard` | Market listing card (image, price, auction countdown, actions) |
75
+
76
+ ## 📖 Type Definitions
77
+
78
+ ```javascript
79
+ import { ListingType, ListingStatus, ItemType } from "@quantabit/market-sdk";
80
+
81
+ // Listing types
82
+ ListingType.FIXED; // Fixed price
83
+ ListingType.AUCTION; // Auction
84
+ ListingType.OFFER; // Make an offer
85
+
86
+ // Item types
87
+ ItemType.NFT; // NFT
88
+ ItemType.TOKEN; // Token
89
+ ItemType.GOODS; // Physical goods
90
+ ItemType.DIGITAL; // Digital goods
91
+ ```
92
+
93
+ ## 🧮 Utility Functions
94
+
95
+ ```javascript
96
+ import {
97
+ formatPrice,
98
+ isAuctionEnded,
99
+ getTimeRemaining,
100
+ } from "@quantabit/market-sdk";
101
+
102
+ // Format price
103
+ formatPrice(1.5, "ETH"); // Ξ1.5
104
+
105
+ // Check if auction has ended
106
+ const ended = isAuctionEnded(listing);
107
+
108
+ // Get remaining time
109
+ const { days, hours, minutes, seconds } = getTimeRemaining(listing.end_at);
110
+ ```
111
+
112
+ ## 📄 License
113
+
114
+ MIT License
115
+
116
+
117
+
118
+ ---
119
+
120
+ ## 🌐 Brand & Links
121
+ - Official Mainnet: [QuantaBit Chain](https://qbitchain.io/)
122
+ - Developer Platform: [Developer Platform](https://developer.quantabit.io/)
123
+ - Open Platform: [Open Platform](https://open.quantabit.io/)
124
+ - Payment Platform: [Pay Platform](https://pay.qbitwallet.io/)
125
+ - Feedback: [Feedback](https://xwin.live/qbit)