Browse Source

show better descriptions on outputs based on signing wallet

bwt
Craig Raw 5 years ago
parent
commit
5d6bb5e4f9
  1. 2
      drongo
  2. 20
      src/main/java/com/sparrowwallet/sparrow/transaction/OutputController.java
  3. 2
      src/main/resources/com/sparrowwallet/sparrow/transaction/output.fxml

2
drongo

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

20
src/main/java/com/sparrowwallet/sparrow/transaction/OutputController.java

@ -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());

2
src/main/resources/com/sparrowwallet/sparrow/transaction/output.fxml

@ -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" />

Loading…
Cancel
Save