Skip to content

useNativeGlyphConnection

The useNativeGlyphConnection hook provides functions to connect and disconnect using the Glyph Wallet connector directly (for Native Integration)

Import

tsx
import { useNativeGlyphConnection } from "@use-glyph/sdk-react";

Usage

Use this hook to initiate a connection with the Glyph Wallet and optionally trigger the Glyph Widget's authentication flow after connection. Set askForSignature to true in the respective provider's config. For example, if you're following the Native Integration guide, you'll need to set askForSignature to true in the GlyphWalletProvider component.

tsx
import { useNativeGlyphConnection } from "@use-glyph/sdk-react";

function NativeConnect() {
	const { connect, disconnect } = useNativeGlyphConnection(true);

	return (
		<div>
			<button onClick={connect}>Connect with Glyph</button>
			<button onClick={disconnect}>Logout</button>
		</div>
	);
}

Return Type

PropertyTypeDescription
connect() => Promise<void>Initiates the connection process with the Glyph Wallet connector
disconnect() => voidLogs the user out by calling the logout function from the useGlyph context