Shared React components and hooks for Hedera and EVM-compatible dApps. This repo is intended for use with scaffold-hbar (Scaffold Hbar). See package READMEs for API details:
- packages/components – Address, Balance, HederaAddress, HederaAddressInput, HbarInput
- packages/hooks – useAddress, useHederaAccountId, useMirrorNodeAccount
- packages/debug-contracts – Contract debug UI, IntegerInput (×1e8 / ×1e18 multiplier), BytesInput, Bytes32Input
- packages/mcp-server – MCP server (stdio + HTTP) exposing docs, props, and examples for AI agents
The example app (example) demonstrates all of the above; run pnpm dev and open http://localhost:3000.
AI assistants: Project guidance is duplicated for different tools—.cursor/skills/ (Cursor), .claude/skills/ and .claude/agents/ (Claude Code), and .agents/ (same agent prompts for other runners). See .claude/README.md.
Typical flow (do all that apply):
- Implement in packages/components and/or packages/hooks — add the source file, export it from
src/index.ts, runpnpm lint/pnpm buildin that package. - Document in docs — add a page under
docs/pages/components/ordocs/pages/hooks/(MDX withlayout: docs). Register the page in the sidebar in docs/vocs.config.ts. If the doc needs an interactive demo, add a small component under docs/components/ and import it from the MDX (see existing examples such as docs/pages/components/HederaAddressInput.mdx). - Example app — add
example/app/components/examples/YourFeatureExample.tsx, export it from example/app/components/examples/index.ts, and render it from example/app/components/HomeContent.tsx. Runpnpm devand verify at http://localhost:3000.
If the feature belongs in the contract debugger, also wire exports and docs under packages/debug-contracts and docs/pages/debug-contracts/ as needed.
- Start the dev mode of the monorepo
pnpm devThis will start the dev mode of both the hooks and components packages, along with the example app.
-
Visit the example app at http://localhost:3000
-
Make changes to the packages and see them reflected in the example app
- Start the dev mode for both packages in the scaffold-hbar-ui directory:
# For hooks
cd packages/hooks && pnpm run dev &
# For components
cd packages/components && pnpm run dev &- Add both packages in scaffold-hbar inside the
packages/nextjs/package.jsonfile:
"@scaffold-hbar-ui/hooks": "file:../../../scaffold-hbar-ui/packages/hooks",
"@scaffold-hbar-ui/components": "file:../../../scaffold-hbar-ui/packages/components"Note: The relative paths use ../../../ because they are resolved from the packages/nextjs directory in scaffold-hbar’s workspace structure.
- Update the
webpacksection in thenext.config.jsornext.config.tsfile:
webpack: (config, { dev }) => {
config.resolve.fallback = { fs: false, net: false, tls: false };
config.externals.push("pino-pretty", "lokijs", "encoding");
if (dev) {
config.watchOptions = {
followSymlinks: true,
};
config.snapshot.managedPaths = [];
}
return config;
},- Add the css file in
packages/nextjs/app/layout.tsxfile for the components package:
import "@scaffold-hbar-ui/components/styles.css";- Install dependencies in scaffold-hbar:
yarn install- Run the scaffold-hbar app:
yarn chain # In one terminal
yarn start # In another terminal- Any changes in this repo will require running
yarn installin scaffold-hbar again.