Skip to main content

Class: PlatformStatsService

Gala Launchpad SDK 9.0.0-rc.5


Gala Launchpad SDK 9.0.0-rc.5 / index / PlatformStatsService

Class: PlatformStatsService

Defined in: packages/launchpad-sdk/dist/services/PlatformStatsService.d.ts:38

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

Constructors​

Constructor​

new PlatformStatsService(http, debugMode?): PlatformStatsService

Defined in: packages/launchpad-sdk/dist/services/PlatformStatsService.d.ts:39

Parameters​

http​

HttpClient

debugMode?​

boolean

Returns​

PlatformStatsService

Overrides​

BaseService.constructor

Methods​

getStats()​

getStats(): Promise<GetPlatformStatsResult>

Defined in: packages/launchpad-sdk/dist/services/PlatformStatsService.d.ts:69

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()}`);

setJwtAuth()​

setJwtAuth(jwtAuth): void

Defined in: packages/launchpad-sdk/dist/services/BaseService.d.ts:50

Set the JWT authentication manager. Allows dynamic configuration of JWT auth after service creation.

Parameters​

jwtAuth​

JwtAuth

JWT auth manager instance

Returns​

void

Inherited from​

BaseService.setJwtAuth