use of com.sparrowwallet.drongo.protocol.NonStandardScriptException in project sparrow by sparrowwallet.
the class TransactionFormController method addPieData.
protected void addPieData(PieChart pie, List<TransactionOutput> outputs) {
ObservableList<PieChart.Data> outputsPieData = FXCollections.observableArrayList();
long totalAmt = 0;
for (int i = 0; i < outputs.size(); i++) {
TransactionOutput output = outputs.get(i);
String name = "#" + i;
try {
Address[] addresses = output.getScript().getToAddresses();
if (addresses.length == 1) {
name = name + " " + addresses[0].getAddress();
} else {
name = name + " [" + addresses[0].getAddress() + ",...]";
}
} catch (NonStandardScriptException e) {
// ignore
}
totalAmt += output.getValue();
outputsPieData.add(new PieChart.Data(name, output.getValue()));
}
addPieData(pie, outputsPieData);
}
use of com.sparrowwallet.drongo.protocol.NonStandardScriptException in project sparrow by sparrowwallet.
the class OutputController method initializeView.
public void initializeView() {
TransactionOutput txOutput = outputForm.getTransactionOutput();
outputForm.signingWalletProperty().addListener((observable, oldValue, signingWallet) -> {
updateOutputLegendFromWallet(txOutput, signingWallet);
});
updateOutputLegendFromWallet(txOutput, outputForm.getSigningWallet());
value.setValue(txOutput.getValue());
to.setVisible(false);
try {
Address[] addresses = txOutput.getScript().getToAddresses();
to.setVisible(true);
if (addresses.length == 1) {
address.setAddress(addresses[0]);
} else {
address.setText("multiple addresses");
}
} catch (NonStandardScriptException e) {
// ignore
}
spentField.managedProperty().bind(spentField.visibleProperty());
spentByField.managedProperty().bind(spentByField.visibleProperty());
spentByField.setVisible(false);
if (outputForm.getPsbt() != null) {
spent.setText("Unspent");
} else if (outputForm.getOutputTransactions() != null) {
updateSpent(outputForm.getOutputTransactions());
} else {
spent.setText("Unknown");
}
initializeScriptField(scriptPubKeyArea);
scriptPubKeyArea.clear();
scriptPubKeyArea.appendScript(txOutput.getScript(), null, null);
}
Aggregations