Injected EVM
EIP-6963 discovery with an EIP-1193 injected fallback, via @usebutr/evm.
@usebutr/evm discovers browser EVM wallets (MetaMask, Rabby, Brave, Coinbase, …)
through EIP-6963 — the standard where
wallets announce themselves via window events instead of fighting over
window.ethereum.
Discovery
autoDiscovery() from @usebutr/wallets handles EVM discovery automatically.
For an EVM-only setup, wire it directly with createWalletSource:
import { createWalletSource } from "@usebutr/core";
import { discoverEvmAdapters } from "@usebutr/evm";
import { WalletManagerProvider } from "@usebutr/react";
const discovery = createWalletSource(discoverEvmAdapters);
<WalletManagerProvider discovery={discovery}>
{children}
</WalletManagerProvider>Injected fallback
Some regional / legacy wallets only expose a raw EIP-1193 window.ethereum and
never announce via EIP-6963. discoverInjectedAdapter is the last-resort
fallback for them. When using autoDiscovery() the injected flag is
controlled by DiscoverOptions and defaults to true whenever evm is enabled.
import { discoverInjectedAdapter, GENERIC_INJECTED_ICON } from "@usebutr/evm";Capabilities
Derived from the wallet's EIP-6963 provider info / RPC inspection. Typically
all of getBalance, sendTransaction, signMessage, subscribe,
switchChain are true; requestAccounts is true for wallets that honour
wallet_requestPermissions. Always branch on
wallet.connector.capabilities rather than
assuming.
Chain switching
EVM connectors switch chains for real via wallet_switchEthereumChain. Use
EVM_CHAINS_LIST (or CHAINS_BY_PLATFORM.evm from @usebutr/wallets) for the
chain list — see multi-chain.
Helpers
@usebutr/evm also exports byte/hex utilities used by adapters and handy in app
code: bytesToHex, hexToBytes, chainIdHexToDecimal,
chainIdDecimalToHex, formatEther.
Source: packages/evm/src. Used by apps/demo-next, apps/demo-tanstack-start, and (via
@usebutr/wallets) apps/demo-vite.