From 4a7ea6bd9d8c1e28dc352c72ec38186bd190f86d Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Wed, 6 Nov 2024 01:14:13 +0700 Subject: [PATCH] Fix TokenERC721_MintTo invalid signature --- .../Thirdweb.Extensions/ThirdwebExtensions.cs | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.cs b/Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.cs index e5b4b60c..2b114dba 100644 --- a/Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.cs +++ b/Thirdweb/Thirdweb.Extensions/ThirdwebExtensions.cs @@ -1953,13 +1953,12 @@ public static async Task TokenERC20_VerifyMintSignature(this Third /// The contract to interact with. /// The wallet to use for the transaction. /// The address of the receiver. - /// The ID of the token. /// The URI of the token metadata. /// A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result. /// Thrown when the contract or wallet is null. /// Thrown when the receiver address or URI is null or empty. /// Thrown when the token ID is less than 0. - public static async Task TokenERC721_MintTo(this ThirdwebContract contract, IThirdwebWallet wallet, string receiverAddress, BigInteger tokenId, string uri) + public static async Task TokenERC721_MintTo(this ThirdwebContract contract, IThirdwebWallet wallet, string receiverAddress, string uri) { if (contract == null) { @@ -1976,12 +1975,7 @@ public static async Task TokenERC721_MintTo(this Thi throw new ArgumentException("Receiver address must be provided"); } - if (tokenId < 0) - { - throw new ArgumentOutOfRangeException(nameof(tokenId), "Token ID must be equal or greater than 0"); - } - - return uri == null ? throw new ArgumentException("URI must be provided") : await ThirdwebContract.Write(wallet, contract, "mintTo", 0, receiverAddress, tokenId, uri); + return uri == null ? throw new ArgumentException("URI must be provided") : await ThirdwebContract.Write(wallet, contract, "mintTo", 0, receiverAddress, uri); } /// @@ -1990,13 +1984,12 @@ public static async Task TokenERC721_MintTo(this Thi /// The contract to interact with. /// The wallet to use for the transaction. /// The address of the receiver. - /// The ID of the token. /// The metadata of the token. /// A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result. /// Thrown when the contract or wallet is null. /// Thrown when the receiver address is null or empty. /// Thrown when the token ID is less than 0. - public static async Task TokenERC721_MintTo(this ThirdwebContract contract, IThirdwebWallet wallet, string receiverAddress, BigInteger tokenId, NFTMetadata metadata) + public static async Task TokenERC721_MintTo(this ThirdwebContract contract, IThirdwebWallet wallet, string receiverAddress, NFTMetadata metadata) { if (contract == null) { @@ -2013,18 +2006,13 @@ public static async Task TokenERC721_MintTo(this Thi throw new ArgumentException("Receiver address must be provided"); } - if (tokenId < 0) - { - throw new ArgumentOutOfRangeException(nameof(tokenId), "Token ID must be equal or greater than 0"); - } - var json = JsonConvert.SerializeObject(metadata); var jsonBytes = System.Text.Encoding.UTF8.GetBytes(json); var ipfsResult = await ThirdwebStorage.UploadRaw(contract.Client, jsonBytes); - return await ThirdwebContract.Write(wallet, contract, "mintTo", 0, receiverAddress, tokenId, $"ipfs://{ipfsResult.IpfsHash}"); + return await ThirdwebContract.Write(wallet, contract, "mintTo", 0, receiverAddress, $"ipfs://{ipfsResult.IpfsHash}"); } ///