### Run Hypergraph Development Server Source: https://docs.hypergraph.thegraph.com/docs/quickstart Navigate to your newly created Hypergraph application directory and use this command to start the development server. The exact command may vary depending on the package manager you chose during installation. ```bash cd my-hypergraph-app npm run dev # or depending on your package manager yarn run dev pnpm run dev bun run dev ``` -------------------------------- ### Install and Run Hypergraph Connect and Sync Servers Source: https://context7_llms Instructions to clone the Hypergraph repository, install dependencies using pnpm, and run the Connect and Sync servers locally. This setup is crucial for developing and testing web3 applications with Hypergraph. ```bash git clone https://github.com/graphprotocol/hypergraph.git cd hypergraph pnpm install cd apps/connect pnpm dev # in another tab cd apps/server pnpm dev ``` -------------------------------- ### Create Hypergraph App using CLI Source: https://docs.hypergraph.thegraph.com/docs/quickstart Use this command to initialize a new Hypergraph application. Ensure you have Node.js version 22 or higher installed. This command supports multiple package managers like npm, pnpm, bun, and yarn. ```bash npx create-hypergraph@latest # or pnpm create hypergraph@latest bunx create-hypergraph@latest yarn create hypergraph@latest ``` -------------------------------- ### Example llms.txt for FastHTML Source: https://llmstxt.org/ This snippet shows a sample llms.txt file for the FastHTML project. It includes a project description, important notes, links to documentation and examples, and optional resources. The format uses markdown-like syntax with comments and links. ```plaintext # FastHTML > FastHTML is a python library which brings together Starlette, Uvicorn, HTMX, and fastcore's `FT` "FastTags" into a library for creating server-rendered hypermedia applications. Important notes: - Although parts of its API are inspired by FastAPI, it is *not* compatible with FastAPI syntax and is not targeted at creating API services - FastHTML is compatible with JS-native web components and any vanilla JS library, but not with React, Vue, or Svelte. ## Docs - [FastHTML quick start](https://fastht.ml/docs/tutorials/quickstart_for_web_devs.html.md): A brief overview of many FastHTML features - [HTMX reference](https://github.com/bigskysoftware/htmx/blob/master/www/content/reference.md): Brief description of all HTMX attributes, CSS classes, headers, events, extensions, js lib methods, and config options ## Examples - [Todo list application](https://github.com/AnswerDotAI/fasthtml/blob/main/examples/adv_app.py): Detailed walk-thru of a complete CRUD app in FastHTML showing idiomatic use of FastHTML and HTMX patterns. ## Optional - [Starlette full documentation](https://gist.githubusercontent.com/jph00/809e4a4808d4510be0e3dc9565e9cbd3/raw/9b717589ca44cedc8aaf00b2b8cacef922964c0f/starlette-sml.md): A subset of the Starlette documentation useful for FastHTML development. ``` -------------------------------- ### Install and Run TypeSync CLI Tool Source: https://context7_llms This command installs and runs the TypeSync CLI tool, which helps manage Hypergraph schemas. It requires Node.js and a package manager like npm, pnpm, or yarn. The tool starts a local server accessible at http://localhost:3000 for schema management. ```bash npx hg typesync --open # or pnpm hg typesync --open bunx hg typesync --open yarn hg typesync --open ``` -------------------------------- ### llms_txt2ctx CLI Tool Usage Example Source: https://llmstxt.org/ Demonstrates the command-line usage of the llms_txt2ctx tool, which is used to process llms.txt files and expand them into multiple markdown files suitable for LLMs. This example is based on the FastHTML project's implementation. ```bash # Example of using llms_txt2ctx command line application # This command processes llms.txt and expands it into context files. llms_txt2ctx ``` -------------------------------- ### llms.txt File Structure Example (Markdown) Source: https://llmstxt.org/ A mock example illustrating the expected Markdown structure of an llms.txt file. This format includes an H1 title, an optional blockquote for a summary, detailed markdown sections, and H2-delimited file lists with links and optional notes. ```markdown # Title > Optional description goes here Optional details go here ## Section name - [Link title](https://link_url): Optional link details ## Optional - [Link title](https://link_url) ``` -------------------------------- ### Environment and Login Source: https://context7_llms Functions for getting the current environment and performing user login. ```APIDOC ## Function: getEnv() ### Description Returns the current environment the application is running in. ### Method (Not specified, assumed to be a function call) ### Endpoint (Not applicable, this is a function) ### Parameters #### Path Parameters (None) #### Query Parameters (None) #### Request Body (None) ### Request Example (Not applicable, this is a function call) ### Response #### Success Response - **"dev" | "production" | "local"** - The current environment. #### Response Example ```json { "environment": "development" } ``` --- ## Function: login() ### Description Performs the user login process using provided credentials and storage. ### Method (Not specified, assumed to be a function call) ### Endpoint (Not applicable, this is a function) ### Parameters #### Path Parameters (None) #### Query Parameters (None) #### Request Body (None) ### Request Example (Not applicable, this is a function call) ### Response #### Success Response - **void** - The function does not return a value upon successful login. #### Response Example (No response body on success) ``` -------------------------------- ### Clone and Run Hypergraph Locally Source: https://docs.hypergraph.thegraph.com/llms-full.txt Instructions to clone the Hypergraph repository, install dependencies, and run the Connect and Sync Server locally. This involves using git for cloning and pnpm for package management and running development servers. ```bash git clone https://github.com/graphprotocol/hypergraph.git cd hypergraph pnpm install ``` ```bash cd apps/connect pnpm dev # in another tab cd apps/server pnpm dev ``` -------------------------------- ### Create Hypergraph App with CLI Source: https://docs.hypergraph.thegraph.com/llms-full.txt Provides bash commands to create a new Hypergraph application using `create-hypergraph` CLI. It lists the commands for different package managers and outlines the interactive prompts during installation. ```bash npx create-hypergraph@latest # or pnpm create hypergraph@latest bunx create-hypergraph@latest yarn create hypergraph@latest ``` ```bash cd my-hypergraph-app npm run dev # or depending on your package manager yarn run dev pnpm run dev bun run dev ``` -------------------------------- ### Environment and Smart Account Management Source: https://docs.hypergraph.thegraph.com/llms-full.txt Functions to retrieve the current environment, get smart account wallet clients, and check the deployment status of smart accounts. ```APIDOC ## GET /environment ### Description Retrieves the current environment the SDK is operating in. ### Method GET ### Endpoint /environment ### Response #### Success Response (200) - **environment** (string) - The current environment, can be 'dev', 'production', or 'local'. #### Response Example ```json { "environment": "dev" } ``` ``` ```APIDOC ## POST /smart-account/client ### Description Initializes and returns a SmartAccountClient. ### Method POST ### Endpoint /smart-account/client ### Parameters #### Request Body - **params** (SmartAccountParams) - Required - Parameters for creating the SmartAccountClient. ### Request Example ```json { "params": { "chain": "", "entryPointAddress": "0x...", "factoryAddress": "0x...", "owner": "0x..." } } ``` ### Response #### Success Response (200) - **SmartAccountClient** (object) - The initialized SmartAccountClient instance. #### Response Example ```json { "client": "" } ``` ``` ```APIDOC ## POST /smart-account/deployed ### Description Checks if a smart account is deployed on the blockchain. ### Method POST ### Endpoint /smart-account/deployed ### Parameters #### Request Body - **smartAccountClient** (SmartAccountClient) - Required - The SmartAccountClient instance to check. ### Request Example ```json { "smartAccountClient": "" } ``` ### Response #### Success Response (200) - **isDeployed** (boolean) - True if the smart account is deployed, false otherwise. #### Response Example ```json { "isDeployed": true } ``` ``` -------------------------------- ### Load Application Component and its Dependencies Source: https://testnet.geobrowser.io/space/2df11968-9d1c-489f-91b7-bdc88b472161/f8780a80-c238-4a2a-96cb-567d88b1aa63 This snippet demonstrates loading the main 'App' component and its associated dependencies. It specifies the necessary JavaScript chunks required for the 'App' component to function, indicating a code-splitting strategy. ```javascript self.__next_f.push([1,"3:I[47465,[\"862\",\"static/chunks/2ac0c89a-1a0f11361f8b231b.js\",\"3399\",\"static/chunks/3d12784a-b4ce862b86a00513.js\",\"1829\",\"static/chunks/9ffa21ba-7d493445d7fa2ee4.js\",\"149\",\"static/chunks/ffcb966f-85fe591a6a9f7ed9.js\",\"7385\",\"static/chunks/7385-2f9146910e8c36d5.js\",\"407\",\"static/chunks/407-aee958359c5f10c6.js\",\"7038\",\"static/chunks/7038-34064e10b7bbe127.js\",\"3972\",\"static/chunks/3972-79ff17ba4a86cd9a.js\",\"3528\",\"static/chunks/3528-45267e31dc48aea1.js\",\"6354\",\"static/chunks/6354-ce8dd4749b796f09.js\",\"3191\",\"static/chunks/3191-6f86244f49debbd9.js\",\"4197\",\"static/chunks/4197-f9d4b371caf05bc0.js\",\"8999\",\"static/chunks/8999-b667a47af61e66ef.js\",\"6173\",\"static/chunks/6173-ba85ca7c39dc073f.js\",\"7052\",\"static/chunks/7052-6d7bdb758b2f3c20.js\",\"326\",\"static/chunks/326-666dcd5d1147f2bd.js\",\"481\",\"static/chunks/481-d21ff4b35d92a272.js\",\"626\",\"static/chunks/626-7c36b8ea477c8138.js\",\"5329\",\"static/chunks/5329-f299b67d38d6268a.js\",\"2230\",\"static/chunks/2230-20667ea738ef3b57.js\",\"51\",\"static/chunks/51-b442a64a8fff6e52.js\",\"7177\",\"static/chunks/app/layout-613e9d29685eac5d.js\"],\"App\"\] ``` -------------------------------- ### Example Mapping Configuration in TypeScript Source: https://context7_llms An example demonstrating how to define a `Mapping` object for entities like 'Account' and 'Event'. It shows how to associate type IDs and map properties and relations using `Id`. ```typescript import { Id } from '@graphprotocol/hypergraph' import type { Mapping } from '@graphprotocol/hypergraph/mapping' const mapping: Mapping = { Account: { typeIds: [Id('a5fd07b1-120f-46c6-b46f-387ef98396a6')], properties: { username: Id('994edcff-6996-4a77-9797-a13e5e3efad8'), createdAt: Id('64bfba51-a69b-4746-be4b-213214a879fe') } }, Event: { typeIds: [Id('0349187b-526f-435f-b2bb-9e9caf23127a')], properties: { name: Id('3808e060-fb4a-4d08-8069-35b8c8a1902b'), description: Id('1f0d9007-8da2-4b28-ab9f-3bc0709f4837'), }, relations: { speaker: Id('a5fd07b1-120f-46c6-b46f-387ef98396a6') } } } ``` -------------------------------- ### Initialize React Fragment and Providers Source: https://testnet.geobrowser.io/space/2df11968-9d1c-489f-91b7-bdc88b472161/f8780a80-c238-4a2a-96cb-567d88b1aa63 This snippet initializes a React fragment and providers, likely for setting up the application's root or a significant part of its component tree. It's part of a larger initialization process managed by `self.__next_f`. ```javascript requestAnimationFrame(function(){$RT=performance.now()});(self.__next_f=self.__next_f||[]).push([0]) self.__next_f.push([1,"1:\"$Sreact.fragment\"\n"]) self.__next_f.push([1,"2:I[50718,[\"862\",\"static/chunks/2ac0c89a-1a0f11361f8b231b.js\",\"3399\",\"static/chunks/3d12784a-b4ce862b86a00513.js\",\"1829\",\"static/chunks/9ffa21ba-7d493445d7fa2ee4.js\",\"149\",\"static/chunks/ffcb966f-85fe591a6a9f7ed9.js\",\"7385\",\"static/chunks/7385-2f9146910e8c36d5.js\",\"407\",\"static/chunks/407-aee958359c5f10c6.js\",\"7038\",\"static/chunks/7038-34064e10b7bbe127.js\",\"3972\",\"static/chunks/3972-79ff17ba4a86cd9a.js\",\"3528\",\"static/chunks/3528-45267e31dc48aea1.js\",\"6354\",\"static/chunks/6354-ce8dd4749b796f09.js\",\"3191\",\"static/chunks/3191-6f86244f49debbd9.js\",\"4197\",\"static/chunks/4197-f9d4b371caf05bc0.js\",\"8999\",\"static/chunks/8999-b667a47af61e66ef.js\",\"6173\",\"static/chunks/6173-ba85ca7c39dc073f.js\",\"7052\",\"static/chunks/7052-6d7bdb758b2f3c20.js\",\"326\",\"static/chunks/326-666dcd5d1147f2bd.js\",\"481\",\"static/chunks/481-d21ff4b35d92a272.js\",\"626\",\"static/chunks/626-7c36b8ea477c8138.js\",\"5329\",\"static/chunks/5329-f299b67d38d6268a.js\",\"2230\",\"static/chunks/2230-20667ea738ef3b57.js\",\"51\",\"static/chunks/51-b442a64a8fff6e52.js\",\"7177\",\"static/chunks/app/layout-613e9d29685eac5d.js\"],\"Providers\"\] ``` -------------------------------- ### Load Button Component and its Dependencies Source: https://testnet.geobrowser.io/space/2df11968-9d1c-489f-91b7-bdc88b472161/f8780a80-c238-4a2a-96cb-567d88b1aa63 This snippet details the loading process for a 'Button' component. It specifies the necessary JavaScript chunks, including core modules and the specific chunk for the 'Button' component, ensuring all its requirements are met before rendering. ```javascript self.__next_f.push([1,"6:I[10404,[\"862\",\"static/chunks/2ac0c89a-1a0f11361f8b231b.js\",\"3399\",\"static/chunks/3d12784a-b4ce862b86a00513.js\",\"7385\",\"static/chunks/7385-2f9146910e8c36d5.js\",\"407\",\"static/chunks/407-aee958359c5f10c6.js\",\"7038\",\"static/chunks/7038-34064e10b7bbe127.js\",\"6353\",\"static/chunks/6353-400d0f01b9a23299.js\",\"3972\",\"static/chunks/3972-79ff17ba4a86cd9a.js\",\"5329\",\"static/chunks/5329-f299b67d38d6268a.js\",\"2230\",\"static/chunks/2230-20667ea738ef3b57.js\",\"4345\",\"static/chunks/app/not-found-cdec1c43522d407b.js\"],\"Button\"\] ``` -------------------------------- ### signup() Source: https://context7_llms Handles the user signup process, including key generation and synchronization with the server. ```APIDOC ## Function: signup() ### Description Handles the user signup process, including generating new identity keys and synchronizing them with the server. ### Method (Not applicable, this is a function signature) ### Endpoint (Not applicable, this is a function signature) ### Parameters #### Path Parameters (None) #### Query Parameters (None) #### Request Body (None) ### Parameters - **signer** (Signer) - The signer object for transaction authorization. - **_walletClient** (WalletClient) - The wallet client instance (unused parameter). - **smartAccountClient** (SmartAccountClient) - The smart account client instance. - **accountAddress** (`0x${string}`) - The address of the user's account. - **syncServerUri** (string) - The URI of the synchronization server. - **addressStorage** (Storage) - Storage interface for account addresses. - **keysStorage** (Storage) - Storage interface for identity keys. - **identityToken** (string) - The identity token for authentication. - **chain** (Chain) - The blockchain chain object. - **rpcUrl** (string) - The RPC URL for the blockchain node. ### Request Example (Not applicable, this is a function signature) ### Response #### Success Response - **Promise** - A Promise that resolves to an object containing the `accountAddress` and the generated `keys` (IdentityKeys). #### Response Example (Not applicable, this is a function signature) ``` -------------------------------- ### Load Providers Module Initialization Source: https://testnet.geobrowser.io/space/b2565802-3118-47be-91f2-e59170735bac/d8ec3f57-7601-4bef-a648-a64799dfd964 This code snippet loads the 'Providers' module, identified by '2'. It includes a list of JavaScript chunk files and dependencies required for the 'Providers' module to function. This is a critical step in initializing the application's context and state management. ```javascript self.__next_f.push([1,"2:I[50718,[\"862\",\"static/chunks/2ac0c89a-1a0f11361f8b231b.js\",\"3399\",\"static/chunks/3d12784a-b4ce862b86a00513.js\",\"1829\",\"static/chunks/9ffa21ba-7d493445d7fa2ee4.js\",\"149\",\"static/chunks/ffcb966f-85fe591a6a9f7ed9.js\",\"7385\",\"static/chunks/7385-2f9146910e8c36d5.js\",\"407\",\"static/chunks/407-aee958359c5f10c6.js\",\"7038\",\"static/chunks/7038-34064e10b7bbe127.js\",\"3972\",\"static/chunks/3972-79ff17ba4a86cd9a.js\",\"3528\",\"static/chunks/3528-45267e31dc48aea1.js\",\"6354\",\"static/chunks/6354-ce8dd4749b796f09.js\",\"3191\",\"static/chunks/3191-6f86244f49debbd9.js\",\"4197\",\"static/chunks/4197-f9d4b371caf05bc0.js\",\"8999\",\"static/chunks/8999-b667a47af61e66ef.js\",\"6173\",\"static/chunks/6173-ba85ca7c39dc073f.js\",\"7052\",\"static/chunks/7052-6d7bdb758b2f3c20.js\",\"326\",\"static/chunks/326-666dcd5d1147f2bd.js\",\"481\",\"static/chunks/481-d21ff4b35d92a272.js\",\"626\",\"static/chunks/626-7c36b8ea477c8138.js\",\"5329\",\"static/chunks/5329-f299b67d38d6268a.js\",\"2230\",\"static/chunks/2230-20667ea738ef3b57.js\",\"51\",\"static/chunks/51-b442a64a8fff6e52.js\",\"7177\",\"static/chunks/app/layout-613e9d29685eac5d.js\"]ـ,ــ"Providers"]\n"]) ``` -------------------------------- ### Get Environment (TypeScript) Source: https://docs.hypergraph.thegraph.com/llms-full.txt Returns the current environment as a string literal ('dev', 'production', or 'local'). ```typescript function getEnv(): "dev" | "production" | "local" ``` -------------------------------- ### Load App Module Initialization Source: https://testnet.geobrowser.io/space/b2565802-3118-47be-91f2-e59170735bac/d8ec3f57-7601-4bef-a648-a64799dfd964 This code snippet loads the main 'App' module, identified by '3'. It lists the necessary JavaScript chunk files and their dependencies for the 'App' module. This is fundamental for rendering the core components of the application. ```javascript self.__next_f.push([1,"3:I[47465,[\"862\",\"static/chunks/2ac0c89a-1a0f11361f8b231b.js\",\"3399\",\"static/chunks/3d12784a-b4ce862b86a00513.js\",\"1829\",\"static/chunks/9ffa21ba-7d493445d7fa2ee4.js\",\"149\",\"static/chunks/ffcb966f-85fe591a6a9f7ed9.js\",\"7385\",\"static/chunks/7385-2f9146910e8c36d5.js\",\"407\",\"static/chunks/407-aee958359c5f10c6.js\",\"7038\",\"static/chunks/7038-34064e10b7bbe127.js\",\"3972\",\"static/chunks/3972-79ff17ba4a86cd9a.js\",\"3528\",\"static/chunks/3528-45267e31dc48aea1.js\",\"6354\",\"static/chunks/6354-ce8dd4749b796f09.js\",\"3191\",\"static/chunks/3191-6f86244f49debbd9.js\",\"4197\",\"static/chunks/4197-f9d4b371caf05bc0.js\",\"8999\",\"static/chunks/8999-b667a47af61e66ef.js\",\"6173\",\"static/chunks/6173-ba85ca7c39dc073f.js\",\"7052\",\"static/chunks/7052-6d7bdb758b2f3c20.js\",\"326\",\"static/chunks/326-666dcd5d1147f2bd.js\",\"481\",\"static/chunks/481-d21ff4b35d92a272.js\",\"626\",\"static/chunks/626-7c36b8ea477c8138.js\",\"5329\",\"static/chunks/5329-f299b67d38d6268a.js\",\"2230\",\"static/chunks/2230-20667ea738ef3b57.js\",\"51\",\"static/chunks/51-b442a64a8fff6e52.js\",\"7177\",\"static/chunks/app/layout-613e9d29685eac5d.js\"]ـ,ــ"App"]\n"]) ``` -------------------------------- ### processConnectAuthSuccess Usage Source: https://docs.hypergraph.thegraph.com/llms-full.txt Example of using the `processConnectAuthSuccess` function from the Hypergraph React SDK to handle authentication callbacks. ```APIDOC ## `processConnectAuthSuccess` ### Description Handles the authentication success callback by processing the ciphertext and nonce, storing authentication data, and redirecting the user. ### Method N/A (This is a function within a hook) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body This function is called with an object containing: - **storage** (object) - The storage object to use (e.g., `localStorage`). - **ciphertext** (string) - The ciphertext received from the authentication provider. - **nonce** (string) - The nonce received from the authentication provider. ### Request Example ```tsx import { useHypergraphApp } from "@graphprotocol/hypergraph-react"; import { useEffect, useRef } from "react"; import { useNavigate, useSearch } from "@tanstack/react-router"; function RouteComponent() { const { ciphertext, nonce } = useSearch(); // get the ciphertext and nonce from the URL const { processConnectAuthSuccess } = useHypergraphApp(); const navigate = useNavigate(); const isProcessingRef = useRef(false); useEffect(() => { if (isProcessingRef.current) return; // prevent multiple calls from useEffect double calling in StrictMode const result = processConnectAuthSuccess({ storage: localStorage, ciphertext, nonce }); if (result.success) { isProcessingRef.current = true; navigate({ to: '/', replace: true }); } else { alert(result.error); } }, [ciphertext, nonce, processConnectAuthSuccess, navigate]); return "Authenticating …"; } ``` ### Response #### Success Response (Implicit) On success, the function processes the data and redirects the user. #### Response Example N/A (Function modifies state and navigates) ``` -------------------------------- ### Define RequestGetAccountInboxes Source: https://docs.hypergraph.thegraph.com/llms-full.txt Defines the structure for a request to get all inboxes for a specific account. It only requires the type of request. ```typescript const RequestGetAccountInboxes: Struct<{ type: Literal<["get-account-inboxes"] }> ``` -------------------------------- ### Login and Signup Functions Source: https://docs.hypergraph.thegraph.com/llms.txt Functions for user login and signup processes. ```APIDOC ## Login ### Description Handles the user login process. ### Method N/A (Function call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **__namedParameters** (object) - Required - Parameters for login. - `signature` (string) - Required - The user's signature. - `identityToken` (string) - Required - The identity token. - `syncServerUri` (string) - Required - The URI for the sync server. - `accountAddress` (string) - Required - The user's account address. - `addressStorage` (object) - Required - Storage for address data. - `keysStorage` (object) - Required - Storage for keys data. - `identityTokenStorage` (object) - Required - Storage for identity token. ### Request Example ```json { "signature": "0xSignature", "identityToken": "identity_token_string", "syncServerUri": "https://sync.example.com", "accountAddress": "0xAccountAddress", "addressStorage": {}, "keysStorage": {}, "identityTokenStorage": {} } ``` ### Response #### Success Response (void) - **Promise**: A promise that resolves when login is complete. #### Response Example ```json { "status": "login_successful" } ``` ## Signup ### Description Handles the user signup process. ### Method N/A (Function call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **signer** (object) - Required - The signer object. - **_walletClient** (object) - Required - The wallet client object. - **smartAccountClient** (object) - Required - The smart account client object. - **accountAddress** (string) - Required - The user's account address. - **syncServerUri** (string) - Required - The URI for the sync server. - **addressStorage** (object) - Required - Storage for address data. - **keysStorage** (object) - Required - Storage for keys data. - **identityToken** (string) - Required - The identity token. - **otherParams** (object) - Optional - Other parameters for signup. ### Request Example ```json { "signer": {}, "_walletClient": {}, "smartAccountClient": {}, "accountAddress": "0xAccountAddress", "syncServerUri": "https://sync.example.com", "addressStorage": {}, "keysStorage": {}, "identityToken": "identity_token_string" } ``` ### Response #### Success Response (void) - **Promise**: A promise that resolves when signup is complete. #### Response Example ```json { "status": "signup_successful" } ``` ``` -------------------------------- ### JavaScript: Dynamic Script Loading and Initialization Source: https://testnet.geobrowser.io/space/b2565802-3118-47be-91f2-e59170735bac/0f3e0e21-1636-435a-850f-6f57d616e28e This snippet demonstrates a common pattern in JavaScript applications, particularly within frameworks like Next.js, for dynamically loading and initializing script chunks. It utilizes an array `__next_f` to manage script loading, where each entry specifies the type of operation (e.g., 0 for initialization, 1 for loading components) and associated metadata like chunk IDs and file paths. This approach allows for efficient code splitting and on-demand loading of components. ```javascript requestAnimationFrame(function(){$RT=performance.now()});(self.__next_f=self.__next_f||[]).push([0]) ``` ```javascript self.__next_f.push([1,"1:\"$Sreact.fragment\"\n"]) ``` ```javascript self.__next_f.push([1,"2:I[50718,[\"862\",\"static/chunks/2ac0c89a-1a0f11361f8b231b.js\",\"3399\",\"static/chunks/3d12784a-b4ce862b86a00513.js\",\"1829\",\"static/chunks/9ffa21ba-7d493445d7fa2ee4.js\",\"149\",\"static/chunks/ffcb966f-85fe591a6a9f7ed9.js\",\"7385\",\"static/chunks/7385-2f9146910e8c36d5.js\",\"407\",\"static/chunks/407-aee958359c5f10c6.js\",\"7038\",\"static/chunks/7038-34064e10b7bbe127.js\",\"3972\",\"static/chunks/3972-79ff17ba4a86cd9a.js\",\"3528\",\"static/chunks/3528-45267e31dc48aea1.js\",\"6354\",\"static/chunks/6354-ce8dd4749b796f09.js\",\"3191\",\"static/chunks/3191-6f86244f49debbd9.js\",\"4197\",\"static/chunks/4197-f9d4b371caf05bc0.js\",\"8999\",\"static/chunks/8999-b667a47af61e66ef.js\",\"6173\",\"static/chunks/6173-ba85ca7c39dc073f.js\",\"7052\",\"static/chunks/7052-6d7bdb758b2f3c20.js\",\"326\",\"static/chunks/326-666dcd5d1147f2bd.js\",\"481\",\"static/chunks/481-d21ff4b35d92a272.js\",\"626\",\"static/chunks/626-7c36b8ea477c8138.js\",\"5329\",\"static/chunks/5329-f299b67d38d6268a.js\",\"2230\",\"static/chunks/2230-20667ea738ef3b57.js\",\"51\",\"static/chunks/51-b442a64a8fff6e52.js\",\"7177\",\"static/chunks/app/layout-613e9d29685eac5d.js\"],\"Providers\"\]\n"]) ``` ```javascript self.__next_f.push([1,"3:I[47465,[\"862\",\"static/chunks/2ac0c89a-1a0f11361f8b231b.js\",\"3399\",\"static/chunks/3d12784a-b4ce862b86a00513.js\",\"1829\",\"static/chunks/9ffa21ba-7d493445d7fa2ee4.js\",\"149\",\"static/chunks/ffcb966f-85fe591a6a9f7ed9.js\",\"7385\",\"static/chunks/7385-2f9146910e8c36d5.js\",\"407\",\"static/chunks/407-aee958359c5f10c6.js\",\"7038\",\"static/chunks/7038-34064e10b7bbe127.js\",\"3972\",\"static/chunks/3972-79ff17ba4a86cd9a.js\",\"3528\",\"static/chunks/3528-45267e31dc48aea1.js\",\"6354\",\"static/chunks/6354-ce8dd4749b796f09.js\",\"3191\",\"static/chunks/3191-6f86244f49debbd9.js\",\"4197\",\"static/chunks/4197-f9d4b371caf05bc0.js\",\"8999\",\"static/chunks/8999-b667a47af61e66ef.js\",\"6173\",\"static/chunks/6173-ba85ca7c39dc073f.js\",\"7052\",\"static/chunks/7052-6d7bdb758b2f3c20.js\",\"326\",\"static/chunks/326-666dcd5d1147f2bd.js\",\"481\",\"static/chunks/481-d21ff4b35d92a272.js\",\"626\",\"static/chunks/626-7c36b8ea477c8138.js\",\"5329\",\"static/chunks/5329-f299b67d38d6268a.js\",\"2230\",\"static/chunks/2230-20667ea738ef3b57.js\",\"51\",\"static/chunks/51-b442a64a8fff6e52.js\",\"7177\",\"static/chunks/app/layout-613e9d29685eac5d.js\"],\"App\"\]\n"]) ``` ```javascript self.__next_f.push([1,"4:I[58396,[],\"\"]\n5:I[80682,[],\"\"]\n6:I[10404,[\"862\",\"static/chunks/2ac0c89a-1a0f11361f8b231b.js\",\"3399\",\"static/chunks/3d12784a-b4ce862b86a00513.js\",\"7385\",\"static/chunks/7385-2f9146910e8c36d5.js\",\"407\",\"static/chunks/407-aee958359c5f10c6.js\",\"7038\",\"static/chunks/7038-34064e10b7bbe127.js\",\"6353\",\"static/chunks/6353-400d0f01b9a23299.js\",\"3972\",\"static/chunks/3972-79ff17ba4a86cd9a.js\",\"5329\",\"static/chunks/5329-f299b67d38d6268a.js\",\"2230\",\"static/chunks/2230-20667ea738ef3b57.js\",\"4345\",\"static/chunks/app/not-found-cdec1c43522d407b.js\"],\"Button\"\]\n"]) ``` ```javascript self.__next_f.push([1,"7:I[22230,[\"862\",\"static/chunks/2ac0c89a-1a0f11361f8b231b.js\",\"3399\",\"static/chunks/3d12784a-b4ce862b86a00513.js\",\"1829\",\"static/chunks/9ffa21ba-7d493445d7fa2ee4.js\",\"149\",\"static/chunks/ffcb966f-85fe591a6a9f7ed9.js\",\"4952\",\"static/chunks/8c2fb024-4bb0412a358bcf44.js\",\"6238\",\"static/chunks/d04f95b7-8146b0a395df48f4.js\",\"7385\",\"static/chunks/7385-2f9146910e8c36d5.js\",\"407\",\"static/chunks/407-aee958359c5f10c6.js\",\"7038\",\"static/chunks/7038-34064e10b7bbe127.js\",\"6353\",\"static/chunks/6353-400d0f01b9a23299.js\",\"3972\",\"static/chunks/3972-79ff17ba4a86cd9a.js\",\"3528\",\"static/chunks/3528-45267e31dc48aea1.js\",\"6354\",\"static/chunks/6354-ce8dd4749b796f09.js\",\"3191\",\"static/chunks/3191-6f86244f49debbd9.js\",\"4197\",\"static/chunks/4197-f9d4b371caf05bc0.js\",\"8999\",\"static/chunks/8999-b667a47af61e66ef.js\",\"6173\",\"static/chunks/6173-ba85ca7c39dc073f.js\",\"7052\",\"static/chunks/7052-6d7bdb758b2f3c20.js\",\"2510\",\"static/chunks/2510-203ef7bef7e9ecf5.js\",\"326\",\"static/chunks/326-666dcd5d1147f2bd.js\",\"481\",\"static/chunks/481-d21ff4b35d92a272.js\",\"5329\",\"static/chunks/5329-f299b67d38d6268a.js\",\"2230\",\"static/chunks/2230-20667ea738ef3b57.js\",\"51\",\"static/chunks/51-b442a64a8fff6e52.js\",\"46\",\"static/chunks/46-c8d86bcf4d1ba179.js\",\"8453\",\"static/chunks/8"]) ``` -------------------------------- ### Storage API Source: https://docs.hypergraph.thegraph.com/llms-full.txt Provides methods for interacting with the local storage, allowing you to get, set, and remove items. ```APIDOC ## Storage Interface ### Description Manages key-value pairs in local storage. ### Methods #### `getItem(key: string): string | null` Retrieves an item from storage by its key. #### `setItem(key: string, value: string): void` Sets an item in storage with the given key and value. #### `removeItem(key: string): void` Removes an item from storage by its key. ### Example Usage ```javascript // Get an item const userData = storage.getItem('user'); // Set an item storage.setItem('theme', 'dark'); // Remove an item storage.removeItem('sessionToken'); ``` ``` -------------------------------- ### Get Smart Account Wallet Client (TypeScript) Source: https://docs.hypergraph.thegraph.com/llms-full.txt Initializes and returns a SmartAccountClient based on the provided parameters. Requires SmartAccountParams. ```typescript import { SmartAccountClient } from "@biconomy-sdk/core-types"; import { SmartAccountParams } from "./types"; async function getSmartAccountWalletClient(smartAccountParams: SmartAccountParams): Promise ``` -------------------------------- ### Signup for Smart Account Source: https://context7_llms Handles the signup process for a new smart account. It requires a signer, wallet client, smart account client, account address, sync server URI, storage interfaces, identity token, chain, and RPC URL. It returns a Promise resolving with the account address and newly created identity keys. This function initiates the creation of a user's account. ```typescript import type { Signer } from '@ethersproject/abstract-signer'; import type { SmartAccountClient } from '@biconomy/account'; import type { Chain } from 'viem'; import type { IdentityKeys } from '../types'; import type { Storage } from './auth-storage'; export const signup = async ( signer: Signer, _walletClient: any, // Placeholder for actual WalletClient type smartAccountClient: SmartAccountClient, accountAddress: `0x${string}`, syncServerUri: string, addressStorage: Storage, keysStorage: Storage, identityToken: string, chain: Chain, rpcUrl: string ): Promise<{ accountAddress: `0x${string}`; keys: IdentityKeys }> => { // Dummy implementation for signup const keys: IdentityKeys = { privateKey: '0x123', publicKey: '0x456', signaturePrivateKey: '0x789', signaturePublicKey: '0xabc', }; await addressStorage.setItem(accountAddress, accountAddress); await keysStorage.setItem(accountAddress, JSON.stringify(keys)); // In a real scenario, this would involve creating a smart account via smartAccountClient console.log( 'Signup process initiated for account:', accountAddress, 'on chain:', chain.id, 'with RPC:', rpcUrl ); return { accountAddress, keys }; }; ``` -------------------------------- ### Load Button Module Initialization Source: https://testnet.geobrowser.io/space/b2565802-3118-47be-91f2-e59170735bac/d8ec3f57-7601-4bef-a648-a64799dfd964 This code initializes and loads the 'Button' module, identified by '6'. It lists the required JavaScript chunk files and their dependencies. This snippet is responsible for making button components available in the application, enabling user interaction elements. ```javascript self.__next_f.push([1,"6:I[10404,[\"862\",\"static/chunks/2ac0c89a-1a0f11361f8b231b.js\",\"3399\",\"static/chunks/3d12784a-b4ce862b86a00513.js\",\"7385\",\"static/chunks/7385-2f9146910e8c36d5.js\",\"407\",\"static/chunks/407-aee958359c5f10c6.js\",\"7038\",\"static/chunks/7038-34064e10b7bbe127.js\",\"6353\",\"static/chunks/6353-400d0f01b9a23299.js\",\"3972\",\"static/chunks/3972-79ff17ba4a86cd9a.js\",\"5329\",\"static/chunks/5329-f299b67d38d6268a.js\",\"2230\",\"static/chunks/2230-20667ea738ef3b57.js\",\"4345\",\"static/chunks/app/not-found-cdec1c43522d407b.js\"]ـ,ــ"Button"]\n"]) ``` -------------------------------- ### Get Smart Account Wallet Client Source: https://context7_llms Initializes and returns a SmartAccountClient based on provided parameters. This client is used for interacting with smart accounts on the blockchain. ```typescript async getSmartAccountWalletClient(__namedParameters: SmartAccountParams): Promise ``` -------------------------------- ### Signup Source: https://docs.hypergraph.thegraph.com/llms-full.txt Handles the user signup process, including key generation and storage, and synchronization with the server. ```APIDOC ## Function: signup() ### Description Handles the user signup process. ### Method N/A (Function) ### Endpoint N/A (Function) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Parameters - **signer** (Signer) - The signer object. - **_walletClient** - The wallet client (type not specified in source). - **smartAccountClient** (SmartAccountClient) - The smart account client. - **accountAddress** (`0x${string}`) - The user's account address. - **syncServerUri** (string) - The URI of the sync server. - **addressStorage** (Storage) - The storage interface for addresses. - **keysStorage** (Storage) - The storage interface for keys. - **identityToken** (string) - The identity token. - **chain** (Chain) - The blockchain chain. - **rpcUrl** (string) - The RPC endpoint URL. ### Request Example ```javascript // Example usage (assuming necessary imports and objects are defined) // const signedUp = await signup(signer, walletClient, smartAccountClient, accountAddress, syncServerUri, addressStorage, keysStorage, identityToken, chain, rpcUrl); ``` ### Response #### Success Response (Promise) - **accountAddress** (`0x${string}`) - The newly created account address. - **keys** (IdentityKeys) - The generated identity keys. #### Response Example ```json { "accountAddress": "0x123...", "keys": { "signaturePublicKey": "pub_sig_ghi...", "encryptionPublicKey": "pub_enc_abc...", "signaturePrivateKey": "priv_sig_def...", "encryptionPrivateKey": "priv_enc_xyz..." } } ``` ``` -------------------------------- ### Get Environment Type Source: https://context7_llms Retrieves the current environment type, which can be 'dev', 'production', or 'local'. This function is useful for conditional logic based on the deployment environment. ```typescript getEnv(): "dev" | "production" | "local" ```