fix: resolve DEX pool issues with XCM Location format and slippage calculation

- Fix PoolDashboard reserve fetching (was hardcoded to 0)
- Fix slippage calculation bug in AddLiquidityModal
- Add XCM Location format support for native token (-1) in all liquidity modals
- Update KNOWN_TOKENS with correct wUSDT asset ID (1000) and add NATIVE_TOKEN_ID constant
- Implement dynamic pool discovery in fetchPools() using XCM Location parsing
- Update fetchUserLPPositions() to use correct LP token ID from chain
- Add formatAssetLocation() helper to shared/utils/dex.ts
This commit is contained in:
2026-02-04 20:13:26 +03:00
parent c8fcd262c8
commit 2bfbbe6d1a
7 changed files with 327 additions and 97 deletions
+15
View File
@@ -77,8 +77,17 @@ export interface PoolCreationParams {
feeRate?: number;
}
// Native token ID constant (relay chain HEZ)
export const NATIVE_TOKEN_ID = -1;
// Known tokens on testnet
export const KNOWN_TOKENS: Record<number, TokenInfo> = {
[-1]: {
id: -1,
symbol: 'HEZ',
name: 'Native HEZ',
decimals: 12,
},
0: {
id: 0,
symbol: 'wHEZ',
@@ -93,6 +102,12 @@ export const KNOWN_TOKENS: Record<number, TokenInfo> = {
},
2: {
id: 2,
symbol: 'wHEZ',
name: 'Wrapped HEZ (Asset Hub)',
decimals: 12,
},
1000: {
id: 1000,
symbol: 'wUSDT',
name: 'Wrapped USDT',
decimals: 6,