Docs Wallets
Wallets
Any injected wallet that announces itself over EIP-6963 or exposes window.ethereum. Photoswap adds Robinhood Chain if the wallet does not know it.
eth_chainId
what chain is the wallet on
wallet_switchEthereumChain
{ chainId: "0x1237" }
wallet_addEthereumChain
ROBINHOOD_CHAIN_PARAMS
Discovery
lib/wallet.ts is framework-free and uses viem only. It listens for eip6963:announceProvider events, dispatches eip6963:requestProvider, and keeps every wallet that announces itself keyed by its rdns. If nothing announces, it falls back to window.ethereum and guesses a name from the usual flags (isRabby, isCoinbaseWallet, isMetaMask).
The last wallet you connected is remembered in localStorage under photoswap.wallet.rdns, so the next visit reconnects silently with eth_accounts. Nothing else is stored.
const { address, connect, disconnect, walletClient, isConnecting, chainOk, switchChain, wallets } = useWallet();Switching chain
After connecting, ensureRobinhoodChain reads eth_chainId. If it is not 4663 it asks for wallet_switchEthereumChain. A 4902 error (or -32603 with an Unrecognized chain message, which some wallets use) means the chain is unknown, so it follows with wallet_addEthereumChain using these parameters:
{
chainId: "0x1237", // 4663
chainName: "Robinhood Chain",
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
rpcUrls: ["https://rpc.mainnet.chain.robinhood.com"],
blockExplorerUrls: ["https://robinhoodchain.blockscout.com"],
}NEXT_PUBLIC_RPC_URL overrides the RPC for both the app's reads and the parameters offered to the wallet. The Connect pill shows Switch to Robinhood Chain until chainOk is true.
Which wallets work
| Wallet | Discovery | Notes |
|---|---|---|
| MetaMask | EIP-6963 | Adds the chain on first use. Works on desktop and in the mobile in-app browser. |
| Rabby | EIP-6963 | Shows the simulated balance change before signing, which is a good check on the basket. |
| Coinbase Wallet | EIP-6963 | Extension and in-app browser. |
| Brave Wallet | EIP-6963 | Built into Brave. |
| Other injected | window.ethereum | Anything that exposes a provider and supports wallet_addEthereumChain. |
| WalletConnect | Not yet | No relay in this build. Use an in-app browser instead. |
You need ETH on Robinhood Chain to buy. Bridging is outside Photoswap; the explorer's bridge page is the usual route.
Errors you will see
walletErrorMessage turns provider errors into one line each:
| Cause | Message |
|---|---|
| Code 4001, user rejected | Request cancelled in wallet. |
| Code -32002, request pending | Open your wallet. A request is already waiting. |
| insufficient funds | Not enough ETH on Robinhood Chain for this purchase. |
| Anything else | The first line of the provider message, cut at 160 characters. |
No signatures except the buy
