Table of Contents

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 ThirdwebClient

The Thirdweb client.

address string

The contract address.

chain BigInteger

The chain ID.

abi string

The 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 ThirdwebClient

The Thirdweb client.

address string

The contract address.

chainId BigInteger

The chain ID.

Returns

Task<string>

The contract ABI.

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 IThirdwebWallet

The wallet instance.

contract ThirdwebContract

The contract instance.

method string

The method to call.

weiValue BigInteger

The 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 ThirdwebContract

The contract instance.

method string

The 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 IThirdwebWallet

The wallet instance.

contract ThirdwebContract

The contract instance.

method string

The method to call.

weiValue BigInteger

The value in wei to send.

parameters object[]

The parameters for the method.

Returns

Task<ThirdwebTransactionReceipt>

A transaction receipt.