@luxfi/dex 1.2.1 → 2.0.0

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.
Files changed (74) hide show
  1. package/dist/client/clob.d.ts +52 -0
  2. package/dist/client/clob.d.ts.map +1 -0
  3. package/dist/client/clob.js +196 -0
  4. package/dist/client/index.d.ts +7 -0
  5. package/dist/client/index.d.ts.map +1 -0
  6. package/dist/client/index.js +6 -0
  7. package/dist/client/types.d.ts +126 -0
  8. package/dist/client/types.d.ts.map +1 -0
  9. package/dist/client/types.js +5 -0
  10. package/dist/hooks/index.d.ts +22 -0
  11. package/dist/hooks/index.d.ts.map +1 -0
  12. package/dist/hooks/index.js +25 -0
  13. package/dist/hooks/use-lxbook.d.ts +95 -0
  14. package/dist/hooks/use-lxbook.d.ts.map +1 -0
  15. package/dist/hooks/use-lxbook.js +213 -0
  16. package/dist/hooks/use-lxfeed.d.ts +111 -0
  17. package/dist/hooks/use-lxfeed.d.ts.map +1 -0
  18. package/dist/hooks/use-lxfeed.js +152 -0
  19. package/dist/hooks/use-lxvault.d.ts +137 -0
  20. package/dist/hooks/use-lxvault.d.ts.map +1 -0
  21. package/dist/hooks/use-lxvault.js +227 -0
  22. package/dist/hooks/use-quote.d.ts +18 -0
  23. package/dist/hooks/use-quote.d.ts.map +1 -0
  24. package/dist/hooks/use-quote.js +65 -0
  25. package/dist/hooks/use-swap.d.ts +17 -0
  26. package/dist/hooks/use-swap.d.ts.map +1 -0
  27. package/dist/hooks/use-swap.js +75 -0
  28. package/dist/index.d.ts +50 -115
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +72 -225
  31. package/dist/precompile/abis.d.ts +991 -0
  32. package/dist/precompile/abis.d.ts.map +1 -0
  33. package/dist/precompile/abis.js +743 -0
  34. package/dist/precompile/addresses.d.ts +129 -0
  35. package/dist/precompile/addresses.d.ts.map +1 -0
  36. package/dist/precompile/addresses.js +117 -0
  37. package/dist/precompile/index.d.ts +19 -0
  38. package/dist/precompile/index.d.ts.map +1 -0
  39. package/dist/precompile/index.js +18 -0
  40. package/dist/precompile/types.d.ts +246 -0
  41. package/dist/precompile/types.d.ts.map +1 -0
  42. package/dist/precompile/types.js +84 -0
  43. package/dist/router/index.d.ts +7 -0
  44. package/dist/router/index.d.ts.map +1 -0
  45. package/dist/router/index.js +6 -0
  46. package/dist/router/router.d.ts +58 -0
  47. package/dist/router/router.d.ts.map +1 -0
  48. package/dist/router/router.js +272 -0
  49. package/dist/router/types.d.ts +76 -0
  50. package/dist/router/types.d.ts.map +1 -0
  51. package/dist/router/types.js +1 -0
  52. package/package.json +55 -29
  53. package/src/client/clob.ts +256 -0
  54. package/src/client/index.ts +6 -0
  55. package/src/client/types.ts +148 -0
  56. package/src/hooks/index.ts +29 -0
  57. package/src/hooks/use-lxbook.ts +343 -0
  58. package/src/hooks/use-lxfeed.ts +179 -0
  59. package/src/hooks/use-lxvault.ts +318 -0
  60. package/src/hooks/use-quote.ts +92 -0
  61. package/src/hooks/use-swap.ts +103 -0
  62. package/src/index.ts +142 -309
  63. package/src/precompile/abis.ts +755 -0
  64. package/src/precompile/addresses.ts +153 -0
  65. package/src/precompile/index.ts +18 -0
  66. package/src/precompile/types.ts +295 -0
  67. package/src/router/index.ts +6 -0
  68. package/src/router/router.ts +338 -0
  69. package/src/router/types.ts +87 -0
  70. package/dist/marketData.d.ts +0 -152
  71. package/dist/marketData.d.ts.map +0 -1
  72. package/dist/marketData.js +0 -253
  73. package/src/marketData.ts +0 -351
  74. package/tsconfig.json +0 -19
