-
Notifications
You must be signed in to change notification settings - Fork 29
Closed
Description
Summary
The useSplToken example in packages/react-hooks/README.md only documents 4 of 14 return values. Critical properties for error handling, transaction verification, and state management are missing.
Currently documented:
balance,send,isSending,owner
Missing from documentation:
Priority 1 — Critical for production apps:
error— Error from balance fetchingsendError— Error from transfer attemptstatus— Overall hook status ('disconnected' | 'error' | 'loading' | 'ready')sendStatus— Transfer status ('idle' | 'loading' | 'success' | 'error')sendSignature— Transaction signature after successful transfer (needed for Explorer links)
Priority 2 — Quality of life:
refresh()— Manually refresh balancerefreshing— True while refreshingresetSend()— Clear error state after failed attempthelper— Low-level helper for advanced useisFetching— True while loading balance
Also undocumented:
UseSplTokenOptions— Optional second parameter withcommitment,owner,revalidateOnFocus, etc.
Motivation
- Without
error/sendError, developers can't show error messages — transfers fail silently. - Without
sendSignature, developers can't link to Solana Explorer — users have no way to verify transactions. - Without
status/sendStatus, developers can't show proper loading/success UI states. - These gaps cause production apps to feel broken or untrustworthy, especially for a library approaching 1.0.
Scope / constraints
Documentation-only change to packages/react-hooks/README.md. No code changes required.
Suggested approach:
- Expand the
useSplTokenexample to show error handling - Add a table listing all return values
- Document the optional second parameter (
UseSplTokenOptions)
Additional context
Source code reference: packages/react-hooks/src/hooks.ts lines 477-607
The return type definition shows all 14 properties, but the README example only uses 4.
Metadata
Metadata
Assignees
Labels
No labels