Skip to content

Commit 2010084

Browse files
authored
ERC721_TotalSupply Include Burned NFTs (#112)
1 parent 79f6f92 commit 2010084

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,19 @@ public static async Task<List<BigInteger>> ERC721A_TokensOfOwnerIn(this Thirdweb
651651
/// <exception cref="ArgumentNullException">Thrown when the contract is null.</exception>
652652
public static async Task<BigInteger> ERC721_TotalSupply(this ThirdwebContract contract)
653653
{
654-
return contract == null ? throw new ArgumentNullException(nameof(contract)) : await ThirdwebContract.Read<BigInteger>(contract, "totalSupply");
654+
if (contract == null)
655+
{
656+
throw new ArgumentNullException(nameof(contract));
657+
}
658+
659+
try
660+
{
661+
return await ThirdwebContract.Read<BigInteger>(contract, "nextTokenIdToMint");
662+
}
663+
catch
664+
{
665+
return await ThirdwebContract.Read<BigInteger>(contract, "totalSupply");
666+
}
655667
}
656668

657669
/// <summary>

0 commit comments

Comments
 (0)