mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-04 21:36:45 +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.Utils;
|
||||||
import com.sparrowwallet.drongo.protocol.Sha256Hash;
|
import com.sparrowwallet.drongo.protocol.Sha256Hash;
|
||||||
import com.sparrowwallet.sparrow.AppController;
|
import com.sparrowwallet.sparrow.AppController;
|
||||||
import com.sparrowwallet.sparrow.io.Storage;
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.beans.binding.BooleanBinding;
|
import javafx.beans.binding.BooleanBinding;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
|
import javafx.scene.text.Font;
|
||||||
import org.controlsfx.control.textfield.CustomTextField;
|
import org.controlsfx.control.textfield.CustomTextField;
|
||||||
import org.controlsfx.control.textfield.TextFields;
|
import org.controlsfx.control.textfield.TextFields;
|
||||||
import org.controlsfx.glyphfont.FontAwesome;
|
import org.controlsfx.glyphfont.FontAwesome;
|
||||||
|
@ -23,13 +23,14 @@ public class TransactionIdDialog extends Dialog<Sha256Hash> {
|
||||||
|
|
||||||
public TransactionIdDialog() {
|
public TransactionIdDialog() {
|
||||||
this.txid = (CustomTextField) TextFields.createClearableTextField();
|
this.txid = (CustomTextField) TextFields.createClearableTextField();
|
||||||
|
txid.setFont(Font.font ("Courier", txid.getFont().getSize()));
|
||||||
final DialogPane dialogPane = getDialogPane();
|
final DialogPane dialogPane = getDialogPane();
|
||||||
|
|
||||||
setTitle("Load Transaction");
|
setTitle("Load Transaction");
|
||||||
dialogPane.setHeaderText("Enter the transaction ID:");
|
dialogPane.setHeaderText("Enter the transaction ID:");
|
||||||
dialogPane.getStylesheets().add(AppController.class.getResource("general.css").toExternalForm());
|
dialogPane.getStylesheets().add(AppController.class.getResource("general.css").toExternalForm());
|
||||||
dialogPane.getButtonTypes().addAll(ButtonType.CANCEL);
|
dialogPane.getButtonTypes().addAll(ButtonType.CANCEL);
|
||||||
dialogPane.setPrefWidth(380);
|
dialogPane.setPrefWidth(550);
|
||||||
dialogPane.setPrefHeight(200);
|
dialogPane.setPrefHeight(200);
|
||||||
|
|
||||||
Glyph wallet = new Glyph("FontAwesome", FontAwesome.Glyph.BITCOIN);
|
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.BlockTransactionFetchedEvent;
|
||||||
import com.sparrowwallet.sparrow.event.TransactionChangedEvent;
|
import com.sparrowwallet.sparrow.event.TransactionChangedEvent;
|
||||||
import com.sparrowwallet.sparrow.event.TransactionLocktimeChangedEvent;
|
import com.sparrowwallet.sparrow.event.TransactionLocktimeChangedEvent;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
@ -250,11 +251,16 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockTransaction inputTx = inputTransactions.get(input.getOutpoint().getHash());
|
BlockTransaction inputTx = inputTransactions.get(input.getOutpoint().getHash());
|
||||||
|
if(inputTx == null) {
|
||||||
|
inputTx = headersForm.getInputTransactions().get(input.getOutpoint().getHash());
|
||||||
|
}
|
||||||
|
|
||||||
if(inputTx == null) {
|
if(inputTx == null) {
|
||||||
if(headersForm.allInputsFetched()) {
|
if(headersForm.allInputsFetched()) {
|
||||||
throw new IllegalStateException("Cannot find transaction for hash " + input.getOutpoint().getHash());
|
throw new IllegalStateException("Cannot find transaction for hash " + input.getOutpoint().getHash());
|
||||||
} else {
|
} else {
|
||||||
//Still paging
|
//Still paging
|
||||||
|
fee.setText("Unknown (" + headersForm.getMaxInputFetched() + " of " + headersForm.getTransaction().getInputs().size() + " inputs fetched)");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,6 +324,12 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
id.setText(headersForm.getTransaction().calculateTxId(false).toString());
|
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
|
@Subscribe
|
||||||
public void transactionChanged(TransactionChangedEvent event) {
|
public void transactionChanged(TransactionChangedEvent event) {
|
||||||
if(headersForm.getTransaction().equals(event.getTransaction())) {
|
if(headersForm.getTransaction().equals(event.getTransaction())) {
|
||||||
|
|
|
@ -493,7 +493,7 @@ public class InputController extends TransactionFormController implements Initia
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void transctionLocktimeChanged(TransactionLocktimeChangedEvent event) {
|
public void transactionLocktimeChanged(TransactionLocktimeChangedEvent event) {
|
||||||
if(event.getTransaction().equals(inputForm.getTransaction())) {
|
if(event.getTransaction().equals(inputForm.getTransaction())) {
|
||||||
locktimeAbsolute.setText(Long.toString(event.getTransaction().getLocktime()));
|
locktimeAbsolute.setText(Long.toString(event.getTransaction().getLocktime()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,11 +124,16 @@ public class InputsController extends TransactionFormController implements Initi
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
BlockTransaction inputTx = inputTransactions.get(input.getOutpoint().getHash());
|
BlockTransaction inputTx = inputTransactions.get(input.getOutpoint().getHash());
|
||||||
|
if(inputTx == null) {
|
||||||
|
inputTx = inputsForm.getInputTransactions().get(input.getOutpoint().getHash());
|
||||||
|
}
|
||||||
|
|
||||||
if(inputTx == null) {
|
if(inputTx == null) {
|
||||||
if(inputsForm.allInputsFetched()) {
|
if(inputsForm.allInputsFetched()) {
|
||||||
throw new IllegalStateException("Cannot find transaction for hash " + input.getOutpoint().getHash());
|
throw new IllegalStateException("Cannot find transaction for hash " + input.getOutpoint().getHash());
|
||||||
} else {
|
} else {
|
||||||
//Still paging
|
//Still paging
|
||||||
|
total.setText("Unknown (" + inputsForm.getMaxInputFetched() + " of " + inputsForm.getTransaction().getInputs().size() + " inputs fetched)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,7 +156,7 @@ public class InputsController extends TransactionFormController implements Initi
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void blockTransactionFetched(BlockTransactionFetchedEvent event) {
|
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());
|
updateBlockTransactionInputs(event.getInputTransactions());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class TransactionData {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean allInputsFetched() {
|
public boolean allInputsFetched() {
|
||||||
return minInputFetched == 0 && maxInputFetched == transaction.getOutputs().size();
|
return minInputFetched == 0 && maxInputFetched == transaction.getInputs().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BlockTransaction> getOutputTransactions() {
|
public List<BlockTransaction> getOutputTransactions() {
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
<?import com.sparrowwallet.sparrow.control.CopyableLabel?>
|
<?import com.sparrowwallet.sparrow.control.CopyableLabel?>
|
||||||
<?import com.sparrowwallet.sparrow.control.IdLabel?>
|
<?import com.sparrowwallet.sparrow.control.IdLabel?>
|
||||||
<?import com.sparrowwallet.sparrow.control.CoinLabel?>
|
<?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">
|
<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>
|
<padding>
|
||||||
|
@ -28,8 +30,13 @@
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<Form GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2">
|
<Form GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2">
|
||||||
<Fieldset text="Transaction" inputGrow="SOMETIMES" wrapWidth="620">
|
<Fieldset text="Transaction" inputGrow="SOMETIMES" wrapWidth="620">
|
||||||
<Field text="Txid:">
|
<Field text="Txid:" styleClass="label-button">
|
||||||
<IdLabel fx:id="id"/>
|
<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>
|
</Field>
|
||||||
</Fieldset>
|
</Fieldset>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
Loading…
Reference in a new issue