Skip to content

glyphWalletConnector function

The glyphWalletConnector is a wagmi connector implementation that enables integration with the Glyph Global Wallet. It's designed to work seamlessly with wagmi and provides a standardized way to connect to the Glyph wallet.

Overview

The glyphWalletConnector is built on top of the Privy wallet connector and provides additional functionality specific to Glyph. It implements the EIP-1193 standard and supports all standard Ethereum JSON-RPC methods.

Usage

In v2.x, chains are configured dynamically. Use useGlyphConfigureDynamicChains to fetch supported chains before creating your wagmi config:

typescript
import { glyphWalletConnector, useGlyphConfigureDynamicChains } from "@use-glyph/sdk-react";
import { createConfig, http } from "wagmi";
import { Transport } from "viem";
import { useMemo } from "react";

function useWagmiConfig() {
	const { chains } = useGlyphConfigureDynamicChains();

	return useMemo(() => {
		if (!chains || chains.length === 0) return null;
		return createConfig({
			chains,
			transports: chains.reduce(
				(acc, chain) => {
					acc[chain.id] = http();
					return acc;
				},
				{} as Record<number, Transport>
			),
			connectors: [glyphWalletConnector()],
			ssr: true,
		});
	}, [chains]);
}

TIP

For most use cases, prefer GlyphWalletProvider — it configures the connector and chains automatically. Use glyphWalletConnector directly only when building a custom provider stack (e.g. with ConnectKit or RainbowKit).

Configuration Options

The connector accepts an optional configuration object:

typescript
glyphWalletConnector({
	useStagingTenant?: boolean;  // Use staging Glyph tenant instead of production
	rkDetails?: WalletDetailsParams;  // RainbowKit connector details (when used with RainbowKit)
});

Integration with GlyphWalletProvider

When using GlyphWalletProvider, the connector is configured automatically. You do not need to pass chains or transports in v2.x:

typescript
import { GlyphWalletProvider } from "@use-glyph/sdk-react";

function App() {
	return (
		<GlyphWalletProvider>
			{/* Your application components */}
		</GlyphWalletProvider>
	);
}

Features

  • Implements EIP-1193 standard
  • Supports all standard Ethereum JSON-RPC methods
  • Integrates with wagmi for seamless wallet connection
  • Supports SSR (Server-Side Rendering)
  • Built on top of Privy's wallet connector for enhanced security