mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
add context menu item to addresses table to spend all utxos for an address
This commit is contained in:
parent
59efed9e42
commit
51ba7fc4cf
1 changed files with 10 additions and 0 deletions
|
@ -559,6 +559,16 @@ public class EntryCell extends TreeTableCell<Entry, Entry> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nodeEntry != null && !nodeEntry.getNode().getUnspentTransactionOutputs().isEmpty()) {
|
if(nodeEntry != null && !nodeEntry.getNode().getUnspentTransactionOutputs().isEmpty()) {
|
||||||
|
List<BlockTransactionHashIndex> 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<BlockTransactionHashIndex> unfrozenUtxos = nodeEntry.getNode().getUnspentTransactionOutputs().stream().filter(utxo -> utxo.getStatus() != Status.FROZEN).collect(Collectors.toList());
|
List<BlockTransactionHashIndex> unfrozenUtxos = nodeEntry.getNode().getUnspentTransactionOutputs().stream().filter(utxo -> utxo.getStatus() != Status.FROZEN).collect(Collectors.toList());
|
||||||
if(!unfrozenUtxos.isEmpty()) {
|
if(!unfrozenUtxos.isEmpty()) {
|
||||||
MenuItem freezeUtxos = new MenuItem("Freeze UTXOs");
|
MenuItem freezeUtxos = new MenuItem("Freeze UTXOs");
|
||||||
|
|
Loading…
Reference in a new issue