Skip to main content

Overview

Use batch APIs to query multiple users or perform bulk operations efficiently.

Implementation

// Batch get scores
async function getLeaderboard(addresses) {
  const scores = await Promise.all(
    addresses.map(addr => zkScore.getScore(addr))
  );
  
  return addresses.map((addr, i) => ({
    address: addr,
    score: scores[i].total
  })).sort((a, b) => b.score - a.score);
}