@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,58 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useBalance, useReadContract } from 'wagmi';
|
|
3
|
+
import { ERC20_ABI } from '../contracts/abis';
|
|
4
|
+
import { isNativeToken } from '../tokens';
|
|
5
|
+
/**
|
|
6
|
+
* Hook to get token balance for an address
|
|
7
|
+
*/
|
|
8
|
+
export function useTokenBalance(token, address, chainId) {
|
|
9
|
+
// For native token
|
|
10
|
+
const nativeBalance = useBalance({
|
|
11
|
+
address,
|
|
12
|
+
chainId,
|
|
13
|
+
query: {
|
|
14
|
+
enabled: !!token && isNativeToken(token) && !!address,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
// For ERC20 token
|
|
18
|
+
const erc20Balance = useReadContract({
|
|
19
|
+
address: token?.address,
|
|
20
|
+
abi: ERC20_ABI,
|
|
21
|
+
functionName: 'balanceOf',
|
|
22
|
+
args: address ? [address] : undefined,
|
|
23
|
+
chainId,
|
|
24
|
+
query: {
|
|
25
|
+
enabled: !!token && !isNativeToken(token) && !!address,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
if (!token || !address) {
|
|
29
|
+
return {
|
|
30
|
+
balance: 0n,
|
|
31
|
+
formatted: '0',
|
|
32
|
+
isLoading: false,
|
|
33
|
+
error: null,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (isNativeToken(token)) {
|
|
37
|
+
const value = nativeBalance.data?.value ?? 0n;
|
|
38
|
+
return {
|
|
39
|
+
balance: value,
|
|
40
|
+
formatted: formatBalance(value, token.decimals),
|
|
41
|
+
isLoading: nativeBalance.isLoading,
|
|
42
|
+
error: nativeBalance.error,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
balance: erc20Balance.data ?? 0n,
|
|
47
|
+
formatted: formatBalance(erc20Balance.data ?? 0n, token.decimals),
|
|
48
|
+
isLoading: erc20Balance.isLoading,
|
|
49
|
+
error: erc20Balance.error,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function formatBalance(value, decimals) {
|
|
53
|
+
const divisor = 10n ** BigInt(decimals);
|
|
54
|
+
const whole = value / divisor;
|
|
55
|
+
const fraction = value % divisor;
|
|
56
|
+
const fractionStr = fraction.toString().padStart(decimals, '0').slice(0, 6);
|
|
57
|
+
return `${whole}.${fractionStr}`.replace(/\.?0+$/, '');
|
|
58
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @luxfi/exchange - Core DEX logic for Lux Exchange
|
|
3
|
+
*
|
|
4
|
+
* Provides:
|
|
5
|
+
* - Chain and token definitions
|
|
6
|
+
* - AMM V2/V3 contract interfaces
|
|
7
|
+
* - DEX precompile integration
|
|
8
|
+
* - Swap/liquidity hooks
|
|
9
|
+
* - Zustand stores for state management
|
|
10
|
+
*/
|
|
11
|
+
export * from './chains';
|
|
12
|
+
export * from './tokens';
|
|
13
|
+
export * from './contracts';
|
|
14
|
+
export * from './dex';
|
|
15
|
+
export * from './hooks';
|
|
16
|
+
export * from './stores';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,cAAc,UAAU,CAAA;AAGxB,cAAc,UAAU,CAAA;AAGxB,cAAc,aAAa,CAAA;AAG3B,cAAc,OAAO,CAAA;AAGrB,cAAc,SAAS,CAAA;AAGvB,cAAc,UAAU,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @luxfi/exchange - Core DEX logic for Lux Exchange
|
|
3
|
+
*
|
|
4
|
+
* Provides:
|
|
5
|
+
* - Chain and token definitions
|
|
6
|
+
* - AMM V2/V3 contract interfaces
|
|
7
|
+
* - DEX precompile integration
|
|
8
|
+
* - Swap/liquidity hooks
|
|
9
|
+
* - Zustand stores for state management
|
|
10
|
+
*/
|
|
11
|
+
// Chains
|
|
12
|
+
export * from './chains';
|
|
13
|
+
// Tokens
|
|
14
|
+
export * from './tokens';
|
|
15
|
+
// Contracts & ABIs
|
|
16
|
+
export * from './contracts';
|
|
17
|
+
// DEX types
|
|
18
|
+
export * from './dex';
|
|
19
|
+
// Hooks
|
|
20
|
+
export * from './hooks';
|
|
21
|
+
// Stores
|
|
22
|
+
export * from './stores';
|
|
23
|
+
// Note: Bridge module is experimental and will be added in a future release
|
|
24
|
+
// See bridge-wip/ for the work-in-progress implementation
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stores/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type RouterPreference = 'auto' | 'v2' | 'v3' | 'precompile';
|
|
2
|
+
export interface SettingsStore {
|
|
3
|
+
routerPreference: RouterPreference;
|
|
4
|
+
expertMode: boolean;
|
|
5
|
+
autoSlippage: boolean;
|
|
6
|
+
hideSmallBalances: boolean;
|
|
7
|
+
smallBalanceThreshold: number;
|
|
8
|
+
setRouterPreference: (preference: RouterPreference) => void;
|
|
9
|
+
toggleExpertMode: () => void;
|
|
10
|
+
toggleAutoSlippage: () => void;
|
|
11
|
+
toggleHideSmallBalances: () => void;
|
|
12
|
+
setSmallBalanceThreshold: (threshold: number) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const useSettingsStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<SettingsStore>, "persist"> & {
|
|
15
|
+
persist: {
|
|
16
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<SettingsStore, SettingsStore>>) => void;
|
|
17
|
+
clearStorage: () => void;
|
|
18
|
+
rehydrate: () => Promise<void> | void;
|
|
19
|
+
hasHydrated: () => boolean;
|
|
20
|
+
onHydrate: (fn: (state: SettingsStore) => void) => () => void;
|
|
21
|
+
onFinishHydration: (fn: (state: SettingsStore) => void) => () => void;
|
|
22
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<SettingsStore, SettingsStore>>;
|
|
23
|
+
};
|
|
24
|
+
}>;
|
|
25
|
+
//# sourceMappingURL=settings-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-store.d.ts","sourceRoot":"","sources":["../../src/stores/settings-store.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,YAAY,CAAA;AAElE,MAAM,WAAW,aAAa;IAE5B,gBAAgB,EAAE,gBAAgB,CAAA;IAGlC,UAAU,EAAE,OAAO,CAAA;IAGnB,YAAY,EAAE,OAAO,CAAA;IAGrB,iBAAiB,EAAE,OAAO,CAAA;IAG1B,qBAAqB,EAAE,MAAM,CAAA;IAG7B,mBAAmB,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,IAAI,CAAA;IAC3D,gBAAgB,EAAE,MAAM,IAAI,CAAA;IAC5B,kBAAkB,EAAE,MAAM,IAAI,CAAA;IAC9B,uBAAuB,EAAE,MAAM,IAAI,CAAA;IACnC,wBAAwB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;CACtD;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;EAwB5B,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
import { persist } from 'zustand/middleware';
|
|
3
|
+
export const useSettingsStore = create()(persist((set) => ({
|
|
4
|
+
routerPreference: 'auto',
|
|
5
|
+
expertMode: false,
|
|
6
|
+
autoSlippage: true,
|
|
7
|
+
hideSmallBalances: false,
|
|
8
|
+
smallBalanceThreshold: 1,
|
|
9
|
+
setRouterPreference: (preference) => set({ routerPreference: preference }),
|
|
10
|
+
toggleExpertMode: () => set((state) => ({ expertMode: !state.expertMode })),
|
|
11
|
+
toggleAutoSlippage: () => set((state) => ({ autoSlippage: !state.autoSlippage })),
|
|
12
|
+
toggleHideSmallBalances: () => set((state) => ({ hideSmallBalances: !state.hideSmallBalances })),
|
|
13
|
+
setSmallBalanceThreshold: (threshold) => set({ smallBalanceThreshold: threshold }),
|
|
14
|
+
}), {
|
|
15
|
+
name: 'settings-storage',
|
|
16
|
+
}));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Token } from '../tokens';
|
|
2
|
+
export type SwapField = 'input' | 'output';
|
|
3
|
+
export interface SwapState {
|
|
4
|
+
tokenIn: Token | null;
|
|
5
|
+
tokenOut: Token | null;
|
|
6
|
+
amountIn: string;
|
|
7
|
+
amountOut: string;
|
|
8
|
+
independentField: SwapField;
|
|
9
|
+
slippageTolerance: number;
|
|
10
|
+
deadline: number;
|
|
11
|
+
setTokenIn: (token: Token | null) => void;
|
|
12
|
+
setTokenOut: (token: Token | null) => void;
|
|
13
|
+
setAmountIn: (amount: string) => void;
|
|
14
|
+
setAmountOut: (amount: string) => void;
|
|
15
|
+
setIndependentField: (field: SwapField) => void;
|
|
16
|
+
setSlippageTolerance: (tolerance: number) => void;
|
|
17
|
+
setDeadline: (deadline: number) => void;
|
|
18
|
+
switchTokens: () => void;
|
|
19
|
+
reset: () => void;
|
|
20
|
+
}
|
|
21
|
+
export declare const useSwapStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<SwapState>, "persist"> & {
|
|
22
|
+
persist: {
|
|
23
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<SwapState, {
|
|
24
|
+
slippageTolerance: number;
|
|
25
|
+
deadline: number;
|
|
26
|
+
}>>) => void;
|
|
27
|
+
clearStorage: () => void;
|
|
28
|
+
rehydrate: () => Promise<void> | void;
|
|
29
|
+
hasHydrated: () => boolean;
|
|
30
|
+
onHydrate: (fn: (state: SwapState) => void) => () => void;
|
|
31
|
+
onFinishHydration: (fn: (state: SwapState) => void) => () => void;
|
|
32
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<SwapState, {
|
|
33
|
+
slippageTolerance: number;
|
|
34
|
+
deadline: number;
|
|
35
|
+
}>>;
|
|
36
|
+
};
|
|
37
|
+
}>;
|
|
38
|
+
//# sourceMappingURL=swap-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swap-store.d.ts","sourceRoot":"","sources":["../../src/stores/swap-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAEtC,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAA;AAE1C,MAAM,WAAW,SAAS;IAExB,OAAO,EAAE,KAAK,GAAG,IAAI,CAAA;IACrB,QAAQ,EAAE,KAAK,GAAG,IAAI,CAAA;IAGtB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IAGjB,gBAAgB,EAAE,SAAS,CAAA;IAG3B,iBAAiB,EAAE,MAAM,CAAA;IAGzB,QAAQ,EAAE,MAAM,CAAA;IAGhB,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,CAAA;IACzC,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,CAAA;IAC1C,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,mBAAmB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAA;IAC/C,oBAAoB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;IACjD,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,YAAY,EAAE,MAAM,IAAI,CAAA;IACxB,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAYD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;EAiExB,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
import { persist } from 'zustand/middleware';
|
|
3
|
+
const initialState = {
|
|
4
|
+
tokenIn: null,
|
|
5
|
+
tokenOut: null,
|
|
6
|
+
amountIn: '',
|
|
7
|
+
amountOut: '',
|
|
8
|
+
independentField: 'input',
|
|
9
|
+
slippageTolerance: 50, // 0.5%
|
|
10
|
+
deadline: 30, // 30 minutes
|
|
11
|
+
};
|
|
12
|
+
export const useSwapStore = create()(persist((set) => ({
|
|
13
|
+
...initialState,
|
|
14
|
+
setTokenIn: (token) => set((state) => {
|
|
15
|
+
// If selecting same token as output, switch them
|
|
16
|
+
if (token && state.tokenOut && token.address === state.tokenOut.address) {
|
|
17
|
+
return {
|
|
18
|
+
tokenIn: token,
|
|
19
|
+
tokenOut: state.tokenIn,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return { tokenIn: token };
|
|
23
|
+
}),
|
|
24
|
+
setTokenOut: (token) => set((state) => {
|
|
25
|
+
// If selecting same token as input, switch them
|
|
26
|
+
if (token && state.tokenIn && token.address === state.tokenIn.address) {
|
|
27
|
+
return {
|
|
28
|
+
tokenOut: token,
|
|
29
|
+
tokenIn: state.tokenOut,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return { tokenOut: token };
|
|
33
|
+
}),
|
|
34
|
+
setAmountIn: (amount) => set({
|
|
35
|
+
amountIn: amount,
|
|
36
|
+
independentField: 'input',
|
|
37
|
+
}),
|
|
38
|
+
setAmountOut: (amount) => set({
|
|
39
|
+
amountOut: amount,
|
|
40
|
+
independentField: 'output',
|
|
41
|
+
}),
|
|
42
|
+
setIndependentField: (field) => set({ independentField: field }),
|
|
43
|
+
setSlippageTolerance: (tolerance) => set({ slippageTolerance: tolerance }),
|
|
44
|
+
setDeadline: (deadline) => set({ deadline: deadline }),
|
|
45
|
+
switchTokens: () => set((state) => ({
|
|
46
|
+
tokenIn: state.tokenOut,
|
|
47
|
+
tokenOut: state.tokenIn,
|
|
48
|
+
amountIn: state.amountOut,
|
|
49
|
+
amountOut: state.amountIn,
|
|
50
|
+
})),
|
|
51
|
+
reset: () => set(initialState),
|
|
52
|
+
}), {
|
|
53
|
+
name: 'swap-storage',
|
|
54
|
+
partialize: (state) => ({
|
|
55
|
+
slippageTolerance: state.slippageTolerance,
|
|
56
|
+
deadline: state.deadline,
|
|
57
|
+
}),
|
|
58
|
+
}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Token } from '../tokens';
|
|
2
|
+
export interface TokenStore {
|
|
3
|
+
customTokens: Token[];
|
|
4
|
+
favoriteTokens: string[];
|
|
5
|
+
addCustomToken: (token: Token) => void;
|
|
6
|
+
removeCustomToken: (address: string) => void;
|
|
7
|
+
toggleFavorite: (address: string) => void;
|
|
8
|
+
isFavorite: (address: string) => boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const useTokenStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<TokenStore>, "persist"> & {
|
|
11
|
+
persist: {
|
|
12
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<TokenStore, TokenStore>>) => void;
|
|
13
|
+
clearStorage: () => void;
|
|
14
|
+
rehydrate: () => Promise<void> | void;
|
|
15
|
+
hasHydrated: () => boolean;
|
|
16
|
+
onHydrate: (fn: (state: TokenStore) => void) => () => void;
|
|
17
|
+
onFinishHydration: (fn: (state: TokenStore) => void) => () => void;
|
|
18
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<TokenStore, TokenStore>>;
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
21
|
+
//# sourceMappingURL=token-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-store.d.ts","sourceRoot":"","sources":["../../src/stores/token-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAEtC,MAAM,WAAW,UAAU;IAEzB,YAAY,EAAE,KAAK,EAAE,CAAA;IAGrB,cAAc,EAAE,MAAM,EAAE,CAAA;IAGxB,cAAc,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IACtC,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAA;CACzC;AAED,eAAO,MAAM,aAAa;;;;;;;;;;EA2CzB,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
import { persist } from 'zustand/middleware';
|
|
3
|
+
export const useTokenStore = create()(persist((set, get) => ({
|
|
4
|
+
customTokens: [],
|
|
5
|
+
favoriteTokens: [],
|
|
6
|
+
addCustomToken: (token) => set((state) => {
|
|
7
|
+
// Check if token already exists
|
|
8
|
+
if (state.customTokens.some((t) => t.address.toLowerCase() === token.address.toLowerCase())) {
|
|
9
|
+
return state;
|
|
10
|
+
}
|
|
11
|
+
return { customTokens: [...state.customTokens, token] };
|
|
12
|
+
}),
|
|
13
|
+
removeCustomToken: (address) => set((state) => ({
|
|
14
|
+
customTokens: state.customTokens.filter((t) => t.address.toLowerCase() !== address.toLowerCase()),
|
|
15
|
+
})),
|
|
16
|
+
toggleFavorite: (address) => set((state) => {
|
|
17
|
+
const normalized = address.toLowerCase();
|
|
18
|
+
if (state.favoriteTokens.includes(normalized)) {
|
|
19
|
+
return {
|
|
20
|
+
favoriteTokens: state.favoriteTokens.filter((a) => a !== normalized),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
favoriteTokens: [...state.favoriteTokens, normalized],
|
|
25
|
+
};
|
|
26
|
+
}),
|
|
27
|
+
isFavorite: (address) => {
|
|
28
|
+
return get().favoriteTokens.includes(address.toLowerCase());
|
|
29
|
+
},
|
|
30
|
+
}), {
|
|
31
|
+
name: 'token-storage',
|
|
32
|
+
}));
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* Token type definition
|
|
4
|
+
*/
|
|
5
|
+
export interface Token {
|
|
6
|
+
address: Address;
|
|
7
|
+
chainId: number;
|
|
8
|
+
decimals: number;
|
|
9
|
+
symbol: string;
|
|
10
|
+
name: string;
|
|
11
|
+
logoURI?: string;
|
|
12
|
+
isNative?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Native tokens
|
|
16
|
+
*/
|
|
17
|
+
export declare const NATIVE_LUX: Token;
|
|
18
|
+
export declare const NATIVE_ZOO: Token;
|
|
19
|
+
/**
|
|
20
|
+
* Wrapped native tokens
|
|
21
|
+
*/
|
|
22
|
+
export declare const WLUX_MAINNET: Token;
|
|
23
|
+
export declare const WLUX_TESTNET: Token;
|
|
24
|
+
export declare const WLUX_DEV: Token;
|
|
25
|
+
/**
|
|
26
|
+
* Stablecoins
|
|
27
|
+
*/
|
|
28
|
+
export declare const LUSD: Token;
|
|
29
|
+
/**
|
|
30
|
+
* Bridge tokens (L-prefix for assets bridged to Lux)
|
|
31
|
+
*/
|
|
32
|
+
export declare const LETH: Token;
|
|
33
|
+
export declare const LBTC: Token;
|
|
34
|
+
/**
|
|
35
|
+
* Major tokens on Lux Mainnet
|
|
36
|
+
*/
|
|
37
|
+
export declare const USDC_LUX: Token;
|
|
38
|
+
export declare const USDT_LUX: Token;
|
|
39
|
+
export declare const WETH_LUX: Token;
|
|
40
|
+
export declare const WBTC_LUX: Token;
|
|
41
|
+
export declare const DAI_LUX: Token;
|
|
42
|
+
/**
|
|
43
|
+
* Zoo chain tokens
|
|
44
|
+
*/
|
|
45
|
+
export declare const WZOO: Token;
|
|
46
|
+
export declare const USDC_ZOO: Token;
|
|
47
|
+
export declare const USDT_ZOO: Token;
|
|
48
|
+
export declare const WETH_ZOO: Token;
|
|
49
|
+
/**
|
|
50
|
+
* Default token list for Lux Mainnet
|
|
51
|
+
*/
|
|
52
|
+
export declare const LUX_MAINNET_TOKENS: Token[];
|
|
53
|
+
/**
|
|
54
|
+
* Default token list for Zoo Mainnet
|
|
55
|
+
*/
|
|
56
|
+
export declare const ZOO_MAINNET_TOKENS: Token[];
|
|
57
|
+
/**
|
|
58
|
+
* Get wrapped native token for chain
|
|
59
|
+
*/
|
|
60
|
+
export declare function getWrappedNative(chainId: number): Token | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Check if token is native
|
|
63
|
+
*/
|
|
64
|
+
export declare function isNativeToken(token: Token): boolean;
|
|
65
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,KAOxB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAOxB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,KAM1B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAM1B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,KAMlB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,KAMlB,CAAA;AAED,eAAO,MAAM,IAAI,EAAE,KAMlB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,KAMlB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,EAWrC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,EAMrC,CAAA;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAWnE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEnD"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native tokens
|
|
3
|
+
*/
|
|
4
|
+
export const NATIVE_LUX = {
|
|
5
|
+
address: '0x0000000000000000000000000000000000000000',
|
|
6
|
+
chainId: 96369,
|
|
7
|
+
decimals: 18,
|
|
8
|
+
symbol: 'LUX',
|
|
9
|
+
name: 'LUX',
|
|
10
|
+
isNative: true,
|
|
11
|
+
};
|
|
12
|
+
export const NATIVE_ZOO = {
|
|
13
|
+
address: '0x0000000000000000000000000000000000000000',
|
|
14
|
+
chainId: 200200,
|
|
15
|
+
decimals: 18,
|
|
16
|
+
symbol: 'ZOO',
|
|
17
|
+
name: 'ZOO',
|
|
18
|
+
isNative: true,
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Wrapped native tokens
|
|
22
|
+
*/
|
|
23
|
+
export const WLUX_MAINNET = {
|
|
24
|
+
address: '0x55750d6CA62a041c06a8E28626b10Be6c688f471',
|
|
25
|
+
chainId: 96369,
|
|
26
|
+
decimals: 18,
|
|
27
|
+
symbol: 'WLUX',
|
|
28
|
+
name: 'Wrapped LUX',
|
|
29
|
+
};
|
|
30
|
+
export const WLUX_TESTNET = {
|
|
31
|
+
address: '0x732740c5c895C9FCF619930ed4293fc858eb44c7',
|
|
32
|
+
chainId: 96368,
|
|
33
|
+
decimals: 18,
|
|
34
|
+
symbol: 'WLUX',
|
|
35
|
+
name: 'Wrapped LUX',
|
|
36
|
+
};
|
|
37
|
+
export const WLUX_DEV = {
|
|
38
|
+
address: '0x610178dA211FEF7D417bC0e6FeD39F05609AD788',
|
|
39
|
+
chainId: 1337,
|
|
40
|
+
decimals: 18,
|
|
41
|
+
symbol: 'WLUX',
|
|
42
|
+
name: 'Wrapped LUX',
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Stablecoins
|
|
46
|
+
*/
|
|
47
|
+
export const LUSD = {
|
|
48
|
+
address: '0x0000000000000000000000000000000000000000', // TODO: Deploy
|
|
49
|
+
chainId: 96369,
|
|
50
|
+
decimals: 18,
|
|
51
|
+
symbol: 'LUSD',
|
|
52
|
+
name: 'Lux Dollar',
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Bridge tokens (L-prefix for assets bridged to Lux)
|
|
56
|
+
*/
|
|
57
|
+
export const LETH = {
|
|
58
|
+
address: '0xAA3AE951A7925F25aE8Ad65b052a76Bd8f052598',
|
|
59
|
+
chainId: 96369,
|
|
60
|
+
decimals: 18,
|
|
61
|
+
symbol: 'LETH',
|
|
62
|
+
name: 'Lux ETH',
|
|
63
|
+
};
|
|
64
|
+
export const LBTC = {
|
|
65
|
+
address: '0x526903Ee6118de6737D11b37f82fC7f69B13685D',
|
|
66
|
+
chainId: 96369,
|
|
67
|
+
decimals: 8,
|
|
68
|
+
symbol: 'LBTC',
|
|
69
|
+
name: 'Lux BTC',
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Major tokens on Lux Mainnet
|
|
73
|
+
*/
|
|
74
|
+
export const USDC_LUX = {
|
|
75
|
+
address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
76
|
+
chainId: 96369,
|
|
77
|
+
decimals: 6,
|
|
78
|
+
symbol: 'USDC',
|
|
79
|
+
name: 'USD Coin',
|
|
80
|
+
};
|
|
81
|
+
export const USDT_LUX = {
|
|
82
|
+
address: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
83
|
+
chainId: 96369,
|
|
84
|
+
decimals: 6,
|
|
85
|
+
symbol: 'USDT',
|
|
86
|
+
name: 'Tether USD',
|
|
87
|
+
};
|
|
88
|
+
export const WETH_LUX = {
|
|
89
|
+
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
90
|
+
chainId: 96369,
|
|
91
|
+
decimals: 18,
|
|
92
|
+
symbol: 'WETH',
|
|
93
|
+
name: 'Wrapped Ether',
|
|
94
|
+
};
|
|
95
|
+
export const WBTC_LUX = {
|
|
96
|
+
address: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
97
|
+
chainId: 96369,
|
|
98
|
+
decimals: 8,
|
|
99
|
+
symbol: 'WBTC',
|
|
100
|
+
name: 'Wrapped Bitcoin',
|
|
101
|
+
};
|
|
102
|
+
export const DAI_LUX = {
|
|
103
|
+
address: '0x6B175474E89094C44Da98b954EesdscdKD34eL55',
|
|
104
|
+
chainId: 96369,
|
|
105
|
+
decimals: 18,
|
|
106
|
+
symbol: 'DAI',
|
|
107
|
+
name: 'Dai Stablecoin',
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Zoo chain tokens
|
|
111
|
+
*/
|
|
112
|
+
export const WZOO = {
|
|
113
|
+
address: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
114
|
+
chainId: 200200,
|
|
115
|
+
decimals: 18,
|
|
116
|
+
symbol: 'WZOO',
|
|
117
|
+
name: 'Wrapped ZOO',
|
|
118
|
+
};
|
|
119
|
+
export const USDC_ZOO = {
|
|
120
|
+
address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
121
|
+
chainId: 200200,
|
|
122
|
+
decimals: 6,
|
|
123
|
+
symbol: 'USDC',
|
|
124
|
+
name: 'USD Coin',
|
|
125
|
+
};
|
|
126
|
+
export const USDT_ZOO = {
|
|
127
|
+
address: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
128
|
+
chainId: 200200,
|
|
129
|
+
decimals: 6,
|
|
130
|
+
symbol: 'USDT',
|
|
131
|
+
name: 'Tether USD',
|
|
132
|
+
};
|
|
133
|
+
export const WETH_ZOO = {
|
|
134
|
+
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
135
|
+
chainId: 200200,
|
|
136
|
+
decimals: 18,
|
|
137
|
+
symbol: 'WETH',
|
|
138
|
+
name: 'Wrapped Ether',
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Default token list for Lux Mainnet
|
|
142
|
+
*/
|
|
143
|
+
export const LUX_MAINNET_TOKENS = [
|
|
144
|
+
NATIVE_LUX,
|
|
145
|
+
WLUX_MAINNET,
|
|
146
|
+
USDC_LUX,
|
|
147
|
+
USDT_LUX,
|
|
148
|
+
WETH_LUX,
|
|
149
|
+
WBTC_LUX,
|
|
150
|
+
DAI_LUX,
|
|
151
|
+
LETH,
|
|
152
|
+
LBTC,
|
|
153
|
+
LUSD,
|
|
154
|
+
];
|
|
155
|
+
/**
|
|
156
|
+
* Default token list for Zoo Mainnet
|
|
157
|
+
*/
|
|
158
|
+
export const ZOO_MAINNET_TOKENS = [
|
|
159
|
+
NATIVE_ZOO,
|
|
160
|
+
WZOO,
|
|
161
|
+
USDC_ZOO,
|
|
162
|
+
USDT_ZOO,
|
|
163
|
+
WETH_ZOO,
|
|
164
|
+
];
|
|
165
|
+
/**
|
|
166
|
+
* Get wrapped native token for chain
|
|
167
|
+
*/
|
|
168
|
+
export function getWrappedNative(chainId) {
|
|
169
|
+
switch (chainId) {
|
|
170
|
+
case 96369:
|
|
171
|
+
return WLUX_MAINNET;
|
|
172
|
+
case 96368:
|
|
173
|
+
return WLUX_TESTNET;
|
|
174
|
+
case 1337:
|
|
175
|
+
return WLUX_DEV;
|
|
176
|
+
default:
|
|
177
|
+
return undefined;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Check if token is native
|
|
182
|
+
*/
|
|
183
|
+
export function isNativeToken(token) {
|
|
184
|
+
return token.isNative === true || token.address === '0x0000000000000000000000000000000000000000';
|
|
185
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@luxfi/exchange",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Lux Exchange SDK - React hooks and utilities for Lux DEX",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./chains": {
|
|
15
|
+
"types": "./dist/chains/index.d.ts",
|
|
16
|
+
"import": "./dist/chains/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./tokens": {
|
|
19
|
+
"types": "./dist/tokens/index.d.ts",
|
|
20
|
+
"import": "./dist/tokens/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./contracts": {
|
|
23
|
+
"types": "./dist/contracts/index.d.ts",
|
|
24
|
+
"import": "./dist/contracts/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./hooks": {
|
|
27
|
+
"types": "./dist/hooks/index.d.ts",
|
|
28
|
+
"import": "./dist/hooks/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./stores": {
|
|
31
|
+
"types": "./dist/stores/index.d.ts",
|
|
32
|
+
"import": "./dist/stores/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./dex": {
|
|
35
|
+
"types": "./dist/dex/index.d.ts",
|
|
36
|
+
"import": "./dist/dex/index.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"src"
|
|
42
|
+
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"typecheck": "tsc --noEmit",
|
|
45
|
+
"build": "tsc",
|
|
46
|
+
"test": "vitest run",
|
|
47
|
+
"prepublishOnly": "npm run build"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"viem": "^2.43.3",
|
|
51
|
+
"wagmi": "^3.1.3",
|
|
52
|
+
"@tanstack/react-query": "^5.90.12",
|
|
53
|
+
"zustand": "^5.0.5"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"react": ">=18.0.0"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/node": "^25.0.3",
|
|
60
|
+
"@types/react": "^19.2.3",
|
|
61
|
+
"typescript": "^5.8.3",
|
|
62
|
+
"vitest": "^4.0.16"
|
|
63
|
+
},
|
|
64
|
+
"repository": {
|
|
65
|
+
"type": "git",
|
|
66
|
+
"url": "https://github.com/luxfi/exchange.git",
|
|
67
|
+
"directory": "packages/exchange"
|
|
68
|
+
},
|
|
69
|
+
"keywords": [
|
|
70
|
+
"lux",
|
|
71
|
+
"dex",
|
|
72
|
+
"exchange",
|
|
73
|
+
"defi",
|
|
74
|
+
"blockchain",
|
|
75
|
+
"react",
|
|
76
|
+
"hooks"
|
|
77
|
+
]
|
|
78
|
+
}
|