diff --git a/apps/portal/src/app/dotnet/client/page.mdx b/apps/portal/src/app/dotnet/client/page.mdx index abacc0c9b7c..1be5fcd715e 100644 --- a/apps/portal/src/app/dotnet/client/page.mdx +++ b/apps/portal/src/app/dotnet/client/page.mdx @@ -64,4 +64,19 @@ Options for configuring timeouts for fetching data. Useful for fine-tuning reque TimeoutOptions(int? storage = null, int? rpc = null, int? other = null) ``` +### rpcOverrides (optional) + +Overrides for the default RPC endpoints. Will use your custom endpoints instead of thirdweb RPC endpoints. + +```csharp +var client = ThirdwebClient.Create( + ..., + rpcOverrides: new() + { + { 1, "https://eth.llamarpc.com" }, + { 42161, "https://arbitrum.llamarpc.com" } + } +); +``` + diff --git a/apps/portal/src/app/dotnet/nebula/quickstart/page.mdx b/apps/portal/src/app/dotnet/nebula/quickstart/page.mdx new file mode 100644 index 00000000000..0809e12122f --- /dev/null +++ b/apps/portal/src/app/dotnet/nebula/quickstart/page.mdx @@ -0,0 +1,100 @@ +import { Details, createMetadata } from "@doc"; + +export const metadata = createMetadata({ + title: "ThirdwebContract.Create | Thirdweb .NET SDK", + description: + "Instantiate a ThirdwebContract to interact with smart contracts.", +}); + +# [Nebula AI](https://thirdweb.com/nebula) .NET Integration +The last piece of the puzzle required to create .NET apps and games leveraging a blockchain-powered AI assistant or NPC that also has the power to fully execute transactions. + +## Read, Write, Reason. +The best way to understand is to look at examples. + +We'll prepare some context for the AI - here, we'll generate a basic `PrivateKeyWallet` and upgrade it to a `SmartWallet` on Sepolia. +```csharp +// Prepare some context +var myChain = 11155111; // Sepolia +var mySigner = await PrivateKeyWallet.Generate(client); +var myWallet = await SmartWallet.Create(mySigner, myChain); +var myContractAddress = "0xe2cb0eb5147b42095c2FfA6F7ec953bb0bE347D8"; // DropERC1155 +var usdcAddress = "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"; // Sepolia USDC +``` + +A one liner creates a Nebula session. +```csharp +// Create a Nebula session +var nebula = await ThirdwebNebula.Create(client); +``` + +You can **Chat** with Nebula. The Chat method accepts any `IThirdwebWallet` as an optional parameter, context will automatically be updated. +```csharp +// Chat, passing wallet context +var response1 = await nebula.Chat(message: "What is my wallet address?", wallet: myWallet); +Console.WriteLine($"Response 1: {response1.Message}"); +``` + +You may also pass it smart contract context. +```csharp +// Chat, passing contract context +var response2 = await nebula.Chat( + message: "What's the total supply of token id 0 for this contract?", + context: new NebulaContext(contractAddresses: new List { myContractAddress }, chainIds: new List { myChain }) +); +Console.WriteLine($"Response 2: {response2.Message}"); +``` + +You can have a full on conversation with it with our **Chat** override accepting multiple messages. +```csharp +// Chat, passing multiple messages and context +var response3 = await nebula.Chat( + messages: new List + { + new($"Tell me the name of this contract: {myContractAddress}", NebulaChatRole.User), + new("The name of the contract is CatDrop", NebulaChatRole.Assistant), + new("What's the symbol of this contract?", NebulaChatRole.User), + }, + context: new NebulaContext(contractAddresses: new List { myContractAddress }, chainIds: new List { myChain }) +); +Console.WriteLine($"Response 3: {response3.Message}"); +``` + +Chatting is cool, but what if I just want it to _**do**_ things and stop talking so much? + +You can **Execute** transactions directly with a simple prompt. +```csharp +// Execute, this directly sends transactions +var executionResult = await nebula.Execute("Approve 1 USDC to vitalik.eth", wallet: myWallet, context: new NebulaContext(contractAddresses: new List() { usdcAddress })); +if (executionResult.TransactionReceipts != null && executionResult.TransactionReceipts.Count > 0) +{ + Console.WriteLine($"Receipt: {executionResult.TransactionReceipts[0]}"); +} +else +{ + Console.WriteLine($"Message: {executionResult.Message}"); +} +``` + +Similarly, **Execute** can take in multiple messages. +```csharp +// Batch execute +var batchExecutionResult = await nebula.Execute( + new List + { + new("What's the address of vitalik.eth", NebulaChatRole.User), + new("The address of vitalik.eth is 0xd8dA6BF26964aF8E437eEa5e3616511D7G3a3298", NebulaChatRole.Assistant), + new("Approve 1 USDC to them", NebulaChatRole.User), + }, + wallet: myWallet, + context: new NebulaContext(contractAddresses: new List() { usdcAddress }) +); +if (batchExecutionResult.TransactionReceipts != null && batchExecutionResult.TransactionReceipts.Count > 0) +{ + Console.WriteLine($"Receipts: {JsonConvert.SerializeObject(batchExecutionResult.TransactionReceipts, Formatting.Indented)}"); +} +else +{ + Console.WriteLine($"Message: {batchExecutionResult.Message}"); +} +``` \ No newline at end of file diff --git a/apps/portal/src/app/dotnet/sidebar.tsx b/apps/portal/src/app/dotnet/sidebar.tsx index 4f3f2a5085d..cc7e48c45c4 100644 --- a/apps/portal/src/app/dotnet/sidebar.tsx +++ b/apps/portal/src/app/dotnet/sidebar.tsx @@ -1,6 +1,6 @@ import type { SideBar } from "@/components/Layouts/DocLayout"; import type { SidebarLink } from "@/components/others/Sidebar"; -import { ZapIcon } from "lucide-react"; +import { CodeIcon, ExternalLink, ZapIcon } from "lucide-react"; const walletProviders: SidebarLink = (() => { const parentSlug = "/dotnet/wallets/providers"; @@ -261,16 +261,29 @@ export const sidebar: SideBar = { icon: , }, { - name: "Godot Integration", - href: "/dotnet/godot", - }, - { - name: "Unity Integration", - href: "/unity/v5", + name: "API Reference", + href: "https://thirdweb-dev.github.io/dotnet/index.html", + isCollapsible: false, + icon: , }, { - name: "MAUI Integration", - href: "/dotnet/maui", + name: "Integrations", + isCollapsible: true, + icon: , + links: [ + { + name: "Unity", + href: "/unity/v5", + }, + { + name: "Godot", + href: "/dotnet/godot", + }, + { + name: "MAUI", + href: "/dotnet/maui", + }, + ], }, { name: "Core", @@ -291,7 +304,6 @@ export const sidebar: SideBar = { isCollapsible: false, links: [walletProviders, walletActions], }, - pay, { name: "Blockchain API", isCollapsible: false, @@ -304,10 +316,20 @@ export const sidebar: SideBar = { }, ], }, - { separator: true }, { - name: "Full Reference", - href: "https://thirdweb-dev.github.io/dotnet/index.html", + name: "Nebula AI", + isCollapsible: false, + links: [ + { + name: "Quickstart", + href: "/dotnet/nebula/quickstart", + }, + { + name: "Nebula Full Reference", + href: "https://thirdweb-dev.github.io/dotnet/docs/Thirdweb.AI.ThirdwebNebula.html", + }, + ], }, + pay, ], }; diff --git a/apps/portal/src/app/dotnet/wallets/providers/ecosystem-wallet/page.mdx b/apps/portal/src/app/dotnet/wallets/providers/ecosystem-wallet/page.mdx index 6cd94a53c05..d86fdc15a64 100644 --- a/apps/portal/src/app/dotnet/wallets/providers/ecosystem-wallet/page.mdx +++ b/apps/portal/src/app/dotnet/wallets/providers/ecosystem-wallet/page.mdx @@ -15,11 +15,13 @@ Create an instance of `EcosystemWallet` using a user's email, phone number or OA Ecosystem Wallets support a variety of login methods: - Email (OTP Login) - Phone (OTP Login) -- Socials (Google, Apple, Facebook, Telegram, Farcaster, Line, Github, Twitch, Steam, etc.) -- SIWE (Sign-In with Ethereum) +- Socials (Google, Apple, Facebook, Telegram, Farcaster, Line, Github, Twitch, Steam etc.) - Custom Auth (OIDC Compatible) - Custom Auth (Generic Auth Endpoint) - Guest (Onboard easily, link other accounts later) +- Backend (Server Wallets) +- Siwe (Login with a seperate wallet supported by the SDK) +- SiweExternal (Login with an external wallet that only supports web using a browser loading a static thirdweb React page temporarily) ## Usage @@ -32,14 +34,18 @@ var wallet = await EcosystemWallet.Create(client: client, ecosystemId: "ecosyste var wallet = await EcosystemWallet.Create(client: client, ecosystemId: "ecosystem.my-ecosystem", phoneNumber: "+1234567890"); // Google, Apple, Facebook, etc. var wallet = await EcosystemWallet.Create(client: client, ecosystemId: "ecosystem.my-ecosystem", authProvider: AuthProvider.Google); -// SIWE -var wallet = await EcosystemWallet.Create(client: client, ecosystemId: "ecosystem.my-ecosystem", authProvider: AuthProvider.Siwe, siweSigner: anyExternalWallet); // Custom Auth - JWT var wallet = await EcosystemWallet.Create(client: client, ecosystemId: "ecosystem.my-ecosystem", authProvider: AuthProvider.JWT); // Custom Auth - AuthEndpoint var wallet = await EcosystemWallet.Create(client: client, ecosystemId: "ecosystem.my-ecosystem", authProvider: AuthProvider.AuthEndpoint); // Guest Login var wallet = await EcosystemWallet.Create(client: client, ecosystemId: "ecosystem.my-ecosystem", authProvider: AuthProvider.Guest); +// Server Login +var wallet = await EcosystemWallet.Create(client: client, ecosystemId: "ecosystem.my-ecosystem", authProvider: AuthProvider.Backend, walletSecret: "very-secret"); +// Siwe +var wallet = await EcosystemWallet.Create(client: client, ecosystemId: "ecosystem.my-ecosystem", authProvider: AuthProvider.Siwe, siweSigner: anyExternalWallet); +// SiweExternal +var wallet = await EcosystemWallet.Create(client: client, ecosystemId: "ecosystem.my-ecosystem", authProvider: AuthProvider.SiweExternal); // Session resuming supported for all methods var isConnected = await wallet.IsConnected(); @@ -62,9 +68,6 @@ var address = await wallet.LoginWithOauth( mobileRedirectScheme: "myBundleId://" ); -// SIWE (Wallet) -var address = await siweWallet.LoginWithSiwe(chainId: 1); - // Custom Auth (JWT) var address = await wallet.LoginWithCustomAuth(jwt: "myjwt"); @@ -73,11 +76,26 @@ var address = await wallet.LoginWithAuthEndpoint(payload: "mypayload"); // Guest Login (Easy onboarding) var address = await wallet.LoginWithGuest(); + +// Backend (Server Wallets) +var address = await wallet.LoginWithBackend(); + +// SIWE (Wallet) +var address = await siweWallet.LoginWithSiwe(chainId: 1); + +// SiweExternal (React-only wallet) +var address = await wallet.LoginWithSiweExternal( + // Windows console app example, adaptable to any runtime + isMobile: false, + browserOpenAction: (url) => + { + var psi = new ProcessStartInfo { FileName = url, UseShellExecute = true }; + _ = Process.Start(psi); + }, + forceWalletIds: new List { "io.metamask", "com.coinbase.wallet", "xyz.abs" } +); ``` - - This wallet is designed for client-side use in applications where direct access to the user's private keys is not safe or necessary. It leverages OTP for secure authentication, allowing users to interact with blockchain applications seamlessly. -
### client (required) @@ -108,6 +126,18 @@ The OAuth provider to use for authentication. Supported values are `AuthProvider The path to the directory where the wallet data is stored. Defaults to the application's data directory. +### siweSigner (optional) + +An external wallet instance to use for SIWE authentication. + +### legacyEncryptionKey (optional) + +The encryption key that is no longer required but was used in the past. Only pass this if you had used custom auth before this was deprecated. + +### walletSecret (optional) + +The secret identifier to use when creating server-side wallets with backend authentication. +
@@ -246,6 +276,31 @@ if (!await ecosystemWallet.IsConnected()) **Note:** The `LoginWithOauth` API allows for custom browser handling, making it suitable for various application types and platforms. +## External Wallet Auth (Siwe & SiweExternal) + +**LoginWithSiwe:** Initiate the login process by calling LoginWithSiwe on the EcosystemWallet instance. This will prompt the external wallet to sign a message instantly. + +```csharp +var address = await siweWallet.LoginWithSiwe(chainId: 1); +``` + +**LoginWithSiweExternal:** Initiate the login process by calling LoginWithSiweExternal on the EcosystemWallet instance. This will initiate a browser-based login flow for external wallets that only support web platforms. + +```csharp +var address = await wallet.LoginWithSiweExternal( + // Windows console app example, adaptable to any runtime + isMobile: false, + browserOpenAction: (url) => + { + var psi = new ProcessStartInfo { FileName = url, UseShellExecute = true }; + _ = Process.Start(psi); + }, + forceWalletIds: new List { "io.metamask", "com.coinbase.wallet", "xyz.abs" } +); +``` + +Note: The parameters are similar to the OAuth flow, with the addition of `forceWalletIds` to specify the wallet IDs to force the user to use. Using a single wallet id will skip the wallet selection screen and directly open the wallet. + ## Unified Identity - Account Linking EcosystemWallet supports linking multiple authentication methods to a single user account. This feature enables users to access their account using different authentication methods, such as email, phone, or OAuth, without creating separate accounts for each method. diff --git a/apps/portal/src/app/dotnet/wallets/providers/in-app-wallet/page.mdx b/apps/portal/src/app/dotnet/wallets/providers/in-app-wallet/page.mdx index ee772449234..a4a924d83b3 100644 --- a/apps/portal/src/app/dotnet/wallets/providers/in-app-wallet/page.mdx +++ b/apps/portal/src/app/dotnet/wallets/providers/in-app-wallet/page.mdx @@ -15,11 +15,13 @@ Create an instance of `InAppWallet` using a user's email, phone number or OAuth. In-App Wallets support a variety of login methods: - Email (OTP Login) - Phone (OTP Login) -- Socials (Google, Apple, Facebook, Telegram, Farcaster, Line, Github, Twitch etc.) -- SIWE (Sign-In with Ethereum) +- Socials (Google, Apple, Facebook, Telegram, Farcaster, Line, Github, Twitch, Steam etc.) - Custom Auth (OIDC Compatible) - Custom Auth (Generic Auth Endpoint) - Guest (Onboard easily, link other accounts later) +- Backend (Server Wallets) +- Siwe (Login with a seperate wallet supported by the SDK) +- SiweExternal (Login with an external wallet that only supports web using a browser loading a static thirdweb React page temporarily) ## Usage @@ -30,14 +32,18 @@ var wallet = await InAppWallet.Create(client: client, email: "userEmail"); var wallet = await InAppWallet.Create(client: client, phoneNumber: "+1234567890"); // Google, Apple, Facebook, etc. var wallet = await InAppWallet.Create(client: client, authProvider: AuthProvider.Google); -// SIWE -var wallet = await InAppWallet.Create(client: client, authProvider: AuthProvider.Siwe, siweSigner: anyExternalWallet); // Custom Auth - JWT var wallet = await InAppWallet.Create(client: client, authProvider: AuthProvider.JWT); // Custom Auth - AuthEndpoint var wallet = await InAppWallet.Create(client: client, authProvider: AuthProvider.AuthEndpoint); // Guest Login var wallet = await InAppWallet.Create(client: client, authProvider: AuthProvider.Guest); +// Server Login +var wallet = await InAppWallet.Create(client: client, authProvider: AuthProvider.Backend, walletSecret: "very-secret"); +// Siwe +var wallet = await InAppWallet.Create(client: client, authProvider: AuthProvider.Siwe, siweSigner: anyExternalWallet); +// SiweExternal +var wallet = await InAppWallet.Create(client: client, authProvider: AuthProvider.SiweExternal); // Session resuming supported for all methods var isConnected = await wallet.IsConnected(); @@ -60,9 +66,6 @@ var address = await wallet.LoginWithOauth( mobileRedirectScheme: "myBundleId://" ); -// SIWE (Wallet) -var address = await siweWallet.LoginWithSiwe(chainId: 1); - // Custom Auth (JWT) var address = await wallet.LoginWithCustomAuth(jwt: "myjwt"); @@ -71,11 +74,26 @@ var address = await wallet.LoginWithAuthEndpoint(payload: "mypayload"); // Guest Login (Easy onboarding) var address = await wallet.LoginWithGuest(); + +// Backend (Server Wallets) +var address = await wallet.LoginWithBackend(); + +// SIWE (Wallet) +var address = await siweWallet.LoginWithSiwe(chainId: 1); + +// SiweExternal (React-only wallet) +var address = await wallet.LoginWithSiweExternal( + // Windows console app example, adaptable to any runtime + isMobile: false, + browserOpenAction: (url) => + { + var psi = new ProcessStartInfo { FileName = url, UseShellExecute = true }; + _ = Process.Start(psi); + }, + forceWalletIds: new List { "io.metamask", "com.coinbase.wallet", "xyz.abs" } +); ``` - - This wallet is designed for client-side use in applications where direct access to the user's private keys is not safe or necessary. It leverages OTP for secure authentication, allowing users to interact with blockchain applications seamlessly. -
### client (required) @@ -98,189 +116,29 @@ The OAuth provider to use for authentication. Supported values are `AuthProvider The path to the directory where the wallet data is stored. Defaults to the application's data directory. -
- -
- -### InAppWallet - -Returns an instance of InAppWallet, initialized for the user based on the provided email or phone number. This wallet is ready for OTP authentication and further blockchain interactions. - -
- -## OTP Authentication Flow - -The OTP authentication flow involves sending an OTP to the user's email or phone and then verifying the OTP to complete authentication: - -**Send OTP:** Initiate the login process by calling SendOTP on the InAppWallet instance. This sends an OTP to the user's email or phone number. - -```csharp -await wallet.SendOTP(); -``` - -**Submit OTP:** Once the user receives the OTP, they submit it back to the application, which then calls LoginWithOtp on the InAppWallet instance to verify the OTP and complete the login process. - -```csharp -var address = await wallet.LoginWithOtp("userEnteredOTP"); -// If this fails, feel free to catch and take in another OTP and retry the login process -``` - -## Example - -Here's an example of creating an `InAppWallet` with a user's email and completing the OTP authentication flow: - -```csharp -// Create InAppWallet wallet as signer to unlock web2 auth -var inAppWallet = await InAppWallet.Create(client: client, email: "email@email.com"); // or email: null, phoneNumber: "+1234567890" - -// Resume session (if `InAppWallet` wallet was not logged in) -if (!await inAppWallet.IsConnected()) -{ - await inAppWallet.SendOTP(); - Console.WriteLine("Please submit the OTP."); - var otp = Console.ReadLine(); - var inAppWalletAddress = await inAppWallet.LoginWithOtp(otp); // try catch and retry if needed -} - -Console.WriteLine($"InAppWallet address: {await inAppWallet.GetAddress()}"); - -// Sign a message -var message = "Hello, Thirdweb!"; -var signature = await wallet.PersonalSign(message); -Console.WriteLine($"Signature: {signature}"); -``` - -**Note:** InAppWallet leverages the security of OTP-based authentication to ensure a secure and user-friendly experience in blockchain applications. - -## OAuth Authentication Flow - -**LoginWithOauth:** Initiate the login process by calling LoginWithOauth on the InAppWallet instance. This redirects the user to the OAuth provider's login page. - -```csharp -// Windows console app example -var address = await inAppWallet.LoginWithOauth( - isMobile: false, - browserOpenAction: (url) => - { - var psi = new ProcessStartInfo { FileName = url, UseShellExecute = true }; - _ = Process.Start(psi); - }, -); -// Godot standalone example -var address = await ThirdwebManager.Instance.InAppWallet.LoginWithOauth( - isMobile: OS.GetName() == "Android" || OS.GetName() == "iOS", - browserOpenAction: (url) => OS.ShellOpen(url), - mobileRedirectScheme: "thirdweb://" -); -``` - -
- -### isMobile - -A `bool` indicating whether the application is running on a mobile platform. - -### browserOpenAction +### siweSigner (optional) -An `Action` that opens the OAuth provider's login page in a browser. +An external wallet instance to use for SIWE authentication. -### mobileRedirectScheme +### legacyEncryptionKey (optional) -The redirect scheme to use for mobile platforms. Defaults to `"thirdweb://"`. +The encryption key that is no longer required but was used in the past. Only pass this if you had used custom auth before this was deprecated. -### browser +### walletSecret (optional) -An instance of `IThirdwebBrowser` to use for the OAuth login process. Defaults to `null`. - -### cancellationToken - -A `CancellationToken` to cancel the operation. Defaults to `default`. +The secret identifier to use when creating server-side wallets with backend authentication.
-### string +### InAppWallet -The InAppWallet address as a hexadecimal `string`. +Returns an instance of InAppWallet, initialized for the user based on the provided email or phone number. This wallet is ready for OTP authentication and further blockchain interactions.
-## Example - -Here's an example of creating an `InAppWallet` using OAuth. - -```csharp -// Create InAppWallet wallet as signer to unlock web2 auth -var inAppWallet = await InAppWallet.Create(client: client, authProvider: AuthProvider.Google); - -// Resume session (if `InAppWallet` wallet was not logged in) -if (!await inAppWallet.IsConnected()) -{ - try { - var address = await inAppWallet.LoginWithOauth( - isMobile: false, - browserOpenAction: (url) => - { - var psi = new ProcessStartInfo { FileName = url, UseShellExecute = true }; - _ = Process.Start(psi); - }, - ); - Console.WriteLine($"OAuth login successful. InAppWallet address: {address}"); - } catch (Exception ex) { - Console.WriteLine($"OAuth login failed: {ex.Message}"); - return; - } -} -``` - -**Note:** The `LoginWithOauth` API allows for custom browser handling, making it suitable for various application types and platforms. - -## Unified Identity - Account Linking +## Authentication, Linking and more. -InAppWallet supports linking multiple authentication methods to a single user account. This feature enables users to access their account using different authentication methods, such as email, phone, or OAuth, without creating separate accounts for each method. +`InAppWallet` extends `EcosystemWallet`, refer to the [EcosystemWallet](/dotnet/wallets/providers/ecosystem-wallet) documentation for information about authentication, linking multiple auth providers to the same wallet, and more. All functionality outside of creation and third-party integrations is the same as `EcosystemWallet`. -### Linking Accounts - -```csharp -var inAppWalletMain = await InAppWallet.Create(client: client, authProvider: AuthProvider.Google); -if (!await inAppWalletMain.IsConnected()) -{ - _ = await inAppWalletMain.LoginWithOauth( - isMobile: false, - (url) => - { - var psi = new ProcessStartInfo { FileName = url, UseShellExecute = true }; - _ = Process.Start(psi); - }, - "thirdweb://", - new InAppWalletBrowser() - ); -} -Console.WriteLine($"Main InAppWallet address: {await inAppWalletMain.GetAddress()}"); - -// Prepare Telegram -var socialWallet = await InAppWallet.Create(client: client, authProvider: AuthProvider.Telegram); -// Link Telegram -_ = await inAppWalletMain.LinkAccount(walletToLink: socialWallet,); - -// Prepare Phone -var phoneWallet = await InAppWallet.Create(client: client, phoneNumber: "+1234567890"); -_ = await phoneWallet.SendOTP(); -var otp = Console.ReadLine(); -// Link Phone -_ = await inAppWalletMain.LinkAccount(walletToLink: phoneWallet, otp: otp); -``` - -### Getting Linked Accounts - -```csharp -List linkedAccounts = await inAppWalletMain.GetLinkedAccounts(); -``` - -### Unlinking Accounts - -```csharp -List linkedAccounts = await inAppWallet.GetLinkedAccounts(); -List linkedAccountsAfterUnlinking = await inAppWallet.UnlinkAccount(linkedAccounts[0]); -``` \ No newline at end of file diff --git a/apps/portal/src/app/unity/v5/sidebar.tsx b/apps/portal/src/app/unity/v5/sidebar.tsx index 57f798b2b87..8e2a5894bfe 100644 --- a/apps/portal/src/app/unity/v5/sidebar.tsx +++ b/apps/portal/src/app/unity/v5/sidebar.tsx @@ -1,5 +1,5 @@ import type { SideBar } from "@/components/Layouts/DocLayout"; -import { ZapIcon } from "lucide-react"; +import { CodeIcon, ZapIcon } from "lucide-react"; const sdkSlug = "/unity/v5"; const walletProvidersSlug = `${sdkSlug}/wallets`; @@ -17,6 +17,12 @@ export const sidebar: SideBar = { href: `${sdkSlug}/getting-started`, icon: , }, + { + name: "API Reference", + href: "/dotnet", + isCollapsible: false, + icon: , + }, { name: "Core", isCollapsible: false, @@ -61,6 +67,20 @@ export const sidebar: SideBar = { }, ], }, + { + name: "Blockchain API", + isCollapsible: false, + links: [ + { + name: "Interacting with Contracts", + href: `${sdkSlug}/contracts`, + }, + { + name: "Full Reference", + href: "https://thirdweb-dev.github.io/dotnet/index.html", + }, + ], + }, { name: "Pay", isCollapsible: false, @@ -72,27 +92,19 @@ export const sidebar: SideBar = { ], }, { - name: "Blockchain API", + name: "Nebula AI", isCollapsible: false, links: [ { - name: "Interacting with Contracts", - href: `${sdkSlug}/contracts`, - }, - { separator: true }, - { - name: "Migrate from v4", - href: `${sdkSlug}/migration-guide`, - }, - { - name: ".NET SDK Portal", - href: "/dotnet", - }, - { - name: "Full Reference", - href: "https://thirdweb-dev.github.io/dotnet/index.html", + name: ".NET SDK QuickStart", + href: "/dotnet/nebula/quickstart", }, ], }, + { separator: true }, + { + name: "Migrate from v4", + href: `${sdkSlug}/migration-guide`, + }, ], }; diff --git a/apps/portal/src/app/unity/v5/thirdwebmanager/page.mdx b/apps/portal/src/app/unity/v5/thirdwebmanager/page.mdx index 1c324575d03..86683182e5c 100644 --- a/apps/portal/src/app/unity/v5/thirdwebmanager/page.mdx +++ b/apps/portal/src/app/unity/v5/thirdwebmanager/page.mdx @@ -44,7 +44,7 @@ This section allows you to define the default preferences for the SDK: - `Initialize On Awake`: Whether the SDK should initialize on awake or not. If not, you can call `ThirdwebManager.Instance.Initialize()` to initialize it manually. - `Show Debug Logs`: Whether to show thirdweb SDK debug logs. -- `Opt Out Usage Analytics`: Whether to opt out of Connect usage analytics, such as the number of wallets connected to your game. +- `Auto-Connect Last Wallet`: If enabled, we will automatically connect to the last connected wallet on initialization (this behavior does not apply to the WalletConnectWallet provider option). If a wallet was connected as a non smart wallet, then later upgraded, the smart wallet is saved as the last wallet, and the next session will autoconnect to the smart wallet. Any failure during this entire flow should not throw. ### Miscellaneous @@ -52,8 +52,10 @@ This section allows you to define the default preferences for the SDK: This section allows you to customize the SDK's behavior: -- `Supported Chains`: A list of chains that the wallets should be able to connect to by default when using `WalletConnect` as a wallet provider. -- `Redirect Page HTML Override`: Raw HTML to override the default redirect page when connecting to `InAppWallet` or `EcosystemWallet` providers. +- `RPC Overrides`: A list of RPC overrides to use when connecting to a chain. You can bypass using thirdweb's RPC that way (not recommended). +- `OAuth Redirect Page HTML Override`: Raw HTML to override the default redirect page when connecting to `InAppWallet` or `EcosystemWallet` providers. +- `WalletConnect Supported Chains`: A list of chains that the wallets should be able to connect to by default when using `WalletConnect` as a wallet provider. +- `WalletConnect Included Wallet IDs`: A list of wallet IDs that should be included in the WalletConnect modal by default (optional override). ### Debug diff --git a/apps/portal/src/app/unity/v5/thirdwebmanager/thirdwebmanager_misc.png b/apps/portal/src/app/unity/v5/thirdwebmanager/thirdwebmanager_misc.png index a46d1770537..16b9a391607 100644 Binary files a/apps/portal/src/app/unity/v5/thirdwebmanager/thirdwebmanager_misc.png and b/apps/portal/src/app/unity/v5/thirdwebmanager/thirdwebmanager_misc.png differ diff --git a/apps/portal/src/app/unity/v5/thirdwebmanager/thirdwebmanager_preferences.png b/apps/portal/src/app/unity/v5/thirdwebmanager/thirdwebmanager_preferences.png index 333dcecbbb0..b1bd2b3863d 100644 Binary files a/apps/portal/src/app/unity/v5/thirdwebmanager/thirdwebmanager_preferences.png and b/apps/portal/src/app/unity/v5/thirdwebmanager/thirdwebmanager_preferences.png differ diff --git a/apps/portal/src/app/unity/v5/wallets/ecosystem-wallet/page.mdx b/apps/portal/src/app/unity/v5/wallets/ecosystem-wallet/page.mdx index af89ffe348c..58ad2bb41cf 100644 --- a/apps/portal/src/app/unity/v5/wallets/ecosystem-wallet/page.mdx +++ b/apps/portal/src/app/unity/v5/wallets/ecosystem-wallet/page.mdx @@ -20,11 +20,13 @@ Ecosystem Wallets have a very similar API to the [In-App Wallet](/unity/v5/walle Ecosystem Wallets support a variety of login methods: - Email (OTP Login) - Phone (OTP Login) -- Socials (Google, Apple, Facebook, Telegram, Farcaster, Line, Github, Twitch, Steam, etc.) -- SIWE (Sign-In with Ethereum) +- Socials (Google, Apple, Facebook, Telegram, Farcaster, Line, Github, Twitch, Steam etc.) - Custom Auth (OIDC Compatible) - Custom Auth (Generic Auth Endpoint) - Guest (Onboard easily, link other accounts later) +- Backend (Server Wallets) +- Siwe (Login with a seperate wallet supported by the SDK) +- SiweExternal (Login with an external wallet that only supports web using a browser loading a static thirdweb React page temporarily) ### Login with Email @@ -95,6 +97,29 @@ var wallet = await ThirdwebManager.Instance.ConnectWallet(options); Will use the external wallet to sign a message and login to the EcosystemWallet. +### Login with SiweExternal + +```csharp +var ecosystemWalletOptions = new EcosystemWalletOptions(ecosystemId: "ecosystem.your-ecosystem", authprovider: AuthProvider.SiweExternal) +var options = new WalletOptions( + provider: WalletProvider.EcosystemWallet, + chainId: 421614, + ecosystemWalletOptions: ecosystemWalletOptions +); +var wallet = await ConnectWallet(options); +``` + +Will open a browser and load a static thirdweb React page to authenticate the user and redirect back to the game. +You can pass `forceSiweExternalWalletIds` to force the page to use one or more wallets. + +Example: +```csharp +var ecosystemWalletOptions = new EcosystemWalletOptions( + ecosystemId: "ecosystem.your-ecosystem", + authprovider: AuthProvider.SiweExternal, + forceSiweExternalWalletIds: new List { "xyz.abs" }); +``` + ### Login with Custom Auth - OIDC Compatible ```csharp @@ -142,6 +167,22 @@ var options = new WalletOptions( var wallet = await ThirdwebManager.Instance.ConnectWallet(options); ``` +### Login with Backend - Server Wallets + +```csharp +var ecosystemWalletOptions = new EcosystemWalletOptions( + ecosystemId: "ecosystem.your-ecosystem", + authprovider: AuthProvider.Backend, + walletSecret: "very-secret" +); +var options = new WalletOptions( + provider: WalletProvider.EcosystemWallet, + chainId: 1, + ecosystemWalletOptions: ecosystemWalletOptions +); +var wallet = await ThirdwebManager.Instance.ConnectWallet(options); +``` + ## Account Linking EcosystemWallets support linking multiple authentication methods to a single wallet, for instance linking Google to your Email-based In-App-Wallet. This is useful to have a unified identity across platforms. diff --git a/apps/portal/src/app/unity/v5/wallets/in-app-wallet/page.mdx b/apps/portal/src/app/unity/v5/wallets/in-app-wallet/page.mdx index 8d5290b3a74..9bb2f3b1df0 100644 --- a/apps/portal/src/app/unity/v5/wallets/in-app-wallet/page.mdx +++ b/apps/portal/src/app/unity/v5/wallets/in-app-wallet/page.mdx @@ -18,11 +18,13 @@ It makes for a fantastic [SmartWallet](/unity/v5/wallets/account-abstraction) ad In-App Wallets support a variety of login methods: - Email (OTP Login) - Phone (OTP Login) -- Socials (Google, Apple, Facebook, Telegram, Farcaster, Line, Github, Twitch, Steam, etc.) -- SIWE (Sign-In with Ethereum) +- Socials (Google, Apple, Facebook, Telegram, Farcaster, Line, Github, Twitch, Steam etc.) - Custom Auth (OIDC Compatible) - Custom Auth (Generic Auth Endpoint) - Guest (Onboard easily, link other accounts later) +- Backend (Server Wallets) +- Siwe (Login with a seperate wallet supported by the SDK) +- SiweExternal (Login with an external wallet that only supports web using a browser loading a static thirdweb React page temporarily) ### Login with Email @@ -66,10 +68,10 @@ var wallet = await ThirdwebManager.Instance.ConnectWallet(options); Will open a native browser or oauth session to authenticate the user and redirect back to the game. -### Login with SIWE +### Login with Siwe ```csharp -var inAppWalletOptions = new InAppWalletOptions(authprovider: AuthProvider.Siwe, siweSigner: anyExternalWallet); +var inAppWalletOptions = new InAppWalletOptions(authprovider: AuthProvider.Siwe, siweSigner: sdkSupportedExternalWallet); var options = new WalletOptions( provider: WalletProvider.InAppWallet, chainId: 1, @@ -78,7 +80,29 @@ var options = new WalletOptions( var wallet = await ThirdwebManager.Instance.ConnectWallet(options); ``` -Will use the external wallet to sign a message and login to the InAppWallet. +Will use a separate wallet to sign a message and login to the InAppWallet. + +### Login with SiweExternal + +```csharp +var inAppWalletOptions = new InAppWalletOptions(authprovider: AuthProvider.SiweExternal) +var options = new WalletOptions( + provider: WalletProvider.InAppWallet, + chainId: 421614, + inAppWalletOptions: inAppWalletOptions +); +var wallet = await ConnectWallet(inAppWalletOptions); +``` + +Will open a browser and load a static thirdweb React page to authenticate the user and redirect back to the game. +You can pass `forceSiweExternalWalletIds` to force the page to use one or more wallets. + +Example: +```csharp +var inAppWalletOptions = new InAppWalletOptions( + authprovider: AuthProvider.SiweExternal, + forceSiweExternalWalletIds: new List { "xyz.abs" }); +``` ### Login with Custom Auth - OIDC Compatible @@ -122,6 +146,21 @@ var options = new WalletOptions( var wallet = await ThirdwebManager.Instance.ConnectWallet(options); ``` +### Login with Backend - Server Wallets + +```csharp +var inAppWalletOptions = new InAppWalletOptions( + authprovider: AuthProvider.Backend, + walletSecret: "very-secret" +); +var options = new WalletOptions( + provider: WalletProvider.InAppWallet, + chainId: 1, + inAppWalletOptions: inAppWalletOptions +); +var wallet = await ThirdwebManager.Instance.ConnectWallet(options); +``` + ## Account Linking InAppWallets support linking multiple authentication methods to a single wallet, for instance linking Google to your Email-based In-App-Wallet. This is useful to have a unified identity across platforms.