@@ -1220,13 +1220,19 @@ public static async Task<BigInteger> ERC1155_TotalSupply(this ThirdwebContract c
1220
1220
/// <param name="fillOwner">A boolean indicating whether to fill the owner details. Defaults to true.</param>
1221
1221
/// <returns>A task representing the asynchronous operation, with an NFT result containing the token details.</returns>
1222
1222
/// <exception cref="ArgumentNullException">Thrown when the contract is null.</exception>
1223
+ /// <exception cref="ArgumentOutOfRangeException">Thrown when the token ID is less than 0.</exception>
1223
1224
public static async Task < NFT > ERC721_GetNFT ( this ThirdwebContract contract , BigInteger tokenId , bool fillOwner = true )
1224
1225
{
1225
1226
if ( contract == null )
1226
1227
{
1227
1228
throw new ArgumentNullException ( nameof ( contract ) ) ;
1228
1229
}
1229
1230
1231
+ if ( tokenId < 0 )
1232
+ {
1233
+ throw new ArgumentOutOfRangeException ( nameof ( tokenId ) , "Token ID must be equal or greater than 0" ) ;
1234
+ }
1235
+
1230
1236
var nft = new NFT
1231
1237
{
1232
1238
Owner = Constants . ADDRESS_ZERO ,
@@ -1379,13 +1385,19 @@ public static async Task<List<NFT>> ERC721_GetOwnedNFTs(this ThirdwebContract co
1379
1385
/// <param name="fillSupply">A boolean indicating whether to fill the supply. Defaults to true if not specified.</param>
1380
1386
/// <returns>A task representing the asynchronous operation, with an NFT result containing the token details.</returns>
1381
1387
/// <exception cref="ArgumentNullException">Thrown when the contract is null.</exception>
1388
+ /// <exception cref="ArgumentOutOfRangeException">Thrown when the token ID is less than 0.</exception>
1382
1389
public static async Task < NFT > ERC1155_GetNFT ( this ThirdwebContract contract , BigInteger tokenId , bool fillSupply = true )
1383
1390
{
1384
1391
if ( contract == null )
1385
1392
{
1386
1393
throw new ArgumentNullException ( nameof ( contract ) ) ;
1387
1394
}
1388
1395
1396
+ if ( tokenId < 0 )
1397
+ {
1398
+ throw new ArgumentOutOfRangeException ( nameof ( tokenId ) , "Token ID must be equal or greater than 0" ) ;
1399
+ }
1400
+
1389
1401
var uri = await contract . ERC1155_URI ( tokenId ) . ConfigureAwait ( false ) ;
1390
1402
NFTMetadata metadata ;
1391
1403
try
0 commit comments