Lux Docs
Lux Skills Reference

Lux Market

Multi-Chain NFT Marketplace

Overview

Lux Market (@luxfi/market) is the NFT trading platform for the Lux Network ecosystem. It supports NFT listings, offers, purchases, and AMM-based NFT trading (sudoswap/LSSVM) across all five Lux EVM chains: Lux (C-Chain), Zoo, Hanzo, SPC, and Pars. Built with Next.js 15, React 19, wagmi 2, and viem 2 for full on-chain interaction.

Repository

ItemValue
Repogithub.com/luxfi/market
Local~/work/lux/market/
Package@luxfi/market v1.0.0
LicenseGPL-3.0-or-later
Dev Port3100
Live URLhttps://markets.lux.network

Tech Stack

TechnologyVersionPurpose
Next.js15.5.0App router, SSR, standalone output
React19.1.0UI rendering
TypeScript5.8.3Type safety
Tailwind CSS4.1.18Styling
wagmi2.15.5React hooks for Ethereum
viem2.43.3Low-level EVM client
TanStack Query5.77.2Async state management
Radix UIDialog, Dropdown, SlotAccessible UI primitives
lucide-react0.511.0Icons
class-variance-authority0.7.xComponent variants
next-themes0.4.xDark/light mode

Supported Chains

All chains defined via viem.defineChain() in src/lib/chains.ts:

ChainIDSymbolRPCExplorer
Lux (C-Chain)96369LUXapi.lux.network/mainnet/ext/bc/C/rpcexplore.lux.network
Zoo200200ZOOapi.lux.network/mainnet/ext/bc/zoo/rpcexplore-zoo.lux.network
Hanzo36963HNZapi.lux.network/mainnet/ext/bc/hanzo/rpcexplore-hanzo.lux.network
SPC36911SPCapi.lux.network/mainnet/ext/bc/spc/rpcexplore-spc.lux.network
Pars494949PARSapi.lux.network/mainnet/ext/bc/pars/rpcexplore-pars.lux.network

Explorer API base URLs follow https://explore[-chain].lux.network/api/v2 for on-chain data queries.

Smart Contracts

Contracts are deployed on all five chains. Addresses in src/lib/contracts.ts:

Contract Types

ContractPurpose
marketsSeaport-based NFT marketplace (list, buy, offer, accept)
lssvmPairFactoryLSSVM pair factory for NFT AMM pools (sudoswap model)
linearCurveLinear bonding curve for AMM pricing
exponentialCurveExponential bonding curve for AMM pricing

Market Contract ABI (Seaport-based)

Key functions:

  • list(nftContract, tokenId, paymentToken, price, duration) -- Create listing
  • buy(listingId) -- Purchase listed NFT (payable)
  • makeOffer(nftContract, tokenId, paymentToken, amount, duration) -- Make offer (payable)
  • acceptOffer(offerId) -- Accept an offer
  • cancelListing(listingId) / cancelOffer(offerId) -- Cancel
  • getListing(listingId) -- View listing details

Events: Listing, Sale, OfferMade

LSSVM AMM ABI

Key functions for NFT AMM trading:

  • swapTokenForSpecificNFTs(nftIds, maxInput, recipient, ...) -- Buy specific NFTs from pool
  • swapNFTsForToken(nftIds, minOutput, recipient, ...) -- Sell NFTs to pool
  • getBuyNFTQuote(assetId, numNFTs) -- Get buy price quote
  • getSellNFTQuote(assetId, numNFTs) -- Get sell price quote
  • spotPrice() -- Current spot price
  • nft() -- NFT contract address for the pair

Token Standards

Full ABI support for:

  • ERC-721: name, symbol, tokenURI, ownerOf, balanceOf, approve, setApprovalForAll, Transfer event
  • ERC-1155: balanceOf, uri, setApprovalForAll

Project Structure

~/work/lux/market/
  package.json           # @luxfi/market v1.0.0
  next.config.ts         # Standalone output, IPFS/Arweave image domains
  Dockerfile             # Multi-stage Next.js standalone build
  src/
    app/                 # Next.js App Router pages
      page.tsx           # Homepage
      layout.tsx         # Root layout with providers
      client-providers.tsx  # wagmi + query + theme providers
      providers.tsx      # Server-side providers
      genesis/           # Genesis NFT collection pages
      collection/        # Collection detail pages
      collections/       # Collection listing pages
      nft/               # Individual NFT detail pages
      activity/          # Trading activity feed
      portfolio/         # User portfolio pages
      globals.css        # Global styles
    components/
      Header.tsx         # Site header with navigation
      NFTCard.tsx        # NFT display card
      CollectionCard.tsx # Collection summary card
      ActivityRow.tsx    # Activity feed row
      ListingForm.tsx    # Create listing form
      OfferForm.tsx      # Make offer form
      SearchBar.tsx      # Search functionality
      TraitFilter.tsx    # Filter by NFT traits
      ui/                # Shared UI primitives
    hooks/
      useChain.ts        # Chain selection and switching
      useNFTData.ts      # NFT metadata and ownership queries
    lib/
      chains.ts          # Chain definitions (viem defineChain)
      contracts.ts       # Contract addresses and ABIs per chain
      explorer.ts        # Explorer API integration
      utils.ts           # Utility functions
      wagmi.ts           # wagmi client configuration

Development

cd ~/work/lux/market

# Install dependencies
pnpm install

# Start development server (port 3100)
pnpm dev

# Production build
pnpm build

# Start production server
pnpm start

# Type checking
pnpm typecheck

# Lint
pnpm lint

Docker Build

Multi-stage standalone Next.js build:

FROM node:22-alpine AS builder
# pnpm install + next build (standalone output)
FROM node:22-alpine AS runner
# Copy standalone + static + public
USER nextjs
EXPOSE 3000

Image Handling

next.config.ts allows remote images from:

  • *.lux.network (explorer thumbnails)
  • ipfs.io, *.ipfs.io, cloudflare-ipfs.com (IPFS gateways)
  • arweave.net (Arweave storage)
  • gateway.pinata.cloud, dweb.link, w3s.link (decentralized storage)
  • nft-cdn.alchemy.com, *.nftstorage.link (NFT CDNs)

Key Patterns

  • All chain interactions go through wagmi hooks backed by viem
  • Contract addresses are per-chain-ID maps -- adding a new chain means adding entries to CONTRACTS, supportedChains, EXPLORER_API, and CHAIN_INFO
  • Explorer API v2 is used for collection/activity data fetching
  • LSSVM AMM pools provide instant liquidity for NFT collections without order book
  • Standalone Next.js output for container deployment
RepoPurpose
github.com/luxfi/explorerBlock explorer providing API v2 for NFT data
github.com/luxfi/evmEVM execution engine running the chains
github.com/luxfi/nodeNode software hosting the RPC endpoints
github.com/luxfi/uiShared component library

On this page