### API Route Example (TypeScript) Source: https://github.com/honeycomb-protocol/mining_badger/blob/main/README.md An example of an API route file in a Next.js application, typically located in the 'pages/api' directory. This file defines an endpoint that can be accessed via HTTP. ```typescript import type { NextApiRequest, NextApiResponse } from 'next' type Data = { name: string } export default function handler( req: NextApiRequest, res: NextApiResponse ) { res.status(200).json({ name: 'John Doe' }) } ``` -------------------------------- ### Start Development Server (Bash) Source: https://github.com/honeycomb-protocol/mining_badger/blob/main/README.md Commands to run the Next.js development server using different package managers like npm, yarn, pnpm, and bun. These commands initiate a local server for development and hot-reloading. ```bash npm run dev # or yarn dev # or pnpm dev # or bun dev ``` -------------------------------- ### Get Inventory - Fetch User Resources (TypeScript) Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Retrieves all resources owned by a user from their Token-2022 accounts and enriches them with metadata. This GET request requires the user's wallet public key as a query parameter. ```typescript // GET /api/get-inventory?wallet=DxT7...wallet_address const response = await fetch('/api/get-inventory?wallet=DxT7...wallet_address'); const data = await response.json(); // Returns: // { // result: [ // { // name: 'Iron Ore', // symbol: 'IRON', // uri: 'https://...', // amount: 5.5, // claimed: true, // address: '9abc...', // mint: '7def...', // tags: ['ORES'], // lvl_req: 1 // } // ] // } ``` -------------------------------- ### Get Inventory - Fetch User Resources Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Retrieves all owned resources from a user's Token-2022 accounts and enriches them with metadata. ```APIDOC ## GET /api/get-inventory ### Description Retrieves all owned resources from the user's Token-2022 accounts and enriches with metadata. ### Method GET ### Endpoint /api/get-inventory ### Parameters #### Query Parameters - **wallet** (string) - Required - The public key of the user's wallet address. ### Request Example ``` GET /api/get-inventory?wallet=DxT7...wallet_address ``` ### Response #### Success Response (200) - **result** (array) - An array of owned resources. - **name** (string) - The name of the resource. - **symbol** (string) - The symbol of the resource. - **uri** (string) - The metadata URI for the resource. - **amount** (number) - The amount of the resource owned. - **claimed** (boolean) - Indicates if the resource has been claimed. - **address** (string) - The address of the resource's NFT. - **mint** (string) - The mint address of the resource. - **tags** (array) - An array of tags associated with the resource (e.g., "ORES"). - **lvl_req** (number) - The level requirement to use or craft the resource. #### Response Example ```json { "result": [ { "name": "Iron Ore", "symbol": "IRON", "uri": "https://...", "amount": 5.5, "claimed": true, "address": "9abc...", "mint": "7def...", "tags": ["ORES"], "lvl_req": 1 } ] } ``` ``` -------------------------------- ### Craft Resource - Get Craftable Items (TypeScript) Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Returns a list of craftable items, filtered by a specified tag, including their ingredient requirements. This GET endpoint requires a 'tag' query parameter to filter results. ```typescript // GET /api/craft-resource?tag=Armor const response = await fetch('/api/craft-resource?tag=Armor'); const data = await response.json(); // Returns: // { // result: [ // { // name: 'Iron Helmet', // symbol: 'IHELM', // uri: 'https://...', // lvl_req: 5, // craft_time: 300, // xp: 50, // ingredients: [ // { name: 'Iron Bar', symbol: 'IBAR', uri: 'https://...', amount: 3 }, // { name: 'Coal', symbol: 'COAL', uri: 'https://...', amount: 2 } // ], // address: '4xyz...', // mint: '8uvw...', // recipe: '2rec...' // } // ] // } ``` -------------------------------- ### GET /api/get-level Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Calculates and returns level information based on experience points. ```APIDOC ## GET /api/get-level ### Description Converts experience points to level information. ### Method GET ### Endpoint /api/get-level ### Parameters #### Query Parameters - **exp** (number) - Required - Experience points to calculate level from. ### Request Example `GET /api/get-level?exp=5000` ### Response #### Success Response (200) - **result** (object) - Contains level details. - **level** (number) - The calculated level. - **current_exp** (number) - The current experience points. - **exp_req** (number) - The experience required for the next level. #### Response Example ```json { "result": { "level": 21, "current_exp": 5000, "exp_req": 5600 } } ``` ``` -------------------------------- ### Configure and Cache Resources (TypeScript) Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Sets up global configuration for the Honeycomb Protocol, including Solana connection details and cached resource data. It pre-processes resource addresses to categorize them (e.g., pickaxes, ores, bars) for efficient lookups. Mine data is retrieved from Redis using an asynchronous HTTP GET request. ```typescript // config/config.ts import { Connection, PublicKey } from '@solana/web3.js'; import resources from '@/config/resource-addresses.json'; const RPC_URL = process.env.NEXT_PUBLIC_RPC_ENDPOINT; const HPL_PROJECT = new PublicKey(process.env.NEXT_PUBLIC_HPL_PROJECT); const connection = new Connection(RPC_URL); // Cached resource types const CachedPickaxes = Object.entries(resources.resources) .filter(([_key, value]) => 'time_reduced' in value) .map(([_key, value]) => value); const CachedOres = Object.entries(resources.resources) .filter(([_key, value]) => 'mine_time' in value) .map(([_key, value]) => value); const CachedBars = Object.entries(resources.resources) .filter(([_key, value]) => 'refine_time' in value) .map(([_key, value]) => value); // Mine data retrieval from Redis import axios from 'axios'; const getMinedResource = async (id: string) => { const res = await axios.get(`/api/upstash-kv?key=${id}`); if (!res?.data?.value) return null; return res.data.value; }; // Usage const mineData = await getMinedResource('wallet_address-resource_address'); if (mineData) { console.log('Mining expires at:', new Date(mineData.will_expire)); } ``` -------------------------------- ### Craft Resource - Get Craftable Items Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Returns a list of craftable items, filtered by a specified tag, along with their ingredient requirements. ```APIDOC ## GET /api/craft-resource ### Description Returns craftable items filtered by tag with ingredient requirements. ### Method GET ### Endpoint /api/craft-resource ### Parameters #### Query Parameters - **tag** (string) - Required - The tag to filter craftable items by (e.g., "Armor"). ### Request Example ``` GET /api/craft-resource?tag=Armor ``` ### Response #### Success Response (200) - **result** (array) - An array of craftable items. - **name** (string) - The name of the craftable item. - **symbol** (string) - The symbol of the craftable item. - **uri** (string) - The metadata URI for the item. - **lvl_req** (number) - The level requirement to craft the item. - **craft_time** (number) - The time in seconds required to craft the item. - **xp** (number) - The experience points gained from crafting the item. - **ingredients** (array) - An array of ingredients required for crafting. - **name** (string) - The name of the ingredient. - **symbol** (string) - The symbol of the ingredient. - **uri** (string) - The metadata URI for the ingredient. - **amount** (number) - The amount of the ingredient required. - **address** (string) - The address of the craftable item's NFT. - **mint** (string) - The mint address of the craftable item. - **recipe** (string) - The identifier for the crafting recipe. #### Response Example ```json { "result": [ { "name": "Iron Helmet", "symbol": "IHELM", "uri": "https://...", "lvl_req": 5, "craft_time": 300, "xp": 50, "ingredients": [ { "name": "Iron Bar", "symbol": "IBAR", "uri": "https://...", "amount": 3 }, { "name": "Coal", "symbol": "COAL", "uri": "https://...", "amount": 2 } ], "address": "4xyz...", "mint": "8uvw...", "recipe": "2rec..." } ] } ``` ``` -------------------------------- ### Initialize Resource - Create Character (TypeScript) Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Creates a new character NFT with default traits if the wallet does not already possess one. This GET request requires the wallet's public key to check for existing characters and potentially create a new one. ```typescript // GET /api/init-resource?wallet=DxT7...wallet_address const response = await fetch('/api/init-resource?wallet=DxT7...wallet_address'); const data = await response.json(); // Returns: // { // result: { // address: 'char123...', // source: { // params: { // attributes: { // Fur: { name: 'Black', symbol: 'FUR_BLK', uri: '...', address: '...' }, // Eyes: { name: 'Blue Eyes', symbol: 'EYE_BLU', uri: '...', address: '...' }, // Mouth: { name: 'Contented', symbol: 'MTH_CON', uri: '...', address: '...' } // } // } // }, // equipments: [ // { // name: 'Bronze Pickaxe', // symbol: 'BPICK', // amount: 1, // address: 'pick123...', // mint: 'mint456...', // tags: ['Pickaxe'] // } // ] // } // } ``` -------------------------------- ### Edge Client Initialization Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Provides a singleton instance of the Honeycomb Protocol edge client for backend usage. ```APIDOC ## Edge Client Initialization ### Description This function implements a singleton pattern to ensure only one instance of the Honeycomb Protocol edge client is created and used throughout the application's backend. ### Usage ```typescript import { getEdgeClient } from '@/lib/edge-client'; const edgeClient = getEdgeClient(); const { character } = await edgeClient.findCharacters({ wallets: ['DxT7...wallet_address'], trees: ['tree_address'] }); ``` ### Internal Implementation Details - The client is initialized lazily on the first call to `getEdgeClient()`. - Configuration and a flag for backend usage (`true`) are passed during initialization. ``` -------------------------------- ### Claim Faucet - Mint Initial Resources Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Mints initial resources (ores or pickaxes) to a user's wallet and initiates a mining timer in the Redis cache. ```APIDOC ## POST /api/claim-faucet ### Description Mints resources (ores or pickaxes) to a user's wallet and creates a mining timer in Redis cache. ### Method POST ### Endpoint /api/claim-faucet ### Parameters #### Request Body - **currentUser** (object) - Required - Information about the current user. - **id** (string) - Required - The user's unique identifier. - **currentWallet** (object) - Required - Information about the user's wallet. - **publicKey** (string) - Required - The public key of the user's wallet address. - **resourceId** (string) - Required - The identifier of the resource to mint. ### Request Example ```json { "currentUser": { "id": "user-123" }, "currentWallet": { "publicKey": "DxT7...wallet_address" }, "resourceId": "9abc...resource_address" } ``` ### Response #### Success Response (200) - **result** (object) - The result of the faucet claim operation. - **user** (string) - The user's identifier. - **wallet** (string) - The user's wallet address. - **resource** (string) - The minted resource identifier. - **created_at** (number) - Timestamp when the resource was created. - **will_expire** (number) - Timestamp when the resource will expire. #### Response Example ```json { "result": { "user": "user-123", "wallet": "DxT7...wallet_address", "resource": "9abc...resource_address", "created_at": 1698765432000, "will_expire": 1698765552000 } } ``` ``` -------------------------------- ### Configuration and Resource Caching Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Manages global application configuration and caches resource data for efficient lookups. ```APIDOC ## Configuration and Resource Caching ### Description This module centralizes configuration, including RPC connection details and project public keys. It also pre-caches resource data (Pickaxes, Ores, Bars) for performance optimization and provides a function to retrieve mining data from Redis. ### Usage Example ```typescript // Retrieve mining data for a specific resource const mineData = await getMinedResource('wallet_address-resource_address'); if (mineData) { console.log('Mining expires at:', new Date(mineData.will_expire)); } ``` ### Internal Details - Reads configuration from environment variables (`NEXT_PUBLIC_RPC_ENDPOINT`, `NEXT_PUBLIC_HPL_PROJECT`). - Loads resource addresses from `resource-addresses.json`. - Caches resources into `CachedPickaxes`, `CachedOres`, and `CachedBars` arrays. - Uses `axios` to fetch data from an Upstash KV store via a `/api/upstash-kv` endpoint. ``` -------------------------------- ### Initialize Resource - Create Character Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Creates a new character NFT with default traits for a given wallet if one does not already exist. ```APIDOC ## GET /api/init-resource ### Description Creates a new character NFT with default traits if one doesn't exist for the wallet. ### Method GET ### Endpoint /api/init-resource ### Parameters #### Query Parameters - **wallet** (string) - Required - The public key of the user's wallet address. ### Request Example ``` GET /api/init-resource?wallet=DxT7...wallet_address ``` ### Response #### Success Response (200) - **result** (object) - Information about the newly created character. - **address** (string) - The address of the created character NFT. - **source** (object) - Details about the character's initial attributes. - **params** (object) - **attributes** (object) - A map of character trait categories to their assigned values. - **Fur** (object) - Example trait. - **name** (string) - **symbol** (string) - **uri** (string) - **address** (string) - **Eyes** (object) - Example trait. - **name** (string) - **symbol** (string) - **uri** (string) - **address** (string) - **Mouth** (object) - Example trait. - **name** (string) - **symbol** (string) - **uri** (string) - **address** (string) - **equipments** (array) - An array of initially equipped items. - **name** (string) - The name of the equipped item. - **symbol** (string) - The symbol of the equipped item. - **amount** (number) - The amount of the item equipped. - **address** (string) - The address of the item's NFT. - **mint** (string) - The mint address of the item. - **tags** (array) - An array of tags associated with the item (e.g., "Pickaxe"). #### Response Example ```json { "result": { "address": "char123...", "source": { "params": { "attributes": { "Fur": { "name": "Black", "symbol": "FUR_BLK", "uri": "...", "address": "..." }, "Eyes": { "name": "Blue Eyes", "symbol": "EYE_BLU", "uri": "...", "address": "..." }, "Mouth": { "name": "Contented", "symbol": "MTH_CON", "uri": "...", "address": "..." } } } }, "equipments": [ { "name": "Bronze Pickaxe", "symbol": "BPICK", "amount": 1, "address": "pick123...", "mint": "mint456...", "tags": ["Pickaxe"] } ] } } ``` ``` -------------------------------- ### Equip Resource - Attach Item to Character (TypeScript) Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Prepares a transaction to equip a resource (item) to a character. This POST endpoint requires the user's wallet address and the resource's address, returning transaction details for client-side signing and submission. ```typescript // POST /api/equip-resource const response = await fetch('/api/equip-resource', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ wallet: 'DxT7...wallet_address', resource: '9abc...resource_address' }) }); const data = await response.json(); // Returns: // { // result: { // tx: 'base58_encoded_transaction', // blockhash: '3bLr...blockhash', // lastValidBlockHeight: 123456789 // } // } // Client signs and sends the transaction import { VersionedTransaction } from '@solana/web3.js'; import base58 from 'bs58'; const transaction = VersionedTransaction.deserialize(base58.decode(data.result.tx)); await wallet.signTransaction(transaction); const signature = await connection.sendRawTransaction(transaction.serialize()); ``` -------------------------------- ### Equip Resource - Attach Item to Character Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Prepares a transaction to equip a resource (item) to a character. The client must sign and send this transaction. ```APIDOC ## POST /api/equip-resource ### Description Prepares a transaction to equip a resource to a character. The client signs and sends the transaction. ### Method POST ### Endpoint /api/equip-resource ### Parameters #### Request Body - **wallet** (string) - Required - The public key of the user's wallet address. - **resource** (string) - Required - The address of the resource (item NFT) to equip. ### Request Example ```json { "wallet": "DxT7...wallet_address", "resource": "9abc...resource_address" } ``` ### Response #### Success Response (200) - **result** (object) - Details required for signing and sending the transaction. - **tx** (string) - The base58 encoded transaction data. - **blockhash** (string) - The recent blockhash to use for the transaction. - **lastValidBlockHeight** (number) - The last valid block height for the transaction. #### Response Example ```json { "result": { "tx": "base58_encoded_transaction", "blockhash": "3bLr...blockhash", "lastValidBlockHeight": 123456789 } } ``` ### Client-Side Transaction Handling ```javascript import { VersionedTransaction } from '@solana/web3.js'; import base58 from 'bs58'; // Assuming 'data' is the JSON response from the API call const transaction = VersionedTransaction.deserialize(base58.decode(data.result.tx)); // Sign the transaction with the user's wallet await wallet.signTransaction(transaction); // Send the signed transaction const signature = await connection.sendRawTransaction(transaction.serialize()); ``` ``` -------------------------------- ### Claim Faucet - Mint Resources (TypeScript) Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Mints initial resources (ores or pickaxes) to a user's wallet and establishes a mining timer in Redis cache. This API endpoint requires user and wallet information, along with the resource ID for minting. ```typescript // POST /api/claim-faucet const response = await fetch('/api/claim-faucet', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ currentUser: { id: 'user-123' }, currentWallet: { publicKey: 'DxT7...wallet_address' }, resourceId: '9abc...resource_address' }) }); const data = await response.json(); // Returns: // { // result: { // user: 'user-123', // wallet: 'DxT7...wallet_address', // resource: '9abc...resource_address', // created_at: 1698765432000, // will_expire: 1698765552000 // } // } ``` -------------------------------- ### Initialize Honeycomb Edge Client (TypeScript) Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Initializes a singleton instance of the Honeycomb Protocol edge client. It uses a provided configuration and a boolean flag for initialization. The client is initialized only once to ensure efficiency. It's used within API routes to interact with character data. ```typescript // lib/edge-client.ts import createEdgeClient from '@honeycomb-protocol/edge-client'; import { EDGE_CLIENT } from '@/config/config'; let edgeClientInstance = null; export function getEdgeClient() { if (!edgeClientInstance || Object.keys(edgeClientInstance).length === 0) { edgeClientInstance = createEdgeClient(EDGE_CLIENT, true); console.log('Edge Client initialized in backend'); } return edgeClientInstance; } // Usage in API routes import { getEdgeClient } from '@/lib/edge-client'; const edgeClient = getEdgeClient(); const { character } = await edgeClient.findCharacters({ wallets: ['DxT7...wallet_address'], trees: ['tree_address'] }); ``` -------------------------------- ### Transaction Signing Helper Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt A utility function designed to sign and send multiple Solana transactions efficiently, including error handling. ```APIDOC ## Transaction Signing Helper ### Description This utility function `sendTransactions` is responsible for signing a batch of transactions using a provided signer (if any) and then broadcasting them to the network using the Honeycomb Protocol's edge client. It also includes confirmation logic. ### Usage Example ```typescript // Assuming txResponse is an array of transaction objects const adminKeypair = Keypair.fromSecretKey(Uint8Array.from(JSON.parse(process.env.ADMIN_KEYPAIR))); const result = await sendTransactions('minting resource', [txResponse], adminKeypair); ``` ### Parameters for `sendTransactions` - **action** (string) - A descriptive string for logging purposes (e.g., 'minting resource'). - **txResponses** (Transaction[]) - An array of transaction objects to be signed and sent. - **signer** (Keypair) - Optional. The Keypair used to sign the transactions. If not provided, transactions are sent unsigned (if allowed by the network). ### Error Handling - The function includes a try-catch block to log and re-throw any errors during the signing or sending process. - It specifically checks for the presence of a valid transaction signature in the response. ``` -------------------------------- ### Sign and Send Transactions (TypeScript) Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt A utility function to sign and send multiple Solana transactions. It handles base58 decoding and encoding, signs transactions using a provided Keypair, and utilizes the Honeycomb edge client for sending them in bulk. It includes error handling and confirmation logic. Dependencies include 'bs58' and '@solana/web3.js'. ```typescript // From pages/api/update-trait.ts import base58 from 'bs58'; import { Keypair, VersionedTransaction } from '@solana/web3.js'; import { getEdgeClient } from '@/lib/edge-client'; import { connection } from '@/config/config'; const sendTransactions = async (action: string, txResponses: Transaction[], signer: Keypair) => { try { const signedTxs = txResponses.map((tx) => { const serializedTx = VersionedTransaction.deserialize(base58.decode(tx.transaction)); signer && serializedTx.sign([signer]); return serializedTx; }); const edgeClient = getEdgeClient(); const { sendBulkTransactions } = await edgeClient.sendBulkTransactions({ txs: signedTxs.map((tx) => base58.encode(tx.serialize())), blockhash: txResponses[0].blockhash, lastValidBlockHeight: txResponses[0].lastValidBlockHeight, options: { skipPreflight: true } }); if (!sendBulkTransactions[0]?.signature) { throw new Error('No valid transaction signature found'); } await connection.confirmTransaction(sendBulkTransactions[0].signature, 'confirmed'); return sendBulkTransactions; } catch (e) { console.error(action, e); throw e; } }; // Usage const adminKeypair = Keypair.fromSecretKey(Uint8Array.from(JSON.parse(process.env.ADMIN_KEYPAIR))); const result = await sendTransactions('minting resource', [txResponse], adminKeypair); ``` -------------------------------- ### Calculate Level from Experience (API) Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Calculates a character's level based on their experience points. This API endpoint requires the 'exp' query parameter and returns the character's current level, experience, and the experience required for the next level. It uses the fetch API for the request. ```typescript // GET /api/get-level?exp=5000 const response = await fetch('/api/get-level?exp=5000'); const data = await response.json(); // Returns: // { // result: { // level: 21, // current_exp: 5000, // exp_req: 5600 // } // } ``` -------------------------------- ### Update Character Trait (API) Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Updates a character's trait by burning the new trait NFT and minting the old one back. This POST request requires a JSON body containing the wallet address, the new trait resource address, and the trait tag. It returns signatures for the burn, mint, and update operations. ```typescript // POST /api/update-trait const response = await fetch('/api/update-trait', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ wallet: 'DxT7...wallet_address', resource: '5trait...new_trait_address', tag: 'Fur' }) }); const data = await response.json(); // Returns: // { // result: { // burn: [{ signature: 'sig1...', status: 'confirmed' }], // mint: [{ signature: 'sig2...', status: 'confirmed' }], // update: [{ signature: 'sig3...', status: 'confirmed' }] // } // } ``` -------------------------------- ### POST /api/update-trait Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt Updates a character's trait attribute by burning a new trait NFT and minting the old one back. ```APIDOC ## POST /api/update-trait ### Description Updates a character's trait attribute by burning the new trait NFT and minting the old one back. ### Method POST ### Endpoint /api/update-trait ### Parameters #### Request Body - **wallet** (string) - Required - The wallet address of the character. - **resource** (string) - Required - The address of the new trait NFT to be applied. - **tag** (string) - Required - The trait tag (e.g., 'Fur'). ### Request Example ```json { "wallet": "DxT7...wallet_address", "resource": "5trait...new_trait_address", "tag": "Fur" } ``` ### Response #### Success Response (200) - **result** (object) - Contains transaction details. - **burn** (array) - An array of objects detailing the burn transaction. - **signature** (string) - The transaction signature. - **status** (string) - The transaction status. - **mint** (array) - An array of objects detailing the mint transaction. - **signature** (string) - The transaction signature. - **status** (string) - The transaction status. - **update** (array) - An array of objects detailing the update transaction. - **signature** (string) - The transaction signature. - **status** (string) - The transaction status. #### Response Example ```json { "result": { "burn": [{ "signature": "sig1...", "status": "confirmed" }], "mint": [{ "signature": "sig2...", "status": "confirmed" }], "update": [{ "signature": "sig3...", "status": "confirmed" }] } } ``` ``` -------------------------------- ### React Logout Hook with Redux (TypeScript) Source: https://context7.com/honeycomb-protocol/mining_badger/llms.txt A custom React hook named `useHoneycomb` that provides a `logout` function. This function dispatches a logout action using Redux's `useAppDispatch`. It's designed for use within React components to manage user sessions. Dependencies include React and Redux store utilities. ```typescript // hooks/useHoneycomb.tsx import React from 'react'; import { useAppDispatch } from '../store'; import { inventory as InventoryActions } from '../store/actions'; export function useHoneycomb() { const dispatch = useAppDispatch(); const logout = React.useCallback(async () => { await dispatch(InventoryActions.logout()); }, [dispatch]); return { logout }; } // Usage in components import { useHoneycomb } from '@/hooks'; function HeaderComponent() { const { logout } = useHoneycomb(); const handleLogout = async () => { await logout(); // Clear wallet and redirect }; return ; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.