@luxfi/exchange 0.1.0 → 1.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 (69) hide show
  1. package/dist/bridge/use-private-teleport.d.ts +1 -1
  2. package/dist/bridge/use-private-teleport.d.ts.map +1 -1
  3. package/dist/bridge/use-private-teleport.js +73 -71
  4. package/dist/contracts/abis/amm-v2-factory.d.ts +148 -0
  5. package/dist/contracts/abis/amm-v2-factory.d.ts.map +1 -0
  6. package/dist/contracts/abis/amm-v2-factory.js +52 -0
  7. package/dist/contracts/abis/amm-v2-pair.d.ts +236 -0
  8. package/dist/contracts/abis/amm-v2-pair.d.ts.map +1 -0
  9. package/dist/contracts/abis/amm-v2-pair.js +88 -0
  10. package/dist/contracts/abis/amm-v2-router.d.ts +496 -0
  11. package/dist/contracts/abis/amm-v2-router.d.ts.map +1 -0
  12. package/dist/contracts/abis/amm-v2-router.js +149 -0
  13. package/dist/contracts/abis/amm-v3-factory.d.ts +152 -0
  14. package/dist/contracts/abis/amm-v3-factory.d.ts.map +1 -0
  15. package/dist/contracts/abis/amm-v3-factory.js +48 -0
  16. package/dist/contracts/abis/amm-v3-pool.d.ts +254 -0
  17. package/dist/contracts/abis/amm-v3-pool.d.ts.map +1 -0
  18. package/dist/contracts/abis/amm-v3-pool.js +84 -0
  19. package/dist/contracts/abis/index.d.ts +8 -5
  20. package/dist/contracts/abis/index.d.ts.map +1 -1
  21. package/dist/contracts/abis/index.js +13 -6
  22. package/dist/contracts/abis/lux-amm-v2-factory.d.ts +148 -0
  23. package/dist/contracts/abis/lux-amm-v2-factory.d.ts.map +1 -0
  24. package/dist/contracts/abis/lux-amm-v2-factory.js +52 -0
  25. package/dist/contracts/abis/lux-amm-v2-pair.d.ts +236 -0
  26. package/dist/contracts/abis/lux-amm-v2-pair.d.ts.map +1 -0
  27. package/dist/contracts/abis/lux-amm-v2-pair.js +88 -0
  28. package/dist/contracts/abis/lux-amm-v2-router.d.ts +496 -0
  29. package/dist/contracts/abis/lux-amm-v2-router.d.ts.map +1 -0
  30. package/dist/contracts/abis/lux-amm-v2-router.js +149 -0
  31. package/dist/contracts/abis/lux-amm-v3-factory.d.ts +152 -0
  32. package/dist/contracts/abis/lux-amm-v3-factory.d.ts.map +1 -0
  33. package/dist/contracts/abis/lux-amm-v3-factory.js +48 -0
  34. package/dist/contracts/abis/lux-amm-v3-pool.d.ts +254 -0
  35. package/dist/contracts/abis/lux-amm-v3-pool.d.ts.map +1 -0
  36. package/dist/contracts/abis/lux-amm-v3-pool.js +84 -0
  37. package/dist/contracts/addresses.d.ts +18 -48
  38. package/dist/contracts/addresses.d.ts.map +1 -1
  39. package/dist/contracts/addresses.js +30 -22
  40. package/dist/index.d.ts +1 -0
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +2 -2
  43. package/dist/tokens/index.d.ts +25 -0
  44. package/dist/tokens/index.d.ts.map +1 -1
  45. package/dist/tokens/index.js +90 -5
  46. package/package.json +6 -2
  47. package/src/bridge/cross-chain-store.ts +210 -0
  48. package/src/bridge/index.ts +81 -0
  49. package/src/bridge/private-teleport-types.ts +578 -0
  50. package/src/bridge/types.ts +125 -0
  51. package/src/bridge/use-cross-chain-mint.ts +299 -0
  52. package/src/bridge/use-private-teleport.ts +951 -0
  53. package/src/contracts/abis/{uniswap-v2-factory.ts → amm-v2-factory.ts} +6 -2
  54. package/src/contracts/abis/{uniswap-v2-pair.ts → amm-v2-pair.ts} +6 -2
  55. package/src/contracts/abis/{uniswap-v2-router.ts → amm-v2-router.ts} +6 -2
  56. package/src/contracts/abis/{uniswap-v3-factory.ts → amm-v3-factory.ts} +6 -2
  57. package/src/contracts/abis/{uniswap-v3-pool.ts → amm-v3-pool.ts} +6 -2
  58. package/src/contracts/abis/index.ts +16 -6
  59. package/src/contracts/abis/pool-manager.ts +1 -1
  60. package/src/contracts/addresses.ts +53 -52
  61. package/src/hooks/use-pools.ts +8 -6
  62. package/src/hooks/use-positions.ts +3 -3
  63. package/src/hooks/use-swap-quote.ts +1 -1
  64. package/src/hooks/use-swap.ts +1 -1
  65. package/src/index.ts +2 -2
  66. package/src/tokens/index.ts +148 -32
  67. package/dist/bridge/__tests__/use-private-teleport.test.d.ts +0 -2
  68. package/dist/bridge/__tests__/use-private-teleport.test.d.ts.map +0 -1
  69. package/dist/bridge/__tests__/use-private-teleport.test.js +0 -272
