mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 16:14:40 +00:00
Follow-up to the V4Encoder move. Quartz could encode a cashuB string but could not parse cashuA/cashuB back, and the parsing lived in amethyst even though it is pure NUT-00 wire-format protocol. Worse, commons.RichTextParser already detects cashuA/cashuB words while the parser sat up in the app, so Desktop (its own rich-text viewer) could not parse a received token at all. Consolidate the legacy out-of-band redeem stack onto quartz: - new quartz CashuTokenB64Parser parses cashuA (standard-Base64 JSON, rewritten off Jackson onto kotlinx.serialization to satisfy quartz's no-Jackson rule) and cashuB (Base64URL CBOR, reusing the V4Token models), returning quartz types. It is the inverse of V4Encoder. - move the CashuToken container model from commons to quartz, switching its proofs from the duplicate commons Proof (field C, amount Int) onto the canonical quartz CashuProof (field c, amount Long). The duplicate Proof type is deleted. - delete amethyst V3Parser/V3Token/V4Parser; CashuParser/CachedCashuParser stay as thin amethyst adapters (off-main-thread guard + GenericLoadable + LruCache) over the quartz parser. - this removes the manual Proof -> CashuProof conversion shims that MeltProcessor and CashuWalletViewModel previously carried. Tests: full cashuA + cashuB vector coverage moves to quartz commonTest (CashuTokenB64ParserTest, runs on JVM) plus an encode/parse round-trip; the superseded amethyst CashuV4ParserTest is removed and CashuBTest stays as the adapter integration test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013UMNKix4qEfiAPP9s2a4gB