Skip to content

Commit 4f2dbcc

Browse files
authored
small fixes to dotnet docs (#8468)
1 parent 908142f commit 4f2dbcc

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

apps/portal/src/app/dotnet/contracts/read/page.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ Use `ThirdwebContract.Read` to fetch data from a smart contract without making a
1212
## Usage
1313

1414
```csharp
15-
var result = await contract.Read<T>(contract, "methodName", parameters);
15+
// Static
16+
var result = await ThirdwebContract.Read<T>(contract, "methodName", parameters);
17+
18+
// Extension
19+
var result = await contract.Read<T>("methodName", parameters);
1620
```
1721

1822
<Details summary="Parameters">
1923

20-
### contract (required)
21-
22-
An instance of `ThirdwebContract`. Represents the smart contract you want to interact with.
23-
2424
### methodName (required)
2525

2626
The name of the contract method you wish to call. Must be a `string`.

apps/portal/src/app/dotnet/contracts/write/page.mdx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ The `ThirdwebContract.Write` method allows you to execute transactions that alte
1212
## Usage
1313

1414
```csharp
15-
var transactionReceipt = await contract.Write(wallet, contract, "methodName", weiValue, parameters);
15+
// Static
16+
var receipt = await ThirdwebContract.Write(wallet, contract, "transfer", weiValue, toAddress, amount);
17+
18+
// Extension
19+
var transactionReceipt = await contract.Write(wallet, "methodName", weiValue, parameters);
1620
```
1721

1822
<Details summary="Parameters">
@@ -21,10 +25,6 @@ var transactionReceipt = await contract.Write(wallet, contract, "methodName", we
2125

2226
An instance of `IThirdwebWallet`. This represents the signer of the transaction, which can be any type of wallet provider.
2327

24-
### contract (required)
25-
26-
An instance of `ThirdwebContract`. Represents the smart contract you wish to interact with.
27-
2828
### methodName (required)
2929

3030
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
5757
var client = ThirdwebClient.Create(secretKey: "yourSecretKey");
5858
var contract = await ThirdwebContract.Create(client, contractAddress, chainId);
5959

60-
// The wallet that signs and sends the transaction
61-
var wallet = await PrivateKeyWallet.Create(client, "yourPrivateKeyHex");
62-
6360
// Assuming transfer takes an address and an amount as parameters
6461
string toAddress = "0x...";
6562
BigInteger amount = new BigInteger(1000); // The amount to transfer
@@ -68,7 +65,7 @@ BigInteger amount = new BigInteger(1000); // The amount to transfer
6865
BigInteger weiValue = BigInteger.Zero;
6966

7067
// Executing the transfer
71-
var receipt = await contract.Write(wallet, contract, "transfer", weiValue, toAddress, amount);
68+
var receipt = await contract.Write(wallet, "transfer", weiValue, toAddress, amount);
7269
Console.WriteLine($"Transaction receipt: {receipt}");
7370
```
7471

apps/portal/src/app/dotnet/transactions/prepare/page.mdx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,22 @@ Looking for the contract APIs themselves? Check out the [Contracts guides](/dotn
2323
## Usage
2424

2525
```csharp
26-
ThirdwebTransaction transaction = await contract.Prepare(
26+
// Static
27+
ThirdwebTransaction transaction = await ThirdwebContract.Prepare(
2728
wallet,
2829
contract,
2930
"methodName",
3031
weiValue,
3132
parameters
3233
);
34+
35+
// Extension
36+
ThirdwebTransaction transaction = await contract.Prepare(
37+
wallet,
38+
"methodName",
39+
weiValue,
40+
parameters
41+
);
3342
```
3443

3544
Once prepared, you can tweak or send the transaction:

0 commit comments

Comments
 (0)