File tree Expand file tree Collapse file tree 5 files changed +23
-6
lines changed
apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]
packages/thirdweb/src/extensions Expand file tree Collapse file tree 5 files changed +23
-6
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " thirdweb " : patch
3+ ---
4+
5+ Fallback to insight response if RPC request fails in ERC721 & ERC1155 ` getNFTs ` extension
Original file line number Diff line number Diff line change @@ -237,7 +237,7 @@ export const MarketplaceTable: React.FC<MarketplaceTableProps> = ({
237237 </ Th >
238238 ) ) }
239239 { /* // Need to add an empty header for the drawer button */ }
240- < Th border = "none" />
240+ < Th border = "none" key = "drawer" />
241241 </ Tr >
242242 ) ) }
243243 </ Thead >
Original file line number Diff line number Diff line change @@ -278,7 +278,7 @@ export const NFTGetAllTable: React.FC<ContractOverviewNFTGetAllProps> = ({
278278 </ Th >
279279 ) ) }
280280 { /* Need to add an empty header for the drawer button */ }
281- < Th border = "none" />
281+ < Th border = "none" key = "drawer" />
282282 </ Tr >
283283 ) ) }
284284 </ Thead >
Original file line number Diff line number Diff line change @@ -84,8 +84,14 @@ async function getNFTsFromInsight(
8484 Math . max ( 0 , Number ( supply ) - currentOffset ) ,
8585 ) ;
8686 if ( result . length < expectedResultLength ) {
87- // fresh contracts might be delayed in indexing, so we fallback to RPC
88- return getNFTsFromRPC ( options ) ;
87+ try {
88+ // fresh contracts might be delayed in indexing, so we fallback to RPC
89+ // must use await here
90+ return await getNFTsFromRPC ( options ) ;
91+ } catch {
92+ // if RPC fails, we return the result from insight
93+ return result ;
94+ }
8995 }
9096 return result ;
9197}
Original file line number Diff line number Diff line change @@ -132,8 +132,14 @@ async function getNFTsFromInsight(
132132 ) ,
133133 ) ;
134134 if ( result . length < expectedResultLength ) {
135- // fresh contracts might be delayed in indexing, so we fallback to RPC
136- return getNFTsFromRPC ( options ) ;
135+ try {
136+ // fresh contracts might be delayed in indexing, so we fallback to RPC
137+ // must use await here
138+ return await getNFTsFromRPC ( options ) ;
139+ } catch {
140+ // if RPC fails, we return the result from insight
141+ return result ;
142+ }
137143 }
138144
139145 return result ;
You can’t perform that action at this time.
0 commit comments