Skip to content

Commit

Permalink
ERC721_TotalSupply Include Burned NFTs
Browse files Browse the repository at this point in the history
  • Loading branch information
0xFirekeeper committed Dec 25, 2024
1 parent 79f6f92 commit b971fa5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,19 @@ public static async Task<List<BigInteger>> ERC721A_TokensOfOwnerIn(this Thirdweb
/// <exception cref="ArgumentNullException">Thrown when the contract is null.</exception>
public static async Task<BigInteger> ERC721_TotalSupply(this ThirdwebContract contract)
{
return contract == null ? throw new ArgumentNullException(nameof(contract)) : await ThirdwebContract.Read<BigInteger>(contract, "totalSupply");
if (contract == null)
{
throw new ArgumentNullException(nameof(contract));
}

try
{
return await ThirdwebContract.Read<BigInteger>(contract, "nextTokenIdToMint");
}
catch
{
return await ThirdwebContract.Read<BigInteger>(contract, "totalSupply");
}
}

/// <summary>
Expand Down

0 comments on commit b971fa5

Please sign in to comment.