show better descriptions on outputs based on signing wallet

This commit is contained in:
Craig Raw 2020-08-31 11:22:15 +02:00
parent b808222faa
commit 5d6bb5e4f9
3 changed files with 18 additions and 6 deletions

2
drongo

@ -1 +1 @@
Subproject commit 10035278543d9ca90b11ae3d396edc3e6131fee2
Subproject commit 59d610f5395cab69a33cf675b3fb116f7e09394c

View file

@ -1,6 +1,7 @@
package com.sparrowwallet.sparrow.transaction;
import com.google.common.eventbus.Subscribe;
import com.sparrowwallet.drongo.KeyPurpose;
import com.sparrowwallet.drongo.address.Address;
import com.sparrowwallet.drongo.protocol.NonStandardScriptException;
import com.sparrowwallet.drongo.protocol.TransactionInput;
@ -39,7 +40,7 @@ public class OutputController extends TransactionFormController implements Initi
private CopyableLabel to;
@FXML
private CopyableLabel change;
private CopyableLabel walletType;
@FXML
private AddressLabel address;
@ -83,10 +84,21 @@ public class OutputController extends TransactionFormController implements Initi
//ignore
}
change.managedProperty().bind(change.visibleProperty());
change.setVisible(false);
walletType.managedProperty().bind(walletType.visibleProperty());
walletType.setVisible(false);
outputForm.signingWalletProperty().addListener((observable, oldValue, signingWallet) -> {
change.setVisible(signingWallet != null && signingWallet.isWalletOutputScript(txOutput.getScript()));
if(signingWallet != null) {
walletType.setVisible(true);
if(signingWallet.getWalletOutputScripts(KeyPurpose.RECEIVE).containsKey(txOutput.getScript())) {
walletType.setText("(Consolidation)");
} else if(signingWallet.getWalletOutputScripts(KeyPurpose.CHANGE).containsKey(txOutput.getScript())) {
walletType.setText("(Change)");
} else {
walletType.setText("(Payment)");
}
} else {
walletType.setVisible(false);
}
});
spentField.managedProperty().bind(spentField.visibleProperty());

View file

@ -34,7 +34,7 @@
<CoinLabel fx:id="value"/>
<CopyableLabel fx:id="to" text="to" />
<AddressLabel fx:id="address" />
<CopyableLabel fx:id="change" text="(Change)" />
<CopyableLabel fx:id="walletType" />
</Field>
<Field fx:id="spentField" text="Spent?">
<Label fx:id="spent" />