feat: add support for all pool combinations (wHEZ-PEZ, PEZ-USDT, wHEZ-USDT)

This commit is contained in:
2026-02-04 19:32:19 +03:00
parent c24a133fab
commit c8fcd262c8
3 changed files with 15 additions and 7 deletions
+5 -3
View File
@@ -26,9 +26,10 @@ interface Balances {
[key: string]: number;
}
// Helper to get display name (users see HEZ not wHEZ, PEZ, USDT not wUSDT)
// Helper to get display name for tokens
const getDisplayName = (assetId: number): string => {
if (assetId === -1 || assetId === ASSET_IDS.WHEZ || assetId === 0 || assetId === 2) return 'HEZ';
if (assetId === -1) return 'HEZ'; // Native HEZ from relay chain
if (assetId === ASSET_IDS.WHEZ || assetId === 2) return 'wHEZ'; // Wrapped HEZ
if (assetId === ASSET_IDS.PEZ || assetId === 1) return 'PEZ';
if (assetId === ASSET_IDS.WUSDT || assetId === 1000) return 'USDT';
return getAssetSymbol(assetId);
@@ -36,7 +37,8 @@ const getDisplayName = (assetId: number): string => {
// Helper to get balance key for the asset
const getBalanceKey = (assetId: number): string => {
if (assetId === -1 || assetId === ASSET_IDS.WHEZ || assetId === 0 || assetId === 2) return 'HEZ';
if (assetId === -1) return 'HEZ'; // Native HEZ
if (assetId === ASSET_IDS.WHEZ || assetId === 2) return 'wHEZ'; // Wrapped HEZ
if (assetId === ASSET_IDS.PEZ || assetId === 1) return 'PEZ';
if (assetId === ASSET_IDS.WUSDT || assetId === 1000) return 'USDT';
return getAssetSymbol(assetId);
+7 -2
View File
@@ -69,12 +69,17 @@ const PoolDashboard = () => {
const discoverPools = async () => {
try {
// Pools must pair with Native token (relay chain HEZ)
// Valid pools: Native HEZ / PEZ, Native HEZ / wUSDT, Native HEZ / wHEZ
// All possible pool combinations
const possiblePools: Array<[number, number]> = [
// Native HEZ pools
[NATIVE_TOKEN_ID, ASSET_IDS.PEZ], // Native HEZ / PEZ
[NATIVE_TOKEN_ID, ASSET_IDS.WUSDT], // Native HEZ / wUSDT
[NATIVE_TOKEN_ID, ASSET_IDS.WHEZ], // Native HEZ / wHEZ
// wHEZ pools
[ASSET_IDS.WHEZ, ASSET_IDS.PEZ], // wHEZ / PEZ
[ASSET_IDS.WHEZ, ASSET_IDS.WUSDT], // wHEZ / wUSDT
// PEZ pools
[ASSET_IDS.PEZ, ASSET_IDS.WUSDT], // PEZ / wUSDT
];
const existingPools: Array<[number, number]> = [];
+3 -2
View File
@@ -7,9 +7,10 @@ import { Button } from '@/components/ui/button';
import { Alert, AlertDescription } from '@/components/ui/alert';
import { ASSET_IDS, getAssetSymbol } from '@pezkuwi/lib/wallet';
// Helper to get display name for tokens (users see HEZ not wHEZ, USDT not wUSDT)
// Helper to get display name for tokens
const getDisplayTokenName = (assetId: number): string => {
if (assetId === -1 || assetId === ASSET_IDS.WHEZ || assetId === 0 || assetId === 2) return 'HEZ';
if (assetId === -1) return 'HEZ'; // Native HEZ from relay chain
if (assetId === ASSET_IDS.WHEZ || assetId === 2) return 'wHEZ'; // Wrapped HEZ
if (assetId === ASSET_IDS.PEZ || assetId === 1) return 'PEZ';
if (assetId === ASSET_IDS.WUSDT || assetId === 1000) return 'USDT';
return getAssetSymbol(assetId);