@@ -1,7 +1,8 @@
1
1
  /**
2
- * UniswapV2Factory ABI
2
+ * AMM V2 Factory ABI
3
+ * Compatible with Lux V2 Factory interface
3
4
  */
4
- export const UNISWAP_V2_FACTORY_ABI = [
5
+ export const AMM_V2_FACTORY_ABI = [
5
6
  {
6
7
  type: 'function',
7
8
  name: 'getPair',
@@ -47,3 +48,6 @@ export const UNISWAP_V2_FACTORY_ABI = [
47
48
  ],
48
49
  },
49
50
  ] as const
51
+
52
+ /** @deprecated Use AMM_V2_FACTORY_ABI instead */
53
+ export const LUX_V2_FACTORY_ABI = AMM_V2_FACTORY_ABI
@@ -1,7 +1,8 @@
1
1
  /**
2
- * UniswapV2Pair ABI
2
+ * AMM V2 Pair ABI
3
+ * Compatible with Lux V2 Pair interface
3
4
  */
4
- export const UNISWAP_V2_PAIR_ABI = [
5
+ export const AMM_V2_PAIR_ABI = [
5
6
  {
6
7
  type: 'function',
7
8
  name: 'token0',
@@ -83,3 +84,6 @@ export const UNISWAP_V2_PAIR_ABI = [
83
84
  ],
84
85
  },
85
86
  ] as const
87
+
88
+ /** @deprecated Use AMM_V2_PAIR_ABI instead */
89
+ export const LUX_V2_PAIR_ABI = AMM_V2_PAIR_ABI
@@ -1,7 +1,8 @@
1
1
  /**
2
- * UniswapV2Router02 ABI (used by Lux AMM V2)
2
+ * AMM V2 Router ABI
3
+ * Compatible with Lux V2 Router02 interface
3
4
  */
4
- export const UNISWAP_V2_ROUTER_ABI = [
5
+ export const AMM_V2_ROUTER_ABI = [
5
6
  {
6
7
  type: 'function',
7
8
  name: 'factory',
@@ -144,3 +145,6 @@ export const UNISWAP_V2_ROUTER_ABI = [
144
145
  stateMutability: 'nonpayable',
145
146
  },
146
147
  ] as const
148
+
149
+ /** @deprecated Use AMM_V2_ROUTER_ABI instead */
150
+ export const LUX_V2_ROUTER_ABI = AMM_V2_ROUTER_ABI
@@ -1,7 +1,8 @@
1
1
  /**
2
- * UniswapV3Factory ABI
2
+ * AMM V3 Factory ABI
3
+ * Compatible with Lux V3 Factory interface
3
4
  */
4
- export const UNISWAP_V3_FACTORY_ABI = [
5
+ export const AMM_V3_FACTORY_ABI = [
5
6
  {
6
7
  type: 'function',
7
8
  name: 'getPool',
@@ -43,3 +44,6 @@ export const UNISWAP_V3_FACTORY_ABI = [
43
44
  ],
44
45
  },
45
46
  ] as const
47
+
48
+ /** @deprecated Use AMM_V3_FACTORY_ABI instead */
49
+ export const LUX_V3_FACTORY_ABI = AMM_V3_FACTORY_ABI
@@ -1,7 +1,8 @@
1
1
  /**
2
- * UniswapV3Pool ABI (essential functions)
2
+ * AMM V3 Pool ABI
3
+ * Compatible with Lux V3 Pool interface
3
4
  */
4
- export const UNISWAP_V3_POOL_ABI = [
5
+ export const AMM_V3_POOL_ABI = [
5
6
  {
6
7
  type: 'function',
7
8
  name: 'token0',
@@ -79,3 +80,6 @@ export const UNISWAP_V3_POOL_ABI = [
79
80
  ],
80
81
  },
81
82
  ] as const
83
+
84
+ /** @deprecated Use AMM_V3_POOL_ABI instead */
85
+ export const LUX_V3_POOL_ABI = AMM_V3_POOL_ABI
@@ -1,17 +1,27 @@
1
1
  /**
2
2
  * Contract ABIs for Lux Exchange
3
+ *
4
+ * AMM V2/V3 - Concentrated liquidity AMM (Lux V2/V3 compatible)
5
+ * DEX V4 - Hook-based DEX with singleton pool manager (Lux V4 compatible)
3
6
  */
4
7
 
5
- export { UNISWAP_V2_ROUTER_ABI } from './uniswap-v2-router'
6
- export { UNISWAP_V2_FACTORY_ABI } from './uniswap-v2-factory'
7
- export { UNISWAP_V2_PAIR_ABI } from './uniswap-v2-pair'
8
- export { UNISWAP_V3_FACTORY_ABI } from './uniswap-v3-factory'
9
- export { UNISWAP_V3_POOL_ABI } from './uniswap-v3-pool'
8
+ // AMM V2 ABIs
9
+ export { AMM_V2_ROUTER_ABI, LUX_V2_ROUTER_ABI } from './amm-v2-router'
10
+ export { AMM_V2_FACTORY_ABI, LUX_V2_FACTORY_ABI } from './amm-v2-factory'
11
+ export { AMM_V2_PAIR_ABI, LUX_V2_PAIR_ABI } from './amm-v2-pair'
12
+
13
+ // AMM V3 ABIs
14
+ export { AMM_V3_FACTORY_ABI, LUX_V3_FACTORY_ABI } from './amm-v3-factory'
15
+ export { AMM_V3_POOL_ABI, LUX_V3_POOL_ABI } from './amm-v3-pool'
16
+
17
+ // AMM V3 Periphery ABIs
10
18
  export { SWAP_ROUTER_ABI } from './swap-router'
11
19
  export { QUOTER_V2_ABI } from './quoter-v2'
12
20
  export { NFT_POSITION_MANAGER_ABI } from './nft-position-manager'
21
+
22
+ // Common ABIs
13
23
  export { ERC20_ABI } from './erc20'
14
24
 
15
- // DEX Precompile ABIs
25
+ // DEX V4 Precompile ABIs
16
26
  export { POOL_MANAGER_ABI } from './pool-manager'
17
27
  export { DEX_SWAP_ROUTER_ABI } from './dex-swap-router'
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * PoolManager Precompile ABI (0x0400)
3
- * Native Uniswap v4-style AMM implementation
3
+ * Native Lux v4-style AMM implementation
4
4
  */
5
5
  export const POOL_MANAGER_ABI = [
6
6
  // Pool initialization
@@ -7,89 +7,90 @@ import type { Address } from 'viem'
7
7
  * Contract addresses for Lux Mainnet (96369)
8
8
  */
9
9
  export const LUX_MAINNET_CONTRACTS = {
10
- // Core
11
- WLUX: '0x55750d6CA62a041c06a8E28626b10Be6c688f471' as Address,
10
+ // Core — verified on-chain 2026-03-05 (149M supply)
11
+ WLUX: '0x4888e4a2ee0f03051c72d2bd3acf755ed3498b3e' as Address,
12
12
  MULTICALL: '0xd25F88CBdAe3c2CCA3Bb75FC4E723b44C0Ea362F' as Address,
13
13
 
14
- // Bridge tokens
15
- LETH: '0xAA3AE95816a4A6FbC6b8Ed5a6C06f22A96A80C8C' as Address,
16
- LBTC: '0x526903E35E7106D62ED3B5d77E14e51d024Aa1D3' as Address,
17
- LUSD: '0x4B1BfA76eD63F1A0aD2E4f40b3F46C45E8F7A4E2' as Address,
14
+ // Bridge tokens — verified on-chain via V3 pools and bridge MPC
15
+ LETH: '0x60E0a8167FC13dE89348978860466C9ceC24B9ba' as Address,
16
+ LBTC: '0x1E48D32a4F5e9f08DB9aE4959163300FaF8A6C8e' as Address,
17
+ LUSD: '0x848Cff46eb323f323b6Bbe1Df274E40793d7f2c2' as Address,
18
+ LSOL: '0x26B40f650156C7EbF9e087Dd0dca181Fe87625B7' as Address,
19
+ LTON: '0x3141b94b89691009b950c96e97Bff48e0C543E3C' as Address,
20
+ LAVAX: '0x0e4bD0DD67c15dECfBBBdbbE07FC9d51D737693D' as Address,
18
21
 
19
- // AMM V2 (QuantumSwap)
20
- V2_FACTORY: '0xd9a95609DbB228A13568Bd9f9A285105E7596970' as Address,
21
- V2_ROUTER: '0x1F6cbC7d3bc7D803ee76D80F0eEE25767431e674' as Address,
22
+ // AMM V2 (CREATE2) — 1 pair on-chain
23
+ V2_FACTORY: '0xD173926A10A0C4eCd3A51B1422270b65Df0551c1' as Address,
24
+ V2_ROUTER: '0xAe2cf1E403aAFE6C05A5b8Ef63EB19ba591d8511' as Address,
22
25
 
23
- // AMM V3 (Concentrated Liquidity)
24
- V3_FACTORY: '0xb732BD88F25EdD9C3456638671fB37685D4B4e3f' as Address,
26
+ // AMM V3 (CREATE2) — 8+ pools, active trading, verified on-chain
27
+ V3_FACTORY: '0x80bBc7C4C7a59C899D1B37BC14539A22D5830a84' as Address,
25
28
  V3_SWAP_ROUTER: '0xE8fb25086C8652c92f5AF90D730Bac7C63Fc9A58' as Address,
26
29
  V3_SWAP_ROUTER_02: '0x939bC0Bca6F9B9c52E6e3AD8A3C590b5d9B9D10E' as Address,
27
30
  V3_QUOTER: '0x12e2B76FaF4dDA5a173a4532916bb6Bfa3645275' as Address,
28
31
  V3_QUOTER_V2: '0x15C729fdd833Ba675edd466Dfc63E1B737925A4c' as Address,
29
- V3_TICK_LENS: '0x57A22965AdA0e52D785A9Aa155beF423D573b879' as Address,
30
32
  V3_NFT_POSITION_MANAGER: '0x7a4C48B9dae0b7c396569b34042fcA604150Ee28' as Address,
31
- V3_NFT_DESCRIPTOR: '0x53B1aAA5b6DDFD4eD00D0A7b5Ef333dc74B605b5' as Address,
32
33
  } as const
33
34
 
34
35
  /**
35
36
  * Contract addresses for Lux Testnet (96368)
36
37
  */
37
38
  export const LUX_TESTNET_CONTRACTS = {
38
- // Core
39
- WLUX: '0x732740c5c895C9FCF619930ed4293fc858eb44c7' as Address,
40
- WETH: '0xd9956542B51032d940ef076d70B69410667277A3' as Address,
39
+ // Core — deployed via DeployMultiNetwork.s.sol 2026-02-27
40
+ WLUX: '0xDe5310d0Eccc04C8987cB66Ff6b89Ee793442C91' as Address,
41
41
  MULTICALL: '0xd25F88CBdAe3c2CCA3Bb75FC4E723b44C0Ea362F' as Address,
42
42
 
43
- // AMM V2
44
- V2_FACTORY: '0x81C3669B139D92909AA67DbF74a241b10540d919' as Address,
45
- V2_ROUTER: '0xDB6c703c80BFaE5F9a56482d3c8535f27E1136EB' as Address,
43
+ // Bridge tokens — deployed via DeployMultiNetwork.s.sol 2026-02-27
44
+ LETH: '0xA695a8A66fbe3E32d15a531db04185313595771A' as Address,
45
+ LBTC: '0x5a88986958ea76Dd043f834542724F081cA1443B' as Address,
46
+ LUSDC: '0x8a3fad1c7FB94461621351aa6A983B6f814F039c' as Address,
46
47
 
47
- // AMM V3
48
- V3_FACTORY: '0x80bBc7C4C7a59C899D1B37BC14539A22D5830a84' as Address,
49
- V3_SWAP_ROUTER: '0xE8fb25086C8652c92f5AF90D730Bac7C63Fc9A58' as Address,
50
- V3_SWAP_ROUTER_02: '0x939bC0Bca6F9B9c52E6e3AD8A3C590b5d9B9D10E' as Address,
51
- V3_QUOTER: '0x12e2B76FaF4dDA5a173a4532916bb6Bfa3645275' as Address,
52
- V3_QUOTER_V2: '0x15C729fdd833Ba675edd466Dfc63E1B737925A4c' as Address,
53
- V3_TICK_LENS: '0x57A22965AdA0e52D785A9Aa155beF423D573b879' as Address,
54
- V3_NFT_POSITION_MANAGER: '0x7a4C48B9dae0b7c396569b34042fcA604150Ee28' as Address,
55
- V3_NFT_DESCRIPTOR: '0x53B1aAA5b6DDFD4eD00D0A7b5Ef333dc74B605b5' as Address,
48
+ // AMM V2 — deployed via DeployMultiNetwork.s.sol 2026-02-27
49
+ V2_FACTORY: '0x1DD4e6cbC6B8FD032fCAD5A3B0a45e446A014637' as Address,
50
+ V2_ROUTER: '0xb06B31521Afc434F87Fe4852c98FC15A26c92aE8' as Address,
56
51
  } as const
57
52
 
58
53
  /**
59
- * DEX Precompile addresses (native AMM)
60
- * These provide sub-microsecond execution
61
- *
62
- * Lux Precompile Address Standard:
63
- * - Prefix format: 0xNNNN000000000000000000000000000000000000
64
- * - Range 0x0400-0x04FF is reserved for DEX precompiles
65
- *
66
- * @see ~/work/lux/precompile/dex/module.go for implementation
54
+ * DEX Precompile addresses (native AMM - Lux v4 style singleton PoolManager)
55
+ * These provide sub-microsecond execution via native Go implementation
56
+ *
57
+ * Address format: 0x0000...00LPNUMBER (addresses end with LP number)
58
+ * LP-9010: DEX Precompile - Native HFT Order Book (PoolManager)
59
+ * LP-9011: Oracle Precompile - Multi-Source Price Aggregation
60
+ *
61
+ * @see ~/work/lux/precompile/registry/registry.go for the full address scheme
62
+ * @see ~/work/lux/dex/pkg/gateway/lux/provider.go for gateway implementation
67
63
  */
68
64
  export const DEX_PRECOMPILES = {
69
- POOL_MANAGER: '0x0400000000000000000000000000000000000000' as Address,
70
- SWAP_ROUTER: '0x0401000000000000000000000000000000000000' as Address,
71
- HOOKS_REGISTRY: '0x0402000000000000000000000000000000000000' as Address,
72
- FLASH_LOAN: '0x0403000000000000000000000000000000000000' as Address,
73
- LENDING: '0x0410000000000000000000000000000000000000' as Address,
74
- LIQUID: '0x0430000000000000000000000000000000000000' as Address,
75
- TELEPORT: '0x0440000000000000000000000000000000000000' as Address,
65
+ // Core DEX (LP-9010 series - Lux v4 style)
66
+ POOL_MANAGER: '0x0000000000000000000000000000000000009010' as Address, // LP-9010
67
+ SWAP_ROUTER: '0x0000000000000000000000000000000000009012' as Address, // LP-9012
68
+ HOOKS_REGISTRY: '0x0000000000000000000000000000000000009013' as Address, // LP-9013
69
+ FLASH_LOAN: '0x0000000000000000000000000000000000009014' as Address, // LP-9014
70
+
71
+ // DeFi Extensions
72
+ ORACLE_HUB: '0x0000000000000000000000000000000000009011' as Address, // LP-9011
73
+ CLOB: '0x0000000000000000000000000000000000009020' as Address, // LP-9020
74
+ VAULT: '0x0000000000000000000000000000000000009030' as Address, // LP-9030
75
+
76
+ // Bridges (LP-6xxx)
77
+ TELEPORT: '0x0000000000000000000000000000000000006010' as Address, // LP-6010
76
78
  } as const
77
79
 
78
80
  /**
79
81
  * Contract addresses for Lux Dev (1337)
82
+ * Deterministic CREATE addresses from DeployFullStack.s.sol deployed by anvil account 0
83
+ * Account 0: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
80
84
  */
81
85
  export const LUX_DEV_CONTRACTS = {
82
- // Core
83
- WLUX: '0x610178dA211FEF7D417bC0e6FeD39F05609AD788' as Address,
86
+ // Core - Nonce 0
87
+ WLUX: '0x5FbDB2315678afecb367f032d93F642f64180aa3' as Address,
84
88
  MULTICALL: '0xd25F88CBdAe3c2CCA3Bb75FC4E723b44C0Ea362F' as Address,
85
89
 
86
- // Bridged tokens (local dev)
87
- ETH: '0x5FbDB2315678afecb367f032d93F642f64180aa3' as Address,
88
- BTC: '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512' as Address,
89
- USDC: '0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0' as Address,
90
- USDT: '0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9' as Address,
91
- DAI: '0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9' as Address,
92
- AI: '0x0B306BF915C4d645ff596e518fAf3F9669b97016' as Address,
90
+ // Bridged tokens (deterministic deployment nonces 1-3)
91
+ LETH: '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512' as Address, // Nonce 1
92
+ LBTC: '0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0' as Address, // Nonce 2
93
+ LUSD: '0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9' as Address, // Nonce 3
93
94
 
94
95
  // AMM V2
95
96
  V2_FACTORY: '0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1' as Address,
@@ -3,7 +3,8 @@
3
3
  import { useQuery } from '@tanstack/react-query'
4
4
  import { usePublicClient } from 'wagmi'
5
5
  import { getContracts } from '../contracts'
6
- import { UNISWAP_V3_FACTORY_ABI, UNISWAP_V3_POOL_ABI } from '../contracts/abis'
6
+ import { LUX_V3_FACTORY_ABI, LUX_V3_POOL_ABI } from '../contracts/abis'
7
+ import { LUX_MAINNET_CONTRACTS } from '../contracts/addresses'
7
8
  import type { Address } from 'viem'
8
9
 
9
10
  export interface Pool {
@@ -28,6 +29,7 @@ export function usePool(
28
29
  ) {
29
30
  const publicClient = usePublicClient({ chainId })
30
31
  const contracts = getContracts(chainId)
32
+ const v3Factory = 'V3_FACTORY' in contracts ? contracts.V3_FACTORY : LUX_MAINNET_CONTRACTS.V3_FACTORY
31
33
 
32
34
  return useQuery({
33
35
  queryKey: ['pool', token0, token1, fee, chainId],
@@ -37,8 +39,8 @@ export function usePool(
37
39
  try {
38
40
  // Get pool address from factory
39
41
  const poolAddress = await publicClient.readContract({
40
- address: contracts.V3_FACTORY,
41
- abi: UNISWAP_V3_FACTORY_ABI,
42
+ address: v3Factory,
43
+ abi: LUX_V3_FACTORY_ABI,
42
44
  functionName: 'getPool',
43
45
  args: [token0, token1, fee],
44
46
  })
@@ -51,17 +53,17 @@ export function usePool(
51
53
  const [slot0, liquidity, tickSpacing] = await Promise.all([
52
54
  publicClient.readContract({
53
55
  address: poolAddress,
54
- abi: UNISWAP_V3_POOL_ABI,
56
+ abi: LUX_V3_POOL_ABI,
55
57
  functionName: 'slot0',
56
58
  }),
57
59
  publicClient.readContract({
58
60
  address: poolAddress,
59
- abi: UNISWAP_V3_POOL_ABI,
61
+ abi: LUX_V3_POOL_ABI,
60
62
  functionName: 'liquidity',
61
63
  }),
62
64
  publicClient.readContract({
63
65
  address: poolAddress,
64
- abi: UNISWAP_V3_POOL_ABI,
66
+ abi: LUX_V3_POOL_ABI,
65
67
  functionName: 'tickSpacing',
66
68
  }),
67
69
  ])
@@ -33,7 +33,7 @@ export function usePositions(owner: Address | undefined, chainId: number) {
33
33
  try {
34
34
  // Get number of positions
35
35
  const balance = await publicClient.readContract({
36
- address: contracts.V3_NFT_POSITION_MANAGER,
36
+ address: (contracts as any).V3_NFT_POSITION_MANAGER,
37
37
  abi: NFT_POSITION_MANAGER_ABI,
38
38
  functionName: 'balanceOf',
39
39
  args: [owner],
@@ -45,7 +45,7 @@ export function usePositions(owner: Address | undefined, chainId: number) {
45
45
  const tokenIds = await Promise.all(
46
46
  Array.from({ length: Number(balance) }, (_, i) =>
47
47
  publicClient.readContract({
48
- address: contracts.V3_NFT_POSITION_MANAGER,
48
+ address: (contracts as any).V3_NFT_POSITION_MANAGER,
49
49
  abi: NFT_POSITION_MANAGER_ABI,
50
50
  functionName: 'tokenOfOwnerByIndex',
51
51
  args: [owner, BigInt(i)],
@@ -57,7 +57,7 @@ export function usePositions(owner: Address | undefined, chainId: number) {
57
57
  const positions = await Promise.all(
58
58
  tokenIds.map(async (tokenId) => {
59
59
  const position = await publicClient.readContract({
60
- address: contracts.V3_NFT_POSITION_MANAGER,
60
+ address: (contracts as any).V3_NFT_POSITION_MANAGER,
61
61
  abi: NFT_POSITION_MANAGER_ABI,
62
62
  functionName: 'positions',
63
63
  args: [tokenId],
@@ -43,7 +43,7 @@ export function useSwapQuote({
43
43
  try {
44
44
  // Call QuoterV2 for quote
45
45
  const result = await publicClient.simulateContract({
46
- address: contracts.V3_QUOTER_V2,
46
+ address: (contracts as any).V3_QUOTER_V2,
47
47
  abi: QUOTER_V2_ABI,
48
48
  functionName: 'quoteExactInputSingle',
49
49
  args: [
@@ -31,7 +31,7 @@ export function useSwap() {
31
31
  const isNativeIn = isNativeToken(params.tokenIn)
32
32
 
33
33
  const txHash = await writeContractAsync({
34
- address: contracts.V3_SWAP_ROUTER_02,
34
+ address: (contracts as any).V3_SWAP_ROUTER_02 ?? contracts.V2_ROUTER,
35
35
  abi: SWAP_ROUTER_ABI,
36
36
  functionName: 'exactInputSingle',
37
37
  args: [
package/src/index.ts CHANGED
@@ -27,5 +27,5 @@ export * from './hooks'
27
27
  // Stores
28
28
  export * from './stores'
29
29
 
30
- // Note: Bridge module is experimental and will be added in a future release
31
- // See bridge-wip/ for the work-in-progress implementation
30
+ // Bridge (cross-chain + Z-Chain privacy layer)
31
+ export * from './bridge'
@@ -38,7 +38,7 @@ export const NATIVE_ZOO: Token = {
38
38
  * Wrapped native tokens
39
39
  */
40
40
  export const WLUX_MAINNET: Token = {
41
- address: '0x55750d6CA62a041c06a8E28626b10Be6c688f471',
41
+ address: '0x4888e4a2ee0f03051c72d2bd3acf755ed3498b3e',
42
42
  chainId: 96369,
43
43
  decimals: 18,
44
44
  symbol: 'WLUX',
@@ -46,7 +46,7 @@ export const WLUX_MAINNET: Token = {
46
46
  }
47
47
 
48
48
  export const WLUX_TESTNET: Token = {
49
- address: '0x732740c5c895C9FCF619930ed4293fc858eb44c7',
49
+ address: '0xDe5310d0Eccc04C8987cB66Ff6b89Ee793442C91',
50
50
  chainId: 96368,
51
51
  decimals: 18,
52
52
  symbol: 'WLUX',
@@ -54,7 +54,8 @@ export const WLUX_TESTNET: Token = {
54
54
  }
55
55
 
56
56
  export const WLUX_DEV: Token = {
57
- address: '0x610178dA211FEF7D417bC0e6FeD39F05609AD788',
57
+ // Deterministic CREATE address from DeployFullStack.s.sol (nonce 0)
58
+ address: '0x5FbDB2315678afecb367f032d93F642f64180aa3',
58
59
  chainId: 1337,
59
60
  decimals: 18,
60
61
  symbol: 'WLUX',
@@ -65,18 +66,19 @@ export const WLUX_DEV: Token = {
65
66
  * Stablecoins
66
67
  */
67
68
  export const LUSD: Token = {
68
- address: '0x0000000000000000000000000000000000000000', // TODO: Deploy
69
+ address: '0x848Cff46eb323f323b6Bbe1Df274E40793d7f2c2',
69
70
  chainId: 96369,
70
71
  decimals: 18,
71
72
  symbol: 'LUSD',
72
- name: 'Lux Dollar',
73
+ name: 'Lux USD',
73
74
  }
74
75
 
75
76
  /**
76
77
  * Bridge tokens (L-prefix for assets bridged to Lux)
78
+ * These are the canonical mainnet addresses from @luxfi/config
77
79
  */
78
80
  export const LETH: Token = {
79
- address: '0xAA3AE951A7925F25aE8Ad65b052a76Bd8f052598',
81
+ address: '0x60E0a8167FC13dE89348978860466C9ceC24B9ba',
80
82
  chainId: 96369,
81
83
  decimals: 18,
82
84
  symbol: 'LETH',
@@ -84,13 +86,91 @@ export const LETH: Token = {
84
86
  }
85
87
 
86
88
  export const LBTC: Token = {
87
- address: '0x526903Ee6118de6737D11b37f82fC7f69B13685D',
89
+ address: '0x1E48D32a4F5e9f08DB9aE4959163300FaF8A6C8e',
90
+ chainId: 96369,
91
+ decimals: 8,
92
+ symbol: 'LBTC',
93
+ name: 'Lux BTC',
94
+ }
95
+
96
+ export const LSOL: Token = {
97
+ address: '0x26B40f650156C7EbF9e087Dd0dca181Fe87625B7',
98
+ chainId: 96369,
99
+ decimals: 18,
100
+ symbol: 'LSOL',
101
+ name: 'Lux SOL',
102
+ }
103
+
104
+ export const LTON: Token = {
105
+ address: '0x3141b94b89691009b950c96e97Bff48e0C543E3C',
88
106
  chainId: 96369,
107
+ decimals: 9,
108
+ symbol: 'LTON',
109
+ name: 'Lux TON',
110
+ }
111
+
112
+ export const LAVAX: Token = {
113
+ address: '0x0e4bD0DD67c15dECfBBBdbbE07FC9d51D737693D',
114
+ chainId: 96369,
115
+ decimals: 18,
116
+ symbol: 'LAVAX',
117
+ name: 'Lux AVAX',
118
+ }
119
+
120
+ /**
121
+ * Testnet bridge tokens
122
+ */
123
+ export const LETH_TESTNET: Token = {
124
+ address: '0xA695a8A66fbe3E32d15a531db04185313595771A',
125
+ chainId: 96368,
126
+ decimals: 18,
127
+ symbol: 'LETH',
128
+ name: 'Lux ETH',
129
+ }
130
+
131
+ export const LBTC_TESTNET: Token = {
132
+ address: '0x5a88986958ea76Dd043f834542724F081cA1443B',
133
+ chainId: 96368,
134
+ decimals: 8,
135
+ symbol: 'LBTC',
136
+ name: 'Lux BTC',
137
+ }
138
+
139
+ export const LUSD_TESTNET: Token = {
140
+ address: '0x8a3fad1c7FB94461621351aa6A983B6f814F039c',
141
+ chainId: 96368,
142
+ decimals: 6,
143
+ symbol: 'LUSDC',
144
+ name: 'Lux USDC',
145
+ }
146
+
147
+ /**
148
+ * Dev mode bridge tokens (deterministic CREATE addresses)
149
+ */
150
+ export const LETH_DEV: Token = {
151
+ address: '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512',
152
+ chainId: 1337,
153
+ decimals: 18,
154
+ symbol: 'LETH',
155
+ name: 'Lux ETH',
156
+ }
157
+
158
+ export const LBTC_DEV: Token = {
159
+ address: '0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0',
160
+ chainId: 1337,
89
161
  decimals: 8,
90
162
  symbol: 'LBTC',
91
163
  name: 'Lux BTC',
92
164
  }
93
165
 
166
+ export const LUSD_DEV: Token = {
167
+ address: '0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9',
168
+ chainId: 1337,
169
+ decimals: 6,
170
+ symbol: 'LUSD',
171
+ name: 'Lux Dollar',
172
+ }
173
+
94
174
  /**
95
175
  * Major tokens on Lux Mainnet
96
176
  */
@@ -127,7 +207,7 @@ export const WBTC_LUX: Token = {
127
207
  }
128
208
 
129
209
  export const DAI_LUX: Token = {
130
- address: '0x6B175474E89094C44Da98b954EesdscdKD34eL55',
210
+ address: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
131
211
  chainId: 96369,
132
212
  decimals: 18,
133
213
  symbol: 'DAI',
@@ -138,35 +218,35 @@ export const DAI_LUX: Token = {
138
218
  * Zoo chain tokens
139
219
  */
140
220
  export const WZOO: Token = {
141
- address: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
221
+ address: '0x5491216406daB99b7032b83765F36790E27F8A61',
142
222
  chainId: 200200,
143
223
  decimals: 18,
144
224
  symbol: 'WZOO',
145
225
  name: 'Wrapped ZOO',
146
226
  }
147
227
 
148
- export const USDC_ZOO: Token = {
149
- address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
228
+ export const LETH_ZOO: Token = {
229
+ address: '0x4870621EA8be7a383eFCfdA225249d35888bD9f2',
150
230
  chainId: 200200,
151
- decimals: 6,
152
- symbol: 'USDC',
153
- name: 'USD Coin',
231
+ decimals: 18,
232
+ symbol: 'LETH',
233
+ name: 'Lux ETH',
154
234
  }
155
235
 
156
- export const USDT_ZOO: Token = {
157
- address: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
236
+ export const LBTC_ZOO: Token = {
237
+ address: '0x6fc44509a32E513bE1aa00d27bb298e63830C6A8',
158
238
  chainId: 200200,
159
- decimals: 6,
160
- symbol: 'USDT',
161
- name: 'Tether USD',
239
+ decimals: 8,
240
+ symbol: 'LBTC',
241
+ name: 'Lux BTC',
162
242
  }
163
243
 
164
- export const WETH_ZOO: Token = {
165
- address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
244
+ export const LUSD_ZOO: Token = {
245
+ address: '0xb2ee1CE7b84853b83AA08702aD0aD4D79711882D',
166
246
  chainId: 200200,
167
247
  decimals: 18,
168
- symbol: 'WETH',
169
- name: 'Wrapped Ether',
248
+ symbol: 'LUSD',
249
+ name: 'Lux USD',
170
250
  }
171
251
 
172
252
  /**
@@ -175,14 +255,12 @@ export const WETH_ZOO: Token = {
175
255
  export const LUX_MAINNET_TOKENS: Token[] = [
176
256
  NATIVE_LUX,
177
257
  WLUX_MAINNET,
178
- USDC_LUX,
179
- USDT_LUX,
180
- WETH_LUX,
181
- WBTC_LUX,
182
- DAI_LUX,
258
+ LUSD,
183
259
  LETH,
184
260
  LBTC,
185
- LUSD,
261
+ LSOL,
262
+ LTON,
263
+ LAVAX,
186
264
  ]
187
265
 
188
266
  /**
@@ -191,11 +269,49 @@ export const LUX_MAINNET_TOKENS: Token[] = [
191
269
  export const ZOO_MAINNET_TOKENS: Token[] = [
192
270
  NATIVE_ZOO,
193
271
  WZOO,
194
- USDC_ZOO,
195
- USDT_ZOO,
196
- WETH_ZOO,
272
+ LUSD_ZOO,
273
+ LETH_ZOO,
274
+ LBTC_ZOO,
275
+ ]
276
+
277
+ /**
278
+ * Default token list for Lux Testnet
279
+ */
280
+ export const LUX_TESTNET_TOKENS: Token[] = [
281
+ WLUX_TESTNET,
282
+ LETH_TESTNET,
283
+ LBTC_TESTNET,
284
+ LUSD_TESTNET,
285
+ ]
286
+
287
+ /**
288
+ * Default token list for Lux Dev
289
+ */
290
+ export const LUX_DEV_TOKENS: Token[] = [
291
+ WLUX_DEV,
292
+ LETH_DEV,
293
+ LBTC_DEV,
294
+ LUSD_DEV,
197
295
  ]
198
296
 
297
+ /**
298
+ * Get tokens for a chain
299
+ */
300
+ export function getTokensForChain(chainId: number): Token[] {
301
+ switch (chainId) {
302
+ case 96369:
303
+ return LUX_MAINNET_TOKENS
304
+ case 96368:
305
+ return LUX_TESTNET_TOKENS
306
+ case 1337:
307
+ return LUX_DEV_TOKENS
308
+ case 200200:
309
+ return ZOO_MAINNET_TOKENS
310
+ default:
311
+ return []
312
+ }
313
+ }
314
+
199
315
  /**
200
316
  * Get wrapped native token for chain
201
317
  */
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=use-private-teleport.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-private-teleport.test.d.ts","sourceRoot":"","sources":["../../../src/bridge/__tests__/use-private-teleport.test.ts"],"names":[],"mappings":""}