File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed
Assets/Thirdweb/Core/Scripts Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,6 @@ public async Task<List<NFT>> GetAll(QueryAllParams queryParams = null)
92
92
start = 0 ;
93
93
end = totalCount - 1 ;
94
94
}
95
- // TODO: Add Multicall
96
95
List < NFT > allNfts = new List < NFT > ( ) ;
97
96
for ( int i = start ; i <= end ; i ++ )
98
97
allNfts . Add ( await Get ( i . ToString ( ) ) ) ;
@@ -113,7 +112,6 @@ public async Task<List<NFT>> GetOwned(string address = null)
113
112
else
114
113
{
115
114
string owner = address == null ? await ThirdwebManager . Instance . SDK . wallet . GetAddress ( ) : address ;
116
- // TODO: Add Multicall
117
115
int totalCount = await TotalCount ( ) ;
118
116
List < NFT > ownedNfts = new List < NFT > ( ) ;
119
117
for ( int i = 0 ; i < totalCount ; i ++ )
Original file line number Diff line number Diff line change @@ -113,12 +113,12 @@ public async Task<List<NFT>> GetOwned(string address = null)
113
113
else
114
114
{
115
115
string owner = address == null ? await ThirdwebManager . Instance . SDK . wallet . GetAddress ( ) : address ;
116
+ var balanceOfOwner = int . Parse ( await BalanceOf ( owner ) ) ;
117
+ List < NFT > ownedNfts = new List < NFT > ( ) ;
116
118
117
119
try
118
120
{
119
121
// ERC721Enumerable
120
- var balanceOfOwner = int . Parse ( await BalanceOf ( owner ) ) ;
121
- List < NFT > ownedNfts = new List < NFT > ( ) ;
122
122
for ( int i = 0 ; i < balanceOfOwner ; i ++ )
123
123
{
124
124
var tokenId = await TransactionManager . ThirdwebRead < TokenERC721Contract . TokenOfOwnerByIndexFunction , TokenERC721Contract . TokenOfOwnerByIndexOutputDTO > (
@@ -129,16 +129,17 @@ public async Task<List<NFT>> GetOwned(string address = null)
129
129
}
130
130
return ownedNfts ;
131
131
}
132
- catch ( System . Exception )
132
+ catch
133
133
{
134
134
// ERC721 totalSupply
135
135
var count = await TotalCount ( ) ;
136
- List < NFT > ownedNfts = new List < NFT > ( ) ;
137
136
for ( int i = 0 ; i < count ; i ++ )
138
137
{
139
138
if ( await OwnerOf ( i . ToString ( ) ) == owner )
140
139
{
141
140
ownedNfts . Add ( await Get ( i . ToString ( ) ) ) ;
141
+ if ( ownedNfts . Count == balanceOfOwner )
142
+ break ;
142
143
}
143
144
}
144
145
return ownedNfts ;
You can’t perform that action at this time.
0 commit comments