Skip to main content

Class: WeeklyChallengeService

Gala Launchpad SDK 9.0.0-rc.5


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

Class: WeeklyChallengeService

Defined in: packages/launchpad-sdk/dist/services/WeeklyChallengeService.d.ts:49

Weekly Challenge Service Class

Provides methods for accessing the weekly challenge leaderboard:

  • Get current week's leaderboard (tokens ranked by market cap increase)
  • Get historical weekly snapshots for a specific token

Challenge Rules:

  • Week runs Saturday to Friday
  • Baseline is Saturday's snapshot
  • Ranking is by market cap increase (current - baseline)
  • Tokens with no baseline data (new this week) use previous week's latest snapshot

Public endpoint - no authentication required.

Example​

const wcService = new WeeklyChallengeService(httpClient, true);

// Get top 10 tokens in weekly challenge
const { leaderboard } = await wcService.getLeaderboard({ limit: 10 });
console.log(`Week: ${leaderboard.weekStart} to ${leaderboard.weekEnd}`);
for (const token of leaderboard.tokens) {
console.log(`#${token.rank} ${token.tokenName}: +${token.marketCapIncreaseGala} GALA`);
}

// Get historical data for a specific token
const { snapshots } = await wcService.getTokenHistory({
vaultAddress: 'eth|123...'
});
for (const snap of snapshots) {
console.log(`${snap.snapshotDate}: ${snap.marketCapGala} GALA`);
}

Extends​

  • BaseService

Constructors​

Constructor​

new WeeklyChallengeService(http, debugMode?): WeeklyChallengeService

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

Parameters​

http​

HttpClient

debugMode?​

boolean

Returns​

WeeklyChallengeService

Overrides​

BaseService.constructor

Methods​

getLeaderboard()​

getLeaderboard(options?): Promise<GetWeeklyChallengeResult>

Defined in: packages/launchpad-sdk/dist/services/WeeklyChallengeService.d.ts:81

Get weekly challenge leaderboard

Returns tokens ranked by market cap increase for the current week. Week runs Saturday to Friday.

Parameters​

options?​

GetWeeklyChallengeOptions

Optional parameters

Returns​

Promise<GetWeeklyChallengeResult>

Leaderboard with ranked tokens

Example​

// Get top 20 tokens
const { leaderboard } = await wcService.getLeaderboard({ limit: 20 });

// Display results
console.log(`Challenge week: ${leaderboard.weekStart} - ${leaderboard.weekEnd}`);
console.log(`Snapshot: ${leaderboard.snapshotDate}`);
console.log(`Total tokens: ${leaderboard.count}`);

for (const token of leaderboard.tokens) {
const increase = token.marketCapIncreaseGala.toLocaleString();
console.log(`${token.rank}. ${token.symbol} (+${increase} GALA)`);
}

getTokenHistory()​

getTokenHistory(options): Promise<GetTokenWeeklyHistoryResult>

Defined in: packages/launchpad-sdk/dist/services/WeeklyChallengeService.d.ts:112

Get token weekly history

Returns the last 4 weeks of snapshot data for a specific token. Useful for tracking a token's performance over time.

Parameters​

options​

GetTokenWeeklyHistoryOptions

Options with vault address

Returns​

Promise<GetTokenWeeklyHistoryResult>

Array of weekly snapshots

Example​

const { snapshots } = await wcService.getTokenHistory({
vaultAddress: 'eth|abc123...'
});

// Show weekly performance
for (const snap of snapshots) {
const date = new Date(snap.snapshotDate).toLocaleDateString();
console.log(`${date}: $${snap.marketCapUsd} (${snap.marketCapGala} GALA)`);
}

// Calculate week-over-week change
if (snapshots.length >= 2) {
const current = parseFloat(snapshots[0].marketCapGala);
const previous = parseFloat(snapshots[1].marketCapGala);
const change = ((current - previous) / previous * 100).toFixed(2);
console.log(`Week-over-week change: ${change}%`);
}

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