diff --git a/shared/images/LP_token_Logo.png b/shared/images/LP_token_Logo.png new file mode 100644 index 00000000..6f9fde66 Binary files /dev/null and b/shared/images/LP_token_Logo.png differ diff --git a/web/check_all_pools.mjs b/web/check_all_pools.mjs deleted file mode 100644 index ffdb488b..00000000 --- a/web/check_all_pools.mjs +++ /dev/null @@ -1,91 +0,0 @@ -import { ApiPromise, WsProvider } from '@pezkuwi/api'; - -async function checkAllPools() { - const provider = new WsProvider('wss://asset-hub-rpc.pezkuwichain.io'); - const api = await ApiPromise.create({ provider }); - - console.log('Connected to Asset Hub\n'); - - const userAddress = '5CyuFfbF95rzBxru7c9yEsX4XmQXUxpLUcbj9RLg9K1cGiiF'; - - // Get all pools - const poolKeys = await api.query.assetConversion.pools.keys(); - console.log('=== ALL POOLS ==='); - console.log('Total pools found:', poolKeys.length, '\n'); - - for (const key of poolKeys) { - const poolPair = key.args[0]; - console.log('Pool key:', JSON.stringify(poolPair.toHuman())); - - const poolInfo = await api.query.assetConversion.pools(poolPair); - if (!poolInfo.isEmpty) { - const poolData = poolInfo.unwrap().toJSON(); - console.log('LP Token ID:', poolData.lpToken); - - // Get LP supply - const lpAsset = await api.query.poolAssets.asset(poolData.lpToken); - if (lpAsset.isSome) { - const supply = lpAsset.unwrap().toJSON().supply; - console.log('Total LP Supply:', Number(BigInt(supply)) / 1e12); - } - - // Get user's LP balance - const userLp = await api.query.poolAssets.account(poolData.lpToken, userAddress); - if (userLp.isSome) { - const balance = userLp.unwrap().toJSON().balance; - console.log('User LP Balance:', Number(BigInt(balance)) / 1e12); - } else { - console.log('User LP Balance: 0'); - } - - // Try to get price - try { - const asset1 = poolPair[0]; - const asset2 = poolPair[1]; - const oneUnit = BigInt(1e12); - const quote = await api.call.assetConversionApi.quotePriceExactTokensForTokens( - asset1, - asset2, - oneUnit.toString(), - true - ); - if (quote && !quote.isNone) { - console.log('Price (1 asset1 -> asset2):', Number(BigInt(quote.unwrap().toString())) / 1e12); - } - } catch { - // Try with 6 decimals for USDT - try { - const asset1 = poolPair[0]; - const asset2 = poolPair[1]; - const oneUnit = BigInt(1e12); - const quote = await api.call.assetConversionApi.quotePriceExactTokensForTokens( - asset1, - asset2, - oneUnit.toString(), - true - ); - if (quote && !quote.isNone) { - console.log('Price (1 asset1 -> asset2):', Number(BigInt(quote.unwrap().toString())) / 1e6, 'USDT'); - } - } catch { - console.log('Could not get price'); - } - } - } - console.log('---'); - } - - // Check all LP token balances for user - console.log('\n=== USER LP TOKEN BALANCES ==='); - for (let lpId = 0; lpId < 5; lpId++) { - const userLp = await api.query.poolAssets.account(lpId, userAddress); - if (userLp.isSome) { - const balance = userLp.unwrap().toJSON().balance; - console.log(`LP Token ${lpId}: ${Number(BigInt(balance)) / 1e12}`); - } - } - - await api.disconnect(); -} - -checkAllPools().catch(console.error); diff --git a/web/src/pages/Dashboard.tsx b/web/src/pages/Dashboard.tsx index a5976046..4bfe640e 100644 --- a/web/src/pages/Dashboard.tsx +++ b/web/src/pages/Dashboard.tsx @@ -10,7 +10,7 @@ import { supabase } from '@/lib/supabase'; import { User, Mail, Phone, Globe, MapPin, Calendar, Shield, AlertCircle, ArrowLeft, Award, Users, TrendingUp, UserMinus, Play, Loader2 } from 'lucide-react'; import { useToast } from '@/hooks/use-toast'; import { fetchUserTikis, getPrimaryRole, getTikiDisplayName, getTikiColor, getTikiEmoji, getUserRoleCategories, getAllTikiNFTDetails, generateCitizenNumber, type TikiNFTDetails } from '@pezkuwi/lib/tiki'; -import { getAllScores, getStakingScoreStatus, startScoreTracking, type UserScores, type StakingScoreStatus, formatDuration } from '@pezkuwi/lib/scores'; +import { getAllScoresWithFallback, getStakingScoreStatus, startScoreTracking, type UserScores, type StakingScoreStatus, formatDuration } from '@pezkuwi/lib/scores'; import { web3FromAddress } from '@pezkuwi/extension-dapp'; import { getKycStatus } from '@pezkuwi/lib/kyc'; import { ReferralDashboard } from '@/components/referral/ReferralDashboard'; @@ -108,10 +108,10 @@ export default function Dashboard() { setLoadingScores(true); try { - // Fetch all scores from blockchain (includes trust, referral, staking, tiki) - // - Trust, referral, tiki, stakingScore: People Chain - // - Staking amount: Relay Chain (staking.ledger) - const allScores = await getAllScores(peopleApi, selectedAccount.address, api); + // Fetch all scores with frontend fallback (until runtime upgrade) + // - Trust, referral, tiki: People Chain (on-chain) + // - Staking: Relay Chain with frontend fallback + const allScores = await getAllScoresWithFallback(peopleApi, api, selectedAccount.address); setScores(allScores); // Fetch staking score tracking status @@ -452,7 +452,7 @@ export default function Dashboard() { {loadingScores ? '...' : scores.trustScore}
- From pallet_trust + Frontend calculation