Skip to content

Commit

Permalink
fix/miniapp: nft collection stats should not be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
stephancill authored and davidfurlong committed Oct 16, 2023
1 parent 489b7af commit a07a7ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions examples/api/src/app/api/open-graph/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,8 @@ export async function fetchNFTMetadata({
`https://api.opensea.io/api/v1/collection/${collectionSlug}/stats`,
authOptions
);
let collectionStats: any = {};
if (collectionStatsResponse.ok) {
collectionStats = await collectionStatsResponse.json();
}
// Collection stats should exist if the collection exists
const collectionStats = await collectionStatsResponse.json();

const fcUser = await fetchUserData(collectionData.owner);

Expand All @@ -150,8 +148,8 @@ export async function fetchNFTMetadata({
id: caip19Uri,
name: collectionData.name,
description: collectionData.description,
itemCount: collectionStats?.stats.count,
ownerCount: collectionStats?.stats.num_owners,
itemCount: collectionStats.stats.count,
ownerCount: collectionStats.stats.num_owners,
imageUrl: image,
mintUrl: mintUrl || collectionData.opensea_url,
openSeaUrl: collectionData.opensea_url,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/embeds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export type NFTMetadata = {
id: string;
name: string;
description: string;
itemCount?: number;
ownerCount?: number;
itemCount: number;
ownerCount: number;
imageUrl: string;
mintUrl: string;
openSeaUrl?: string;
Expand Down

2 comments on commit a07a7ff

@vercel
Copy link

@vercel vercel bot commented on a07a7ff Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

example-nextjs-shadcn – ./examples/nextjs-shadcn

mod-nextjs-shadcn.vercel.app
example-nextjs-shadcn-discove.vercel.app
example-nextjs-shadcn-git-main-discove.vercel.app
example-nextjs.modprotocol.org

@vercel
Copy link

@vercel vercel bot commented on a07a7ff Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./docs

docs-git-main-discove.vercel.app
docs-discove.vercel.app
docs-nu-wine.vercel.app
docs.modprotocol.org

Please sign in to comment.