eclair
eclair copied to clipboard
RPC: parse BOLT12 invoices and offers
This PR adds the ability to parse BOLT12 invoices to parseinvoice RPC call, and introduces parseoffer RPC call, that parses BOLT12 offers.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 86.00%. Comparing base (
c8184b3) to head (6d01eee).
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@ Coverage Diff @@
## master #2843 +/- ##
==========================================
+ Coverage 85.96% 86.00% +0.03%
==========================================
Files 219 219
Lines 18441 18442 +1
Branches 762 731 -31
==========================================
+ Hits 15853 15861 +8
+ Misses 2588 2581 -7
| Files | Coverage Δ | |
|---|---|---|
| ...n/scala/fr/acinq/eclair/json/JsonSerializers.scala | 96.42% <ø> (ø) |
|
| ...la/fr/acinq/eclair/payment/send/OfferPayment.scala | 72.91% <100.00%> (+0.57%) |
:arrow_up: |
You seem to be doing more than just adding a
parseofferAPI in this PR, you're also adding support for Bolt 12 invoices which is arguably not a good idea...
Not at all. Only parseinvoice was changed to support Bolt 12 invoices. The changes in other RPCs were made just to prevent MatchError exceptions and avoid compiler errors.
Only parseinvoice was changed to support Bolt 12 invoices.
This is what threw me off, I don't think we should do this. But I may be wrong, @thomash-acinq do you think this would be useful?
If there was an explicit decision to hide Bolt 12 invoices from the user (I didn't realize it was removed from the spec), then we shouldn't expose them.
If it's only for debugging purposes, what I usually do is run this test:
test("show invoice"){
val encodedInvoice = "lni1qqgds4gw..."
val invoice = Bolt12Invoice.fromString(encodedInvoice).get
invoice.records.records.foreach(println)
}
Shelving this for now, as Bolt 12 invoices aren't supposed to be exposed yet. We can reopen this in the future when concrete use-cases need it.