mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2026-08-10 08:37:05 +00:00
tx viewer fix various
This commit is contained in:
@@ -3,12 +3,12 @@ package com.sparrowwallet.sparrow.control;
|
||||
import com.sparrowwallet.drongo.Utils;
|
||||
import com.sparrowwallet.drongo.protocol.Sha256Hash;
|
||||
import com.sparrowwallet.sparrow.AppController;
|
||||
import com.sparrowwallet.sparrow.io.Storage;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.binding.BooleanBinding;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import org.controlsfx.control.textfield.CustomTextField;
|
||||
import org.controlsfx.control.textfield.TextFields;
|
||||
import org.controlsfx.glyphfont.FontAwesome;
|
||||
@@ -23,13 +23,14 @@ public class TransactionIdDialog extends Dialog<Sha256Hash> {
|
||||
|
||||
public TransactionIdDialog() {
|
||||
this.txid = (CustomTextField) TextFields.createClearableTextField();
|
||||
txid.setFont(Font.font ("Courier", txid.getFont().getSize()));
|
||||
final DialogPane dialogPane = getDialogPane();
|
||||
|
||||
setTitle("Load Transaction");
|
||||
dialogPane.setHeaderText("Enter the transaction ID:");
|
||||
dialogPane.getStylesheets().add(AppController.class.getResource("general.css").toExternalForm());
|
||||
dialogPane.getButtonTypes().addAll(ButtonType.CANCEL);
|
||||
dialogPane.setPrefWidth(380);
|
||||
dialogPane.setPrefWidth(550);
|
||||
dialogPane.setPrefHeight(200);
|
||||
|
||||
Glyph wallet = new Glyph("FontAwesome", FontAwesome.Glyph.BITCOIN);
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.sparrowwallet.sparrow.control.CopyableLabel;
|
||||
import com.sparrowwallet.sparrow.event.BlockTransactionFetchedEvent;
|
||||
import com.sparrowwallet.sparrow.event.TransactionChangedEvent;
|
||||
import com.sparrowwallet.sparrow.event.TransactionLocktimeChangedEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
@@ -250,11 +251,16 @@ public class HeadersController extends TransactionFormController implements Init
|
||||
}
|
||||
|
||||
BlockTransaction inputTx = inputTransactions.get(input.getOutpoint().getHash());
|
||||
if(inputTx == null) {
|
||||
inputTx = headersForm.getInputTransactions().get(input.getOutpoint().getHash());
|
||||
}
|
||||
|
||||
if(inputTx == null) {
|
||||
if(headersForm.allInputsFetched()) {
|
||||
throw new IllegalStateException("Cannot find transaction for hash " + input.getOutpoint().getHash());
|
||||
} else {
|
||||
//Still paging
|
||||
fee.setText("Unknown (" + headersForm.getMaxInputFetched() + " of " + headersForm.getTransaction().getInputs().size() + " inputs fetched)");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -318,6 +324,12 @@ public class HeadersController extends TransactionFormController implements Init
|
||||
id.setText(headersForm.getTransaction().calculateTxId(false).toString());
|
||||
}
|
||||
|
||||
public void copyId(ActionEvent event) {
|
||||
ClipboardContent content = new ClipboardContent();
|
||||
content.putString(headersForm.getTransaction().getTxId().toString());
|
||||
Clipboard.getSystemClipboard().setContent(content);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void transactionChanged(TransactionChangedEvent event) {
|
||||
if(headersForm.getTransaction().equals(event.getTransaction())) {
|
||||
|
||||
@@ -493,7 +493,7 @@ public class InputController extends TransactionFormController implements Initia
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void transctionLocktimeChanged(TransactionLocktimeChangedEvent event) {
|
||||
public void transactionLocktimeChanged(TransactionLocktimeChangedEvent event) {
|
||||
if(event.getTransaction().equals(inputForm.getTransaction())) {
|
||||
locktimeAbsolute.setText(Long.toString(event.getTransaction().getLocktime()));
|
||||
}
|
||||
|
||||
@@ -124,11 +124,16 @@ public class InputsController extends TransactionFormController implements Initi
|
||||
return;
|
||||
} else {
|
||||
BlockTransaction inputTx = inputTransactions.get(input.getOutpoint().getHash());
|
||||
if(inputTx == null) {
|
||||
inputTx = inputsForm.getInputTransactions().get(input.getOutpoint().getHash());
|
||||
}
|
||||
|
||||
if(inputTx == null) {
|
||||
if(inputsForm.allInputsFetched()) {
|
||||
throw new IllegalStateException("Cannot find transaction for hash " + input.getOutpoint().getHash());
|
||||
} else {
|
||||
//Still paging
|
||||
total.setText("Unknown (" + inputsForm.getMaxInputFetched() + " of " + inputsForm.getTransaction().getInputs().size() + " inputs fetched)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -151,7 +156,7 @@ public class InputsController extends TransactionFormController implements Initi
|
||||
|
||||
@Subscribe
|
||||
public void blockTransactionFetched(BlockTransactionFetchedEvent event) {
|
||||
if(event.getTxId().equals(inputsForm.getTransaction().getTxId()) && inputsForm.getPsbt() != null) {
|
||||
if(event.getTxId().equals(inputsForm.getTransaction().getTxId()) && inputsForm.getPsbt() == null) {
|
||||
updateBlockTransactionInputs(event.getInputTransactions());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class TransactionData {
|
||||
}
|
||||
|
||||
public boolean allInputsFetched() {
|
||||
return minInputFetched == 0 && maxInputFetched == transaction.getOutputs().size();
|
||||
return minInputFetched == 0 && maxInputFetched == transaction.getInputs().size();
|
||||
}
|
||||
|
||||
public List<BlockTransaction> getOutputTransactions() {
|
||||
|
||||
Reference in New Issue
Block a user