qml: use FormattedAmount in LightningPaymentDetails, formatter and fx now use millisats if available, else sats
This commit is contained in:
@@ -12,10 +12,7 @@ Pane {
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
// property string title: qsTr("Lightning payment details")
|
||||
|
||||
property string key
|
||||
|
||||
property alias label: lnpaymentdetails.label
|
||||
|
||||
signal detailsChanged
|
||||
@@ -70,14 +67,8 @@ Pane {
|
||||
color: Material.accentColor
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
text: Config.formatMilliSats(lnpaymentdetails.amount)
|
||||
}
|
||||
Label {
|
||||
text: Config.baseUnit
|
||||
color: Material.accentColor
|
||||
}
|
||||
FormattedAmount {
|
||||
amount: lnpaymentdetails.amount
|
||||
}
|
||||
|
||||
Label {
|
||||
|
||||
@@ -9,7 +9,7 @@ RowLayout {
|
||||
required property Amount amount
|
||||
property bool showAlt: true
|
||||
Label {
|
||||
text: Config.formatSats(amount)
|
||||
text: amount.msatsInt > 0 ? Config.formatMilliSats(amount) : Config.formatSats(amount)
|
||||
font.family: FixedFont
|
||||
}
|
||||
Label {
|
||||
|
||||
@@ -101,7 +101,7 @@ class QEFX(QObject, QtEventListener):
|
||||
def fiatValue(self, satoshis, plain=True):
|
||||
rate = self.fx.exchange_rate()
|
||||
if isinstance(satoshis, QEAmount):
|
||||
satoshis = satoshis.satsInt
|
||||
satoshis = satoshis.msatsInt / 1000 if satoshis.msatsInt > 0 else satoshis.satsInt
|
||||
else:
|
||||
try:
|
||||
sd = Decimal(satoshis)
|
||||
@@ -118,7 +118,7 @@ class QEFX(QObject, QtEventListener):
|
||||
@pyqtSlot(QEAmount, str, bool, result=str)
|
||||
def fiatValueHistoric(self, satoshis, timestamp, plain=True):
|
||||
if isinstance(satoshis, QEAmount):
|
||||
satoshis = satoshis.satsInt
|
||||
satoshis = satoshis.msatsInt / 1000 if satoshis.msatsInt > 0 else satoshis.satsInt
|
||||
else:
|
||||
try:
|
||||
sd = Decimal(satoshis)
|
||||
|
||||
Reference in New Issue
Block a user