Key Features
- Full TypeScript Support: Complete type definitions for all API endpoints and responses
- IntelliSense Integration: Auto-completion and inline documentation in your IDE
- Error Handling: Built-in error handling with typed error responses
- Authentication: Flexible authentication with API keys and secret keys
- Comprehensive Coverage: Support for all Lootex Plus API endpoints
- Zero Dependencies: Lightweight with minimal external dependencies
Installation
Quick Start
Get started with the SDK in just a few lines of code:Authentication
The SDK supports flexible authentication to match your use case:API Key (Required)
Your API key is required for all endpoints and provides access to read operations, marketplace functionality, and asset management.Secret Key (Optional)
Your secret key is only required for server-wallet operations like minting and transferring tokens. This provides enhanced security for sensitive operations.Note: Keep your secret key secure and never expose it in client-side code. Project wallet operations should only be performed in secure server environments.
API Reference
The SDK provides comprehensive access to all Lootex Plus API endpoints, organized into logical categories for easy navigation and usage.Assets
Manage and explore NFT assets across supported blockchains.Get Asset
Retrieve information about a specific NFT asset.chainId(number): The blockchain chain IDcontractAddress(string): The NFT contract addresstokenId(string): The token ID
AssetDto with asset details including name, description, image URL, schema, and listing information.
Search Assets
Explore and search for assets with various filters.chainId(number, optional): Filter by chain IDcontractAddress(string, optional): Filter by contract addressownerAddress(string, optional): Filter by owner addresssearch(string, optional): Search by asset nameisVerified(boolean, optional): Filter verified assets onlyhasListings(boolean, optional): Filter assets with active listingspage(number, optional): Page number for paginationlimit(number, optional): Number of items per page
AssetPaginationDto with paginated list of assets.
Collections
Discover and manage NFT collections with comprehensive metadata and verification status.Get Collection
Retrieve information about a specific collection.chainId(number): The blockchain chain IDcontractAddress(string): The collection contract address
CollectionDto with collection details.
Search Collections
Explore and search for collections.chainId(number, optional): Filter by chain IDsearch(string, optional): Search by collection nameisVerified(boolean, optional): Filter verified collections onlypage(number, optional): Page number for paginationlimit(number, optional): Number of items per page
Get Trending Collections
Get trending collections for a specific time range.chainId(number): The blockchain chain IDtimeRange(string, optional): Time range for trending data'one_hour''one_day''one_week''one_month'
Orders
Create, manage, and interact with marketplace orders for buying, selling, and trading NFTs.Get Order
Retrieve information about a specific order.hash(string): The order hash
OrderDto with order details.
Create Orders
Create new orders (requires signature).signature(string): The signature for the orders
List Orders
List orders for sale.chainId(number): The blockchain chain IDaccountAddress(string): The account address listing the ordersitems(ListOrderItemDto[]): Array of items to list
Buy Orders
Buy existing orders.chainId(number): The blockchain chain IDorderHashes(string[]): Array of order hashes to buyaccountAddress(string): The account address buying the orders
Cancel Orders
Cancel existing orders.chainId(number): The blockchain chain IDorderHashes(string[]): Array of order hashes to cancel
Drops
Participate in NFT drops and claim tokens with built-in validation and stage management.Get Drop
Retrieve information about a specific drop.chainId(number): The blockchain chain IDcontractAddress(string): The drop contract addressaccountAddress(string, optional): The account address for personalized drop data
DropDto with drop details including claim stages and statistics.
Claim Drop
Claim tokens from a drop.chainId(number): The blockchain chain IDcontractAddress(string): The drop contract addressquantity(number): Number of tokens to claimaccountAddress(string): The account address claiming the droprecipientAddress(string, optional): The recipient address (defaults to accountAddress)
Project Wallet
Perform secure server-side operations including minting and transferring tokens with enterprise-grade security.Security Note: These operations require a secret key and should only be performed in secure server environments.
Mint
Mint new tokens using the project wallet.chainId(number): The blockchain chain IDcontractAddress(string): The contract address to mint fromrecipientAddress(string): The recipient wallet addresstokenId(number, optional): Token ID for ERC721 mintsquantity(number, optional): Quantity for ERC1155 mintsmetadata(Record, optional): Additional metadata
Transfer
Transfer tokens using the project wallet.type(string): Token type -'native','erc20','erc721', or'erc1155'chainId(number): The blockchain chain IDcontractAddress(string, optional): Contract address (required for ERC20, ERC721, ERC1155)recipientAddress(string): The recipient wallet addressamount(string, optional): Transfer amount in smallest unit (required for native, ERC20, ERC1155)tokenId(string, optional): Token ID (required for ERC721, ERC1155)data(string, optional): Additional data for ERC1155 transfersmetadata(Record, optional): Additional metadata
TransferResponseDto with transfer details including transaction hash and status.
Error Handling
The SDK provides consistent error handling across all methods. Each method returns an object withdata and error properties, allowing you to handle errors gracefully:
Common Error Scenarios
- Authentication Errors: Invalid or missing API keys
- Validation Errors: Invalid parameters or missing required fields
- Rate Limiting: Too many requests in a short time period
- Network Errors: Connection issues or timeout
- Server Errors: Internal API errors (rare)
Best Practices
TypeScript Support
The SDK is built with TypeScript from the ground up, providing complete type safety and excellent developer experience:Full Type Safety
All parameters, return types, and error objects are fully typed:IDE Integration
Enjoy full IntelliSense support in VS Code, WebStorm, and other TypeScript-aware editors:- Auto-completion for all method parameters
- Type checking for all return values
- Inline documentation for all properties
- Error detection for invalid parameter combinations
Complete Example
Here’s a comprehensive example demonstrating multiple SDK features in a real-world scenario:- Error handling for each API call
- Progressive data fetching from collections to assets
- Project wallet operations with proper security
- Real-world workflow from discovery to action
- Comprehensive logging for debugging and monitoring