mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-02 20:36:44 +00:00
tx viewer fix various
This commit is contained in:
parent
9cd8a9b9ee
commit
0cd97649cc
6 changed files with 31 additions and 6 deletions
|
@ -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() {
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
<?import com.sparrowwallet.sparrow.control.CopyableLabel?>
|
||||
<?import com.sparrowwallet.sparrow.control.IdLabel?>
|
||||
<?import com.sparrowwallet.sparrow.control.CoinLabel?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import org.controlsfx.glyphfont.Glyph?>
|
||||
|
||||
<GridPane hgap="10.0" vgap="10.0" styleClass="tx-pane" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.transaction.HeadersController" stylesheets="@headers.css, @transaction.css, @../general.css">
|
||||
<padding>
|
||||
|
@ -28,8 +30,13 @@
|
|||
</rowConstraints>
|
||||
<Form GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2">
|
||||
<Fieldset text="Transaction" inputGrow="SOMETIMES" wrapWidth="620">
|
||||
<Field text="Txid:">
|
||||
<Field text="Txid:" styleClass="label-button">
|
||||
<IdLabel fx:id="id"/>
|
||||
<Button maxWidth="25" minWidth="-Infinity" prefWidth="30" text="Cy" onAction="#copyId">
|
||||
<graphic>
|
||||
<Glyph fontFamily="FontAwesome" icon="COPY" prefWidth="15" />
|
||||
</graphic>
|
||||
</Button>
|
||||
</Field>
|
||||
</Fieldset>
|
||||
</Form>
|
||||
|
|
Loading…
Reference in a new issue