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/Chains and tokens

Tokens

Token lists, withDefaultTokens, pinning, sorting and user token import.

View .mdReport a problem

The Tokens tab in the account panel shows the native balance of the connected chain, followed by the ERC-20 tokens you list for that chain. You define the list in code, so every user sees the same tokens in the same order.

The tokens prop

Set tokens on WylletProvider:

ValueResult
'default'Wyllet's blue-chip list (defaultTokens). This is the default
falseNative balance only
TokenEntry[]Only your tokens, as a flat list with chainId on each entry
TokenListOnly your tokens, as a map of chain ID to Token[]
<WylletProvider
  tokens={[
    { chainId: 8453, address: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', symbol: 'USDC', decimals: 6, pinned: true },
    { chainId: 8453, address: '0x4200000000000000000000000000000000000006', symbol: 'WETH', decimals: 18 },
  ]}
>
  {children}
</WylletProvider>

The same list as a TokenList:

const tokens: TokenList = {
  8453: [
    { address: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', symbol: 'USDC', decimals: 6, pinned: true },
    { address: '0x4200000000000000000000000000000000000006', symbol: 'WETH', decimals: 18 },
  ],
}

toTokenList() converts a flat TokenEntry[] into a TokenList if you need the map form.

Default tokens

defaultTokens covers five chains:

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

Other chains show only the native balance unless you list tokens for them.

Adding to the defaults

withDefaultTokens() puts your tokens first, then the default tokens for each chain, with duplicate addresses removed.

import { withDefaultTokens } from 'wyllet'
 
const tokens = withDefaultTokens([
  { chainId: 8453, address: '0x...', symbol: 'MYTKN', decimals: 18, icon: '/mytkn.svg', pinned: true },
  { chainId: 424242, address: '0x...', symbol: 'USDC', decimals: 6 },
])
 
<WylletProvider tokens={tokens}>{children}</WylletProvider>

It accepts a TokenEntry[] or a TokenList and returns a TokenList.

Token fields

FieldTypeDescription
addressAddressContract address
symbolstringSymbol shown in the list
decimalsnumberToken decimals, used to format balances
namestringOptional. Shown under the symbol
iconstringOptional. Image URL or data URI. Falls back to a built-in icon, then a monogram
pinnedbooleanOptional. Always show this token at the top, regardless of balance

A TokenEntry is a Token plus chainId: number.

Ordering

List order is the display order. pinned: true keeps a token at the top, and pinned tokens keep their list order among themselves. appearance.tokenSort decides the rest:

ValueOrder
'balance' (default)Pinned tokens, then tokens the user holds, then the rest. Each group stays in list order
'list'Pinned tokens, then every other token in exactly your list order

The native balance is always the first row. Tokens with a zero balance are dimmed.

Add to wallet

Every ERC-20 row has an Add to wallet button. It asks the connected wallet to track the token (wallet_watchAsset through wagmi), passing the address, symbol, decimals and your icon when one is set.

User token import

Set allowTokenImport to let each user add their own ERC-20s.

<WylletProvider allowTokenImport>{children}</WylletProvider>

The Tokens tab then shows an Import token button when the user is on a configured chain. The user pastes a contract address, and Wyllet reads the token's name, symbol, decimals and the user's balance onchain. A contract without a readable symbol and decimals is rejected, as is an address already in the list.

Imported tokens:

  • Are saved in the user's browser (localStorage), per chain. They are not sent anywhere.
  • Appear after your listed tokens with a Custom tag, and follow the same tokenSort rules.
  • Can be removed with the remove button on their row.
  • Only show while allowTokenImport is true.

useWylletTokens

Returns the token list for a chain: your configured tokens in list order, followed by the user's imported tokens. It defaults to the connected chain.

import { useWylletTokens } from 'wyllet'
 
const { tokens, importToken, removeToken, canImport } = useWylletTokens()
const onBase = useWylletTokens(8453)
FieldTypeDescription
tokensListedToken[]Configured tokens, then imported ones. Imported tokens have custom: true
importToken(token: Token, chainId?: number)Save a token for the user. Defaults to the hook's chain
removeToken(address: string, chainId?: number)Remove an imported token
canImportbooleanThe value of allowTokenImport

tokens is not sorted by balance. The Tokens tab applies tokenSort on top of it.

TokenIcon

Renders a token logo with an optional chain badge in the corner.

import { TokenIcon } from 'wyllet'
 
<TokenIcon symbol="USDC" chainId={8453} size={28} />
PropTypeDefaultDescription
symbolstringToken symbol. Picks the built-in icon and the alt text
srcstringCustom icon URL. If it fails to load, the built-in icon is used
chainIdnumberDraws a small ChainIcon badge for this chain
sizenumber32Width and height in pixels
classNamestringExtra class name

Built-in icons cover ETH, WETH, USDC, USDT, DAI, WBTC, LINK, UNI, OP, ARB, POL, MATIC and AVAX. Any other symbol, including BNB, gets a monogram. tokenIconUri(symbol) returns the same icon as a data URI.

PreviousChainsNextAccount panel

On this page

  • The tokens prop
  • Default tokens
  • Adding to the defaults
  • Token fields
  • Ordering
  • Add to wallet
  • User token import
  • useWylletTokens
  • TokenIcon