diff --git a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java index 72c5b239..673dda81 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java @@ -429,11 +429,18 @@ public class TransactionDiagram extends GridPane { Tooltip tooltip = new Tooltip(); Long inputValue = null; + String inputLabel = input.getLabel(); if(walletNode != null) { inputValue = input.getValue(); Wallet nodeWallet = walletNode.getWallet(); - tooltip.setText("Spending " + getSatsValue(inputValue) + " sats from " + (isFinal() ? nodeWallet.getFullDisplayName() : (nodeWallet.isNested() ? nodeWallet.getDisplayName() : "")) + " " + walletNode + "\n" + - input.getHashAsString() + ":" + input.getIndex() + "\n" + walletNode.getAddress()); + StringJoiner joiner = new StringJoiner("\n"); + joiner.add("Spending " + getSatsValue(inputValue) + " sats from " + (isFinal() ? nodeWallet.getFullDisplayName() : (nodeWallet.isNested() ? nodeWallet.getDisplayName() : "")) + " " + walletNode); + joiner.add(input.getHashAsString() + ":" + input.getIndex()); + joiner.add(walletNode.getAddress().toString()); + if (inputLabel != null) { + joiner.add(inputLabel); + } + tooltip.setText(joiner.toString()); tooltip.getStyleClass().add("input-label"); if(input.getLabel() == null || input.getLabel().isEmpty()) { @@ -448,12 +455,15 @@ public class TransactionDiagram extends GridPane { ContextMenu contextMenu = new LabelContextMenu(walletNode.getAddress(), inputValue); label.setContextMenu(contextMenu); } else { - if(input instanceof PayjoinBlockTransactionHashIndex) { + if (input instanceof PayjoinBlockTransactionHashIndex) { tooltip.setText("Added once transaction is signed and sent to the payjoin server"); } else if(input instanceof AdditionalBlockTransactionHashIndex additionalReference) { inputValue = input.getValue(); StringJoiner joiner = new StringJoiner("\n"); joiner.add("Spending " + getSatsValue(inputValue) + " sats from" + (isExpanded() ? ":" : " (click to expand):")); + if (inputLabel != null) { + joiner.add(inputLabel); + } for(BlockTransactionHashIndex additionalInput : additionalReference.getAdditionalInputs()) { joiner.add(getInputDescription(additionalInput)); } diff --git a/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java b/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java index cb3bed45..ae20fdf2 100644 --- a/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java +++ b/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java @@ -89,6 +89,9 @@ public class HeadersController extends TransactionFormController implements Init @FXML private IdLabel id; + @FXML + private IdLabel txNotes; + @FXML private ToggleButton copyTxid; @@ -860,7 +863,17 @@ public class HeadersController extends TransactionFormController implements Init } private void updateTxId() { - id.setText(headersForm.getTransaction().calculateTxId(false).toString()); + Sha256Hash txid = headersForm.getTransaction().calculateTxId(false); + id.setText(txid.toString()); + txNotes.setText(headersForm.getName()); + + Wallet w = getWalletFromTransactionInputs(); + if (w != null) { + BlockTransaction txn = w.getWalletTransaction(txid); + if (txn != null) { + txNotes.setText(txn.getLabel()); + } + } if(!headersForm.isTransactionFinalized()) { addStyleClass(id, UNFINALIZED_TXID_CLASS); addStyleClass(size, UNFINALIZED_TXID_CLASS); diff --git a/src/main/resources/com/sparrowwallet/sparrow/transaction/headers.fxml b/src/main/resources/com/sparrowwallet/sparrow/transaction/headers.fxml index b6b92ac6..01bf0c89 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/transaction/headers.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/transaction/headers.fxml @@ -67,6 +67,9 @@ + + +