Skip to content

react: split out @sentriscloud/sdk-ts-react with hooks (useChainTip, useBalance, useSubscribe) #22

@satyakwok

Description

@satyakwok

Wrap the SDK's chain reads + subscriptions in idiomatic React hooks. Ship as a sibling package (@sentriscloud/sdk-ts-react) or sub-export so dApp builders don't have to write the useEffect/useState dance themselves.

Scope

  • useChainTip() — current height, auto-updating via newHeads subscription
  • useBlock(blockNumber | hash) — fetch + cache a block
  • useBalance(address) — native or ERC-20 balance, re-fetches on new block
  • useTransaction(hash) — tx + receipt
  • useSendTransaction() — write hook with wallet integration
  • Internal cache layer (React Query underneath, optional)

Why

Every dApp on Sentrix reimplements these. A canonical package = consistent UX + faster build time.

Out of scope

  • Wallet connector logic (WalletConnect / RainbowKit) — those have their own libraries; this package consumes their connection result
  • Storybook / docs site — separate effort

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions