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> = ({
237
237
</ Th >
238
238
) ) }
239
239
{ /* // Need to add an empty header for the drawer button */ }
240
- < Th border = "none" />
240
+ < Th border = "none" key = "drawer" />
241
241
</ Tr >
242
242
) ) }
243
243
</ Thead >
Original file line number Diff line number Diff line change @@ -278,7 +278,7 @@ export const NFTGetAllTable: React.FC<ContractOverviewNFTGetAllProps> = ({
278
278
</ Th >
279
279
) ) }
280
280
{ /* Need to add an empty header for the drawer button */ }
281
- < Th border = "none" />
281
+ < Th border = "none" key = "drawer" />
282
282
</ Tr >
283
283
) ) }
284
284
</ Thead >
Original file line number Diff line number Diff line change @@ -84,8 +84,14 @@ async function getNFTsFromInsight(
84
84
Math . max ( 0 , Number ( supply ) - currentOffset ) ,
85
85
) ;
86
86
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
+ }
89
95
}
90
96
return result ;
91
97
}
Original file line number Diff line number Diff line change @@ -132,8 +132,14 @@ async function getNFTsFromInsight(
132
132
) ,
133
133
) ;
134
134
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
+ }
137
143
}
138
144
139
145
return result ;
You can’t perform that action at this time.
0 commit comments