npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@buildeross/hooks

v0.2.2

Published

Shared React hooks for BuilderOSS apps

Readme

@buildeross/hooks

Collection of reusable React hooks for BuilderOSS applications, providing blockchain interactions, UI utilities, and data management.

Installation

pnpm install @buildeross/hooks

Features

  • Blockchain Hooks: DAO auctions, governance, token interactions
  • UI Utilities: Countdown timers, scroll detection, pagination
  • Data Management: ENS resolution, NFT metadata, token balances
  • File Handling: IPFS artwork upload and preview
  • Type-Safe: Full TypeScript support with proper typing
  • Optimized: Built for performance with proper dependency management

Usage

Blockchain Hooks

useDaoAuction

Hook for fetching current DAO auction data.

import { useDaoAuction } from '@buildeross/hooks'

function AuctionComponent() {
  const auction = useDaoAuction({
    collectionAddress: '0x...',
    auctionAddress: '0x...',
    chainId: CHAIN_ID.ETHEREUM,
  })

  return (
    <div>
      <p>Current Bid: {auction.highestBid} ETH</p>
      <p>Token ID: {auction.tokenId?.toString()}</p>
      <p>Time Remaining: {auction.endTime}</p>
    </div>
  )
}

useVotes

Hook for checking user's voting power and delegation status.

import { useVotes } from '@buildeross/hooks'

function VotingPower() {
  const votes = useVotes({
    chainId: CHAIN_ID.ETHEREUM,
    collectionAddress: '0x...',
    governorAddress: '0x...',
    signerAddress: '0x...',
  })

  return (
    <div>
      <p>Votes: {votes.votes?.toString()}</p>
      <p>Can Propose: {votes.hasThreshold ? 'Yes' : 'No'}</p>
      <p>Delegating: {votes.isDelegating ? 'Yes' : 'No'}</p>
    </div>
  )
}

useDaoMembership

Hook for checking DAO membership and token ownership.

import { useDaoMembership } from '@buildeross/hooks'

function MembershipStatus() {
  const membership = useDaoMembership({
    chainId: CHAIN_ID.ETHEREUM,
    tokenAddress: '0x...',
    userAddress: '0x...',
  })

  return (
    <div>
      <p>Is Member: {membership.isMember ? 'Yes' : 'No'}</p>
      <p>Token Count: {membership.tokenCount}</p>
    </div>
  )
}

UI Utility Hooks

useCountdown

Hook for countdown timers with formatted display.

import { useCountdown, useIsMounted } from '@buildeross/hooks'

function CountdownTimer() {
  const isMounted = useIsMounted()
  const countdown = useCountdown(endTimestamp, () => console.log('Timer ended!'))

  if (!isMounted) return null

  return (
    <div>
      <p>{countdown.countdownString}</p>
      <p>Ended: {countdown.isEnded ? 'Yes' : 'No'}</p>
    </div>
  )
}

usePagination

Hook for handling pagination state and navigation.

import { usePagination } from '@buildeross/hooks'

function PaginatedList() {
  const pagination = usePagination({
    totalItems: 100,
    itemsPerPage: 10,
  })

  return (
    <div>
      <button onClick={pagination.previousPage}>Previous</button>
      <span>
        Page {pagination.currentPage} of {pagination.totalPages}
      </span>
      <button onClick={pagination.nextPage}>Next</button>
    </div>
  )
}

useScrollDirection

Hook for detecting scroll direction.

import { useScrollDirection } from '@buildeross/hooks'

function NavigationBar() {
  const scrollDirection = useScrollDirection()

  return (
    <nav
      style={{
        transform: scrollDirection === 'down' ? 'translateY(-100%)' : 'translateY(0)',
      }}
    >
      Navigation content
    </nav>
  )
}

Data Hooks

useEnsData

Hook for resolving ENS names and avatars.

import { useEnsData } from '@buildeross/hooks'

function UserProfile({ address }) {
  const ens = useEnsData(address)

  return (
    <div>
      <img src={ens.avatar} alt="Avatar" />
      <p>{ens.name || address}</p>
    </div>
  )
}

useTokenMetadata

Hook for fetching token metadata.

import { useTokenMetadata } from '@buildeross/hooks'

function TokenInfo() {
  const metadata = useTokenMetadata({
    contractAddress: '0x...',
    tokenId: '1',
    chainId: CHAIN_ID.ETHEREUM,
  })

  return (
    <div>
      <h3>{metadata.name}</h3>
      <p>{metadata.description}</p>
      <img src={metadata.image} alt={metadata.name} />
    </div>
  )
}

useNFTBalance

Hook for checking NFT balance of an address.

import { useNFTBalance } from '@buildeross/hooks'

