mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
sdk/ts: describe the surface that exists, not the one it was written against
The clean-room posture is worth keeping; the surface it described had moved. Settlement is 0x9999, which carries the V4 PoolManager ABI this path already encodes. The LXPool precompile at 0x9010 it pointed to is deprecated — eth_getCode returns empty for it on mainnet, so the calls it built went to an address with no code behind it. FIX is FIXT.1.1 at the session layer and FIX.5.0SP2 (EP307) at the application layer. pkg/fix asserts Parse errors on 8=FIX.4.4 and 8=FIX.4.2, so the 4.4 profile advertised here could not open a session. The ws subpath now says nothing serves it: pkg/api compiles and is tested, but NewWebSocketServer and NewVenueWS have no caller outside those tests and no binary in cmd/ imports the package. A client for a listener nobody started is worth shipping only if it says so. zap and the precompile path were checked the same way and both reach something live. Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
+17
-3
@@ -5,10 +5,10 @@ vocabulary over the four DEX paths:
|
||||
|
||||
| Subpath | Path | Engine source | Use |
|
||||
|---|---|---|---|
|
||||
| `@luxfi/dex-sdk/precompile` | V4 on-chain | LXPool precompile `0x9010` (LP-9010) | On-chain settlement via the MIT `@luxfi/exchange` ABIs + viem |
|
||||
| `@luxfi/dex-sdk/precompile` | V4 on-chain | Settlement precompile `0x9999` (LP-9999) | On-chain settlement via the MIT `@luxfi/exchange` ABIs + viem |
|
||||
| `@luxfi/dex-sdk/zap` | Binary OrderBook wire | `pkg/zapwire` | Lowest-latency take/place |
|
||||
| `@luxfi/dex-sdk/fix` | FIX 4.4 | `pkg/fix` | Institutional order entry |
|
||||
| `@luxfi/dex-sdk/ws` | JSON WebSocket | `pkg/api` | Streaming market data + orders |
|
||||
| `@luxfi/dex-sdk/fix` | FIXT.1.1 / FIX.5.0SP2 | `pkg/fix` | Institutional order entry |
|
||||
| `@luxfi/dex-sdk/ws` | JSON WebSocket | `pkg/api` | No server runs this today — see Status |
|
||||
|
||||
## License & provenance
|
||||
|
||||
@@ -23,3 +23,17 @@ are never a dependency of this SDK.
|
||||
Scaffold: types + path-uniform client interfaces + frozen wire constants
|
||||
(grounded in the engine). Codec/transport bodies land in the implementation
|
||||
pass. Typechecks under TypeScript 5.9 strict.
|
||||
|
||||
What each path can reach today, checked against the tree and the chain rather
|
||||
than assumed:
|
||||
|
||||
- **precompile** — live. `eth_getCode` at `0x9999` returns code on Lux mainnet,
|
||||
and the address dispatches the V4 `PoolManager` selectors this path encodes.
|
||||
- **zap** — live. `pkg/zapwire` is the frozen `dex_*` wire `dexd` serves in
|
||||
standalone mode, and `cmd/dexbench` drives it.
|
||||
- **fix** — live. `pkg/fix` speaks FIXT.1.1 at the session layer and FIX.5.0SP2
|
||||
(Extension Pack 307) at the application layer.
|
||||
- **ws** — no server. `pkg/api` compiles and is tested, but nothing constructs
|
||||
`NewWebSocketServer` or `NewVenueWS` outside its own tests, and no binary in
|
||||
`cmd/` imports the package. Treat this subpath as a client for a listener that
|
||||
has not been stood up.
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@luxfi/dex-sdk",
|
||||
"version": "0.1.0",
|
||||
"description": "Clean-room BSD-3-Clause TypeScript client for the Lux DEX. One client surface over the four DEX paths: V4 precompile (LXPool 0x9010), ZAP binary wire, FIX 4.4, and the JSON WebSocket. No GPL/Uniswap-derived code.",
|
||||
"description": "Clean-room BSD-3-Clause TypeScript client for the Lux DEX. One client surface over the four DEX paths: V4 settlement precompile (0x9999), ZAP binary wire, FIXT.1.1/FIX.5.0SP2, and the JSON WebSocket. No GPL/Uniswap-derived code.",
|
||||
"license": "BSD-3-Clause",
|
||||
"author": "Lux Industries Inc.",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
//
|
||||
// FIX 4.4 path — institutional order entry.
|
||||
// FIX path — institutional order entry.
|
||||
//
|
||||
// FIXT.1.1 is the session layer (tag 8) and FIX.5.0SP2 with Extension Pack 307
|
||||
// is the application layer, named on the Logon. The retired FIX.4.4 profile is
|
||||
// rejected outright: pkg/fix asserts Parse errors on both 8=FIX.4.4 and
|
||||
// 8=FIX.4.2, so a session opened with either BeginString cannot connect.
|
||||
//
|
||||
// Tag numbers and enum values mirror the engine's FIX acceptor
|
||||
// (pkg/fix/message.go). This client builds NewOrderSingle (35=D) and
|
||||
|
||||
+6
-3
@@ -6,11 +6,14 @@
|
||||
// One client vocabulary (`DexClient`, `OrderRequest`, `Fill`, ...) over the
|
||||
// four DEX paths, each its own subpath export:
|
||||
//
|
||||
// ./precompile V4 on-chain via LXPool precompile 0x9010 (uses MIT
|
||||
// ./precompile V4 on-chain via the settlement precompile 0x9999 (uses MIT
|
||||
// @luxfi/exchange ABIs + viem). On-chain settlement.
|
||||
// ./zap Binary OrderBook wire (pkg/zapwire). Lowest-latency take/place.
|
||||
// ./fix FIX 4.4 order entry (pkg/fix). Institutional connectivity.
|
||||
// ./ws JSON WebSocket (pkg/api). Streaming market data + orders.
|
||||
// ./fix FIXT.1.1 session, FIX.5.0SP2 application (pkg/fix).
|
||||
// Institutional connectivity.
|
||||
// ./ws JSON WebSocket (pkg/api). No server runs this today: nothing
|
||||
// outside pkg/api's own tests constructs the handler, and no
|
||||
// binary in cmd/ imports the package.
|
||||
//
|
||||
// No GPL/Uniswap-derived code. Dependencies are MIT (@luxfi/exchange, viem).
|
||||
|
||||
|
||||
@@ -3,9 +3,12 @@
|
||||
//
|
||||
// V4 precompile path — the on-chain DEX surface.
|
||||
//
|
||||
// The native singleton AMM lives at the LXPool precompile, address 0x9010
|
||||
// (LP-9010; see ~/work/lux/precompile/registry/registry.go). Pool keys, the
|
||||
// PoolManager ABI, and the DEX swap-router ABI are provided by the MIT-licensed
|
||||
// Settlement lives at 0x9999 (LP-9999), which carries the V4 PoolManager ABI so
|
||||
// that V4 tooling works against it unchanged. It replaces the LXPool precompile
|
||||
// at 0x9010 (LP-9010), which is deprecated — eth_getCode returns empty for it on
|
||||
// Lux mainnet, so anything still pointing there encodes calls to an address with
|
||||
// no code behind it. Pool keys, the PoolManager ABI, and the DEX swap-router ABI
|
||||
// are provided by the MIT-licensed
|
||||
// `@luxfi/exchange` package — this client does NOT redefine or copy them. A
|
||||
// consumer constructs a viem `WalletClient`/`PublicClient`, imports the ABI +
|
||||
// addresses from `@luxfi/exchange/contracts`, and calls through this thin,
|
||||
@@ -16,9 +19,9 @@
|
||||
|
||||
import type { Address, Hex } from '../types.js'
|
||||
|
||||
/** Canonical LXPool singleton-AMM precompile address (LP-9010, all chains). */
|
||||
export const LXPOOL_PRECOMPILE: Address =
|
||||
'0x0000000000000000000000000000000000009010'
|
||||
/** Canonical settlement precompile address (LP-9999, all chains). */
|
||||
export const SETTLEMENT_PRECOMPILE: Address =
|
||||
'0x0000000000000000000000000000000000009999'
|
||||
|
||||
/**
|
||||
* Pool key identifying a V4 pool. Field shape matches the MIT
|
||||
@@ -56,8 +59,8 @@ export interface PrecompileTransport {
|
||||
}
|
||||
|
||||
/**
|
||||
* On-chain DEX client over the LXPool precompile. Construct with a transport
|
||||
* bound to a viem client + the `@luxfi/exchange` ABI at `LXPOOL_PRECOMPILE`.
|
||||
* On-chain DEX client over the settlement precompile. Construct with a transport
|
||||
* bound to a viem client + the `@luxfi/exchange` ABI at `SETTLEMENT_PRECOMPILE`.
|
||||
*/
|
||||
export class PrecompileClient {
|
||||
constructor(private readonly transport: PrecompileTransport) {}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//
|
||||
// ZAP path — the binary OrderBook wire (`pkg/zapwire`).
|
||||
//
|
||||
// ZAP is the low-latency off-chain twin of the on-chain LXPool path: a fixed,
|
||||
// ZAP is the low-latency off-chain twin of the on-chain settlement path: a fixed,
|
||||
// frozen byte layout the matcher and the d-chain ledger exchange. Frame sizes
|
||||
// here mirror the engine's frozen wire test (pkg/zapwire/zapwire_test.go) and
|
||||
// MUST NOT drift. RPC method names mirror pkg/zapwire constants.
|
||||
|
||||
Reference in New Issue
Block a user