Compare commits

...
12 Commits
15 changed files with 70 additions and 28 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ plugins {
id 'org.gradlex.extra-java-module-info' version '1.9'
}
def sparrowVersion = '2.1.1'
def sparrowVersion = '2.1.2'
def os = org.gradle.internal.os.OperatingSystem.current()
def osName = os.getFamilyName()
if(os.macOsX) {
@@ -72,7 +72,7 @@ dependencies {
implementation('org.jdbi:jdbi3-sqlobject:3.20.0') {
exclude group: 'org.slf4j'
}
implementation('org.flywaydb:flyway-core:9.1.3')
implementation('org.flywaydb:flyway-core:9.22.3')
implementation('org.fxmisc.richtext:richtextfx:0.10.4')
implementation('no.tornado:tornadofx-controls:1.0.4')
implementation('com.google.zxing:javase:3.4.0') {
+1 -1
Submodule drongo updated: ca758e1288...f7d5b4fb8f
+1 -1
Submodule lark updated: b80cbbbc57...c4c7ca8da3
@@ -1,5 +1,5 @@
Package: sparrow
Version: 2.1.1-1
Version: 2.1.2-1
Section: utils
Maintainer: Craig Raw <mail@sparrowwallet.com>
Priority: optional
@@ -1,5 +1,5 @@
Package: sparrow
Version: 2.1.1-1
Version: 2.1.2-1
Section: utils
Maintainer: Craig Raw <mail@sparrowwallet.com>
Priority: optional
+1 -1
View File
@@ -1,6 +1,6 @@
Summary: Sparrow
Name: sparrow
Version: 2.1.1
Version: 2.1.2
Release: 1
License: ASL 2.0
Vendor: Unknown
+3 -1
View File
@@ -21,7 +21,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.1.1</string>
<string>2.1.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<!-- See https://developer.apple.com/app-store/categories/ for list of AppStore categories -->
@@ -35,6 +35,8 @@
<string>true</string>
<key>NSCameraUsageDescription</key>
<string>Sparrow requires access to the camera in order to scan QR codes</string>
<key>NSLocalNetworkUsageDescription</key>
<string>Sparrow requires access to the local network in order to connect to your configured server</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
@@ -633,19 +633,10 @@ public class AppController implements Initializable {
byte[] bytes = Files.readAllBytes(file.toPath());
String name = file.getName();
try {
if(Utils.isHex(bytes) || Utils.isBase64(bytes)) {
addTransactionTab(name, file, new String(bytes, StandardCharsets.UTF_8).trim());
} else {
addTransactionTab(name, file, bytes);
} catch(ParseException e) {
ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
ByteSource byteSource = new ByteSource() {
@Override
public InputStream openStream() {
return inputStream;
}
};
String text = byteSource.asCharSource(Charsets.UTF_8).read().trim();
addTransactionTab(name, file, text);
}
} catch(IOException e) {
showErrorDialog("Error opening file", e.getMessage());
@@ -18,7 +18,7 @@ import java.util.*;
public class SparrowWallet {
public static final String APP_ID = "sparrow";
public static final String APP_NAME = "Sparrow";
public static final String APP_VERSION = "2.1.1";
public static final String APP_VERSION = "2.1.2";
public static final String APP_VERSION_SUFFIX = "";
public static final String APP_HOME_PROPERTY = "sparrow.home";
public static final String NETWORK_ENV_PROPERTY = "SPARROW_NETWORK";
@@ -55,7 +55,7 @@ public class MnemonicWalletKeystoreImportPane extends MnemonicKeystorePane {
protected List<Node> createRightButtons() {
discoverButton = new Button("Discover Wallet");
discoverButton.setDisable(true);
discoverButton.setDefaultButton(true);
discoverButton.setDefaultButton(AppServices.onlineProperty().get());
discoverButton.managedProperty().bind(discoverButton.visibleProperty());
discoverButton.setOnAction(event -> {
discoverWallet();
@@ -66,6 +66,7 @@ public class MnemonicWalletKeystoreImportPane extends MnemonicKeystorePane {
importButton = new Button("Import Wallet");
importButton.setDisable(true);
importButton.setDefaultButton(!AppServices.onlineProperty().get());
importButton.managedProperty().bind(importButton.visibleProperty());
importButton.visibleProperty().bind(discoverButton.visibleProperty().not());
importButton.setOnAction(event -> {
@@ -196,6 +197,7 @@ public class MnemonicWalletKeystoreImportPane extends MnemonicKeystorePane {
HBox.setHgrow(region, Priority.SOMETIMES);
Button importMnemonicButton = new Button("Import");
importMnemonicButton.setDefaultButton(true);
importMnemonicButton.setOnAction(event -> {
showHideLink.setVisible(true);
setExpanded(false);
@@ -21,7 +21,7 @@ import java.util.*;
import java.util.stream.Collectors;
public enum ExchangeSource {
NONE("None") {
NONE("None", null) {
@Override
public List<Currency> getSupportedCurrencies() {
return Collections.emptyList();
@@ -37,7 +37,7 @@ public enum ExchangeSource {
return Collections.emptyMap();
}
},
COINBASE("Coinbase") {
COINBASE("Coinbase", "No historical rates") {
@Override
public List<Currency> getSupportedCurrencies() {
return getRates().data.rates.keySet().stream().filter(code -> isValidISO4217Code(code.toUpperCase(Locale.ROOT)))
@@ -121,7 +121,7 @@ public enum ExchangeSource {
return historicalRates;
}
},
COINGECKO("Coingecko") {
COINGECKO("Coingecko", "No historical rates") {
@Override
public List<Currency> getSupportedCurrencies() {
return getRates().rates.entrySet().stream().filter(rate -> "fiat".equals(rate.getValue().type) && isValidISO4217Code(rate.getKey().toUpperCase(Locale.ROOT)))
@@ -189,7 +189,7 @@ public enum ExchangeSource {
return historicalRates;
}
},
MEMPOOL_SPACE("mempool.space") {
MEMPOOL_SPACE("mempool.space", "Historical rates from Apr 2023") {
@Override
public List<Currency> getSupportedCurrencies() {
return getRates().rates.entrySet().stream().filter(price -> isValidISO4217Code(price.getKey().toUpperCase(Locale.ROOT)))
@@ -262,9 +262,11 @@ public enum ExchangeSource {
private static final Logger log = LoggerFactory.getLogger(ExchangeSource.class);
private final String name;
private final String description;
ExchangeSource(String name) {
ExchangeSource(String name, String description) {
this.name = name;
this.description = description;
}
public abstract List<Currency> getSupportedCurrencies();
@@ -282,6 +284,14 @@ public enum ExchangeSource {
}
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
@Override
public String toString() {
return name;
@@ -19,6 +19,7 @@ import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.ListCell;
import javafx.util.StringConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -158,6 +159,9 @@ public class GeneralSettingsController extends SettingsDetailController {
config.setExchangeSource(exchangeSource.getValue());
}
exchangeSource.setButtonCell(new ExchangeSourceButtonCell());
exchangeSource.setCellFactory(_ -> new ExchangeSourceListCell());
exchangeSource.valueProperty().addListener((observable, oldValue, source) -> {
config.setExchangeSource(source);
updateCurrencies(source);
@@ -253,4 +257,32 @@ public class GeneralSettingsController extends SettingsDetailController {
fiatCurrency.valueProperty().addListener(fiatCurrencyListener);
}
private static class ExchangeSourceButtonCell extends ListCell<ExchangeSource> {
@Override
protected void updateItem(ExchangeSource exchangeSource, boolean empty) {
super.updateItem(exchangeSource, empty);
if(exchangeSource == null || empty) {
setText("");
} else {
setText(exchangeSource.getName());
}
}
}
private static class ExchangeSourceListCell extends ListCell<ExchangeSource> {
@Override
protected void updateItem(ExchangeSource exchangeSource, boolean empty) {
super.updateItem(exchangeSource, empty);
if(exchangeSource == null || empty) {
setText("");
} else {
String text = exchangeSource.getName();
if(exchangeSource.getDescription() != null && !exchangeSource.getDescription().isEmpty()) {
text += " (" + exchangeSource.getDescription() + ")";
}
setText(text);
}
}
}
}
@@ -256,6 +256,7 @@ public class KeystoreController extends WalletFormController implements Initiali
launchImportDialog(keystoreSource);
} else {
fingerprint.setText(DEFAULT_WATCH_ONLY_FINGERPRINT);
derivation.setText(getWalletForm().getWallet().getScriptType().getDefaultDerivationPath());
selectSourcePane.setVisible(false);
}
}
@@ -653,6 +654,9 @@ public class KeystoreController extends WalletFormController implements Initiali
@Subscribe
public void update(SettingsChangedEvent event) {
if(walletForm.getWallet().equals(event.getWallet()) && event.getType().equals(SettingsChangedEvent.Type.SCRIPT_TYPE)) {
if(keystore.getSource() == KeystoreSource.SW_WATCH && derivation.getPromptText().equals(derivation.getText())) {
derivation.setText(event.getWallet().getScriptType().getDefaultDerivationPath());
}
derivation.setPromptText(event.getWallet().getScriptType().getDefaultDerivationPath());
if(derivation.getText() != null && !derivation.getText().isEmpty()) {
String derivationPath = derivation.getText();
@@ -52,7 +52,7 @@
<ComboBox fx:id="fiatCurrency" />
</Field>
<Field text="Exchange rate source:">
<ComboBox fx:id="exchangeSource">
<ComboBox fx:id="exchangeSource" prefWidth="160">
<items>
<FXCollections fx:factory="observableArrayList">
<ExchangeSource fx:constant="NONE" />
+1
View File
@@ -13,6 +13,7 @@
<logger name="org.flywaydb.core.internal.command.DbValidate" level="WARN" />
<logger name="org.flywaydb.core.internal.command.DbMigrate" level="WARN" />
<logger name="org.flywaydb.core.internal.command.DbClean" level="ERROR" />
<logger name="org.flywaydb.core.internal.command.clean.CleanExecutor" level="ERROR" />
<logger name="org.flywaydb.core.internal.database.base.BaseDatabaseType" level="WARN" />
<logger name="org.flywaydb.core.internal.database.base.Schema" level="WARN" />
<logger name="org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory" level="WARN" />