mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 02:07:55 +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)',
|
description: 'Production mainnet (mainnet subdomain)',
|
||||||
},
|
},
|
||||||
|
|
||||||
// Zagros Testnet
|
// Zagros Testnet (Relay Chain only)
|
||||||
ZAGROS: {
|
ZAGROS: {
|
||||||
name: 'Zagros Testnet',
|
name: 'Zagros Testnet',
|
||||||
endpoint: 'https://zagros-rpc.pezkuwichain.io',
|
endpoint: 'https://zagros-rpc.pezkuwichain.io',
|
||||||
wsEndpoint: 'wss://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',
|
type: 'testnet',
|
||||||
description: 'Zagros testnet for development and testing',
|
description: 'Zagros testnet - relay chain only',
|
||||||
},
|
},
|
||||||
|
|
||||||
// Testnet alias (maps to Zagros)
|
// Testnet alias (maps to Zagros)
|
||||||
@@ -55,10 +53,8 @@ export const NETWORK_ENDPOINTS: Record<string, NetworkConfig> = {
|
|||||||
name: 'Zagros Testnet',
|
name: 'Zagros Testnet',
|
||||||
endpoint: 'https://zagros-rpc.pezkuwichain.io',
|
endpoint: 'https://zagros-rpc.pezkuwichain.io',
|
||||||
wsEndpoint: 'wss://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',
|
type: 'testnet',
|
||||||
description: 'Testnet environment (Zagros)',
|
description: 'Testnet environment (Zagros) - relay chain only',
|
||||||
},
|
},
|
||||||
|
|
||||||
// Local Development
|
// Local Development
|
||||||
@@ -72,15 +68,13 @@ export const NETWORK_ENDPOINTS: Record<string, NetworkConfig> = {
|
|||||||
description: 'Local development node',
|
description: 'Local development node',
|
||||||
},
|
},
|
||||||
|
|
||||||
// Development alias (maps to Zagros for live testing)
|
// Development alias (maps to Zagros relay chain only)
|
||||||
DEVELOPMENT: {
|
DEVELOPMENT: {
|
||||||
name: 'Zagros Testnet',
|
name: 'Zagros Testnet',
|
||||||
endpoint: 'https://zagros-rpc.pezkuwichain.io',
|
endpoint: 'https://zagros-rpc.pezkuwichain.io',
|
||||||
wsEndpoint: 'wss://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',
|
type: 'development',
|
||||||
description: 'Development mode connecting to Zagros testnet',
|
description: 'Development mode connecting to Zagros relay chain',
|
||||||
},
|
},
|
||||||
|
|
||||||
// Legacy: Beta (deprecated, maps to Mainnet)
|
// Legacy: Beta (deprecated, maps to Mainnet)
|
||||||
@@ -98,10 +92,7 @@ export const NETWORK_ENDPOINTS: Record<string, NetworkConfig> = {
|
|||||||
/**
|
/**
|
||||||
* Default network based on environment
|
* Default network based on environment
|
||||||
*/
|
*/
|
||||||
export const DEFAULT_NETWORK =
|
export const DEFAULT_NETWORK = NETWORK_ENDPOINTS.MAINNET;
|
||||||
process.env.NODE_ENV === 'production'
|
|
||||||
? NETWORK_ENDPOINTS.MAINNET
|
|
||||||
: NETWORK_ENDPOINTS.ZAGROS;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Port Configuration
|
* Port Configuration
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ export const StakingDashboard: React.FC = () => {
|
|||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
{/* Overview Cards */}
|
{/* 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">
|
<Card className="bg-gray-900 border-gray-800">
|
||||||
<CardHeader className="pb-3">
|
<CardHeader className="pb-3">
|
||||||
<CardTitle className="text-sm text-gray-400">Total Bonded</CardTitle>
|
<CardTitle className="text-sm text-gray-400">Total Bonded</CardTitle>
|
||||||
@@ -508,11 +508,12 @@ export const StakingDashboard: React.FC = () => {
|
|||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<Card className="bg-gray-900 border-gray-800">
|
{/* PEZ Rewards - only show when pallet is available */}
|
||||||
<CardHeader className="pb-3">
|
{pezRewards && (
|
||||||
<div className="flex items-center justify-between">
|
<Card className="bg-gray-900 border-gray-800">
|
||||||
<CardTitle className="text-sm text-gray-400">PEZ Rewards</CardTitle>
|
<CardHeader className="pb-3">
|
||||||
{pezRewards && (
|
<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 ${
|
<span className={`text-xs px-2 py-0.5 rounded-full font-medium ${
|
||||||
pezRewards.epochStatus === 'Open'
|
pezRewards.epochStatus === 'Open'
|
||||||
? 'bg-green-500/20 text-green-400'
|
? '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'}
|
{pezRewards.epochStatus === 'Open' ? 'Open' : pezRewards.epochStatus === 'ClaimPeriod' ? 'Claim Period' : 'Closed'}
|
||||||
</span>
|
</span>
|
||||||
)}
|
</div>
|
||||||
</div>
|
</CardHeader>
|
||||||
</CardHeader>
|
<CardContent>
|
||||||
<CardContent>
|
|
||||||
{pezRewards ? (
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<p className="text-xs text-gray-500">Epoch {pezRewards.currentEpoch}</p>
|
<p className="text-xs text-gray-500">Epoch {pezRewards.currentEpoch}</p>
|
||||||
|
|
||||||
@@ -552,7 +551,7 @@ export const StakingDashboard: React.FC = () => {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Claimable rewards */}
|
{/* Claimable rewards */}
|
||||||
{pezRewards.hasPendingClaim ? (
|
{pezRewards.hasPendingClaim && (
|
||||||
<>
|
<>
|
||||||
<div className="text-2xl font-bold text-orange-500">
|
<div className="text-2xl font-bold text-orange-500">
|
||||||
{parseFloat(pezRewards.totalClaimable).toFixed(2)} PEZ
|
{parseFloat(pezRewards.totalClaimable).toFixed(2)} PEZ
|
||||||
@@ -574,20 +573,11 @@ export const StakingDashboard: React.FC = () => {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
) : (
|
|
||||||
!pezRewards.hasRecordedThisEpoch && pezRewards.epochStatus !== 'Open' && (
|
|
||||||
<div className="text-2xl font-bold text-gray-500">0 PEZ</div>
|
|
||||||
)
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
</CardContent>
|
||||||
<>
|
</Card>
|
||||||
<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>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Main Staking Interface */}
|
{/* Main Staking Interface */}
|
||||||
|
|||||||
+13
-24
@@ -581,32 +581,27 @@ export default function Dashboard() {
|
|||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* PEZ Rewards Card */}
|
{/* PEZ Rewards Card - only show when pallet is available */}
|
||||||
{selectedAccount && (
|
{selectedAccount && pezRewards && (
|
||||||
<Card className="mb-6">
|
<Card className="mb-6">
|
||||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||||
<CardTitle className="text-sm font-medium">PEZ Rewards</CardTitle>
|
<CardTitle className="text-sm font-medium">PEZ Rewards</CardTitle>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{pezRewards && (
|
<Badge className={
|
||||||
<Badge className={
|
pezRewards.epochStatus === 'Open'
|
||||||
pezRewards.epochStatus === 'Open'
|
? 'bg-green-500'
|
||||||
? 'bg-green-500'
|
: pezRewards.epochStatus === 'ClaimPeriod'
|
||||||
: pezRewards.epochStatus === 'ClaimPeriod'
|
? 'bg-orange-500'
|
||||||
? 'bg-orange-500'
|
: 'bg-gray-500'
|
||||||
: 'bg-gray-500'
|
}>
|
||||||
}>
|
{pezRewards.epochStatus === 'Open' ? 'Open' : pezRewards.epochStatus === 'ClaimPeriod' ? 'Claim Period' : 'Closed'}
|
||||||
{pezRewards.epochStatus === 'Open' ? 'Open' : pezRewards.epochStatus === 'ClaimPeriod' ? 'Claim Period' : 'Closed'}
|
</Badge>
|
||||||
</Badge>
|
|
||||||
)}
|
|
||||||
<Coins className="h-4 w-4 text-orange-500" />
|
<Coins className="h-4 w-4 text-orange-500" />
|
||||||
</div>
|
</div>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
{loadingScores ? (
|
<div className="space-y-3">
|
||||||
<div className="text-2xl font-bold">...</div>
|
<p className="text-xs text-muted-foreground">Epoch {pezRewards.currentEpoch}</p>
|
||||||
) : pezRewards ? (
|
|
||||||
<div className="space-y-3">
|
|
||||||
<p className="text-xs text-muted-foreground">Epoch {pezRewards.currentEpoch}</p>
|
|
||||||
|
|
||||||
{/* Open epoch: Record score or show recorded score */}
|
{/* Open epoch: Record score or show recorded score */}
|
||||||
{pezRewards.epochStatus === 'Open' && (
|
{pezRewards.epochStatus === 'Open' && (
|
||||||
@@ -664,12 +659,6 @@ export default function Dashboard() {
|
|||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
</div>
|
</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>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user