Configuration
Create a wagmi config with getDefaultConfig: app info, chains, transports and wallets.
getDefaultConfig() creates the wagmi config for your app. It returns a standard wagmi Config that you pass to <WagmiProvider>, and it also registers your wallet list and app metadata so <WylletProvider> picks them up without extra props.
Basic usage
import { base, mainnet } from 'viem/chains'
import { getDefaultConfig } from 'wyllet'
export const config = getDefaultConfig({
appName: 'My dApp',
walletConnectProjectId: 'YOUR_PROJECT_ID',
chains: [mainnet, base],
})Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
appName | string | Required | Your dApp's name. Shown in the connect panel title and sent to wallets. |
appDescription | string | appName | Sent to wallets in the WalletConnect metadata. |
appUrl | string | window.location.origin | Your dApp's URL, sent to wallets. Set it explicitly when the config is evaluated on the server. |
appIcon | string | None | URL of a square icon shown inside wallets. |
walletConnectProjectId | string | None | Enables WalletConnect (QR codes, mobile wallets and the All wallets directory). Requires @walletconnect/ethereum-provider. |
chains | readonly [Chain, ...Chain[]] | Required | Supported networks in priority order. The first chain is the default. |
transports | Partial<Record<chainId, Transport>> | http() per chain | Transport per chain id. Chains you leave out use http(), which is the chain's public RPC. |
wallets | Wallet[] | defaultWallets() | Wallets shown in the connect panel, in order. |
connectors | CreateConnectorFn[] | [] | Extra wagmi connectors, appended as-is. |
Every other wagmi createConfig() parameter is passed through unchanged. The type is Omit<CreateConfigParameters, 'chains' | 'transports' | 'connectors'> plus the fields above, so options like ssr, storage, syncConnectedChain or pollingInterval work as they do in wagmi.
Chains
chains accepts any viem Chain. Mix chains from viem/chains, Wyllet's popularChains and popularTestnets presets, and your own chains built with customChain().
import { sepolia } from 'viem/chains'
import { getDefaultConfig, popularChains } from 'wyllet'
export const config = getDefaultConfig({
appName: 'My dApp',
chains: [...popularChains, sepolia],
})The order matters: the first chain is the default. To arrange the Networks tab differently, use the chainOrder prop on <WylletProvider>. See Chains.
Transports
By default each chain uses http() with no URL, which means the chain's public RPC endpoint. Public endpoints are rate-limited and are not meant for production traffic.
import { http } from 'wagmi'
import { base, mainnet } from 'viem/chains'
import { getDefaultConfig } from 'wyllet'
export const config = getDefaultConfig({
appName: 'My dApp',
chains: [mainnet, base],
transports: {
[mainnet.id]: http('https://eth-mainnet.example.com/v2/KEY'),
[base.id]: http('https://base-mainnet.example.com/v2/KEY'),
},
})transports is partial. Any chain without an entry falls back to http().
Wallets
wallets controls which wallets appear in the connect panel and in what order. It defaults to defaultWallets(): MetaMask, Phantom, Rabby, OKX Wallet and WalletConnect.
import { base, mainnet } from 'viem/chains'
import { burnerWallet, coinbaseWallet, defaultWallets, getDefaultConfig } from 'wyllet'
export const config = getDefaultConfig({
appName: 'My dApp',
chains: [mainnet, base],
wallets: [
...defaultWallets(),
coinbaseWallet({ overrides: { icon: '/brand/coinbase-wallet.svg' } }),
burnerWallet(),
],
})Installed browser wallets you did not list are still detected through EIP-6963 and shown under Detected. See Wallets for every preset and for custom wallets.
What getDefaultConfig sets up
For reference, getDefaultConfig() builds the connector list like this:
- A WalletConnect connector, if
walletConnectProjectIdis set and at least one wallet inwalletssupports WalletConnect. It is created withshowQrModal: false, because Wyllet renders its own QR code. - One connector for each wallet that brings its own (for example
burnerWallet()), tagged so the panel knows which wallet it belongs to. - A generic
injected({ shimDisconnect: true })connector, used forwindow.ethereumin browsers and in-app webviews without EIP-6963. - Your extra
connectors.
EIP-6963 discovery of installed extensions is handled by wagmi itself.
App metadata
appName, appDescription, appUrl and appIcon are sent to wallets when connecting through WalletConnect, and appName appears in the connect panel title ("Connect to My dApp").
Some app details are only set on the provider, through its appInfo prop: learnMoreUrl for the "Learn more about wallets" link, and termsUrl plus privacyUrl for the terms notice in the panel footer. The notice only appears when both URLs are set. appInfo is merged over what getDefaultConfig() registered.
<WylletProvider appInfo={{ termsUrl: '/terms', privacyUrl: '/privacy' }}>Using your own createConfig
You can skip getDefaultConfig() and write the wagmi config yourself. Wyllet works with any config, but because nothing is registered for it, pass the Wyllet-specific details to <WylletProvider> instead.
import { createConfig, http, injected } from 'wagmi'
import { walletConnect } from 'wagmi/connectors'
import { base, mainnet } from 'viem/chains'
export const projectId = 'YOUR_PROJECT_ID'
export const config = createConfig({
chains: [mainnet, base],
transports: {
[mainnet.id]: http(),
[base.id]: http(),
},
connectors: [
walletConnect({
projectId,
showQrModal: false,
metadata: {
name: 'My dApp',
description: 'My dApp',
url: 'https://my-dapp.xyz',
icons: ['https://my-dapp.xyz/icon.png'],
},
}),
injected({ shimDisconnect: true }),
],
})import { defaultWallets, WylletProvider } from 'wyllet'
import { projectId } from './wagmi'
<WylletProvider
wallets={defaultWallets()}
appInfo={{ name: 'My dApp' }}
walletConnectProjectId={projectId}
>
{children}
</WylletProvider>Keep these points in mind with a hand-written config:
- Include a
walletConnect()connector withshowQrModal: falseif you want QR codes and mobile wallets. Without it, the WalletConnect option is hidden. - Pass
walletConnectProjectIdto the provider as well. The All wallets directory needs it. - Pass
appInfowith at least aname. Otherwise the panel title reads "Connect to this app". walletsdefaults todefaultWallets()when nothing is registered.- A wallet that relies on its own connector must find that connector in your config. For the burner wallet, add
burner()(exported by Wyllet) toconnectors;burnerWallet()matches it by the connector idburner. A custom wallet can point at any connector in your config withconnectorId.