feat: mostrar valor fiat entonces y ahora en el historial + pipeo fiat completo#119
feat: mostrar valor fiat entonces y ahora en el historial + pipeo fiat completo#119Delgado74 wants to merge 2 commits into
Conversation
- Embed original fiat in invoice memo and outgoing description - Wire fiat params through sendPayment, sendPaymentToLNURL, sendPaymentToLightningAddress, and createInvoice - Fix Yadio service: use /convert/1/BTC/XXX - Add Then & Now in history with current Yadio rate - Fallback to wallet fiat for Then/Now when original unknown - Use Yadio as primary conversion in _getAmountInSats - Fix negative fiat display with abs() - Remove USD exclusion from memo fallback regex - Localize history detail labels - Reorder createInvoice: standard endpoint first, LNURLp fallback
|
Warning Review limit reached
More reviews will be available in 34 minutes and 13 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (8)
📒 Files selected for processing (13)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Descripción
Implementa el valor fiat "Entonces" y "Ahora" en el historial de transacciones, mostrando el valor original al momento de la transacción junto al valor actual calculado con la tasa de Yadio en tiempo real, en la misma moneda fiat que se usó al crear el pago.
Además, se pipea la metadata fiat a través de todos los flujos de pago (LNURL, Lightning Address, bolt11) para que
TransactionInfopueda recuperarla y mostrarla consistentemente.Cambios principales
Fiat Then & Now
7history_screen.dart: muestra "Entonces: X.XX CURR" / "Ahora: Y.YY CURR" tanto en la lista como en el detalle de cada transacción, usando el rate actual de Yadio en la moneda original.Pipeo de metadata fiat
invoice_service.dart:sendPayment(),sendPaymentToLNURL(),sendPaymentToLightningAddress()ycreateInvoice()ahora aceptanoriginalFiatCurrency/Amount/Ratey los incrustan en el memo/description de cada transacción.amount_screen.dart:_processPayment()extrae el fiat del currency selector y lo pasa a los tres métodos de pago.invoice_confirm_screen.dart: recibe los parámetros fiat y los reenvía asendPayment().Localización
history_date_label,history_description_label,history_hash_label,history_fee_label,history_original_rate_label,history_wallet_amount_label,history_wallet_rate_label.Bugs corregidos durante la implementación
Estos bugs fueron descubiertos al probar el flujo fiat y era necesario resolverlos para que Then & Now funcionara correctamente:
LNBits ignora claves
extrapersonalizadas — LNBits no preserva las clavesfiat_currency,fiat_amount,fiat_ratedentro del objetoextraen las respuestas. Solución: incrustar los datos fiat directamente en el memo/description de la factura/pago, y usar un regex de respaldo enTransactionInfo.fromJson()para extraerlos.extras(plural) vsextra(singular) — el nombre del campo enviado al API de LNBits eraextras(incorrecto) en lugar deextra. Corregido para coincidir con el API real.Endpoint
/ratesde Yadio roto — el endpoint/ratesde YadioService fallaba. Reemplazado por/convert/1/BTC/XXXpor moneda.Valor "Now" negativo en pagos salientes —
_getCurrentFiatValue()no usabaabs()enamountSats, mostrando valores negativos. Corregido.USD excluido del fallback de memo — había una condición
currency != 'USD'que impedía mostrar Then & Now para transacciones en USD. Eliminada.Orden de endpoints en
createInvoice()— el endpoint LNURLp (/lnurlp/api/v1/invoice) se probaba primero y no preservaba el memo. Reordenado para que el estándar/api/v1/paymentsvaya primero, con LNURLp como fallback.Limitaciones conocidas
Beneficio para comercios
Esta funcionalidad tiene valor directo para comercios que operan con BTC y llevan contabilidad en fiat:
Closes #117