lightning icon indicating copy to clipboard operation
lightning copied to clipboard

Have pay just pay a bolt12 offer

Open Sjors opened this issue 1 year ago • 6 comments

I ran into the same confusion that led to #5473.

lightning-cli pay lno1zrxq... 100sat
{
   "code": -32602,
   "message": "Invalid bolt12: unexpected prefix lno"
}

You have to call fetchinvoice and then pay that.

Why not just do that automatically?

Sjors avatar Sep 02 '24 06:09 Sjors

You have to call fetchinvoice and then pay that.

This is true for any bolt12. It is also true that it is trivial to add a pay <bolt12> helper

vincenzopalazzo avatar Sep 02 '24 07:09 vincenzopalazzo

I can imagine needing a different flow for bolt12 offers that give away money. And repeating payments also aren't very suitable for the pay call.

Sjors avatar Sep 02 '24 07:09 Sjors

I can imagine needing a different flow for bolt12 offers that give away money. And repeating payments also aren't very suitable for the pay call.

You are right, in fact I have a plugin that wrap the bolt12, so it is time to upstream the changes. Thanks for reporting

vincenzopalazzo avatar Sep 02 '24 07:09 vincenzopalazzo

Currency conversions and repeated payments both need a different flow, so it's generalized. But if the amount is known and it's not repeated (which, TBF, is very common), it's totally possible to have pay Just Work,

rustyrussell avatar Sep 07 '24 03:09 rustyrussell

Could currency conversion be handled through a plugin? So you'd simply use pay bolt12_fiat_amount and if the plugin is there, it just works, and otherwise it complains "sorry, no plugin".

Sjors avatar Sep 07 '24 07:09 Sjors

Could currency conversion be handled through a plugin? So you'd simply use pay bolt12_fiat_amount and if the plugin is there, it just works, and otherwise it complains "sorry, no plugin".

Yes, but this is another story, the pay plugin should handle bolt12 IMHO, I will try to see what kind of code is required to implement it

vincenzopalazzo avatar Sep 13 '24 13:09 vincenzopalazzo

I'm moving this to next milestone, sorry. I'd really like xpay to do this at some point though...

rustyrussell avatar Nov 19 '24 01:11 rustyrussell

I started working on it, but I think it is better wait for a cycle to have the xpay in good shape before adding another pile of code on top of it.

vincenzopalazzo avatar Nov 19 '24 08:11 vincenzopalazzo