refactor .storage and .external to .io

This commit is contained in:
Craig Raw 2020-04-30 09:27:14 +02:00
parent 7a554df619
commit 14aa328f6d
40 changed files with 41 additions and 49 deletions

View file

@ -17,7 +17,7 @@ import com.sparrowwallet.sparrow.control.WalletNameDialog;
import com.sparrowwallet.sparrow.event.TabEvent; import com.sparrowwallet.sparrow.event.TabEvent;
import com.sparrowwallet.sparrow.event.TransactionTabChangedEvent; import com.sparrowwallet.sparrow.event.TransactionTabChangedEvent;
import com.sparrowwallet.sparrow.event.TransactionTabSelectedEvent; import com.sparrowwallet.sparrow.event.TransactionTabSelectedEvent;
import com.sparrowwallet.sparrow.storage.Storage; import com.sparrowwallet.sparrow.io.Storage;
import com.sparrowwallet.sparrow.transaction.TransactionController; import com.sparrowwallet.sparrow.transaction.TransactionController;
import com.sparrowwallet.sparrow.wallet.SettingsController; import com.sparrowwallet.sparrow.wallet.SettingsController;
import com.sparrowwallet.sparrow.wallet.WalletController; import com.sparrowwallet.sparrow.wallet.WalletController;

View file

@ -1,7 +1,7 @@
package com.sparrowwallet.sparrow.control; package com.sparrowwallet.sparrow.control;
import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.drongo.wallet.Wallet;
import com.sparrowwallet.sparrow.external.Device; import com.sparrowwallet.sparrow.io.Device;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.scene.control.Accordion; import javafx.scene.control.Accordion;

View file

@ -8,8 +8,8 @@ import com.sparrowwallet.drongo.wallet.KeystoreSource;
import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.drongo.wallet.Wallet;
import com.sparrowwallet.sparrow.EventManager; import com.sparrowwallet.sparrow.EventManager;
import com.sparrowwallet.sparrow.event.KeystoreImportEvent; import com.sparrowwallet.sparrow.event.KeystoreImportEvent;
import com.sparrowwallet.sparrow.external.Device; import com.sparrowwallet.sparrow.io.Device;
import com.sparrowwallet.sparrow.external.Hwi; import com.sparrowwallet.sparrow.io.Hwi;
import com.sparrowwallet.drongo.wallet.WalletModel; import com.sparrowwallet.drongo.wallet.WalletModel;
import com.sparrowwallet.sparrow.glyphfont.FontAwesome5; import com.sparrowwallet.sparrow.glyphfont.FontAwesome5;
import javafx.application.Platform; import javafx.application.Platform;

View file

@ -5,7 +5,7 @@ import com.sparrowwallet.drongo.wallet.Keystore;
import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.drongo.wallet.Wallet;
import com.sparrowwallet.sparrow.EventManager; import com.sparrowwallet.sparrow.EventManager;
import com.sparrowwallet.sparrow.event.KeystoreImportEvent; import com.sparrowwallet.sparrow.event.KeystoreImportEvent;
import com.sparrowwallet.sparrow.external.KeystoreFileImport; import com.sparrowwallet.sparrow.io.KeystoreFileImport;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.geometry.Pos; import javafx.geometry.Pos;

View file

@ -1,9 +1,9 @@
package com.sparrowwallet.sparrow.control; package com.sparrowwallet.sparrow.control;
import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.drongo.wallet.Wallet;
import com.sparrowwallet.sparrow.external.KeystoreFileImport; import com.sparrowwallet.sparrow.io.KeystoreFileImport;
import com.sparrowwallet.sparrow.external.KeystoreImport; import com.sparrowwallet.sparrow.io.KeystoreImport;
import com.sparrowwallet.sparrow.external.KeystoreMnemonicImport; import com.sparrowwallet.sparrow.io.KeystoreMnemonicImport;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.scene.control.Accordion; import javafx.scene.control.Accordion;

View file

