Hooks
The Glyph Widget library provides several hooks to access user data, manage balances, and interact with the widget functionality. All hooks must be used within a GlyphProvider.
Available Hooks
tsx
import {
useGlyph,
useBalances,
useGlyphFunding,
useActivity,
useNativeGlyphConnection,
} from "@use-glyph/sdk-react";Core Hooks
useGlyph - Access the Glyph context and core functionality
useNativeGlyphConnection - Connect and disconnect using the Glyph Wallet connector directly. See Native Integration for more information.
useGlyphView - Open a certain view of the widget
Balance Hooks
- useBalances - Fetch and manage token balances
Funding Hooks
- useGlyphFunding - Handle on/off ramp and funding operations
Activity Hooks
- useActivity - Fetch and manage transaction activity with optional type filtering
Provider Requirement
All hooks must be used within a GlyphProvider. Using them outside will throw an error.
tsx
import { GlyphProvider } from "@use-glyph/sdk-react";
function App() {
return (
<GlyphProvider>
{/* Components using hooks can be used here */}
<YourComponent />
</GlyphProvider>
);
}Next Steps
- Explore each hook's documentation for detailed usage information, parameters, and return types.
