Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions apps/portal/src/app/dotnet/contracts/read/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ Use `ThirdwebContract.Read` to fetch data from a smart contract without making a
## Usage

```csharp
var result = await contract.Read<T>(contract, "methodName", parameters);
// Static
var result = await ThirdwebContract.Read<T>(contract, "methodName", parameters);

// Extension
var result = await contract.Read<T>("methodName", parameters);
```

<Details summary="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`.
Expand Down
15 changes: 6 additions & 9 deletions apps/portal/src/app/dotnet/contracts/write/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
```

<Details summary="Parameters">
Expand All @@ -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`.
Expand Down Expand Up @@ -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
Expand All @@ -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}");
```

Expand Down
11 changes: 10 additions & 1 deletion apps/portal/src/app/dotnet/transactions/prepare/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading