QML: show onchain and offchain amounts for groups in txdetails
This commit is contained in:
@@ -68,13 +68,21 @@ Pane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
visible: !txdetails.isUnrelated && txdetails.lnAmount.satsInt == 0
|
visible: !txdetails.isUnrelated && txdetails.amount.satsInt != 0
|
||||||
text: txdetails.amount.satsInt > 0
|
text: txdetails.amount.satsInt > 0
|
||||||
? qsTr('Amount received')
|
? qsTr('Amount received onchain')
|
||||||
: qsTr('Amount sent')
|
: qsTr('Amount sent onchain')
|
||||||
color: Material.accentColor
|
color: Material.accentColor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FormattedAmount {
|
||||||
|
visible: !txdetails.isUnrelated && txdetails.amount.satsInt != 0
|
||||||
|
Layout.preferredWidth: 1
|
||||||
|
Layout.fillWidth: true
|
||||||
|
amount: txdetails.amount
|
||||||
|
timestamp: txdetails.timestamp
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
visible: !txdetails.isUnrelated && txdetails.lnAmount.satsInt != 0
|
visible: !txdetails.isUnrelated && txdetails.lnAmount.satsInt != 0
|
||||||
@@ -86,7 +94,7 @@ Pane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FormattedAmount {
|
FormattedAmount {
|
||||||
visible: !txdetails.isUnrelated
|
visible: !txdetails.isUnrelated && txdetails.lnAmount.satsInt != 0
|
||||||
Layout.preferredWidth: 1
|
Layout.preferredWidth: 1
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
amount: txdetails.lnAmount.isEmpty ? txdetails.amount : txdetails.lnAmount
|
amount: txdetails.lnAmount.isEmpty ? txdetails.amount : txdetails.lnAmount
|
||||||
|
|||||||
@@ -284,10 +284,18 @@ class QETxDetails(QObject, QtEventListener):
|
|||||||
self._mempool_depth = self._wallet.wallet.config.depth_tooltip(txinfo.mempool_depth_bytes)
|
self._mempool_depth = self._wallet.wallet.config.depth_tooltip(txinfo.mempool_depth_bytes)
|
||||||
|
|
||||||
if self._wallet.wallet.lnworker:
|
if self._wallet.wallet.lnworker:
|
||||||
|
# Calling lnworker.get_onchain_history and wallet.get_full_history here
|
||||||
|
# is inefficient. We should probably pass the tx_item to the constructor.
|
||||||
lnworker_history = self._wallet.wallet.lnworker.get_onchain_history()
|
lnworker_history = self._wallet.wallet.lnworker.get_onchain_history()
|
||||||
if self._txid in lnworker_history:
|
if self._txid in lnworker_history:
|
||||||
item = lnworker_history[self._txid]
|
item = lnworker_history[self._txid]
|
||||||
self._lnamount.satsInt = int(item['amount_msat'] / 1000)
|
group_id = item.get('group_id')
|
||||||
|
if group_id:
|
||||||
|
full_history = self._wallet.wallet.get_full_history()
|
||||||
|
group_item = full_history['group:'+ group_id]
|
||||||
|
self._lnamount.satsInt = int(group_item['ln_value'].value)
|
||||||
|
else:
|
||||||
|
self._lnamount.satsInt = int(item['amount_msat'] / 1000)
|
||||||
else:
|
else:
|
||||||
self._lnamount.satsInt = 0
|
self._lnamount.satsInt = 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user