From 9963a759d3e1f97dd091d2c86bad50534e9ab2ec Mon Sep 17 00:00:00 2001 From: Kurdistan Tech Ministry Date: Fri, 13 Feb 2026 18:11:24 +0300 Subject: [PATCH] fix: fix Zagros endpoints, hide PEZ Rewards when pallet unavailable - Remove Asset Hub and People Chain endpoints from Zagros/Development config (relay chain only) - Default network now always mainnet - PEZ Rewards card only renders when pallet is available on chain - Dynamic grid layout when PEZ Rewards card is hidden --- shared/blockchain/endpoints.ts | 21 +++------- .../components/staking/StakingDashboard.tsx | 38 +++++++------------ web/src/pages/Dashboard.tsx | 37 +++++++----------- 3 files changed, 33 insertions(+), 63 deletions(-) diff --git a/shared/blockchain/endpoints.ts b/shared/blockchain/endpoints.ts index 1a0b6f2c..8870ccf6 100644 --- a/shared/blockchain/endpoints.ts +++ b/shared/blockchain/endpoints.ts @@ -39,15 +39,13 @@ export const NETWORK_ENDPOINTS: Record = { description: 'Production mainnet (mainnet subdomain)', }, - // Zagros Testnet + // Zagros Testnet (Relay Chain only) ZAGROS: { name: 'Zagros Testnet', endpoint: 'https://zagros-rpc.pezkuwichain.io', wsEndpoint: 'wss://zagros-rpc.pezkuwichain.io', - assetHubEndpoint: 'wss://zagros-asset-hub.pezkuwichain.io', - peopleChainEndpoint: 'wss://zagros-people.pezkuwichain.io', type: 'testnet', - description: 'Zagros testnet for development and testing', + description: 'Zagros testnet - relay chain only', }, // Testnet alias (maps to Zagros) @@ -55,10 +53,8 @@ export const NETWORK_ENDPOINTS: Record = { name: 'Zagros Testnet', endpoint: 'https://zagros-rpc.pezkuwichain.io', wsEndpoint: 'wss://zagros-rpc.pezkuwichain.io', - assetHubEndpoint: 'wss://zagros-asset-hub.pezkuwichain.io', - peopleChainEndpoint: 'wss://zagros-people.pezkuwichain.io', type: 'testnet', - description: 'Testnet environment (Zagros)', + description: 'Testnet environment (Zagros) - relay chain only', }, // Local Development @@ -72,15 +68,13 @@ export const NETWORK_ENDPOINTS: Record = { description: 'Local development node', }, - // Development alias (maps to Zagros for live testing) + // Development alias (maps to Zagros relay chain only) DEVELOPMENT: { name: 'Zagros Testnet', endpoint: 'https://zagros-rpc.pezkuwichain.io', wsEndpoint: 'wss://zagros-rpc.pezkuwichain.io', - assetHubEndpoint: 'wss://zagros-asset-hub.pezkuwichain.io', - peopleChainEndpoint: 'wss://zagros-people.pezkuwichain.io', type: 'development', - description: 'Development mode connecting to Zagros testnet', + description: 'Development mode connecting to Zagros relay chain', }, // Legacy: Beta (deprecated, maps to Mainnet) @@ -98,10 +92,7 @@ export const NETWORK_ENDPOINTS: Record = { /** * Default network based on environment */ -export const DEFAULT_NETWORK = - process.env.NODE_ENV === 'production' - ? NETWORK_ENDPOINTS.MAINNET - : NETWORK_ENDPOINTS.ZAGROS; +export const DEFAULT_NETWORK = NETWORK_ENDPOINTS.MAINNET; /** * Port Configuration diff --git a/web/src/components/staking/StakingDashboard.tsx b/web/src/components/staking/StakingDashboard.tsx index bc0e7066..e8fc907a 100644 --- a/web/src/components/staking/StakingDashboard.tsx +++ b/web/src/components/staking/StakingDashboard.tsx @@ -428,7 +428,7 @@ export const StakingDashboard: React.FC = () => { return (
{/* Overview Cards */} -
+
Total Bonded @@ -508,11 +508,12 @@ export const StakingDashboard: React.FC = () => { - - -
- PEZ Rewards - {pezRewards && ( + {/* PEZ Rewards - only show when pallet is available */} + {pezRewards && ( + + +
+ PEZ Rewards { }`}> {pezRewards.epochStatus === 'Open' ? 'Open' : pezRewards.epochStatus === 'ClaimPeriod' ? 'Claim Period' : 'Closed'} - )} -
-
- - {pezRewards ? ( +
+
+

Epoch {pezRewards.currentEpoch}

@@ -552,7 +551,7 @@ export const StakingDashboard: React.FC = () => { )} {/* Claimable rewards */} - {pezRewards.hasPendingClaim ? ( + {pezRewards.hasPendingClaim && ( <>
{parseFloat(pezRewards.totalClaimable).toFixed(2)} PEZ @@ -574,20 +573,11 @@ export const StakingDashboard: React.FC = () => { ))}
- ) : ( - !pezRewards.hasRecordedThisEpoch && pezRewards.epochStatus !== 'Open' && ( -
0 PEZ
- ) )}
- ) : ( - <> -
0 PEZ
-

No rewards available

- - )} -
-
+ + + )}
{/* Main Staking Interface */} diff --git a/web/src/pages/Dashboard.tsx b/web/src/pages/Dashboard.tsx index 4fd03ad2..8bb70f41 100644 --- a/web/src/pages/Dashboard.tsx +++ b/web/src/pages/Dashboard.tsx @@ -581,32 +581,27 @@ export default function Dashboard() {
- {/* PEZ Rewards Card */} - {selectedAccount && ( + {/* PEZ Rewards Card - only show when pallet is available */} + {selectedAccount && pezRewards && ( PEZ Rewards
- {pezRewards && ( - - {pezRewards.epochStatus === 'Open' ? 'Open' : pezRewards.epochStatus === 'ClaimPeriod' ? 'Claim Period' : 'Closed'} - - )} + + {pezRewards.epochStatus === 'Open' ? 'Open' : pezRewards.epochStatus === 'ClaimPeriod' ? 'Claim Period' : 'Closed'} +
- {loadingScores ? ( -
...
- ) : pezRewards ? ( -
-

Epoch {pezRewards.currentEpoch}

+
+

Epoch {pezRewards.currentEpoch}

{/* Open epoch: Record score or show recorded score */} {pezRewards.epochStatus === 'Open' && ( @@ -664,12 +659,6 @@ export default function Dashboard() { ) )}
- ) : ( -
-
0 PEZ
-

No rewards available

-
- )} )}