@quantabit/order-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,138 @@
1
+ # @quantabit/order-sdk
2
+
3
+ > QuantaBit Order SDK - Order creation, management, and status flow
4
+
5
+ ## 📦 Installation
6
+
7
+ ```bash
8
+ npm install @quantabit/order-sdk
9
+ # or
10
+ yarn add @quantabit/order-sdk
11
+ ```
12
+
13
+ ## 🚀 Quick Start
14
+
15
+ ### 1. Setup Provider
16
+
17
+ ```jsx
18
+ import { OrderProvider } from "@quantabit/order-sdk";
19
+ import "@quantabit/order-sdk/styles.css";
20
+
21
+ function App() {
22
+ return (
23
+ <OrderProvider
24
+ apiUrl="https://api.example.com/v1"
25
+ token="your-auth-token"
26
+ language="en"
27
+ onOrderPay={(result) => console.log("Payment:", result)}
28
+ >
29
+ <YourComponent />
30
+ </OrderProvider>
31
+ );
32
+ }
33
+ ```
34
+
35
+ ### 2. Using Components
36
+
37
+ ```jsx
38
+ import { OrderCard, OrderList } from '@quantabit/order-sdk';
39
+
40
+ // Order card
41
+ <OrderCard
42
+ order={orderData}
43
+ onPay={(order) => handlePay(order)}
44
+ onDetail={(order) => navigateToDetail(order.id)}
45
+ />
46
+
47
+ // Order list
48
+ <OrderList
49
+ showFilter
50
+ onPay={(order) => handlePay(order)}
51
+ onDetail={(order) => navigateToDetail(order.id)}
52
+ />
53
+ ```
54
+
55
+ ### 3. Using Hooks
56
+
57
+ ```jsx
58
+ import { useOrder } from "@quantabit/order-sdk";
59
+
60
+ function MyComponent() {
61
+ const {
62
+ orders, // Order list
63
+ currentOrder, // Current order details
64
+ stats, // Order statistics
65
+ loading,
66
+ createOrder, // Create order
67
+ loadOrders, // Load order list
68
+ cancelOrder, // Cancel order
69
+ payOrder, // Pay order
70
+ confirmReceive, // Confirm receipt
71
+ } = useOrder();
72
+
73
+ return <div>...</div>;
74
+ }
75
+ ```
76
+
77
+ ## 📚 Components
78
+
79
+ | Component | Description |
80
+ | ----------- | -------------------------------------------------- |
81
+ | `OrderCard` | Order card (product list, amount, status, actions) |
82
+ | `OrderList` | Order list (status filtering, pagination) |
83
+
84
+ ## 📖 Type Definitions
85
+
86
+ ```javascript
87
+ import { OrderStatus, OrderType, PaymentMethod } from "@quantabit/order-sdk";
88
+
89
+ // Order status
90
+ OrderStatus.PENDING; // Pending payment
91
+ OrderStatus.PAID; // Paid
92
+ OrderStatus.PROCESSING; // Processing
93
+ OrderStatus.SHIPPED; // Shipped
94
+ OrderStatus.COMPLETED; // Completed
95
+ OrderStatus.CANCELLED; // Cancelled
96
+
97
+ // Order types
98
+ OrderType.GOODS; // Physical goods
99
+ OrderType.SERVICE; // Service
100
+ OrderType.VIRTUAL; // Virtual goods
101
+ OrderType.SUBSCRIPTION; // Subscription
102
+ ```
103
+
104
+ ## 🧮 Utility Functions
105
+
106
+ ```javascript
107
+ import {
108
+ canPay,
109
+ canCancel,
110
+ formatPrice,
111
+ getPaymentRemaining,
112
+ } from "@quantabit/order-sdk";
113
+
114
+ // Check if order can be paid/cancelled
115
+ const payable = canPay(order);
116
+ const cancelable = canCancel(order);
117
+
118
+ // Format price
119
+ formatPrice(99.9, "CNY"); // ¥99.90
120
+
121
+ // Calculate payment remaining time
122
+ const remaining = getPaymentRemaining(order.expire_at);
123
+ ```
124
+
125
+ ## 📄 License
126
+
127
+ MIT License
128
+
129
+
130
+
131
+ ---
132
+
133
+ ## 🌐 Brand & Links
134
+ - Official Mainnet: [QuantaBit Chain](https://qbitchain.io/)
135
+ - Developer Platform: [Developer Platform](https://developer.quantabit.io/)
136
+ - Open Platform: [Open Platform](https://open.quantabit.io/)
137
+ - Payment Platform: [Pay Platform](https://pay.qbitwallet.io/)
138
+ - Feedback: [Feedback](https://xwin.live/qbit)