File tree Expand file tree Collapse file tree 3 files changed +1098
-111
lines changed
src/server/routes/contract/extensions/erc721/read Expand file tree Collapse file tree 3 files changed +1098
-111
lines changed Original file line number Diff line number Diff line change 43
43
"@prisma/client" : " 5.2.0" ,
44
44
"@sinclair/typebox" : " ^0.31.28" ,
45
45
"@t3-oss/env-core" : " ^0.6.0" ,
46
- "@thirdweb-dev/auth" : " ^4.1.0-nightly-c238fde8-20231020022304 " ,
46
+ "@thirdweb-dev/auth" : " ^4.1.27 " ,
47
47
"@thirdweb-dev/chains" : " ^0.1.65" ,
48
- "@thirdweb-dev/sdk" : " ^4.0.23 " ,
48
+ "@thirdweb-dev/sdk" : " ^4.0.30 " ,
49
49
"@thirdweb-dev/service-utils" : " ^0.4.2" ,
50
50
"@thirdweb-dev/wallets" : " ^2.1.5" ,
51
51
"body-parser" : " ^1.20.2" ,
Original file line number Diff line number Diff line change @@ -73,6 +73,14 @@ export async function erc721GetOwned(fastify: FastifyInstance) {
73
73
chainId,
74
74
contractAddress,
75
75
} ) ;
76
+ // Check if the wallet has any tokens before querying getOwned
77
+ const balance = await contract . erc721 . balanceOf ( walletAddress ) ;
78
+ if ( balance . eq ( 0 ) ) {
79
+ reply . status ( StatusCodes . OK ) . send ( {
80
+ result : [ ] ,
81
+ } ) ;
82
+ return ;
83
+ }
76
84
const result = await contract . erc721 . getOwned ( walletAddress ) ;
77
85
reply . status ( StatusCodes . OK ) . send ( {
78
86
result,
You can’t perform that action at this time.
0 commit comments