From 55332cddbe8488c4b848ae8dbf96aee938198ba5 Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Thu, 27 Nov 2025 17:35:37 +0700 Subject: [PATCH] small fixes to dotnet docs --- .../portal/src/app/dotnet/contracts/read/page.mdx | 10 +++++----- .../src/app/dotnet/contracts/write/page.mdx | 15 ++++++--------- .../src/app/dotnet/transactions/prepare/page.mdx | 11 ++++++++++- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/apps/portal/src/app/dotnet/contracts/read/page.mdx b/apps/portal/src/app/dotnet/contracts/read/page.mdx index d6a87c4e2b5..71f0a65db70 100644 --- a/apps/portal/src/app/dotnet/contracts/read/page.mdx +++ b/apps/portal/src/app/dotnet/contracts/read/page.mdx @@ -12,15 +12,15 @@ Use `ThirdwebContract.Read` to fetch data from a smart contract without making a ## Usage ```csharp -var result = await contract.Read(contract, "methodName", parameters); +// Static +var result = await ThirdwebContract.Read(contract, "methodName", parameters); + +// Extension +var result = await contract.Read("methodName", parameters); ```
-### contract (required) - -An instance of `ThirdwebContract`. Represents the smart contract you want to interact with. - ### methodName (required) The name of the contract method you wish to call. Must be a `string`. diff --git a/apps/portal/src/app/dotnet/contracts/write/page.mdx b/apps/portal/src/app/dotnet/contracts/write/page.mdx index e0bb7bfa5ef..d08203711bc 100644 --- a/apps/portal/src/app/dotnet/contracts/write/page.mdx +++ b/apps/portal/src/app/dotnet/contracts/write/page.mdx @@ -12,7 +12,11 @@ The `ThirdwebContract.Write` method allows you to execute transactions that alte ## Usage ```csharp -var transactionReceipt = await contract.Write(wallet, contract, "methodName", weiValue, parameters); +// Static +var receipt = await ThirdwebContract.Write(wallet, contract, "transfer", weiValue, toAddress, amount); + +// Extension +var transactionReceipt = await contract.Write(wallet, "methodName", weiValue, parameters); ```
@@ -21,10 +25,6 @@ var transactionReceipt = await contract.Write(wallet, contract, "methodName", we An instance of `IThirdwebWallet`. This represents the signer of the transaction, which can be any type of wallet provider. -### contract (required) - -An instance of `ThirdwebContract`. Represents the smart contract you wish to interact with. - ### methodName (required) The name of the smart contract method you intend to call. Must be a `string`. @@ -57,9 +57,6 @@ string contractAddress = "0x..."; // Your contract address var client = ThirdwebClient.Create(secretKey: "yourSecretKey"); var contract = await ThirdwebContract.Create(client, contractAddress, chainId); -// The wallet that signs and sends the transaction -var wallet = await PrivateKeyWallet.Create(client, "yourPrivateKeyHex"); - // Assuming transfer takes an address and an amount as parameters string toAddress = "0x..."; BigInteger amount = new BigInteger(1000); // The amount to transfer @@ -68,7 +65,7 @@ BigInteger amount = new BigInteger(1000); // The amount to transfer BigInteger weiValue = BigInteger.Zero; // Executing the transfer -var receipt = await contract.Write(wallet, contract, "transfer", weiValue, toAddress, amount); +var receipt = await contract.Write(wallet, "transfer", weiValue, toAddress, amount); Console.WriteLine($"Transaction receipt: {receipt}"); ``` diff --git a/apps/portal/src/app/dotnet/transactions/prepare/page.mdx b/apps/portal/src/app/dotnet/transactions/prepare/page.mdx index 6b793e4be27..38a26d0cc1e 100644 --- a/apps/portal/src/app/dotnet/transactions/prepare/page.mdx +++ b/apps/portal/src/app/dotnet/transactions/prepare/page.mdx @@ -23,13 +23,22 @@ Looking for the contract APIs themselves? Check out the [Contracts guides](/dotn ## Usage ```csharp -ThirdwebTransaction transaction = await contract.Prepare( +// Static +ThirdwebTransaction transaction = await ThirdwebContract.Prepare( wallet, contract, "methodName", weiValue, parameters ); + +// Extension +ThirdwebTransaction transaction = await contract.Prepare( + wallet, + "methodName", + weiValue, + parameters +); ``` Once prepared, you can tweak or send the transaction: