@luxfi/dex 2.0.3 → 2.0.5
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 +1 -1
- package/dist/precompile/addresses.d.ts +1 -1
- package/dist/precompile/types.d.ts +1 -1
- package/package.json +5 -5
- package/src/hooks/use-lxbook.ts +6 -6
- package/src/hooks/use-lxvault.ts +1 -1
- package/src/index.ts +2 -2
- package/src/precompile/addresses.ts +1 -1
- package/src/precompile/types.ts +1 -1
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
|
|
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
|
|
124
|
+
export declare function isLXPrecompile(address: Address): boolean;
|
|
125
125
|
/**
|
|
126
126
|
* Check if address is a Bridge precompile (LP-6xxx range)
|
|
127
127
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luxfi/dex",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"private": false,
|
|
3
|
+
"version": "2.0.5",
|
|
5
4
|
"description": "Lux DEX SDK - CLOB client, AMM precompiles, and omnichain routing",
|
|
6
5
|
"license": "MIT",
|
|
7
6
|
"type": "module",
|
|
@@ -36,7 +35,7 @@
|
|
|
36
35
|
"scripts": {
|
|
37
36
|
"typecheck": "tsc --noEmit",
|
|
38
37
|
"build": "tsc",
|
|
39
|
-
"prepublishOnly": "
|
|
38
|
+
"prepublishOnly": "pnpm run build"
|
|
40
39
|
},
|
|
41
40
|
"dependencies": {
|
|
42
41
|
"viem": "^2.30.6",
|
|
@@ -64,5 +63,6 @@
|
|
|
64
63
|
"amm",
|
|
65
64
|
"swap",
|
|
66
65
|
"precompile"
|
|
67
|
-
]
|
|
68
|
-
|
|
66
|
+
],
|
|
67
|
+
"private": false
|
|
68
|
+
}
|
package/src/hooks/use-lxbook.ts
CHANGED
|
@@ -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
|
|
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:
|
|
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:
|
|
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:
|
|
253
|
+
const order: LxSwapOrder = {
|
|
254
254
|
marketId: params.marketId,
|
|
255
255
|
isBuy: params.isBuy,
|
|
256
256
|
kind: OrderKind.MARKET,
|
package/src/hooks/use-lxvault.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
|
142
|
+
export function isLXPrecompile(address: Address): boolean {
|
|
143
143
|
const lp = toLP(address)
|
|
144
144
|
return lp >= 9000 && lp < 10000
|
|
145
145
|
}
|