# One-click buyer web page (wallet connect + token import + prefilled send)

Use when buyers must do wallet actions that are error-prone in chat: making a
custom token visible, sending the token to a program address, switching to the
right chain. A single static HTML page (served from the project's fast host)
replaces pages of manual instructions.

## Required buttons (in this order)

1. **Connect** — `eth_requestAccounts`, then `eth_chainId`; if not on BNB
   Chain (56), `wallet_switchEthereumChain` with `chainId: '0x38'` first and
   abort on failure. Show the connected address.
2. **Add token** — `wallet_watchAsset` with
   `{type:'ERC20', options:{address, symbol, decimals, image}}`. Works in the
   MetaMask AND Trust in-app browsers. This fixes "I received nothing".
3. **Send all** — read the buyer's token balance via `eth_call`
   (`0x70a08231` + padded address), then `eth_sendTransaction` with a fully
   prefilled ERC20 `transfer`: `0xa9059cbb` + recipient address padded to
   64 hex + amount hex padded to 64, `value: '0x0'`. The wallet shows one
   confirm popup — nothing to type, nothing to paste.

## Details that make it work

- Balances and amounts as JS `BigInt` (token amounts overflow Number).
- Listen to `accountsChanged` → `location.reload()` so switching accounts
  doesn't show a stale balance.
- Detect a missing wallet (`window.ethereum` undefined) and tell the user to
  open the page inside the MetaMask/Trust in-app browser — a plain browser
  cannot run it.
- Offer a small language switcher (TR/DE/EN) via a TEXTS dict, same as the
  bot; default Turkish.
- The bot links to this page as a URL button on the sell-back step — chat
  instructions stay as the manual fallback only.

## Handover of a ready-made account

When the owner asks for a test/buyer account "on a freshly generated
account": generate the EOA, run the full customer cycle with it (see
SKILL.md), then hand over the private key in chat plus MetaMask instructions:
account menu → **Add account or hardware wallet → Import account → type
"Private Key"** (NOT seed phrase, NOT JSON, NOT "watch account") → paste
key. The classic user error is pasting the key where MetaMask expects an
ADDRESS (watch-only account) and reporting the key as "invalid" — state the
exact menu path up front, and mention the key also works with a leading `0x`.
The token becomes visible via this page's watch-asset button. Keep a copy
under `~/.secrets/<project>_<name>.key` (chmod 600).
