@luxfi/exchange

Core TypeScript SDK for LX and any whitelabel that builds on top of it.

This is a Lux-original SDK extracted from the luxfi/exchange monorepo. It contains no third-party (GPL) source — only original TypeScript: React hooks, Zustand stores, viem/wagmi bindings, factual contract ABIs, chain/token definitions, and Lux's asset-class and regulated-provider abstractions.

What's inside

  • Chains — Lux chain definitions.
  • Tokens — token registries.
  • Contracts & ABIs — AMM V2/V3/V4 contract interfaces, DEX swap-router, quoter, position-manager, and ERC-20 ABIs (factual interface descriptions).
  • DEX types — pool keys, balance deltas, swap/liquidity parameter types.
  • Hooks — useSwap, useSwapQuote, usePools, usePositions, useTokenBalance, useTokenAllowance.
  • Stores — Zustand stores for swap, settings, and token state.
  • Bridge — cross-chain mint + private teleport (Z-Chain privacy layer).
  • Asset-class extension API — declarative asset categorization (crypto, stablecoin, stocks, bonds, private securities, ...). Downstream UIs render by class id, never by tenant identity.
  • Regulated-provider hook — gates regulated-asset trades through a configured provider (KYC/AML redirect, then on-chain settlement via the ERC-3643 IRegulatedProvider adapter).
  • Featured tokens — declarative landing-page list with regulatory metadata.
  • Feature flags — declarative tenant capabilities that drive conditional rendering. Bind to named features, not tenant identity.

Install

npm install @luxfi/exchange

Peer dependency: react@19.

Usage

import { useSwap, AssetClass } from '@luxfi/exchange'

Whitelabels consume this package via npm and configure declaratively (<Exchange brand={...} features={...} provider={...} />) — there is no tenant-identity branching anywhere in the SDK.

Subpath exports

./chains, ./tokens, ./contracts, ./hooks, ./stores, ./dex, ./bridge, ./asset-class, ./regulated-provider, ./featured, ./features.

Development

npm run build      # tsc -> dist/
npm run typecheck  # tsc --noEmit
npm run test       # vitest run

License

BSD-3-Clause — Copyright (c) 2020-2026, Lux Industries, Inc. See LICENSE.

S
Description
No description provided
Readme BSD-3-Clause
227 KiB
Languages
TypeScript 100%