Skip to main content

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.
Parameters:
  • chainId (number): The blockchain chain ID
  • contractAddress (string): The NFT contract address
  • tokenId (string): The token ID
Returns: AssetDto with asset details including name, description, image URL, schema, and listing information.

Search Assets

Explore and search for assets with various filters.
Parameters:
  • chainId (number, optional): Filter by chain ID
  • contractAddress (string, optional): Filter by contract address
  • ownerAddress (string, optional): Filter by owner address
  • search (string, optional): Search by asset name
  • isVerified (boolean, optional): Filter verified assets only
  • hasListings (boolean, optional): Filter assets with active listings
  • page (number, optional): Page number for pagination
  • limit (number, optional): Number of items per page
Returns: 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.
Parameters:
  • chainId (number): The blockchain chain ID
  • contractAddress (string): The collection contract address
Returns: CollectionDto with collection details.

Search Collections

Explore and search for collections.
Parameters:
  • chainId (number, optional): Filter by chain ID
  • search (string, optional): Search by collection name
  • isVerified (boolean, optional): Filter verified collections only
  • page (number, optional): Page number for pagination
  • limit (number, optional): Number of items per page
Returns: Paginated list of collections. Get trending collections for a specific time range.
Parameters:
  • chainId (number): The blockchain chain ID
  • timeRange (string, optional): Time range for trending data
    • 'one_hour'
    • 'one_day'
    • 'one_week'
    • 'one_month'
Returns: List of trending collections.

Orders

Create, manage, and interact with marketplace orders for buying, selling, and trading NFTs.

Get Order

Retrieve information about a specific order.
Parameters:
  • hash (string): The order hash
Returns: OrderDto with order details.

Create Orders

Create new orders (requires signature).
Parameters:
  • signature (string): The signature for the orders
Returns: List of created orders.

List Orders

List orders for sale.
Parameters:
  • chainId (number): The blockchain chain ID
  • accountAddress (string): The account address listing the orders
  • items (ListOrderItemDto[]): Array of items to list
Returns: Execution result for listing orders.

Buy Orders

Buy existing orders.
Parameters:
  • chainId (number): The blockchain chain ID
  • orderHashes (string[]): Array of order hashes to buy
  • accountAddress (string): The account address buying the orders
Returns: Execution result for buying orders.

Cancel Orders

Cancel existing orders.
Parameters:
  • chainId (number): The blockchain chain ID
  • orderHashes (string[]): Array of order hashes to cancel
Returns: Execution result for canceling orders.

Drops

Participate in NFT drops and claim tokens with built-in validation and stage management.

Get Drop

Retrieve information about a specific drop.
Parameters:
  • chainId (number): The blockchain chain ID
  • contractAddress (string): The drop contract address
  • accountAddress (string, optional): The account address for personalized drop data
Returns: DropDto with drop details including claim stages and statistics.

Claim Drop

Claim tokens from a drop.
Parameters:
  • chainId (number): The blockchain chain ID
  • contractAddress (string): The drop contract address
  • quantity (number): Number of tokens to claim
  • accountAddress (string): The account address claiming the drop
  • recipientAddress (string, optional): The recipient address (defaults to accountAddress)
Returns: Claim execution result.

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.
Parameters:
  • chainId (number): The blockchain chain ID
  • contractAddress (string): The contract address to mint from
  • recipientAddress (string): The recipient wallet address
  • tokenId (number, optional): Token ID for ERC721 mints
  • quantity (number, optional): Quantity for ERC1155 mints
  • metadata (Record, optional): Additional metadata
Returns: Mint execution result with transaction details.

Transfer

Transfer tokens using the project wallet.
Parameters:
  • type (string): Token type - 'native', 'erc20', 'erc721', or 'erc1155'
  • chainId (number): The blockchain chain ID
  • contractAddress (string, optional): Contract address (required for ERC20, ERC721, ERC1155)
  • recipientAddress (string): The recipient wallet address
  • amount (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 transfers
  • metadata (Record, optional): Additional metadata
Returns: 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 with data 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:
This example demonstrates:
  • 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