mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-25 09:37:56 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user