function NFTBalance() {
  const balance = useNFTBalance({
    address: '0x...',
    contractAddress: '0x...',
    chainId: CHAIN_ID.ETHEREUM,
  })

  return <p>NFT Balance: {balance.toString()}</p>
}

File Handling Hooks

useArtworkUpload

Hook for uploading artwork to IPFS.

import { useArtworkUpload } from '@buildeross/hooks'

function ArtworkUploader() {
  const { upload, isUploading, error } = useArtworkUpload()

  const handleUpload = async (file: File) => {
    const result = await upload(file)
    console.log('IPFS Hash:', result.hash)
  }

  return (
    <div>
      <input type="file" onChange={(e) => handleUpload(e.target.files[0])} />
      {isUploading && <p>Uploading...</p>}
      {error && <p>Error: {error}</p>}
    </div>
  )
}

useArtworkPreview

Hook for generating artwork previews.

import { useArtworkPreview } from '@buildeross/hooks'

function ArtworkPreview({ file }) {
  const preview = useArtworkPreview(file)

  return preview ? <img src={preview} alt="Preview" /> : null
}

Utility Hooks

useInterval

Hook for setting up intervals with automatic cleanup.

import { useInterval } from '@buildeross/hooks'

function Timer() {
  const [count, setCount] = useState(0)

  useInterval(() => {
    setCount((c) => c + 1)
  }, 1000)

  return <p>Count: {count}</p>
}

useTimeout

Hook for setting up timeouts with automatic cleanup.

import { useTimeout } from '@buildeross/hooks'

function DelayedMessage() {
  const [show, setShow] = useState(false)

  useTimeout(() => {
    setShow(true)
  }, 3000)

  return show ? <p>Hello after 3 seconds!</p> : null
}

useIsMounted

Hook for preventing hydration mismatches.

import { useIsMounted } from '@buildeross/hooks'

function ClientOnlyComponent() {
  const isMounted = useIsMounted()

  if (!isMounted) return null

  return <div>This only renders on client</div>
}

usePrevious

Hook for accessing previous values.

import { usePrevious } from '@buildeross/hooks'

function ValueTracker({ value }) {
  const previousValue = usePrevious(value)

  return (
    <div>
      <p>Current: {value}</p>
      <p>Previous: {previousValue}</p>
    </div>
  )
}

Development

Prerequisites

  • Node.js 18+
  • pnpm 8+

Setup

# Install dependencies
pnpm install

# Build the package
pnpm build

# Development build with watch
pnpm dev

# Run type checking
pnpm type-check

# Run linting
pnpm lint

Scripts

  • pnpm build - Build the package for production
  • pnpm dev - Build in watch mode for development
  • pnpm type-check - Run TypeScript type checking
  • pnpm lint - Run ESLint with auto-fix
  • pnpm clean - Remove build artifacts

Dependencies

Dependencies

  • @buildeross/ipfs-service - IPFS utilities
  • @buildeross/constants - Shared constants
  • @buildeross/sdk - Core SDK and contract ABIs
  • @buildeross/types - TypeScript types
  • @buildeross/utils - Utility functions
  • dayjs - Date manipulation

Peer Dependencies

  • react ^19.1.0
  • react-dom ^19.1.0
  • viem ^2.30.0
  • swr ^2.3.3
  • next ^15.3.2
  • wagmi ^2.15.4

Hook Categories

Blockchain Interaction

  • useDaoAuction - Current auction data
  • useDaoMembership - DAO membership status
  • useVotes - Voting power and delegation
  • useDelegate - Delegation management
  • useDelayedGovernance - Governance timing
  • useTokenBalances - Token balance queries
  • useIsContract - Contract detection
  • useIsGnosisSafe - Gnosis Safe detection

UI & UX

  • useCountdown - Countdown timers
  • usePagination - Pagination state
  • useScrollDirection - Scroll detection
  • useBridgeModal - Bridge modal management

Data & Metadata

  • useEnsData - ENS resolution
  • useTokenMetadata - Token metadata
  • useNftMetadata - NFT metadata
  • useNFTBalance - NFT balance checking
  • useDecodedTransactions - Transaction decoding

File Handling

  • useArtworkUpload - IPFS artwork upload
  • useArtworkPreview - Artwork preview generation

Utilities

  • useInterval - Interval management
  • useTimeout - Timeout management
  • useIsMounted - Mount detection
  • usePrevious - Previous value tracking

Type Safety

All hooks are fully typed with TypeScript and include proper return type definitions. Generic hooks accept type parameters for additional type safety.

Best Practices

  1. Always use useIsMounted() with useCountdown() to prevent hydration errors
  2. Handle loading states for blockchain hooks
  3. Provide fallbacks for undefined data
  4. Use proper error boundaries for hooks that can fail
  5. Cleanup intervals and timeouts automatically handled

License

MIT License - see LICENSE file for details.