Honeycomb

Hooks

Access the Hive blockchain connection, chain object, and account data through framework-specific hooks.

useHive()

Returns the full Hive context including the chain object, connection status, and endpoint information. This is the primary hook for accessing blockchain connectivity.

PropertyTypeDescription
chainIHiveChainInterface | nullHive chain instance for API calls
is_loadingbooleanTrue while connecting to blockchain
errorstring | nullError message if connection failed
is_clientbooleanTrue when running on client (SSR detection). Not available in Vue package.
api_endpointstring | nullCurrently active API endpoint URL
statusConnectionStatusConnection state: connecting | connected | reconnecting | disconnected | error
endpointsEndpointStatus[]Health status of all configured endpoints
refresh_endpoints() => Promise<void>Manually trigger endpoint health checks

Signal Getters

All values are signal getters — call them as functions (chain(), isLoading()) to access reactive values.

import { useHive } from "@hiveio/honeycomb-solid";

function StatusBar() {
  const {
    chain,
    is_loading,
    error,
    is_client,
    api_endpoint,
    status,
    endpoints,
    refresh_endpoints,
  } = useHive();

  // All values are signal getters - call them as functions
  return (
    <div>
      {is_loading() ? (
        <p>Connecting to Hive...</p>
      ) : error() ? (
        <p>Error: {error()}</p>
      ) : (
        <>
          <p>Status: {status()}</p>
          <p>Endpoint: {api_endpoint()}</p>
          <p>Healthy: {endpoints().filter((ep) => ep.healthy).length}</p>
          <button onClick={() => refresh_endpoints()}>
            Refresh Endpoints
          </button>
        </>
      )}
    </div>
  );
}

useHiveChain()

Returns the chain object directly. Use this when you only need the chain and want to keep destructuring minimal. The chain object provides access to all Hive blockchain APIs.

Chain API

The chain object is an IHiveChainInterface from @hiveio/wax. Use it to call blockchain APIs like chain.api.database_api.find_accounts() or chain.api.database_api.get_dynamic_global_properties().

import { useHiveChain } from "@hiveio/honeycomb-solid";

function AccountLookup(props: { username: string }) {
  // Returns a signal getter
  const chain = useHiveChain();

  async function fetch_account() {
    const c = chain();
    if (!c) return;

    const result = await c.api.database_api.find_accounts({
      accounts: [props.username],
    });
    // result.accounts[0] contains full account data
  }

  async function fetch_global_props() {
    const c = chain();
    if (!c) return;

    const global_props =
      await c.api.database_api.get_dynamic_global_properties({});
    // global_props.head_block_number, global_props.current_supply, etc.
  }

  return (
    <div>
      <button onClick={fetch_account}>Fetch Account</button>
      <button onClick={fetch_global_props}>Fetch Global Props</button>
    </div>
  );
}

useApiEndpoint()

Returns the currently active API endpoint URL. Returns null when not connected.

import { useApiEndpoint } from "@hiveio/honeycomb-solid";

function EndpointDisplay() {
  const endpoint = useApiEndpoint();
  // Signal getter - call as function
  return <p>Connected to: {endpoint() ?? "none"}</p>;
}

useHiveStatus()

Returns connection status and endpoint health information.

FieldTypeDescription
urlstringEndpoint URL
healthybooleanWhether the endpoint is responding
lastChecknumber | nullTimestamp of last health check
lastErrorstring | nullLast error message if unhealthy
import { useHiveStatus } from "@hiveio/honeycomb-solid";

function ConnectionMonitor() {
  // Returns a signal getter for { status, endpoints }
  const hive_status = useHiveStatus();

  return (
    <div>
      <p>Status: {hive_status().status}</p>
      <p>
        Healthy: {hive_status().endpoints.filter((ep) => ep.healthy).length}
        {" / "}
        {hive_status().endpoints.length}
      </p>
    </div>
  );
}

useHiveAccount(username)

Fetches account data from the Hive blockchain. Handles loading and error states automatically.

ParamTypeDescription
usernamestringHive account username to fetch
PropertyTypeDescription
accountHiveAccount | nullAccount data (name, balance, hbd_balance, post_count, etc.)
is_loadingbooleanTrue while fetching account data
errorError | nullError if fetch failed
refetch() => voidManually re-fetch account data

Signal Getters

All values are signal getters — call them as functions (account(), isLoading()) to access reactive values.

import { useHiveAccount } from "@hiveio/honeycomb-solid";

function UserProfile(props: { username: string }) {
  const { account, is_loading, error, refetch } = useHiveAccount(props.username);

  return (
    <div>
      {is_loading() ? (
        <p>Loading account...</p>
      ) : error() ? (
        <p>Error: {error()?.message}</p>
      ) : !account() ? (
        <p>Account not found</p>
      ) : (
        <>
          <h2>{account()?.name}</h2>
          <p>Balance: {account()?.balance}</p>
          <p>HBD: {account()?.hbd_balance}</p>
          <p>Posts: {account()?.post_count}</p>
          <p>Joined: {account()?.created}</p>
          <button onClick={refetch}>Refresh</button>
        </>
      )}
    </div>
  );
}
Hive ProviderTheming