mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-23 20:36:44 +00:00
refactor .storage and .external to .io
This commit is contained in:
parent
7a554df619
commit
14aa328f6d
40 changed files with 41 additions and 49 deletions
|
@ -17,7 +17,7 @@ import com.sparrowwallet.sparrow.control.WalletNameDialog;
|
|||
import com.sparrowwallet.sparrow.event.TabEvent;
|
||||
import com.sparrowwallet.sparrow.event.TransactionTabChangedEvent;
|
||||
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.wallet.SettingsController;
|
||||
import com.sparrowwallet.sparrow.wallet.WalletController;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.sparrowwallet.sparrow.control;
|
||||
|
||||
import com.sparrowwallet.drongo.wallet.Wallet;
|
||||
import com.sparrowwallet.sparrow.external.Device;
|
||||
import com.sparrowwallet.sparrow.io.Device;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.scene.control.Accordion;
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ import com.sparrowwallet.drongo.wallet.KeystoreSource;
|
|||
import com.sparrowwallet.drongo.wallet.Wallet;
|
||||
import com.sparrowwallet.sparrow.EventManager;
|
||||
import com.sparrowwallet.sparrow.event.KeystoreImportEvent;
|
||||
import com.sparrowwallet.sparrow.external.Device;
|
||||
import com.sparrowwallet.sparrow.external.Hwi;
|
||||
import com.sparrowwallet.sparrow.io.Device;
|
||||
import com.sparrowwallet.sparrow.io.Hwi;
|
||||
import com.sparrowwallet.drongo.wallet.WalletModel;
|
||||
import com.sparrowwallet.sparrow.glyphfont.FontAwesome5;
|
||||
import javafx.application.Platform;
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.sparrowwallet.drongo.wallet.Keystore;
|
|||
import com.sparrowwallet.drongo.wallet.Wallet;
|
||||
import com.sparrowwallet.sparrow.EventManager;
|
||||
import com.sparrowwallet.sparrow.event.KeystoreImportEvent;
|
||||
import com.sparrowwallet.sparrow.external.KeystoreFileImport;
|
||||
import com.sparrowwallet.sparrow.io.KeystoreFileImport;
|
||||
import javafx.application.Platform;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.sparrowwallet.sparrow.control;
|
||||
|
||||
import com.sparrowwallet.drongo.wallet.Wallet;
|
||||
import com.sparrowwallet.sparrow.external.KeystoreFileImport;
|
||||
import com.sparrowwallet.sparrow.external.KeystoreImport;
|
||||
import com.sparrowwallet.sparrow.external.KeystoreMnemonicImport;
|
||||
import com.sparrowwallet.sparrow.io.KeystoreFileImport;
|
||||
import com.sparrowwallet.sparrow.io.KeystoreImport;
|
||||
import com.sparrowwallet.sparrow.io.KeystoreMnemonicImport;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.scene.control.Accordion;
|
||||
|
||||
|
|
|
@ -2,19 +2,15 @@ package com.sparrowwallet.sparrow.control;
|
|||
|
||||
import com.sparrowwallet.sparrow.AppController;
|
||||
import com.sparrowwallet.sparrow.glyphfont.FontAwesome5;
|
||||
import com.sparrowwallet.sparrow.storage.Storage;
|
||||
import com.sparrowwallet.sparrow.io.Storage;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.binding.BooleanBinding;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import org.controlsfx.control.textfield.CustomTextField;
|
||||
import org.controlsfx.control.textfield.TextFields;
|
||||
import org.controlsfx.glyphfont.FontAwesome;
|
||||
import org.controlsfx.glyphfont.Glyph;
|
||||
import org.controlsfx.glyphfont.GlyphFont;
|
||||
import org.controlsfx.glyphfont.GlyphFontRegistry;
|
||||
import org.controlsfx.validation.ValidationResult;
|
||||
import org.controlsfx.validation.ValidationSupport;
|
||||
import org.controlsfx.validation.Validator;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
import com.google.common.io.CharStreams;
|
||||
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.Wallet;
|
||||
import com.sparrowwallet.drongo.wallet.WalletModel;
|
||||
import com.sparrowwallet.sparrow.storage.Storage;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.HashSet;
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
import com.google.common.io.CharStreams;
|
||||
import com.sparrowwallet.drongo.ExtendedPublicKey;
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
import com.sparrowwallet.drongo.wallet.WalletModel;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
import com.google.gson.*;
|
||||
import com.google.gson.reflect.TypeToken;
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
public interface Export {
|
||||
String getName();
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
public class ExportException extends Throwable {
|
||||
public ExportException() {
|
|
@ -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.CharStreams;
|
||||
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 javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
public interface Import {
|
||||
String getName();
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
public class ImportException extends Exception {
|
||||
public ImportException() {
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
import com.sparrowwallet.drongo.protocol.ScriptType;
|
||||
import com.sparrowwallet.drongo.wallet.Keystore;
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
import com.sparrowwallet.drongo.policy.PolicyType;
|
||||
import com.sparrowwallet.drongo.wallet.WalletModel;
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
import com.sparrowwallet.drongo.protocol.ScriptType;
|
||||
import com.sparrowwallet.drongo.wallet.Keystore;
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
import com.sparrowwallet.drongo.wallet.Wallet;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
import com.sparrowwallet.drongo.protocol.ScriptType;
|
||||
import com.sparrowwallet.drongo.wallet.Wallet;
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.storage;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.gson.*;
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
import com.sparrowwallet.drongo.wallet.Wallet;
|
||||
|
|
@ -2,9 +2,9 @@ package com.sparrowwallet.sparrow.keystoreimport;
|
|||
|
||||
import com.sparrowwallet.drongo.policy.PolicyType;
|
||||
import com.sparrowwallet.sparrow.control.KeystoreImportAccordion;
|
||||
import com.sparrowwallet.sparrow.external.ColdcardMultisig;
|
||||
import com.sparrowwallet.sparrow.external.ColdcardSinglesig;
|
||||
import com.sparrowwallet.sparrow.external.KeystoreImport;
|
||||
import com.sparrowwallet.sparrow.io.ColdcardMultisig;
|
||||
import com.sparrowwallet.sparrow.io.ColdcardSinglesig;
|
||||
import com.sparrowwallet.sparrow.io.KeystoreImport;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.sparrowwallet.sparrow.keystoreimport;
|
||||
|
||||
import com.sparrowwallet.sparrow.control.DeviceAccordion;
|
||||
import com.sparrowwallet.sparrow.external.Device;
|
||||
import com.sparrowwallet.sparrow.io.Device;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.sparrowwallet.sparrow.keystoreimport;
|
||||
|
||||
import com.sparrowwallet.sparrow.external.Device;
|
||||
import com.sparrowwallet.sparrow.external.Hwi;
|
||||
import com.sparrowwallet.sparrow.io.Device;
|
||||
import com.sparrowwallet.sparrow.io.Hwi;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Button;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.sparrowwallet.sparrow.keystoreimport;
|
|||
import com.sparrowwallet.drongo.wallet.KeystoreSource;
|
||||
import com.sparrowwallet.drongo.wallet.Wallet;
|
||||
import com.sparrowwallet.sparrow.AppController;
|
||||
import com.sparrowwallet.sparrow.external.Device;
|
||||
import com.sparrowwallet.sparrow.io.Device;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.sparrowwallet.sparrow.keystoreimport;
|
||||
|
||||
import com.sparrowwallet.sparrow.control.KeystoreImportAccordion;
|
||||
import com.sparrowwallet.sparrow.external.Electrum;
|
||||
import com.sparrowwallet.sparrow.external.KeystoreImport;
|
||||
import com.sparrowwallet.sparrow.io.Electrum;
|
||||
import com.sparrowwallet.sparrow.io.KeystoreImport;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.sparrowwallet.sparrow.wallet;
|
|||
|
||||
import com.sparrowwallet.drongo.crypto.ECKey;
|
||||
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.IOException;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.sparrowwallet.drongo.ExtendedPublicKey;
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
import com.sparrowwallet.drongo.policy.PolicyType;
|
||||
import com.sparrowwallet.drongo.protocol.ScriptType;
|
||||
|
@ -10,7 +10,7 @@ public class ColdcardSinglesigTest extends ImportExportTest {
|
|||
@Test
|
||||
public void testImport() throws ImportException {
|
||||
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("Coldcard 3D88D0CF", wallet.getName());
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.sparrowwallet.drongo.policy.PolicyType;
|
|
@ -1,10 +1,10 @@
|
|||
package com.sparrowwallet.sparrow.external;
|
||||
package com.sparrowwallet.sparrow.io;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
public class ImportExportTest {
|
||||
|
||||
protected InputStream getInputStream(String filename) {
|
||||
return this.getClass().getResourceAsStream("/com/sparrowwallet/sparrow/external/" + filename);
|
||||
return this.getClass().getResourceAsStream("/com/sparrowwallet/sparrow/io/" + filename);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue