ACINQ / phoenix

Phoenix is a self-custodial Bitcoin wallet using Lightning to send/receive payments.
https://phoenix.acinq.co
Apache License 2.0
624 stars 93 forks source link

Display LNURL Error Reason instead of "service offline" message #468

Closed dr-erych closed 7 months ago

dr-erych commented 7 months ago

1️⃣ Scan or paste an LNURL that returns an error response according to the LNURL Spec (also applies to payRequest etc.)

Example: LNURL1DP68GURN8GHJ7MR9VAJKUEPWD3HXY6T5WVHXXMMD9AMKJARGV3EXZAE0V9CXJTMKXYHKCMN4WFKZ76TJXDVYVC6RFQM8W52Y8PU9QE2PXDZKXKR34H0W77

Returns:
{"status":"ERROR","reason":"Withdraw is spent."}

2️⃣ The Phoenix wallet (at least on iOS) displays "The service (...) appears to be offline, or they have a down server", which is not the case.
It would be helpful to the user to actually know the "reason" from the LNURL response.

image
dpad85 commented 7 months ago

Thanks for reporting this issue.

It seems specific to the iOS app. @robbiehanson I think we'll fallback to an "service offline" message if the error is not unreadable/cannot connect : https://github.com/ACINQ/phoenix/blob/3d122f583d00fea107d8e56bc26fd2f1a139216c/phoenix-ios/phoenix-ios/views/send/SendView.swift#L241-L248

On Android we should be ok: https://github.com/ACINQ/phoenix/blob/3d122f583d00fea107d8e56bc26fd2f1a139216c/phoenix-android/src/main/kotlin/fr/acinq/phoenix/android/payments/ScanDataView.kt#L298-L303

Though on Android we don't have a special Lightning address case (user unknown by this service), which is a nice feature.