@@ -0,0 +1,129 @@
1
+ /**
2
+ * LX Precompile Addresses (LP-Aligned)
3
+ * Native Go implementation at EVM level
4
+ *
5
+ * LX is the umbrella name for the Lux DEX stack:
6
+ * - AMM (Uniswap v4-style)
7
+ * - CLOB (Hyperliquid-style)
8
+ * - Vaults, Feeds, Routing
9
+ *
10
+ * LP-Aligned Address Format (LP-9015):
11
+ * - Address = 0x0000000000000000000000000000000000LPNUM
12
+ * - LP number directly visible as trailing hex digits
13
+ * - Example: LP-9010 → 0x0000...009010
14
+ *
15
+ * @see LP-9015 (Precompile Registry) for canonical spec
16
+ * @see ~/work/lux/precompile/dex/module.go for Go implementation
17
+ * @see ~/work/lux/lps/LPs/lp-9015-precompile-registry.md
18
+ */
19
+ import type { Address } from 'viem';
20
+ /**
21
+ * LX Precompile addresses (LP-9xxx range)
22
+ * LX prefix naming convention for developer-facing contracts
23
+ * Address format: 0x0000000000000000000000000000000000LPNUM
24
+ */
25
+ export declare const LX: {
26
+ /**
27
+ * LXPool (LP-9010)
28
+ * v4 PoolManager-compatible core AMM
29
+ * - Initialize pools
30
+ * - Execute swaps
31
+ * - Modify liquidity
32
+ * - Flash accounting settlement
33
+ */
34
+ readonly LX_POOL: Address;
35
+ /**
36
+ * LXOracle (LP-9011)
37
+ * Multi-source price aggregation
38
+ * - Chainlink, Pyth, TWAP aggregation
39
+ * - Price feed validation
40
+ */
41
+ readonly LX_ORACLE: Address;
42
+ /**
43
+ * LXRouter (LP-9012)
44
+ * Optimized swap routing
45
+ * - exactInputSingle / exactOutputSingle
46
+ * - Multi-hop swaps
47
+ * - Native LUX support
48
+ */
49
+ readonly LX_ROUTER: Address;
50
+ /**
51
+ * LXHooks (LP-9013)
52
+ * Hook contract registry
53
+ * - Register hook contracts
54
+ * - Query hook permissions
55
+ */
56
+ readonly LX_HOOKS: Address;
57
+ /**
58
+ * LXFlash (LP-9014)
59
+ * Flash loan facility
60
+ * - Borrow any token
61
+ * - Repay in same transaction
62
+ */
63
+ readonly LX_FLASH: Address;
64
+ /**
65
+ * LXBook (LP-9020)
66
+ * Permissionless orderbooks + matching + advanced orders
67
+ * - Market factory (createMarket)
68
+ * - Order lifecycle (place/cancel/modify)
69
+ * - Advanced orders (trigger, TWAP)
70
+ * - Book views (L1, order info)
71
+ */
72
+ readonly LX_BOOK: Address;
73
+ /**
74
+ * LXVault (LP-9030)
75
+ * Balances, margin, collateral, liquidations
76
+ * - Token custody
77
+ * - Margin requirements
78
+ * - Position liquidations
79
+ */
80
+ readonly LX_VAULT: Address;
81
+ /**
82
+ * LXFeed (LP-9040)
83
+ * Price feed aggregator
84
+ */
85
+ readonly LX_FEED: Address;
86
+ /**
87
+ * Teleport Bridge (LP-6010)
88
+ * Cross-chain asset teleportation
89
+ */
90
+ readonly TELEPORT: Address;
91
+ };
92
+ /**
93
+ * Backwards compatibility - old naming convention
94
+ * @deprecated Use LX export instead
95
+ */
96
+ export declare const DEX_PRECOMPILES: {
97
+ readonly POOL_MANAGER: `0x${string}`;
98
+ readonly ORACLE_HUB: `0x${string}`;
99
+ readonly SWAP_ROUTER: `0x${string}`;
100
+ readonly HOOKS_REGISTRY: `0x${string}`;
101
+ readonly FLASH_LOAN: `0x${string}`;
102
+ readonly CLOB: `0x${string}`;
103
+ readonly VAULT: `0x${string}`;
104
+ readonly PRICE_FEED: `0x${string}`;
105
+ readonly TELEPORT: `0x${string}`;
106
+ };
107
+ export type LxdexPrecompile = keyof typeof LX;
108
+ export type DexPrecompile = keyof typeof DEX_PRECOMPILES;
109
+ /**
110
+ * Generate precompile address from LP number
111
+ * @param lpNumber - The LP number (e.g., 9010)
112
+ * @returns The precompile address
113
+ */
114
+ export declare function fromLP(lpNumber: number): Address;
115
+ /**
116
+ * Extract LP number from precompile address
117
+ * @param address - The precompile address
118
+ * @returns The LP number
119
+ */
120
+ export declare function toLP(address: Address): number;
121
+ /**
122
+ * Check if address is a DEX precompile (LP-9xxx range)
123
+ */
124
+ export declare function isDEXPrecompile(address: Address): boolean;
125
+ /**
126
+ * Check if address is a Bridge precompile (LP-6xxx range)
127
+ */
128
+ export declare function isBridgePrecompile(address: Address): boolean;
129
+ //# sourceMappingURL=addresses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../src/precompile/addresses.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC;;;;GAIG;AACH,eAAO,MAAM,EAAE;IACb;;;;;;;OAOG;sBACsD,OAAO;IAEhE;;;;;OAKG;wBACwD,OAAO;IAElE;;;;;;OAMG;wBACwD,OAAO;IAElE;;;;;OAKG;uBACuD,OAAO;IAEjE;;;;;OAKG;uBACuD,OAAO;IAEjE;;;;;;;OAOG;sBACsD,OAAO;IAEhE;;;;;;OAMG;uBACuD,OAAO;IAEjE;;;OAGG;sBACsD,OAAO;IAEhE;;;OAGG;uBACuD,OAAO;CACzD,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;CAUlB,CAAA;AAEV,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,EAAE,CAAA;AAC7C,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,eAAe,CAAA;AAExD;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAE7C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAGzD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAG5D"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * LX Precompile addresses (LP-9xxx range)
3
+ * LX prefix naming convention for developer-facing contracts
4
+ * Address format: 0x0000000000000000000000000000000000LPNUM
5
+ */
6
+ export const LX = {
7
+ /**
8
+ * LXPool (LP-9010)
9
+ * v4 PoolManager-compatible core AMM
10
+ * - Initialize pools
11
+ * - Execute swaps
12
+ * - Modify liquidity
13
+ * - Flash accounting settlement
14
+ */
15
+ LX_POOL: '0x0000000000000000000000000000000000009010',
16
+ /**
17
+ * LXOracle (LP-9011)
18
+ * Multi-source price aggregation
19
+ * - Chainlink, Pyth, TWAP aggregation
20
+ * - Price feed validation
21
+ */
22
+ LX_ORACLE: '0x0000000000000000000000000000000000009011',
23
+ /**
24
+ * LXRouter (LP-9012)
25
+ * Optimized swap routing
26
+ * - exactInputSingle / exactOutputSingle
27
+ * - Multi-hop swaps
28
+ * - Native LUX support
29
+ */
30
+ LX_ROUTER: '0x0000000000000000000000000000000000009012',
31
+ /**
32
+ * LXHooks (LP-9013)
33
+ * Hook contract registry
34
+ * - Register hook contracts
35
+ * - Query hook permissions
36
+ */
37
+ LX_HOOKS: '0x0000000000000000000000000000000000009013',
38
+ /**
39
+ * LXFlash (LP-9014)
40
+ * Flash loan facility
41
+ * - Borrow any token
42
+ * - Repay in same transaction
43
+ */
44
+ LX_FLASH: '0x0000000000000000000000000000000000009014',
45
+ /**
46
+ * LXBook (LP-9020)
47
+ * Permissionless orderbooks + matching + advanced orders
48
+ * - Market factory (createMarket)
49
+ * - Order lifecycle (place/cancel/modify)
50
+ * - Advanced orders (trigger, TWAP)
51
+ * - Book views (L1, order info)
52
+ */
53
+ LX_BOOK: '0x0000000000000000000000000000000000009020',
54
+ /**
55
+ * LXVault (LP-9030)
56
+ * Balances, margin, collateral, liquidations
57
+ * - Token custody
58
+ * - Margin requirements
59
+ * - Position liquidations
60
+ */
61
+ LX_VAULT: '0x0000000000000000000000000000000000009030',
62
+ /**
63
+ * LXFeed (LP-9040)
64
+ * Price feed aggregator
65
+ */
66
+ LX_FEED: '0x0000000000000000000000000000000000009040',
67
+ /**
68
+ * Teleport Bridge (LP-6010)
69
+ * Cross-chain asset teleportation
70
+ */
71
+ TELEPORT: '0x0000000000000000000000000000000000006010',
72
+ };
73
+ /**
74
+ * Backwards compatibility - old naming convention
75
+ * @deprecated Use LX export instead
76
+ */
77
+ export const DEX_PRECOMPILES = {
78
+ POOL_MANAGER: LX.LX_POOL,
79
+ ORACLE_HUB: LX.LX_ORACLE,
80
+ SWAP_ROUTER: LX.LX_ROUTER,
81
+ HOOKS_REGISTRY: LX.LX_HOOKS,
82
+ FLASH_LOAN: LX.LX_FLASH,
83
+ CLOB: LX.LX_BOOK,
84
+ VAULT: LX.LX_VAULT,
85
+ PRICE_FEED: LX.LX_FEED,
86
+ TELEPORT: LX.TELEPORT,
87
+ };
88
+ /**
89
+ * Generate precompile address from LP number
90
+ * @param lpNumber - The LP number (e.g., 9010)
91
+ * @returns The precompile address
92
+ */
93
+ export function fromLP(lpNumber) {
94
+ return `0x${lpNumber.toString(16).padStart(40, '0')}`;
95
+ }
96
+ /**
97
+ * Extract LP number from precompile address
98
+ * @param address - The precompile address
99
+ * @returns The LP number
100
+ */
101
+ export function toLP(address) {
102
+ return parseInt(address.slice(-4), 16);
103
+ }
104
+ /**
105
+ * Check if address is a DEX precompile (LP-9xxx range)
106
+ */
107
+ export function isDEXPrecompile(address) {
108
+ const lp = toLP(address);
109
+ return lp >= 9000 && lp < 10000;
110
+ }
111
+ /**
112
+ * Check if address is a Bridge precompile (LP-6xxx range)
113
+ */
114
+ export function isBridgePrecompile(address) {
115
+ const lp = toLP(address);
116
+ return lp >= 6000 && lp < 7000;
117
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * LX Precompile Exports (LP-Aligned)
3
+ *
4
+ * Native precompiles for Lux DEX stack:
5
+ * - LXPool (LP-9010): v4-style AMM PoolManager
6
+ * - LXOracle (LP-9011): Multi-source price aggregation
7
+ * - LXRouter (LP-9012): Optimized swap routing
8
+ * - LXHooks (LP-9013): Hook contract registry
9
+ * - LXFlash (LP-9014): Flash loan facility
10
+ * - LXBook (LP-9020): CLOB matching engine
11
+ * - LXVault (LP-9030): Custody and margin engine
12
+ * - LXFeed (LP-9040): Mark price and funding feeds
13
+ *
14
+ * Address format: 0x0000000000000000000000000000000000LPNUM
15
+ */
16
+ export * from './types';
17
+ export * from './abis';
18
+ export * from './addresses';
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/precompile/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * LX Precompile Exports (LP-Aligned)
3
+ *
4
+ * Native precompiles for Lux DEX stack:
5
+ * - LXPool (LP-9010): v4-style AMM PoolManager
6
+ * - LXOracle (LP-9011): Multi-source price aggregation
7
+ * - LXRouter (LP-9012): Optimized swap routing
8
+ * - LXHooks (LP-9013): Hook contract registry
9
+ * - LXFlash (LP-9014): Flash loan facility
10
+ * - LXBook (LP-9020): CLOB matching engine
11
+ * - LXVault (LP-9030): Custody and margin engine
12
+ * - LXFeed (LP-9040): Mark price and funding feeds
13
+ *
14
+ * Address format: 0x0000000000000000000000000000000000LPNUM
15
+ */
16
+ export * from './types';
17
+ export * from './abis';
18
+ export * from './addresses';
@@ -0,0 +1,246 @@
1
+ /**
2
+ * DEX Precompile Types
3
+ * Native Uniswap v4-style AMM implementation
4
+ */
5
+ import type { Address } from 'viem';
6
+ /**
7
+ * Currency type - address(0) = native LUX
8
+ */
9
+ export interface Currency {
10
+ address: Address;
11
+ }
12
+ /**
13
+ * Pool key uniquely identifies a pool
14
+ */
15
+ export interface PoolKey {
16
+ currency0: Address;
17
+ currency1: Address;
18
+ fee: number;
19
+ tickSpacing: number;
20
+ hooks: Address;
21
+ }
22
+ /**
23
+ * Balance delta from swap/liquidity operations
24
+ * Positive = user owes pool, Negative = pool owes user
25
+ */
26
+ export interface BalanceDelta {
27
+ amount0: bigint;
28
+ amount1: bigint;
29
+ }
30
+ /**
31
+ * Swap parameters
32
+ */
33
+ export interface SwapParams {
34
+ zeroForOne: boolean;
35
+ amountSpecified: bigint;
36
+ sqrtPriceLimitX96: bigint;
37
+ }
38
+ /**
39
+ * Modify liquidity parameters
40
+ */
41
+ export interface ModifyLiquidityParams {
42
+ tickLower: number;
43
+ tickUpper: number;
44
+ liquidityDelta: bigint;
45
+ salt: `0x${string}`;
46
+ }
47
+ /**
48
+ * Pool state
49
+ */
50
+ export interface PoolState {
51
+ sqrtPriceX96: bigint;
52
+ tick: number;
53
+ protocolFee: number;
54
+ lpFee: number;
55
+ }
56
+ /**
57
+ * Position info
58
+ */
59
+ export interface Position {
60
+ liquidity: bigint;
61
+ feeGrowthInside0LastX128: bigint;
62
+ feeGrowthInside1LastX128: bigint;
63
+ }
64
+ /**
65
+ * Native LUX currency constant
66
+ */
67
+ export declare const NATIVE_LUX: Address;
68
+ /**
69
+ * Sort currencies for pool key creation
70
+ */
71
+ export declare function sortCurrencies(a: Address, b: Address): [Address, Address];
72
+ /**
73
+ * Create a pool key from two currencies
74
+ */
75
+ export declare function createPoolKey(tokenA: Address, tokenB: Address, fee?: number, tickSpacing?: number, hooks?: Address): PoolKey;
76
+ /**
77
+ * Order time-in-force
78
+ */
79
+ export declare enum TIF {
80
+ GTC = 0,// Good-til-canceled (resting)
81
+ IOC = 1,// Immediate-or-cancel
82
+ ALO = 2
83
+ }
84
+ /**
85
+ * Order kind
86
+ */
87
+ export declare enum OrderKind {
88
+ LIMIT = 0,
89
+ MARKET = 1,
90
+ STOP_MARKET = 2,
91
+ STOP_LIMIT = 3,
92
+ TAKE_MARKET = 4,
93
+ TAKE_LIMIT = 5
94
+ }
95
+ /**
96
+ * Order group type
97
+ */
98
+ export declare enum GroupType {
99
+ NONE = 0,
100
+ OCO = 1,// One-cancels-other
101
+ BRACKET = 2
102
+ }
103
+ /**
104
+ * Action type for execute() endpoint
105
+ */
106
+ export declare enum ActionType {
107
+ PLACE = 0,
108
+ CANCEL = 1,
109
+ CANCEL_BY_CLOID = 2,
110
+ MODIFY = 3,
111
+ TWAP_CREATE = 4,
112
+ TWAP_CANCEL = 5,
113
+ SCHEDULE_CANCEL = 6,
114
+ NOOP = 7,
115
+ RESERVE_WEIGHT = 8
116
+ }
117
+ /**
118
+ * LXBook Order (LP-9020)
119
+ */
120
+ export interface LXOrder {
121
+ marketId: number;
122
+ isBuy: boolean;
123
+ kind: OrderKind;
124
+ sizeX18: bigint;
125
+ limitPxX18: bigint;
126
+ triggerPxX18: bigint;
127
+ reduceOnly: boolean;
128
+ tif: TIF;
129
+ cloid: `0x${string}`;
130
+ groupId: `0x${string}`;
131
+ groupType: GroupType;
132
+ }
133
+ /**
134
+ * LXBook Action (execute() payload)
135
+ */
136
+ export interface LXAction {
137
+ actionType: ActionType;
138
+ nonce: bigint;
139
+ expiresAfter: bigint;
140
+ data: `0x${string}`;
141
+ }
142
+ /**
143
+ * LXBook PlaceResult
144
+ */
145
+ export interface LXPlaceResult {
146
+ oid: bigint;
147
+ status: number;
148
+ filledSizeX18: bigint;
149
+ avgPxX18: bigint;
150
+ }
151
+ /**
152
+ * LXBook L1 (best bid/ask)
153
+ */
154
+ export interface LXL1 {
155
+ bestBidPxX18: bigint;
156
+ bestBidSzX18: bigint;
157
+ bestAskPxX18: bigint;
158
+ bestAskSzX18: bigint;
159
+ lastTradePxX18: bigint;
160
+ }
161
+ /**
162
+ * Margin mode
163
+ */
164
+ export declare enum MarginMode {
165
+ CROSS = 0,
166
+ ISOLATED = 1
167
+ }
168
+ /**
169
+ * Position side
170
+ */
171
+ export declare enum PositionSide {
172
+ LONG = 0,
173
+ SHORT = 1
174
+ }
175
+ /**
176
+ * LXVault Account identifier
177
+ */
178
+ export interface LXAccount {
179
+ main: Address;
180
+ subaccountId: number;
181
+ }
182
+ /**
183
+ * LXVault Position (LP-9030)
184
+ */
185
+ export interface LXPosition {
186
+ marketId: number;
187
+ side: PositionSide;
188
+ sizeX18: bigint;
189
+ entryPxX18: bigint;
190
+ unrealizedPnlX18: bigint;
191
+ accumulatedFundingX18: bigint;
192
+ lastFundingTime: bigint;
193
+ }
194
+ /**
195
+ * LXVault MarginInfo
196
+ */
197
+ export interface LXMarginInfo {
198
+ totalCollateralX18: bigint;
199
+ usedMarginX18: bigint;
200
+ freeMarginX18: bigint;
201
+ marginRatioX18: bigint;
202
+ maintenanceMarginX18: bigint;
203
+ liquidatable: boolean;
204
+ }
205
+ /**
206
+ * LXVault Settlement (LXBook → LXVault)
207
+ */
208
+ export interface LXSettlement {
209
+ maker: LXAccount;
210
+ taker: LXAccount;
211
+ marketId: number;
212
+ takerIsBuy: boolean;
213
+ sizeX18: bigint;
214
+ priceX18: bigint;
215
+ makerFeeX18: bigint;
216
+ takerFeeX18: bigint;
217
+ }
218
+ /**
219
+ * LXVault LiquidationResult
220
+ */
221
+ export interface LXLiquidationResult {
222
+ liquidated: LXAccount;
223
+ liquidator: LXAccount;
224
+ marketId: number;
225
+ sizeX18: bigint;
226
+ priceX18: bigint;
227
+ penaltyX18: bigint;
228
+ adlTriggered: boolean;
229
+ }
230
+ /**
231
+ * LXFeed Mark price
232
+ */
233
+ export interface LXMarkPrice {
234
+ indexPxX18: bigint;
235
+ markPxX18: bigint;
236
+ premiumX18: bigint;
237
+ timestamp: bigint;
238
+ }
239
+ /**
240
+ * LXFeed Funding rate
241
+ */
242
+ export interface LXFundingRate {
243
+ rateX18: bigint;
244
+ nextFundingTime: bigint;
245
+ }
246
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/precompile/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;IAClB,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,OAAO,CAAA;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,UAAU,EAA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AAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,MAAM,CAAA;CACxB"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Native LUX currency constant
3
+ */
4
+ export const NATIVE_LUX = '0x0000000000000000000000000000000000000000';
5
+ /**
6
+ * Sort currencies for pool key creation
7
+ */
8
+ export function sortCurrencies(a, b) {
9
+ return a.toLowerCase() < b.toLowerCase() ? [a, b] : [b, a];
10
+ }
11
+ /**
12
+ * Create a pool key from two currencies
13
+ */
14
+ export function createPoolKey(tokenA, tokenB, fee = 3000, tickSpacing = 60, hooks = '0x0000000000000000000000000000000000000000') {
15
+ const [currency0, currency1] = sortCurrencies(tokenA, tokenB);
16
+ return { currency0, currency1, fee, tickSpacing, hooks };
17
+ }
18
+ // ============================================================================
19
+ // LXBook Types (LP-9020) - CLOB Matching Engine
20
+ // ============================================================================
21
+ /**
22
+ * Order time-in-force
23
+ */
24
+ export var TIF;
25
+ (function (TIF) {
26
+ TIF[TIF["GTC"] = 0] = "GTC";
27
+ TIF[TIF["IOC"] = 1] = "IOC";
28
+ TIF[TIF["ALO"] = 2] = "ALO";
29
+ })(TIF || (TIF = {}));
30
+ /**
31
+ * Order kind
32
+ */
33
+ export var OrderKind;
34
+ (function (OrderKind) {
35
+ OrderKind[OrderKind["LIMIT"] = 0] = "LIMIT";
36
+ OrderKind[OrderKind["MARKET"] = 1] = "MARKET";
37
+ OrderKind[OrderKind["STOP_MARKET"] = 2] = "STOP_MARKET";
38
+ OrderKind[OrderKind["STOP_LIMIT"] = 3] = "STOP_LIMIT";
39
+ OrderKind[OrderKind["TAKE_MARKET"] = 4] = "TAKE_MARKET";
40
+ OrderKind[OrderKind["TAKE_LIMIT"] = 5] = "TAKE_LIMIT";
41
+ })(OrderKind || (OrderKind = {}));
42
+ /**
43
+ * Order group type
44
+ */
45
+ export var GroupType;
46
+ (function (GroupType) {
47
+ GroupType[GroupType["NONE"] = 0] = "NONE";
48
+ GroupType[GroupType["OCO"] = 1] = "OCO";
49
+ GroupType[GroupType["BRACKET"] = 2] = "BRACKET";
50
+ })(GroupType || (GroupType = {}));
51
+ /**
52
+ * Action type for execute() endpoint
53
+ */
54
+ export var ActionType;
55
+ (function (ActionType) {
56
+ ActionType[ActionType["PLACE"] = 0] = "PLACE";
57
+ ActionType[ActionType["CANCEL"] = 1] = "CANCEL";
58
+ ActionType[ActionType["CANCEL_BY_CLOID"] = 2] = "CANCEL_BY_CLOID";
59
+ ActionType[ActionType["MODIFY"] = 3] = "MODIFY";
60
+ ActionType[ActionType["TWAP_CREATE"] = 4] = "TWAP_CREATE";
61
+ ActionType[ActionType["TWAP_CANCEL"] = 5] = "TWAP_CANCEL";
62
+ ActionType[ActionType["SCHEDULE_CANCEL"] = 6] = "SCHEDULE_CANCEL";
63
+ ActionType[ActionType["NOOP"] = 7] = "NOOP";
64
+ ActionType[ActionType["RESERVE_WEIGHT"] = 8] = "RESERVE_WEIGHT";
65
+ })(ActionType || (ActionType = {}));
66
+ // ============================================================================
67
+ // LXVault Types (LP-9030) - Custody and Risk Engine
68
+ // ============================================================================
69
+ /**
70
+ * Margin mode
71
+ */
72
+ export var MarginMode;
73
+ (function (MarginMode) {
74
+ MarginMode[MarginMode["CROSS"] = 0] = "CROSS";
75
+ MarginMode[MarginMode["ISOLATED"] = 1] = "ISOLATED";
76
+ })(MarginMode || (MarginMode = {}));
77
+ /**
78
+ * Position side
79
+ */
80
+ export var PositionSide;
81
+ (function (PositionSide) {
82
+ PositionSide[PositionSide["LONG"] = 0] = "LONG";
83
+ PositionSide[PositionSide["SHORT"] = 1] = "SHORT";
84
+ })(PositionSide || (PositionSide = {}));
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Router Exports
3
+ * Omnichain routing between CLOB and AMM
4
+ */
5
+ export * from './types';
6
+ export * from './router';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Router Exports
3
+ * Omnichain routing between CLOB and AMM
4
+ */
5
+ export * from './types';
6
+ export * from './router';