From 31d11fa24b9c376fbeadec75fd5ba60ff43170ff Mon Sep 17 00:00:00 2001 From: samina <57885104+saminacodes@users.noreply.github.com> Date: Mon, 30 Dec 2024 10:11:00 -0700 Subject: [PATCH] re-organized nebula documentation (#5839) --- .../app/nebula/api-reference/chat/page.mdx | 189 ++++++++ .../api-reference/clear-session/page.mdx | 13 + .../api-reference/create-session/page.mdx | 32 ++ .../api-reference/delete-session/page.mdx | 15 + .../app/nebula/api-reference/execute/page.mdx | 77 ++++ .../nebula/api-reference/get-session/page.mdx | 28 ++ .../api-reference/list-session/page.mdx | 29 ++ .../src/app/nebula/api-reference/page.mdx | 435 ------------------ .../api-reference/update-session/page.mdx | 26 ++ apps/portal/src/app/nebula/faqs/page.mdx | 5 + apps/portal/src/app/nebula/page.mdx | 123 ++--- .../src/app/nebula/plugins/eliza/page.mdx | 5 + apps/portal/src/app/nebula/plugins/page.mdx | 3 + .../src/app/nebula/prompt-guide/page.mdx | 15 + apps/portal/src/app/nebula/sidebar.tsx | 86 ++++ .../src/app/nebula/troubleshoot/page.mdx | 3 + apps/portal/src/app/nebula/use-cases/page.mdx | 48 ++ apps/portal/src/icons/API/GetIcon.tsx | 19 + apps/portal/src/icons/index.ts | 12 + apps/portal/src/icons/sidebar/BrickIcon.tsx | 15 + apps/portal/src/icons/sidebar/CodeIcon.tsx | 15 + apps/portal/src/icons/sidebar/EditIcon.tsx | 15 + .../src/icons/sidebar/NebulaSideIcon.tsx | 20 + apps/portal/src/icons/sidebar/PluginIcon.tsx | 15 + .../portal/src/icons/sidebar/QuestionIcon.tsx | 15 + .../src/icons/sidebar/TroubleshootIcon.tsx | 15 + 26 files changed, 760 insertions(+), 513 deletions(-) create mode 100644 apps/portal/src/app/nebula/api-reference/chat/page.mdx create mode 100644 apps/portal/src/app/nebula/api-reference/clear-session/page.mdx create mode 100644 apps/portal/src/app/nebula/api-reference/create-session/page.mdx create mode 100644 apps/portal/src/app/nebula/api-reference/delete-session/page.mdx create mode 100644 apps/portal/src/app/nebula/api-reference/execute/page.mdx create mode 100644 apps/portal/src/app/nebula/api-reference/get-session/page.mdx create mode 100644 apps/portal/src/app/nebula/api-reference/list-session/page.mdx create mode 100644 apps/portal/src/app/nebula/api-reference/update-session/page.mdx create mode 100644 apps/portal/src/app/nebula/faqs/page.mdx create mode 100644 apps/portal/src/app/nebula/plugins/eliza/page.mdx create mode 100644 apps/portal/src/app/nebula/plugins/page.mdx create mode 100644 apps/portal/src/app/nebula/prompt-guide/page.mdx create mode 100644 apps/portal/src/app/nebula/troubleshoot/page.mdx create mode 100644 apps/portal/src/app/nebula/use-cases/page.mdx create mode 100644 apps/portal/src/icons/API/GetIcon.tsx create mode 100644 apps/portal/src/icons/sidebar/BrickIcon.tsx create mode 100644 apps/portal/src/icons/sidebar/CodeIcon.tsx create mode 100644 apps/portal/src/icons/sidebar/EditIcon.tsx create mode 100644 apps/portal/src/icons/sidebar/NebulaSideIcon.tsx create mode 100644 apps/portal/src/icons/sidebar/PluginIcon.tsx create mode 100644 apps/portal/src/icons/sidebar/QuestionIcon.tsx create mode 100644 apps/portal/src/icons/sidebar/TroubleshootIcon.tsx diff --git a/apps/portal/src/app/nebula/api-reference/chat/page.mdx b/apps/portal/src/app/nebula/api-reference/chat/page.mdx new file mode 100644 index 00000000000..1989835c3b6 --- /dev/null +++ b/apps/portal/src/app/nebula/api-reference/chat/page.mdx @@ -0,0 +1,189 @@ +### Send Message + +```http +POST /chat +``` + +**Request Body:** +```json +{ + "message": "Find the last 5 blocks", + "session_id": "abc", + "stream": true, + "context_filter": { + "chain_ids": [137], + "contract_addresses": ["0x..."], + "wallet_addresses": ["0x..."] + }, + "execute_config": { + "mode": "client", + "signer_wallet_address": "0x..." + } +} +``` + +**Request Parameters:** + +- `message` (required) + - Type: string + - Description: The user's input message or command to be processed by Nebula + +- `session_id` (optional) + - Type: string + - Description: Identifier for maintaining conversation context + - Default: A new session will be created if omitted + +- `stream` (optional) + - Type: boolean + - Description: Controls whether the response is streamed or returned as a single response + - Default: false + +- `context_filter` (optional) + - Type: object + - Description: Controls which blockchain data sources are used for context + - Properties: + - `chain_ids`: Array of numbers representing blockchain network IDs + - `contract_addresses`: Array of strings containing contract addresses to focus on + +- `execute_config` (optional) + - Type: object + - Description: Configuration for transaction execution + - Properties: + - `mode`: String indicating execution mode (currently only "client" is supported) + - `signer_wallet_address`: String containing the wallet address that will sign transactions + + #### Chat Messages + +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. + +**Example Response with Chat Message:** +```json +{ + "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!", + "actions": [], + "session_id": "5d579903-5a63-434f-8667-788adfae9304", + "request_id": "d46cfb80-de6a-48a6-9a97-746e1708d066" +} +``` + +Response properties: +- `message`: A formatted string containing the response, which may include: + - Markdown formatting for better readability + - Technical data (hashes, addresses, numbers) + - Structured information about blockchain state +- `actions`: Array of actions (empty when no transactions are needed) +- `session_id`: Unique identifier for the current session +- `request_id`: Unique identifier for the specific request + +#### Chat Actions + +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. + +**Example Response with Chat Action:** +```json +{ + "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.", + "actions": [ + { + "session_id": "437a0df7-d512-4ef4-95b5-6168ccbbe097", + "request_id": "c2b51ed6-da79-49ac-b411-206a42059509", + "type": "sign_transaction", + "source": "executor", + "data": "{\"chainId\": 11155111, \"to\": \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\", \"data\": \"0x\", \"value\": \"0x5af3107a4000\"}" + } + ], + "session_id": "437a0df7-d512-4ef4-95b5-6168ccbbe097", + "request_id": "c2b51ed6-da79-49ac-b411-206a42059509" +} +``` + +**Action Properties:** +- `session_id`: Unique identifier for the current session +- `request_id`: Unique identifier for the specific request +- `type`: The type of action (e.g., "sign_transaction") +- `source`: Origin of the action (e.g., "executor") +- `data`: Transaction parameters including: + - `chainId`: Network identifier (e.g., 11155111 for Sepolia) + - `to`: Recipient's address + - `data`: Transaction data (if any) + - `value`: Amount to send in wei + +When handling actions: +1. Parse the `message` field for human-readable transaction details +2. Extract the transaction data from the `actions` array +3. Present transaction details to the user for review +4. Use a local wallet to sign the transaction +5. Broadcast the signed transaction to the network + +**Example Implementation with thirdweb SDK:** +```javascript +import { + createThirdwebClient, + prepareTransaction, + sendTransaction, + privateKeyToAccount +} from "thirdweb"; + +// Example function to handle the API response +async function handleNebulaResponse(response) { + // Initialize thirdweb client + const client = createThirdwebClient({ + secretKey: process.env.THIRDWEB_SECRET_KEY + }); + + // Initialize account + const account = privateKeyToAccount({ + client, + privateKey: process.env.EOA_PRIVATE_KEY + }); + + // Check if we have any actions + if (response.actions && response.actions.length > 0) { + const action = response.actions[0]; + + // Parse the transaction data from the action + const txData = JSON.parse(action.data); + + try { + // Prepare transaction with client + const transaction = prepareTransaction({ + to: txData.to, + data: txData.data, + value: BigInt(txData.value), + chain: txData.chainId, + client + }); + + // Send transaction with account + const result = await sendTransaction({ + transaction, + account + }); + + return result; + } catch (error) { + console.error("Error processing transaction:", error); + throw error; + } + } +} + +// Example usage +const response = await fetch('https://nebula-api.thirdweb.com/chat', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'x-secret-key': 'YOUR_THIRDWEB_SECRET_KEY' + }, + body: JSON.stringify({ + message: "send 0.0001 ETH on sepolia to vitalik.eth", + execute_config: { + mode: "client", + signer_wallet_address: "0xc3F2b2a12Eba0f5989cD75B2964E31D56603a2cE" + } + }) +}); + +const data = await response.json(); +const result = await handleNebulaResponse(data); +``` diff --git a/apps/portal/src/app/nebula/api-reference/clear-session/page.mdx b/apps/portal/src/app/nebula/api-reference/clear-session/page.mdx new file mode 100644 index 00000000000..f337139cde0 --- /dev/null +++ b/apps/portal/src/app/nebula/api-reference/clear-session/page.mdx @@ -0,0 +1,13 @@ +#### Clear Session + +Clear a session's message history. + +```bash +POST /session/{session_id}/clear +``` + +**Example curl:** +```bash +curl -X POST https://nebula-api.thirdweb.com/session/abc123/clear \ + -H "x-secret-key: YOUR_THIRDWEB_SECRET_KEY" +``` \ No newline at end of file diff --git a/apps/portal/src/app/nebula/api-reference/create-session/page.mdx b/apps/portal/src/app/nebula/api-reference/create-session/page.mdx new file mode 100644 index 00000000000..1613fb7280a --- /dev/null +++ b/apps/portal/src/app/nebula/api-reference/create-session/page.mdx @@ -0,0 +1,32 @@ +#### Create Session + +Create a new chat session. + +```bash +POST /session +``` +**Request Body:** +```tsx +{ + "title": "My DeFi Research", // Optional: Custom session title + "is_public": true, // Optional: Make session publicly accessible + "context_filter": { // Optional: Filter data sources + "chain_ids": [1], + "contract_addresses": ["0x..."] + } +} +``` + +**Example curl:** +```bash +curl -X POST https://nebula-api.thirdweb.com/session \ + -H "Content-Type: application/json" \ + -H "x-secret-key: YOUR_THIRDWEB_SECRET_KEY" \ + -d '{ + "title": "My DeFi Research", + "is_public": true, + "context_filter": { + "chain_ids": [1] + } + }' +``` \ No newline at end of file diff --git a/apps/portal/src/app/nebula/api-reference/delete-session/page.mdx b/apps/portal/src/app/nebula/api-reference/delete-session/page.mdx new file mode 100644 index 00000000000..c7734e15150 --- /dev/null +++ b/apps/portal/src/app/nebula/api-reference/delete-session/page.mdx @@ -0,0 +1,15 @@ +Delete Session + + +Delete a session. + +```bash +DELETE /session/{session_id} +``` + +Example curl: + +```bash +curl -X DELETE https://nebula-api.thirdweb.com/session/abc123 \ + -H "x-secret-key: YOUR_THIRDWEB_SECRET_KEY" +``` \ No newline at end of file diff --git a/apps/portal/src/app/nebula/api-reference/execute/page.mdx b/apps/portal/src/app/nebula/api-reference/execute/page.mdx new file mode 100644 index 00000000000..449879b9cc1 --- /dev/null +++ b/apps/portal/src/app/nebula/api-reference/execute/page.mdx @@ -0,0 +1,77 @@ +### Execute + +Execute specific blockchain commands or actions. This endpoint is designed for direct command execution without the conversational context of the chat endpoint. + +```bash +POST /execute +``` + +**Request Body:** +```bash +{ + "message": "send 0.0001 ETH on sepolia to vitalik.eth", + "user_id": "default-user", + "stream": false, + "execute_config": { + "mode": "client", + "signer_wallet_address": "0xc3F2b2a12Eba0f5989cD75B2964E31D56603a2cE" + } +} +``` + +**Request Parameters:** +- `message` (required): The command to execute +- `user_id` (optional): Identifier for the user making the request +- `stream` (optional): Whether to stream the response +- `execute_config` (optional): Configuration for transaction execution + - `mode`: Execution mode (currently only "client" is supported) + - `signer_wallet_address`: Address that will sign the transaction + +**Example Response:** +```json +{ + "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.", + "actions": [ + { + "session_id": "437a0df7-d512-4ef4-95b5-6168ccbbe097", + "request_id": "c2b51ed6-da79-49ac-b411-206a42059509", + "type": "sign_transaction", + "source": "executor", + "data": "{\"chainId\": 11155111, \"to\": \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\", \"data\": \"0x\", \"value\": \"0x5af3107a4000\"}" + } + ], + "session_id": "437a0df7-d512-4ef4-95b5-6168ccbbe097", + "request_id": "c2b51ed6-da79-49ac-b411-206a42059509" +} +``` + +**Example curl:** +```bash +curl -X POST https://nebula-api.thirdweb.com/execute \ + -H "Content-Type: application/json" \ + -H "x-secret-key: YOUR_THIRDWEB_SECRET_KEY" \ + -d '{ + "message": "send 0.0001 ETH on sepolia to vitalik.eth", + "user_id": "default-user", + "stream": false, + "execute_config": { + "mode": "client", + "signer_wallet_address": "0xc3F2b2a12Eba0f5989cD75B2964E31D56603a2cE" + } + }' +``` + +**Response Properties:** +- `message`: A human-readable description of the action to be taken +- `actions`: Array of actions to be executed + - `session_id`: Unique identifier for the session + - `request_id`: Unique identifier for this request + - `type`: The type of action (e.g., "sign_transaction") + - `source`: Origin of the action + - `data`: Transaction data in hexadecimal format including: + - `chainId`: Network identifier + - `to`: Recipient's address + - `data`: Transaction data + - `value`: Amount to send in hex +- `session_id`: Session identifier for this execution +- `request_id`: Unique identifier for this request \ No newline at end of file diff --git a/apps/portal/src/app/nebula/api-reference/get-session/page.mdx b/apps/portal/src/app/nebula/api-reference/get-session/page.mdx new file mode 100644 index 00000000000..5503eff39e8 --- /dev/null +++ b/apps/portal/src/app/nebula/api-reference/get-session/page.mdx @@ -0,0 +1,28 @@ +#### Get Session + +Get details for a specific session. + +```bash +GET /session/{session_id} +``` + +**Example curl:** +```bash +curl -X GET https://nebula-api.thirdweb.com/session/abc123 \ + -H "x-secret-key: YOUR_THIRDWEB_SECRET_KEY" +``` + +**Response:** +```tsx +{ + "result": { + "id": "string", + "title": "string", + "model_name": "string", + "is_public": boolean, + "created_at": "datetime", + "updated_at": "datetime", + "messages": [] + } +} +``` \ No newline at end of file diff --git a/apps/portal/src/app/nebula/api-reference/list-session/page.mdx b/apps/portal/src/app/nebula/api-reference/list-session/page.mdx new file mode 100644 index 00000000000..f34c8a97648 --- /dev/null +++ b/apps/portal/src/app/nebula/api-reference/list-session/page.mdx @@ -0,0 +1,29 @@ +#### List Sessions + +Retrieve available sessions for the authenticated account. + +```bash +GET /session/list +``` + +**Example curl:** +```bash +curl -X GET https://nebula-api.thirdweb.com/session/list \ + -H "x-secret-key: YOUR_THIRDWEB_SECRET_KEY" +``` + +**Response:** +```bash +{ + "result": [ + { + "id": "string", + "title": "string", + "model_name": "string", + "is_public": boolean, + "created_at": "datetime", + "updated_at": "datetime" + } + ] +} +``` \ No newline at end of file diff --git a/apps/portal/src/app/nebula/api-reference/page.mdx b/apps/portal/src/app/nebula/api-reference/page.mdx index 0e0d2f409c2..9b61fd0042d 100644 --- a/apps/portal/src/app/nebula/api-reference/page.mdx +++ b/apps/portal/src/app/nebula/api-reference/page.mdx @@ -202,442 +202,7 @@ eventSource.addEventListener('error', (event) => { eventSource.close(); }); ``` -## API Endpoints -### Chat -#### Send Message -```http -POST /chat -``` - -**Request Body:** -```json -{ - "message": "Find the last 5 blocks", - "session_id": "abc", - "stream": true, - "context_filter": { - "chain_ids": [137], - "contract_addresses": ["0x..."], - "wallet_addresses": ["0x..."] - }, - "execute_config": { - "mode": "client", - "signer_wallet_address": "0x..." - } -} -``` - -**Request Parameters:** - -- `message` (required) - - Type: string - - Description: The user's input message or command to be processed by Nebula - -- `session_id` (optional) - - Type: string - - Description: Identifier for maintaining conversation context - - Default: A new session will be created if omitted - -- `stream` (optional) - - Type: boolean - - Description: Controls whether the response is streamed or returned as a single response - - Default: false - -- `context_filter` (optional) - - Type: object - - Description: Controls which blockchain data sources are used for context - - Properties: - - `chain_ids`: Array of numbers representing blockchain network IDs - - `contract_addresses`: Array of strings containing contract addresses to focus on - -- `execute_config` (optional) - - Type: object - - Description: Configuration for transaction execution - - Properties: - - `mode`: String indicating execution mode (currently only "client" is supported) - - `signer_wallet_address`: String containing the wallet address that will sign transactions - -#### Chat Messages - -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. - -**Example Response with Chat Message:** -```json -{ - "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!", - "actions": [], - "session_id": "5d579903-5a63-434f-8667-788adfae9304", - "request_id": "d46cfb80-de6a-48a6-9a97-746e1708d066" -} -``` - -Response properties: -- `message`: A formatted string containing the response, which may include: - - Markdown formatting for better readability - - Technical data (hashes, addresses, numbers) - - Structured information about blockchain state -- `actions`: Array of actions (empty when no transactions are needed) -- `session_id`: Unique identifier for the current session -- `request_id`: Unique identifier for the specific request - -#### Chat Actions - -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. - -**Example Response with Chat Action:** -```json -{ - "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.", - "actions": [ - { - "session_id": "437a0df7-d512-4ef4-95b5-6168ccbbe097", - "request_id": "c2b51ed6-da79-49ac-b411-206a42059509", - "type": "sign_transaction", - "source": "executor", - "data": "{\"chainId\": 11155111, \"to\": \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\", \"data\": \"0x\", \"value\": \"0x5af3107a4000\"}" - } - ], - "session_id": "437a0df7-d512-4ef4-95b5-6168ccbbe097", - "request_id": "c2b51ed6-da79-49ac-b411-206a42059509" -} -``` - -**Action Properties:** -- `session_id`: Unique identifier for the current session -- `request_id`: Unique identifier for the specific request -- `type`: The type of action (e.g., "sign_transaction") -- `source`: Origin of the action (e.g., "executor") -- `data`: Transaction parameters including: - - `chainId`: Network identifier (e.g., 11155111 for Sepolia) - - `to`: Recipient's address - - `data`: Transaction data (if any) - - `value`: Amount to send in wei - -When handling actions: -1. Parse the `message` field for human-readable transaction details -2. Extract the transaction data from the `actions` array -3. Present transaction details to the user for review -4. Use a local wallet to sign the transaction -5. Broadcast the signed transaction to the network - -**Example Implementation with thirdweb SDK:** -```javascript -import { - createThirdwebClient, - prepareTransaction, - sendTransaction, - privateKeyToAccount -} from "thirdweb"; - -// Example function to handle the API response -async function handleNebulaResponse(response) { - // Initialize thirdweb client - const client = createThirdwebClient({ - secretKey: process.env.THIRDWEB_SECRET_KEY - }); - - // Initialize account - const account = privateKeyToAccount({ - client, - privateKey: process.env.EOA_PRIVATE_KEY - }); - - // Check if we have any actions - if (response.actions && response.actions.length > 0) { - const action = response.actions[0]; - - // Parse the transaction data from the action - const txData = JSON.parse(action.data); - - try { - // Prepare transaction with client - const transaction = prepareTransaction({ - to: txData.to, - data: txData.data, - value: BigInt(txData.value), - chain: txData.chainId, - client - }); - - // Send transaction with account - const result = await sendTransaction({ - transaction, - account - }); - - return result; - } catch (error) { - console.error("Error processing transaction:", error); - throw error; - } - } -} - -// Example usage -const response = await fetch('https://nebula-api.thirdweb.com/chat', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'x-secret-key': 'YOUR_THIRDWEB_SECRET_KEY' - }, - body: JSON.stringify({ - message: "send 0.0001 ETH on sepolia to vitalik.eth", - execute_config: { - mode: "client", - signer_wallet_address: "0xc3F2b2a12Eba0f5989cD75B2964E31D56603a2cE" - } - }) -}); - -const data = await response.json(); -const result = await handleNebulaResponse(data); -``` - -### Execute - - -```bash -POST /execute -``` -Execute specific blockchain commands or actions. This endpoint is designed for direct command execution without the conversational context of the chat endpoint. - -**Request Body:** -```bash -{ - "message": "send 0.0001 ETH on sepolia to vitalik.eth", - "user_id": "default-user", - "stream": false, - "execute_config": { - "mode": "client", - "signer_wallet_address": "0xc3F2b2a12Eba0f5989cD75B2964E31D56603a2cE" - } -} -``` - -**Request Parameters:** -- `message` (required): The command to execute -- `user_id` (optional): Identifier for the user making the request -- `stream` (optional): Whether to stream the response -- `execute_config` (optional): Configuration for transaction execution - - `mode`: Execution mode (currently only "client" is supported) - - `signer_wallet_address`: Address that will sign the transaction - -**Example Response:** -```json -{ - "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.", - "actions": [ - { - "session_id": "437a0df7-d512-4ef4-95b5-6168ccbbe097", - "request_id": "c2b51ed6-da79-49ac-b411-206a42059509", - "type": "sign_transaction", - "source": "executor", - "data": "{\"chainId\": 11155111, \"to\": \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\", \"data\": \"0x\", \"value\": \"0x5af3107a4000\"}" - } - ], - "session_id": "437a0df7-d512-4ef4-95b5-6168ccbbe097", - "request_id": "c2b51ed6-da79-49ac-b411-206a42059509" -} -``` - -**Example curl:** -```bash -curl -X POST https://nebula-api.thirdweb.com/execute \ - -H "Content-Type: application/json" \ - -H "x-secret-key: YOUR_THIRDWEB_SECRET_KEY" \ - -d '{ - "message": "send 0.0001 ETH on sepolia to vitalik.eth", - "user_id": "default-user", - "stream": false, - "execute_config": { - "mode": "client", - "signer_wallet_address": "0xc3F2b2a12Eba0f5989cD75B2964E31D56603a2cE" - } - }' -``` - -**Response Properties:** -- `message`: A human-readable description of the action to be taken -- `actions`: Array of actions to be executed - - `session_id`: Unique identifier for the session - - `request_id`: Unique identifier for this request - - `type`: The type of action (e.g., "sign_transaction") - - `source`: Origin of the action - - `data`: Transaction data in hexadecimal format including: - - `chainId`: Network identifier - - `to`: Recipient's address - - `data`: Transaction data - - `value`: Amount to send in hex -- `session_id`: Session identifier for this execution -- `request_id`: Unique identifier for this request - -### Sessions - -#### List Sessions - -```bash -GET /session/list -``` - -Retrieve available sessions for the authenticated account. - -**Example curl:** -```bash -curl -X GET https://nebula-api.thirdweb.com/session/list \ - -H "x-secret-key: YOUR_THIRDWEB_SECRET_KEY" -``` - -**Response:** -```bash -{ - "result": [ - { - "id": "string", - "title": "string", - "model_name": "string", - "is_public": boolean, - "created_at": "datetime", - "updated_at": "datetime" - } - ] -} -``` - -#### Get Session - -```bash -GET /session/{session_id} -``` - -Get details for a specific session. - -**Example curl:** -```bash -curl -X GET https://nebula-api.thirdweb.com/session/abc123 \ - -H "x-secret-key: YOUR_THIRDWEB_SECRET_KEY" -``` - -**Response:** -```tsx -{ - "result": { - "id": "string", - "title": "string", - "model_name": "string", - "is_public": boolean, - "created_at": "datetime", - "updated_at": "datetime", - "messages": [] - } -} -``` - -#### Create Session - -```bash -POST /session -``` - -Create a new chat session. - -**Request Body:** -```tsx -{ - "title": "My DeFi Research", // Optional: Custom session title - "is_public": true, // Optional: Make session publicly accessible - "context_filter": { // Optional: Filter data sources - "chain_ids": [1], - "contract_addresses": ["0x..."] - } -} -``` - -**Example curl:** -```bash -curl -X POST https://nebula-api.thirdweb.com/session \ - -H "Content-Type: application/json" \ - -H "x-secret-key: YOUR_THIRDWEB_SECRET_KEY" \ - -d '{ - "title": "My DeFi Research", - "is_public": true, - "context_filter": { - "chain_ids": [1] - } - }' -``` - -#### Update Session - -```bash -PUT /session/{session_id} -``` - -Update an existing session. - -**Example curl:** -```bash -curl -X PUT https://nebula-api.thirdweb.com/session/abc123 \ - -H "Content-Type: application/json" \ - -H "x-secret-key: YOUR_THIRDWEB_SECRET_KEY" \ - -d '{ - "title": "Updated Title", - "is_public": true - }' -``` - -**Request Body:** -```tsx -{ - "title": "string", - "is_public": boolean -} -``` - -#### Clear Session - -```bash -POST /session/{session_id}/clear -``` - -Clear a session's message history. - -**Example curl:** -```bash -curl -X POST https://nebula-api.thirdweb.com/session/abc123/clear \ - -H "x-secret-key: YOUR_THIRDWEB_SECRET_KEY" -``` - -#### Delete Session - -```bash -DELETE /session/{session_id} -``` - -Delete a session. - -**Example curl:** -```bash -curl -X DELETE https://nebula-api.thirdweb.com/session/abc123 \ - -H "x-secret-key: YOUR_THIRDWEB_SECRET_KEY" -``` - -## Error Handling - -The API uses standard HTTP status codes and returns errors in this format: - -```bash -{ - "error": { - "message": "Error description" - } -} -``` -Common Status Codes: -- 400: Bad Request -- 401: Unauthorized -- 404: Not Found -- 500: Internal Server Error diff --git a/apps/portal/src/app/nebula/api-reference/update-session/page.mdx b/apps/portal/src/app/nebula/api-reference/update-session/page.mdx new file mode 100644 index 00000000000..1d2baeeb278 --- /dev/null +++ b/apps/portal/src/app/nebula/api-reference/update-session/page.mdx @@ -0,0 +1,26 @@ +#### Update Session + +Update an existing session. + +```bash +PUT /session/{session_id} +``` + +**Example curl:** +```bash +curl -X PUT https://nebula-api.thirdweb.com/session/abc123 \ + -H "Content-Type: application/json" \ + -H "x-secret-key: YOUR_THIRDWEB_SECRET_KEY" \ + -d '{ + "title": "Updated Title", + "is_public": true + }' +``` + +**Request Body:** +```tsx +{ + "title": "string", + "is_public": boolean +} +``` \ No newline at end of file diff --git a/apps/portal/src/app/nebula/faqs/page.mdx b/apps/portal/src/app/nebula/faqs/page.mdx new file mode 100644 index 00000000000..2311a328da5 --- /dev/null +++ b/apps/portal/src/app/nebula/faqs/page.mdx @@ -0,0 +1,5 @@ +# Nebula FAQs + +### When will pricing be available for Nebula? + +Pricing options will be available in beta (estimated mid January 2025). \ No newline at end of file diff --git a/apps/portal/src/app/nebula/page.mdx b/apps/portal/src/app/nebula/page.mdx index 7c5d1d14a94..1308164e8ee 100644 --- a/apps/portal/src/app/nebula/page.mdx +++ b/apps/portal/src/app/nebula/page.mdx @@ -1,87 +1,54 @@ +import { PencilRulerIcon, HandCoinsIcon, BlocksIcon, WorkflowIcon, ShieldCheckIcon, CirclePlusIcon } from "lucide-react"; +import { DocImage, createMetadata, FeatureCard } from "@doc"; + + # What is Nebula? Natural language model with blockchain reasoning, autonomous transaction capabilities and real-time access to the blockchain. Nebula is currently available in Alpha. [Join the waitlist.](https://thirdweb.com/nebula) -## What Can Nebula Do? - -### Smart Contract Intelligence -- Analyze any smart contract's functionality and features -- Explain contract interfaces and supported standards -- Read contract data and state -- Help you understand function behaviors and parameters -- Decode complex contract interactions -- Retrieve detailed contract metadata and source code analysis - -### Blockchain Network Information -- Provide real-time network status and gas prices -- Explain block and transaction details -- Help you understand blockchain network specifications -- Offer insights about different blockchain networks -- Track transaction status and history -- Access detailed chain metadata including RPC endpoints - -### Token Analysis -- Look up token information across different networks -- Track token prices and market data -- Explain token standards and implementations -- Help you understand token bridges and cross-chain aspects -- Monitor trading pairs and liquidity -- Fetch token metadata and current exchange rates - -### Transaction and Wallet Management -- Retrieve detailed transaction information using transaction hashes -- Provide wallet balance and transaction history - -### thirdweb Product Guidance - -- Connect Integration: Implement wallet connections and social login setups with how-to guides and code snippets for user authentication flows and wallet management strategies. -- Smart Contract Development: Deploy smart contracts and manage permissions with practical examples and code snippets for contract interaction and NFT minting. -- Account Abstraction: How to use thirdweb Account Abstraction services to provide a seamless user experience for your users. -- Engine Implementation: Integrate backend systems with thirdweb Engine using transaction management and API implementation examples. - - -## Example Questions You Can Ask - -### Understanding Smart Contracts -- "What ERC standards are implemented by contract address 0x59325733eb952a92e069C87F0A6168b29E80627f on Ethereum?" -- "What functions can I use to mint more of my contract's NFTs?" -- "What is the total supply of NFTs for my contract?" - -### Interacting with wallets -- "How much ETH is in my wallet?" -- "What is the wallet address of vitalik.eth?" -- "Does my wallet hold USDC on Base?" - -### Exploring Blockchain Networks -- "What is the last block on zkSync?" -- "What is the current gas price on Avalanche C-Chain?" -- "Can you show me transaction details for 0xdfc450bb39e44bd37c22e0bfd0e5212edbea571e4e534d87b5cbbf06f10b9e04 on Optimism?" - -### Researching Tokens and Prices -- "What is the address of USDC on Ethereum?" -- "Is there a UNI token on Arbitrum?" -- "What is the current price of ARB?" - -### Building with thirdweb -- "How can I add a connect wallet button to my web app? I want to support users connecting with both email/social wallets and MetaMask and use smart wallets." -- "Can you show me how to claim an NFT from an ERC721 using TypeScript?" -- "I have an ERC1155 contract from thirdweb. Can you show me how to generate and mint with a signature?" -- "I have an ERC20 token. Can you show me how I'd use Engine to mint additional tokens to a user wallet?" -- "How can I query for the status of queued transactions on Engine?" - -## What Can You Build With Nebula? - -- Chat with an AI with blockchain context - answer questions about transactions, wallets, and smart contracts in real-time -- Create code editors that can write web3 apps & games -- Build blockchain explorers that explain complex transactions in plain English -- Build automated trading agents that can monitor and execute trades based on specific conditions -- Perform smart contract security analysis and audit assistance -- Create wallet management assistants that help users track portfolios and suggest optimizations -- Create DeFi strategy advisors that analyze yields and risks across protocols -- Create NFT collection managers that can mint, list, and track market activity -- Enable automated customer support for web3 products +## Features + +
+ } + /> + + } + /> + + } + /> + + } + /> + + } + /> + + } + /> +
## Supported Chains Nebula is supported on every EVM compatible chain. To view the full list, visit [thirdweb chainlist](https://thirdweb.com/chainlist). diff --git a/apps/portal/src/app/nebula/plugins/eliza/page.mdx b/apps/portal/src/app/nebula/plugins/eliza/page.mdx new file mode 100644 index 00000000000..8b6ab36470a --- /dev/null +++ b/apps/portal/src/app/nebula/plugins/eliza/page.mdx @@ -0,0 +1,5 @@ +### Coming Soon + +We are actively developing plugins to develop with other frameworks and languages. If you have a specific request, please [contact us](https://thirdweb.com/contact). + + diff --git a/apps/portal/src/app/nebula/plugins/page.mdx b/apps/portal/src/app/nebula/plugins/page.mdx new file mode 100644 index 00000000000..31c221768a6 --- /dev/null +++ b/apps/portal/src/app/nebula/plugins/page.mdx @@ -0,0 +1,3 @@ +### Coming Soon + +We are actively developing plugins to develop with other frameworks and languages. If you have a specific request, please [contact us](https://thirdweb.com/contact). \ No newline at end of file diff --git a/apps/portal/src/app/nebula/prompt-guide/page.mdx b/apps/portal/src/app/nebula/prompt-guide/page.mdx new file mode 100644 index 00000000000..0945e3350d1 --- /dev/null +++ b/apps/portal/src/app/nebula/prompt-guide/page.mdx @@ -0,0 +1,15 @@ +# Prompt Guide + +Maximize the potential of Nebula. Whether you’re new to blockchain development or an experienced user, this document will help you craft prompts that fully leverage Nebula’s blockchain specific features. + +### Supported Actions + +| **Action** | **Description** | **Examples** | +|-----------------------------|----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **Understand** | Retrieve information about smart contracts. | • "What ERC standards are implemented by contract address 0x59325733eb952a92e069C87F0A6168b29E80627f on Ethereum?"
• "What functions can I use to mint more of my contract's NFTs?"
• "What is the total supply of NFTs for my contract?" | +| **Interact** | Query wallet balances, addresses, and token holdings. | • "How much ETH is in my wallet?"
• "What is the wallet address of vitalik.eth?"
• "Does my wallet hold USDC on Base?" | +| **Explore** | Access blockchain-specific data. | • "What is the last block on zkSync?"
• "What is the current gas price on Avalanche C-Chain?"
• "Can you show me transaction details for 0xdfc450bb39e44bd37c22e0bfd0e5212edbea571e4e534d87b5cbbf06f10b9e04 on Optimism?" | +| **Research** | Obtain details about tokens, their addresses, and current prices. | • "What is the address of USDC on Ethereum?"
• "Is there a UNI token on Arbitrum?"
• "What is the current price of ARB?" | +| **Build** | Implement features using Web3 SDKs and tools. | • "How can I add a connect wallet button to my web app? I want to support users connecting with both email/social wallets and MetaMask and use smart wallets."
• "Can you show me how to claim an NFT from an ERC721 using TypeScript?"
• "I have an ERC1155 contract from thirdweb. Can you show me how to generate and mint with a signature?"
• "I have an ERC20 token. Can you show me how I'd use Engine to mint additional tokens to a user wallet?"
• "How can I query for the status of queued transactions on Engine?" | + + diff --git a/apps/portal/src/app/nebula/sidebar.tsx b/apps/portal/src/app/nebula/sidebar.tsx index 8e23da6b441..5c12ff95597 100644 --- a/apps/portal/src/app/nebula/sidebar.tsx +++ b/apps/portal/src/app/nebula/sidebar.tsx @@ -1,4 +1,14 @@ import type { SideBar } from "@/components/Layouts/DocLayout"; +import { + BrickIcon, + CodeIcon, + EditIcon, + GetIcon, + NebulaSideIcon, + PluginIcon, + QuestionIcon, + TroubleshootIcon, +} from "@/icons"; export const sidebar: SideBar = { name: "Nebula", @@ -6,10 +16,86 @@ export const sidebar: SideBar = { { name: "Overview", href: "/nebula", + icon: , + }, + { + name: "Use Cases", + href: "/nebula/use-cases", + icon: , + }, + { + name: "Prompt Guide", + href: "/nebula/prompt-guide", + icon: , + }, + { + name: "Plugins", + href: "/nebula/plugins", + icon: , + links: [ + { + name: "Eliza", + href: "/nebula/plugins/eliza", + }, + ], }, { name: "API Reference", href: "/nebula/api-reference", + icon: , + links: [ + { + name: "Send Message", + href: "/nebula/api-reference/chat", + icon: , + }, + { + name: "Execute Transaction", + href: "/nebula/api-reference/execute", + icon: , + }, + { + name: "List Sessions", + href: "/nebula/api-reference/list-session", + icon: , + }, + { + name: "Get Session", + href: "/nebula/api-reference/get-session", + icon: , + }, + { + name: "Create Session", + href: "/nebula/api-reference/create-session", + icon: , + }, + + { + name: "Update Session", + href: "/nebula/api-reference/update-session", + icon: , + }, + { + name: "Clear Session", + href: "/nebula/api-reference/clear-session", + icon: , + }, + { + name: "Delete Session", + href: "/nebula/api-reference/delete-session", + icon: , + }, + ], + }, + { + name: "Troubleshoot", + href: "/nebula/troubleshoot", + icon: , + }, + { + name: "FAQs", + href: "/nebula/faqs", + icon: , }, ], }; diff --git a/apps/portal/src/app/nebula/troubleshoot/page.mdx b/apps/portal/src/app/nebula/troubleshoot/page.mdx new file mode 100644 index 00000000000..a8e5d0e25e1 --- /dev/null +++ b/apps/portal/src/app/nebula/troubleshoot/page.mdx @@ -0,0 +1,3 @@ +# Troubleshoot + +For any issues you encounter while using Nebula, please [visit our support site](https://thirdweb.com/support). \ No newline at end of file diff --git a/apps/portal/src/app/nebula/use-cases/page.mdx b/apps/portal/src/app/nebula/use-cases/page.mdx new file mode 100644 index 00000000000..25afe3f0cc8 --- /dev/null +++ b/apps/portal/src/app/nebula/use-cases/page.mdx @@ -0,0 +1,48 @@ +## What Can Nebula Do? + +**Smart Contract Intelligence** +- Analyze any smart contract's functionality and features +- Explain contract interfaces and supported standards +- Read contract data and state +- Help you understand function behaviors and parameters +- Decode complex contract interactions +- Retrieve detailed contract metadata and source code analysis + +**Blockchain Network Information** +- Provide real-time network status and gas prices +- Explain block and transaction details +- Help you understand blockchain network specifications +- Offer insights about different blockchain networks +- Track transaction status and history +- Access detailed chain metadata including RPC endpoints + +**Token Analysis** +- Look up token information across different networks +- Track token prices and market data +- Explain token standards and implementations +- Help you understand token bridges and cross-chain aspects +- Monitor trading pairs and liquidity +- Fetch token metadata and current exchange rates + +**Transaction and Wallet Management** +- Retrieve detailed transaction information using transaction hashes +- Provide wallet balance and transaction history + +**Product Guidance** + +- Connect Integration: Implement wallet connections and social login setups with how-to guides and code snippets for user authentication flows and wallet management strategies. +- Smart Contract Development: Deploy smart contracts and manage permissions with practical examples and code snippets for contract interaction and NFT minting. +- Account Abstraction: How to use thirdweb Account Abstraction services to provide a seamless user experience for your users. +- Engine Implementation: Integrate backend systems with thirdweb Engine using transaction management and API implementation examples. + +## What Can You Build With Nebula? + +- Chat with an AI with blockchain context - answer questions about transactions, wallets, and smart contracts in real-time +- Create code editors that can write web3 apps & games +- Build blockchain explorers that explain complex transactions in plain English +- Build automated trading agents that can monitor and execute trades based on specific conditions +- Perform smart contract security analysis and audit assistance +- Create wallet management assistants that help users track portfolios and suggest optimizations +- Create DeFi strategy advisors that analyze yields and risks across protocols +- Create NFT collection managers that can mint, list, and track market activity +- Enable automated customer support for web3 products \ No newline at end of file diff --git a/apps/portal/src/icons/API/GetIcon.tsx b/apps/portal/src/icons/API/GetIcon.tsx new file mode 100644 index 00000000000..aa1f07917a2 --- /dev/null +++ b/apps/portal/src/icons/API/GetIcon.tsx @@ -0,0 +1,19 @@ +export function GetIcon(props: { className?: string }) { + return ( + + Get Icon + + + + ); +} diff --git a/apps/portal/src/icons/index.ts b/apps/portal/src/icons/index.ts index 037bfc41c63..988690a6388 100644 --- a/apps/portal/src/icons/index.ts +++ b/apps/portal/src/icons/index.ts @@ -34,5 +34,17 @@ export { NebulaIcon } from "./products/nebula/NebulaIcon"; // solutions export { GamingIcon } from "./solutions/GamingIcon"; +//sidebar +export { EditIcon } from "./sidebar/EditIcon"; +export { CodeIcon } from "./sidebar/CodeIcon"; +export { BrickIcon } from "./sidebar/BrickIcon"; +export { QuestionIcon } from "./sidebar/QuestionIcon"; +export { NebulaSideIcon } from "./sidebar/NebulaSideIcon"; +export { PluginIcon } from "./sidebar/PluginIcon"; +export { TroubleshootIcon } from "./sidebar/TroubleshootIcon"; + +//api icons +export { GetIcon } from "./API/GetIcon"; + // general purposes export { ExternalLinkIcon } from "./ExternalLinkIcon"; diff --git a/apps/portal/src/icons/sidebar/BrickIcon.tsx b/apps/portal/src/icons/sidebar/BrickIcon.tsx new file mode 100644 index 00000000000..1d13036ea4e --- /dev/null +++ b/apps/portal/src/icons/sidebar/BrickIcon.tsx @@ -0,0 +1,15 @@ +export function BrickIcon(props: { className?: string }) { + return ( + + Brick Icon + + + ); +} diff --git a/apps/portal/src/icons/sidebar/CodeIcon.tsx b/apps/portal/src/icons/sidebar/CodeIcon.tsx new file mode 100644 index 00000000000..dd8f31193bc --- /dev/null +++ b/apps/portal/src/icons/sidebar/CodeIcon.tsx @@ -0,0 +1,15 @@ +export function CodeIcon(props: { className?: string }) { + return ( + + Code Icon + + + ); +} diff --git a/apps/portal/src/icons/sidebar/EditIcon.tsx b/apps/portal/src/icons/sidebar/EditIcon.tsx new file mode 100644 index 00000000000..1dadec69164 --- /dev/null +++ b/apps/portal/src/icons/sidebar/EditIcon.tsx @@ -0,0 +1,15 @@ +export function EditIcon(props: { className?: string }) { + return ( + + Edit Icon + + + ); +} diff --git a/apps/portal/src/icons/sidebar/NebulaSideIcon.tsx b/apps/portal/src/icons/sidebar/NebulaSideIcon.tsx new file mode 100644 index 00000000000..f0072d30d40 --- /dev/null +++ b/apps/portal/src/icons/sidebar/NebulaSideIcon.tsx @@ -0,0 +1,20 @@ +export function NebulaSideIcon(props: { className?: string }) { + return ( + + Nebula Side Icon + + + ); +} diff --git a/apps/portal/src/icons/sidebar/PluginIcon.tsx b/apps/portal/src/icons/sidebar/PluginIcon.tsx new file mode 100644 index 00000000000..5827a6a5187 --- /dev/null +++ b/apps/portal/src/icons/sidebar/PluginIcon.tsx @@ -0,0 +1,15 @@ +export function PluginIcon(props: { className?: string }) { + return ( + + Question Icon + + + ); +} diff --git a/apps/portal/src/icons/sidebar/QuestionIcon.tsx b/apps/portal/src/icons/sidebar/QuestionIcon.tsx new file mode 100644 index 00000000000..f0c0790f000 --- /dev/null +++ b/apps/portal/src/icons/sidebar/QuestionIcon.tsx @@ -0,0 +1,15 @@ +export function QuestionIcon(props: { className?: string }) { + return ( + + Question Icon + + + ); +} diff --git a/apps/portal/src/icons/sidebar/TroubleshootIcon.tsx b/apps/portal/src/icons/sidebar/TroubleshootIcon.tsx new file mode 100644 index 00000000000..ac9d004b149 --- /dev/null +++ b/apps/portal/src/icons/sidebar/TroubleshootIcon.tsx @@ -0,0 +1,15 @@ +export function TroubleshootIcon(props: { className?: string }) { + return ( + + Troubleshoot Icon + + + ); +}