rename tld

This commit is contained in:
Craig Raw 2020-04-01 13:26:40 +02:00
parent 97de5ef6dc
commit 0e7681f7d1
40 changed files with 157 additions and 92 deletions

View file

@ -1,12 +1,14 @@
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.8'
id 'org.kordamp.gradle.jdeps' version '0.9.0'
id 'org.beryx.jlink' version '2.17.4'
}
group 'com.craigraw'
group 'com.sparrowwallet'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
sourceCompatibility = 1.9
repositories {
mavenCentral()
@ -17,11 +19,49 @@ javafx {
modules = [ 'javafx.controls', 'javafx.fxml' ]
}
dependencies {
implementation project(':drongo')
compile group: 'org.fxmisc.richtext', name: 'richtextfx', version: '0.10.4'
compile group: 'no.tornado', name: 'tornadofx-controls', version: '1.0.4'
testCompile group: 'junit', name: 'junit', version: '4.12'
java {
disableAutoTargetJvm()
}
mainClassName = 'com.craigraw.sparrow.MainApp'
dependencies {
implementation(project(':drongo')) {
exclude group: 'org.hamcrest'
exclude group: 'junit'
}
implementation('org.fxmisc.richtext:richtextfx:0.10.4')
implementation('no.tornado:tornadofx-controls:1.0.4')
implementation('org.controlsfx:controlsfx:11.0.1' ) {
exclude group: 'org.openjfx', module: 'javafx-base'
exclude group: 'org.openjfx', module: 'javafx-graphics'
exclude group: 'org.openjfx', module: 'javafx-controls'
exclude group: 'org.openjfx', module: 'javafx-swing'
exclude group: 'org.openjfx', module: 'javafx-fxml'
exclude group: 'org.openjfx', module: 'javafx-web'
exclude group: 'org.openjfx', module: 'javafx-media'
}
testImplementation('junit:junit:4.12')
}
mainClassName = 'com.sparrowwallet.sparrow.MainApp'
jlink {
mergedModule {
requires 'java.management';
requires 'javafx.graphics';
requires 'java.naming';
requires 'javafx.controls';
requires 'java.logging';
requires 'java.sql';
requires 'java.xml';
requires 'javafx.base';
requires 'jdk.unsupported';
}
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages', '--ignore-signing-information']
launcher {
name = 'sparrow'
}
addExtraDependencies("javafx")
}

2
drongo

@ -1 +1 @@
Subproject commit 314ee075c20c9a23d09e9dd84ee2b6eb3588a129
Subproject commit e0a4b29ed4c21dc8f3fcd7596300808a69981d8e

View file

@ -1,7 +0,0 @@
package com.craigraw.sparrow;
import com.craigraw.drongo.protocol.Transaction;
public interface TransactionListener {
void updated(Transaction transaction);
}

View file

@ -1,9 +1,9 @@
package com.craigraw.sparrow;
package com.sparrowwallet.sparrow;
import com.craigraw.drongo.Utils;
import com.craigraw.drongo.protocol.Transaction;
import com.craigraw.drongo.psbt.PSBT;
import com.craigraw.drongo.psbt.PSBTParseException;
import com.sparrowwallet.drongo.Utils;
import com.sparrowwallet.drongo.protocol.Transaction;
import com.sparrowwallet.drongo.psbt.PSBT;
import com.sparrowwallet.drongo.psbt.PSBTParseException;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
@ -13,7 +13,6 @@ import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import org.bouncycastle.util.encoders.Hex;
import java.io.File;
import java.io.FileInputStream;

View file

@ -1,6 +1,6 @@
package com.craigraw.sparrow;
package com.sparrowwallet.sparrow;
import com.craigraw.drongo.protocol.Transaction;
import com.sparrowwallet.drongo.protocol.Transaction;
import java.util.ArrayList;
import java.util.List;

View file

@ -1,4 +1,4 @@
package com.craigraw.sparrow;
package com.sparrowwallet.sparrow;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;

View file

@ -1,8 +1,9 @@
package com.craigraw.sparrow;
package com.sparrowwallet.sparrow;
import com.craigraw.drongo.protocol.*;
import com.craigraw.drongo.psbt.PSBT;
import com.craigraw.sparrow.form.*;
import com.sparrowwallet.drongo.Utils;
import com.sparrowwallet.drongo.protocol.*;
import com.sparrowwallet.drongo.psbt.PSBT;
import com.sparrowwallet.sparrow.form.*;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Node;
@ -12,7 +13,6 @@ import javafx.scene.control.TreeView;
import javafx.scene.control.cell.TextFieldTreeCell;
import javafx.scene.layout.Pane;
import javafx.util.StringConverter;
import org.bouncycastle.util.encoders.Hex;
import org.fxmisc.richtext.CodeArea;
import java.io.ByteArrayOutputStream;
@ -110,7 +110,7 @@ public class TransactionController implements Initializable, TransactionListener
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
transaction.bitcoinSerializeToStream(baos);
hex = Hex.toHexString(baos.toByteArray());
hex = Utils.bytesToHex(baos.toByteArray());
} catch(IOException e) {
throw new IllegalStateException("Can't happen");
}

View file

@ -0,0 +1,7 @@
package com.sparrowwallet.sparrow;
import com.sparrowwallet.drongo.protocol.Transaction;
public interface TransactionListener {
void updated(Transaction transaction);
}

View file

@ -1,4 +1,4 @@
package com.craigraw.sparrow.form;
package com.sparrowwallet.sparrow.form;
import javafx.scene.Node;

View file

@ -1,8 +1,8 @@
package com.craigraw.sparrow.form;
package com.sparrowwallet.sparrow.form;
import com.craigraw.drongo.address.Address;
import com.craigraw.drongo.protocol.TransactionOutput;
import com.craigraw.drongo.protocol.NonStandardScriptException;
import com.sparrowwallet.drongo.address.Address;
import com.sparrowwallet.drongo.protocol.TransactionOutput;
import com.sparrowwallet.drongo.protocol.NonStandardScriptException;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.chart.PieChart;

View file

@ -1,8 +1,8 @@
package com.craigraw.sparrow.form;
package com.sparrowwallet.sparrow.form;
import com.craigraw.drongo.protocol.Transaction;
import com.craigraw.sparrow.EventManager;
import com.craigraw.sparrow.TransactionListener;
import com.sparrowwallet.drongo.protocol.Transaction;
import com.sparrowwallet.sparrow.EventManager;
import com.sparrowwallet.sparrow.TransactionListener;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.*;
@ -29,7 +29,10 @@ public class HeadersController implements Initializable, TransactionListener {
private TextField segwit;
@FXML
private ToggleGroup locktimeType;
private ToggleGroup locktimeToggleGroup;
@FXML
private ToggleButton locktimeNoneType;
@FXML
private ToggleButton locktimeBlockType;
@ -94,13 +97,22 @@ public class HeadersController implements Initializable, TransactionListener {
}
segwit.setText(type);
locktimeType.selectedToggleProperty().addListener((ov, old_toggle, new_toggle) -> {
if(locktimeType.getSelectedToggle() != null) {
String selection = locktimeType.getSelectedToggle().getUserData().toString();
if(selection.equals("block")) {
locktimeToggleGroup.selectedToggleProperty().addListener((ov, old_toggle, new_toggle) -> {
if(locktimeToggleGroup.getSelectedToggle() != null) {
String selection = locktimeToggleGroup.getSelectedToggle().getUserData().toString();
if(selection.equals("none")) {
locktimeFieldset.getChildren().remove(locktimeDateField);
locktimeFieldset.getChildren().remove(locktimeBlockField);
locktimeFieldset.getChildren().add(locktimeBlockField);
locktimeBlock.setDisable(true);
locktimeBlock.getValueFactory().setValue(0);
tx.setLockTime(0);
EventManager.get().notify(tx);
} else if(selection.equals("block")) {
locktimeFieldset.getChildren().remove(locktimeDateField);
locktimeFieldset.getChildren().remove(locktimeBlockField);
locktimeFieldset.getChildren().add(locktimeBlockField);
locktimeBlock.setDisable(false);
Integer block = locktimeBlock.getValue();
if(block != null) {
tx.setLockTime(block);
@ -121,12 +133,17 @@ public class HeadersController implements Initializable, TransactionListener {
if(tx.getLockTime() < MAX_BLOCK_LOCKTIME) {
locktimeBlock.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, (int)MAX_BLOCK_LOCKTIME-1, (int)tx.getLockTime()));
locktimeType.selectToggle(locktimeBlockType);
if(tx.getLockTime() == 0) {
locktimeToggleGroup.selectToggle(locktimeNoneType);
locktimeBlock.setDisable(true);
} else {
locktimeToggleGroup.selectToggle(locktimeBlockType);
}
} else {
locktimeBlock.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, (int)MAX_BLOCK_LOCKTIME-1));
LocalDateTime date = Instant.ofEpochSecond(tx.getLockTime()).atZone(ZoneId.systemDefault()).toLocalDateTime();
locktimeDate.setDateTimeValue(date);
locktimeType.selectToggle(locktimeDateType);
locktimeToggleGroup.selectToggle(locktimeDateType);
}
locktimeBlock.valueProperty().addListener((obs, oldValue, newValue) -> {

View file

@ -1,7 +1,7 @@
package com.craigraw.sparrow.form;
package com.sparrowwallet.sparrow.form;
import com.craigraw.drongo.protocol.Transaction;
import com.craigraw.drongo.psbt.PSBT;
import com.sparrowwallet.drongo.protocol.Transaction;
import com.sparrowwallet.drongo.psbt.PSBT;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;

View file

@ -1,4 +1,4 @@
package com.craigraw.sparrow.form;
package com.sparrowwallet.sparrow.form;
import javafx.fxml.Initializable;

View file

@ -1,6 +1,6 @@
package com.craigraw.sparrow.form;
package com.sparrowwallet.sparrow.form;
import com.craigraw.drongo.protocol.TransactionInput;
import com.sparrowwallet.drongo.protocol.TransactionInput;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;

View file

@ -1,7 +1,7 @@
package com.craigraw.sparrow.form;
package com.sparrowwallet.sparrow.form;
import com.craigraw.drongo.protocol.*;
import com.craigraw.drongo.psbt.PSBTInput;
import com.sparrowwallet.drongo.protocol.*;
import com.sparrowwallet.drongo.psbt.PSBTInput;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.chart.PieChart;

View file

@ -1,7 +1,7 @@
package com.craigraw.sparrow.form;
package com.sparrowwallet.sparrow.form;
import com.craigraw.drongo.protocol.Transaction;
import com.craigraw.drongo.psbt.PSBT;
import com.sparrowwallet.drongo.protocol.Transaction;
import com.sparrowwallet.drongo.psbt.PSBT;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;

View file

@ -1,4 +1,4 @@
package com.craigraw.sparrow.form;
package com.sparrowwallet.sparrow.form;
import javafx.fxml.Initializable;

View file

@ -1,6 +1,6 @@
package com.craigraw.sparrow.form;
package com.sparrowwallet.sparrow.form;
import com.craigraw.drongo.protocol.TransactionOutput;
import com.sparrowwallet.drongo.protocol.TransactionOutput;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;

View file

@ -1,7 +1,7 @@
package com.craigraw.sparrow.form;
package com.sparrowwallet.sparrow.form;
import com.craigraw.drongo.protocol.Transaction;
import com.craigraw.drongo.protocol.TransactionOutput;
import com.sparrowwallet.drongo.protocol.Transaction;
import com.sparrowwallet.drongo.protocol.TransactionOutput;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.chart.PieChart;

View file

@ -1,6 +1,6 @@
package com.craigraw.sparrow.form;
package com.sparrowwallet.sparrow.form;
import com.craigraw.drongo.protocol.Transaction;
import com.sparrowwallet.drongo.protocol.Transaction;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;

View file

@ -1,4 +1,4 @@
package com.craigraw.sparrow.form;
package com.sparrowwallet.sparrow.form;
import javafx.fxml.Initializable;

View file

@ -1,6 +1,6 @@
package com.craigraw.sparrow.form;
package com.sparrowwallet.sparrow.form;
import com.craigraw.drongo.psbt.PSBTInput;
import com.sparrowwallet.drongo.psbt.PSBTInput;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;

View file

@ -1,4 +1,4 @@
package com.craigraw.sparrow.form;
package com.sparrowwallet.sparrow.form;
import javafx.fxml.Initializable;

View file

@ -1,6 +1,6 @@
package com.craigraw.sparrow.form;
package com.sparrowwallet.sparrow.form;
import com.craigraw.drongo.psbt.PSBTOutput;
import com.sparrowwallet.drongo.psbt.PSBTOutput;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;

View file

@ -0,0 +1,8 @@
open module com.sparrowwallet.sparrow {
requires java.desktop;
requires javafx.controls;
requires javafx.fxml;
requires org.controlsfx.controls;
requires org.fxmisc.richtext;
requires com.sparrowwallet.drongo;
}

View file

@ -3,7 +3,7 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="700.0" prefWidth="900.0" fx:controller="com.craigraw.sparrow.AppController" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1">
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="700.0" prefWidth="900.0" fx:controller="com.sparrowwallet.sparrow.AppController" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1">
<children>
<MenuBar>
<menus>

View file

@ -12,7 +12,8 @@
<?import tornadofx.control.Fieldset?>
<?import tornadofx.control.Field?>
<GridPane hgap="10.0" prefHeight="350.0" prefWidth="600.0" vgap="10.0" alignment="TOP_CENTER" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.craigraw.sparrow.form.HeadersController" stylesheets="@headers.css, @../general.css">
<?import org.controlsfx.control.SegmentedButton?>
<GridPane hgap="10.0" prefHeight="350.0" prefWidth="600.0" vgap="10.0" alignment="TOP_CENTER" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.form.HeadersController" stylesheets="@headers.css, @../general.css">
<padding>
<Insets bottom="25.0" left="25.0" right="25.0" top="25.0" />
</padding>
@ -51,16 +52,16 @@
<Form GridPane.columnIndex="1" GridPane.rowIndex="2">
<Fieldset fx:id="locktimeFieldset" text="Locktime" inputGrow="SOMETIMES">
<Field text="Type:">
<HBox fillHeight="true">
<children>
<ToggleButton fx:id="locktimeBlockType" text="Block" userData="block">
<SegmentedButton>
<toggleGroup>
<ToggleGroup fx:id="locktimeType" />
<ToggleGroup fx:id="locktimeToggleGroup" />
</toggleGroup>
</ToggleButton>
<ToggleButton fx:id="locktimeDateType" text="Date" toggleGroup="$locktimeType" userData="date" />
</children>
</HBox>
<buttons>
<ToggleButton fx:id="locktimeNoneType" text="None" userData="none" toggleGroup="$locktimeToggleGroup" />
<ToggleButton fx:id="locktimeBlockType" text="Block" userData="block" toggleGroup="$locktimeToggleGroup" />
<ToggleButton fx:id="locktimeDateType" text="Date" userData="date" toggleGroup="$locktimeToggleGroup" />
</buttons>
</SegmentedButton>
</Field>
<Field fx:id="locktimeBlockField" text="Block:">
<Spinner fx:id="locktimeBlock" prefWidth="120"/>

View file

@ -8,7 +8,7 @@
<AnchorPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="com.craigraw.sparrow.form.InputController"
fx:controller="com.sparrowwallet.sparrow.form.InputController"
prefHeight="400.0" prefWidth="600.0">
</AnchorPane>

View file

@ -6,7 +6,7 @@
<?import tornadofx.control.*?>
<?import javafx.scene.chart.PieChart?>
<GridPane alignment="TOP_CENTER" hgap="10.0" prefHeight="500.0" prefWidth="600.0" stylesheets="@inputs.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.craigraw.sparrow.form.InputsController">
<GridPane alignment="TOP_CENTER" hgap="10.0" prefHeight="500.0" prefWidth="600.0" stylesheets="@inputs.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.form.InputsController">
<padding>
<Insets bottom="25.0" left="25.0" right="25.0" top="25.0" />
</padding>

View file

@ -8,7 +8,7 @@
<AnchorPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="com.craigraw.sparrow.form.OutputController"
fx:controller="com.sparrowwallet.sparrow.form.OutputController"
prefHeight="400.0" prefWidth="600.0">
</AnchorPane>

View file

@ -6,7 +6,7 @@
<?import tornadofx.control.*?>
<?import javafx.scene.chart.PieChart?>
<GridPane alignment="TOP_CENTER" hgap="10.0" prefHeight="500.0" prefWidth="600.0" stylesheets="@outputs.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.craigraw.sparrow.form.OutputsController">
<GridPane alignment="TOP_CENTER" hgap="10.0" prefHeight="500.0" prefWidth="600.0" stylesheets="@outputs.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.form.OutputsController">
<padding>
<Insets bottom="25.0" left="25.0" right="25.0" top="25.0" />
</padding>

View file

@ -8,7 +8,7 @@
<AnchorPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="com.craigraw.sparrow.form.PartialInputController"
fx:controller="com.sparrowwallet.sparrow.form.PartialInputController"
prefHeight="400.0" prefWidth="600.0">
</AnchorPane>

View file

@ -8,7 +8,7 @@
<AnchorPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="com.craigraw.sparrow.form.PartialOutputController"
fx:controller="com.sparrowwallet.sparrow.form.PartialOutputController"
prefHeight="400.0" prefWidth="600.0">
</AnchorPane>

View file

@ -5,7 +5,7 @@
<?import org.fxmisc.richtext.*?>
<?import org.fxmisc.flowless.VirtualizedScrollPane?>
<SplitPane dividerPositions="0.82" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0" stylesheets="@transaction.css" VBox.vgrow="ALWAYS" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.craigraw.sparrow.TransactionController">
<SplitPane dividerPositions="0.82" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0" stylesheets="@transaction.css" VBox.vgrow="ALWAYS" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.TransactionController">
<items>
<SplitPane dividerPositions="0.2" prefHeight="160.0" prefWidth="200.0">
<items>