1
0

qml: improve info text for incomplete transactions and transactions in mempool on transaction details page.

This commit is contained in:
Sander van Grieken
2023-12-12 12:11:37 +01:00
parent c1b359d43f
commit 297f971fae
2 changed files with 29 additions and 9 deletions

View File

@@ -64,33 +64,46 @@ Pane {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.bottomMargin: constants.paddingLarge
visible: txdetails.canBump || txdetails.canCpfp || txdetails.canCancel || txdetails.canRemove || txdetails.isUnrelated
visible: txdetails.isUnrelated || !txdetails.isMined
text: txdetails.isUnrelated
? qsTr('Transaction is unrelated to this wallet')
: txdetails.canRemove
? txdetails.lockDelay
? qsTr('Transaction is unrelated to this wallet.')
: txdetails.inMempool
? qsTr('This transaction is still unconfirmed.') + '\n' +
(txdetails.canBump || txdetails.canCpfp || txdetails.canCancel
? txdetails.canCancel
? qsTr('You can bump its fee to speed up its confirmation, or cancel this transaction.')
: qsTr('You can bump its fee to speed up its confirmation.')
: '')
: txdetails.lockDelay
? qsTr('This transaction is local to your wallet and locked for the next %1 blocks.').arg(txdetails.lockDelay)
: qsTr('This transaction is local to your wallet. It has not been published yet.')
: qsTr('This transaction is still unconfirmed.') + '\n' + (txdetails.canCancel
? qsTr('You can bump its fee to speed up its confirmation, or cancel this transaction')
: qsTr('You can bump its fee to speed up its confirmation'))
: txdetails.isComplete
? qsTr('This transaction is local to your wallet. It has not been published yet.')
: txdetails.canSign
? qsTr('This transaction is not fully signed and can be signed by this wallet.')
: qsTr('This transaction is not fully signed.') + '\n' +
(txdetails.wallet.isWatchOnly
? qsTr('Present this transaction to the signing wallet.')
: qsTr('Present this transaction to the next cosigner.'))
iconStyle: txdetails.isUnrelated
? InfoTextArea.IconStyle.Warn
: InfoTextArea.IconStyle.Info
}
Label {
Layout.preferredWidth: 1
Layout.fillWidth: true
visible: !txdetails.isUnrelated && txdetails.amount.satsInt != 0
text: txdetails.amount.satsInt > 0
? qsTr('Amount received onchain')
: qsTr('Amount sent onchain')
color: Material.accentColor
wrapMode: Text.Wrap
}
FormattedAmount {
visible: !txdetails.isUnrelated && txdetails.amount.satsInt != 0
Layout.preferredWidth: 1
Layout.fillWidth: true
visible: !txdetails.isUnrelated && txdetails.amount.satsInt != 0
amount: txdetails.amount
timestamp: txdetails.timestamp
}

View File

@@ -60,6 +60,7 @@ class QETxDetails(QObject, QtEventListener):
self._should_confirm = False
self._mempool_depth = ''
self._in_mempool = False
self._date = ''
self._timestamp = 0
@@ -178,6 +179,10 @@ class QETxDetails(QObject, QtEventListener):
def mempoolDepth(self):
return self._mempool_depth
@pyqtProperty(bool, notify=detailsChanged)
def inMempool(self):
return self._in_mempool
@pyqtProperty(str, notify=detailsChanged)
def date(self):
return self._date
@@ -298,12 +303,14 @@ class QETxDetails(QObject, QtEventListener):
should_reject = False
self._lock_delay = 0
self._in_mempool = False
self._is_mined = False if not txinfo.tx_mined_status else txinfo.tx_mined_status.height > 0
if self._is_mined:
self.update_mined_status(txinfo.tx_mined_status)
else:
if txinfo.tx_mined_status.height in [TX_HEIGHT_UNCONFIRMED, TX_HEIGHT_UNCONF_PARENT]:
self._mempool_depth = self._wallet.wallet.config.depth_tooltip(txinfo.mempool_depth_bytes)
self._in_mempool = True
elif txinfo.tx_mined_status.height == TX_HEIGHT_FUTURE:
self._lock_delay = txinfo.tx_mined_status.wanted_height - self._wallet.wallet.adb.get_local_height()
if isinstance(self._tx, PartialTransaction):