@quantabit/nft-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 +21 -0
- package/README.md +162 -0
- package/dist/index.cjs +1231 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.esm.js +1200 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/styles.css +1 -0
- package/package.json +94 -0
- package/types/index.d.ts +53 -0
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,162 @@
|
|
|
1
|
+
# @quantabit/nft-sdk
|
|
2
|
+
|
|
3
|
+
> QuantaBit NFT SDK - NFT minting, transferring, display, and digital collectible management
|
|
4
|
+
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- 🎨 **NFT Marketplace** - Browse, buy, and sell NFTs
|
|
8
|
+
- ⛏️ **Minting** - Create and mint new NFTs
|
|
9
|
+
- 🏷️ **Rarity System** - Common, Rare, Epic, Legendary classifications
|
|
10
|
+
- 🔨 **Auctions** - Timed auction with bidding support
|
|
11
|
+
- ❤️ **Favorites** - NFT wishlist and collection management
|
|
12
|
+
- 🌍 **Multi-Language** - Built-in Chinese/English translations
|
|
13
|
+
|
|
14
|
+
## 📦 Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @quantabit/nft-sdk
|
|
18
|
+
# or
|
|
19
|
+
yarn add @quantabit/nft-sdk
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 🚀 Quick Start
|
|
23
|
+
|
|
24
|
+
### 1. Using Components
|
|
25
|
+
|
|
26
|
+
```jsx
|
|
27
|
+
import {
|
|
28
|
+
NftMarketplace,
|
|
29
|
+
NftGrid,
|
|
30
|
+
NftCard,
|
|
31
|
+
NftDetail,
|
|
32
|
+
MyNftsPage,
|
|
33
|
+
AuctionCard,
|
|
34
|
+
} from '@quantabit/nft-sdk';
|
|
35
|
+
|
|
36
|
+
// Full NFT marketplace
|
|
37
|
+
<NftMarketplace />
|
|
38
|
+
|
|
39
|
+
// NFT grid
|
|
40
|
+
<NftGrid
|
|
41
|
+
columns={4}
|
|
42
|
+
onNftClick={(nft) => viewDetail(nft)}
|
|
43
|
+
showFilters
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
// NFT card
|
|
47
|
+
<NftCard
|
|
48
|
+
nft={nftData}
|
|
49
|
+
onBuy={(nft) => handleBuy(nft)}
|
|
50
|
+
showRarity
|
|
51
|
+
/>
|
|
52
|
+
|
|
53
|
+
// NFT detail page
|
|
54
|
+
<NftDetail nftId="nft_123" onBuy={() => handleBuy()} />
|
|
55
|
+
|
|
56
|
+
// My NFTs page
|
|
57
|
+
<MyNftsPage onNftClick={(nft) => viewDetail(nft)} />
|
|
58
|
+
|
|
59
|
+
// Auction card
|
|
60
|
+
<AuctionCard
|
|
61
|
+
auction={auctionData}
|
|
62
|
+
onBid={(amount) => handleBid(amount)}
|
|
63
|
+
showCountdown
|
|
64
|
+
/>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 2. Using Hooks
|
|
68
|
+
|
|
69
|
+
```jsx
|
|
70
|
+
import {
|
|
71
|
+
useNfts,
|
|
72
|
+
useNftDetail,
|
|
73
|
+
useMyNfts,
|
|
74
|
+
useFavoriteNfts,
|
|
75
|
+
useBuyNft,
|
|
76
|
+
useMintNft,
|
|
77
|
+
useNftAuction,
|
|
78
|
+
} from "@quantabit/nft-sdk";
|
|
79
|
+
|
|
80
|
+
function MyComponent() {
|
|
81
|
+
const { nfts, loading, loadNfts, filters } = useNfts();
|
|
82
|
+
const { nft, loadDetail } = useNftDetail("nft_123");
|
|
83
|
+
const { myNfts, loadMyNfts } = useMyNfts();
|
|
84
|
+
const { favorites, toggleFavorite } = useFavoriteNfts();
|
|
85
|
+
const { buyNft, buying } = useBuyNft();
|
|
86
|
+
const { mintNft, minting } = useMintNft();
|
|
87
|
+
const { auction, placeBid, bids } = useNftAuction("auction_123");
|
|
88
|
+
|
|
89
|
+
return <div>...</div>;
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 3. API Client
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
import { nftApi } from "@quantabit/nft-sdk";
|
|
97
|
+
|
|
98
|
+
// Browse NFTs
|
|
99
|
+
const nfts = await nftApi.getNfts({ page: 1, limit: 20 });
|
|
100
|
+
|
|
101
|
+
// Get NFT detail
|
|
102
|
+
const nft = await nftApi.getNftDetail("nft_123");
|
|
103
|
+
|
|
104
|
+
// Get my NFTs
|
|
105
|
+
const myNfts = await nftApi.getMyNfts();
|
|
106
|
+
|
|
107
|
+
// Buy NFT
|
|
108
|
+
await nftApi.buyNft("nft_123");
|
|
109
|
+
|
|
110
|
+
// Mint new NFT
|
|
111
|
+
await nftApi.mintNft({
|
|
112
|
+
name: "My NFT",
|
|
113
|
+
description: "A unique digital collectible",
|
|
114
|
+
image: imageFile,
|
|
115
|
+
rarity: "epic",
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## 📚 Components
|
|
120
|
+
|
|
121
|
+
| Component | Description |
|
|
122
|
+
| ---------------- | ------------------------------------------------- |
|
|
123
|
+
| `NftMarketplace` | Complete NFT marketplace with browsing and search |
|
|
124
|
+
| `NftGrid` | NFT grid layout with filters and pagination |
|
|
125
|
+
| `NftCard` | Single NFT card with image, rarity, and price |
|
|
126
|
+
| `NftDetail` | NFT detail page with attributes and history |
|
|
127
|
+
| `MyNftsPage` | User's NFT collection page |
|
|
128
|
+
| `AuctionCard` | Auction card with countdown and bid history |
|
|
129
|
+
|
|
130
|
+
## 📖 Type Definitions
|
|
131
|
+
|
|
132
|
+
```javascript
|
|
133
|
+
import { NftRarity, NftStatus } from "@quantabit/nft-sdk";
|
|
134
|
+
|
|
135
|
+
// NFT rarity
|
|
136
|
+
NftRarity.COMMON; // Common
|
|
137
|
+
NftRarity.RARE; // Rare
|
|
138
|
+
NftRarity.EPIC; // Epic
|
|
139
|
+
NftRarity.LEGENDARY; // Legendary
|
|
140
|
+
|
|
141
|
+
// NFT status
|
|
142
|
+
NftStatus.MINTED; // Minted
|
|
143
|
+
NftStatus.LISTED; // Listed for sale
|
|
144
|
+
NftStatus.SOLD; // Sold
|
|
145
|
+
NftStatus.TRANSFERRED; // Transferred
|
|
146
|
+
NftStatus.BURNED; // Burned
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## 📄 License
|
|
150
|
+
|
|
151
|
+
MIT License
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## 🌐 Brand & Links
|
|
158
|
+
- Official Mainnet: [QuantaBit Chain](https://qbitchain.io/)
|
|
159
|
+
- Developer Platform: [Developer Platform](https://developer.quantabit.io/)
|
|
160
|
+
- Open Platform: [Open Platform](https://open.quantabit.io/)
|
|
161
|
+
- Payment Platform: [Pay Platform](https://pay.qbitwallet.io/)
|
|
162
|
+
- Feedback: [Feedback](https://xwin.live/qbit)
|