Class ThirdwebContract
- Namespace
- Thirdweb
- Assembly
- Thirdweb.dll
Represents a Thirdweb contract.
public class ThirdwebContract
- Inheritance
-
ThirdwebContract
- Inherited Members
- Extension Methods
Methods
Create(ThirdwebClient, string, BigInteger, string)
Creates a new instance of ThirdwebContract.
public static Task<ThirdwebContract> Create(ThirdwebClient client, string address, BigInteger chain, string abi = null)
Parameters
client
ThirdwebClientThe Thirdweb client.
address
stringThe contract address.
chain
BigIntegerThe chain ID.
abi
stringThe contract ABI (optional).
Returns
- Task<ThirdwebContract>
A new instance of ThirdwebContract.
Exceptions
- ArgumentException
Thrown if any of the required parameters are missing.
FetchAbi(ThirdwebClient, string, BigInteger)
Fetches the ABI for the specified contract.
public static Task<string> FetchAbi(ThirdwebClient client, string address, BigInteger chainId)
Parameters
client
ThirdwebClientThe Thirdweb client.
address
stringThe contract address.
chainId
BigIntegerThe chain ID.
Returns
Prepare(IThirdwebWallet, ThirdwebContract, string, BigInteger, params object[])
Prepares a transaction for the specified method and parameters.
public static Task<ThirdwebTransaction> Prepare(IThirdwebWallet wallet, ThirdwebContract contract, string method, BigInteger weiValue, params object[] parameters)
Parameters
wallet
IThirdwebWalletThe wallet instance.
contract
ThirdwebContractThe contract instance.
method
stringThe method to call.
weiValue
BigIntegerThe value in wei to send.
parameters
object[]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>(ThirdwebContract contract, string method, params object[] parameters)
Parameters
contract
ThirdwebContractThe contract instance.
method
stringThe method to call.
parameters
object[]The parameters for the method.
Returns
- Task<T>
The result of the method call.
Type Parameters
T
The type of the return value.
Write(IThirdwebWallet, ThirdwebContract, string, BigInteger, params object[])
Writes data to the contract using the specified method and parameters.
public static Task<ThirdwebTransactionReceipt> Write(IThirdwebWallet wallet, ThirdwebContract contract, string method, BigInteger weiValue, params object[] parameters)
Parameters
wallet
IThirdwebWalletThe wallet instance.
contract
ThirdwebContractThe contract instance.
method
stringThe method to call.
weiValue
BigIntegerThe value in wei to send.
parameters
object[]The parameters for the method.
Returns
- Task<ThirdwebTransactionReceipt>
A transaction receipt.