[Docs] .NET & Unity as of 2.9/5.10 (#5445)

<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on updating the documentation for the `Thirdweb .NET SDK`, adding new methods, modifying existing ones, and improving sidebar navigation. It also removes outdated pages and refines descriptions for better clarity.

### Detailed summary
- Deleted `getemail` and `getphonenumber` action pages.
- Updated the reference link for `ThirdwebExtensions`.
- Added documentation for `EcosystemWallet.GetEcosystemDetails` and `EcosystemWallet.GetUserDetails`.
- Modified sidebar links, replacing `GetEmail` and `GetPhoneNumber` with `GetUserDetails` and `GenerateExternalLoginLink`.
- Added documentation for `EcosystemWallet.GenerateExternalLoginLink`.
- Updated `IThirdwebWallet.Transfer` method description and usage examples.
- Revised wallet connection methods in `ThirdwebManager`, updating method names and descriptions.
- Improved `Child Prefabs` section, renaming and clarifying modal usage.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
This commit is contained in:
0xFirekeeper
2024-11-18 19:10:52 +00:00
parent f01de732fb
commit 565dbb9ef3
9 changed files with 127 additions and 93 deletions
@@ -30,6 +30,6 @@ var balance = await contract.ERC20_BalanceOf("0xOwnerAddress");
## Available Contract Extensions
Please refer to the `ThirdwebExtensions` [full reference](https://thirdweb-dev.github.io/thirdweb-dotnet/docs/Thirdweb.ThirdwebExtensions.html) for a complete list of available contract extensions.
Please refer to the `ThirdwebExtensions` [full reference](https://thirdweb-dev.github.io/dotnet/index.html) for a complete list of available contract extensions.
+12 -8
View File
@@ -68,6 +68,10 @@ const walletActions: SidebarLink = (() => {
name: "ExecuteTransaction",
href: `${parentSlug}/executetransaction`,
},
{
name: "Transfer",
href: `${parentSlug}/transfer`,
},
],
},
{
@@ -75,12 +79,16 @@ const walletActions: SidebarLink = (() => {
isCollapsible: false,
links: [
{
name: "GetEmail",
href: `${parentSlug}/getemail`,
name: "GetUserDetails",
href: `${parentSlug}/getuserdetails`,
},
{
name: "GetPhoneNumber",
href: `${parentSlug}/getphonenumber`,
name: "GetEcosystemDetails",
href: `${parentSlug}/getecosystemdetails`,
},
{
name: "GenerateExternalLoginLink",
href: `${parentSlug}/generateexternalloginlink`,
},
],
},
@@ -124,10 +132,6 @@ const walletActions: SidebarLink = (() => {
name: "GetTransactionCount",
href: `${parentSlug}/gettransactioncount`,
},
{
name: "Transfer",
href: `${parentSlug}/transfer`,
},
],
},
],
@@ -0,0 +1,28 @@
import { Details, createMetadata } from "@doc";
export const metadata = createMetadata({
title: "EcosystemWallet.GenerateExternalLoginLink | Thirdweb .NET SDK",
description: "Method to forward the logged-in session of In-App or Ecosystem Wallets from .NET to React apps built using thirdweb.",
});
# EcosystemWallet.GenerateExternalLoginLink
This method returns a URL that can be used to forward the logged-in session of In-App or Ecosystem Wallets from .NET to React apps built using thirdweb.
Configure your React website to use thirdweb Connect, open the link generated by this method and your users will be autoconnected.
If using Ecosystem Wallets, make sure to create the ecosystem wallet with the same ecosystem id and partner id (if any) and include it as one of your wallets in, for example, your ConnectButton's wallets prop.
Make sure you're using the same api key on both ends.
## Usage
```csharp
var url = await ecosystemWallet.GenerateExternalLoginLink();
```
<Details summary="Return Value">
### string
The URL that can be used to forward the logged-in session of In-App or Ecosystem Wallets from .NET to React apps built using thirdweb.
</Details>
@@ -0,0 +1,24 @@
import { Details, createMetadata } from "@doc";
export const metadata = createMetadata({
title: "EcosystemWallet.GetEcosystemDetails | Thirdweb .NET SDK",
description: "Retrieve information about the Ecosystem the wallet is part of.",
});
# EcosystemWallet.GetEcosystemDetails
This method returns information about the Ecosystem the wallet is part of.
## Usage
```csharp
var result = await ecosystemWallet.GetEcosystemDetails();
```
<Details summary="Return Value">
### EcosystemDetails
The Ecosystem details, such as the Ecosystem name, slug, image URL and more.
</Details>
@@ -1,24 +0,0 @@
import { Details, createMetadata } from "@doc";
export const metadata = createMetadata({
title: "InAppWallet.GetEmail | Thirdweb .NET SDK",
description: "Retrieve the email associated with a logged in InAppWallet.",
});
# InAppWallet.GetEmail
This method retrieves the email associated with a connected `InAppWallet`.
## Usage
```csharp
string email = await inAppWallet.GetEmail();
```
<Details summary="Return Value">
### string
The user's email as a `string`.
</Details>
@@ -1,24 +0,0 @@
import { Details, createMetadata } from "@doc";
export const metadata = createMetadata({
title: "InAppWallet.GetPhoneNumber | Thirdweb .NET SDK",
description: "Retrieve the email associated with a logged in InAppWallet.",
});
# InAppWallet.GetPhoneNumber
This method retrieves the email associated with a connected `InAppWallet`.
## Usage
```csharp
string phoneNumber = await inAppWallet.GetPhoneNumber();
```
<Details summary="Return Value">
### string
The user's phone number as a `string`.
</Details>
@@ -0,0 +1,24 @@
import { Details, createMetadata } from "@doc";
export const metadata = createMetadata({
title: "EcosystemWallet.GetUserDetails | Thirdweb .NET SDK",
description: "Retrieve information about the connected user wallet and its linked accounts.",
});
# EcosystemWallet.GetUserDetails
This method returns information about the connected user wallet and its linked accounts.
## Usage
```csharp
var result = await ecosystemWallet.GetUserDetails();
```
<Details summary="Return Value">
### UserStatusResponse
The user and linked accounts information, such as the user's address, email and more.
</Details>
@@ -3,18 +3,20 @@ import { Details, createMetadata } from "@doc";
export const metadata = createMetadata({
title: "IThirdwebWallet.Transfer | Thirdweb .NET SDK",
description: "Method to transfer the specified amount of Wei to a given address.",
description: "Method to transfer the specified amount of native tokens or ERC20 tokens to a given address.",
});
# IThirdwebWallet.Transfer
This method transfers a specified amount of Wei (smallest denomination of Ether) to a specified wallet address on a given chain.
This method transfers a specified amount of Wei (smallest denomination of Ether) or ERC20s to a specified wallet address on a given chain.
## Usage
```csharp
// Transfer Wei
ThirdwebTransactionReceipt receipt = await wallet.Transfer(chainId, toAddress, weiAmount);
var receipt = await wallet.Transfer(chainId, toAddress, weiAmount);
// Transfer ERC20
var receipt = await wallet.Transfer(chainId, toAddress, weiAmount, erc20ContractAddress);
```
<Details summary="Parameters">
@@ -35,6 +37,10 @@ The address to which the Wei will be transferred.
The amount of Wei to transfer. It must be 0 or greater.
### erc20ContractAddress (optional)
The contract address of the ERC20 token to transfer. If not provided, the transfer will be in native tokens.
</Details>
<Details summary="Return Value">
@@ -85,6 +85,32 @@ var result = await contract.Read<string>("name");
Returns a [ThirdwebContract](/dotnet/contracts/create) instance that can be used to interact with a smart contract.
### ConnectWallet
```csharp
var walletOptions = new WalletOptions(WalletProvider.PrivateKeyWallet, 421614);
var wallet = await ThirdwebManager.Instance.ConnectWallet(walletOptions);
var address = await wallet.GetAddress();
```
Connects a wallet based on the specified `WalletOptions` and returns an `IThirdwebWallet` instance that can be used to interact with the blockchain.
### UpgradeToSmartWallet
```csharp
var smartWallet = await ThirdwebManager.Instance.UpgradeToSmartWallet(wallet, chainId, smartWalletOptions);
```
Upgrades the specified wallet to a `SmartWallet`, returning a `SmartWallet` instance.
### LinkAccount
```csharp
var linkedAccounts = await ThirdwebManager.Instance.LinkAccount(mainWallet, walletToLink, otp, chainId, jwtOrPayload);
```
Links another `InAppWallet` or `EcosystemWallet` account to the main wallet and returns a list of linked accounts, allowing you to login with either authentication method later.
### GetActiveWallet
```csharp
@@ -125,43 +151,13 @@ ThirdwebManager.Instance.RemoveWallet("wallet-address");
Removes a wallet from the manager's wallet mapping by its address.
### ConnectWallet
```csharp
var walletOptions = new WalletOptions(WalletProvider.PrivateKeyWallet, 421614);
var wallet = await ThirdwebManager.Instance.ConnectWallet(walletOptions);
var address = await wallet.GetAddress();
```
Connects a wallet based on the specified `WalletOptions` and returns an `IThirdwebWallet` instance that can be used to interact with the blockchain.
### UpgradeToSmartWallet
```csharp
var smartWallet = await ThirdwebManager.Instance.UpgradeToSmartWallet(wallet, chainId, smartWalletOptions);
```
Upgrades the specified wallet to a `SmartWallet`, returning a `SmartWallet` instance.
### LinkAccount
```csharp
var linkedAccounts = await ThirdwebManager.Instance.LinkAccount(mainWallet, walletToLink, otp, chainId, jwtOrPayload);
```
Links another `InAppWallet` account to the main wallet and returns a list of linked accounts, allowing you to login with either authentication method later.
## Child Prefabs
### InAppWalletModal
### DefaultOTPModal
The `InAppWalletModal` prefab is a simple and customizable OTP verification modal for `InAppWallet` providers. It is used to verify and finalize the user's wallet connection.
The helper modal that is displayed when using the `ThirdwebManager`'s `ConnectWallet` function with an auth method that requires an OTP, such as Email or Phone login.
It will be automatically activated when connecting to an `InAppWallet` provider.
### EcosystemWalletModal
Similar use case as `InAppWalletModal`, but for `EcosystemWallet` providers.
It can be replaced with a custom modal that extends `AbstractOTPVerifyModal` to customize the OTP verification process.
### WalletConnectModal