Skip to content

feeds.myFeeds()

Get a list of feeds owned by the authenticated wallet.

Signature

feeds.myFeeds(): Promise<PaginatedResponse<Feed>>

Parameters

This method takes no parameters.

Returns

  • Type: Promise<PaginatedResponse<Feed>>
interface PaginatedResponse<Feed> {
  data: Feed[];
  next_page_token?: string;
  has_more: boolean;
}

Usage

Basic Example

// Get your feeds
const myFeeds = await grapevine.feeds.myFeeds();
 
console.log(`You have ${myFeeds.data.length} feeds`);
myFeeds.data.forEach(feed => {
  console.log(`${feed.name}: ${feed.total_entries} entries, ${feed.total_revenue} revenue`);
});

Filtering Results

// Get all feeds and filter by status
const allMyFeeds = await grapevine.feeds.myFeeds();
 
const active = allMyFeeds.data.filter(f => f.is_active);
const inactive = allMyFeeds.data.filter(f => !f.is_active);
 
console.log(`Active: ${active.length}, Inactive: ${inactive.length}`);

With Pagination

// Get all your feeds with pagination using feeds.list()
async function getAllMyFeeds() {
  const allFeeds: Feed[] = [];
  
  // First get the wallet ID from the wallet address
  const wallet = await grapevine.wallets.getByAddress(grapevine.getWalletAddress());
  let pageToken: string | undefined;
  
  do {
    const response = await grapevine.feeds.list({
      owner_id: wallet.id,  // Use owner_id, not wallet address
      page_size: 50,
      page_token: pageToken
    });
    
    allFeeds.push(...response.data);
    pageToken = response.next_page_token;
  } while (pageToken);
  
  return allFeeds;
}
 
// Or use the paginate helper
for await (const batch of grapevine.feeds.paginate({ owner_id: wallet.id }, 50)) {
  // Process each batch
}

Feed Statistics

const myFeeds = await grapevine.feeds.myFeeds();
 
// Calculate total statistics
const stats = myFeeds.data.reduce((acc, feed) => ({
  totalEntries: acc.totalEntries + feed.total_entries,
  totalPurchases: acc.totalPurchases + feed.total_purchases,
  totalRevenue: acc.totalRevenue + parseFloat(feed.total_revenue)
}), { totalEntries: 0, totalPurchases: 0, totalRevenue: 0 });
 
console.log('Portfolio Statistics:', stats);

Behind the Scenes

This method:

  1. Gets authentication headers (nonce + signature)
  2. Makes GET request to /v1/feeds with owner filter
  3. Automatically filters by authenticated wallet
  4. Returns only feeds you own

Error Handling

try {
  const myFeeds = await grapevine.feeds.myFeeds();
  console.log(`Found ${myFeeds.data.length} feeds`);
} catch (error) {
  if (error.message.includes('401')) {
    console.error('Authentication required');
  } else {
    console.error('Error:', error.message);
  }
}

Notes

  • Authentication: Required - uses private key from client config
  • Ownership: Only returns feeds owned by authenticated wallet
  • Filtering: Returns all feeds (active and inactive) - filter client-side if needed
  • Limit: Maximum 10 feeds per wallet on testnet

Related