Skip to content

Commit 66d54f1

Browse files
authored
Merge pull request #7 from UTEXO-Protocol/feat/rln-wasm
Feat/rln wasm
2 parents 475e508 + 6762da3 commit 66d54f1

37 files changed

Lines changed: 6479 additions & 3381 deletions

‎.env.example‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,18 @@ VITE_REGTEST_PROXY_RPC_URL=rpc://localhost:3000/json-rpc
77
VITE_REGTEST_BITCOIND_URL=/bitcoind/wallet/miner
88
VITE_REGTEST_BITCOIND_USER=user
99
VITE_REGTEST_BITCOIND_PASS=password
10+
11+
# APay UTEXO (signet) flow — LSP & APay page
12+
# Faucet RLN-node REST that funds BTC + sends the RGB top-up (required).
13+
# The browser reaches it through the Vite /faucet-signet proxy.
14+
VITE_SIGNET_FAUCET_URL=
15+
# Bearer token for the signet LSP APay routes (enableLightningAddress).
16+
VITE_SIGNET_LSP_BEARER=
17+
# Optional overrides (defaults: RN-demo asset id, /lsp-signet proxy →
18+
# https://lsp-signet.utexo.com).
19+
# VITE_SIGNET_ASSET_ID=rgb:...
20+
# VITE_SIGNET_LSP_URL=/lsp-signet
21+
# VITE_SIGNET_LSP_TARGET=https://lsp-signet.utexo.com
22+
# VITE_SIGNET_PROXY_WS=wss://... # WS gateway for the wasm node's LDK P2P
23+
# VITE_SIGNET_INDEXER_URL=https://esplora-api.utexo.com
24+
# VITE_SIGNET_TRANSPORT=rpcs://rgb-proxy.utexo.com/json-rpc

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ npm-debug.log*
2424

2525
# TypeScript
2626
*.tsbuildinfo
27+
28+
# Local scripts
29+
scripts/start-lsp-web.sh

‎CLAUDE.md‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,23 @@ Interactive React SPA that demos every function of the `@utexo/rgb-sdk-web` WASM
1818

1919
## Architecture
2020

21-
**Startup flow**: `App.tsx` calls `initWasm()` (async WASM init), then `autoRestore()` to recover wallets from `sessionStorage`. The Zustand store in `src/store.ts` holds the live WASM wallet instances (`manager: WalletManager | null`, `utexo: UTEXOWallet | null`) plus an activity log. Wallet instances **must** live in Zustand (not React state) because WASM objects cannot be cloned/serialized.
21+
The SDK is **RLN-only** (the old rgb-lib-wasm `WalletManager` stack was removed). All wallets are backed by `rln-wasm-sdk`.
22+
23+
**Startup flow**: `App.tsx` calls `initRlnWasm()` (async WASM init), then `autoRestore()` to recover wallets from `localStorage`. The Zustand store in `src/store.ts` holds live wallet instances (`type: 'utexo' | 'rln'`, instance `UTEXOWallet | RlnWalletManager`) plus an activity log. Instances **must** live in Zustand (not React state) — WASM objects cannot be cloned/serialized. Both wallet types restore via `*.create({ mnemonic, password, network, indexerUrl?, transportEndpoint?, proxyUrl?, nodeRuntimeId? })`, so the saved `WalletConfig` must include `password`. `create()` auto-connects to the indexer (saved `indexerUrl` or the network default) non-fatally — check `isOnline()` afterwards; no separate `goOnline()` call is needed.
2224

2325
**Pages** (one route each in `App.tsx`):
2426
- `KeysPage` — `generateKeys`, `restoreKeys`, `deriveKeysFromMnemonic`, `bip39`
25-
- `WalletManagerPage` — full `WalletManager` lifecycle (create, go online, UTXO ops, BTC send)
26-
- `UtexoWalletPage` — `UTEXOWallet` (dual-layer wallet with optional transport endpoint)
27-
- `BitcoinPage` — BTC send (3-step PSBT), faucet funding, fee estimation
28-
- `RgbAssetsPage` — issue NIA/IFA assets, blind/witness receive invoices, send assets
29-
- `BackupPage` — file backup/restore, VSS cloud backup
27+
- `UtexoWalletPage` — **primary**: create + full `UTEXOWallet` surface (RGB on-chain + Lightning), backed by RLN
28+
- `UtexoBackupPage` (`/backup`) — file backup (`createBackup`/`getLastBackupBytes`/`restoreFromBackupBytes`) + VSS
29+
30+
`BitcoinPage`, `RgbAssetsPage`, `RlnWalletPage`, and `RlnFlowGuidePage` were removed — they duplicated `UtexoWalletPage`'s coverage of BTC send, RGB issue/send/receive, and Lightning at the lower `RlnWalletManager`/`IRlnNodeBinding` layer. `UTEXOWallet` does not re-expose `sendBeginBatch`/`sendBatch`/`sendRgbFromGroups` (batch/group RGB send) — use `RlnWalletManager` directly for that if needed.
3031

3132
**Reusable components** worth knowing:
3233
- `StepFlow.tsx` — 3-step Begin → Sign → Broadcast UI; steps unlock sequentially; has an "Auto" button that runs all 3 at once
3334
- `OutputBox.tsx` — `<pre>` display with Copy button
3435
- `Field.tsx`, `Section.tsx`, `Btn.tsx` — form/layout primitives
3536

36-
**Session persistence** (`src/lib/session.ts`): saves `{ type, mnemonic, network, transportEndpoint, indexerUrl }` to `sessionStorage['rgb_wallet_session']`. Cleared when browser session ends.
37+
**Session persistence** (`src/lib/session.ts`): saves wallet entries (incl. `WalletConfig` with `password`) to `localStorage['rgb_wallet_sessions']`; active id in `sessionStorage['rgb_active_wallet_id']`.
3738

3839
## Critical Vite Config Rules
3940

@@ -45,7 +46,7 @@ Interactive React SPA that demos every function of the `@utexo/rgb-sdk-web` WASM
4546

4647
`optimizeDeps.exclude` must list `@utexo/rgb-sdk-web` and sibling packages — Vite's pre-bundler breaks async WASM init if they're included.
4748

48-
`server.fs.allow` must include sibling monorepo paths (`../rgb-sdk-web`, `../rgb-lib-wasm`, `../rgb-sdk-core`) so Vite can serve their WASM files.
49+
`server.fs.allow` must include sibling monorepo paths (`../rgb-sdk-web`, `../rgb-sdk-core`, `../../utexo/rgb-lightning-node/bindings/wasm-sdk/pkg`) so Vite can serve their WASM files.
4950

5051
## SDK Patterns
5152

0 commit comments

Comments
 (0)