@fedimint/core-web
THIS IS A WORK IN PROGRESS AND NOT READY FOR SERIOUS USE
This package provides a typescript interface for a fedimint client in the browser.
It contains the wasm-pack output of the rust-based fedimint client.
Key Features:
- WebAssembly-powered Client: Exposes the robust, fault-tolerant fedimint-client (built in Rust) via WebAssembly. Lazy-Loads within a web worker for performance.
- eCash Payments: Includes support for joining federations, sending/receiving eCash, and managing balances.
- Lightning Payments: Ships with zero-setup Lightning Network payments.
- 🛠️ State Management: Handles the complex state management and storage challenges for browser wallets.
- 🤫 Privacy Included: Offers a privacy-centric wallet by default.
- ⚙️ Framework Agnostic: Designed as a "core" library compatible with vanilla JavaScript, laying the groundwork for future framework-specific packages.
Installation
// npm or yarn or pnpm
pnpm add @fedimint/core-web
Setup
This package relies on the wasm binary to be bundled with your application. You will likely need to update your bundler's or framework's configuration to load the wasm file. Setup guides for popular frameworks are coming soon.
See the vite.config.ts file in the vite-core example for an example of configuring wasm within a web-worker using Vite.
Usage
import { FedimintWallet } from '@fedimint/core-web'
const wallet = new FedimintWallet()
await wallet.open()
if (!wallet.isOpen()) {
const inviteCode = 'fed11qgqpw9thwvaz7t...'
await wallet.joinFederation(inviteCode)
}
const balance = await wallet.getBalance()
const unsubscribe = wallet.subscribeBalance((balance: number) => {
console.log('updated balance', balance)
})
await wallet.reissueNotes('A11qgqpw9thwvaz7t...')
await wallet.payBolt11Invoice('lnbc...')
Check out the example
Resources