mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-21 23:47:56 +00:00
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
This commit is contained in:
@@ -39,15 +39,13 @@ export const NETWORK_ENDPOINTS: Record<string, NetworkConfig> = {
|
||||
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<string, NetworkConfig> = {
|
||||
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<string, NetworkConfig> = {
|
||||
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<string, NetworkConfig> = {
|
||||
/**
|
||||
* 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
|
||||
|
||||
@@ -428,7 +428,7 @@ export const StakingDashboard: React.FC = () => {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{/* Overview Cards */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-4">
|
||||
<div className={`grid grid-cols-1 md:grid-cols-2 ${pezRewards ? 'lg:grid-cols-5' : 'lg:grid-cols-4'} gap-4`}>
|
||||
<Card className="bg-gray-900 border-gray-800">
|
||||
<CardHeader className="pb-3">
|
||||
<CardTitle className="text-sm text-gray-400">Total Bonded</CardTitle>
|
||||
@@ -508,11 +508,12 @@ export const StakingDashboard: React.FC = () => {
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="bg-gray-900 border-gray-800">
|
||||
<CardHeader className="pb-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<CardTitle className="text-sm text-gray-400">PEZ Rewards</CardTitle>
|
||||
{pezRewards && (
|
||||
{/* PEZ Rewards - only show when pallet is available */}
|
||||
{pezRewards && (
|
||||
<Card className="bg-gray-900 border-gray-800">
|
||||
<CardHeader className="pb-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<CardTitle className="text-sm text-gray-400">PEZ Rewards</CardTitle>
|
||||
<span className={`text-xs px-2 py-0.5 rounded-full font-medium ${
|
||||
pezRewards.epochStatus === 'Open'
|
||||
? 'bg-green-500/20 text-green-400'
|
||||
@@ -522,11 +523,9 @@ export const StakingDashboard: React.FC = () => {
|
||||
}`}>
|
||||
{pezRewards.epochStatus === 'Open' ? 'Open' : pezRewards.epochStatus === 'ClaimPeriod' ? 'Claim Period' : 'Closed'}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{pezRewards ? (
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="space-y-2">
|
||||
<p className="text-xs text-gray-500">Epoch {pezRewards.currentEpoch}</p>
|
||||
|
||||
@@ -552,7 +551,7 @@ export const StakingDashboard: React.FC = () => {
|
||||
)}
|
||||
|
||||
{/* Claimable rewards */}
|
||||
{pezRewards.hasPendingClaim ? (
|
||||
{pezRewards.hasPendingClaim && (
|
||||
<>
|
||||
<div className="text-2xl font-bold text-orange-500">
|
||||
{parseFloat(pezRewards.totalClaimable).toFixed(2)} PEZ
|
||||
@@ -574,20 +573,11 @@ export const StakingDashboard: React.FC = () => {
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
!pezRewards.hasRecordedThisEpoch && pezRewards.epochStatus !== 'Open' && (
|
||||
<div className="text-2xl font-bold text-gray-500">0 PEZ</div>
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="text-2xl font-bold text-gray-500">0 PEZ</div>
|
||||
<p className="text-xs text-gray-500 mt-1">No rewards available</p>
|
||||
</>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Main Staking Interface */}
|
||||
|
||||
+13
-24
@@ -581,32 +581,27 @@ export default function Dashboard() {
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
{/* PEZ Rewards Card */}
|
||||
{selectedAccount && (
|
||||
{/* PEZ Rewards Card - only show when pallet is available */}
|
||||
{selectedAccount && pezRewards && (
|
||||
<Card className="mb-6">
|
||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||
<CardTitle className="text-sm font-medium">PEZ Rewards</CardTitle>
|
||||
<div className="flex items-center gap-2">
|
||||
{pezRewards && (
|
||||
<Badge className={
|
||||
pezRewards.epochStatus === 'Open'
|
||||
? 'bg-green-500'
|
||||
: pezRewards.epochStatus === 'ClaimPeriod'
|
||||
? 'bg-orange-500'
|
||||
: 'bg-gray-500'
|
||||
}>
|
||||
{pezRewards.epochStatus === 'Open' ? 'Open' : pezRewards.epochStatus === 'ClaimPeriod' ? 'Claim Period' : 'Closed'}
|
||||
</Badge>
|
||||
)}
|
||||
<Badge className={
|
||||
pezRewards.epochStatus === 'Open'
|
||||
? 'bg-green-500'
|
||||
: pezRewards.epochStatus === 'ClaimPeriod'
|
||||
? 'bg-orange-500'
|
||||
: 'bg-gray-500'
|
||||
}>
|
||||
{pezRewards.epochStatus === 'Open' ? 'Open' : pezRewards.epochStatus === 'ClaimPeriod' ? 'Claim Period' : 'Closed'}
|
||||
</Badge>
|
||||
<Coins className="h-4 w-4 text-orange-500" />
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{loadingScores ? (
|
||||
<div className="text-2xl font-bold">...</div>
|
||||
) : pezRewards ? (
|
||||
<div className="space-y-3">
|
||||
<p className="text-xs text-muted-foreground">Epoch {pezRewards.currentEpoch}</p>
|
||||
<div className="space-y-3">
|
||||
<p className="text-xs text-muted-foreground">Epoch {pezRewards.currentEpoch}</p>
|
||||
|
||||
{/* Open epoch: Record score or show recorded score */}
|
||||
{pezRewards.epochStatus === 'Open' && (
|
||||
@@ -664,12 +659,6 @@ export default function Dashboard() {
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
<div className="text-2xl font-bold text-muted-foreground">0 PEZ</div>
|
||||
<p className="text-xs text-muted-foreground">No rewards available</p>
|
||||
</div>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user