File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
examples/api/src/app/api/open-graph/lib Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -121,10 +121,8 @@ export async function fetchNFTMetadata({
121
121
`https://api.opensea.io/api/v1/collection/${ collectionSlug } /stats` ,
122
122
authOptions
123
123
) ;
124
- let collectionStats : any = { } ;
125
- if ( collectionStatsResponse . ok ) {
126
- collectionStats = await collectionStatsResponse . json ( ) ;
127
- }
124
+ // Collection stats should exist if the collection exists
125
+ const collectionStats = await collectionStatsResponse . json ( ) ;
128
126
129
127
const fcUser = await fetchUserData ( collectionData . owner ) ;
130
128
@@ -150,8 +148,8 @@ export async function fetchNFTMetadata({
150
148
id : caip19Uri ,
151
149
name : collectionData . name ,
152
150
description : collectionData . description ,
153
- itemCount : collectionStats ? .stats . count ,
154
- ownerCount : collectionStats ? .stats . num_owners ,
151
+ itemCount : collectionStats . stats . count ,
152
+ ownerCount : collectionStats . stats . num_owners ,
155
153
imageUrl : image ,
156
154
mintUrl : mintUrl || collectionData . opensea_url ,
157
155
openSeaUrl : collectionData . opensea_url ,
Original file line number Diff line number Diff line change @@ -29,8 +29,8 @@ export type NFTMetadata = {
29
29
id : string ;
30
30
name : string ;
31
31
description : string ;
32
- itemCount ? : number ;
33
- ownerCount ? : number ;
32
+ itemCount : number ;
33
+ ownerCount : number ;
34
34
imageUrl : string ;
35
35
mintUrl : string ;
36
36
openSeaUrl ?: string ;
You can’t perform that action at this time.
0 commit comments