lightninglabs / taproot-assets

A layer 1 daemon, for the Taproot Assets Protocol specification, written in Go (golang)
MIT License
464 stars 111 forks source link

[feature]: add RPC endpoint for generating LN Invoices for Tap assets #884

Closed ffranr closed 2 months ago

ffranr commented 7 months ago

Description

This issue proposes the implementation of a new RPC endpoint to facilitate generating a lightning network invoice for receiving tap assets over a lightning channel.

Arguments

The RPC endpoint should accept the following parameters:

Invoice Generation Functionality

The tapd node should execute the following steps to generate an invoice:

  1. Check the given AssetId. If the asset is unknown, retrieve asset details from a known universe.
  2. Utilize the RFQ (Request for Quote) service to negotiate and finalize a quote with the specified routing peer. This step is crucial for determining the scid (short channel ID) for the invoice, the BTC amount to be used in the invoice, and the final expiry time of the invoice.
  3. Interface with lnd to generate an invoice based on the agreed terms.
  4. Amend the last hop hint in the generated invoice using the RFQ quote to specify the routing peer, ensuring correct routing and asset conversion.

The endpoint should return the modified lightning invoice to the caller.

ffranr commented 6 months ago

This RPC endpoint should return a status channel instead of directly providing an invoice, given that invoice generation can be time-consuming due to processes like RFQ negotiation, universe synchronization, and calls to LND. Implementing a status channel in this endpoint will prevent the caller from being blocked while these operations are executed.

ffranr commented 6 months ago

I don't think we've got a solid plan in place for this issue. Right now, for the PoC, this functionality is in lightning terminal.

dstadulis commented 5 months ago

Moving to v0.4.1 as IIUC it's related to lnd operating in remote mode

Roasbeef commented 2 months ago

Fixed by https://github.com/lightninglabs/taproot-assets/pull/1048