@ -2,19 +2,15 @@ package com.sparrowwallet.sparrow.control;
import com.sparrowwallet.sparrow.AppController; import com.sparrowwallet.sparrow.AppController;
import com.sparrowwallet.sparrow.glyphfont.FontAwesome5; import com.sparrowwallet.sparrow.glyphfont.FontAwesome5;
import com.sparrowwallet.sparrow.storage.Storage; 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.Glyph; import org.controlsfx.glyphfont.Glyph;
import org.controlsfx.glyphfont.GlyphFont;
import org.controlsfx.glyphfont.GlyphFontRegistry;
import org.controlsfx.validation.ValidationResult; import org.controlsfx.validation.ValidationResult;
import org.controlsfx.validation.ValidationSupport; import org.controlsfx.validation.ValidationSupport;
import org.controlsfx.validation.Validator; import org.controlsfx.validation.Validator;

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
import com.google.common.io.CharStreams; import com.google.common.io.CharStreams;
import com.google.gson.Gson; import com.google.gson.Gson;
@ -12,7 +12,6 @@ import com.sparrowwallet.drongo.wallet.Keystore;
import com.sparrowwallet.drongo.wallet.KeystoreSource; import com.sparrowwallet.drongo.wallet.KeystoreSource;
import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.drongo.wallet.Wallet;
import com.sparrowwallet.drongo.wallet.WalletModel; import com.sparrowwallet.drongo.wallet.WalletModel;
import com.sparrowwallet.sparrow.storage.Storage;
import java.io.*; import java.io.*;
import java.util.HashSet; import java.util.HashSet;

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
import com.google.common.io.CharStreams; import com.google.common.io.CharStreams;
import com.sparrowwallet.drongo.ExtendedPublicKey; import com.sparrowwallet.drongo.ExtendedPublicKey;

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
import com.sparrowwallet.drongo.wallet.WalletModel; import com.sparrowwallet.drongo.wallet.WalletModel;

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
import com.google.gson.*; import com.google.gson.*;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
public interface Export { public interface Export {
String getName(); String getName();

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
public class ExportException extends Throwable { public class ExportException extends Throwable {
public ExportException() { public ExportException() {

View file

@ -1,11 +1,8 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import com.google.common.io.CharStreams; import com.google.common.io.CharStreams;
import com.google.gson.*; import com.google.gson.*;
import com.sparrowwallet.drongo.policy.PolicyType;
import com.sparrowwallet.drongo.protocol.ScriptType;
import com.sparrowwallet.drongo.wallet.Keystore;
import com.sparrowwallet.drongo.wallet.WalletModel; import com.sparrowwallet.drongo.wallet.WalletModel;
import javafx.concurrent.Service; import javafx.concurrent.Service;
import javafx.concurrent.Task; import javafx.concurrent.Task;

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
public interface Import { public interface Import {
String getName(); String getName();

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
public class ImportException extends Exception { public class ImportException extends Exception {
public ImportException() { public ImportException() {

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
import com.sparrowwallet.drongo.protocol.ScriptType; import com.sparrowwallet.drongo.protocol.ScriptType;
import com.sparrowwallet.drongo.wallet.Keystore; import com.sparrowwallet.drongo.wallet.Keystore;

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
import com.sparrowwallet.drongo.policy.PolicyType; import com.sparrowwallet.drongo.policy.PolicyType;
import com.sparrowwallet.drongo.wallet.WalletModel; import com.sparrowwallet.drongo.wallet.WalletModel;

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
import com.sparrowwallet.drongo.protocol.ScriptType; import com.sparrowwallet.drongo.protocol.ScriptType;
import com.sparrowwallet.drongo.wallet.Keystore; import com.sparrowwallet.drongo.wallet.Keystore;

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.drongo.wallet.Wallet;

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
import com.sparrowwallet.drongo.protocol.ScriptType; import com.sparrowwallet.drongo.protocol.ScriptType;
import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.drongo.wallet.Wallet;

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.storage; package com.sparrowwallet.sparrow.io;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import com.google.gson.*; import com.google.gson.*;

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.drongo.wallet.Wallet;

View file

@ -2,9 +2,9 @@ package com.sparrowwallet.sparrow.keystoreimport;
import com.sparrowwallet.drongo.policy.PolicyType; import com.sparrowwallet.drongo.policy.PolicyType;
import com.sparrowwallet.sparrow.control.KeystoreImportAccordion; import com.sparrowwallet.sparrow.control.KeystoreImportAccordion;
import com.sparrowwallet.sparrow.external.ColdcardMultisig; import com.sparrowwallet.sparrow.io.ColdcardMultisig;
import com.sparrowwallet.sparrow.external.ColdcardSinglesig; import com.sparrowwallet.sparrow.io.ColdcardSinglesig;
import com.sparrowwallet.sparrow.external.KeystoreImport; import com.sparrowwallet.sparrow.io.KeystoreImport;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.fxml.FXML; import javafx.fxml.FXML;

View file

@ -1,7 +1,7 @@
package com.sparrowwallet.sparrow.keystoreimport; package com.sparrowwallet.sparrow.keystoreimport;
import com.sparrowwallet.sparrow.control.DeviceAccordion; import com.sparrowwallet.sparrow.control.DeviceAccordion;
import com.sparrowwallet.sparrow.external.Device; import com.sparrowwallet.sparrow.io.Device;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.fxml.FXML; import javafx.fxml.FXML;

View file

@ -1,7 +1,7 @@
package com.sparrowwallet.sparrow.keystoreimport; package com.sparrowwallet.sparrow.keystoreimport;
import com.sparrowwallet.sparrow.external.Device; import com.sparrowwallet.sparrow.io.Device;
import com.sparrowwallet.sparrow.external.Hwi; import com.sparrowwallet.sparrow.io.Hwi;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Button; import javafx.scene.control.Button;

View file

@ -3,7 +3,7 @@ package com.sparrowwallet.sparrow.keystoreimport;
import com.sparrowwallet.drongo.wallet.KeystoreSource; import com.sparrowwallet.drongo.wallet.KeystoreSource;
import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.drongo.wallet.Wallet;
import com.sparrowwallet.sparrow.AppController; import com.sparrowwallet.sparrow.AppController;
import com.sparrowwallet.sparrow.external.Device; import com.sparrowwallet.sparrow.io.Device;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable; import javafx.fxml.Initializable;

View file

@ -1,8 +1,8 @@
package com.sparrowwallet.sparrow.keystoreimport; package com.sparrowwallet.sparrow.keystoreimport;
import com.sparrowwallet.sparrow.control.KeystoreImportAccordion; import com.sparrowwallet.sparrow.control.KeystoreImportAccordion;
import com.sparrowwallet.sparrow.external.Electrum; import com.sparrowwallet.sparrow.io.Electrum;
import com.sparrowwallet.sparrow.external.KeystoreImport; import com.sparrowwallet.sparrow.io.KeystoreImport;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.fxml.FXML; import javafx.fxml.FXML;

View file

@ -2,7 +2,7 @@ package com.sparrowwallet.sparrow.wallet;
import com.sparrowwallet.drongo.crypto.ECKey; import com.sparrowwallet.drongo.crypto.ECKey;
import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.drongo.wallet.Wallet;
import com.sparrowwallet.sparrow.storage.Storage; import com.sparrowwallet.sparrow.io.Storage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import com.sparrowwallet.drongo.ExtendedPublicKey; import com.sparrowwallet.drongo.ExtendedPublicKey;

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
import com.sparrowwallet.drongo.policy.PolicyType; import com.sparrowwallet.drongo.policy.PolicyType;
import com.sparrowwallet.drongo.protocol.ScriptType; import com.sparrowwallet.drongo.protocol.ScriptType;
@ -10,7 +10,7 @@ public class ColdcardSinglesigTest extends ImportExportTest {
@Test @Test
public void testImport() throws ImportException { public void testImport() throws ImportException {
ColdcardSinglesig ccSingleSig = new ColdcardSinglesig(); ColdcardSinglesig ccSingleSig = new ColdcardSinglesig();
Wallet wallet = ccSingleSig.importWallet(getInputStream("cc-wallet-dump.txt"), ScriptType.P2PKH); Wallet wallet = ccSingleSig.importWallet(ScriptType.P2PKH, getInputStream("cc-wallet-dump.txt"));
Assert.assertEquals(PolicyType.SINGLE, wallet.getPolicyType()); Assert.assertEquals(PolicyType.SINGLE, wallet.getPolicyType());
Assert.assertEquals("Coldcard 3D88D0CF", wallet.getName()); Assert.assertEquals("Coldcard 3D88D0CF", wallet.getName());

View file

@ -1,4 +1,4 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import com.sparrowwallet.drongo.policy.PolicyType; import com.sparrowwallet.drongo.policy.PolicyType;

View file

@ -1,10 +1,10 @@
package com.sparrowwallet.sparrow.external; package com.sparrowwallet.sparrow.io;
import java.io.InputStream; import java.io.InputStream;
public class ImportExportTest { public class ImportExportTest {
protected InputStream getInputStream(String filename) { protected InputStream getInputStream(String filename) {
return this.getClass().getResourceAsStream("/com/sparrowwallet/sparrow/external/" + filename); return this.getClass().getResourceAsStream("/com/sparrowwallet/sparrow/io/" + filename);
} }
} }