fix: query nominators from Asset Hub, treasury balances from both chains

NetworkStats now queries staking.nominators from Asset Hub instead of
Relay Chain (staking migrated to AH). Treasury hook fetches HEZ from RC
and PEZ from AH (asset 1) for accurate balance display.
This commit is contained in:
2026-02-22 06:36:15 +03:00
parent d19be068f9
commit 8f187cd971
3 changed files with 45 additions and 15 deletions
+7 -5
View File
@@ -81,15 +81,17 @@ export const NetworkStats: React.FC = () => {
if (import.meta.env.DEV) console.warn('Failed to fetch People Chain collators', err);
}
// 3. Count Nominators
// 3. Count Nominators from Asset Hub (staking migrated to AH)
let nCount = 0;
try {
const nominators = await api.query.staking?.nominators.entries();
if (nominators) {
nCount = nominators.length;
if (isAssetHubReady && assetHubApi?.query.staking?.nominators) {
const nominators = await assetHubApi.query.staking.nominators.entries();
if (nominators) {
nCount = nominators.length;
}
}
} catch {
if (import.meta.env.DEV) console.warn('Staking pallet not available, nominators = 0');
if (import.meta.env.DEV) console.warn('Staking pallet not available on AH, nominators = 0');
}
setValidatorCount(vCount);