Skip to content

Commit de6104a

Browse files
committed
fix(wallet): fetch activeTranscoderCount and delegatorsCount from subgraph
getProtocol() was hardcoding activeTranscoderCount: 0 and delegatorsCount: 0 instead of querying them from the subgraph. The Explore Overview cards showed "0" and "—" for these values. Also added inflationChange, paused fields and fixed participationRate to multiply by 100 (matching Express backend percentage format). Made-with: Cursor
1 parent 59ef7e1 commit de6104a

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

apps/web-next/src/lib/wallet/subgraph.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,26 @@ export async function getOrchestrators() {
8686
export async function getProtocol() {
8787
const data = await querySubgraph<{ protocol: any }>(`{
8888
protocol(id: "0") {
89-
totalSupply totalActiveStake participationRate inflation
89+
totalSupply totalActiveStake participationRate inflation inflationChange
9090
currentRound { id length }
91-
totalVolumeETH totalVolumeUSD
91+
activeTranscoderCount delegatorsCount
92+
totalVolumeETH totalVolumeUSD paused
9293
}
9394
}`);
9495
const p = data.protocol || {};
9596
return {
9697
totalSupply: p.totalSupply || '0',
9798
totalActiveStake: p.totalActiveStake || '0',
98-
participationRate: parseFloat(p.participationRate || '0'),
99+
participationRate: parseFloat(p.participationRate || '0') * 100,
99100
inflation: p.inflation || '0',
101+
inflationChange: p.inflationChange || '0',
100102
currentRound: parseInt(p.currentRound?.id || '0'),
101103
roundLength: parseInt(p.currentRound?.length || '0'),
102-
activeTranscoderCount: 0,
103-
delegatorsCount: 0,
104+
activeTranscoderCount: parseInt(String(p.activeTranscoderCount || '0')),
105+
delegatorsCount: parseInt(String(p.delegatorsCount || '0')),
104106
totalVolumeETH: p.totalVolumeETH || '0',
105107
totalVolumeUSD: p.totalVolumeUSD || '0',
108+
paused: p.paused || false,
106109
lastUpdated: new Date().toISOString(),
107110
};
108111
}

0 commit comments

Comments
 (0)