Skip to content

Commit 221945c

Browse files
authored
Merge branch 'main' into neb-docs
2 parents 2a1e536 + e50d77d commit 221945c

File tree

18 files changed

+408
-232
lines changed

18 files changed

+408
-232
lines changed

.changeset/chatty-geese-burn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@thirdweb-dev/service-utils": patch
3+
---
4+
5+
add `canCreatePublicChains` to TeamResponse

apps/dashboard/src/app/login/onboarding/AccountForm.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
88
import { useTrack } from "hooks/analytics/useTrack";
99
import { useState } from "react";
1010
import { useForm } from "react-hook-form";
11+
import { toast } from "sonner";
1112
import {
1213
type AccountValidationSchema,
1314
accountValidationSchema,
@@ -81,15 +82,21 @@ export const AccountForm: React.FC<AccountFormProps> = ({
8182
data,
8283
});
8384
},
84-
onError: (err) => {
85-
const error = err as Error;
85+
onError: (error) => {
86+
console.error(error);
8687

8788
if (
8889
onDuplicateError &&
8990
error?.message.match(/email address already exists/)
9091
) {
9192
onDuplicateError(values.email);
93+
return;
94+
} else if (error.message.includes("INVALID_EMAIL_ADDRESS")) {
95+
toast.error("Invalid Email Address");
96+
} else {
97+
toast.error(error.message || "Failed to update account");
9298
}
99+
93100
trackEvent({
94101
category: "account",
95102
action: "update",
Lines changed: 13 additions & 0 deletions
Loading

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,19 @@ Options for configuring timeouts for fetching data. Useful for fine-tuning reque
6464
TimeoutOptions(int? storage = null, int? rpc = null, int? other = null)
6565
```
6666

67+
### rpcOverrides (optional)
68+
69+
Overrides for the default RPC endpoints. Will use your custom endpoints instead of thirdweb RPC endpoints.
70+
71+
```csharp
72+
var client = ThirdwebClient.Create(
73+
...,
74+
rpcOverrides: new()
75+
{
76+
{ 1, "https://eth.llamarpc.com" },
77+
{ 42161, "https://arbitrum.llamarpc.com" }
78+
}
79+
);
80+
```
81+
6782
</Details>
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import { Details, createMetadata } from "@doc";
2+
3+
export const metadata = createMetadata({
4+
title: "ThirdwebContract.Create | Thirdweb .NET SDK",
5+
description:
6+
"Instantiate a ThirdwebContract to interact with smart contracts.",
7+
});
8+
9+
# [Nebula AI](https://thirdweb.com/nebula) .NET Integration
10+
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.
11+
12+
## Read, Write, Reason.
13+
The best way to understand is to look at examples.
14+
15+
We'll prepare some context for the AI - here, we'll generate a basic `PrivateKeyWallet` and upgrade it to a `SmartWallet` on Sepolia.
16+
```csharp
17+
// Prepare some context
18+
var myChain = 11155111; // Sepolia
19+
var mySigner = await PrivateKeyWallet.Generate(client);
20+
var myWallet = await SmartWallet.Create(mySigner, myChain);
21+
var myContractAddress = "0xe2cb0eb5147b42095c2FfA6F7ec953bb0bE347D8"; // DropERC1155
22+
var usdcAddress = "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"; // Sepolia USDC
23+
```
24+
25+
A one liner creates a Nebula session.
26+
```csharp
27+
// Create a Nebula session
28+
var nebula = await ThirdwebNebula.Create(client);
29+
```
30+
31+
You can **Chat** with Nebula. The Chat method accepts any `IThirdwebWallet` as an optional parameter, context will automatically be updated.
32+
```csharp
33+
// Chat, passing wallet context
34+
var response1 = await nebula.Chat(message: "What is my wallet address?", wallet: myWallet);
35+
Console.WriteLine($"Response 1: {response1.Message}");
36+
```
37+
38+
You may also pass it smart contract context.
39+
```csharp
40+
// Chat, passing contract context
41+
var response2 = await nebula.Chat(
42+
message: "What's the total supply of token id 0 for this contract?",
43+
context: new NebulaContext(contractAddresses: new List<string> { myContractAddress }, chainIds: new List<BigInteger> { myChain })
44+
);
45+
Console.WriteLine($"Response 2: {response2.Message}");
46+
```
47+
48+
You can have a full on conversation with it with our **Chat** override accepting multiple messages.
49+
```csharp
50+
// Chat, passing multiple messages and context
51+
var response3 = await nebula.Chat(
52+
messages: new List<NebulaChatMessage>
53+
{
54+
new($"Tell me the name of this contract: {myContractAddress}", NebulaChatRole.User),
55+
new("The name of the contract is CatDrop", NebulaChatRole.Assistant),
56+
new("What's the symbol of this contract?", NebulaChatRole.User),
57+
},
58+
context: new NebulaContext(contractAddresses: new List<string> { myContractAddress }, chainIds: new List<BigInteger> { myChain })
59+
);
60+
Console.WriteLine($"Response 3: {response3.Message}");
61+
```
62+
63+
Chatting is cool, but what if I just want it to _**do**_ things and stop talking so much?
64+
65+
You can **Execute** transactions directly with a simple prompt.
66+
```csharp
67+
// Execute, this directly sends transactions
68+
var executionResult = await nebula.Execute("Approve 1 USDC to vitalik.eth", wallet: myWallet, context: new NebulaContext(contractAddresses: new List<string>() { usdcAddress }));
69+
if (executionResult.TransactionReceipts != null && executionResult.TransactionReceipts.Count > 0)
70+
{
71+
Console.WriteLine($"Receipt: {executionResult.TransactionReceipts[0]}");
72+
}
73+
else
74+
{
75+
Console.WriteLine($"Message: {executionResult.Message}");
76+
}
77+
```
78+
79+
Similarly, **Execute** can take in multiple messages.
80+
```csharp
81+
// Batch execute
82+
var batchExecutionResult = await nebula.Execute(
83+
new List<NebulaChatMessage>
84+
{
85+
new("What's the address of vitalik.eth", NebulaChatRole.User),
86+
new("The address of vitalik.eth is 0xd8dA6BF26964aF8E437eEa5e3616511D7G3a3298", NebulaChatRole.Assistant),
87+
new("Approve 1 USDC to them", NebulaChatRole.User),
88+
},
89+
wallet: myWallet,
90+
context: new NebulaContext(contractAddresses: new List<string>() { usdcAddress })
91+
);
92+
if (batchExecutionResult.TransactionReceipts != null && batchExecutionResult.TransactionReceipts.Count > 0)
93+
{
94+
Console.WriteLine($"Receipts: {JsonConvert.SerializeObject(batchExecutionResult.TransactionReceipts, Formatting.Indented)}");
95+
}
96+
else
97+
{
98+
Console.WriteLine($"Message: {batchExecutionResult.Message}");
99+
}
100+
```

apps/portal/src/app/dotnet/sidebar.tsx

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { SideBar } from "@/components/Layouts/DocLayout";
22
import type { SidebarLink } from "@/components/others/Sidebar";
3-
import { ZapIcon } from "lucide-react";
3+
import { CodeIcon, ExternalLink, ZapIcon } from "lucide-react";
44

55
const walletProviders: SidebarLink = (() => {
66
const parentSlug = "/dotnet/wallets/providers";
@@ -261,16 +261,29 @@ export const sidebar: SideBar = {
261261
icon: <ZapIcon />,
262262
},
263263
{
264-
name: "Godot Integration",
265-
href: "/dotnet/godot",
266-
},
267-
{
268-
name: "Unity Integration",
269-
href: "/unity/v5",
264+
name: "API Reference",
265+
href: "https://thirdweb-dev.github.io/dotnet/index.html",
266+
isCollapsible: false,
267+
icon: <ExternalLink />,
270268
},
271269
{
272-
name: "MAUI Integration",
273-
href: "/dotnet/maui",
270+
name: "Integrations",
271+
isCollapsible: true,
272+
icon: <CodeIcon />,
273+
links: [
274+
{
275+
name: "Unity",
276+
href: "/unity/v5",
277+
},
278+
{
279+
name: "Godot",
280+
href: "/dotnet/godot",
281+
},
282+
{
283+
name: "MAUI",
284+
href: "/dotnet/maui",
285+
},
286+
],
274287
},
275288
{
276289
name: "Core",
@@ -291,7 +304,6 @@ export const sidebar: SideBar = {
291304
isCollapsible: false,
292305
links: [walletProviders, walletActions],
293306
},
294-
pay,
295307
{
296308
name: "Blockchain API",
297309
isCollapsible: false,
@@ -304,10 +316,20 @@ export const sidebar: SideBar = {
304316
},
305317
],
306318
},
307-
{ separator: true },
308319
{
309-
name: "Full Reference",
310-
href: "https://thirdweb-dev.github.io/dotnet/index.html",
320+
name: "Nebula AI",
321+
isCollapsible: false,
322+
links: [
323+
{
324+
name: "Quickstart",
325+
href: "/dotnet/nebula/quickstart",
326+
},
327+
{
328+
name: "Nebula Full Reference",
329+
href: "https://thirdweb-dev.github.io/dotnet/docs/Thirdweb.AI.ThirdwebNebula.html",
330+
},
331+
],
311332
},
333+
pay,
312334
],
313335
};

0 commit comments

Comments
 (0)