Skip to main content

class Contract

class Contract
: public Thirdweb.Routable

Convenient wrapper to interact with any EVM contract

Summary

MembersTypeDescriptions
chainvariable
addressvariable
abivariable
ERC20variableCall any ERC20 supported functions
ERC721variableCall any ERC721 supported functions
ERC1155variableCall any ERC1155 supported functions
marketplacevariableCall any Marketplace supported functions
packvariableCall any Pack supported functions
Contractfunction
GetBalancefunction
Read< T >functionRead data from a contract
WritefunctionExecute a write transaction on a contract
WritefunctionExecute a write transaction on a contract

Members

public string chain


public string address


public string abi


public ERC20 ERC20

Call any ERC20 supported functions


public ERC721 ERC721

Call any ERC721 supported functions


public ERC1155 ERC1155

Call any ERC1155 supported functions


public Marketplace marketplace

Call any Marketplace supported functions


public Pack pack

Call any Pack supported functions


public inline Contract(string chain,string address,string abi)


public inline async Task< CurrencyValue>GetBalance()


public inline async Task< T > Read< T >(string functionName,params object[] args)

Read data from a contract

Parameters

  • functionName The contract function name to call

  • args Optional function arguments. Structs and Lists will get serialized automatically

Returns

The data deserialized to the given typed


public inline Task< TransactionResult>Write(string functionName,params object[] args)

Execute a write transaction on a contract

Parameters

  • functionName The contract function name to call

  • args Optional function arguments. Structs and Lists will get serialized automatically

Returns

The transaction receipt


public inline async Task< TransactionResult>Write(string functionName,TransactionRequest? transactionOverrides,params object[] args)

Execute a write transaction on a contract

Parameters

  • functionName The contract function name to call

  • transactionOverrides Overrides to pass with the transaction

  • args Optional function arguments. Structs and Lists will get serialized automatically

Returns

The transaction receipt