@luxfi/exchange 0.1.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.
- package/dist/bridge/__tests__/use-private-teleport.test.d.ts +2 -0
- package/dist/bridge/__tests__/use-private-teleport.test.d.ts.map +1 -0
- package/dist/bridge/__tests__/use-private-teleport.test.js +272 -0
- package/dist/bridge/cross-chain-store.d.ts +57 -0
- package/dist/bridge/cross-chain-store.d.ts.map +1 -0
- package/dist/bridge/cross-chain-store.js +158 -0
- package/dist/bridge/index.d.ts +78 -0
- package/dist/bridge/index.d.ts.map +1 -0
- package/dist/bridge/index.js +79 -0
- package/dist/bridge/private-teleport-types.d.ts +634 -0
- package/dist/bridge/private-teleport-types.d.ts.map +1 -0
- package/dist/bridge/private-teleport-types.js +308 -0
- package/dist/bridge/types.d.ts +84 -0
- package/dist/bridge/types.d.ts.map +1 -0
- package/dist/bridge/types.js +37 -0
- package/dist/bridge/use-cross-chain-mint.d.ts +34 -0
- package/dist/bridge/use-cross-chain-mint.d.ts.map +1 -0
- package/dist/bridge/use-cross-chain-mint.js +228 -0
- package/dist/bridge/use-private-teleport.d.ts +69 -0
- package/dist/bridge/use-private-teleport.d.ts.map +1 -0
- package/dist/bridge/use-private-teleport.js +666 -0
- package/dist/chains/index.d.ts +6 -0
- package/dist/chains/index.d.ts.map +1 -0
- package/dist/chains/index.js +6 -0
- package/dist/chains/lux.d.ts +508 -0
- package/dist/chains/lux.d.ts.map +1 -0
- package/dist/chains/lux.js +131 -0
- package/dist/contracts/abis/dex-swap-router.d.ts +137 -0
- package/dist/contracts/abis/dex-swap-router.d.ts.map +1 -0
- package/dist/contracts/abis/dex-swap-router.js +95 -0
- package/dist/contracts/abis/erc20.d.ts +136 -0
- package/dist/contracts/abis/erc20.d.ts.map +1 -0
- package/dist/contracts/abis/erc20.js +96 -0
- package/dist/contracts/abis/index.d.ts +15 -0
- package/dist/contracts/abis/index.d.ts.map +1 -0
- package/dist/contracts/abis/index.js +15 -0
- package/dist/contracts/abis/nft-position-manager.d.ts +235 -0
- package/dist/contracts/abis/nft-position-manager.d.ts.map +1 -0
- package/dist/contracts/abis/nft-position-manager.js +146 -0
- package/dist/contracts/abis/pool-manager.d.ts +315 -0
- package/dist/contracts/abis/pool-manager.d.ts.map +1 -0
- package/dist/contracts/abis/pool-manager.js +191 -0
- package/dist/contracts/abis/quoter-v2.d.ts +103 -0
- package/dist/contracts/abis/quoter-v2.d.ts.map +1 -0
- package/dist/contracts/abis/quoter-v2.js +68 -0
- package/dist/contracts/abis/swap-router.d.ts +119 -0
- package/dist/contracts/abis/swap-router.d.ts.map +1 -0
- package/dist/contracts/abis/swap-router.js +75 -0
- 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 +141 -0
- package/dist/contracts/addresses.d.ts.map +1 -0
- package/dist/contracts/addresses.js +108 -0
- package/dist/contracts/index.d.ts +6 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +5 -0
- package/dist/dex/balance-delta.d.ts +27 -0
- package/dist/dex/balance-delta.d.ts.map +1 -0
- package/dist/dex/balance-delta.js +45 -0
- package/dist/dex/index.d.ts +7 -0
- package/dist/dex/index.d.ts.map +1 -0
- package/dist/dex/index.js +6 -0
- package/dist/dex/pool-key.d.ts +19 -0
- package/dist/dex/pool-key.d.ts.map +1 -0
- package/dist/dex/pool-key.js +44 -0
- package/dist/dex/types.d.ts +71 -0
- package/dist/dex/types.d.ts.map +1 -0
- package/dist/dex/types.js +28 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +9 -0
- package/dist/hooks/use-pools.d.ts +24 -0
- package/dist/hooks/use-pools.d.ts.map +1 -0
- package/dist/hooks/use-pools.js +85 -0
- package/dist/hooks/use-positions.d.ts +17 -0
- package/dist/hooks/use-positions.d.ts.map +1 -0
- package/dist/hooks/use-positions.js +65 -0
- package/dist/hooks/use-swap-quote.d.ts +19 -0
- package/dist/hooks/use-swap-quote.d.ts.map +1 -0
- package/dist/hooks/use-swap-quote.js +54 -0
- package/dist/hooks/use-swap.d.ts +22 -0
- package/dist/hooks/use-swap.d.ts.map +1 -0
- package/dist/hooks/use-swap.js +46 -0
- package/dist/hooks/use-token-allowance.d.ts +27 -0
- package/dist/hooks/use-token-allowance.d.ts.map +1 -0
- package/dist/hooks/use-token-allowance.js +59 -0
- package/dist/hooks/use-token-balance.d.ts +17 -0
- package/dist/hooks/use-token-balance.d.ts.map +1 -0
- package/dist/hooks/use-token-balance.js +58 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/stores/index.d.ts +7 -0
- package/dist/stores/index.d.ts.map +1 -0
- package/dist/stores/index.js +6 -0
- package/dist/stores/settings-store.d.ts +25 -0
- package/dist/stores/settings-store.d.ts.map +1 -0
- package/dist/stores/settings-store.js +16 -0
- package/dist/stores/swap-store.d.ts +38 -0
- package/dist/stores/swap-store.d.ts.map +1 -0
- package/dist/stores/swap-store.js +58 -0
- package/dist/stores/token-store.d.ts +21 -0
- package/dist/stores/token-store.d.ts.map +1 -0
- package/dist/stores/token-store.js +32 -0
- package/dist/tokens/index.d.ts +65 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/index.js +185 -0
- package/package.json +78 -0
- package/src/chains/index.ts +21 -0
- package/src/chains/lux.ts +141 -0
- package/src/contracts/abis/dex-swap-router.ts +98 -0
- package/src/contracts/abis/erc20.ts +96 -0
- package/src/contracts/abis/index.ts +17 -0
- package/src/contracts/abis/nft-position-manager.ts +146 -0
- package/src/contracts/abis/pool-manager.ts +198 -0
- package/src/contracts/abis/quoter-v2.ts +68 -0
- package/src/contracts/abis/swap-router.ts +75 -0
- package/src/contracts/abis/uniswap-v2-factory.ts +49 -0
- package/src/contracts/abis/uniswap-v2-pair.ts +85 -0
- package/src/contracts/abis/uniswap-v2-router.ts +146 -0
- package/src/contracts/abis/uniswap-v3-factory.ts +45 -0
- package/src/contracts/abis/uniswap-v3-pool.ts +81 -0
- package/src/contracts/addresses.ts +128 -0
- package/src/contracts/index.ts +14 -0
- package/src/dex/balance-delta.ts +52 -0
- package/src/dex/index.ts +7 -0
- package/src/dex/pool-key.ts +62 -0
- package/src/dex/types.ts +87 -0
- package/src/hooks/index.ts +10 -0
- package/src/hooks/use-pools.ts +116 -0
- package/src/hooks/use-positions.ts +90 -0
- package/src/hooks/use-swap-quote.ts +81 -0
- package/src/hooks/use-swap.ts +64 -0
- package/src/hooks/use-token-allowance.ts +74 -0
- package/src/hooks/use-token-balance.ts +71 -0
- package/src/index.ts +31 -0
- package/src/stores/index.ts +7 -0
- package/src/stores/settings-store.ts +54 -0
- package/src/stores/swap-store.ts +112 -0
- package/src/stores/token-store.ts +62 -0
- package/src/tokens/index.ts +220 -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
|
+
];
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract Addresses for Lux Exchange
|
|
3
|
+
*/
|
|
4
|
+
import type { Address } from 'viem';
|
|
5
|
+
/**
|
|
6
|
+
* Contract addresses for Lux Mainnet (96369)
|
|
7
|
+
*/
|
|
8
|
+
export declare const LUX_MAINNET_CONTRACTS: {
|
|
9
|
+
readonly WLUX: Address;
|
|
10
|
+
readonly MULTICALL: Address;
|
|
11
|
+
readonly LETH: Address;
|
|
12
|
+
readonly LBTC: Address;
|
|
13
|
+
readonly LUSD: Address;
|
|
14
|
+
readonly V2_FACTORY: Address;
|
|
15
|
+
readonly V2_ROUTER: Address;
|
|
16
|
+
readonly V3_FACTORY: Address;
|
|
17
|
+
readonly V3_SWAP_ROUTER: Address;
|
|
18
|
+
readonly V3_SWAP_ROUTER_02: Address;
|
|
19
|
+
readonly V3_QUOTER: Address;
|
|
20
|
+
readonly V3_QUOTER_V2: Address;
|
|
21
|
+
readonly V3_TICK_LENS: Address;
|
|
22
|
+
readonly V3_NFT_POSITION_MANAGER: Address;
|
|
23
|
+
readonly V3_NFT_DESCRIPTOR: Address;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Contract addresses for Lux Testnet (96368)
|
|
27
|
+
*/
|
|
28
|
+
export declare const LUX_TESTNET_CONTRACTS: {
|
|
29
|
+
readonly WLUX: Address;
|
|
30
|
+
readonly WETH: Address;
|
|
31
|
+
readonly MULTICALL: Address;
|
|
32
|
+
readonly V2_FACTORY: Address;
|
|
33
|
+
readonly V2_ROUTER: Address;
|
|
34
|
+
readonly V3_FACTORY: Address;
|
|
35
|
+
readonly V3_SWAP_ROUTER: Address;
|
|
36
|
+
readonly V3_SWAP_ROUTER_02: Address;
|
|
37
|
+
readonly V3_QUOTER: Address;
|
|
38
|
+
readonly V3_QUOTER_V2: Address;
|
|
39
|
+
readonly V3_TICK_LENS: Address;
|
|
40
|
+
readonly V3_NFT_POSITION_MANAGER: Address;
|
|
41
|
+
readonly V3_NFT_DESCRIPTOR: Address;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* DEX Precompile addresses (native AMM)
|
|
45
|
+
* These provide sub-microsecond execution
|
|
46
|
+
*
|
|
47
|
+
* Lux Precompile Address Standard:
|
|
48
|
+
* - Prefix format: 0xNNNN000000000000000000000000000000000000
|
|
49
|
+
* - Range 0x0400-0x04FF is reserved for DEX precompiles
|
|
50
|
+
*
|
|
51
|
+
* @see ~/work/lux/precompile/dex/module.go for implementation
|
|
52
|
+
*/
|
|
53
|
+
export declare const DEX_PRECOMPILES: {
|
|
54
|
+
readonly POOL_MANAGER: Address;
|
|
55
|
+
readonly SWAP_ROUTER: Address;
|
|
56
|
+
readonly HOOKS_REGISTRY: Address;
|
|
57
|
+
readonly FLASH_LOAN: Address;
|
|
58
|
+
readonly LENDING: Address;
|
|
59
|
+
readonly LIQUID: Address;
|
|
60
|
+
readonly TELEPORT: Address;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Contract addresses for Lux Dev (1337)
|
|
64
|
+
*/
|
|
65
|
+
export declare const LUX_DEV_CONTRACTS: {
|
|
66
|
+
readonly WLUX: Address;
|
|
67
|
+
readonly MULTICALL: Address;
|
|
68
|
+
readonly ETH: Address;
|
|
69
|
+
readonly BTC: Address;
|
|
70
|
+
readonly USDC: Address;
|
|
71
|
+
readonly USDT: Address;
|
|
72
|
+
readonly DAI: Address;
|
|
73
|
+
readonly AI: Address;
|
|
74
|
+
readonly V2_FACTORY: Address;
|
|
75
|
+
readonly V2_ROUTER: Address;
|
|
76
|
+
readonly V3_FACTORY: Address;
|
|
77
|
+
readonly V3_SWAP_ROUTER: Address;
|
|
78
|
+
readonly V3_SWAP_ROUTER_02: Address;
|
|
79
|
+
readonly V3_QUOTER: Address;
|
|
80
|
+
readonly V3_QUOTER_V2: Address;
|
|
81
|
+
readonly V3_TICK_LENS: Address;
|
|
82
|
+
readonly V3_NFT_POSITION_MANAGER: Address;
|
|
83
|
+
readonly V3_NFT_DESCRIPTOR: Address;
|
|
84
|
+
readonly STAKED_LUX: Address;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Get contracts for a specific chain
|
|
88
|
+
*/
|
|
89
|
+
export declare function getContracts(chainId: number): {
|
|
90
|
+
readonly WLUX: Address;
|
|
91
|
+
readonly MULTICALL: Address;
|
|
92
|
+
readonly LETH: Address;
|
|
93
|
+
readonly LBTC: Address;
|
|
94
|
+
readonly LUSD: Address;
|
|
95
|
+
readonly V2_FACTORY: Address;
|
|
96
|
+
readonly V2_ROUTER: Address;
|
|
97
|
+
readonly V3_FACTORY: Address;
|
|
98
|
+
readonly V3_SWAP_ROUTER: Address;
|
|
99
|
+
readonly V3_SWAP_ROUTER_02: Address;
|
|
100
|
+
readonly V3_QUOTER: Address;
|
|
101
|
+
readonly V3_QUOTER_V2: Address;
|
|
102
|
+
readonly V3_TICK_LENS: Address;
|
|
103
|
+
readonly V3_NFT_POSITION_MANAGER: Address;
|
|
104
|
+
readonly V3_NFT_DESCRIPTOR: Address;
|
|
105
|
+
} | {
|
|
106
|
+
readonly WLUX: Address;
|
|
107
|
+
readonly WETH: Address;
|
|
108
|
+
readonly MULTICALL: Address;
|
|
109
|
+
readonly V2_FACTORY: Address;
|
|
110
|
+
readonly V2_ROUTER: Address;
|
|
111
|
+
readonly V3_FACTORY: Address;
|
|
112
|
+
readonly V3_SWAP_ROUTER: Address;
|
|
113
|
+
readonly V3_SWAP_ROUTER_02: Address;
|
|
114
|
+
readonly V3_QUOTER: Address;
|
|
115
|
+
readonly V3_QUOTER_V2: Address;
|
|
116
|
+
readonly V3_TICK_LENS: Address;
|
|
117
|
+
readonly V3_NFT_POSITION_MANAGER: Address;
|
|
118
|
+
readonly V3_NFT_DESCRIPTOR: Address;
|
|
119
|
+
} | {
|
|
120
|
+
readonly WLUX: Address;
|
|
121
|
+
readonly MULTICALL: Address;
|
|
122
|
+
readonly ETH: Address;
|
|
123
|
+
readonly BTC: Address;
|
|
124
|
+
readonly USDC: Address;
|
|
125
|
+
readonly USDT: Address;
|
|
126
|
+
readonly DAI: Address;
|
|
127
|
+
readonly AI: Address;
|
|
128
|
+
readonly V2_FACTORY: Address;
|
|
129
|
+
readonly V2_ROUTER: Address;
|
|
130
|
+
readonly V3_FACTORY: Address;
|
|
131
|
+
readonly V3_SWAP_ROUTER: Address;
|
|
132
|
+
readonly V3_SWAP_ROUTER_02: Address;
|
|
133
|
+
readonly V3_QUOTER: Address;
|
|
134
|
+
readonly V3_QUOTER_V2: Address;
|
|
135
|
+
readonly V3_TICK_LENS: Address;
|
|
136
|
+
readonly V3_NFT_POSITION_MANAGER: Address;
|
|
137
|
+
readonly V3_NFT_DESCRIPTOR: Address;
|
|
138
|
+
readonly STAKED_LUX: Address;
|
|
139
|
+
};
|
|
140
|
+
export type ContractAddresses = typeof LUX_MAINNET_CONTRACTS;
|
|
141
|
+
//# sourceMappingURL=addresses.d.ts.map
|
|
@@ -0,0 +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;yBAGD,OAAO;wBACR,OAAO;yBAGN,OAAO;6BACH,OAAO;gCACJ,OAAO;wBACf,OAAO;2BACJ,OAAO;2BACP,OAAO;sCACI,OAAO;gCACb,OAAO;CAClE,CAAA;AAEV;;GAEG;AACH,eAAO,MAAM,qBAAqB;mBAEsB,OAAO;mBACP,OAAO;wBACF,OAAO;yBAGN,OAAO;wBACR,OAAO;yBAGN,OAAO;6BACH,OAAO;gCACJ,OAAO;wBACf,OAAO;2BACJ,OAAO;2BACP,OAAO;sCACI,OAAO;gCACb,OAAO;CAClE,CAAA;AAEV;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe;2BACoC,OAAO;0BACR,OAAO;6BACJ,OAAO;yBACX,OAAO;sBACV,OAAO;qBACR,OAAO;uBACL,OAAO;CACzD,CAAA;AAEV;;GAEG;AACH,eAAO,MAAM,iBAAiB;mBAE0B,OAAO;wBACF,OAAO;kBAGb,OAAO;kBACP,OAAO;mBACN,OAAO;mBACP,OAAO;kBACR,OAAO;iBACR,OAAO;yBAGC,OAAO;wBACR,OAAO;yBAGN,OAAO;6BACH,OAAO;gCACJ,OAAO;wBACf,OAAO;2BACJ,OAAO;2BACP,OAAO;sCACI,OAAO;gCACb,OAAO;yBAGd,OAAO;CAC3D,CAAA;AAEV;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM;mBAxGY,OAAO;wBACF,OAAO;mBAGZ,OAAO;mBACP,OAAO;mBACP,OAAO;yBAGD,OAAO;wBACR,OAAO;yBAGN,OAAO;6BACH,OAAO;gCACJ,OAAO;wBACf,OAAO;2BACJ,OAAO;2BACP,OAAO;sCACI,OAAO;gCACb,OAAO;;mBAQpB,OAAO;mBACP,OAAO;wBACF,OAAO;yBAGN,OAAO;wBACR,OAAO;yBAGN,OAAO;6BACH,OAAO;gCACJ,OAAO;wBACf,OAAO;2BACJ,OAAO;2BACP,OAAO;sCACI,OAAO;gCACb,OAAO;;mBA4BpB,OAAO;wBACF,OAAO;kBAGb,OAAO;kBACP,OAAO;mBACN,OAAO;mBACP,OAAO;kBACR,OAAO;iBACR,OAAO;yBAGC,OAAO;wBACR,OAAO;yBAGN,OAAO;6BACH,OAAO;gCACJ,OAAO;wBACf,OAAO;2BACJ,OAAO;2BACP,OAAO;sCACI,OAAO;gCACb,OAAO;yBAGd,OAAO;EAiBpE;AAED,MAAM,MAAM,iBAAiB,GAAG,OAAO,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract addresses for Lux Mainnet (96369)
|
|
3
|
+
*/
|
|
4
|
+
export const LUX_MAINNET_CONTRACTS = {
|
|
5
|
+
// Core
|
|
6
|
+
WLUX: '0x55750d6CA62a041c06a8E28626b10Be6c688f471',
|
|
7
|
+
MULTICALL: '0xd25F88CBdAe3c2CCA3Bb75FC4E723b44C0Ea362F',
|
|
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',
|
|
17
|
+
V3_SWAP_ROUTER: '0xE8fb25086C8652c92f5AF90D730Bac7C63Fc9A58',
|
|
18
|
+
V3_SWAP_ROUTER_02: '0x939bC0Bca6F9B9c52E6e3AD8A3C590b5d9B9D10E',
|
|
19
|
+
V3_QUOTER: '0x12e2B76FaF4dDA5a173a4532916bb6Bfa3645275',
|
|
20
|
+
V3_QUOTER_V2: '0x15C729fdd833Ba675edd466Dfc63E1B737925A4c',
|
|
21
|
+
V3_TICK_LENS: '0x57A22965AdA0e52D785A9Aa155beF423D573b879',
|
|
22
|
+
V3_NFT_POSITION_MANAGER: '0x7a4C48B9dae0b7c396569b34042fcA604150Ee28',
|
|
23
|
+
V3_NFT_DESCRIPTOR: '0x53B1aAA5b6DDFD4eD00D0A7b5Ef333dc74B605b5',
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Contract addresses for Lux Testnet (96368)
|
|
27
|
+
*/
|
|
28
|
+
export const LUX_TESTNET_CONTRACTS = {
|
|
29
|
+
// Core
|
|
30
|
+
WLUX: '0x732740c5c895C9FCF619930ed4293fc858eb44c7',
|
|
31
|
+
WETH: '0xd9956542B51032d940ef076d70B69410667277A3',
|
|
32
|
+
MULTICALL: '0xd25F88CBdAe3c2CCA3Bb75FC4E723b44C0Ea362F',
|
|
33
|
+
// AMM V2
|
|
34
|
+
V2_FACTORY: '0x81C3669B139D92909AA67DbF74a241b10540d919',
|
|
35
|
+
V2_ROUTER: '0xDB6c703c80BFaE5F9a56482d3c8535f27E1136EB',
|
|
36
|
+
// AMM V3
|
|
37
|
+
V3_FACTORY: '0x80bBc7C4C7a59C899D1B37BC14539A22D5830a84',
|
|
38
|
+
V3_SWAP_ROUTER: '0xE8fb25086C8652c92f5AF90D730Bac7C63Fc9A58',
|
|
39
|
+
V3_SWAP_ROUTER_02: '0x939bC0Bca6F9B9c52E6e3AD8A3C590b5d9B9D10E',
|
|
40
|
+
V3_QUOTER: '0x12e2B76FaF4dDA5a173a4532916bb6Bfa3645275',
|
|
41
|
+
V3_QUOTER_V2: '0x15C729fdd833Ba675edd466Dfc63E1B737925A4c',
|
|
42
|
+
V3_TICK_LENS: '0x57A22965AdA0e52D785A9Aa155beF423D573b879',
|
|
43
|
+
V3_NFT_POSITION_MANAGER: '0x7a4C48B9dae0b7c396569b34042fcA604150Ee28',
|
|
44
|
+
V3_NFT_DESCRIPTOR: '0x53B1aAA5b6DDFD4eD00D0A7b5Ef333dc74B605b5',
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* DEX Precompile addresses (native AMM)
|
|
48
|
+
* These provide sub-microsecond execution
|
|
49
|
+
*
|
|
50
|
+
* Lux Precompile Address Standard:
|
|
51
|
+
* - Prefix format: 0xNNNN000000000000000000000000000000000000
|
|
52
|
+
* - Range 0x0400-0x04FF is reserved for DEX precompiles
|
|
53
|
+
*
|
|
54
|
+
* @see ~/work/lux/precompile/dex/module.go for implementation
|
|
55
|
+
*/
|
|
56
|
+
export const DEX_PRECOMPILES = {
|
|
57
|
+
POOL_MANAGER: '0x0400000000000000000000000000000000000000',
|
|
58
|
+
SWAP_ROUTER: '0x0401000000000000000000000000000000000000',
|
|
59
|
+
HOOKS_REGISTRY: '0x0402000000000000000000000000000000000000',
|
|
60
|
+
FLASH_LOAN: '0x0403000000000000000000000000000000000000',
|
|
61
|
+
LENDING: '0x0410000000000000000000000000000000000000',
|
|
62
|
+
LIQUID: '0x0430000000000000000000000000000000000000',
|
|
63
|
+
TELEPORT: '0x0440000000000000000000000000000000000000',
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Contract addresses for Lux Dev (1337)
|
|
67
|
+
*/
|
|
68
|
+
export const LUX_DEV_CONTRACTS = {
|
|
69
|
+
// Core
|
|
70
|
+
WLUX: '0x610178dA211FEF7D417bC0e6FeD39F05609AD788',
|
|
71
|
+
MULTICALL: '0xd25F88CBdAe3c2CCA3Bb75FC4E723b44C0Ea362F',
|
|
72
|
+
// Bridged tokens (local dev)
|
|
73
|
+
ETH: '0x5FbDB2315678afecb367f032d93F642f64180aa3',
|
|
74
|
+
BTC: '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512',
|
|
75
|
+
USDC: '0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0',
|
|
76
|
+
USDT: '0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9',
|
|
77
|
+
DAI: '0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9',
|
|
78
|
+
AI: '0x0B306BF915C4d645ff596e518fAf3F9669b97016',
|
|
79
|
+
// AMM V2
|
|
80
|
+
V2_FACTORY: '0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1',
|
|
81
|
+
V2_ROUTER: '0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE',
|
|
82
|
+
// AMM V3 (uses testnet addresses for dev)
|
|
83
|
+
V3_FACTORY: '0x80bBc7C4C7a59C899D1B37BC14539A22D5830a84',
|
|
84
|
+
V3_SWAP_ROUTER: '0xE8fb25086C8652c92f5AF90D730Bac7C63Fc9A58',
|
|
85
|
+
V3_SWAP_ROUTER_02: '0x939bC0Bca6F9B9c52E6e3AD8A3C590b5d9B9D10E',
|
|
86
|
+
V3_QUOTER: '0x12e2B76FaF4dDA5a173a4532916bb6Bfa3645275',
|
|
87
|
+
V3_QUOTER_V2: '0x15C729fdd833Ba675edd466Dfc63E1B737925A4c',
|
|
88
|
+
V3_TICK_LENS: '0x57A22965AdA0e52D785A9Aa155beF423D573b879',
|
|
89
|
+
V3_NFT_POSITION_MANAGER: '0x7a4C48B9dae0b7c396569b34042fcA604150Ee28',
|
|
90
|
+
V3_NFT_DESCRIPTOR: '0x53B1aAA5b6DDFD4eD00D0A7b5Ef333dc74B605b5',
|
|
91
|
+
// Staking
|
|
92
|
+
STAKED_LUX: '0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0',
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Get contracts for a specific chain
|
|
96
|
+
*/
|
|
97
|
+
export function getContracts(chainId) {
|
|
98
|
+
switch (chainId) {
|
|
99
|
+
case 96369:
|
|
100
|
+
return LUX_MAINNET_CONTRACTS;
|
|
101
|
+
case 96368:
|
|
102
|
+
return LUX_TESTNET_CONTRACTS;
|
|
103
|
+
case 1337:
|
|
104
|
+
return LUX_DEV_CONTRACTS;
|
|
105
|
+
default:
|
|
106
|
+
return LUX_TESTNET_CONTRACTS;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAA;AAEpB,cAAc,QAAQ,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { BalanceDelta } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Create balance delta from packed int256 (Solidity representation)
|
|
4
|
+
* Upper 128 bits = amount0, Lower 128 bits = amount1
|
|
5
|
+
*/
|
|
6
|
+
export declare function unpackBalanceDelta(packed: bigint): BalanceDelta;
|
|
7
|
+
/**
|
|
8
|
+
* Pack balance delta into int256
|
|
9
|
+
*/
|
|
10
|
+
export declare function packBalanceDelta(delta: BalanceDelta): bigint;
|
|
11
|
+
/**
|
|
12
|
+
* Add two balance deltas
|
|
13
|
+
*/
|
|
14
|
+
export declare function addBalanceDeltas(a: BalanceDelta, b: BalanceDelta): BalanceDelta;
|
|
15
|
+
/**
|
|
16
|
+
* Negate balance delta
|
|
17
|
+
*/
|
|
18
|
+
export declare function negateBalanceDelta(delta: BalanceDelta): BalanceDelta;
|
|
19
|
+
/**
|
|
20
|
+
* Check if balance delta is zero
|
|
21
|
+
*/
|
|
22
|
+
export declare function isZeroDelta(delta: BalanceDelta): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Get the amount for a specific currency (0 or 1)
|
|
25
|
+
*/
|
|
26
|
+
export declare function getDeltaAmount(delta: BalanceDelta, currency: 0 | 1): bigint;
|
|
27
|
+
//# sourceMappingURL=balance-delta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balance-delta.d.ts","sourceRoot":"","sources":["../../src/dex/balance-delta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAI/D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAE5D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,YAAY,CAK/E;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CAKpE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAExD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,MAAM,CAE3E"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create balance delta from packed int256 (Solidity representation)
|
|
3
|
+
* Upper 128 bits = amount0, Lower 128 bits = amount1
|
|
4
|
+
*/
|
|
5
|
+
export function unpackBalanceDelta(packed) {
|
|
6
|
+
const amount0 = packed >> 128n;
|
|
7
|
+
const amount1 = BigInt.asIntN(128, packed);
|
|
8
|
+
return { amount0, amount1 };
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Pack balance delta into int256
|
|
12
|
+
*/
|
|
13
|
+
export function packBalanceDelta(delta) {
|
|
14
|
+
return (delta.amount0 << 128n) | (delta.amount1 & ((1n << 128n) - 1n));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Add two balance deltas
|
|
18
|
+
*/
|
|
19
|
+
export function addBalanceDeltas(a, b) {
|
|
20
|
+
return {
|
|
21
|
+
amount0: a.amount0 + b.amount0,
|
|
22
|
+
amount1: a.amount1 + b.amount1,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Negate balance delta
|
|
27
|
+
*/
|
|
28
|
+
export function negateBalanceDelta(delta) {
|
|
29
|
+
return {
|
|
30
|
+
amount0: -delta.amount0,
|
|
31
|
+
amount1: -delta.amount1,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Check if balance delta is zero
|
|
36
|
+
*/
|
|
37
|
+
export function isZeroDelta(delta) {
|
|
38
|
+
return delta.amount0 === 0n && delta.amount1 === 0n;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get the amount for a specific currency (0 or 1)
|
|
42
|
+
*/
|
|
43
|
+
export function getDeltaAmount(delta, currency) {
|
|
44
|
+
return currency === 0 ? delta.amount0 : delta.amount1;
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dex/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type Address } from 'viem';
|
|
2
|
+
import type { PoolKey, Currency } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Sort currencies to ensure currency0 < currency1
|
|
5
|
+
*/
|
|
6
|
+
export declare function sortCurrencies(currencyA: Currency, currencyB: Currency): [Currency, Currency];
|
|
7
|
+
/**
|
|
8
|
+
* Create a pool key from parameters
|
|
9
|
+
*/
|
|
10
|
+
export declare function createPoolKey(currencyA: Currency, currencyB: Currency, fee: number, tickSpacing: number, hooks?: Address): PoolKey;
|
|
11
|
+
/**
|
|
12
|
+
* Compute pool ID from pool key
|
|
13
|
+
*/
|
|
14
|
+
export declare function computePoolId(key: PoolKey): `0x${string}`;
|
|
15
|
+
/**
|
|
16
|
+
* Check if two pool keys are equal
|
|
17
|
+
*/
|
|
18
|
+
export declare function poolKeysEqual(a: PoolKey, b: PoolKey): boolean;
|
|
19
|
+
//# sourceMappingURL=pool-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pool-key.d.ts","sourceRoot":"","sources":["../../src/dex/pool-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,OAAO,EAAE,MAAM,MAAM,CAAA;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEhD;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAI7F;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,QAAQ,EACnB,SAAS,EAAE,QAAQ,EACnB,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,EACnB,KAAK,GAAE,OAAsD,GAC5D,OAAO,CAST;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,MAAM,EAAE,CAazD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAQ7D"}
|