index/classes/PlatformStatsService.md
Platform Stats Service Class
Provides methods for accessing platform-wide statistics:
- Total GALA trading volume (1h, 24h, 7d)
- Total token count
Caching: Backend caches stats for 3 minutes. HTTP responses include Cache-Control headers (60s max-age).
Public endpoint - no authentication required.
Example
const statsService = new PlatformStatsService(httpClient, true);
// Get platform stats
const { stats } = await statsService.getStats();
console.log('Volume (1h):', stats.galaVolume1h, 'GALA');
console.log('Volume (24h):', stats.galaVolume24h, 'GALA');
console.log('Volume (7d):', stats.galaVolume7d, 'GALA');
console.log('Total tokens:', stats.totalTokens);
console.log('Updated:', stats.timestamp);
Extends
BaseService
base service
Constructors
Constructor
new PlatformStatsService(
http,debugMode?):PlatformStatsService
Parameters
| Parameter | Type |
|---|---|
http | HttpClient |
debugMode? | boolean |
Returns
PlatformStatsService
Overrides
BaseService.constructor
debug mode platform stats service http client base
Methods
getStats()
getStats():
Promise<GetPlatformStatsResult>
Get platform-wide statistics
Returns aggregated platform metrics including:
- GALA trading volume over 1h, 24h, 7d
- Total number of tokens on the platform
Returns
Promise<GetPlatformStatsResult>
Platform statistics
Example
const { stats } = await statsService.getStats();
// Display volume in millions
console.log(`24h Volume: ${(stats.galaVolume24h / 1_000_000).toFixed(2)}M GALA`);
// Display token count
console.log(`${stats.totalTokens} tokens on platform`);
// Display timestamp
const updated = new Date(stats.timestamp);
console.log(`Last updated: ${updated.toLocaleString()}`);
get stats platform result
setJwtAuth()
setJwtAuth(
jwtAuth):void
Set the JWT authentication manager. Allows dynamic configuration of JWT auth after service creation.
Parameters
| Parameter | Type | Description |
|---|---|---|
jwtAuth | JwtAuth | JWT auth manager instance |
Returns
void
Inherited from
BaseService.setJwtAuth
set jwt auth base service