mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-02 12:26:45 +00:00
output pane
This commit is contained in:
parent
924e7d6b45
commit
5ad85eb154
8 changed files with 128 additions and 42 deletions
10
README.md
10
README.md
|
@ -1,9 +1,11 @@
|
|||
# Sparrow
|
||||
Bitcoin Transaction Editor
|
||||
Bitcoin Wallet & Transaction Editor
|
||||
|
||||
To clone this project, use `git clone --recursive git@github.com:craigraw/sparrow.git`
|
||||
|
||||
## Various ways to hex dump a file without spaces:
|
||||
xxd -p file | tr -d '\n'
|
||||
hexdump -ve '1/1 "%.2x"'
|
||||
od -t x1 -An file | tr -d '\n '
|
||||
`xxd -p file | tr -d '\n'`
|
||||
|
||||
`hexdump -ve '1/1 "%.2x"'`
|
||||
|
||||
`od -t x1 -An file | tr -d '\n '`
|
|
@ -108,12 +108,12 @@ public class InputController extends TransactionFormController implements Initia
|
|||
|
||||
//TODO: Enable select outpoint when wallet present
|
||||
outpointSelect.setDisable(true);
|
||||
initializeScriptFields(txInput);
|
||||
initializeScriptFields(txInput, psbtInput);
|
||||
initializeStatusFields(txInput);
|
||||
initializeLocktimeFields(txInput);
|
||||
}
|
||||
|
||||
private void initializeScriptFields(TransactionInput txInput) {
|
||||
private void initializeScriptFields(TransactionInput txInput, PSBTInput psbtInput) {
|
||||
//TODO: Is this safe?
|
||||
Script redeemScript = txInput.getScriptSig().getFirstNestedScript();
|
||||
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import com.sparrowwallet.drongo.protocol.TransactionOutput;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.TextField;
|
||||
import org.fxmisc.richtext.CodeArea;
|
||||
import tornadofx.control.Fieldset;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
@ -8,12 +13,32 @@ import java.util.ResourceBundle;
|
|||
public class OutputController extends TransactionFormController implements Initializable {
|
||||
private OutputForm outputForm;
|
||||
|
||||
@FXML
|
||||
private Fieldset outputFieldset;
|
||||
|
||||
@FXML
|
||||
private TextField value;
|
||||
|
||||
@FXML
|
||||
private CodeArea scriptPubKeyArea;
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
|
||||
}
|
||||
|
||||
public void initializeView() {
|
||||
TransactionOutput txOutput = outputForm.getTransactionOutput();
|
||||
|
||||
outputFieldset.setText("Output #" + txOutput.getIndex());
|
||||
value.setText(txOutput.getValue() + " sats");
|
||||
|
||||
scriptPubKeyArea.clear();
|
||||
appendScript(scriptPubKeyArea, txOutput.getScript(), null, null);
|
||||
}
|
||||
|
||||
public void setModel(OutputForm form) {
|
||||
this.outputForm = form;
|
||||
initializeView();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,23 @@ public abstract class TransactionFormController {
|
|||
}
|
||||
|
||||
protected void appendScript(CodeArea codeArea, Script script, Script redeemScript, Script witnessScript) {
|
||||
if(ScriptPattern.isP2WPKH(script)) {
|
||||
if(ScriptPattern.isP2PKH(script)) {
|
||||
codeArea.append(script.getChunks().get(0).toString(), "script-opcode");
|
||||
codeArea.append(" ", "");
|
||||
codeArea.append(script.getChunks().get(1).toString(), "script-opcode");
|
||||
codeArea.append(" ", "");
|
||||
codeArea.append("<pkh>", "script-hash");
|
||||
codeArea.append(" ", "");
|
||||
codeArea.append(script.getChunks().get(3).toString(), "script-opcode");
|
||||
codeArea.append(" ", "");
|
||||
codeArea.append(script.getChunks().get(4).toString(), "script-opcode");
|
||||
} else if(ScriptPattern.isP2SH(script)) {
|
||||
codeArea.append(script.getChunks().get(0).toString(), "script-opcode");
|
||||
codeArea.append(" ", "");
|
||||
codeArea.append("<sh>", "script-hash");
|
||||
codeArea.append(" ", "");
|
||||
codeArea.append(script.getChunks().get(2).toString(), "script-opcode");
|
||||
} else if(ScriptPattern.isP2WPKH(script)) {
|
||||
codeArea.append(script.getChunks().get(0).toString(), "script-opcode");
|
||||
codeArea.append(" ", "");
|
||||
codeArea.append("<wpkh>", "script-hash");
|
||||
|
|
|
@ -24,37 +24,4 @@
|
|||
|
||||
.locktime { -fx-fill: #e5e5e6 }
|
||||
|
||||
.script-nest { -fx-fill: #000000 }
|
||||
.script-opcode { -fx-fill: #0184bc; }
|
||||
.script-hash { -fx-fill: #986801; }
|
||||
.script-signature { -fx-fill: #50a14f }
|
||||
.script-pubkey { -fx-fill: #a626a4 }
|
||||
.script-redeem { -fx-fill: #ca1243 }
|
||||
.script-other { -fx-fill: #a0a1a7 }
|
||||
|
||||
.uneditable-codearea {
|
||||
-fx-font: 14px Courier;
|
||||
-fx-padding: 4;
|
||||
}
|
||||
|
||||
.virtualized-scroll-pane {
|
||||
-fx-background-color: linear-gradient(to bottom, derive(-fx-text-box-border, -10%), -fx-text-box-border), linear-gradient(from 0px 0px to 0px 5px, derive(-fx-control-inner-background, -9%), -fx-control-inner-background);
|
||||
-fx-background-insets: 0, 1;
|
||||
-fx-background-radius: 3, 2;
|
||||
}
|
||||
|
||||
.virtualized-scroll-pane:disabled {
|
||||
-fx-opacity: 0.5;
|
||||
}
|
||||
|
||||
.virtualized-scroll-pane .styled-text-area {
|
||||
-fx-background-insets: 0px;
|
||||
-fx-background-color: transparent;
|
||||
}
|
||||
|
||||
.virtualized-scroll-pane .scroll-bar:vertical {
|
||||
-fx-background-radius: 0 2 2 0;
|
||||
-fx-padding: 0.08333325em 0.08333325em 0.08333325em 0;
|
||||
-fx-border-insets: 0.08333325em 0.08333325em 0.08333325em 0;
|
||||
-fx-background-insets: 0.08333325em 0.08333325em 0.08333325em 0;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<?import org.controlsfx.control.ToggleSwitch?>
|
||||
<?import com.sparrowwallet.sparrow.control.RelativeTimelockSpinner?>
|
||||
|
||||
<GridPane alignment="TOP_CENTER" hgap="10.0" prefHeight="500.0" prefWidth="620.0" stylesheets="@input.css, @../general.css" vgap="10.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.transaction.InputController">
|
||||
<GridPane alignment="TOP_CENTER" hgap="10.0" prefHeight="500.0" prefWidth="620.0" stylesheets="@input.css, @script.css, @../general.css" vgap="10.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.transaction.InputController">
|
||||
<padding>
|
||||
<Insets bottom="25.0" left="25.0" right="25.0" top="25.0" />
|
||||
</padding>
|
||||
|
|
|
@ -5,6 +5,48 @@
|
|||
<?import javafx.scene.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import org.fxmisc.richtext.CodeArea?>
|
||||
<?import org.fxmisc.flowless.VirtualizedScrollPane?>
|
||||
<?import tornadofx.control.Field?>
|
||||
<?import tornadofx.control.Fieldset?>
|
||||
<?import tornadofx.control.Form?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
|
||||
<GridPane alignment="TOP_CENTER" hgap="10.0" prefHeight="500.0" prefWidth="600.0" stylesheets="@output.css, @../general.css" vgap="10.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.transaction.OutputController">
|
||||
<GridPane alignment="TOP_CENTER" hgap="10.0" prefHeight="500.0" prefWidth="600.0" stylesheets="@output.css, @script.css, @../general.css" vgap="10.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.transaction.OutputController">
|
||||
<padding>
|
||||
<Insets bottom="25.0" left="25.0" right="25.0" top="25.0" />
|
||||
</padding>
|
||||
<columnConstraints>
|
||||
<ColumnConstraints maxWidth="Infinity" minWidth="340" prefWidth="340">
|
||||
</ColumnConstraints>
|
||||
<ColumnConstraints maxWidth="Infinity" minWidth="340" prefWidth="340">
|
||||
</ColumnConstraints>
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints />
|
||||
<RowConstraints />
|
||||
</rowConstraints>
|
||||
<Form GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.rowIndex="0">
|
||||
<Fieldset fx:id="outputFieldset" inputGrow="SOMETIMES" text="Output">
|
||||
<Field text="Value:">
|
||||
<TextField fx:id="value" editable="false" styleClass="copyable-label" />
|
||||
</Field>
|
||||
</Fieldset>
|
||||
</Form>
|
||||
|
||||
<Separator styleClass="form-separator" GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.rowIndex="1" />
|
||||
|
||||
<Form GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.rowIndex="2">
|
||||
<Fieldset inputGrow="SOMETIMES" text="Script">
|
||||
<Field text="ScriptPubKey:">
|
||||
<HBox prefHeight="42">
|
||||
<VirtualizedScrollPane>
|
||||
<content>
|
||||
<CodeArea fx:id="scriptPubKeyArea" editable="false" minWidth="570" prefWidth="570" wrapText="true" styleClass="uneditable-codearea" />
|
||||
</content>
|
||||
</VirtualizedScrollPane>
|
||||
</HBox>
|
||||
</Field>
|
||||
</Fieldset>
|
||||
</Form>
|
||||
</GridPane>
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
.script-nest { -fx-fill: #000000 }
|
||||
.script-opcode { -fx-fill: #0184bc }
|
||||
.script-hash { -fx-fill: #986801 }
|
||||
.script-signature { -fx-fill: #50a14f }
|
||||
.script-pubkey { -fx-fill: #a626a4 }
|
||||
.script-redeem { -fx-fill: #ca1243 }
|
||||
.script-other { -fx-fill: #a0a1a7 }
|
||||
|
||||
.uneditable-codearea {
|
||||
-fx-font: 14px Courier;
|
||||
-fx-padding: 4;
|
||||
}
|
||||
|
||||
.virtualized-scroll-pane {
|
||||
-fx-background-color: linear-gradient(to bottom, derive(-fx-text-box-border, -10%), -fx-text-box-border), linear-gradient(from 0px 0px to 0px 5px, derive(-fx-control-inner-background, -9%), -fx-control-inner-background);
|
||||
-fx-background-insets: 0, 1;
|
||||
-fx-background-radius: 3, 2;
|
||||
}
|
||||
|
||||
.virtualized-scroll-pane:disabled {
|
||||
-fx-opacity: 0.5;
|
||||
}
|
||||
|
||||
.virtualized-scroll-pane .styled-text-area {
|
||||
-fx-background-insets: 0px;
|
||||
-fx-background-color: transparent;
|
||||
}
|
||||
|
||||
.virtualized-scroll-pane .scroll-bar:vertical {
|
||||
-fx-background-radius: 0 2 2 0;
|
||||
-fx-padding: 0.08333325em 0.08333325em 0.08333325em 0;
|
||||
-fx-border-insets: 0.08333325em 0.08333325em 0.08333325em 0;
|
||||
-fx-background-insets: 0.08333325em 0.08333325em 0.08333325em 0;
|
||||
}
|
Loading…
Reference in a new issue