mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
Add input labels into TransactionDiagram along with transaction notes
This commit is contained in:
parent
e1dab3a48e
commit
67ed382f3d
3 changed files with 30 additions and 4 deletions
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -67,6 +67,9 @@
|
|||
</buttons>
|
||||
</SegmentedButton>
|
||||
</Field>
|
||||
<Field text="Notes:" styleClass="label-button">
|
||||
<IdLabel fx:id="txNotes"/>
|
||||
</Field>
|
||||
</Fieldset>
|
||||
</Form>
|
||||
|
||||
|
|
Loading…
Reference in a new issue