diff --git a/implementation-guide-taproot-assets-l402-fastapi.md b/implementation-guide-taproot-assets-l402-fastapi.md index dda6497..30ef4ab 100644 --- a/implementation-guide-taproot-assets-l402-fastapi.md +++ b/implementation-guide-taproot-assets-l402-fastapi.md @@ -318,14 +318,20 @@ def issue_session_macaroon( m.add_first_party_caveat(f"payment_hash = {payment_hash}") return m.serialize() +ALLOWED_CURRENCIES = {"TIMMY", "sats"} + def verify_session_macaroon( root_key: bytes, token: str, requests_used: int, ) -> bool: v = pymacaroons.Verifier() - v.satisfy_exact("currency = TIMMY") - v.satisfy_exact("currency = sats") + # Allow exactly one currency caveat per token — use a general checker, NOT + # multiple satisfy_exact() calls. satisfy_exact() requires ALL listed values + # to appear, which would fail any single-currency token. + v.satisfy_general(lambda c: ( + c.startswith("currency = ") and c.split(" = ")[1] in ALLOWED_CURRENCIES + )) v.satisfy_general(lambda c: c.startswith("amount_paid = ")) v.satisfy_general(lambda c: c.startswith("payment_hash = ")) v.satisfy_general(lambda c: _check_requests(c, requests_used)) @@ -378,6 +384,40 @@ The session pass flow using TIMMY: **Recommendation:** Use the tapd REST API for simplicity during development; migrate to gRPC for production to access features like RFQ negotiation that are gRPC-only. +**REST curl quick reference — tapd v0.7 (port 8089):** + +```bash +# Set these once +TAPD_MAC_HEX=$(xxd -p ~/.taproot-assets/data/mainnet/admin.macaroon | tr -d '\n') + +# List all assets held by this node +curl -s --cacert ~/.taproot-assets/tls.cert \ + -H "Grpc-Metadata-macaroon: $TAPD_MAC_HEX" \ + https://localhost:8089/v1/taproot-assets/assets | jq . + +# Create a TIMMY receive address (AddressV2) +# Replace with your TIMMY asset ID encoded as base64 +curl -s --cacert ~/.taproot-assets/tls.cert \ + -H "Grpc-Metadata-macaroon: $TAPD_MAC_HEX" \ + -H "Content-Type: application/json" \ + -X POST https://localhost:8089/v1/taproot-assets/addrs \ + -d '{ + "asset_id": "", + "amt": "10", + "address_version": "ADDR_VERSION_V2" + }' | jq .encoded + +# Check recent transfers (to detect incoming TIMMY payment) +curl -s --cacert ~/.taproot-assets/tls.cert \ + -H "Grpc-Metadata-macaroon: $TAPD_MAC_HEX" \ + https://localhost:8089/v1/taproot-assets/transfers | jq . + +# Query TIMMY balance +curl -s --cacert ~/.taproot-assets/tls.cert \ + -H "Grpc-Metadata-macaroon: $TAPD_MAC_HEX" \ + "https://localhost:8089/v1/taproot-assets/assets/balance?asset_id_filter=" | jq . +``` + ### 4.2 LNbits Taproot Assets Extension Status (March 2026) The community extension (`echennells/taproot_assets`) exists and connects LNbits to `litd` via gRPC. It supports asset listing, send/receive, channel viewing, and balance tracking with WebSocket updates. It bundles its own LND and tapd protobuf stubs (`lnd_grpc_files.tar.gz`, `tapd_grpc_files.tar.gz`).