Class ThirdwebExtensions
- Namespace
- Thirdweb
- Assembly
- Thirdweb.dll
public static class ThirdwebExtensions
- Inheritance
-
ThirdwebExtensions
- Inherited Members
Methods
Authenticate<T>(IThirdwebWallet, string, BigInteger, string, string, string, string, bool, IThirdwebHttpClient)
Authenticates the wallet.
public static Task<T> Authenticate<T>(this IThirdwebWallet wallet, string domain, BigInteger chainId, string authPayloadPath = "/auth/payload", string authLoginPath = "/auth/login", string authPayloadMethod = "GET", string authLoginMethod = "POST", bool separatePayloadAndSignatureInBody = false, IThirdwebHttpClient httpClientOverride = null)
Parameters
walletIThirdwebWalletThe wallet that will sign the SIWE payload.
domainstringThe authentication domain.
chainIdBigIntegerThe chain ID.
authPayloadPathstringThe authentication payload path.
authLoginPathstringThe authentication login path.
authPayloadMethodstringThe authentication payload method.
authLoginMethodstringThe authentication login method.
separatePayloadAndSignatureInBodyboolWhether to separate the payload and signature in the body.
httpClientOverrideIThirdwebHttpClientThe HTTP client override.
Returns
- Task<T>
The authentication result.
Type Parameters
T
CreateCallData(ThirdwebContract, string, params object[])
Encodes the function call for the specified method and parameters.
public static string CreateCallData(this ThirdwebContract contract, string method, params object[] parameters)
Parameters
contractThirdwebContractThe contract instance.
methodstringThe method to call.
parametersobject[]The parameters for the method.
Returns
- string
The generated calldata.
DropER721_Burn(ThirdwebContract, IThirdwebWallet, BigInteger)
Burn a specific ERC721 token with a given token ID.
public static Task<ThirdwebTransactionReceipt> DropER721_Burn(this ThirdwebContract contract, IThirdwebWallet wallet, BigInteger tokenId)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
tokenIdBigIntegerThe ID of the token to burn.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0.
DropERC1155_BurnBatch(ThirdwebContract, IThirdwebWallet, string, BigInteger[], BigInteger[])
Burn a specific quantity of ERC1155 tokens for a specific account with given token IDs and amounts to burn.
public static Task<ThirdwebTransactionReceipt> DropERC1155_BurnBatch(this ThirdwebContract contract, IThirdwebWallet wallet, string account, BigInteger[] tokenIds, BigInteger[] amounts)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
accountstringThe address of the account to burn the tokens from.
tokenIdsBigInteger[]The IDs of the tokens to burn.
amountsBigInteger[]The amounts of tokens to burn.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract, wallet, or account is null.
- ArgumentException
Thrown when the account is null or empty, or the token IDs or amounts are null or empty, or the token IDs and amounts have different lengths.
- ArgumentOutOfRangeException
Thrown when the token IDs or amounts have a length less than or equal to 0.
- ArgumentException
Thrown when the token IDs and amounts have different lengths.
DropERC1155_Claim(ThirdwebContract, IThirdwebWallet, string, BigInteger, BigInteger)
Claim a specific quantity of ERC1155 tokens for a receiver.
public static Task<ThirdwebTransactionReceipt> DropERC1155_Claim(this ThirdwebContract contract, IThirdwebWallet wallet, string receiverAddress, BigInteger tokenId, BigInteger quantity)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
receiverAddressstringThe address of the receiver.
tokenIdBigIntegerThe ID of the token.
quantityBigIntegerThe quantity of tokens to claim.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentException
Thrown when the receiver address is null or empty.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0 or the quantity is less than or equal to 0.
DropERC1155_GetActiveClaimCondition(ThirdwebContract, BigInteger)
Get the details of the active claim condition for a specific ERC1155 token.
public static Task<Drop_ClaimCondition> DropERC1155_GetActiveClaimCondition(this ThirdwebContract contract, BigInteger tokenId)
Parameters
contractThirdwebContractThe contract to interact with.
tokenIdBigIntegerThe ID of the token.
Returns
- Task<Drop_ClaimCondition>
A task representing the asynchronous operation, with a Drop_ClaimCondition result containing the active claim condition details.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0.
DropERC1155_GetActiveClaimConditionId(ThirdwebContract, BigInteger)
Get the active claim condition ID for a specific ERC1155 token.
public static Task<BigInteger> DropERC1155_GetActiveClaimConditionId(this ThirdwebContract contract, BigInteger tokenId)
Parameters
contractThirdwebContractThe contract to interact with.
tokenIdBigIntegerThe ID of the token.
Returns
- Task<BigInteger>
A task representing the asynchronous operation, with a BigInteger result containing the active claim condition ID.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0.
DropERC1155_GetClaimConditionById(ThirdwebContract, BigInteger, BigInteger)
Get the claim condition details for a specific claim condition ID of a specific ERC1155 token.
public static Task<Drop_ClaimCondition> DropERC1155_GetClaimConditionById(this ThirdwebContract contract, BigInteger tokenId, BigInteger claimConditionId)
Parameters
contractThirdwebContractThe contract to interact with.
tokenIdBigIntegerThe ID of the token.
claimConditionIdBigIntegerThe ID of the claim condition.
Returns
- Task<Drop_ClaimCondition>
A task representing the asynchronous operation, with a Drop_ClaimCondition result containing the claim condition details.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentOutOfRangeException
Thrown when the token ID or claim condition ID is less than 0.
DropERC20_Claim(ThirdwebContract, IThirdwebWallet, string, string)
Claim a specific amount of ERC20 tokens for a receiver.
public static Task<ThirdwebTransactionReceipt> DropERC20_Claim(this ThirdwebContract contract, IThirdwebWallet wallet, string receiverAddress, string amount)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
receiverAddressstringThe address of the receiver.
amountstringThe amount of tokens to claim.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentException
Thrown when the receiver address or amount is null or empty.
DropERC20_GetActiveClaimCondition(ThirdwebContract)
Get the details of the active claim condition for the ERC20 drop.
public static Task<Drop_ClaimCondition> DropERC20_GetActiveClaimCondition(this ThirdwebContract contract)
Parameters
contractThirdwebContractThe contract to interact with.
Returns
- Task<Drop_ClaimCondition>
A task representing the asynchronous operation, with a Drop_ClaimCondition result containing the active claim condition details.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
DropERC20_GetActiveClaimConditionId(ThirdwebContract)
Get the active claim condition ID for the ERC20 drop.
public static Task<BigInteger> DropERC20_GetActiveClaimConditionId(this ThirdwebContract contract)
Parameters
contractThirdwebContractThe contract to interact with.
Returns
- Task<BigInteger>
A task representing the asynchronous operation, with a BigInteger result containing the active claim condition ID.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
DropERC20_GetClaimConditionById(ThirdwebContract, BigInteger)
Get the claim condition details for a specific claim condition ID.
public static Task<Drop_ClaimCondition> DropERC20_GetClaimConditionById(this ThirdwebContract contract, BigInteger claimConditionId)
Parameters
contractThirdwebContractThe contract to interact with.
claimConditionIdBigIntegerThe ID of the claim condition.
Returns
- Task<Drop_ClaimCondition>
A task representing the asynchronous operation, with a Drop_ClaimCondition result containing the claim condition details.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentOutOfRangeException
Thrown when the claim condition ID is less than 0.
DropERC721_Claim(ThirdwebContract, IThirdwebWallet, string, BigInteger)
Claim a specific quantity of ERC721 tokens for a receiver.
public static Task<ThirdwebTransactionReceipt> DropERC721_Claim(this ThirdwebContract contract, IThirdwebWallet wallet, string receiverAddress, BigInteger quantity)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
receiverAddressstringThe address of the receiver.
quantityBigIntegerThe quantity of tokens to claim.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentException
Thrown when the receiver address is null or empty.
- ArgumentOutOfRangeException
Thrown when the quantity is less than or equal to 0.
DropERC721_GetActiveClaimCondition(ThirdwebContract)
Get the details of the active claim condition for the ERC721 drop.
public static Task<Drop_ClaimCondition> DropERC721_GetActiveClaimCondition(this ThirdwebContract contract)
Parameters
contractThirdwebContractThe contract to interact with.
Returns
- Task<Drop_ClaimCondition>
A task representing the asynchronous operation, with a Drop_ClaimCondition result containing the active claim condition details.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
DropERC721_GetActiveClaimConditionId(ThirdwebContract)
Get the active claim condition ID for the ERC721 drop.
public static Task<BigInteger> DropERC721_GetActiveClaimConditionId(this ThirdwebContract contract)
Parameters
contractThirdwebContractThe contract to interact with.
Returns
- Task<BigInteger>
A task representing the asynchronous operation, with a BigInteger result containing the active claim condition ID.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
DropERC721_GetClaimConditionById(ThirdwebContract, BigInteger)
Get the claim condition details for a specific claim condition ID.
public static Task<Drop_ClaimCondition> DropERC721_GetClaimConditionById(this ThirdwebContract contract, BigInteger claimConditionId)
Parameters
contractThirdwebContractThe contract to interact with.
claimConditionIdBigIntegerThe ID of the claim condition.
Returns
- Task<Drop_ClaimCondition>
A task representing the asynchronous operation, with a Drop_ClaimCondition result containing the claim condition details.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentOutOfRangeException
Thrown when the claim condition ID is less than 0.
ERC1155_BalanceOf(ThirdwebContract, string, BigInteger)
Check the balance of a specific token for a specific address.
public static Task<BigInteger> ERC1155_BalanceOf(this ThirdwebContract contract, string ownerAddress, BigInteger tokenId)
Parameters
contractThirdwebContractThe contract to interact with.
ownerAddressstringThe address of the owner whose balance is to be checked.
tokenIdBigIntegerThe ID of the token.
Returns
- Task<BigInteger>
A task representing the asynchronous operation, with a BigInteger result containing the balance.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentException
Thrown when the owner address is null or empty.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0.
ERC1155_BalanceOfBatch(ThirdwebContract, string[], BigInteger[])
Check the balance of multiple tokens for multiple addresses.
public static Task<List<BigInteger>> ERC1155_BalanceOfBatch(this ThirdwebContract contract, string[] ownerAddresses, BigInteger[] tokenIds)
Parameters
contractThirdwebContractThe contract to interact with.
ownerAddressesstring[]The array of owner addresses.
tokenIdsBigInteger[]The array of token IDs.
Returns
- Task<List<BigInteger>>
A task representing the asynchronous operation, with a list of BigInteger results containing the balances.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentException
Thrown when the owner addresses or token IDs are null.
ERC1155_GetAllNFTs(ThirdwebContract, int, int, bool)
Get a list of all ERC1155 tokens within a specified range.
public static Task<List<NFT>> ERC1155_GetAllNFTs(this ThirdwebContract contract, int startTokenId = 0, int count = 100, bool fillSupply = true)
Parameters
contractThirdwebContractThe contract to interact with.
startTokenIdintThe starting token ID (inclusive). Defaults to 0 if not specified.
countintThe number of tokens to retrieve. Defaults to the 100 if not specified.
fillSupplyboolA boolean indicating whether to fill the supply. Defaults to true if not specified.
Returns
- Task<List<NFT>>
A task representing the asynchronous operation, with a list of NFT results containing the token details.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
ERC1155_GetNFT(ThirdwebContract, BigInteger, bool)
Get the details of a specific ERC1155 token.
public static Task<NFT> ERC1155_GetNFT(this ThirdwebContract contract, BigInteger tokenId, bool fillSupply = true)
Parameters
contractThirdwebContractThe contract to interact with.
tokenIdBigIntegerThe ID of the token.
fillSupplyboolA boolean indicating whether to fill the supply. Defaults to true if not specified.
Returns
- Task<NFT>
A task representing the asynchronous operation, with an NFT result containing the token details.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0.
ERC1155_GetOwnedNFTs(ThirdwebContract, string, int, int)
Get a list of ERC1155 tokens owned by a specific address.
public static Task<List<NFT>> ERC1155_GetOwnedNFTs(this ThirdwebContract contract, string owner, int startTokenId = 0, int count = 100)
Parameters
contractThirdwebContractThe contract to interact with.
ownerstringThe address of the owner.
startTokenIdintThe starting token ID (inclusive). Defaults to 0 if not specified.
countintThe number of tokens to retrieve. Defaults to 100 if not specified.
Returns
- Task<List<NFT>>
A task representing the asynchronous operation, with a list of NFT results containing the token details.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentException
Thrown when the owner address is null or empty.
ERC1155_IsApprovedForAll(ThirdwebContract, string, string)
Check if an address is approved to transfer specific tokens.
public static Task<bool> ERC1155_IsApprovedForAll(this ThirdwebContract contract, string ownerAddress, string operatorAddress)
Parameters
contractThirdwebContractThe contract to interact with.
ownerAddressstringThe address of the owner.
operatorAddressstringThe address of the operator.
Returns
- Task<bool>
A task representing the asynchronous operation, with a boolean result indicating if the operator is approved for the owner.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentException
Thrown when the owner address or operator address is null or empty.
ERC1155_SafeBatchTransferFrom(ThirdwebContract, IThirdwebWallet, string, string, BigInteger[], BigInteger[], byte[])
Transfer multiple tokens from one address to another.
public static Task<ThirdwebTransactionReceipt> ERC1155_SafeBatchTransferFrom(this ThirdwebContract contract, IThirdwebWallet wallet, string fromAddress, string toAddress, BigInteger[] tokenIds, BigInteger[] amounts, byte[] data = null)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
fromAddressstringThe address of the sender.
toAddressstringThe address of the recipient.
tokenIdsBigInteger[]The array of token IDs to transfer.
amountsBigInteger[]The array of amounts for each token ID.
databyte[]Additional data with no specified format.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentException
Thrown when the sender address, recipient address, token IDs, or amounts are null or empty.
ERC1155_SafeTransferFrom(ThirdwebContract, IThirdwebWallet, string, string, BigInteger, BigInteger, byte[])
Transfer specific tokens from one address to another.
public static Task<ThirdwebTransactionReceipt> ERC1155_SafeTransferFrom(this ThirdwebContract contract, IThirdwebWallet wallet, string fromAddress, string toAddress, BigInteger tokenId, BigInteger amount, byte[] data = null)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
fromAddressstringThe address of the sender.
toAddressstringThe address of the recipient.
tokenIdBigIntegerThe ID of the token.
amountBigIntegerThe amount of tokens to transfer.
databyte[]Additional data with no specified format.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentException
Thrown when the sender address or recipient address is null or empty.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0.
ERC1155_SetApprovalForAll(ThirdwebContract, IThirdwebWallet, string, bool)
Approve a specific address to transfer specific tokens.
public static Task<ThirdwebTransactionReceipt> ERC1155_SetApprovalForAll(this ThirdwebContract contract, IThirdwebWallet wallet, string operatorAddress, bool approved)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
operatorAddressstringThe address of the operator.
approvedboolA boolean indicating whether to approve or revoke approval.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentException
Thrown when the operator address is null or empty.
ERC1155_TotalSupply(ThirdwebContract)
Get the total supply of tokens.
public static Task<BigInteger> ERC1155_TotalSupply(this ThirdwebContract contract)
Parameters
contractThirdwebContractThe contract to interact with.
Returns
- Task<BigInteger>
A task representing the asynchronous operation, with a BigInteger result containing the total supply.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
ERC1155_TotalSupply(ThirdwebContract, BigInteger)
Get the total supply of a specific token.
public static Task<BigInteger> ERC1155_TotalSupply(this ThirdwebContract contract, BigInteger tokenId)
Parameters
contractThirdwebContractThe contract to interact with.
tokenIdBigIntegerThe ID of the token.
Returns
- Task<BigInteger>
A task representing the asynchronous operation, with a BigInteger result containing the total supply.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0.
ERC1155_URI(ThirdwebContract, BigInteger)
Get the URI for a specific token.
public static Task<string> ERC1155_URI(this ThirdwebContract contract, BigInteger tokenId)
Parameters
contractThirdwebContractThe contract to interact with.
tokenIdBigIntegerThe ID of the token.
Returns
- Task<string>
A task representing the asynchronous operation, with a string result containing the URI.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0.
ERC20_Allowance(ThirdwebContract, string, string)
Get the allowance of a spender for a specific owner.
public static Task<BigInteger> ERC20_Allowance(this ThirdwebContract contract, string ownerAddress, string spenderAddress)
Parameters
contractThirdwebContractThe contract to interact with.
ownerAddressstringThe address of the owner.
spenderAddressstringThe address of the spender.
Returns
- Task<BigInteger>
A task representing the asynchronous operation, with a BigInteger result containing the allowance.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentException
Thrown when the owner address or spender address is null or empty.
ERC20_Approve(ThirdwebContract, IThirdwebWallet, string, BigInteger)
Approve a spender to spend a specific amount of tokens.
public static Task<ThirdwebTransactionReceipt> ERC20_Approve(this ThirdwebContract contract, IThirdwebWallet wallet, string spenderAddress, BigInteger amount)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
spenderAddressstringThe address of the spender.
amountBigIntegerThe amount of tokens to approve.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentException
Thrown when the spender address is null or empty.
ERC20_BalanceOf(ThirdwebContract, string)
Check the balance of a specific address.
public static Task<BigInteger> ERC20_BalanceOf(this ThirdwebContract contract, string ownerAddress)
Parameters
contractThirdwebContractThe contract to interact with.
ownerAddressstringThe address of the owner whose balance is to be checked.
Returns
- Task<BigInteger>
A task representing the asynchronous operation, with a BigInteger result containing the balance.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentException
Thrown when the owner address is null or empty.
ERC20_Decimals(ThirdwebContract)
Get the number of decimals used by the token.
public static Task<int> ERC20_Decimals(this ThirdwebContract contract)
Parameters
contractThirdwebContractThe contract to interact with.
Returns
- Task<int>
A task representing the asynchronous operation, with an int result containing the number of decimals.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
ERC20_Name(ThirdwebContract)
Get the name of the token.
public static Task<string> ERC20_Name(this ThirdwebContract contract)
Parameters
contractThirdwebContractThe contract to interact with.
Returns
- Task<string>
A task representing the asynchronous operation, with a string result containing the name.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
ERC20_Symbol(ThirdwebContract)
Get the symbol of the token.
public static Task<string> ERC20_Symbol(this ThirdwebContract contract)
Parameters
contractThirdwebContractThe contract to interact with.
Returns
- Task<string>
A task representing the asynchronous operation, with a string result containing the symbol.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
ERC20_TotalSupply(ThirdwebContract)
Get the total supply of the token.
public static Task<BigInteger> ERC20_TotalSupply(this ThirdwebContract contract)
Parameters
contractThirdwebContractThe contract to interact with.
Returns
- Task<BigInteger>
A task representing the asynchronous operation, with a BigInteger result containing the total supply.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
ERC20_Transfer(ThirdwebContract, IThirdwebWallet, string, BigInteger)
Transfer tokens to a specific address.
public static Task<ThirdwebTransactionReceipt> ERC20_Transfer(this ThirdwebContract contract, IThirdwebWallet wallet, string toAddress, BigInteger amount)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
toAddressstringThe address of the recipient.
amountBigIntegerThe amount of tokens to transfer.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentException
Thrown when the recipient address is null or empty.
ERC20_TransferFrom(ThirdwebContract, IThirdwebWallet, string, string, BigInteger)
Transfer tokens from one address to another.
public static Task<ThirdwebTransactionReceipt> ERC20_TransferFrom(this ThirdwebContract contract, IThirdwebWallet wallet, string fromAddress, string toAddress, BigInteger amount)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
fromAddressstringThe address of the sender.
toAddressstringThe address of the recipient.
amountBigIntegerThe amount of tokens to transfer.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentException
Thrown when the sender address or recipient address is null or empty.
ERC721A_TokensOfOwner(ThirdwebContract, string)
public static Task<List<BigInteger>> ERC721A_TokensOfOwner(this ThirdwebContract contract, string ownerAddress)
Parameters
contractThirdwebContractownerAddressstring
Returns
ERC721A_TokensOfOwnerIn(ThirdwebContract, string, BigInteger, BigInteger)
public static Task<List<BigInteger>> ERC721A_TokensOfOwnerIn(this ThirdwebContract contract, string ownerAddress, BigInteger startIndex, BigInteger endIndex)
Parameters
contractThirdwebContractownerAddressstringstartIndexBigIntegerendIndexBigInteger
Returns
ERC721_Approve(ThirdwebContract, IThirdwebWallet, string, BigInteger)
Approve a specific address to transfer a specific token.
public static Task<ThirdwebTransactionReceipt> ERC721_Approve(this ThirdwebContract contract, IThirdwebWallet wallet, string toAddress, BigInteger tokenId)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
toAddressstringThe address of the recipient.
tokenIdBigIntegerThe ID of the token.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentException
Thrown when the recipient address is null or empty.
ERC721_BalanceOf(ThirdwebContract, string)
Check the balance of a specific address.
public static Task<BigInteger> ERC721_BalanceOf(this ThirdwebContract contract, string ownerAddress)
Parameters
contractThirdwebContractThe contract to interact with.
ownerAddressstringThe address of the owner whose balance is to be checked.
Returns
- Task<BigInteger>
A task representing the asynchronous operation, with a BigInteger result containing the balance.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentException
Thrown when the owner address is null or empty.
ERC721_GetAllNFTs(ThirdwebContract, int, int, bool)
Get a list of all ERC721 tokens within a specified range.
public static Task<List<NFT>> ERC721_GetAllNFTs(this ThirdwebContract contract, int startTokenId = 0, int count = 100, bool fillOwner = true)
Parameters
contractThirdwebContractThe contract to interact with.
startTokenIdintThe starting token ID (inclusive). Defaults to 0 if not specified.
countintThe number of tokens to retrieve. Defaults to 100 if not specified.
fillOwnerboolA boolean indicating whether to fill the owner details. Defaults to true.
Returns
- Task<List<NFT>>
A task representing the asynchronous operation, with a list of NFT results containing the token details.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
ERC721_GetApproved(ThirdwebContract, BigInteger)
Get the approved address for a specific token.
public static Task<string> ERC721_GetApproved(this ThirdwebContract contract, BigInteger tokenId)
Parameters
contractThirdwebContractThe contract to interact with.
tokenIdBigIntegerThe ID of the token.
Returns
- Task<string>
A task representing the asynchronous operation, with a string result containing the approved address.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0.
ERC721_GetNFT(ThirdwebContract, BigInteger, bool)
Get the details of a specific ERC721 token.
public static Task<NFT> ERC721_GetNFT(this ThirdwebContract contract, BigInteger tokenId, bool fillOwner = true)
Parameters
contractThirdwebContractThe contract to interact with.
tokenIdBigIntegerThe ID of the token.
fillOwnerboolA boolean indicating whether to fill the owner details. Defaults to true.
Returns
- Task<NFT>
A task representing the asynchronous operation, with an NFT result containing the token details.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0.
ERC721_GetOwnedNFTs(ThirdwebContract, string, int, int)
Get a list of ERC721 tokens owned by a specific address.
public static Task<List<NFT>> ERC721_GetOwnedNFTs(this ThirdwebContract contract, string owner, int startTokenId = 0, int count = 100)
Parameters
contractThirdwebContractThe contract to interact with.
ownerstringThe address of the owner.
startTokenIdintThe starting token ID (inclusive). Defaults to 0 if not specified.
countintThe number of tokens to retrieve. Defaults to 100 if not specified.
Returns
- Task<List<NFT>>
A task representing the asynchronous operation, with a list of NFT results containing the token details.
Remarks
ERC721AQueryable and ERC721Enumerable are supported.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentException
Thrown when the owner address is null or empty.
ERC721_IsApprovedForAll(ThirdwebContract, string, string)
Check if an address is an operator for another address.
public static Task<bool> ERC721_IsApprovedForAll(this ThirdwebContract contract, string ownerAddress, string operatorAddress)
Parameters
contractThirdwebContractThe contract to interact with.
ownerAddressstringThe address of the owner.
operatorAddressstringThe address of the operator.
Returns
- Task<bool>
A task representing the asynchronous operation, with a boolean result indicating if the operator is approved for the owner.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentException
Thrown when the owner address or operator address is null or empty.
ERC721_Name(ThirdwebContract)
Get the name of the token.
public static Task<string> ERC721_Name(this ThirdwebContract contract)
Parameters
contractThirdwebContractThe contract to interact with.
Returns
- Task<string>
A task representing the asynchronous operation, with a string result containing the name.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
ERC721_OwnerOf(ThirdwebContract, BigInteger)
Get the owner of a specific token.
public static Task<string> ERC721_OwnerOf(this ThirdwebContract contract, BigInteger tokenId)
Parameters
contractThirdwebContractThe contract to interact with.
tokenIdBigIntegerThe ID of the token.
Returns
- Task<string>
A task representing the asynchronous operation, with a string result containing the owner's address.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0.
ERC721_SafeTransferFrom(ThirdwebContract, IThirdwebWallet, string, string, BigInteger)
Safely transfer a specific token from one address to another.
public static Task<ThirdwebTransactionReceipt> ERC721_SafeTransferFrom(this ThirdwebContract contract, IThirdwebWallet wallet, string fromAddress, string toAddress, BigInteger tokenId)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
fromAddressstringThe address of the sender.
toAddressstringThe address of the recipient.
tokenIdBigIntegerThe ID of the token.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentException
Thrown when the sender address or recipient address is null or empty.
ERC721_SetApprovalForAll(ThirdwebContract, IThirdwebWallet, string, bool)
Set or unset an operator for an owner.
public static Task<ThirdwebTransactionReceipt> ERC721_SetApprovalForAll(this ThirdwebContract contract, IThirdwebWallet wallet, string operatorAddress, bool approved)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
operatorAddressstringThe address of the operator.
approvedboolA boolean indicating whether to set or unset the operator.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentException
Thrown when the operator address is null or empty.
ERC721_Symbol(ThirdwebContract)
Get the symbol of the token.
public static Task<string> ERC721_Symbol(this ThirdwebContract contract)
Parameters
contractThirdwebContractThe contract to interact with.
Returns
- Task<string>
A task representing the asynchronous operation, with a string result containing the symbol.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
ERC721_TokenByIndex(ThirdwebContract, BigInteger)
Get the token ID of a specific token by index.
public static Task<BigInteger> ERC721_TokenByIndex(this ThirdwebContract contract, BigInteger index)
Parameters
contractThirdwebContractThe contract to interact with.
indexBigIntegerThe index of the token.
Returns
- Task<BigInteger>
A task representing the asynchronous operation, with a BigInteger result containing the token ID.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
ERC721_TokenOfOwnerByIndex(ThirdwebContract, string, BigInteger)
Get the token ID of a specific owner by index.
public static Task<BigInteger> ERC721_TokenOfOwnerByIndex(this ThirdwebContract contract, string ownerAddress, BigInteger index)
Parameters
contractThirdwebContractThe contract to interact with.
ownerAddressstringThe address of the owner.
indexBigIntegerThe index of the token.
Returns
- Task<BigInteger>
A task representing the asynchronous operation, with a BigInteger result containing the token ID.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentException
Thrown when the owner address is null or empty.
ERC721_TokenURI(ThirdwebContract, BigInteger)
Get the URI of a specific token.
public static Task<string> ERC721_TokenURI(this ThirdwebContract contract, BigInteger tokenId)
Parameters
contractThirdwebContractThe contract to interact with.
tokenIdBigIntegerThe ID of the token.
Returns
- Task<string>
A task representing the asynchronous operation, with a string result containing the token URI.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0.
ERC721_TotalSupply(ThirdwebContract)
Get the total supply of the token.
public static Task<BigInteger> ERC721_TotalSupply(this ThirdwebContract contract)
Parameters
contractThirdwebContractThe contract to interact with.
Returns
- Task<BigInteger>
A task representing the asynchronous operation, with a BigInteger result containing the total supply.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
ERC721_TransferFrom(ThirdwebContract, IThirdwebWallet, string, string, BigInteger)
Transfer a specific token from one address to another.
public static Task<ThirdwebTransactionReceipt> ERC721_TransferFrom(this ThirdwebContract contract, IThirdwebWallet wallet, string fromAddress, string toAddress, BigInteger tokenId)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
fromAddressstringThe address of the sender.
toAddressstringThe address of the recipient.
tokenIdBigIntegerThe ID of the token.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentException
Thrown when the sender address or recipient address is null or empty.
GetBalance(IThirdwebWallet, BigInteger, string)
Retrieves the balance of the specified wallet on the specified chain.
public static Task<BigInteger> GetBalance(this IThirdwebWallet wallet, BigInteger chainId, string erc20ContractAddress = null)
Parameters
walletIThirdwebWalletThe wallet to retrieve the balance for.
chainIdBigIntegerThe chain ID to retrieve the balance from.
erc20ContractAddressstringThe optional ERC20 contract address to retrieve the balance from.
Returns
- Task<BigInteger>
A task that represents the asynchronous operation. The task result contains the balance in Wei.
Exceptions
- ArgumentNullException
Thrown when the wallet is null.
- ArgumentOutOfRangeException
Thrown when the chain ID is less than or equal to 0.
GetBalance(ThirdwebContract, string)
Retrieves the balance of the specified contract.
public static Task<BigInteger> GetBalance(this ThirdwebContract contract, string erc20ContractAddress = null)
Parameters
contractThirdwebContractThe contract to retrieve the balance for.
erc20ContractAddressstringThe optional ERC20 contract address to retrieve the balance from.
Returns
- Task<BigInteger>
A task that represents the asynchronous operation. The task result contains the balance in Wei.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
GetBalanceRaw(ThirdwebClient, BigInteger, string, string)
Retrieves the balance of the specified address on the specified chain.
public static Task<BigInteger> GetBalanceRaw(ThirdwebClient client, BigInteger chainId, string address, string erc20ContractAddress = null)
Parameters
clientThirdwebClientThe client used to retrieve the balance.
chainIdBigIntegerThe chain ID to retrieve the balance from.
addressstringThe address to retrieve the balance for.
erc20ContractAddressstringThe optional ERC20 contract address to retrieve the balance from.
Returns
- Task<BigInteger>
A task that represents the asynchronous operation. The task result contains the balance in Wei.
Exceptions
- ArgumentNullException
Thrown when the client is null.
- ArgumentOutOfRangeException
Thrown when the chain ID is less than or equal to 0.
- ArgumentException
Thrown when the address is null or empty.
GetDefaultRoyaltyInfo(ThirdwebContract)
Retrieves the default royalty information of the specified contract.
public static Task<RoyaltyInfoResult> GetDefaultRoyaltyInfo(this ThirdwebContract contract)
Parameters
contractThirdwebContractThe contract to retrieve the default royalty information for.
Returns
- Task<RoyaltyInfoResult>
A task that represents the asynchronous operation. The task result contains the royalty information.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
GetMetadata(ThirdwebContract)
Retrieves the metadata of the specified contract.
public static Task<ContractMetadata> GetMetadata(this ThirdwebContract contract)
Parameters
contractThirdwebContractThe contract to retrieve metadata for.
Returns
- Task<ContractMetadata>
A task that represents the asynchronous operation. The task result contains the contract metadata.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
GetNFTImageBytes(NFT, ThirdwebClient)
Retrieves the image bytes of the specified NFT.
public static Task<byte[]> GetNFTImageBytes(this NFT nft, ThirdwebClient client)
Parameters
nftNFTThe NFT to retrieve the image bytes for.
clientThirdwebClientThe client used to download the image bytes.
Returns
- Task<byte[]>
A task that represents the asynchronous operation. The task result contains the image bytes.
Exceptions
- ArgumentNullException
Thrown when the client is null.
GetPrimarySaleRecipient(ThirdwebContract)
Retrieves the primary sale recipient address of the specified contract.
public static Task<string> GetPrimarySaleRecipient(this ThirdwebContract contract)
Parameters
contractThirdwebContractThe contract to retrieve the primary sale recipient address for.
Returns
- Task<string>
A task that represents the asynchronous operation. The task result contains the primary sale recipient address.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
GetTransactionCount(IThirdwebWallet, BigInteger, string)
Retrieves the transaction count (i.e. nonce) of the specified wallet on the specified chain.
public static Task<BigInteger> GetTransactionCount(this IThirdwebWallet wallet, BigInteger chainId, string blocktag = "pending")
Parameters
walletIThirdwebWalletThe wallet to retrieve the transaction count for.
chainIdBigIntegerThe chain ID to retrieve the transaction count from.
blocktagstringThe block tag to retrieve the transaction count at. Defaults to "pending".
Returns
- Task<BigInteger>
A task that represents the asynchronous operation. The task result contains the transaction count.
Exceptions
- ArgumentNullException
Thrown when the wallet is null.
- ArgumentOutOfRangeException
Thrown when the chain ID is less than or equal to 0.
GetTransactionCount(ThirdwebContract, string)
Retrieves the transaction count (i.e. nonce) of the specified contract.
public static Task<BigInteger> GetTransactionCount(this ThirdwebContract contract, string blocktag = "pending")
Parameters
contractThirdwebContractThe contract to retrieve the transaction count for.
blocktagstringThe block tag to retrieve the transaction count at. Defaults to "pending".
Returns
- Task<BigInteger>
A task that represents the asynchronous operation. The task result contains the transaction count.
Exceptions
- ArgumentNullException
Thrown when the contract is null.
GetTransactionCountRaw(ThirdwebClient, BigInteger, string, string)
Retrieves the transaction count (i.e. nonce) of the specified address on the specified chain.
public static Task<BigInteger> GetTransactionCountRaw(ThirdwebClient client, BigInteger chainId, string address, string blocktag = "pending")
Parameters
clientThirdwebClientThe client used to retrieve the transaction count.
chainIdBigIntegerThe chain ID to retrieve the transaction count from.
addressstringThe address to retrieve the transaction count for.
blocktagstringThe block tag to retrieve the transaction count at. Defaults to "pending".
Returns
- Task<BigInteger>
A task that represents the asynchronous operation. The task result contains the transaction count.
Exceptions
- ArgumentNullException
Thrown when the client is null.
- ArgumentOutOfRangeException
Thrown when the chain ID is less than or equal to 0.
- ArgumentException
Thrown when the address is null or empty.
Prepare(ThirdwebContract, IThirdwebWallet, string, BigInteger, params object[])
Prepares a transaction for the specified method and parameters.
public static Task<ThirdwebTransaction> Prepare(this ThirdwebContract contract, IThirdwebWallet wallet, string method, BigInteger weiValue, params object[] parameters)
Parameters
contractThirdwebContractThe contract instance.
walletIThirdwebWalletThe wallet instance.
methodstringThe method to call.
weiValueBigIntegerThe value in wei to send.
parametersobject[]The parameters for the method.
Returns
- Task<ThirdwebTransaction>
A prepared transaction.
Read<T>(ThirdwebContract, string, params object[])
Reads data from the contract using the specified method.
public static Task<T> Read<T>(this ThirdwebContract contract, string method, params object[] parameters)
Parameters
contractThirdwebContractThe contract instance.
methodstringThe method to call.
parametersobject[]The parameters for the method.
Returns
- Task<T>
The result of the method call.
Type Parameters
TThe type of the return value.
Send(ThirdwebTransaction)
Sends the transaction.
public static Task<string> Send(this ThirdwebTransaction transaction)
Parameters
transactionThirdwebTransactionThe transaction.
Returns
SendAndWaitForTransactionReceipt(ThirdwebTransaction)
Sends the transaction and waits for the transaction receipt.
public static Task<ThirdwebTransactionReceipt> SendAndWaitForTransactionReceipt(this ThirdwebTransaction transaction)
Parameters
transactionThirdwebTransactionThe transaction.
Returns
- Task<ThirdwebTransactionReceipt>
The transaction receipt.
SupportsInterface(ThirdwebContract, string)
Returns whether the contract supports the specified interface.
public static Task<bool> SupportsInterface(this ThirdwebContract contract, string interfaceId)
Parameters
contractThirdwebContractThe contract instance.
interfaceIdstringThe interface ID to check.
Returns
- Task<bool>
A task that represents the asynchronous operation. The task result contains a boolean indicating whether the contract supports the interface.
Exceptions
TokenERC1155_Burn(ThirdwebContract, IThirdwebWallet, string, BigInteger, BigInteger)
Burn a specific quantity of ERC1155 tokens for a specific account with a given token ID and amount to burn.
public static Task<ThirdwebTransactionReceipt> TokenERC1155_Burn(this ThirdwebContract contract, IThirdwebWallet wallet, string account, BigInteger tokenId, BigInteger amount)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
accountstringThe address of the account to burn the tokens from.
tokenIdBigIntegerThe ID of the token to burn.
amountBigIntegerThe amount of tokens to burn.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract, wallet, or account is null.
- ArgumentException
Thrown when the account is null or empty.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0 or the amount is less than or equal to 0.
TokenERC1155_BurnBatch(ThirdwebContract, IThirdwebWallet, string, BigInteger[], BigInteger[])
Burn a specific quantity of ERC1155 tokens for a specific account with given token IDs and amounts to burn.
public static Task<ThirdwebTransactionReceipt> TokenERC1155_BurnBatch(this ThirdwebContract contract, IThirdwebWallet wallet, string account, BigInteger[] tokenIds, BigInteger[] amounts)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
accountstringThe address of the account to burn the tokens from.
tokenIdsBigInteger[]The IDs of the tokens to burn.
amountsBigInteger[]The amounts of tokens to burn.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract, wallet, or account is null.
- ArgumentException
Thrown when the account is null or empty, or the token IDs or amounts are null or empty, or the token IDs and amounts have different lengths.
- ArgumentOutOfRangeException
Thrown when the token IDs or amounts have a length less than or equal to 0.
- ArgumentException
Thrown when the token IDs and amounts have different lengths.
TokenERC1155_GenerateMintSignature(ThirdwebContract, IThirdwebWallet, TokenERC1155_MintRequest, NFTMetadata?)
Generate a mint signature for ERC1155 tokens.
public static Task<(TokenERC1155_MintRequest, string)> TokenERC1155_GenerateMintSignature(this ThirdwebContract contract, IThirdwebWallet wallet, TokenERC1155_MintRequest mintRequest, NFTMetadata? metadataOverride = null)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for generating the signature.
mintRequestTokenERC1155_MintRequestThe mint request containing the minting details.
metadataOverrideNFTMetadata?Optional metadata override for the token.
Returns
- Task<(TokenERC1155_MintRequest, string)>
A task representing the asynchronous operation, with a tuple containing the mint request and the generated signature.
Exceptions
- ArgumentNullException
Thrown when the contract, wallet, or mint request is null.
- ArgumentException
Thrown when the MintRequest URI or NFTMetadata override is not provided.
TokenERC1155_MintTo(ThirdwebContract, IThirdwebWallet, string, BigInteger, BigInteger, string)
Mint a specific quantity of ERC1155 tokens to a receiver address with a given URI.
public static Task<ThirdwebTransactionReceipt> TokenERC1155_MintTo(this ThirdwebContract contract, IThirdwebWallet wallet, string receiverAddress, BigInteger tokenId, BigInteger quantity, string uri)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
receiverAddressstringThe address of the receiver.
tokenIdBigIntegerThe ID of the token.
quantityBigIntegerThe quantity of tokens to mint.
uristringThe URI of the token metadata.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract, wallet, or URI is null.
- ArgumentException
Thrown when the receiver address is null or empty.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0 or the quantity is less than or equal to 0.
TokenERC1155_MintTo(ThirdwebContract, IThirdwebWallet, string, BigInteger, BigInteger, NFTMetadata)
Mint a specific quantity of ERC1155 tokens to a receiver address with metadata.
public static Task<ThirdwebTransactionReceipt> TokenERC1155_MintTo(this ThirdwebContract contract, IThirdwebWallet wallet, string receiverAddress, BigInteger tokenId, BigInteger quantity, NFTMetadata metadata)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
receiverAddressstringThe address of the receiver.
tokenIdBigIntegerThe ID of the token.
quantityBigIntegerThe quantity of tokens to mint.
metadataNFTMetadataThe metadata of the token.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentException
Thrown when the receiver address is null or empty.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0 or the quantity is less than or equal to 0.
TokenERC1155_MintWithSignature(ThirdwebContract, IThirdwebWallet, TokenERC1155_MintRequest, string)
Mint ERC1155 tokens with a signature.
public static Task<ThirdwebTransactionReceipt> TokenERC1155_MintWithSignature(this ThirdwebContract contract, IThirdwebWallet wallet, TokenERC1155_MintRequest mintRequest, string signature)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
mintRequestTokenERC1155_MintRequestThe mint request containing the minting details.
signaturestringThe signature to authorize the minting.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract, wallet, or mint request is null.
- ArgumentException
Thrown when the signature is null or empty.
TokenERC1155_VerifyMintSignature(ThirdwebContract, TokenERC1155_MintRequest, string)
Verify a mint signature for ERC1155 tokens.
public static Task<VerifyResult> TokenERC1155_VerifyMintSignature(this ThirdwebContract contract, TokenERC1155_MintRequest mintRequest, string signature)
Parameters
contractThirdwebContractThe contract to interact with.
mintRequestTokenERC1155_MintRequestThe mint request containing the minting details.
signaturestringThe signature to verify.
Returns
- Task<VerifyResult>
A task representing the asynchronous operation, with a VerifyResult result containing the verification details.
Exceptions
- ArgumentNullException
Thrown when the contract or mint request is null.
- ArgumentException
Thrown when the signature is null or empty.
TokenERC20_GenerateMintSignature(ThirdwebContract, IThirdwebWallet, TokenERC20_MintRequest)
Generate a mint signature for ERC20 tokens.
public static Task<(TokenERC20_MintRequest, string)> TokenERC20_GenerateMintSignature(this ThirdwebContract contract, IThirdwebWallet wallet, TokenERC20_MintRequest mintRequest)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for generating the signature.
mintRequestTokenERC20_MintRequestThe mint request containing the minting details.
Returns
- Task<(TokenERC20_MintRequest, string)>
A task representing the asynchronous operation, with a tuple containing the mint request and the generated signature.
Exceptions
- ArgumentNullException
Thrown when the contract, wallet, or mint request is null.
TokenERC20_MintTo(ThirdwebContract, IThirdwebWallet, string, string)
Mint a specific amount of ERC20 tokens to a receiver address.
public static Task<ThirdwebTransactionReceipt> TokenERC20_MintTo(this ThirdwebContract contract, IThirdwebWallet wallet, string receiverAddress, string amount)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
receiverAddressstringThe address of the receiver.
amountstringThe amount of tokens to mint.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentException
Thrown when the receiver address or amount is null or empty.
TokenERC20_MintWithSignature(ThirdwebContract, IThirdwebWallet, TokenERC20_MintRequest, string)
Mint ERC20 tokens with a signature.
public static Task<ThirdwebTransactionReceipt> TokenERC20_MintWithSignature(this ThirdwebContract contract, IThirdwebWallet wallet, TokenERC20_MintRequest mintRequest, string signature)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
mintRequestTokenERC20_MintRequestThe mint request containing the minting details.
signaturestringThe signature to authorize the minting.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract, wallet, or mint request is null.
- ArgumentException
Thrown when the signature is null or empty.
TokenERC20_VerifyMintSignature(ThirdwebContract, TokenERC20_MintRequest, string)
Verify a mint signature for ERC20 tokens.
public static Task<VerifyResult> TokenERC20_VerifyMintSignature(this ThirdwebContract contract, TokenERC20_MintRequest mintRequest, string signature)
Parameters
contractThirdwebContractThe contract to interact with.
mintRequestTokenERC20_MintRequestThe mint request containing the minting details.
signaturestringThe signature to verify.
Returns
- Task<VerifyResult>
A task representing the asynchronous operation, with a VerifyResult result containing the verification details.
Exceptions
- ArgumentNullException
Thrown when the contract or mint request is null.
- ArgumentException
Thrown when the signature is null or empty.
TokenERC721_Burn(ThirdwebContract, IThirdwebWallet, BigInteger)
Burn a specific ERC721 token with a given token ID.
public static Task<ThirdwebTransactionReceipt> TokenERC721_Burn(this ThirdwebContract contract, IThirdwebWallet wallet, BigInteger tokenId)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
tokenIdBigIntegerThe ID of the token to burn.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0.
TokenERC721_GenerateMintSignature(ThirdwebContract, IThirdwebWallet, TokenERC721_MintRequest, NFTMetadata?)
Generate a mint signature for ERC721 tokens.
public static Task<(TokenERC721_MintRequest, string)> TokenERC721_GenerateMintSignature(this ThirdwebContract contract, IThirdwebWallet wallet, TokenERC721_MintRequest mintRequest, NFTMetadata? metadataOverride = null)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for generating the signature.
mintRequestTokenERC721_MintRequestThe mint request containing the minting details.
metadataOverrideNFTMetadata?Optional metadata override for the token.
Returns
- Task<(TokenERC721_MintRequest, string)>
A task representing the asynchronous operation, with a tuple containing the mint request and the generated signature.
Exceptions
- ArgumentNullException
Thrown when the contract, wallet, or mint request is null.
TokenERC721_MintTo(ThirdwebContract, IThirdwebWallet, string, string)
Mint a specific ERC721 token to a receiver address with a given URI.
public static Task<ThirdwebTransactionReceipt> TokenERC721_MintTo(this ThirdwebContract contract, IThirdwebWallet wallet, string receiverAddress, string uri)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
receiverAddressstringThe address of the receiver.
uristringThe URI of the token metadata.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentException
Thrown when the receiver address or URI is null or empty.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0.
TokenERC721_MintTo(ThirdwebContract, IThirdwebWallet, string, NFTMetadata)
Mint a specific ERC721 token to a receiver address with metadata.
public static Task<ThirdwebTransactionReceipt> TokenERC721_MintTo(this ThirdwebContract contract, IThirdwebWallet wallet, string receiverAddress, NFTMetadata metadata)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
receiverAddressstringThe address of the receiver.
metadataNFTMetadataThe metadata of the token.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract or wallet is null.
- ArgumentException
Thrown when the receiver address is null or empty.
- ArgumentOutOfRangeException
Thrown when the token ID is less than 0.
TokenERC721_MintWithSignature(ThirdwebContract, IThirdwebWallet, TokenERC721_MintRequest, string)
Mint ERC721 tokens with a signature.
public static Task<ThirdwebTransactionReceipt> TokenERC721_MintWithSignature(this ThirdwebContract contract, IThirdwebWallet wallet, TokenERC721_MintRequest mintRequest, string signature)
Parameters
contractThirdwebContractThe contract to interact with.
walletIThirdwebWalletThe wallet to use for the transaction.
mintRequestTokenERC721_MintRequestThe mint request containing the minting details.
signaturestringThe signature to authorize the minting.
Returns
- Task<ThirdwebTransactionReceipt>
A task representing the asynchronous operation, with a ThirdwebTransactionReceipt result.
Exceptions
- ArgumentNullException
Thrown when the contract, wallet, or mint request is null.
- ArgumentException
Thrown when the signature is null or empty.
TokenERC721_VerifyMintSignature(ThirdwebContract, TokenERC721_MintRequest, string)
Verify a mint signature for ERC721 tokens.
public static Task<VerifyResult> TokenERC721_VerifyMintSignature(this ThirdwebContract contract, TokenERC721_MintRequest mintRequest, string signature)
Parameters
contractThirdwebContractThe contract to interact with.
mintRequestTokenERC721_MintRequestThe mint request containing the minting details.
signaturestringThe signature to verify.
Returns
- Task<VerifyResult>
A task representing the asynchronous operation, with a VerifyResult result containing the verification details.
Exceptions
- ArgumentNullException
Thrown when the contract or mint request is null.
- ArgumentException
Thrown when the signature is null or empty.
Transfer(IThirdwebWallet, BigInteger, string, BigInteger, string)
Transfers the specified amount of Wei to the specified address. Passing tokenAddress will override this function to transfer ERC20 tokens.
public static Task<ThirdwebTransactionReceipt> Transfer(this IThirdwebWallet wallet, BigInteger chainId, string toAddress, BigInteger weiAmount, string tokenAddress = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE")
Parameters
walletIThirdwebWalletThe wallet to transfer from.
chainIdBigIntegerThe chain ID to transfer on.
toAddressstringThe address to transfer to.
weiAmountBigIntegerThe amount of Wei to transfer.
tokenAddressstringThe optional token address to transfer from. Defaults to the native token address (ETH or equivalent).
Returns
- Task<ThirdwebTransactionReceipt>
A task that represents the asynchronous operation. The task result contains the transaction receipt.
Exceptions
- ArgumentNullException
Thrown when the wallet is null.
- ArgumentOutOfRangeException
Thrown when the chain ID is less than or equal to 0.
- ArgumentException
Thrown when the recipient address is null or empty.
Write(ThirdwebContract, IThirdwebWallet, string, BigInteger, params object[])
Writes data to the contract using the specified method and parameters.
public static Task<ThirdwebTransactionReceipt> Write(this ThirdwebContract contract, IThirdwebWallet wallet, string method, BigInteger weiValue, params object[] parameters)
Parameters
contractThirdwebContractThe contract instance.
walletIThirdwebWalletThe wallet instance.
methodstringThe method to call.
weiValueBigIntegerThe value in wei to send.
parametersobject[]The parameters for the method.
Returns
- Task<ThirdwebTransactionReceipt>
A transaction receipt.