mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-06 11:48:24 +00:00
The Cashu stack under Account (CashuWalletState -> commons CashuWalletOps
-> quartz CashuMintOperations/MintHttpClient) was jvmAndroid because the
mint client was written on OkHttp.
quartz:
- MintHttpTransport (commonMain) is the HTTP the client needs: GET and a
JSON POST, returning status + body text. OkHttpMintTransport (jvmAndroid)
implements it with the per-URL OkHttp factory it used before, and a
same-named MintHttpClient(..., okHttpClient) factory keeps the app's
MeltProcessor, the CLI mint commands and the tests unchanged.
- MintHttpClient, CashuMintOperations and CashuMintUrlValidator move to
commonMain. The client keeps withContext(Dispatchers.IO) around each call
and its decode, uses TimeUtils.nowMillis() and kotlin.concurrent.Volatile.
commons:
- CashuWalletOps and CashuWalletReader move to commonMain. CashuWalletOps
takes a mintTransport instead of an OkHttp factory; its per-mint cache is
quartz ConcurrentMap (same atomic getOrPut).
- ConcurrentSet gains snapshot() (jvmAndroid: copy of the key-set view; iOS:
copy under its lock), with a commonTest.
app:
- CashuWalletState's maps are quartz ConcurrentMap / commons ConcurrentSet;
every iteration reads a snapshot(). put(...) == null ("was it new") is
putIfAbsent(...) == null: an event with the same id is the same event.
- Account takes cashuMintTransport instead of okHttpClientForMoney (Cashu
was its only user); AccountCacheState wraps its money client in
OkHttpMintTransport. The CLI's CashuContext does the same.
No behaviour change intended. CashuWalletDiscovery stays in jvmAndroid; the
group does not use it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S7FuNBSKiyVecARSoE4B9P