Skip to content

Commit 03d03b4

Browse files
committed
lint errors
1 parent 9181f37 commit 03d03b4

File tree

8 files changed

+100
-211
lines changed

8 files changed

+100
-211
lines changed

apps/portal/src/app/nebula/api-reference/page.mdx

Lines changed: 0 additions & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -202,176 +202,7 @@ eventSource.addEventListener('error', (event) => {
202202
eventSource.close();
203203
});
204204
```
205-
## API Endpoints
206205

207-
### Chat
208206

209207

210-
#### Chat Messages
211-
212-
Chat messages are natural language responses from Nebula. They appear in the `message` field of the response and provide formatted information, explanations, or answers to your queries. Messages can include formatted text, blockchain data, and technical details.
213-
214-
**Example Response with Chat Message:**
215-
```json
216-
{
217-
"message": "The last block on the Arbitrum mainnet is block number **284204124**. Here are the details:\n\n- **Block Hash:** 0xf42e3d624ae1e3fd6b89d4680f39943eb1cd3b8f0606918ef818d3021b7724f1\n- **Parent Hash:** 0x4c45cd0964281833b070b633980d8f530debdd21dfbdbf6eddf96cc93cbaac8e\n- **Timestamp:** 1734063299\n- **Gas Used:** 5,064,851\n- **Gas Limit:** 1,125,899,906,842,624\n- **Base Fee per Gas:** 10,000,000\n- **Transaction Count:** 7\n- **Withdrawals Count:** 0\n\nIf you need any more information about this block or related transactions, feel free to ask!",
218-
"actions": [],
219-
"session_id": "5d579903-5a63-434f-8667-788adfae9304",
220-
"request_id": "d46cfb80-de6a-48a6-9a97-746e1708d066"
221-
}
222-
```
223-
224-
Response properties:
225-
- `message`: A formatted string containing the response, which may include:
226-
- Markdown formatting for better readability
227-
- Technical data (hashes, addresses, numbers)
228-
- Structured information about blockchain state
229-
- `actions`: Array of actions (empty when no transactions are needed)
230-
- `session_id`: Unique identifier for the current session
231-
- `request_id`: Unique identifier for the specific request
232-
233-
#### Chat Actions
234-
235-
Chat actions represent blockchain transactions or operations that Nebula has prepared in response to your request. The response includes both a detailed explanation in the `message` field and the actual transaction data in the `actions` array.
236-
237-
**Example Response with Chat Action:**
238-
```json
239-
{
240-
"message": "The transaction to transfer 0.0001 ETH to the address resolved from the ENS name `vitalik.eth` (which is `0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045`) is set up successfully. The simulation indicates that the transaction is likely to succeed.\n\nPlease proceed by signing and confirming the transaction.",
241-
"actions": [
242-
{
243-
"session_id": "437a0df7-d512-4ef4-95b5-6168ccbbe097",
244-
"request_id": "c2b51ed6-da79-49ac-b411-206a42059509",
245-
"type": "sign_transaction",
246-
"source": "executor",
247-
"data": "{\"chainId\": 11155111, \"to\": \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\", \"data\": \"0x\", \"value\": \"0x5af3107a4000\"}"
248-
}
249-
],
250-
"session_id": "437a0df7-d512-4ef4-95b5-6168ccbbe097",
251-
"request_id": "c2b51ed6-da79-49ac-b411-206a42059509"
252-
}
253-
```
254-
255-
**Action Properties:**
256-
- `session_id`: Unique identifier for the current session
257-
- `request_id`: Unique identifier for the specific request
258-
- `type`: The type of action (e.g., "sign_transaction")
259-
- `source`: Origin of the action (e.g., "executor")
260-
- `data`: Transaction parameters including:
261-
- `chainId`: Network identifier (e.g., 11155111 for Sepolia)
262-
- `to`: Recipient's address
263-
- `data`: Transaction data (if any)
264-
- `value`: Amount to send in wei
265-
266-
When handling actions:
267-
1. Parse the `message` field for human-readable transaction details
268-
2. Extract the transaction data from the `actions` array
269-
3. Present transaction details to the user for review
270-
4. Use a local wallet to sign the transaction
271-
5. Broadcast the signed transaction to the network
272-
273-
**Example Implementation with thirdweb SDK:**
274-
```javascript
275-
import {
276-
createThirdwebClient,
277-
prepareTransaction,
278-
sendTransaction,
279-
privateKeyToAccount
280-
} from "thirdweb";
281-
282-
// Example function to handle the API response
283-
async function handleNebulaResponse(response) {
284-
// Initialize thirdweb client
285-
const client = createThirdwebClient({
286-
secretKey: process.env.THIRDWEB_SECRET_KEY
287-
});
288-
289-
// Initialize account
290-
const account = privateKeyToAccount({
291-
client,
292-
privateKey: process.env.EOA_PRIVATE_KEY
293-
});
294-
295-
// Check if we have any actions
296-
if (response.actions && response.actions.length > 0) {
297-
const action = response.actions[0];
298-
299-
// Parse the transaction data from the action
300-
const txData = JSON.parse(action.data);
301-
302-
try {
303-
// Prepare transaction with client
304-
const transaction = prepareTransaction({
305-
to: txData.to,
306-
data: txData.data,
307-
value: BigInt(txData.value),
308-
chain: txData.chainId,
309-
client
310-
});
311-
312-
// Send transaction with account
313-
const result = await sendTransaction({
314-
transaction,
315-
account
316-
});
317-
318-
return result;
319-
} catch (error) {
320-
console.error("Error processing transaction:", error);
321-
throw error;
322-
}
323-
}
324-
}
325-
326-
// Example usage
327-
const response = await fetch('https://nebula-api.thirdweb.com/chat', {
328-
method: 'POST',
329-
headers: {
330-
'Content-Type': 'application/json',
331-
'x-secret-key': 'YOUR_THIRDWEB_SECRET_KEY'
332-
},
333-
body: JSON.stringify({
334-
message: "send 0.0001 ETH on sepolia to vitalik.eth",
335-
execute_config: {
336-
mode: "client",
337-
signer_wallet_address: "0xc3F2b2a12Eba0f5989cD75B2964E31D56603a2cE"
338-
}
339-
})
340-
});
341-
342-
const data = await response.json();
343-
const result = await handleNebulaResponse(data);
344-
```
345-
346-
347-
348-
#### Get Session
349-
350-
```bash
351-
GET /session/{session_id}
352-
```
353-
354-
Get details for a specific session.
355-
356-
**Example curl:**
357-
```bash
358-
curl -X GET https://nebula-api.thirdweb.com/session/abc123 \
359-
-H "x-secret-key: YOUR_THIRDWEB_SECRET_KEY"
360-
```
361-
362-
**Response:**
363-
```tsx
364-
{
365-
"result": {
366-
"id": "string",
367-
"title": "string",
368-
"model_name": "string",
369-
"is_public": boolean,
370-
"created_at": "datetime",
371-
"updated_at": "datetime",
372-
"messages": []
373-
}
374-
}
375-
```
376-
377208

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

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,44 @@
11
import type { SideBar } from "@/components/Layouts/DocLayout";
2-
import { NebulaSideIcon, EditIcon, CodeIcon, GetIcon, BrickIcon } from "@/icons";
2+
import {
3+
BrickIcon,
4+
CodeIcon,
5+
EditIcon,
6+
GetIcon,
7+
NebulaSideIcon,
8+
} from "@/icons";
39

410
export const sidebar: SideBar = {
511
name: "Nebula",
612
links: [
713
{
814
name: "Overview",
915
href: "/nebula",
10-
icon: <NebulaSideIcon/>,
16+
icon: <NebulaSideIcon />,
1117
},
1218
{
1319
name: "Use Cases",
1420
href: "/nebula/use-cases",
15-
icon: <BrickIcon/>,
21+
icon: <BrickIcon />,
1622
},
1723
{
1824
name: "Prompt Guide",
1925
href: "/nebula/prompt-guide",
20-
icon: <EditIcon/>,
26+
icon: <EditIcon />,
2127
},
2228
{
2329
name: "API Reference",
2430
href: "/nebula/api-reference",
25-
icon: <CodeIcon/>,
31+
icon: <CodeIcon />,
2632
links: [
2733
{
2834
name: "Send Message",
2935
href: "/nebula/api-reference/chat",
30-
icon: <GetIcon />
36+
icon: <GetIcon />,
3137
},
3238
{
3339
name: "Execute Transaction",
3440
href: "/nebula/api-reference/execute",
35-
icon: <GetIcon />
41+
icon: <GetIcon />,
3642
},
3743
{
3844
name: "List Sessions",
@@ -53,7 +59,7 @@ export const sidebar: SideBar = {
5359
{
5460
name: "Update Session",
5561
href: "/nebula/api-reference/update-session",
56-
icon: <GetIcon />
62+
icon: <GetIcon />,
5763
},
5864
{
5965
name: "Clear Session",
@@ -64,8 +70,8 @@ export const sidebar: SideBar = {
6470
name: "Delete Session",
6571
href: "/nebula/api-reference/delete-session",
6672
icon: <GetIcon />,
67-
}
68-
]
73+
},
74+
],
6975
},
7076
],
7177
};
Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
export function GetIcon(props: { className?: string }) {
2-
return (
3-
<svg width="147" height="45" viewBox="0 0 147 45" fill="none" xmlns="http://www.w3.org/2000/svg" className={props.className}>
4-
<rect width="147" height="45" rx="15" fill="#4CAF50"/>
5-
<path d="M62.0909 19.1875C61.9716 18.7727 61.804 18.4062 61.5881 18.0881C61.3722 17.7642 61.108 17.4915 60.7955 17.2699C60.4886 17.0426 60.1364 16.8693 59.7386 16.75C59.3466 16.6307 58.9119 16.571 58.4347 16.571C57.5426 16.571 56.7585 16.7926 56.0824 17.2358C55.4119 17.679 54.8892 18.3239 54.5142 19.1705C54.1392 20.0114 53.9517 21.0398 53.9517 22.2557C53.9517 23.4716 54.1364 24.5057 54.5057 25.358C54.875 26.2102 55.3977 26.8608 56.0739 27.3097C56.75 27.7528 57.5483 27.9744 58.4688 27.9744C59.304 27.9744 60.017 27.8267 60.608 27.5312C61.2045 27.2301 61.6591 26.8068 61.9716 26.2614C62.2898 25.7159 62.4489 25.071 62.4489 24.3267L63.1989 24.4375H58.6989V21.6591H66.0028V23.858C66.0028 25.392 65.679 26.7102 65.0312 27.8125C64.3835 28.9091 63.4915 29.7557 62.3551 30.3523C61.2188 30.9432 59.9176 31.2386 58.4517 31.2386C56.8153 31.2386 55.3778 30.8778 54.1392 30.1562C52.9006 29.429 51.9347 28.3977 51.2415 27.0625C50.554 25.7216 50.2102 24.1307 50.2102 22.2898C50.2102 20.875 50.4148 19.6136 50.8239 18.5057C51.2386 17.392 51.8182 16.4489 52.5625 15.6761C53.3068 14.9034 54.1733 14.3153 55.1619 13.9119C56.1506 13.5085 57.2216 13.3068 58.375 13.3068C59.3636 13.3068 60.2841 13.4517 61.1364 13.7415C61.9886 14.0256 62.7443 14.429 63.4034 14.9517C64.0682 15.4744 64.6108 16.0966 65.0312 16.8182C65.4517 17.5341 65.7216 18.3239 65.8409 19.1875H62.0909ZM68.7749 31V13.5455H80.5362V16.5881H72.4652V20.7472H79.9311V23.7898H72.4652V27.9574H80.5703V31H68.7749ZM82.8054 16.5881V13.5455H97.1406V16.5881H91.7969V31H88.1491V16.5881H82.8054Z" fill="white"/>
6-
</svg>
7-
)
8-
}
2+
return (
3+
<svg
4+
width="147"
5+
height="45"
6+
viewBox="0 0 147 45"
7+
fill="none"
8+
xmlns="http://www.w3.org/2000/svg"
9+
className={props.className}
10+
>
11+
<title>Get Icon</title>
12+
<rect width="147" height="45" rx="15" fill="#4CAF50" />
13+
<path
14+
d="M62.0909 19.1875C61.9716 18.7727 61.804 18.4062 61.5881 18.0881C61.3722 17.7642 61.108 17.4915 60.7955 17.2699C60.4886 17.0426 60.1364 16.8693 59.7386 16.75C59.3466 16.6307 58.9119 16.571 58.4347 16.571C57.5426 16.571 56.7585 16.7926 56.0824 17.2358C55.4119 17.679 54.8892 18.3239 54.5142 19.1705C54.1392 20.0114 53.9517 21.0398 53.9517 22.2557C53.9517 23.4716 54.1364 24.5057 54.5057 25.358C54.875 26.2102 55.3977 26.8608 56.0739 27.3097C56.75 27.7528 57.5483 27.9744 58.4688 27.9744C59.304 27.9744 60.017 27.8267 60.608 27.5312C61.2045 27.2301 61.6591 26.8068 61.9716 26.2614C62.2898 25.7159 62.4489 25.071 62.4489 24.3267L63.1989 24.4375H58.6989V21.6591H66.0028V23.858C66.0028 25.392 65.679 26.7102 65.0312 27.8125C64.3835 28.9091 63.4915 29.7557 62.3551 30.3523C61.2188 30.9432 59.9176 31.2386 58.4517 31.2386C56.8153 31.2386 55.3778 30.8778 54.1392 30.1562C52.9006 29.429 51.9347 28.3977 51.2415 27.0625C50.554 25.7216 50.2102 24.1307 50.2102 22.2898C50.2102 20.875 50.4148 19.6136 50.8239 18.5057C51.2386 17.392 51.8182 16.4489 52.5625 15.6761C53.3068 14.9034 54.1733 14.3153 55.1619 13.9119C56.1506 13.5085 57.2216 13.3068 58.375 13.3068C59.3636 13.3068 60.2841 13.4517 61.1364 13.7415C61.9886 14.0256 62.7443 14.429 63.4034 14.9517C64.0682 15.4744 64.6108 16.0966 65.0312 16.8182C65.4517 17.5341 65.7216 18.3239 65.8409 19.1875H62.0909ZM68.7749 31V13.5455H80.5362V16.5881H72.4652V20.7472H79.9311V23.7898H72.4652V27.9574H80.5703V31H68.7749ZM82.8054 16.5881V13.5455H97.1406V16.5881H91.7969V31H88.1491V16.5881H82.8054Z"
15+
fill="white"
16+
/>
17+
</svg>
18+
);
19+
}

apps/portal/src/icons/index.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { editionDropContract } from './../../../playground-web/src/components/account-abstraction/sponsored-tx';
21
// sdks
32
export { GoIcon } from "./sdks/GoIcon";
43
export { PythonIcon } from "./sdks/PythonIcon";
@@ -36,13 +35,13 @@ export { NebulaIcon } from "./products/nebula/NebulaIcon";
3635
export { GamingIcon } from "./solutions/GamingIcon";
3736

3837
//sidebar
39-
export { EditIcon} from "./sidebar/EditIcon";
40-
export { CodeIcon} from "./sidebar/CodeIcon";
41-
export { BrickIcon} from "./sidebar/BrickIcon";
42-
export {NebulaSideIcon} from "./sidebar/NebulaSideIcon";
38+
export { EditIcon } from "./sidebar/EditIcon";
39+
export { CodeIcon } from "./sidebar/CodeIcon";
40+
export { BrickIcon } from "./sidebar/BrickIcon";
41+
export { NebulaSideIcon } from "./sidebar/NebulaSideIcon";
4342

4443
//api icons
45-
export {GetIcon} from "./API/GetIcon";
44+
export { GetIcon } from "./API/GetIcon";
4645

4746
// general purposes
4847
export { ExternalLinkIcon } from "./ExternalLinkIcon";
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
export function BrickIcon(props: { className?: string }) {
2-
return (
3-
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#6e6e6e" className={props.className}><path d="M80-160v-480h120v-160h240v160h80v-160h240v160h120v480H80Zm80-80h640v-320H160v320Zm120-400h80v-80h-80v80Zm320 0h80v-80h-80v80ZM160-240h640-640Zm120-400h80-80Zm320 0h80-80Z"/></svg>
4-
)
5-
}
2+
return (
3+
<svg
4+
xmlns="http://www.w3.org/2000/svg"
5+
height="24px"
6+
viewBox="0 -960 960 960"
7+
width="24px"
8+
fill="#6e6e6e"
9+
className={props.className}
10+
>
11+
<title>Brick Icon</title>
12+
<path d="M80-160v-480h120v-160h240v160h80v-160h240v160h120v480H80Zm80-80h640v-320H160v320Zm120-400h80v-80h-80v80Zm320 0h80v-80h-80v80ZM160-240h640-640Zm120-400h80-80Zm320 0h80-80Z" />
13+
</svg>
14+
);
15+
}
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
export function CodeIcon(props: { className?: string }) {
2-
return (
3-
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#6e6e6e" className={props.className}><path d="m384-336 56-57-87-87 87-87-56-57-144 144 144 144Zm192 0 144-144-144-144-56 57 87 87-87 87 56 57ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"/></svg>
4-
)
5-
}
2+
return (
3+
<svg
4+
xmlns="http://www.w3.org/2000/svg"
5+
height="24px"
6+
viewBox="0 -960 960 960"
7+
width="24px"
8+
fill="#6e6e6e"
9+
className={props.className}
10+
>
11+
<title>Code Icon</title>
12+
<path d="m384-336 56-57-87-87 87-87-56-57-144 144 144 144Zm192 0 144-144-144-144-56 57 87 87-87 87 56 57ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z" />
13+
</svg>
14+
);
15+
}
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
export function EditIcon(props: { className?: string }) {
2-
return (
3-
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#6e6e6e" className={props.className}><path d="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z"/></svg>
4-
)
5-
}
2+
return (
3+
<svg
4+
xmlns="http://www.w3.org/2000/svg"
5+
height="24px"
6+
viewBox="0 -960 960 960"
7+
width="24px"
8+
fill="#6e6e6e"
9+
className={props.className}
10+
>
11+
<title>Edit Icon</title>
12+
<path d="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z" />
13+
</svg>
14+
);
15+
}

0 commit comments

Comments
 (0)