Build with AI assistants
Give Cursor, Claude Code, Copilot or ChatGPT the Wyllet docs and the rules for a correct integration.
Most Wyllet integrations are now written with an AI coding assistant. This page gives your assistant everything it needs: where to read the docs, a prompt to start from, and the rules that keep generated code correct.
Give your assistant the docs
Every page on this site is available in a form built for language models.
| Resource | What it contains |
|---|---|
/llms.txt | An index of every doc page and post, with one-line summaries and links to their Markdown versions |
/llms-full.txt | The complete documentation in one plain-text file |
<page>.md | The Markdown version of any doc or post, for example /docs/quick-start.md |
Accept: text/markdown | Requesting any doc or post URL with this header returns Markdown instead of HTML |
Tools that can fetch URLs (Claude Code, Cursor, Copilot agent mode, ChatGPT with browsing) can read /llms-full.txt directly. For tools that can't, copy a page with the Copy as Markdown button at the top of every doc and paste it into the chat.
A prompt to start from
Paste this into your assistant and fill in the parts in brackets.
Add the Wyllet wallet connector to this [Next.js App Router | Vite + React] app.
Read https://wyllet.dev/llms-full.txt first and follow it exactly. Wyllet is built on wagmi v3 and viem 2.
Requirements:
- Chains: [mainnet, base] (the first chain is the default)
- WalletConnect project ID from the env var [NEXT_PUBLIC_WC_PROJECT_ID]
- Put the connect button in [the site header]
- Theme: [obsidianTheme with accentColor '#…' | light/dark pair following the OS]
- [Optional: Sign-In With Ethereum against my existing /api/auth routes]
Rules:
- Install: wyllet wagmi viem @tanstack/react-query, plus @walletconnect/ethereum-provider because a project ID is set.
- Use getDefaultConfig from wyllet for the wagmi config. Do not install or configure RainbowKit, ConnectKit or Web3Modal.
- Providers go in a 'use client' component, nested WagmiProvider > QueryClientProvider > WylletProvider.
- Do not import any CSS. Wyllet injects its own styles.
- Only use props and hooks documented on wyllet.dev. Do not invent options.Rules for a correct integration
These are the mistakes assistants make most often. Each rule is checked against the library source.
Packages
- Install
wyllettogether with its peers:wagmi,viem,@tanstack/react-query,reactandreact-dom. Wyllet has no direct runtime dependencies of its own. - Install
@walletconnect/ethereum-provideronly whenwalletConnectProjectIdis set. It is an optional peer. - Wyllet requires wagmi v3. Tutorials written for wagmi v2 use APIs that have since changed, so prefer these docs and the wagmi v3 reference.
Providers and client components
- The package ships with a
'use client'directive. CallgetDefaultConfig(), theme presets such asobsidianTheme()andwithDefaultTokens()from client modules only. - Nest the providers in this order:
WagmiProvider, thenQueryClientProvider, thenWylletProvider. Every Wyllet component and hook must render insideWylletProvider. - In Next.js, create the
QueryClientinsideuseStatein the providers component, and setappUrlingetDefaultConfig()because there is nowindowon the server. - Do not import a stylesheet. Styles are injected automatically.
injectStyles={false}plusimport 'wyllet/styles.css'is only for apps that load styles themselves.
Configuration
- The order of
chainsis the priority order, and the first chain is the default. UsecustomChain()for chains thatviem/chainsdoesn't include. getDefaultConfig()accepts any wagmicreateConfig()option exceptchains,transportsandconnectors, which it builds. Pass your own RPC URLs throughtransportsin production.- With a hand-written
createConfig(), passwallets,appInfoandwalletConnectProjectIdtoWylletProvider, includewalletConnect({ showQrModal: false }), and addburner()to the connectors if you useburnerWallet(). burnerWallet()is for local development only. It keeps a private key inlocalStorage.
Opening the panel
useWylletButton()takes an element:open(e.currentTarget)oropenAccount(el, 'activity').useWyllet()takes an options object:openConnect({ anchor: e.currentTarget })oropenTab('networks', { anchor }).- The popover presentation needs an anchor element. Without one it falls back to a modal.
- The keyboard shortcut is off until you pass
shortcut="mod+k".
Sign-In With Ethereum
- The auth adapter needs
getNonce,verifyandsignOut, and optionallygetSession. Verify the signature and the nonce on your server, never only in the browser. - Switching accounts or disconnecting signs the user out automatically. Don't add your own listener for that.
Styling
- Change colors and radii through theme options or
overrides, not by targeting internal class names. - To override
--wy-*variables from your own stylesheet, use a selector at least as specific as:root [data-wyllet].
A complete reference implementation
This is the smallest correct Next.js App Router setup. It is a good target to compare generated code against.
import { base, mainnet } from 'viem/chains'
import { getDefaultConfig } from 'wyllet'
export const config = getDefaultConfig({
appName: 'My dApp',
appUrl: 'https://my-dapp.xyz',
walletConnectProjectId: process.env.NEXT_PUBLIC_WC_PROJECT_ID,
chains: [mainnet, base],
ssr: true,
})'use client'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { useState, type ReactNode } from 'react'
import { WagmiProvider } from 'wagmi'
import { obsidianTheme, WylletProvider } from 'wyllet'
import { config } from '@/lib/wagmi'
export function Providers({ children }: { children: ReactNode }) {
const [queryClient] = useState(() => new QueryClient())
return (
<WagmiProvider config={config}>
<QueryClientProvider client={queryClient}>
<WylletProvider theme={obsidianTheme({ accentColor: '#48ECD2' })} shortcut="mod+k">
{children}
</WylletProvider>
</QueryClientProvider>
</WagmiProvider>
)
}import type { ReactNode } from 'react'
import { WylletButton } from 'wyllet'
import { Providers } from './providers'
export default function RootLayout({ children }: { children: ReactNode }) {
return (
<html lang="en">
<body>
<Providers>
<header>
<WylletButton />
</header>
{children}
</Providers>
</body>
</html>
)
}Check the result
Before you accept generated code, check that:
wylletappears inpackage.jsonwithwagmiv3 andviemv2, and no other wallet connector library was added.- The providers file starts with
'use client'and nests the three providers in the right order. - There is no Wyllet CSS import.
- The button opens the panel, installed wallets appear under Detected, and the WalletConnect option shows a QR code once a project ID is set.
- Every prop and hook used appears in the Provider, Hooks or Components reference.