Skip to Content
butr
API reference

@usebutr/wallets

autoDiscovery(): one wallet source for every platform, listing each wallet once.

autoDiscovery(platforms?, options?): WalletSource

The one-call source for WalletManagerConfig.sources. It composes EVM (EIP-6963 plus the window.ethereum fallback), Solana and Sui (Wallet Standard), Bitcoin (Wallet Standard plus the injected fallbacks) and Polkadot (injectedWeb3 plus the Wallet Standard fallback), and lists each wallet once.

import type { WalletManagerConfig } from "@usebutr/core";
import { WalletManagerProvider } from "@usebutr/react";
import { autoDiscovery } from "@usebutr/wallets";

const config: WalletManagerConfig = { sources: [autoDiscovery()] };

export const Providers = ({ children }: { children: React.ReactNode }) => (
  <WalletManagerProvider config={config}>{children}</WalletManagerProvider>
);
ArgumentTypeDefault
platformsReadonlyArray<ChainPlatform>Every platform. autoDiscovery(["evm", "svm"]) discovers only those; an empty list warns and finds nothing.
options.fallbacksbooleantrue. false skips each platform's secondary channel: window.ethereum, the injected Bitcoin wallets, and Polkadot's Wallet Standard path.
options.loadModuleWalletStandardModuleLoaderThe dynamic import of @wallet-standard/app. Pass a fake registry in tests.
autoDiscovery(undefined, { fallbacks: false }); // every platform, standards only

How wallets list once

Every platform shares one Wallet Standard subscription. Primary channels list a wallet as soon as it announces. Fallback channels wait until Wallet Standard has loaded and read the wallets already registered, then 150 ms more, and list a wallet unless a channel already listed one with the same platform and walletKey. Each adapter gets its key where it is built, from the wallet's name without case, punctuation or the word "wallet", so the injected OKX adapter and the Wallet Standard OKX Wallet are both okx. A primary wallet that announces after its fallback listed is dropped.

  • A Bitcoin Wallet Standard wallet hides only its own injected entry: Xverse on both channels lists once, and Unisat still lists next to Phantom.
  • window.ethereum and window.btc name no wallet, so each lists only when its platform found nothing else.

A single-platform app can pass that package's discover*Adapters export instead and keep the other platforms out of its bundle. Combining a primary and a fallback source by hand lists a wallet on both channels twice.

Importing the package loads every platform package, so WalletSigner carries their signer kinds (eip1193, wallet-standard, unisat, sats-connect, polkadot-injected) even in an app that imports nothing else. Chain registries (CHAINS_BY_PLATFORM, EVM_CHAINS, …) live in @usebutr/core.

Types

AutoDiscoveryOptions.

Source: packages/wallets/src/index.ts.