From b7c5abd93868b97c25f52610510544764a3e44eb Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 4 Jul 2026 09:33:52 -0700 Subject: Features phase 2: gift/swap/ark primitives leave the core wallet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wallet.js drops from 2,762 to 2,374 lines and now exposes two generic seams instead of feature code: - registerCoinLock()/lockedCoinIds(): features contribute coin ids that spending and the balance treat as unavailable (gift reservations). - loadFeatureState()/saveFeatureState(): namespaced per-wallet persisted state. src/features/gifts-wallet.js takes the whole gift engine — reservation sets, gift records, coin selection, the SIGHASH_SINGLE/NONE PSBT builder, the compact codec, claim building, nostr-locked gifts — as an installGiftWallet(wallet) instance install plus standalone exports. Swap storage/key helpers (loadSwaps/saveSwaps/swapNode/nextSwapIndex) install from swap.js; ark state storage installs from the ark feature. The silent-payment scan worker only embeds when the sp feature ships (wallet.js already tolerated its absence). Minimal profile: 412KB, down from 476KB (full: 578KB). All suites pass: ark UI e2e, ArkManager crash-resume, gift lifecycle, minimal smoke. SP's engine (scanning, BIP-352 signing) stays in wallet.js — extracting it safely wants an SP e2e harness on this stack first. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01QFAcD4V284DvYZZHP7Rxxy --- tools/ark/gift-shot.js | 1 + 1 file changed, 1 insertion(+) (limited to 'tools') diff --git a/tools/ark/gift-shot.js b/tools/ark/gift-shot.js index 948854c..3ebb21f 100644 --- a/tools/ark/gift-shot.js +++ b/tools/ark/gift-shot.js @@ -17,6 +17,7 @@ for (let i = 0; i < 30; i++) { try { if ((await fetch(APP)).ok) break; } catch { const browser = await puppeteer.launch({ executablePath: '/usr/bin/google-chrome', headless: 'new', args: ['--no-sandbox'] }); const page = await browser.newPage(); +page.on('pageerror', (e) => console.log('[pageerror]', e.message)); await page.setViewport({ width: 420, height: 860, deviceScaleFactor: 2 }); const clickText = (sel, text) => page.evaluate((sel, text) => { const el = [...document.querySelectorAll(sel)].find((e) => e.textContent.trim().toLowerCase().includes(text.toLowerCase())); -- cgit v1.2.3