// Get metadata for a specific badge
const badgeMetadata = collection.getBadgeMetadata(1n);
// Get collection-level metadata
const collectionMetadata = collection.getCollectionMetadata();
Checking Balances
// Get total supply
const totalSupply = collection.getBadgeBalances('Total');
// Get specific address balance
const userBalance = collection.getBadgeBalances('bb1234...');
// Get full balance info including approvals
const balanceInfo = collection.getBadgeBalanceInfo('bb1234...');
Pagination and Views
Views are used to fetch paginated data like transfer history and owner lists. Each view uses a bookmark system for pagination.
// Fetch owners with pagination
const viewRequest = {
viewType: 'owners',
viewId: 'owners-list',
bookmark: '', // Empty for first page
};
// Fetch first page
await collection.fetchNextForView(BitBadgesApi, 'owners', 'owners-list');
// Check if more pages exist
const hasMore = collection.viewHasMore('owners-list');
// Get next bookmark
const nextBookmark = collection.getViewBookmark('owners-list');
Content Warnings
Collections can be flagged as NSFW or reported. These flags will be present in the response: