Skip to main content

Leaderboard

Methods for retrieving leaderboard information.

getTopUsers

Gets the top users on the leaderboard.
async getTopUsers(limit: number): Promise<LeaderboardUser[]>

Parameters

NameTypeDescription
limitnumberMaximum number of users to return

Returns

Array of LeaderboardUser objects.

Example

const topUsers = await sdk.getTopUsers(10);
topUsers.forEach(user => {
  console.log(`Rank ${user.rank}: ${user.address}`);
  console.log(`Referrals: ${user.referralCount}, Earnings: ${user.totalEarnings}`);
});

getUserRank

Gets a user’s rank on the leaderboard.
async getUserRank(userAddress: Address): Promise<number>

Parameters

NameTypeDescription
userAddressAddressAddress of the user

Returns

number - User’s rank (1-indexed).

Example

const rank = await sdk.getUserRank('0x1234...');
console.log('Your rank:', rank);

getLeaderboardStats

Gets statistics about the leaderboard system.
async getLeaderboardStats(): Promise<LeaderboardStats>

Returns

LeaderboardStats object containing leaderboard statistics.

Example

const stats = await sdk.getLeaderboardStats();
console.log('Total users:', stats.totalUsers);
console.log('Total referrals:', stats.totalReferrals);