Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bolt12 offers may specify an amount, and that amount may be in a fiat currency. The wallet should be able to understand that, and convert the amount to btc, using the feerate fetched by the
CurrencyManager.Conversion can be done using the method
FiatCurrency.valueOfOrNull(offer.currency), sinceoffer.currencyis the standard currency code.A new method
fetchRateForCurrencyhas been added inCurrencyManager. It immediately fetches the feerate of a given fiat currency and refreshes the cache ; or will return the cached value is the cache is fresh.Since the conversion is not accurate, the user should be able to change the amount to send, even use an amount below what Phoenix computed. The recipient may then reject the payment if it's too far from what he actually expects for the given fiat amount.
This PR depends on : ACINQ/lightning-kmp#804
Example offers:
Screenshots:
The UI is almost unchanged, except for a label below the amount input mentioning that the invoice is labelled in fiat:
Tapping on the "Invoice requests 1 EUR" message, the app displays a modal with some details: