Leaderboards
The leaderboards resource provides access to platform-wide rankings, trending content, and discovery features.
Overview
Leaderboards help users discover content and track platform activity:
- Trending - Feeds with recent revenue growth
- Popular - Most purchased feeds by period
- Top Revenue - Highest earning feeds
- Top Feeds - Feeds with most entries
- Top Providers - Highest earning content creators
- Top Buyers - Most active purchasers
- Category Stats - Aggregated stats by category
- Recent Entries - Latest content across all feeds
Methods
| Method | Description | Period Filter |
|---|---|---|
| trending() | Feeds with revenue velocity | No |
| mostPopular() | Most purchased feeds | Yes |
| topRevenue() | Highest revenue feeds | Yes |
| topFeeds() | Most entries feeds | No |
| topProviders() | Top earning creators | Yes |
| topBuyers() | Most active buyers | Yes |
| categoryStats() | Stats by category | No |
| recentEntries() | Latest entries | No |
Quick Examples
import { GrapevineClient } from '@pinata/grapevine-sdk';
const grapevine = new GrapevineClient({ network: 'testnet' });
// Get trending feeds
const trending = await grapevine.leaderboards.trending({ page_size: 10 });
console.log('Trending feeds:', trending.data.map(f => f.name));
// Get most popular feeds in last 7 days
const popular = await grapevine.leaderboards.mostPopular({
period: '7d',
page_size: 10
});
// Get top providers by revenue
const topProviders = await grapevine.leaderboards.topProviders({
period: '30d'
});
// Get category statistics
const categories = await grapevine.leaderboards.categoryStats();
// Get recent entries across all feeds
const recent = await grapevine.leaderboards.recentEntries({ page_size: 20 });Period Filters
Methods that support period filtering accept these values:
type LeaderboardPeriod = '1d' | '7d' | '30d' | 'all';| Period | Description |
|---|---|
1d | Last 24 hours |
7d | Last 7 days |
30d | Last 30 days |
all | All time (default) |
Types
TrendingFeed
interface TrendingFeed {
rank: string;
id: string;
owner_id: string;
owner_wallet: string;
owner_username?: string | null;
category_id?: string | null;
category_name?: string | null;
name: string;
description?: string | null;
image_cid?: string | null;
is_active: boolean;
total_entries: number;
total_purchases: number;
total_revenue: string;
tags?: string[] | null;
created_at: number;
updated_at: number;
purchases_last_7d: string;
revenue_last_7d: string;
unique_buyers_last_7d: string;
}PopularFeed
interface PopularFeed {
rank: string;
feed_id: string;
feed_name: string;
owner_id: string;
owner_username?: string | null;
owner_wallet: string;
category_id?: string | null;
category_name: string;
description?: string | null;
image_cid?: string | null;
is_active: boolean;
tags?: string[] | null;
total_entries: number;
total_purchases: string;
total_revenue: string;
unique_buyers: string;
avg_revenue_per_purchase?: string | null;
created_at: number;
updated_at: number;
}TopProvider
interface TopProvider {
rank: string;
user_id: string;
username?: string | null;
wallet_address: string;
total_feeds: string;
total_entries: string;
total_purchases: string;
total_revenue: string;
unique_buyers: string;
joined_at: number;
}TopBuyer
interface TopBuyer {
rank: string;
user_id: string;
username?: string | null;
wallet_address: string;
total_purchases: string;
total_spent: string;
unique_entries_purchased: string;
unique_feeds_purchased_from: string;
joined_at: number;
}CategoryStats
interface CategoryStats {
category_id: string;
category_name: string;
category_description: string | null;
category_icon_url: string | null;
total_feeds: string;
total_providers: string;
total_entries: string;
total_purchases: string;
total_revenue: string;
unique_buyers: string;
avg_purchase_amount: string;
}RecentEntry
interface RecentEntry {
id: string;
feed_id: string;
cid: string;
mime_type: string;
title?: string | null;
description?: string | null;
metadata?: string | null;
tags?: string[] | null;
price: string;
asset: string;
is_free: boolean;
expires_at?: number | null;
piid?: string | null;
feed_name: string;
feed_owner_id: string;
owner_wallet: string;
category_name: string;
created_at: number;
updated_at: number;
}Use Cases
Homepage Discovery
async function getHomepageData() {
const [trending, recent, topProviders] = await Promise.all([
grapevine.leaderboards.trending({ page_size: 6 }),
grapevine.leaderboards.recentEntries({ page_size: 12 }),
grapevine.leaderboards.topProviders({ period: '7d', page_size: 5 })
]);
return {
trendingFeeds: trending.data,
latestContent: recent.data,
featuredCreators: topProviders.data
};
}Category Browser
async function getCategoryOverview() {
const stats = await grapevine.leaderboards.categoryStats();
return stats.data.map(cat => ({
id: cat.category_id,
name: cat.category_name,
description: cat.category_description,
feedCount: parseInt(cat.total_feeds),
totalRevenue: formatUSDC(cat.total_revenue),
avgPrice: formatUSDC(cat.avg_purchase_amount)
}));
}User Rankings
async function getUserRankings(walletAddress: string) {
const [providers, buyers] = await Promise.all([
grapevine.leaderboards.topProviders({ page_size: 100 }),
grapevine.leaderboards.topBuyers({ page_size: 100 })
]);
const providerRank = providers.data.findIndex(
p => p.wallet_address === walletAddress
);
const buyerRank = buyers.data.findIndex(
b => b.wallet_address === walletAddress
);
return {
providerRank: providerRank >= 0 ? providerRank + 1 : null,
buyerRank: buyerRank >= 0 ? buyerRank + 1 : null
};
}Related
- API Leaderboards Reference - REST API documentation
- Feeds - Browse all feeds
- Categories - Category management