@luxfi/exchange 1.0.1 → 1.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/chains/lux.d.ts +116 -6
- package/dist/chains/lux.d.ts.map +1 -1
- package/dist/contracts/abis/amm-v2-factory.d.ts +2 -2
- package/dist/contracts/abis/amm-v2-factory.d.ts.map +1 -1
- package/dist/contracts/abis/amm-v2-factory.js +2 -2
- package/dist/contracts/abis/amm-v2-pair.d.ts +2 -2
- package/dist/contracts/abis/amm-v2-pair.d.ts.map +1 -1
- package/dist/contracts/abis/amm-v2-pair.js +2 -2
- package/dist/contracts/abis/amm-v2-router.d.ts +2 -2
- package/dist/contracts/abis/amm-v2-router.d.ts.map +1 -1
- package/dist/contracts/abis/amm-v2-router.js +2 -2
- package/dist/contracts/abis/amm-v3-factory.d.ts +2 -2
- package/dist/contracts/abis/amm-v3-factory.d.ts.map +1 -1
- package/dist/contracts/abis/amm-v3-factory.js +2 -2
- package/dist/contracts/abis/amm-v3-pool.d.ts +2 -2
- package/dist/contracts/abis/amm-v3-pool.d.ts.map +1 -1
- package/dist/contracts/abis/amm-v3-pool.js +2 -2
- package/dist/contracts/abis/index.d.ts +7 -7
- package/dist/contracts/abis/index.d.ts.map +1 -1
- package/dist/contracts/abis/index.js +7 -7
- package/dist/contracts/abis/lux-amm-v2-factory.d.ts +148 -0
- package/dist/contracts/abis/lux-amm-v2-factory.d.ts.map +1 -0
- package/dist/contracts/abis/lux-amm-v2-factory.js +52 -0
- package/dist/contracts/abis/lux-amm-v2-pair.d.ts +236 -0
- package/dist/contracts/abis/lux-amm-v2-pair.d.ts.map +1 -0
- package/dist/contracts/abis/lux-amm-v2-pair.js +88 -0
- package/dist/contracts/abis/lux-amm-v2-router.d.ts +496 -0
- package/dist/contracts/abis/lux-amm-v2-router.d.ts.map +1 -0
- package/dist/contracts/abis/lux-amm-v2-router.js +149 -0
- package/dist/contracts/abis/lux-amm-v3-factory.d.ts +152 -0
- package/dist/contracts/abis/lux-amm-v3-factory.d.ts.map +1 -0
- package/dist/contracts/abis/lux-amm-v3-factory.js +48 -0
- package/dist/contracts/abis/lux-amm-v3-pool.d.ts +254 -0
- package/dist/contracts/abis/lux-amm-v3-pool.d.ts.map +1 -0
- package/dist/contracts/abis/lux-amm-v3-pool.js +84 -0
- package/dist/contracts/abis/pool-manager.d.ts +1 -1
- package/dist/contracts/abis/pool-manager.js +1 -1
- package/dist/contracts/abis/uniswap-v2-factory.d.ts +75 -0
- package/dist/contracts/abis/uniswap-v2-factory.d.ts.map +1 -0
- package/dist/contracts/abis/uniswap-v2-factory.js +49 -0
- package/dist/contracts/abis/uniswap-v2-pair.d.ts +119 -0
- package/dist/contracts/abis/uniswap-v2-pair.d.ts.map +1 -0
- package/dist/contracts/abis/uniswap-v2-pair.js +85 -0
- package/dist/contracts/abis/uniswap-v2-router.d.ts +249 -0
- package/dist/contracts/abis/uniswap-v2-router.d.ts.map +1 -0
- package/dist/contracts/abis/uniswap-v2-router.js +146 -0
- package/dist/contracts/abis/uniswap-v3-factory.d.ts +77 -0
- package/dist/contracts/abis/uniswap-v3-factory.d.ts.map +1 -0
- package/dist/contracts/abis/uniswap-v3-factory.js +45 -0
- package/dist/contracts/abis/uniswap-v3-pool.d.ts +128 -0
- package/dist/contracts/abis/uniswap-v3-pool.d.ts.map +1 -0
- package/dist/contracts/abis/uniswap-v3-pool.js +81 -0
- package/dist/contracts/addresses.d.ts +13 -31
- package/dist/contracts/addresses.d.ts.map +1 -1
- package/dist/contracts/addresses.js +34 -25
- package/dist/hooks/use-pools.d.ts.map +1 -1
- package/dist/hooks/use-pools.js +6 -8
- package/dist/hooks/use-swap.js +1 -1
- package/dist/hooks/use-token-allowance.d.ts +1 -1
- package/dist/tokens/index.d.ts +3 -6
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/index.js +38 -57
- package/package.json +3 -2
- package/src/chains/index.ts +6 -0
- package/src/chains/lux.ts +68 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UniswapV3Factory ABI
|
|
3
|
+
*/
|
|
4
|
+
export const UNISWAP_V3_FACTORY_ABI = [
|
|
5
|
+
{
|
|
6
|
+
type: 'function',
|
|
7
|
+
name: 'getPool',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'tokenA', type: 'address' },
|
|
10
|
+
{ name: 'tokenB', type: 'address' },
|
|
11
|
+
{ name: 'fee', type: 'uint24' },
|
|
12
|
+
],
|
|
13
|
+
outputs: [{ name: 'pool', type: 'address' }],
|
|
14
|
+
stateMutability: 'view',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: 'function',
|
|
18
|
+
name: 'createPool',
|
|
19
|
+
inputs: [
|
|
20
|
+
{ name: 'tokenA', type: 'address' },
|
|
21
|
+
{ name: 'tokenB', type: 'address' },
|
|
22
|
+
{ name: 'fee', type: 'uint24' },
|
|
23
|
+
],
|
|
24
|
+
outputs: [{ name: 'pool', type: 'address' }],
|
|
25
|
+
stateMutability: 'nonpayable',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
type: 'function',
|
|
29
|
+
name: 'feeAmountTickSpacing',
|
|
30
|
+
inputs: [{ name: 'fee', type: 'uint24' }],
|
|
31
|
+
outputs: [{ name: 'tickSpacing', type: 'int24' }],
|
|
32
|
+
stateMutability: 'view',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 'event',
|
|
36
|
+
name: 'PoolCreated',
|
|
37
|
+
inputs: [
|
|
38
|
+
{ name: 'token0', type: 'address', indexed: true },
|
|
39
|
+
{ name: 'token1', type: 'address', indexed: true },
|
|
40
|
+
{ name: 'fee', type: 'uint24', indexed: true },
|
|
41
|
+
{ name: 'tickSpacing', type: 'int24', indexed: false },
|
|
42
|
+
{ name: 'pool', type: 'address', indexed: false },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
];
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UniswapV3Pool ABI (essential functions)
|
|
3
|
+
*/
|
|
4
|
+
export declare const UNISWAP_V3_POOL_ABI: readonly [{
|
|
5
|
+
readonly type: "function";
|
|
6
|
+
readonly name: "token0";
|
|
7
|
+
readonly inputs: readonly [];
|
|
8
|
+
readonly outputs: readonly [{
|
|
9
|
+
readonly type: "address";
|
|
10
|
+
}];
|
|
11
|
+
readonly stateMutability: "view";
|
|
12
|
+
}, {
|
|
13
|
+
readonly type: "function";
|
|
14
|
+
readonly name: "token1";
|
|
15
|
+
readonly inputs: readonly [];
|
|
16
|
+
readonly outputs: readonly [{
|
|
17
|
+
readonly type: "address";
|
|
18
|
+
}];
|
|
19
|
+
readonly stateMutability: "view";
|
|
20
|
+
}, {
|
|
21
|
+
readonly type: "function";
|
|
22
|
+
readonly name: "fee";
|
|
23
|
+
readonly inputs: readonly [];
|
|
24
|
+
readonly outputs: readonly [{
|
|
25
|
+
readonly type: "uint24";
|
|
26
|
+
}];
|
|
27
|
+
readonly stateMutability: "view";
|
|
28
|
+
}, {
|
|
29
|
+
readonly type: "function";
|
|
30
|
+
readonly name: "tickSpacing";
|
|
31
|
+
readonly inputs: readonly [];
|
|
32
|
+
readonly outputs: readonly [{
|
|
33
|
+
readonly type: "int24";
|
|
34
|
+
}];
|
|
35
|
+
readonly stateMutability: "view";
|
|
36
|
+
}, {
|
|
37
|
+
readonly type: "function";
|
|
38
|
+
readonly name: "liquidity";
|
|
39
|
+
readonly inputs: readonly [];
|
|
40
|
+
readonly outputs: readonly [{
|
|
41
|
+
readonly type: "uint128";
|
|
42
|
+
}];
|
|
43
|
+
readonly stateMutability: "view";
|
|
44
|
+
}, {
|
|
45
|
+
readonly type: "function";
|
|
46
|
+
readonly name: "slot0";
|
|
47
|
+
readonly inputs: readonly [];
|
|
48
|
+
readonly outputs: readonly [{
|
|
49
|
+
readonly name: "sqrtPriceX96";
|
|
50
|
+
readonly type: "uint160";
|
|
51
|
+
}, {
|
|
52
|
+
readonly name: "tick";
|
|
53
|
+
readonly type: "int24";
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "observationIndex";
|
|
56
|
+
readonly type: "uint16";
|
|
57
|
+
}, {
|
|
58
|
+
readonly name: "observationCardinality";
|
|
59
|
+
readonly type: "uint16";
|
|
60
|
+
}, {
|
|
61
|
+
readonly name: "observationCardinalityNext";
|
|
62
|
+
readonly type: "uint16";
|
|
63
|
+
}, {
|
|
64
|
+
readonly name: "feeProtocol";
|
|
65
|
+
readonly type: "uint8";
|
|
66
|
+
}, {
|
|
67
|
+
readonly name: "unlocked";
|
|
68
|
+
readonly type: "bool";
|
|
69
|
+
}];
|
|
70
|
+
readonly stateMutability: "view";
|
|
71
|
+
}, {
|
|
72
|
+
readonly type: "function";
|
|
73
|
+
readonly name: "positions";
|
|
74
|
+
readonly inputs: readonly [{
|
|
75
|
+
readonly name: "key";
|
|
76
|
+
readonly type: "bytes32";
|
|
77
|
+
}];
|
|
78
|
+
readonly outputs: readonly [{
|
|
79
|
+
readonly name: "liquidity";
|
|
80
|
+
readonly type: "uint128";
|
|
81
|
+
}, {
|
|
82
|
+
readonly name: "feeGrowthInside0LastX128";
|
|
83
|
+
readonly type: "uint256";
|
|
84
|
+
}, {
|
|
85
|
+
readonly name: "feeGrowthInside1LastX128";
|
|
86
|
+
readonly type: "uint256";
|
|
87
|
+
}, {
|
|
88
|
+
readonly name: "tokensOwed0";
|
|
89
|
+
readonly type: "uint128";
|
|
90
|
+
}, {
|
|
91
|
+
readonly name: "tokensOwed1";
|
|
92
|
+
readonly type: "uint128";
|
|
93
|
+
}];
|
|
94
|
+
readonly stateMutability: "view";
|
|
95
|
+
}, {
|
|
96
|
+
readonly type: "event";
|
|
97
|
+
readonly name: "Swap";
|
|
98
|
+
readonly inputs: readonly [{
|
|
99
|
+
readonly name: "sender";
|
|
100
|
+
readonly type: "address";
|
|
101
|
+
readonly indexed: true;
|
|
102
|
+
}, {
|
|
103
|
+
readonly name: "recipient";
|
|
104
|
+
readonly type: "address";
|
|
105
|
+
readonly indexed: true;
|
|
106
|
+
}, {
|
|
107
|
+
readonly name: "amount0";
|
|
108
|
+
readonly type: "int256";
|
|
109
|
+
readonly indexed: false;
|
|
110
|
+
}, {
|
|
111
|
+
readonly name: "amount1";
|
|
112
|
+
readonly type: "int256";
|
|
113
|
+
readonly indexed: false;
|
|
114
|
+
}, {
|
|
115
|
+
readonly name: "sqrtPriceX96";
|
|
116
|
+
readonly type: "uint160";
|
|
117
|
+
readonly indexed: false;
|
|
118
|
+
}, {
|
|
119
|
+
readonly name: "liquidity";
|
|
120
|
+
readonly type: "uint128";
|
|
121
|
+
readonly indexed: false;
|
|
122
|
+
}, {
|
|
123
|
+
readonly name: "tick";
|
|
124
|
+
readonly type: "int24";
|
|
125
|
+
readonly indexed: false;
|
|
126
|
+
}];
|
|
127
|
+
}];
|
|
128
|
+
//# sourceMappingURL=uniswap-v3-pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uniswap-v3-pool.d.ts","sourceRoot":"","sources":["../../../src/contracts/abis/uniswap-v3-pool.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6EtB,CAAA"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UniswapV3Pool ABI (essential functions)
|
|
3
|
+
*/
|
|
4
|
+
export const UNISWAP_V3_POOL_ABI = [
|
|
5
|
+
{
|
|
6
|
+
type: 'function',
|
|
7
|
+
name: 'token0',
|
|
8
|
+
inputs: [],
|
|
9
|
+
outputs: [{ type: 'address' }],
|
|
10
|
+
stateMutability: 'view',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
type: 'function',
|
|
14
|
+
name: 'token1',
|
|
15
|
+
inputs: [],
|
|
16
|
+
outputs: [{ type: 'address' }],
|
|
17
|
+
stateMutability: 'view',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: 'function',
|
|
21
|
+
name: 'fee',
|
|
22
|
+
inputs: [],
|
|
23
|
+
outputs: [{ type: 'uint24' }],
|
|
24
|
+
stateMutability: 'view',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'function',
|
|
28
|
+
name: 'tickSpacing',
|
|
29
|
+
inputs: [],
|
|
30
|
+
outputs: [{ type: 'int24' }],
|
|
31
|
+
stateMutability: 'view',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
type: 'function',
|
|
35
|
+
name: 'liquidity',
|
|
36
|
+
inputs: [],
|
|
37
|
+
outputs: [{ type: 'uint128' }],
|
|
38
|
+
stateMutability: 'view',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'function',
|
|
42
|
+
name: 'slot0',
|
|
43
|
+
inputs: [],
|
|
44
|
+
outputs: [
|
|
45
|
+
{ name: 'sqrtPriceX96', type: 'uint160' },
|
|
46
|
+
{ name: 'tick', type: 'int24' },
|
|
47
|
+
{ name: 'observationIndex', type: 'uint16' },
|
|
48
|
+
{ name: 'observationCardinality', type: 'uint16' },
|
|
49
|
+
{ name: 'observationCardinalityNext', type: 'uint16' },
|
|
50
|
+
{ name: 'feeProtocol', type: 'uint8' },
|
|
51
|
+
{ name: 'unlocked', type: 'bool' },
|
|
52
|
+
],
|
|
53
|
+
stateMutability: 'view',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: 'function',
|
|
57
|
+
name: 'positions',
|
|
58
|
+
inputs: [{ name: 'key', type: 'bytes32' }],
|
|
59
|
+
outputs: [
|
|
60
|
+
{ name: 'liquidity', type: 'uint128' },
|
|
61
|
+
{ name: 'feeGrowthInside0LastX128', type: 'uint256' },
|
|
62
|
+
{ name: 'feeGrowthInside1LastX128', type: 'uint256' },
|
|
63
|
+
{ name: 'tokensOwed0', type: 'uint128' },
|
|
64
|
+
{ name: 'tokensOwed1', type: 'uint128' },
|
|
65
|
+
],
|
|
66
|
+
stateMutability: 'view',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: 'event',
|
|
70
|
+
name: 'Swap',
|
|
71
|
+
inputs: [
|
|
72
|
+
{ name: 'sender', type: 'address', indexed: true },
|
|
73
|
+
{ name: 'recipient', type: 'address', indexed: true },
|
|
74
|
+
{ name: 'amount0', type: 'int256', indexed: false },
|
|
75
|
+
{ name: 'amount1', type: 'int256', indexed: false },
|
|
76
|
+
{ name: 'sqrtPriceX96', type: 'uint160', indexed: false },
|
|
77
|
+
{ name: 'liquidity', type: 'uint128', indexed: false },
|
|
78
|
+
{ name: 'tick', type: 'int24', indexed: false },
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
];
|
|
@@ -11,9 +11,6 @@ export declare const LUX_MAINNET_CONTRACTS: {
|
|
|
11
11
|
readonly LETH: Address;
|
|
12
12
|
readonly LBTC: Address;
|
|
13
13
|
readonly LUSD: Address;
|
|
14
|
-
readonly LSOL: Address;
|
|
15
|
-
readonly LTON: Address;
|
|
16
|
-
readonly LAVAX: Address;
|
|
17
14
|
readonly V2_FACTORY: Address;
|
|
18
15
|
readonly V2_ROUTER: Address;
|
|
19
16
|
readonly V3_FACTORY: Address;
|
|
@@ -21,22 +18,33 @@ export declare const LUX_MAINNET_CONTRACTS: {
|
|
|
21
18
|
readonly V3_SWAP_ROUTER_02: Address;
|
|
22
19
|
readonly V3_QUOTER: Address;
|
|
23
20
|
readonly V3_QUOTER_V2: Address;
|
|
21
|
+
readonly V3_TICK_LENS: Address;
|
|
24
22
|
readonly V3_NFT_POSITION_MANAGER: Address;
|
|
23
|
+
readonly V3_NFT_DESCRIPTOR: Address;
|
|
25
24
|
};
|
|
26
25
|
/**
|
|
27
26
|
* Contract addresses for Lux Testnet (96368)
|
|
28
27
|
*/
|
|
29
28
|
export declare const LUX_TESTNET_CONTRACTS: {
|
|
30
29
|
readonly WLUX: Address;
|
|
30
|
+
readonly WETH: Address;
|
|
31
31
|
readonly MULTICALL: Address;
|
|
32
32
|
readonly LETH: Address;
|
|
33
33
|
readonly LBTC: Address;
|
|
34
|
-
readonly
|
|
34
|
+
readonly LUSD: Address;
|
|
35
35
|
readonly V2_FACTORY: Address;
|
|
36
36
|
readonly V2_ROUTER: Address;
|
|
37
|
+
readonly V3_FACTORY: Address;
|
|
38
|
+
readonly V3_SWAP_ROUTER: Address;
|
|
39
|
+
readonly V3_SWAP_ROUTER_02: Address;
|
|
40
|
+
readonly V3_QUOTER: Address;
|
|
41
|
+
readonly V3_QUOTER_V2: Address;
|
|
42
|
+
readonly V3_TICK_LENS: Address;
|
|
43
|
+
readonly V3_NFT_POSITION_MANAGER: Address;
|
|
44
|
+
readonly V3_NFT_DESCRIPTOR: Address;
|
|
37
45
|
};
|
|
38
46
|
/**
|
|
39
|
-
* DEX Precompile addresses (native AMM -
|
|
47
|
+
* DEX Precompile addresses (native AMM - Uniswap v4 style singleton PoolManager)
|
|
40
48
|
* These provide sub-microsecond execution via native Go implementation
|
|
41
49
|
*
|
|
42
50
|
* Address format: 0x0000...00LPNUMBER (addresses end with LP number)
|
|
@@ -83,31 +91,6 @@ export declare const LUX_DEV_CONTRACTS: {
|
|
|
83
91
|
* Get contracts for a specific chain
|
|
84
92
|
*/
|
|
85
93
|
export declare function getContracts(chainId: number): {
|
|
86
|
-
readonly WLUX: Address;
|
|
87
|
-
readonly MULTICALL: Address;
|
|
88
|
-
readonly LETH: Address;
|
|
89
|
-
readonly LBTC: Address;
|
|
90
|
-
readonly LUSD: Address;
|
|
91
|
-
readonly LSOL: Address;
|
|
92
|
-
readonly LTON: Address;
|
|
93
|
-
readonly LAVAX: Address;
|
|
94
|
-
readonly V2_FACTORY: Address;
|
|
95
|
-
readonly V2_ROUTER: Address;
|
|
96
|
-
readonly V3_FACTORY: Address;
|
|
97
|
-
readonly V3_SWAP_ROUTER: Address;
|
|
98
|
-
readonly V3_SWAP_ROUTER_02: Address;
|
|
99
|
-
readonly V3_QUOTER: Address;
|
|
100
|
-
readonly V3_QUOTER_V2: Address;
|
|
101
|
-
readonly V3_NFT_POSITION_MANAGER: Address;
|
|
102
|
-
} | {
|
|
103
|
-
readonly WLUX: Address;
|
|
104
|
-
readonly MULTICALL: Address;
|
|
105
|
-
readonly LETH: Address;
|
|
106
|
-
readonly LBTC: Address;
|
|
107
|
-
readonly LUSDC: Address;
|
|
108
|
-
readonly V2_FACTORY: Address;
|
|
109
|
-
readonly V2_ROUTER: Address;
|
|
110
|
-
} | {
|
|
111
94
|
readonly WLUX: Address;
|
|
112
95
|
readonly MULTICALL: Address;
|
|
113
96
|
readonly LETH: Address;
|
|
@@ -123,7 +106,6 @@ export declare function getContracts(chainId: number): {
|
|
|
123
106
|
readonly V3_TICK_LENS: Address;
|
|
124
107
|
readonly V3_NFT_POSITION_MANAGER: Address;
|
|
125
108
|
readonly V3_NFT_DESCRIPTOR: Address;
|
|
126
|
-
readonly STAKED_LUX: Address;
|
|
127
109
|
};
|
|
128
110
|
export type ContractAddresses = typeof LUX_MAINNET_CONTRACTS;
|
|
129
111
|
//# sourceMappingURL=addresses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../src/contracts/addresses.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC;;GAEG;AACH,eAAO,MAAM,qBAAqB;mBAEsB,OAAO;wBACF,OAAO;mBAGZ,OAAO;mBACP,OAAO;mBACP,OAAO;
|
|
1
|
+
{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../src/contracts/addresses.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC;;GAEG;AACH,eAAO,MAAM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Contract addresses for Lux Mainnet (96369)
|
|
3
3
|
*/
|
|
4
4
|
export const LUX_MAINNET_CONTRACTS = {
|
|
5
|
-
// Core
|
|
6
|
-
WLUX: '
|
|
5
|
+
// Core
|
|
6
|
+
WLUX: '0x55750d6CA62a041c06a8E28626b10Be6c688f471',
|
|
7
7
|
MULTICALL: '0xd25F88CBdAe3c2CCA3Bb75FC4E723b44C0Ea362F',
|
|
8
|
-
// Bridge tokens
|
|
9
|
-
LETH: '
|
|
10
|
-
LBTC: '
|
|
11
|
-
LUSD: '
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// AMM
|
|
16
|
-
|
|
17
|
-
V2_ROUTER: '0xAe2cf1E403aAFE6C05A5b8Ef63EB19ba591d8511',
|
|
18
|
-
// AMM V3 (CREATE2) — 8+ pools, active trading, verified on-chain
|
|
19
|
-
V3_FACTORY: '0x80bBc7C4C7a59C899D1B37BC14539A22D5830a84',
|
|
8
|
+
// Bridge tokens
|
|
9
|
+
LETH: '0xAA3AE95816a4A6FbC6b8Ed5a6C06f22A96A80C8C',
|
|
10
|
+
LBTC: '0x526903E35E7106D62ED3B5d77E14e51d024Aa1D3',
|
|
11
|
+
LUSD: '0x4B1BfA76eD63F1A0aD2E4f40b3F46C45E8F7A4E2',
|
|
12
|
+
// AMM V2 (QuantumSwap)
|
|
13
|
+
V2_FACTORY: '0xd9a95609DbB228A13568Bd9f9A285105E7596970',
|
|
14
|
+
V2_ROUTER: '0x1F6cbC7d3bc7D803ee76D80F0eEE25767431e674',
|
|
15
|
+
// AMM V3 (Concentrated Liquidity)
|
|
16
|
+
V3_FACTORY: '0xb732BD88F25EdD9C3456638671fB37685D4B4e3f',
|
|
20
17
|
V3_SWAP_ROUTER: '0xE8fb25086C8652c92f5AF90D730Bac7C63Fc9A58',
|
|
21
18
|
V3_SWAP_ROUTER_02: '0x939bC0Bca6F9B9c52E6e3AD8A3C590b5d9B9D10E',
|
|
22
19
|
V3_QUOTER: '0x12e2B76FaF4dDA5a173a4532916bb6Bfa3645275',
|
|
23
20
|
V3_QUOTER_V2: '0x15C729fdd833Ba675edd466Dfc63E1B737925A4c',
|
|
21
|
+
V3_TICK_LENS: '0x57A22965AdA0e52D785A9Aa155beF423D573b879',
|
|
24
22
|
V3_NFT_POSITION_MANAGER: '0x7a4C48B9dae0b7c396569b34042fcA604150Ee28',
|
|
23
|
+
V3_NFT_DESCRIPTOR: '0x53B1aAA5b6DDFD4eD00D0A7b5Ef333dc74B605b5',
|
|
25
24
|
};
|
|
26
25
|
/**
|
|
27
26
|
* Contract addresses for Lux Testnet (96368)
|
|
28
27
|
*/
|
|
29
28
|
export const LUX_TESTNET_CONTRACTS = {
|
|
30
|
-
// Core
|
|
31
|
-
WLUX: '
|
|
29
|
+
// Core
|
|
30
|
+
WLUX: '0x732740c5c895C9FCF619930ed4293fc858eb44c7',
|
|
31
|
+
WETH: '0xd9956542B51032d940ef076d70B69410667277A3',
|
|
32
32
|
MULTICALL: '0xd25F88CBdAe3c2CCA3Bb75FC4E723b44C0Ea362F',
|
|
33
|
-
// Bridge tokens
|
|
34
|
-
LETH: '
|
|
35
|
-
LBTC: '
|
|
36
|
-
|
|
37
|
-
// AMM V2
|
|
38
|
-
V2_FACTORY: '
|
|
39
|
-
V2_ROUTER: '
|
|
33
|
+
// Bridge tokens (testnet deployments)
|
|
34
|
+
LETH: '0x60E0a8167FC13dE89348978860466C9ceC24B9ba',
|
|
35
|
+
LBTC: '0x1E48D32a4F5e9f08DB9aE4959163300FaF8A6C8e',
|
|
36
|
+
LUSD: '0xb84112ac9318a0b2319aa11d4d10e9762b25f7f4',
|
|
37
|
+
// AMM V2
|
|
38
|
+
V2_FACTORY: '0x81C3669B139D92909AA67DbF74a241b10540d919',
|
|
39
|
+
V2_ROUTER: '0xDB6c703c80BFaE5F9a56482d3c8535f27E1136EB',
|
|
40
|
+
// AMM V3
|
|
41
|
+
V3_FACTORY: '0x80bBc7C4C7a59C899D1B37BC14539A22D5830a84',
|
|
42
|
+
V3_SWAP_ROUTER: '0xE8fb25086C8652c92f5AF90D730Bac7C63Fc9A58',
|
|
43
|
+
V3_SWAP_ROUTER_02: '0x939bC0Bca6F9B9c52E6e3AD8A3C590b5d9B9D10E',
|
|
44
|
+
V3_QUOTER: '0x12e2B76FaF4dDA5a173a4532916bb6Bfa3645275',
|
|
45
|
+
V3_QUOTER_V2: '0x15C729fdd833Ba675edd466Dfc63E1B737925A4c',
|
|
46
|
+
V3_TICK_LENS: '0x57A22965AdA0e52D785A9Aa155beF423D573b879',
|
|
47
|
+
V3_NFT_POSITION_MANAGER: '0x7a4C48B9dae0b7c396569b34042fcA604150Ee28',
|
|
48
|
+
V3_NFT_DESCRIPTOR: '0x53B1aAA5b6DDFD4eD00D0A7b5Ef333dc74B605b5',
|
|
40
49
|
};
|
|
41
50
|
/**
|
|
42
|
-
* DEX Precompile addresses (native AMM -
|
|
51
|
+
* DEX Precompile addresses (native AMM - Uniswap v4 style singleton PoolManager)
|
|
43
52
|
* These provide sub-microsecond execution via native Go implementation
|
|
44
53
|
*
|
|
45
54
|
* Address format: 0x0000...00LPNUMBER (addresses end with LP number)
|
|
@@ -50,7 +59,7 @@ export const LUX_TESTNET_CONTRACTS = {
|
|
|
50
59
|
* @see ~/work/lux/dex/pkg/gateway/lux/provider.go for gateway implementation
|
|
51
60
|
*/
|
|
52
61
|
export const DEX_PRECOMPILES = {
|
|
53
|
-
// Core DEX (LP-9010 series -
|
|
62
|
+
// Core DEX (LP-9010 series - Uniswap v4 style)
|
|
54
63
|
POOL_MANAGER: '0x0000000000000000000000000000000000009010', // LP-9010
|
|
55
64
|
SWAP_ROUTER: '0x0000000000000000000000000000000000009012', // LP-9012
|
|
56
65
|
HOOKS_REGISTRY: '0x0000000000000000000000000000000000009013', // LP-9013
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-pools.d.ts","sourceRoot":"","sources":["../../src/hooks/use-pools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-pools.d.ts","sourceRoot":"","sources":["../../src/hooks/use-pools.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,MAAM,WAAW,IAAI;IACnB,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,OAAO,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,OAAO,GAAG,SAAS,EAC3B,MAAM,EAAE,OAAO,GAAG,SAAS,EAC3B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,sEA4DhB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,OAAO,GAAG,SAAS,EAC3B,MAAM,EAAE,OAAO,GAAG,SAAS,EAC3B,OAAO,EAAE,MAAM;;;;EAqBhB"}
|
package/dist/hooks/use-pools.js
CHANGED
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
import { useQuery } from '@tanstack/react-query';
|
|
3
3
|
import { usePublicClient } from 'wagmi';
|
|
4
4
|
import { getContracts } from '../contracts';
|
|
5
|
-
import {
|
|
6
|
-
import { LUX_MAINNET_CONTRACTS } from '../contracts/addresses';
|
|
5
|
+
import { UNISWAP_V3_FACTORY_ABI, UNISWAP_V3_POOL_ABI } from '../contracts/abis';
|
|
7
6
|
/**
|
|
8
7
|
* Hook to get pool information
|
|
9
8
|
*/
|
|
10
9
|
export function usePool(token0, token1, fee, chainId) {
|
|
11
10
|
const publicClient = usePublicClient({ chainId });
|
|
12
11
|
const contracts = getContracts(chainId);
|
|
13
|
-
const v3Factory = 'V3_FACTORY' in contracts ? contracts.V3_FACTORY : LUX_MAINNET_CONTRACTS.V3_FACTORY;
|
|
14
12
|
return useQuery({
|
|
15
13
|
queryKey: ['pool', token0, token1, fee, chainId],
|
|
16
14
|
queryFn: async () => {
|
|
@@ -19,8 +17,8 @@ export function usePool(token0, token1, fee, chainId) {
|
|
|
19
17
|
try {
|
|
20
18
|
// Get pool address from factory
|
|
21
19
|
const poolAddress = await publicClient.readContract({
|
|
22
|
-
address:
|
|
23
|
-
abi:
|
|
20
|
+
address: contracts.V3_FACTORY,
|
|
21
|
+
abi: UNISWAP_V3_FACTORY_ABI,
|
|
24
22
|
functionName: 'getPool',
|
|
25
23
|
args: [token0, token1, fee],
|
|
26
24
|
});
|
|
@@ -31,17 +29,17 @@ export function usePool(token0, token1, fee, chainId) {
|
|
|
31
29
|
const [slot0, liquidity, tickSpacing] = await Promise.all([
|
|
32
30
|
publicClient.readContract({
|
|
33
31
|
address: poolAddress,
|
|
34
|
-
abi:
|
|
32
|
+
abi: UNISWAP_V3_POOL_ABI,
|
|
35
33
|
functionName: 'slot0',
|
|
36
34
|
}),
|
|
37
35
|
publicClient.readContract({
|
|
38
36
|
address: poolAddress,
|
|
39
|
-
abi:
|
|
37
|
+
abi: UNISWAP_V3_POOL_ABI,
|
|
40
38
|
functionName: 'liquidity',
|
|
41
39
|
}),
|
|
42
40
|
publicClient.readContract({
|
|
43
41
|
address: poolAddress,
|
|
44
|
-
abi:
|
|
42
|
+
abi: UNISWAP_V3_POOL_ABI,
|
|
45
43
|
functionName: 'tickSpacing',
|
|
46
44
|
}),
|
|
47
45
|
]);
|
package/dist/hooks/use-swap.js
CHANGED
|
@@ -15,7 +15,7 @@ export function useSwap() {
|
|
|
15
15
|
const contracts = getContracts(params.chainId);
|
|
16
16
|
const isNativeIn = isNativeToken(params.tokenIn);
|
|
17
17
|
const txHash = await writeContractAsync({
|
|
18
|
-
address: contracts.V3_SWAP_ROUTER_02
|
|
18
|
+
address: contracts.V3_SWAP_ROUTER_02,
|
|
19
19
|
abi: SWAP_ROUTER_ABI,
|
|
20
20
|
functionName: 'exactInputSingle',
|
|
21
21
|
args: [
|
|
@@ -18,7 +18,7 @@ export declare function useTokenAllowance(token: Token | null, owner: Address |
|
|
|
18
18
|
isPending: boolean;
|
|
19
19
|
isConfirming: boolean;
|
|
20
20
|
isSuccess: boolean;
|
|
21
|
-
refetch: (options?: import("@tanstack/
|
|
21
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<bigint, import("viem").ReadContractErrorType>>;
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
24
|
* Check if approval is needed for a specific amount
|
package/dist/tokens/index.d.ts
CHANGED
|
@@ -32,9 +32,6 @@ export declare const LUSD: Token;
|
|
|
32
32
|
*/
|
|
33
33
|
export declare const LETH: Token;
|
|
34
34
|
export declare const LBTC: Token;
|
|
35
|
-
export declare const LSOL: Token;
|
|
36
|
-
export declare const LTON: Token;
|
|
37
|
-
export declare const LAVAX: Token;
|
|
38
35
|
/**
|
|
39
36
|
* Testnet bridge tokens
|
|
40
37
|
*/
|
|
@@ -59,9 +56,9 @@ export declare const DAI_LUX: Token;
|
|
|
59
56
|
* Zoo chain tokens
|
|
60
57
|
*/
|
|
61
58
|
export declare const WZOO: Token;
|
|
62
|
-
export declare const
|
|
63
|
-
export declare const
|
|
64
|
-
export declare const
|
|
59
|
+
export declare const USDC_ZOO: Token;
|
|
60
|
+
export declare const USDT_ZOO: Token;
|
|
61
|
+
export declare const WETH_ZOO: Token;
|
|
65
62
|
/**
|
|
66
63
|
* Default token list for Lux Mainnet
|
|
67
64
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tokens/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,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