diff --git a/electrum/gui/qml/components/LightningPaymentDetails.qml b/electrum/gui/qml/components/LightningPaymentDetails.qml index 7da44ded0..e3b15db71 100644 --- a/electrum/gui/qml/components/LightningPaymentDetails.qml +++ b/electrum/gui/qml/components/LightningPaymentDetails.qml @@ -60,6 +60,7 @@ Pane { FormattedAmount { amount: lnpaymentdetails.amount + timestamp: lnpaymentdetails.timestamp } Label { @@ -71,6 +72,7 @@ Pane { FormattedAmount { visible: lnpaymentdetails.amount.msatsInt < 0 amount: lnpaymentdetails.fee + timestamp: lnpaymentdetails.timestamp } Label { diff --git a/electrum/gui/qml/components/TxDetails.qml b/electrum/gui/qml/components/TxDetails.qml index 567cfe136..cf4624b3d 100644 --- a/electrum/gui/qml/components/TxDetails.qml +++ b/electrum/gui/qml/components/TxDetails.qml @@ -90,6 +90,7 @@ Pane { Layout.preferredWidth: 1 Layout.fillWidth: true amount: txdetails.lnAmount.isEmpty ? txdetails.amount : txdetails.lnAmount + timestamp: txdetails.timestamp } Label { @@ -104,6 +105,7 @@ Pane { FormattedAmount { Layout.fillWidth: true amount: txdetails.fee + timestamp: txdetails.timestamp } } diff --git a/electrum/gui/qml/components/controls/FormattedAmount.qml b/electrum/gui/qml/components/controls/FormattedAmount.qml index 04e342d89..ac5e375b9 100644 --- a/electrum/gui/qml/components/controls/FormattedAmount.qml +++ b/electrum/gui/qml/components/controls/FormattedAmount.qml @@ -10,6 +10,8 @@ GridLayout { property bool showAlt: true property bool singleLine: true property bool valid: true + property bool historic: Daemon.fx.historicRates + property int timestamp: 0 columns: !valid ? 1 @@ -42,7 +44,11 @@ GridLayout { function setFiatValue() { if (showAlt) - fiatLabel.text = '(' + Daemon.fx.fiatValue(amount) + ' ' + Daemon.fx.fiatCurrency + ')' + if (historic && timestamp) + fiatLabel.text = '(' + Daemon.fx.fiatValueHistoric(amount, timestamp) + ' ' + Daemon.fx.fiatCurrency + ')' + else + fiatLabel.text = '(' + Daemon.fx.fiatValue(amount) + ' ' + Daemon.fx.fiatCurrency + ')' + } onAmountChanged: setFiatValue() diff --git a/electrum/gui/qml/qelnpaymentdetails.py b/electrum/gui/qml/qelnpaymentdetails.py index 3ea29eb50..49fef7dde 100644 --- a/electrum/gui/qml/qelnpaymentdetails.py +++ b/electrum/gui/qml/qelnpaymentdetails.py @@ -6,6 +6,7 @@ from electrum.util import bfh, format_time from .qetypes import QEAmount from .qewallet import QEWallet + class QELnPaymentDetails(QObject): _logger = get_logger(__name__) @@ -16,9 +17,14 @@ class QELnPaymentDetails(QObject): self._wallet = None self._key = None + self._label = '' self._date = None + self._timestamp = 0 self._fee = QEAmount() self._amount = QEAmount() + self._status = '' + self._phash = '' + self._preimage = '' walletChanged = pyqtSignal() @pyqtProperty(QEWallet, notify=walletChanged) @@ -64,6 +70,10 @@ class QELnPaymentDetails(QObject): def date(self): return self._date + @pyqtProperty(int, notify=detailsChanged) + def timestamp(self): + return self._timestamp + @pyqtProperty(str, notify=detailsChanged) def paymentHash(self): return self._phash @@ -93,6 +103,7 @@ class QELnPaymentDetails(QObject): self._amount.msatsInt = int(tx['amount_msat']) self._label = tx['label'] self._date = format_time(tx['timestamp']) + self._timestamp = tx['timestamp'] self._status = 'settled' # TODO: other states? get_lightning_history is deciding the filter for us :( self._phash = tx['payment_hash'] self._preimage = tx['preimage'] diff --git a/electrum/gui/qml/qetxdetails.py b/electrum/gui/qml/qetxdetails.py index 8bd04c870..8732f9776 100644 --- a/electrum/gui/qml/qetxdetails.py +++ b/electrum/gui/qml/qetxdetails.py @@ -57,6 +57,7 @@ class QETxDetails(QObject, QtEventListener): self._mempool_depth = '' self._date = '' + self._timestamp = 0 self._confirmations = 0 self._header_hash = '' self._short_id = "" @@ -172,6 +173,10 @@ class QETxDetails(QObject, QtEventListener): def date(self): return self._date + @pyqtProperty(int, notify=detailsChanged) + def timestamp(self): + return self._timestamp + @pyqtProperty(int, notify=detailsChanged) def confirmations(self): return self._confirmations @@ -307,6 +312,7 @@ class QETxDetails(QObject, QtEventListener): def update_mined_status(self, tx_mined_info: TxMinedInfo): self._mempool_depth = '' self._date = format_time(tx_mined_info.timestamp) + self._timestamp = tx_mined_info.timestamp self._confirmations = tx_mined_info.conf self._header_hash = tx_mined_info.header_hash self._short_id = tx_mined_info.short_id() or ""