Breez_tech on Nostr: To make WASM happen, we’ve made major improvements across the SDK. ⚠️ Warning: ...
To make WASM happen, we’ve made major improvements across the SDK.
⚠️ Warning: we’re about to go technical ⚠️
WASM-Compatible SDK Core
We updated the 𝚜𝚍𝚔-𝚌𝚘𝚖𝚖𝚘𝚗 crate to work in WASM environments by:
→ Integrating a WASM-compatible gRPC client using 𝚝𝚘𝚗𝚒𝚌_𝚠𝚎𝚋_𝚠𝚊𝚜𝚖_𝚌𝚕𝚒𝚎𝚗𝚝
→ Implementing custom DNS resolution for WASM
→ Refactoring the internal REST client to remove non-WASM-compatible dependencies
→ Introducing a new 𝚜𝚍𝚔-𝚖𝚊𝚌𝚛𝚘𝚜 crate for shared macro support across platforms
New WASM-Specific Crate
We added a dedicated WASM interface using 𝚠𝚊𝚜𝚖-𝚋𝚒𝚗𝚍𝚐𝚎𝚗, with custom type and callback handling to provide a smooth developer experience.
Flexible SDK Customization
The new 𝙻𝚒𝚚𝚞𝚒𝚍𝚂𝚍𝚔𝙱𝚞𝚒𝚕𝚍𝚎𝚛 makes it easy to configure SDK components:
→ Includes platform-specific filesystem abstractions
→ Supports persistent storage in both Web and Node.js environments
SQLite and Cache Handling
Since traditional databases are challenging in WASM, we:
→ Use an adapted in-memory SQLite setup via 𝚛𝚞𝚜𝚚𝚕𝚒𝚝𝚎
→ Added a custom persistent watcher to handle state
Background Tasks & System Adaptations
We implemented WASM-friendly alternatives for:
→ Background task spawning
→ Interval management
→ Accessing system time
Alternative Blockchain Data Sources
Electrum isn’t viable in-browser, so we:
→ Integrated support for 𝚆𝚊𝚝𝚎𝚛𝚏𝚊𝚕𝚕𝚜 as a lightweight blockchain data source
WASM-Ready Boltz Integration
→ We refactored the Boltz swap client to be fully compatible with WASM environments.
gRPC-Web Proxy Support
All gRPC-based services (e.g., Breez Server and real-time sync):
→ Now support 𝚐𝚁𝙿𝙲-𝚆𝚎𝚋 proxies
→ Enabling full connectivity from browser environments
Published at
2025-04-18 13:11:59Event JSON
{
"id": "58b03e65b2305ca15a233eced71984877963ce11c3e55731fad594c2df1e681d",
"pubkey": "9711d1aba806a3a285ff3e87d175902c2f250741860d9c65903c8b5e863ebd81",
"created_at": 1744981919,
"kind": 1,
"tags": [
[
"e",
"12c1860c3bbd080888683d2a2ef3ac1ee0580dbd2487aed4ed2eac7240153cca",
"",
"root"
],
[
"p",
"9711d1aba806a3a285ff3e87d175902c2f250741860d9c65903c8b5e863ebd81"
],
[
"r",
"wss://eden.nostr.land/"
],
[
"r",
"wss://frjosh.nostr1.com/"
],
[
"r",
"wss://nostr.sidnlabs.nl/"
],
[
"r",
"wss://purplepag.es/"
],
[
"r",
"wss://relay.damus.io/"
],
[
"r",
"wss://relay.nostr.band/"
]
],
"content": "To make WASM happen, we’ve made major improvements across the SDK.\n\n⚠️ Warning: we’re about to go technical ⚠️\n\nWASM-Compatible SDK Core\nWe updated the 𝚜𝚍𝚔-𝚌𝚘𝚖𝚖𝚘𝚗 crate to work in WASM environments by:\n→ Integrating a WASM-compatible gRPC client using 𝚝𝚘𝚗𝚒𝚌_𝚠𝚎𝚋_𝚠𝚊𝚜𝚖_𝚌𝚕𝚒𝚎𝚗𝚝\n→ Implementing custom DNS resolution for WASM\n→ Refactoring the internal REST client to remove non-WASM-compatible dependencies\n→ Introducing a new 𝚜𝚍𝚔-𝚖𝚊𝚌𝚛𝚘𝚜 crate for shared macro support across platforms\n\nNew WASM-Specific Crate\nWe added a dedicated WASM interface using 𝚠𝚊𝚜𝚖-𝚋𝚒𝚗𝚍𝚐𝚎𝚗, with custom type and callback handling to provide a smooth developer experience.\n\nFlexible SDK Customization\nThe new 𝙻𝚒𝚚𝚞𝚒𝚍𝚂𝚍𝚔𝙱𝚞𝚒𝚕𝚍𝚎𝚛 makes it easy to configure SDK components:\n → Includes platform-specific filesystem abstractions\n → Supports persistent storage in both Web and Node.js environments\n\nSQLite and Cache Handling\nSince traditional databases are challenging in WASM, we:\n → Use an adapted in-memory SQLite setup via 𝚛𝚞𝚜𝚚𝚕𝚒𝚝𝚎\n → Added a custom persistent watcher to handle state\n\nBackground Tasks \u0026 System Adaptations\nWe implemented WASM-friendly alternatives for:\n → Background task spawning\n → Interval management\n → Accessing system time\n\nAlternative Blockchain Data Sources\n Electrum isn’t viable in-browser, so we:\n → Integrated support for 𝚆𝚊𝚝𝚎𝚛𝚏𝚊𝚕𝚕𝚜 as a lightweight blockchain data source\n\nWASM-Ready Boltz Integration\n → We refactored the Boltz swap client to be fully compatible with WASM environments.\n\ngRPC-Web Proxy Support\n All gRPC-based services (e.g., Breez Server and real-time sync):\n → Now support 𝚐𝚁𝙿𝙲-𝚆𝚎𝚋 proxies\n → Enabling full connectivity from browser environments",
"sig": "d7292ea9cb35fd1525f84640ca647d46f71f39769c0d4a9e309e8f3dd5c86126a803e569df5f5aa2b356ca136a462b3234c00f734ee73ac7252b05c9b687b677"
}