@quantabit/market-sdk
v1.0.2
Published
QuantaBit Market SDK - Product listing, auction, matching, and trading
Maintainers
Readme
@quantabit/market-sdk
QuantaBit Market SDK - Product listing, auction, matching, and trading
📦 Installation
npm install @quantabit/market-sdk
# or
yarn add @quantabit/market-sdk🚀 Quick Start
1. Setup Provider
import { MarketProvider } from "@quantabit/market-sdk";
import "@quantabit/market-sdk/styles.css";
function App() {
return (
<MarketProvider
apiUrl="https://api.example.com/v1"
token="your-auth-token"
language="en"
onPurchase={(result) => console.log("Purchase successful:", result)}
onBid={(result) => console.log("Bid placed:", result)}
>
<YourComponent />
</MarketProvider>
);
}2. Using Components
import { ListingCard } from "@quantabit/market-sdk";
// Market listing card
<ListingCard
listing={listingData}
onBuy={(result) => console.log("Purchase:", result)}
onBid={(listing) => openBidModal(listing)}
onClick={(listing) => navigateToDetail(listing.id)}
/>;3. Using Hooks
import { useMarket } from "@quantabit/market-sdk";
function MyComponent() {
const {
listings, // Market listings
myListings, // My listings
myPurchases, // My purchases
loading,
loadListings, // Load market
buy, // Buy
placeBid, // Place bid
} = useMarket();
return <div>...</div>;
}📚 Components
| Component | Description |
| ------------- | -------------------------------------------------------------- |
| ListingCard | Market listing card (image, price, auction countdown, actions) |
📖 Type Definitions
import { ListingType, ListingStatus, ItemType } from "@quantabit/market-sdk";
// Listing types
ListingType.FIXED; // Fixed price
ListingType.AUCTION; // Auction
ListingType.OFFER; // Make an offer
// Item types
ItemType.NFT; // NFT
ItemType.TOKEN; // Token
ItemType.GOODS; // Physical goods
ItemType.DIGITAL; // Digital goods🧮 Utility Functions
import {
formatPrice,
isAuctionEnded,
getTimeRemaining,
} from "@quantabit/market-sdk";
// Format price
formatPrice(1.5, "ETH"); // Ξ1.5
// Check if auction has ended
const ended = isAuctionEnded(listing);
// Get remaining time
const { days, hours, minutes, seconds } = getTimeRemaining(listing.end_at);📄 License
MIT License
🌐 Brand & Links
- Official Mainnet: QuantaBit Chain
- Developer Platform: Developer Platform
- Open Platform: Open Platform
- Payment Platform: Pay Platform
- Feedback: Feedback
