<!--
Sitemap:
- [MBGA · Reactive Primitives for Spark](/index)
- [Acknowledgments](/acknowledgments)
- [API Reference](/api/)
- [Connectors](/connectors/)
- [Examples](/examples/)
- [Flashnet](/flashnet/)
- [Getting Started](/getting-started)
- [Installation](/installation)
- [Kit](/kit/)
- [Configuration](/api/configuration)
- [Core Actions](/api/core-actions)
- [React Hooks](/api/hooks)
- [Types & Errors](/api/types)
- [Custom Connectors](/connectors/custom)
- [Sats Connect (Xverse)](/connectors/sats-connect)
- [Spark SDK](/connectors/spark-sdk)
- [Wallet Standard](/connectors/wallet-standard)
- [Flashnet Authentication](/flashnet/authentication)
- [Next.js](/frameworks/nextjs)
- [Vite](/frameworks/vite)
- [AccountModal](/kit/account-modal)
- [ConnectButton](/kit/connect-button)
- [ConnectModal](/kit/connect-modal)
-->

# Connectors

Connectors are the bridge between MBGA and Bitcoin wallets. Each connector implements a standard interface so your app code stays the same regardless of which wallet the user picks.

## Available Connectors

| Connector | Package | Use Case |
|-----------|---------|----------|
| [Sats Connect](./sats-connect) | `@mbga/connectors` | Browser wallets (Xverse, etc.) |
| [Spark SDK](./spark-sdk) | `@mbga/connectors` | Programmatic/embedded wallets |
| [Wallet Standard](./wallet-standard) | `@mbga/connectors` | Any wallet implementing the Wallet Standard |

## How Connectors Work

Connectors are passed to `createConfig` as factory functions:

```ts
import { walletStandardDiscovery, xverse } from '@mbga/connectors'
import { createConfig, sparkMainnet } from 'mbga'

const config = createConfig({
  network: sparkMainnet,
  connectors: [xverse()],
  plugins: [walletStandardDiscovery()],
})
```

Each connector factory returns an object implementing the connector interface. When a user calls `connect({ connector })`, MBGA:

1. Calls the connector's `connect()` method
2. Stores the returned accounts in state
3. Persists the connector ID to storage for reconnection
4. Updates the connection status to `'connected'`

## Choosing a Connector

* **Building a dApp where users connect their own wallet?** Use [Sats Connect](./sats-connect) or [Wallet Standard](./wallet-standard).
* **Building a server-side app or bot that manages its own keys?** Use [Spark SDK](./spark-sdk).
* **Want to support any wallet automatically?** Use [Wallet Standard](./wallet-standard) -- it discovers wallets at runtime.
* **Need something custom?** See [Custom Connectors](./custom).
