Contract Extensions

Thirdweb's .NET SDK provides a set of useful type-safe extensions for calling smart contracts. These extensions simplify the process of interacting with smart contracts by providing a more intuitive and user-friendly API.

Usage

// Write without extensions
var receiver = await wallet.GetAddress();
var quantity = BigInteger.One;
var currency = Constants.NATIVE_TOKEN_ADDRESS;
var pricePerToken = BigInteger.Zero;
var allowlistProof = new object[] { new byte[] { }, BigInteger.Zero, BigInteger.Zero, Constants.ADDRESS_ZERO };
var data = new byte[] { };
var receipt = await contract.Write(smartAccount, contract, "claim", 0, receiver, quantity, currency, pricePerToken, allowlistProof, data);
// Write with extensions
var receipt = await contract.DropERC20_Claim(wallet, receiver, amount);
// Read without extensions
var balance = await contract.Read<string>("balanceOf", "0xOwnerAddress");
// Read with extensions
var balance = await contract.ERC20_BalanceOf("0xOwnerAddress");
// Generate low level calldata
var calldata = contract.CreateCallData("myFunction", param1, param2);

Available Contract Extensions

Please refer to the ThirdwebExtensions full reference for a complete list of available contract extensions.

If you are using our Marketplace contract, check out our Marketplace-specific extensions.