` with inline `{ [K in keyof T]: T[K] }` where it improves readability
-- [ ] Consider using `Simplify` from `type-fest` instead of rolling our own
-- [ ] Add type-level tests (`*.test-d.ts`) for all public types
-
-### Stronger Connector Typing
-- [ ] Make connector `getProvider()` return type more specific (not just `unknown`)
-- [ ] Type the `request()` method with a discriminated union of method names and params
-- [ ] Explore using branded types for addresses (Bitcoin address vs Lightning address)
-
-## 5. Dependency Modernization
-
-### Current Dependencies to Watch
-| Package | Current | Notes |
-|---------|---------|-------|
-| `eventemitter3` | 5.0.1 | Consider `mitt` (200B) or native EventTarget |
-| `zustand` | 5.0.0 | Keep updated, evaluate at Phase 2 |
-| `use-sync-external-store` | 1.4.0 | May be removable with React 19's `useSyncExternalStore` built-in |
-| `@tanstack/react-query` | ^5.x | Keep updated |
-
-### Planned Changes
-- [ ] Replace `eventemitter3` with `mitt` (saves ~3KB, simpler API)
-- [ ] Drop `use-sync-external-store` shim once we require React 19+
-- [ ] Evaluate `valibot` (used by sats-connect) as our validation library
-- [ ] Add `type-fest` for common utility types
-
-## 6. Code Quality & Tooling
-
-### Linting/Formatting
-- [ ] Ensure Biome covers all files (currently configured)
-- [ ] Add `biome check` to pre-commit hook
-- [ ] Consider enabling `noBarrelFile` globally (we currently suppress it for entrypoints)
-
-### CI/CD Pipeline
-- [ ] GitHub Actions workflow: lint, type-check, test, build
-- [ ] Automated npm publishing via changesets
-- [ ] Bundle size tracking (size-limit)
-- [ ] Renovate/Dependabot for dependency updates
-
-### Documentation
-- [ ] JSDoc comments on all public APIs
-- [ ] Auto-generated API docs (TypeDoc or similar)
-- [ ] VitePress documentation site (like wagmi.sh)
-
-## 7. Architecture Divergences from WAGMI
-
-Things we intentionally do differently:
-
-### No Chain Abstraction
-WAGMI's `chains` array and chain switching is designed for multi-chain EVM. We use a single
-`network` (mainnet/testnet) since Spark is one network. This simplifies:
-- Config creation (no transport mapping per chain)
-- Connection state (no chainId tracking)
-- No `switchChain` action needed
-
-### No ABI/Contract System
-WAGMI has extensive ABI encoding, contract read/write, and multicall support. We don't need
-any of this since Spark doesn't use smart contracts in the EVM sense.
-
-### Payment-First Actions
-Instead of `sendTransaction` with hex data, we have:
-- `sendPayment` - Lightning/Spark payments
-- `createInvoice` - Generate payment requests
-- `waitForPayment` - Subscribe to incoming payments
-
-These are higher-level abstractions matching how Bitcoin/Lightning apps actually work.
-
-### Simpler Connector Interface
-Our connectors don't need:
-- `switchChain` - Single network
-- `getChainId` - No chains
-- `rdns` / EIP-6963 - Bitcoin wallets don't use this standard (yet)
-- `getClient` - No viem client concept
-
-This makes writing new connectors significantly simpler than WAGMI connectors.
diff --git a/plans/readme-and-examples.md b/plans/readme-and-examples.md
deleted file mode 100644
index 58483e6..0000000
--- a/plans/readme-and-examples.md
+++ /dev/null
@@ -1,193 +0,0 @@
-# README & Usage Examples Plan
-
-## README.md Structure
-
-### Header
-- Project name + tagline: "MBGA - React Hooks for Spark"
-- Badges: npm version, CI status, codecov, license
-- One-sentence description: "Type-safe React hooks and vanilla JS actions for connecting to Spark wallets"
-
-### Quick Start
-```tsx
-import { createConfig, MbgaProvider, sparkMainnet } from 'mbga'
-import { satsConnect } from 'mbga/connectors'
-import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
-
-const config = createConfig({
- network: sparkMainnet,
- connectors: [satsConnect()],
-})
-
-const queryClient = new QueryClient()
-
-function App() {
- return (
-
-
-
-
-
- )
-}
-
-function WalletConnect() {
- const { connect, connectors } = useConnect()
- const { disconnect } = useDisconnect()
- const { isConnected, accounts } = useConnection()
-
- if (isConnected) {
- return (
-
-
Connected: {accounts[0]}
-
-
- )
- }
-
- return (
-
- {connectors.map((connector) => (
-
- ))}
-
- )
-}
-```
-
-### Installation
-```bash
-pnpm add mbga @tanstack/react-query
-# or
-npm install mbga @tanstack/react-query
-```
-
-### Sections to include
-1. **Features** - Bullet list: type-safe, SSR-ready, multiple connectors, React hooks, vanilla JS core
-2. **Packages** - Table of `@mbga/core`, `@mbga/connectors`, `mbga` with descriptions
-3. **Configuration** - `createConfig` options (network, connectors, storage, ssr)
-4. **Hooks reference** - Brief table of all hooks with one-line descriptions
-5. **Core actions** - Brief table of vanilla JS actions for non-React usage
-6. **Connectors** - List of available connectors and how to use each
-7. **TypeScript** - Note on type inference, `Register` interface for augmentation
-8. **Contributing** - Link to CONTRIBUTING.md (future)
-9. **License** - MIT
-
-## Usage Examples
-
-### Example 1: Basic Connect/Disconnect (`examples/basic/`)
-Minimal Vite + React app showing connect and disconnect flow.
-
-### Example 2: Display Balance (`examples/balance/`)
-```tsx
-function Balance() {
- const { data, isLoading, error } = useBalance()
-
- if (isLoading) return Loading balance...
- if (error) return Error: {error.message}
- if (!data) return null
-
- return Balance: {data.formatted} {data.symbol}
-}
-```
-
-### Example 3: Send Payment (`examples/send-payment/`)
-```tsx
-function SendPayment() {
- const { sendPayment, isPending, isSuccess, error } = useSendPayment()
-
- const handleSend = () => {
- sendPayment({
- to: 'sp1recipient...',
- amount: 1000n, // 1000 sats
- })
- }
-
- return (
-
-
- {isSuccess &&
Payment sent!
}
- {error &&
Error: {error.message}
}
-
- )
-}
-```
-
-### Example 4: Sign Message (`examples/sign-message/`)
-```tsx
-function SignMessage() {
- const { signMessage, data, isPending } = useSignMessage()
-
- return (
-
-
- {data &&
Signature: {data.signature}
}
-
- )
-}
-```
-
-### Example 5: Vanilla JS (No React) (`examples/vanilla/`)
-```typescript
-import { createConfig, connect, disconnect, getConnection } from '@mbga/core'
-import { satsConnect } from '@mbga/connectors'
-import { sparkMainnet } from '@mbga/core'
-
-const config = createConfig({
- network: sparkMainnet,
- connectors: [satsConnect()],
-})
-
-// Connect
-const { accounts } = await connect(config, {
- connector: config.connectors[0]!,
-})
-console.log('Connected:', accounts)
-
-// Check connection
-const connection = getConnection(config)
-console.log('Status:', connection.status)
-
-// Disconnect
-await disconnect(config)
-```
-
-### Example 6: SSR / Next.js (`examples/nextjs/`)
-```tsx
-// app/providers.tsx
-'use client'
-
-import { createConfig, MbgaProvider, sparkMainnet } from 'mbga'
-import { satsConnect } from 'mbga/connectors'
-import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
-import { useState } from 'react'
-
-const config = createConfig({
- network: sparkMainnet,
- connectors: [satsConnect()],
- ssr: true,
-})
-
-export function Providers({ children }: { children: React.ReactNode }) {
- const [queryClient] = useState(() => new QueryClient())
-
- return (
-
-
- {children}
-
-
- )
-}
-```
-
-## Implementation Order
-1. Write README.md with quick start and hook/action reference tables
-2. Create `examples/basic/` as a working Vite + React playground
-3. Add remaining examples as the core actions get implemented
-4. Add Next.js example once SSR is tested
diff --git a/plans/roadmap.md b/plans/roadmap.md
index 2a61045..c4888dc 100644
--- a/plans/roadmap.md
+++ b/plans/roadmap.md
@@ -12,46 +12,46 @@
- [x] @mbga/test: Mock connector and initial tests
### Milestone 1.1 - Working Wallet Connection
-- [ ] Integrate actual Spark SDK for balance queries and payment sending
-- [ ] Complete sats-connect connector with real wallet interaction
-- [ ] End-to-end wallet connect/disconnect flow working in browser
-- [ ] Persistent sessions (reconnect on page reload)
-- [ ] Error handling with user-friendly messages
+- [x] Integrate actual Spark SDK for balance queries and payment sending
+- [x] Complete sats-connect connector with real wallet interaction
+- [x] End-to-end wallet connect/disconnect flow working in browser
+- [x] Persistent sessions (reconnect on page reload)
+- [x] Error handling with user-friendly messages
### Milestone 1.2 - Core Actions Fully Implemented
-- [ ] getBalance: Fetch real BTC/sats balance from Spark
-- [ ] sendPayment: Support Lightning invoices (BOLT11), on-chain, and Spark-native transfers
-- [ ] signMessage: BIP-322 message signing
-- [ ] getTransaction: Look up transaction by ID
-- [ ] waitForPayment: Subscribe to incoming payment events
-- [ ] createInvoice: Generate Lightning/Spark invoices
+- [x] getBalance: Fetch real BTC/sats balance from Spark
+- [x] sendPayment: Support Lightning invoices (BOLT11), on-chain, and Spark-native transfers
+- [x] signMessage: BIP-322 message signing
+- [x] getTransaction: Look up transaction by ID
+- [x] waitForPayment: Subscribe to incoming payment events
+- [x] createInvoice: Generate Lightning/Spark invoices
## Phase 2: Advanced Features
### Milestone 2.0 - Multi-Wallet & Account Management
-- [ ] Multiple simultaneous wallet connections
-- [ ] Account switching within a single connector
+- [x] Multiple simultaneous wallet connections
+- [x] Account switching within a single connector
- [ ] Multi-account balance aggregation
- [ ] Connection prioritization and fallbacks
### Milestone 2.1 - Token & Asset Support
-- [ ] Spark token balance queries (if Spark supports tokens/assets)
-- [ ] Token transfer actions
-- [ ] Token metadata fetching
+- [x] Spark token balance queries (if Spark supports tokens/assets)
+- [x] Token transfer actions
+- [x] Token metadata fetching
- [ ] NFT / Ordinals support via connectors that support it
### Milestone 2.2 - Transaction Management
-- [ ] Transaction history queries
+- [x] Transaction history queries
- [ ] Transaction status polling/subscriptions
-- [ ] Fee estimation
+- [x] Fee estimation
- [ ] PSBT (Partially Signed Bitcoin Transaction) support
- [ ] Batch transactions / multi-send
### Milestone 2.3 - Developer Experience
-- [ ] CLI tool (`create-mbga`) for scaffolding new projects
-- [ ] Playground / example apps (Next.js, Vite)
-- [ ] Comprehensive documentation site
-- [ ] TypeScript type inference improvements
+- [x] CLI tool (`create-mbga`) for scaffolding new projects
+- [x] Playground / example apps (Next.js, Vite)
+- [x] Comprehensive documentation site
+- [x] TypeScript type inference improvements
- [ ] DevTools browser extension
## Phase 3: Ecosystem Expansion
@@ -66,15 +66,15 @@
- [ ] Spark-specific features (state channels, instant finality)
- [ ] Flashnet swap operations
- [ ] Clawback support for reversible transfers
-- [ ] Spark SDK direct connector (@buildonspark/spark-sdk)
+- [x] Spark SDK direct connector (@buildonspark/spark-sdk)
- [ ] Monitor other wallets for Spark support and add connectors as available
### Milestone 3.2 - Enterprise & Production
-- [ ] SSR/SSG support for all frameworks
+- [x] SSR/SSG support for all frameworks
- [ ] CDN-hosted UMD bundle
- [ ] Performance benchmarks and optimization
- [ ] Security audit
-- [ ] Semantic versioning with changesets
+- [x] Semantic versioning with changesets
- [ ] npm publish automation
## Phase 4: Ecosystem Maturity
diff --git a/plans/testing-plan.md b/plans/testing-plan.md
deleted file mode 100644
index 0423f8b..0000000
--- a/plans/testing-plan.md
+++ /dev/null
@@ -1,107 +0,0 @@
-# MBGA Testing Plan
-
-## Testing Pyramid
-
-### Unit Tests (Highest Priority)
-Tests for individual functions in isolation.
-
-#### @mbga/core
-- [ ] `createConfig` - Config creation with various options, SSR mode, storage options
-- [ ] `createConfig` - Connector setup and registration
-- [ ] `createEmitter` - Event emission, subscription, unsubscription, once
-- [ ] `createStorage` - Set/get/remove items, prefix handling, serialization
-- [ ] `createStorage` - noopStorage, getDefaultStorage
-- [ ] `createConnector` - Factory function produces valid connector shape
-- [ ] `connect` - Happy path, already connected error, connector not found
-- [ ] `disconnect` - Happy path, disconnect specific connector, disconnect last connection
-- [ ] `reconnect` - Reconnect from stored connector ID, no stored ID, unauthorized
-- [ ] `getBalance` - Not connected error, address parameter handling
-- [ ] `sendPayment` - Not connected error, parameter validation
-- [ ] `signMessage` - Not connected error, address resolution
-- [ ] `getConnection` - Connected state, disconnected state, all status flags
-- [ ] `getConnections` - Empty list, multiple connections
-- [ ] `getConnectors` - Returns registered connectors
-- [ ] `watchConnection` - Callback fires on state change, unsubscribe works
-- [ ] `watchConnections` - Callback fires on connection add/remove
-- [ ] `watchConnectors` - Callback fires on connector list change
-- [ ] Error classes - Correct names, messages, inheritance
-- [ ] Utility functions - deepEqual, serialize, deserialize, uid
-
-#### @mbga/connectors
-- [ ] `satsConnect` - Creates valid connector, correct id/name/type
-- [ ] `satsConnect` - Connect flow (mocked sats-connect module)
-- [ ] `satsConnect` - Disconnect flow
-- [ ] `satsConnect` - getAccounts returns addresses
-- [ ] `satsConnect` - isAuthorized check
-- [ ] `satsConnect` - Error handling on failed connection
-- [ ] `satsConnect` - Account change events
-
-#### mbga (React)
-- [ ] `MbgaProvider` - Provides config to children
-- [ ] `MbgaProvider` - Throws without config
-- [ ] `useConfig` - Returns config from context
-- [ ] `useConfig` - Throws outside provider
-- [ ] `useConfig` - Accepts config parameter override
-- [ ] `useConnect` - Mutation lifecycle (idle -> pending -> success)
-- [ ] `useConnect` - Error handling
-- [ ] `useConnect` - Exposes connectors list
-- [ ] `useDisconnect` - Mutation lifecycle
-- [ ] `useConnection` - Reflects connection state changes
-- [ ] `useConnection` - Status flags (isConnected, isConnecting, etc.)
-- [ ] `useBalance` - Query lifecycle, caching
-- [ ] `useSendPayment` - Mutation lifecycle
-- [ ] `useSignMessage` - Mutation lifecycle
-- [ ] `useConnectors` - Syncs with external store
-- [ ] `useReconnect` - Auto-reconnect flow
-
-### Integration Tests
-Tests that exercise multiple units together.
-
-- [ ] Full connect -> getBalance -> sendPayment -> disconnect flow
-- [ ] Multiple connector registration and switching
-- [ ] Storage persistence across config recreation (simulating page reload)
-- [ ] SSR hydration with initial state
-- [ ] React provider with multiple hooks consuming same config
-- [ ] Concurrent connection attempts
-- [ ] Reconnect after storage-persisted session
-
-### E2E Tests (Future)
-Tests with real browser and wallet extensions.
-
-- [ ] Connect with Xverse (sats-connect) in Chromium
-- [ ] Connect with Leather wallet
-- [ ] Connect with Unisat wallet
-- [ ] Full payment flow with testnet wallet
-- [ ] Multi-wallet connection in same session
-- [ ] Session persistence across page navigations
-
-## Test Infrastructure
-
-### Current Setup
-- **Runner**: Vitest 3.x
-- **Environments**: Node (core, connectors), happy-dom (react)
-- **Mock Connector**: `@mbga/test` package with `mock()` connector
-
-### Planned Additions
-- [ ] Browser testing with Playwright for React hooks
-- [ ] Snapshot testing for serialized state
-- [ ] Type-level tests (test-d.ts files) for TypeScript inference
-- [ ] Performance benchmarks for state updates
-- [ ] Coverage reporting (aim for >80% on core)
-- [ ] CI integration with GitHub Actions
-- [ ] Wallet mock server (like prool in WAGMI) for simulating wallet responses
-- [ ] Visual regression tests for any UI components
-
-### Mocking Strategy
-1. **Wallet providers**: Mock at the `sats-connect` module level using vitest `vi.mock()`
-2. **Storage**: Use `noopStorage` or in-memory storage for tests
-3. **Network requests**: Mock Spark SDK/API responses
-4. **React**: Use `@testing-library/react` with custom render that wraps in MbgaProvider + QueryClientProvider
-
-## Test Conventions
-- Test files live next to source: `foo.ts` -> `foo.test.ts`
-- Type tests use `.test-d.ts` extension
-- Each test file focuses on one module/function
-- Use `describe` blocks to group related tests
-- Prefer `it('does X when Y')` naming pattern
-- Shared test setup in `@mbga/test` package
diff --git a/site/pages/examples/index.mdx b/site/pages/examples/index.mdx
index 3759880..b7f8099 100644
--- a/site/pages/examples/index.mdx
+++ b/site/pages/examples/index.mdx
@@ -10,11 +10,11 @@ Working example apps demonstrating MBGA in different frameworks.
A minimal React app with wallet connection, balance display, payments, invoice creation, message signing, and fee estimation.
-**Source:** [examples/vite-react](https://github.com/quantumlyy/mbga/tree/main/examples/vite-react)
+**Source:** [examples/vite-react](https://github.com/refrakts/mbga/tree/main/examples/vite-react)
```bash
# Run locally
-git clone https://github.com/quantumlyy/mbga.git
+git clone https://github.com/refrakts/mbga.git
cd mbga
pnpm install
pnpm dev:vite
@@ -37,11 +37,11 @@ pnpm dev:vite
SSR-compatible setup using Next.js App Router with `'use client'` directives and SSR-safe storage.
-**Source:** [examples/nextjs](https://github.com/quantumlyy/mbga/tree/main/examples/nextjs)
+**Source:** [examples/nextjs](https://github.com/refrakts/mbga/tree/main/examples/nextjs)
```bash
# Run locally
-git clone https://github.com/quantumlyy/mbga.git
+git clone https://github.com/refrakts/mbga.git
cd mbga
pnpm install
pnpm dev:next
diff --git a/site/pages/frameworks/nextjs.mdx b/site/pages/frameworks/nextjs.mdx
index 60d20a8..76f4ccf 100644
--- a/site/pages/frameworks/nextjs.mdx
+++ b/site/pages/frameworks/nextjs.mdx
@@ -72,4 +72,4 @@ All component files using MBGA hooks must include `'use client'` at the top.
## Example
-See the full [Next.js example](https://github.com/quantumlyy/mbga/tree/main/examples/nextjs) for an App Router setup.
+See the full [Next.js example](https://github.com/refrakts/mbga/tree/main/examples/nextjs) for an App Router setup.
diff --git a/site/pages/frameworks/vite.mdx b/site/pages/frameworks/vite.mdx
index 8a0a110..3eb8d38 100644
--- a/site/pages/frameworks/vite.mdx
+++ b/site/pages/frameworks/vite.mdx
@@ -54,4 +54,4 @@ export default function App() {
## Example
-See the full [Vite + React example](https://github.com/quantumlyy/mbga/tree/main/examples/vite-react) for a complete working app with wallet connection, balance display, payments, invoices, and message signing.
+See the full [Vite + React example](https://github.com/refrakts/mbga/tree/main/examples/vite-react) for a complete working app with wallet connection, balance display, payments, invoices, and message signing.
diff --git a/site/pages/index.mdx b/site/pages/index.mdx
index 7b88474..949aadf 100644
--- a/site/pages/index.mdx
+++ b/site/pages/index.mdx
@@ -17,7 +17,7 @@ import { HomePage } from 'vocs'
Build Bitcoin apps with lightweight, composable, and type-safe modules that interface with Spark
Get started
- GitHub
+ GitHub
@@ -131,9 +131,9 @@ mbga supports all these features out-of-the-box:
Check out the following places for more mbga-related content:
-- Join the [discussions on GitHub](https://github.com/quantumlyy/mbga/discussions)
-- Check out the [example apps](https://github.com/quantumlyy/mbga/tree/main/examples)
-- Read the [contributing guide](https://github.com/quantumlyy/mbga/blob/main/.github/CONTRIBUTING.md)
+- Join the [discussions on GitHub](https://github.com/refrakts/mbga/discussions)
+- Check out the [example apps](https://github.com/refrakts/mbga/tree/main/examples)
+- Read the [contributing guide](https://github.com/refrakts/mbga/blob/main/.github/CONTRIBUTING.md)
diff --git a/site/vocs.config.ts b/site/vocs.config.ts
index c0ce67c..7aecd70 100644
--- a/site/vocs.config.ts
+++ b/site/vocs.config.ts
@@ -11,12 +11,12 @@ export default defineConfig({
titleTemplate: '%s – MBGA',
accentColor: 'light-dark(#f7931a, #ffc517)',
editLink: {
- link: 'https://github.com/quantumlyy/mbga/edit/main/site/pages/:path',
+ link: 'https://github.com/refrakts/mbga/edit/main/site/pages/:path',
text: 'Suggest changes to this page',
},
mcp: {
enabled: true,
- sources: [McpSource.github({ name: 'mbga', repo: 'quantumlyy/mbga' })],
+ sources: [McpSource.github({ name: 'mbga', repo: 'refrakts/mbga' })],
},
topNav: [
{
@@ -31,11 +31,11 @@ export default defineConfig({
items: [
{
text: 'Changelog',
- link: 'https://github.com/quantumlyy/mbga/blob/main/CHANGELOG.md',
+ link: 'https://github.com/refrakts/mbga/blob/main/CHANGELOG.md',
},
{
text: 'Contributing',
- link: 'https://github.com/quantumlyy/mbga/blob/main/.github/CONTRIBUTING.md',
+ link: 'https://github.com/refrakts/mbga/blob/main/.github/CONTRIBUTING.md',
},
],
},
@@ -50,5 +50,5 @@ export default defineConfig({
'/examples': sidebar,
'/acknowledgments': sidebar,
},
- socials: [{ icon: 'github', link: 'https://github.com/quantumlyy/mbga' }],
+ socials: [{ icon: 'github', link: 'https://github.com/refrakts/mbga' }],
})