Skip to content
wyllet
  • Docs
  • Features
  • Playground
  • Blog
  • Docs
  • Features
  • Playground
  • Blog
  • Compare
  • Changelog
GitHub @wylletdevnpm Support
esc
  • IntroductionWhat Wyllet is, what it includes, and how it fits into a wagmi + viem dApp.
  • InstallationInstall Wyllet and its peer dependencies, and enable WalletConnect.
  • Quick startAdd a working connect button to a React dApp in a few minutes.
  • Next.jsUse Wyllet with the Next.js App Router, server components and SSR.
  • Build with AI assistantsGive Cursor, Claude Code, Copilot or ChatGPT the Wyllet docs and the rules for a correct integration.
  • ConfigurationCreate a wagmi config with getDefaultConfig: app info, chains, transports and wallets.
  • WylletProviderEvery WylletProvider prop: theme, appearance, tokens, auth, messages and callbacks.
  • WylletButtonThe Island button, its display options, and building your own trigger with useWylletButton.
Overview

Getting started

  • Introduction
  • Installation
  • Quick start
  • Next.js
  • Build with AI assistants

Core concepts

  • Configuration
  • WylletProvider
  • WylletButton
  • Presentations

Customization

  • Theming
  • Class names
  • Translations

Wallets

  • Wallets
  • All wallets
  • WalletConnect

Chains and tokens

  • Chains
  • Tokens

Features

  • Account panel
  • Activity and transactions
  • Toasts
  • Sign-In With Ethereum
  • ConnectGate

Reference

  • Hooks
  • Components
  • Utilities and types

Guides

  • Security
  • Migrate from RainbowKit
  • FAQ
wyllet

The open-source wallet connector for React dApps. Built on wagmi and viem.

MIT licensed. v1.1.0 on npm with provenance.

Product

  • Features
  • Compare
  • Playground
  • Changelog
  • Blog

Docs

  • Quick start
  • Next.js
  • Build with AI
  • Theming
  • Migrate from RainbowKit

Community

  • GitHub
  • X @wylletdev
  • npm
  • Releases
  • Report an issue

Support

  • support@wyllet.dev
  • FAQ
  • Security
  • Report a vulnerability
  • MIT License

For AI agents

  • llms.txt
  • llms-full.txt
  • RSS feed
  • Sitemap

Wallet, network and token names and logos are trademarks of their respective owners and are used only to identify them.

Docs/Reference

Utilities and types

Helper functions and the TypeScript types Wyllet exports.

View .mdReport a problem

Besides components and hooks, Wyllet exports helper functions for configuration, chains, tokens, theming, translations and formatting, plus the TypeScript types behind every public API. Everything on this page is a named export of wyllet.

Configuration

getDefaultConfig

Creates a wagmi config with EIP-6963 discovery, WalletConnect (when you pass a project id), your wallet list and app metadata. It is covered in Configuration.

import { getDefaultConfig } from 'wyllet'
import { base, mainnet } from 'viem/chains'
 
const config = getDefaultConfig({
  appName: 'My dApp',
  walletConnectProjectId: process.env.NEXT_PUBLIC_WC_PROJECT_ID,
  chains: [mainnet, base],
})

Chains

customChain

