Skip to content

Glyph Types Documentation

This document provides a comprehensive overview of all types defined in the Glyph library package.

Core Types

StrategyType

typescript
export enum StrategyType {
	PRIVY = "privy",
	EIP1193 = "eip1193",
}

An enum defining the available authentication strategies:

  • PRIVY: Uses Privy for authentication
  • EIP1193: Uses EIP-1193 compatible wallets for authentication

GlyphView

typescript
export enum GlyphView {
	CLOSED = "closed",
	OPEN = "open",
	MAIN = "main",
	FUND = "fund",
	SEND = "send",
	RECEIVE = "receive",
	PROFILE = "profile",
	HOME = "home",
	ACTIVITY = "activity",
	TOKENS = "tokens",
	NFTS = "nfts",
	SWAP = "swap",
	LINKED_ACCOUNTS = "linked-accounts",
}

An enum defining the available views of the Glyph widget.

Learn more about the views in the useGlyphView section.

WalletClientType

typescript
export enum WalletClientType {
	RAINBOWKIT = "rainbowkit",
	CONNECTKIT = "connectkit",
	THIRDWEB = "thirdweb",
	WAGMI = "wagmi",
	DYNAMIC = "dynamic",
}

An enum defining the available wallet client types.

Learn more about the usage of the wallet client types in the GlyphProvider section.

GlyphInterface

typescript
export interface GlyphInterface {
	ready: boolean;
	authenticated: boolean;
	hideWidget?: boolean;
	user: GlyphWidgetUser | null;
	balances: GlyphWidgetBalances | null;
	nativeSymbol: string;
	hasBalances: boolean;
	isBalancesLoading: boolean;
	fetchForAllNetworks: boolean;
	setFetchForAllNetworks: (value: boolean) => void;
	signMessage: (params: { message: string }) => Promise<string>;
	signTypedData: (params: { data: SignTypedDataParams }) => Promise<string>;
	sendTransaction: (params: {
		transaction: UnsignedTransactionRequest;
	}) => Promise<string>;
	login: () => void;
	logout: () => void;
	glyphUrl: string;
}

The core interface for Glyph functionality, providing access to:

  • Authentication state
  • User data
  • Wallet balances and multi-chain balance fetching
  • Transaction and message signing capabilities (including EIP-712 typed data)
  • Login/logout functionality

GlyphPrivyConfig

typescript
export type GlyphPrivyConfig = Omit<PrivyClientConfig, "supportedChains">;

Privy client configuration type used by GlyphPrivyProvider. The supportedChains property is omitted because chains are configured dynamically.

Data Types

GlyphWidgetUser

typescript
export type GlyphWidgetUser = {
	hasProfile: boolean;
	id: string;
	name: string;
	picture: string;
	evmWallet: string;
	smartWallet?: string;
	solanaWallet?: string;
	linkedWallets?: {
		address: string;
		walletClientType?: string;
	}[];
	isVerified: boolean;
	currency: string;
	usd2CurrencyRate: number;
	minFundingAmount: number;
	maxFundingAmount: number;
	country: string;
	subdivision?: string;
	cb_chain: string;
	cb_token: string;
	hasGoogle?: boolean;
	hasApple?: boolean;
	hasEmail?: boolean;
	hasTwitter?: boolean;
	isOnrampEnabled?: boolean;
	blockExplorerUrl?: string;
} | null;

Type representing a Glyph user's data.

GlyphWidgetTokenBalancesItem

typescript
export type GlyphWidgetTokenBalancesItem = {
	chainId: number;
	name: string;
	symbol: string;
	value: string;
	logo: string | null;
	valueInWei: string;
	amount: string;
	currency: string;
	native: boolean;
	hide?: boolean;
	address: Hex;
	rateInCurrency: string;
	decimals: number;
	displayDecimals: number;
	priceChangePct: number;
};

Type representing a token balance item.

GlyphWidgetNFTBalancesItem

typescript
export type GlyphWidgetNFTBalancesItem = {
	address: Hex;
	name: string;
	symbol: string;
	image: string | null;
	contractImage: string | null;
	items: {
		tokenId: string;
		symbol: string;
		name: string;
		tokenName: string;
		tokenImage: string;
		balance: string;
		owner: string;
		fromLinked: boolean;
		fromDelegated: boolean;
		image?: { cachedUrl: string; thumbnailUrl: string; pngUrl: string; contentType: string; size: number; originalUrl: string };
	}[];
};

Type representing an NFT collection balance item. The items array contains individual NFT tokens within the collection.

GlyphWidgetBalances

typescript
export type GlyphWidgetBalances = {
	tokens: GlyphWidgetTokenBalancesItem[];
	nfts: GlyphWidgetNFTBalancesItem[];
	wallet_value: {
		currency: string;
		nfts: number;
		tokens: number;
		total: number;
	};
};

Type representing the user's balances. The wallet_value field provides aggregate values (tokens, NFTs, and total) in the user's currency.

GlyphWidgetButtonProps

typescript
export type GlyphWidgetButtonProps = {
	hide?: boolean;
	showAvatar?: boolean;
	showBalance?: boolean;
	showUsername?: boolean;
};

Type for the Glyph Widget button. Set hide to true to hide the default widget toggle button.

GlyphWidgetProps

typescript
export type GlyphWidgetProps = {
	buttonProps?: GlyphWidgetButtonProps;
	minWidth?: number;
	alwaysOpen?: boolean;
};

Type for GlyphWidget component props. See GlyphWidget for full documentation.

FundQuoteDTO

typescript
export type FundQuoteDTO = {
	id: string;
	in_amount: number;
	estimated_fees_amount: number;
	currency: string;
	out_tokens_amount: number;
	ape_to_currency: number;
	deposit_address: string;
	refresh_in_seconds: number;
	error?: string;
};

Type representing a funding quote from the Glyph API.

FundQuoteStatus

typescript
export type FundQuoteStatus = FundQuoteStatusOk | FundQuoteStatusError;

type FundQuoteStatusOk = {
	ok: true;
	status: FUND_STATUS_API;
	details: string;
};

type FundQuoteStatusError = {
	ok: false;
	status: null;
	details?: string;
};

Type representing the status of a funding quote.