Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add input labels into TransactionDiagram along with transaction notes #1506

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,18 @@ private Pane getInputsLabels(List<Map<BlockTransactionHashIndex, WalletNode>> di

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()) {
Expand All @@ -448,12 +455,15 @@ private Pane getInputsLabels(List<Map<BlockTransactionHashIndex, WalletNode>> di
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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public class HeadersController extends TransactionFormController implements Init
@FXML
private IdLabel id;

@FXML
private IdLabel txNotes;

@FXML
private ToggleButton copyTxid;

Expand Down Expand Up @@ -860,7 +863,17 @@ public BlockHeightContextMenu(BlockTransaction blockTransaction) {
}

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
</buttons>
</SegmentedButton>
</Field>
<Field text="Notes:" styleClass="label-button">
<IdLabel fx:id="txNotes"/>
</Field>
</Fieldset>
</Form>

Expand Down