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