GaloyMoney / blink

bitcoin banking infrastructure
https://galoy.io
MIT License
363 stars 138 forks source link

API feature request: return preImage for intraLedger settlement #3735

Closed openoms closed 7 months ago

openoms commented 8 months ago

Currently the preImage is only returned in case the invoice is paid over LN:

mutation LnInvoicePaymentSend($input: LnInvoicePaymentInput!) {
  lnInvoicePaymentSend(input: $input) {
    errors {
      message
    }
    status
    transaction {
      settlementVia {
        ... on SettlementViaLn {
          preImage
        }
        ... on SettlementViaIntraLedger {
          counterPartyUsername
          counterPartyWalletId
        }
      }
    }
  }
}

Discussed in detail in: https://github.com/getAlby/lightning-browser-extension/issues/2946

If the Galoy connector doesn't reliably return preimages for WebLN it will break quite some apps that follow the current WebLN spec and possibly would force them to handle those special cases (for intraledger payments) which is clearly not how WebLN is intended to work.

Would also be required to be able to obtain a proof of payment when paying another user on the same backend.

Update with the BTCPayServer plugin: as the BTCPayServer instance shows the receipt online (with the preImage in it's database from the invoice creation) it provides the preImage as the payment proof regardless if the payment was settled intraledger. Example of an invoice paid to the BTCPay Blink plugin from Blink: image

openoms commented 7 months ago

Thank you for the fix, the preimage is now returned for intraledger payments.

Opened a PR to Alby to implement this: https://github.com/getAlby/lightning-browser-extension/pull/2997