Skip to content

Commit 7293dfa

Browse files
committed
[Docs] .NET 2.10.0+ (#5842)
Closes TOOL-2440 <!-- start pr-codex --> --- ## PR-Codex overview This PR primarily focuses on refactoring the code to streamline interactions with contracts by removing references to `ThirdwebContract` and directly using `contract`. Additionally, it introduces new functionalities for unlinking accounts and enhances documentation across various pages. ### Detailed summary - Refactored contract interactions to use `contract` instead of `ThirdwebContract`. - Added `PurchaseData` object in `getbuywithfiatstatus` and `getbuywithfiatquote`. - Introduced unlinking functionality in in-app and ecosystem wallets. - Updated documentation for `SwitchNetwork` and `SignAuthorization`. - Improved descriptions and metadata for various pages. - Enhanced code examples and clarified usage instructions. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent e9c23ad commit 7293dfa

File tree

22 files changed

+233
-27
lines changed

22 files changed

+233
-27
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,32 @@ Thirdweb's .NET SDK provides a set of useful type-safe extensions for calling sm
1212
## Usage
1313

1414
```csharp
15-
// Without extensions
15+
// Write without extensions
1616
var receiver = await wallet.GetAddress();
1717
var quantity = BigInteger.One;
1818
var currency = Constants.NATIVE_TOKEN_ADDRESS;
1919
var pricePerToken = BigInteger.Zero;
2020
var allowlistProof = new object[] { new byte[] { }, BigInteger.Zero, BigInteger.Zero, Constants.ADDRESS_ZERO };
2121
var data = new byte[] { };
22-
var receipt = await ThirdwebContract.Write(smartAccount, contract, "claim", 0, receiver, quantity, currency, pricePerToken, allowlistProof, data);
22+
var receipt = await contract.Write(smartAccount, contract, "claim", 0, receiver, quantity, currency, pricePerToken, allowlistProof, data);
2323

24-
// With extensions
24+
// Write with extensions
2525
var receipt = await contract.DropERC20_Claim(wallet, receiver, amount);
2626

27-
// Can also do read operations and much more
27+
// Read without extensions
28+
var balance = await contract.Read<string>("balanceOf", "0xOwnerAddress");
29+
30+
// Read with extensions
2831
var balance = await contract.ERC20_BalanceOf("0xOwnerAddress");
32+
33+
// Generate low level calldata
34+
var calldata = contract.CreateCallData("myFunction", param1, param2);
2935
```
3036

3137
## Available Contract Extensions
3238

3339
Please refer to the `ThirdwebExtensions` [full reference](https://thirdweb-dev.github.io/dotnet/docs/Thirdweb.ThirdwebExtensions.html) for a complete list of available contract extensions.
3440

41+
If you are using our [Marketplace](https://thirdweb.com/thirdweb.eth/MarketplaceV3) contract, check out our [Marketplace-specific](https://thirdweb-dev.github.io/dotnet/docs/Thirdweb.ThirdwebMarketplaceExtensions.html) extensions.
42+
3543

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Useful for preparing, simulating and manipulating transactions before sending th
1515
## Usage
1616

1717
```csharp
18-
ThirdwebTransaction transaction = await ThirdwebContract.Prepare(wallet, contract, "methodName", weiValue, parameters);
18+
ThirdwebTransaction transaction = await contract.Prepare(wallet, contract, "methodName", weiValue, parameters);
1919
```
2020

2121
<Details summary="Parameters">

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

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

1414
```csharp
15-
var result = await ThirdwebContract.Read<T>(contract, "methodName", parameters);
15+
var result = await contract.Read<T>(contract, "methodName", parameters);
1616
```
1717

1818
<Details summary="Parameters">

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

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

1414
```csharp
15-
var transactionReceipt = await ThirdwebContract.Write(wallet, contract, "methodName", weiValue, parameters);
15+
var transactionReceipt = await contract.Write(wallet, contract, "methodName", weiValue, parameters);
1616
```
1717

1818
<Details summary="Parameters">
@@ -68,7 +68,7 @@ BigInteger amount = new BigInteger(1000); // The amount to transfer
6868
BigInteger weiValue = BigInteger.Zero;
6969

7070
// Executing the transfer
71-
var receipt = await ThirdwebContract.Write(wallet, contract, "transfer", weiValue, toAddress, amount);
71+
var receipt = await contract.Write(wallet, contract, "transfer", weiValue, toAddress, amount);
7272
Console.WriteLine($"Transaction receipt: {receipt}");
7373
```
7474

apps/portal/src/app/dotnet/getting-started/page.mdx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,17 @@ This command adds the Thirdweb SDK to your project, allowing you to interact wit
3939
Create a new instance of the Thirdweb client in your application:
4040

4141
```csharp
42-
// For Frontend Applications
42+
// For Web Applications
43+
var client = ThirdwebClient.Create(clientId: "yourClientId");
44+
45+
// For Native Applications
4346
var client = ThirdwebClient.Create(clientId: "yourClientId", bundleId: "yourBundleId");
4447

4548
// For Backend Applications
4649
var client = ThirdwebClient.Create(secretKey: "yourSecretKey");
4750
```
4851

49-
Replace "yourClientId" and "yourBundleId" with your actual client ID and bundle ID. Note that a bundle ID is only required if you are not using the SDK from a web application.
52+
Replace "yourClientId" and "yourBundleId" with your actual client ID and bundle ID.
5053

5154
</Step>
5255
<Step title="Interact with Smart Contracts" >
@@ -55,7 +58,7 @@ Now, you can start interacting with smart contracts. For example, to read from a
5558

5659
```csharp
5760
var contract = await ThirdwebContract.Create(client: client, address: "contractAddress", chain: chainId);
58-
var readResult = await ThirdwebContract.Read<string>(contract, "methodName");
61+
var readResult = await contract.Read<string>(contract, "methodName");
5962
Console.WriteLine($"Contract read result: {readResult}");
6063
```
6164

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import { GraduationCap } from "lucide-react";
33

44
# .NET SDK
55

6-
A .NET SDK to integrate blockchain and web3 capabilities into your applications.
6+
Build decentralized .NET applications and create seamless user experiences using Thirdweb's .NET SDK.
77

88
Connect to users’ wallets, interact with smart contracts, sign messages, and utilize common standards such as tokens, NFTs, and marketplaces; all with built-in RPC URLs, IPFS gateways, and more.
99

1010
<OpenSourceCard
1111
title=".NET SDK"
12-
href="https://github.com/thirdweb-dev/thirdweb-dotnet"
12+
href="https://github.com/thirdweb-dev/dotnet"
1313
isLibrary={true}
1414
/>
1515

apps/portal/src/app/dotnet/pay/getbuywithcryptoquote/page.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ string toAmountWei; // Optional, amount of to token in wei
4949
string toAddress; // Optional, address to receive the to token
5050
int? maxSlippageBPS; // Optional, maximum slippage in basis points
5151
string intentId; // Optional, intent identifier used to link status to a BuyWithFiat onramp flow if any
52+
object purchaseData; // Optional, additional data to be passed and retained during the flow
5253
```
5354

5455
</Details>

apps/portal/src/app/dotnet/pay/getbuywithcryptostatus/page.mdx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,16 @@ var status = await ThirdwebPay.GetBuyWithCryptoStatus(client, txHash);
3636
A `BuyWithCryptoStatusResult` object containing the following properties:
3737

3838
```csharp
39-
Quote quote; // The quote object containing the swap details.
40-
string swapType; // The swap type, see SwapType enum.
41-
TransactionDetails source; // The source transaction details.
42-
TransactionDetails destination; // The destination transaction details.
43-
string status; // The status of the swap, see SwapStatus enum.
44-
string subStatus; // The sub status of the swap, see SwapSubStatus enum.
45-
string fromAddress; // The source address.
46-
string failureMessage; // The failure message if the swap failed.
47-
string bridge // The bridge used for the swap if applicable.
39+
Quote Quote; // The quote object containing the swap details.
40+
string SwapType; // The swap type, see SwapType enum.
41+
TransactionDetails Source; // The source transaction details.
42+
TransactionDetails Destination; // The destination transaction details.
43+
string Status; // The status of the swap, see SwapStatus enum.
44+
string SubStatus; // The sub status of the swap, see SwapSubStatus enum.
45+
string FromAddress; // The source address.
46+
string FailureMessage; // The failure message if the swap failed.
47+
string Bridge; // The bridge used for the swap if applicable.
48+
object PurchaseData; // Additional data passed when creating the quote
4849
```
4950

5051
</Details>

apps/portal/src/app/dotnet/pay/getbuywithfiatquote/page.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ string toAmount; // Optional, amount of to token
4949
string toAmountWei; // Optional, amount of to token in wei
5050
double? maxSlippageBPS; // Optional, maximum slippage in basis points
5151
bool isTestMode; // Optional, enters test mode onramp flow, defaults to false
52+
string preferredProvider; // Optional, can be set to "STRIPE", "KADO", etc.
53+
object purchaseData; // Optional, additional data to be passed and retained during the flow
5254
```
5355

5456
</Details>

apps/portal/src/app/dotnet/pay/getbuywithfiatstatus/page.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ OnRampQuote Quote; // OnRamp Quote details
4545
TransactionDetails Source; // Source transaction details
4646
TransactionDetails Destination; // Destination transaction details
4747
string FailureMessage; // Failure message if any
48+
object PurchaseData; // Additional data passed when creating the quote
4849
```
4950

5051
</Details>

0 commit comments

Comments
 (0)