Defines any EVM chain in one call. The result is a regular viem Chain (built with viem's defineChain) that also carries Wyllet's icon metadata under chain.custom.wyllet.

function customChain(input: CustomChainInput): Chain
FieldTypeDefaultDescription
idnumberChain id.
namestringDisplay name.
rpcUrlstringHTTPS JSON-RPC endpoint.
nativeCurrency{ name, symbol, decimals }Ether, ETH, 18Native currency.
explorerUrlstringBlock explorer base URL. A trailing slash is removed.
testnetbooleanMarks the chain as a testnet (shown with a tag in the Networks tab).
iconstringChain logo URL or data URI.
colorstringBrand color for the generated monogram when there is no icon.
nativeIconstringIcon for the native currency in the Tokens tab.
const myChain = customChain({
  id: 424242,
  name: 'My Chain',
  rpcUrl: 'https://rpc.mychain.xyz',
  explorerUrl: 'https://scan.mychain.xyz',
  nativeCurrency: { name: 'My Token', symbol: 'MYT', decimals: 18 },
  icon: '/mychain.svg',
})

popularChains

A readonly array of viem chains with built-in icons: Ethereum, Base, OP, Arbitrum, Polygon, BNB Smart Chain, Avalanche, zkSync, Linea and Scroll, in that order.

popularTestnets

A readonly array of testnets: Sepolia, Base Sepolia, OP Sepolia, Arbitrum Sepolia and Polygon Amoy.

getDefaultConfig({
  appName: 'My dApp',
  chains: [...popularChains, ...popularTestnets],
})

See Chains for ordering and the Networks tab.

Tokens

defaultTokens

A TokenList of blue-chip tokens, used when tokens is 'default' (the provider's default):

ChainTokens
Ethereum (1)USDC, USDT, DAI, WETH, WBTC
Base (8453)USDC, WETH, DAI
OP (10)USDC, USDT, WETH, OP
Arbitrum (42161)USDC, USDT, WETH, ARB
Polygon (137)USDC, USDT, WETH

withDefaultTokens

function withDefaultTokens(custom: TokenList | TokenEntry[]): TokenList

Your tokens first, then defaultTokens for each chain, with duplicates (same address, case-insensitive) removed.

const tokens = withDefaultTokens([
  { chainId: 8453, address: '0x…', symbol: 'MYTKN', decimals: 18, pinned: true },
])
 
<WylletProvider tokens={tokens} />

toTokenList

function toTokenList(input: TokenList | TokenEntry[]): TokenList

Turns a flat TokenEntry[] (each entry has a chainId) into a TokenList keyed by chain id, keeping order. A TokenList is returned unchanged.

tokenIconUri

function tokenIconUri(symbol: string): string

Returns the icon TokenIcon uses for a symbol: built-in official artwork when bundled (matched as given, then upper-cased), otherwise a generated monogram as an SVG data URI. It never throws, including for emoji or markup in the symbol.

See Tokens for pinning, sorting and user token import.

Theming

Theme presets

Four presets, each a function that takes optional ThemeOptions and returns a Theme:

PresetLook
obsidianThemeDeep graphite with a mint accent. The default dark theme.
porcelainThemePaper white with ink-black actions. The default light theme.
auroraThemeTranslucent glass with a violet to cyan glow. Best over colorful backgrounds.
terminalThemeMonospace, sharp corners, phosphor green.

ThemeOptions:

OptionTypeDescription
accentColorstringBrand color for primary actions, focus and live indicators.
accentColorForegroundstringText color on top of the accent.
accentSecondarystringSecond brand color used in gradients.
radius'sharp' | 'soft' | 'round' | 'pill'Corner radius scale.
fontFamilystringBody font stack.
overlayBlur'none' | 'subtle' | 'heavy'Blur behind the panel overlay.
overridesDeepPartial<Theme>Deep-merged after the options above.
<WylletProvider theme={obsidianTheme({ accentColor: '#C6F432', radius: 'soft' })} />

createTheme

function createTheme(base: Theme, overrides?: DeepPartial<Theme>): Theme

Deep-merges overrides into base without mutating either.

const brand = createTheme(porcelainTheme(), {
  colors: { accent: '#5B3DF5', islandBackground: '#F7F5FF' },
  radii: { button: '999px' },
})

themeToCssVars

function themeToCssVars(theme: Theme): Record<string, string>

Flattens a theme into the CSS custom properties Wyllet uses, named --wy-<group>-<token> in kebab case. For example colors.accentForeground becomes --wy-colors-accent-foreground and radii.panel becomes --wy-radii-panel. Useful for styling your own UI to match. See Theming.

Translations

en

The English strings object. Every user-facing string Wyllet renders is a key in en. Pass a partial object to the provider's messages prop to rename or translate. Placeholders such as {name} are filled in at render time.

import { en } from 'wyllet'
 
<WylletProvider messages={{ connect: 'Conectar', connectTo: 'Conectar a {app}' }} />

See Translations.

Formatting

formatAmount

function formatAmount(value: bigint, decimals: number, maxSignificant?: number): string

Formats a raw token amount for display. maxSignificant defaults to 4.

Raw value (18 decimals)Output
00
0.00001<0.0001
0.12345670.1235
1.51.5
12.345612.35
1234512.3K
25000002.5M

Values of a billion or more use a B suffix. Invalid decimals (not an integer from 0 to 77) fall back to 18.

shortenAddress

function shortenAddress(address: string, chars?: number): string

Keeps chars characters (default 4) on each side: 0x1234567890abcdef1234567890abcdef12345678 becomes 0x1234…5678. Strings already short enough are returned unchanged.

Wallets

The wallet presets (metaMaskWallet, phantomWallet, rabbyWallet, okxWallet, walletConnectWallet, coinbaseWallet, rainbowWallet, trustWallet, browserWallet, burnerWallet) and defaultWallets are covered in Wallets.

burner

function burner(options?: BurnerOptions): CreateConnectorFn

The wagmi connector behind burnerWallet(): an in-browser wallet whose private key is generated and kept unencrypted in localStorage (key wyllet.v1.burner.key unless you pass storageKey). Non-signing RPC calls go to the chain's transport from your config. Use it only for local development and demos. It logs a console warning the first time it connects on a host that is not local (localhost, 127.0.0.1, [::1], 0.0.0.0, or a .local, .localhost or .test domain).

import { createConfig, http } from 'wagmi'
import { sepolia } from 'viem/chains'
import { burner } from 'wyllet'
 
const config = createConfig({
  chains: [sepolia],
  transports: { [sepolia.id]: http() },
  connectors: [burner()],
})
Warning

Never hold real funds in a burner wallet. Anyone with access to the browser's storage, including any script running on the page, can read the key.

Types

All types are exported from wyllet and can be imported with import type.

import type { Theme, Wallet, WylletAuthAdapter } from 'wyllet'

Provider and configuration

TypeDescription
WylletProviderPropsProps of WylletProvider.
DefaultConfigParametersParameters of getDefaultConfig.
AppInfoApp metadata: name, description, url, icon, learnMoreUrl, termsUrl, privacyUrl.
AppearanceThe provider's appearance prop.
Presentation'drawer' | 'popover' | 'modal'.
PanelView'connect' | 'account'.
AccountTab'tokens' | 'activity' | 'networks'.
OpenOptionsanchor and tab options for opening the panel.
WylletSlotElements that accept classNames: 'overlay' | 'panel' | 'island' | 'walletRow' | 'primaryButton' | 'identityCard' | 'toast'.
CustomAvatarPropsProps passed to a custom avatar component: address, ensImage, size.

Components and hooks

TypeDescription
WylletButtonPropsProps of WylletButton.
WylletButtonStateReturn type of useWylletButton.
ConnectGatePropsProps of ConnectGate.
GateReason'disconnected' | 'wrongNetwork' | 'unauthenticated'.
AvatarPropsProps of Avatar.
ChainIconPropsProps of ChainIcon.
TokenIconPropsProps of TokenIcon.
QRCodePropsProps of QRCode.
ListedTokenToken plus custom?: boolean for user-imported tokens.
WalletOptionOne entry from useWalletOptions.
WalletGroupA group from useWalletOptions: id ('installed' | 'popular' | 'more') and wallets.

Theming

TypeDescription
ThemeEvery design token, in five groups: colors, radii, fonts, shadows, effects.
ThemeInputA Theme, or a { light, dark } pair.
ThemeOptionsOptions accepted by the presets.
ColorMode'light' | 'dark' | 'auto'.
RadiusScale'sharp' | 'soft' | 'round' | 'pill'.
BlurScale'none' | 'subtle' | 'heavy'.
DeepPartialRecursive Partial, used for theme overrides.

Wallets

TypeDescription
WalletA wallet in the connect view: id, name, icon, and optional iconBackground, rdns, connectorId, createConnector, walletConnect, downloadUrls, description, featured.
WalletDownloadUrlsbrowserExtension, ios, android, website.
WalletPresetOptionsOptions for every preset: connector and overrides.
BurnerOptionsOptions for burner and burnerWallet: storageKey.

Chains and tokens

TypeDescription
CustomChainInputInput of customChain.
ChainExtrasWyllet's chain metadata: icon, color, nativeIcon.
Tokenaddress, symbol, decimals, and optional name, icon, pinned.
TokenEntryToken plus chainId, for flat lists.
TokenListTokens keyed by chain id.

Auth

TypeDescription
WylletAuthAdapterThe auth adapter: getNonce, verify, signOut, and optional createMessage, getSession, statement.
AuthStatus'loading' | 'unauthenticated' | 'authenticated'.

Toasts and activity

TypeDescription
ToastApiReturn type of useWylletToast.
ToastOptionsOptions for a toast.
ToastA toast in the store: ToastOptions plus id, status, createdAt, dismissed.
ToastStatus'info' | 'success' | 'error' | 'loading'.
ToastPosition'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'.
ActivityItemOne timeline entry: id, kind, title, description, status, account, chainId, hash, timestamp.
ActivityKind'transaction' | 'connect' | 'disconnect' | 'network' | 'signIn' | 'custom'.
ActivityStatus'pending' | 'success' | 'failed' | 'info'.

Translations

TypeDescription
MessagesThe shape of en: every string key Wyllet uses.
PreviousComponentsNextSecurity

On this page

  • Configuration
  • getDefaultConfig
  • Chains
  • customChain
  • popularChains
  • popularTestnets
  • Tokens
  • defaultTokens
  • withDefaultTokens
  • toTokenList
  • tokenIconUri
  • Theming
  • Theme presets
  • createTheme
  • themeToCssVars
  • Translations
  • en
  • Formatting
  • formatAmount
  • shortenAddress
  • Wallets
  • burner
  • Types
  • Provider and configuration
  • Components and hooks
  • Theming
  • Wallets
  • Chains and tokens
  • Auth
  • Toasts and activity
  • Translations