I have added WebSocket subscriptions to coco-cashu.
This was the most complex feature so far, because I wanted it to work fully automatic, for wallets that can support long-running subscriptins, but at the same time enable on-demand updates for more ephemeral processes like CLI wallets would have.
So you can now enable the MintQuoteWatcher which will watch all pending quotes and redeem them automatically, or you can use the API to await payments on certain quotes manually.
Only 4.000 lines into coco-cashu and complexity is already lingering in the shadows. I can feel it creeping up.
Drop your favourite books on design and architecture below🙏
My personal goal for coco-cashu is to make Cashu wallet dev so easy and accessible that Opus can one shot a Cashu electrum wallet.
I think we can get there
When people say that Javscript coercion sucks, I usually responded that it does not as long as you know the rules.
Well I just debugged a bug for one hour because an untyped API passed a string instead of a number.
And as it turns out "5" + 0 > 8 === true
I stand corrected
Today I build the first example Cashu CLI wallet using coco-cashu.
- mint info & keysets cache with revalidation
- proof storage and state management
- coin selection
- send / receive / mint
49 lines of code.