Docs

Call Functions

If the functionality of your smart contract does not come under one of thirdweb's supported interfaces, use the generic Write method to call any function on the smart contract.

The result of the transaction can be read by awaiting the result of the Write.

The call will be awaited until the transaction is mined and the transaction receipt is available.

Usage

TransactionResult result = await contract.Write("functionName");

Configuration

functionName

The name of the function, view, mapping, variable, etc. on your smart contract.

Must be a string.

transactionOverrides

Optional transaction overrides to change parameters like value or gasLimit.

Must be of type TransactionRequest

TransactionResult result = await contract.Write("functionName", new TransactionRequest() { value = "100000", gasLimit = "100000" });

args

The arguments to the function/variable, in the same order they are on your smart contract.

If you provide too few or too many arguments, the function will throw an error.

BigInteger arg1 = 1234;
string arg2 = "hello world";
TransactionResult result = await contract.Write("functionName", arg1, arg2, ...);