feat: taproot asset backend
This pull request introduces initial support for Taproot Assets by implementing a new funding source: the TapRestWallet. This wallet backend interacts with a Lightning Terminal Daemon (like litd via a REST interface) to enable the mint to handle Taproot Asset on the Lightning Network.
Key Changes and Implementation Details
-
Adds cashu/lightning/taprest.py, which contains the TapRestWallet class, providing a LightningBackend interface for Taproot Assets operations (specifically targeting litd's REST API).
-
Unit Support: Temporarily uses Unit.thb as a placeholder for a generic "Taproot Asset Unit" in the backend implementation, which will likely need to be generalized/abstracted in future iterations.
-
Adds a new configuration section TapRestFundingSource to cashu/core/settings.py and the respective variables to .env.example.
-
New Environment Variables: Introduces settings for connecting to the Taproot Assets service: MINT_TAP_REST_ENDPOINT, MINT_TAP_REST_CERT, MINT_TAP_REST_CERT_VERIFY
-
Authentication Macaroons: MINT_TAP_REST_LND_MACAROON (for LND/Lightning operations) and MINT_TAP_REST_TAP_MACAROON (for Taproot Assets operations).
-
Asset Identifiers: MINT_TAP_REST_ASSET_ID (the ID of the asset this mint will handle) and MINT_TAP_REST_PEER_PUBKEY.
-
Minor adjustments to cashu/core/base.py to allow the use of Unit.thb in amount calculations, supporting the chosen unit for the Taproot Asset.
Thank you for the PR. Two things that stand out to me:
- One could want to use any other unit (USD, EUR, etc...) for respectively denominated taproot assets
- This shouldn't be a backend standing on its own, but rather an optional feature of the existing LND backends.