From 51ba7fc4cf2ee18c4d6fee48c13a3a79ab0f568b Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 5 Sep 2022 14:37:05 +0200 Subject: [PATCH] add context menu item to addresses table to spend all utxos for an address --- .../com/sparrowwallet/sparrow/control/EntryCell.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java b/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java index d8626a9b..def9ea7f 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java @@ -559,6 +559,16 @@ public class EntryCell extends TreeTableCell { } if(nodeEntry != null && !nodeEntry.getNode().getUnspentTransactionOutputs().isEmpty()) { + List utxos = nodeEntry.getNode().getUnspentTransactionOutputs().stream().collect(Collectors.toList()); + MenuItem spendUtxos = new MenuItem("Spend UTXOs"); + spendUtxos.setGraphic(getSendGlyph()); + spendUtxos.setOnAction(AE -> { + hide(); + EventManager.get().post(new SendActionEvent(nodeEntry.getWallet(), utxos)); + Platform.runLater(() -> EventManager.get().post(new SpendUtxoEvent(nodeEntry.getWallet(), utxos))); + }); + getItems().add(spendUtxos); + List unfrozenUtxos = nodeEntry.getNode().getUnspentTransactionOutputs().stream().filter(utxo -> utxo.getStatus() != Status.FROZEN).collect(Collectors.toList()); if(!unfrozenUtxos.isEmpty()) { MenuItem freezeUtxos = new MenuItem("Freeze UTXOs");