@luxfi/dex 2.0.1 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -44,7 +44,7 @@
44
44
  * └─────────────┘
45
45
  * ```
46
46
  */
47
- export { type Currency, type PoolKey, type BalanceDelta, type SwapParams, type ModifyLiquidityParams, type PoolState, type Position as AMMPosition, NATIVE_LUX, sortCurrencies, createPoolKey, TIF, OrderKind, GroupType, ActionType, type LXOrder, type LXAction, type LXPlaceResult, type LXL1, MarginMode, PositionSide, type LXAccount, type LXPosition, type LXMarginInfo, type LXSettlement, type LXLiquidationResult, type LXMarkPrice, type LXFundingRate, POOL_MANAGER_ABI, SWAP_ROUTER_ABI, HOOKS_REGISTRY_ABI, FLASH_LOAN_ABI, LX_BOOK_ABI, LX_VAULT_ABI, LX_FEED_ABI, LX_ORACLE_ABI, LX, DEX_PRECOMPILES, type LxdexPrecompile, type DexPrecompile, fromLP, toLP, isDEXPrecompile, isBridgePrecompile, } from './precompile';
47
+ export { type Currency, type PoolKey, type BalanceDelta, type SwapParams, type ModifyLiquidityParams, type PoolState, type Position as AMMPosition, NATIVE_LUX, sortCurrencies, createPoolKey, TIF, OrderKind, GroupType, ActionType, type UniswapXOrder, type LXAction, type LXPlaceResult, type LXL1, MarginMode, PositionSide, type LXAccount, type LXPosition, type LXMarginInfo, type LXSettlement, type LXLiquidationResult, type LXMarkPrice, type LXFundingRate, POOL_MANAGER_ABI, SWAP_ROUTER_ABI, HOOKS_REGISTRY_ABI, FLASH_LOAN_ABI, LX_BOOK_ABI, LX_VAULT_ABI, LX_FEED_ABI, LX_ORACLE_ABI, LX, DEX_PRECOMPILES, type LxdexPrecompile, type DexPrecompile, fromLP, toLP, isLXPrecompile, isBridgePrecompile, } from './precompile';
48
48
  export { type OrderSide, type OrderType, type OrderStatus, type TimeInForce, type OrderRequest, type Order, type OrderBookEntry, type OrderBook, type Trade, type Position as CLOBPosition, type Balance, type ICLOBClient, CLOBClient, createCLOBClient, } from './client';
49
49
  export * from './router';
50
50
  export * from './hooks';
@@ -121,7 +121,7 @@ export declare function toLP(address: Address): number;
121
121
  /**
122
122
  * Check if address is a DEX precompile (LP-9xxx range)
123
123
  */
124
- export declare function isDEXPrecompile(address: Address): boolean;
124
+ export declare function isLXPrecompile(address: Address): boolean;
125
125
  /**
126
126
  * Check if address is a Bridge precompile (LP-6xxx range)
127
127
  */
@@ -117,7 +117,7 @@ export declare enum ActionType {
117
117
  /**
118
118
  * LXBook Order (LP-9020)
119
119
  */
120
- export interface LXOrder {
120
+ export interface UniswapXOrder {
121
121
  marketId: number;
122
122
  isBuy: boolean;
123
123
  kind: OrderKind;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxfi/dex",
3
- "version": "2.0.1",
3
+ "version": "2.0.4",
4
4
  "description": "Lux DEX SDK - CLOB client, AMM precompiles, and omnichain routing",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,7 +35,7 @@
35
35
  "scripts": {
36
36
  "typecheck": "tsc --noEmit",
37
37
  "build": "tsc",
38
- "prepublishOnly": "bun run build"
38
+ "prepublishOnly": "pnpm run build"
39
39
  },
40
40
  "dependencies": {
41
41
  "viem": "^2.30.6",
@@ -63,5 +63,6 @@
63
63
  "amm",
64
64
  "swap",
65
65
  "precompile"
66
- ]
66
+ ],
67
+ "private": false
67
68
  }
@@ -9,7 +9,7 @@ import { encodeFunctionData } from 'viem'
9
9
  import { LX } from '../precompile/addresses'
10
10
  import { LX_BOOK_ABI } from '../precompile/abis'
11
11
  import {
12
- type LXOrder,
12
+ type LxSwapOrder,
13
13
  type LXAction,
14
14
  type LXPlaceResult,
15
15
  type LXL1,
@@ -93,7 +93,7 @@ function buildAction(
93
93
  /**
94
94
  * Encode order data for placement
95
95
  */
96
- function encodeOrderData(order: LXOrder): `0x${string}` {
96
+ function encodeOrderData(order: LxSwapOrder): `0x${string}` {
97
97
  // Pack order into bytes - this matches the Go/Solidity struct layout
98
98
  const encoded = encodeFunctionData({
99
99
  abi: [{
@@ -149,7 +149,7 @@ export function useLXBookExecute(): UseLXBookExecuteResult {
149
149
  address: LX.LX_BOOK,
150
150
  abi: LX_BOOK_ABI,
151
151
  functionName: 'execute',
152
- args: [action],
152
+ args: [action] as any,
153
153
  })
154
154
  },
155
155
  [writeContract]
@@ -161,7 +161,7 @@ export function useLXBookExecute(): UseLXBookExecuteResult {
161
161
  address: LX.LX_BOOK,
162
162
  abi: LX_BOOK_ABI,
163
163
  functionName: 'executeBatch',
164
- args: [actions],
164
+ args: [actions] as any,
165
165
  })
166
166
  },
167
167
  [writeContract]
@@ -217,7 +217,7 @@ export function useLXBookPlaceOrder(): UseLXBookPlaceOrderResult {
217
217
  reduceOnly?: boolean
218
218
  cloid?: `0x${string}`
219
219
  }) => {
220
- const order: LXOrder = {
220
+ const order: LxSwapOrder = {
221
221
  marketId: params.marketId,
222
222
  isBuy: params.isBuy,
223
223
  kind: OrderKind.LIMIT,
@@ -250,7 +250,7 @@ export function useLXBookPlaceOrder(): UseLXBookPlaceOrderResult {
250
250
  size: bigint
251
251
  reduceOnly?: boolean
252
252
  }) => {
253
- const order: LXOrder = {
253
+ const order: LxSwapOrder = {
254
254
  marketId: params.marketId,
255
255
  isBuy: params.isBuy,
256
256
  kind: OrderKind.MARKET,
@@ -276,7 +276,7 @@ export function useLXVaultLiquidate(): UseLXVaultLiquidateResult {
276
276
  address: LX.LX_VAULT,
277
277
  abi: LX_VAULT_ABI,
278
278
  functionName: 'liquidate',
279
- args: [buildAccount(targetAccount, targetSubaccount), marketId, sizeX18],
279
+ args: [buildAccount(targetAccount, targetSubaccount), marketId, sizeX18] as any,
280
280
  })
281
281
  },
282
282
  [writeContract]
package/src/index.ts CHANGED
@@ -67,7 +67,7 @@ export {
67
67
  OrderKind,
68
68
  GroupType,
69
69
  ActionType,
70
- type LXOrder,
70
+ type LxSwapOrder,
71
71
  type LXAction,
72
72
  type LXPlaceResult,
73
73
  type LXL1,
@@ -104,7 +104,7 @@ export {
104
104
  type DexPrecompile,
105
105
  fromLP,
106
106
  toLP,
107
- isDEXPrecompile,
107
+ isLXPrecompile,
108
108
  isBridgePrecompile,
109
109
  } from './precompile'
110
110
 
@@ -139,7 +139,7 @@ export function toLP(address: Address): number {
139
139
  /**
140
140
  * Check if address is a DEX precompile (LP-9xxx range)
141
141
  */
142
- export function isDEXPrecompile(address: Address): boolean {
142
+ export function isLXPrecompile(address: Address): boolean {
143
143
  const lp = toLP(address)
144
144
  return lp >= 9000 && lp < 10000
145
145
  }
@@ -147,7 +147,7 @@ export enum ActionType {
147
147
  /**
148
148
  * LXBook Order (LP-9020)
149
149
  */
150
- export interface LXOrder {
150
+ export interface LxSwapOrder {
151
151
  marketId: number
152
152
  isBuy: boolean
153
153
  kind: OrderKind