fix: use real totalCount from Subsquid instead of capped fetch limit

Add totalCount to the GraphQL query so transactionCount reflects the
true number of transfers in the period, not the 2000-item fetch cap.
This also fixes the average Ğ1/tx calculation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
syoul
2026-03-22 18:40:07 +01:00
parent 2674b3891b
commit a6fc4a534f
2 changed files with 20 additions and 11 deletions
+1 -2
View File
@@ -37,10 +37,9 @@ async function fetchLiveTransactions(periodDays: number): Promise<{
totalCount: number;
totalVolume: number;
}> {
const rawTransfers = await fetchTransfers(periodDays);
const { transfers: rawTransfers, totalCount } = await fetchTransfers(periodDays);
if (rawTransfers.length === 0) return { geolocated: [], totalCount: 0, totalVolume: 0 };
const totalCount = rawTransfers.length;
const totalVolume = rawTransfers.reduce((s, t) => s + t.amount, 0);
// Carte SS58 courant → clé Duniter (= _id Cesium+)