mbga
Build Bitcoin apps with lightweight, composable, and type-safe modules that interface with Spark
Modular
Composable hooks for wallets, payments, and invoices
Lightweight
Tree-shakeable with zero bloat. Only pay for what you use.
Performant
Powered by TanStack Query with automatic caching and deduplication
Typed APIs
TypeScript strict mode with autocomplete for every API
Overview
// 1. Import modules.
import { createConfig, sparkMainnet } from 'mbga'
import { xverse, walletStandardDiscovery } from '@mbga/connectors'
// 2. Set up your config with desired network & connectors.
const config = createConfig({
network: sparkMainnet,
connectors: [xverse()],
plugins: [walletStandardDiscovery()],
})
// 3. Use hooks in your components!
import { useConnect, useBalance, useSendPayment } from 'mbga'
function App() {
const { connect, connectors } = useConnect()
const { data: balance } = useBalance()
const { sendPayment } = useSendPayment()
}Features
mbga supports all these features out-of-the-box:
- Connect and disconnect with multiple wallet connectors (Sats Connect, Spark SDK, Wallet Standard)
- Query wallet balances with automatic caching
- Send payments via Lightning, on-chain Bitcoin, or Spark transfers
- Create invoices and wait for payments
- Sign messages with BIP-322
- Estimate fees before sending
- Authenticate with Flashnet for cross-chain swaps and orchestration
- Framework-agnostic core actions for vanilla JS usage
- TypeScript ready with strict typing throughout
Community
Check out the following places for more mbga-related content:
- Join the discussions on GitHub
- Check out the example apps
- Read the contributing guide