diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5c3322306f..bf12e778f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,10 +17,10 @@ jobs: - uses: actions/checkout@v3 with: lfs: true - - name: Set up JDK 20 + - name: Set up JDK 11 uses: actions/setup-java@v3 with: - java-version: '20' + java-version: '11' distribution: 'adopt' cache: gradle - name: Build with Gradle diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 972fd2da3a..2cebc57e9e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -35,13 +35,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - - name: Set up JDK 20 - uses: actions/setup-java@v3 - with: - java-version: '20' - distribution: 'adopt' - cache: gradle - # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index a43fe881e7..66f702c248 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Bounty explanation - uses: peter-evans/create-or-update-comment@v3 + uses: peter-evans/create-or-update-comment@v2 if: github.event.label.name == '💰bounty' with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.gradle b/build.gradle index 77127f7cef..cccf3de77c 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ buildscript { classpath 'com.google.gradle:osdetector-gradle-plugin:1.7.3' classpath 'com.github.johnrengelman:shadow:8.1.1' classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.6.3' - classpath 'com.gradle:gradle-enterprise-gradle-plugin:3.13.4' // added for windows build verification-metadata.xml error + classpath 'com.gradle:gradle-enterprise-gradle-plugin:3.12.4' // added for windows build verification-metadata.xml error } } @@ -46,8 +46,8 @@ configure(subprojects) { fontawesomefxMaterialdesignfontVersion = '2.0.26-9.1.2' grpcVersion = '1.42.1' gsonVersion = '2.8.5' - guavaVersion = '32.1.1-jre' - guiceVersion = '7.0.0' + guavaVersion = '30.1.1-jre' + guiceVersion = '4.2.2' moneroJavaVersion = '0.7.16' httpclient5Version = '5.0' hamcrestVersion = '2.2' diff --git a/common/src/main/java/haveno/common/ClockWatcher.java b/common/src/main/java/haveno/common/ClockWatcher.java index 047b0b1d39..b810b367a5 100644 --- a/common/src/main/java/haveno/common/ClockWatcher.java +++ b/common/src/main/java/haveno/common/ClockWatcher.java @@ -17,11 +17,12 @@ package haveno.common; -import com.google.inject.Singleton; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Singleton; import java.util.LinkedList; import java.util.List; import java.util.concurrent.TimeUnit; -import lombok.extern.slf4j.Slf4j; // Helps configure listener objects that are run by the `UserThread` each second // and can do per second, per minute and delayed second actions. Also detects when we were in standby, and logs it. diff --git a/common/src/main/java/haveno/common/crypto/KeyRing.java b/common/src/main/java/haveno/common/crypto/KeyRing.java index b103d76cd9..e03fc1969a 100644 --- a/common/src/main/java/haveno/common/crypto/KeyRing.java +++ b/common/src/main/java/haveno/common/crypto/KeyRing.java @@ -17,15 +17,16 @@ package haveno.common.crypto; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.security.KeyPair; -import javax.annotation.Nullable; -import javax.crypto.SecretKey; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import javax.annotation.Nullable; +import javax.crypto.SecretKey; +import javax.inject.Inject; +import javax.inject.Singleton; +import java.security.KeyPair; + @Getter @EqualsAndHashCode @Slf4j diff --git a/common/src/main/java/haveno/common/crypto/KeyStorage.java b/common/src/main/java/haveno/common/crypto/KeyStorage.java index b5b81dcfec..4acc01662a 100644 --- a/common/src/main/java/haveno/common/crypto/KeyStorage.java +++ b/common/src/main/java/haveno/common/crypto/KeyStorage.java @@ -18,11 +18,15 @@ package haveno.common.crypto; import com.google.inject.Inject; -import com.google.inject.Singleton; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.common.file.FileUtil; -import static haveno.common.util.Preconditions.checkDir; +import org.jetbrains.annotations.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.crypto.SecretKey; +import javax.inject.Named; +import javax.inject.Singleton; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -44,10 +48,8 @@ import java.security.spec.InvalidKeySpecException; import java.security.spec.KeySpec; import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.RSAPublicKeySpec; -import javax.crypto.SecretKey; -import org.jetbrains.annotations.NotNull; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; + +import static haveno.common.util.Preconditions.checkDir; /** * KeyStorage uses password protection to save a symmetric key in PKCS#12 format. diff --git a/common/src/main/java/haveno/common/file/CorruptedStorageFileHandler.java b/common/src/main/java/haveno/common/file/CorruptedStorageFileHandler.java index 25db77e7ad..76cce42779 100644 --- a/common/src/main/java/haveno/common/file/CorruptedStorageFileHandler.java +++ b/common/src/main/java/haveno/common/file/CorruptedStorageFileHandler.java @@ -17,12 +17,13 @@ package haveno.common.file; -import com.google.inject.Inject; -import com.google.inject.Singleton; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.util.ArrayList; import java.util.List; import java.util.Optional; -import lombok.extern.slf4j.Slf4j; @Slf4j @Singleton diff --git a/common/src/main/java/haveno/common/persistence/PersistenceManager.java b/common/src/main/java/haveno/common/persistence/PersistenceManager.java index 42d0adbb7a..7bdb4cb1e7 100644 --- a/common/src/main/java/haveno/common/persistence/PersistenceManager.java +++ b/common/src/main/java/haveno/common/persistence/PersistenceManager.java @@ -17,9 +17,7 @@ package haveno.common.persistence; -import static com.google.common.base.Preconditions.checkNotNull; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.Timer; import haveno.common.UserThread; import haveno.common.app.DevEnv; @@ -32,9 +30,13 @@ import haveno.common.file.FileUtil; import haveno.common.handlers.ResultHandler; import haveno.common.proto.persistable.PersistableEnvelope; import haveno.common.proto.persistable.PersistenceProtoResolver; -import haveno.common.util.GcUtil; -import static haveno.common.util.Preconditions.checkDir; import haveno.common.util.SingleThreadExecutorUtils; +import haveno.common.util.GcUtil; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; + +import javax.annotation.Nullable; +import javax.inject.Named; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; @@ -49,9 +51,9 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; -import javax.annotation.Nullable; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; + +import static com.google.common.base.Preconditions.checkNotNull; +import static haveno.common.util.Preconditions.checkDir; /** * Responsible for reading persisted data and writing it on disk. We read usually only at start-up and keep data in RAM. diff --git a/core/src/main/java/haveno/core/account/sign/SignedWitnessService.java b/core/src/main/java/haveno/core/account/sign/SignedWitnessService.java index e88142a2af..b40a7fb0e8 100644 --- a/core/src/main/java/haveno/core/account/sign/SignedWitnessService.java +++ b/core/src/main/java/haveno/core/account/sign/SignedWitnessService.java @@ -19,7 +19,6 @@ package haveno.core.account.sign; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Charsets; -import com.google.inject.Inject; import haveno.common.UserThread; import haveno.common.crypto.CryptoException; import haveno.common.crypto.Hash; @@ -35,6 +34,12 @@ import haveno.network.p2p.BootstrapListener; import haveno.network.p2p.P2PService; import haveno.network.p2p.storage.P2PDataStorage; import haveno.network.p2p.storage.persistence.AppendOnlyDataStoreService; +import lombok.extern.slf4j.Slf4j; +import org.bitcoinj.core.Coin; +import org.bitcoinj.core.ECKey; +import org.bitcoinj.core.Utils; + +import javax.inject.Inject; import java.math.BigInteger; import java.security.PublicKey; import java.security.SignatureException; @@ -52,10 +57,6 @@ import java.util.Optional; import java.util.Set; import java.util.Stack; import java.util.stream.Collectors; -import lombok.extern.slf4j.Slf4j; -import org.bitcoinj.core.Coin; -import org.bitcoinj.core.ECKey; -import org.bitcoinj.core.Utils; @Slf4j public class SignedWitnessService { diff --git a/core/src/main/java/haveno/core/account/sign/SignedWitnessStorageService.java b/core/src/main/java/haveno/core/account/sign/SignedWitnessStorageService.java index f8a7c57251..304ff09759 100644 --- a/core/src/main/java/haveno/core/account/sign/SignedWitnessStorageService.java +++ b/core/src/main/java/haveno/core/account/sign/SignedWitnessStorageService.java @@ -17,16 +17,17 @@ package haveno.core.account.sign; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.common.persistence.PersistenceManager; import haveno.network.p2p.storage.P2PDataStorage; import haveno.network.p2p.storage.payload.PersistableNetworkPayload; import haveno.network.p2p.storage.persistence.MapStoreService; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Named; import java.io.File; import java.util.Map; -import lombok.extern.slf4j.Slf4j; @Slf4j public class SignedWitnessStorageService extends MapStoreService { diff --git a/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessService.java b/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessService.java index fa1f61e94a..27560f1576 100644 --- a/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessService.java +++ b/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessService.java @@ -18,8 +18,6 @@ package haveno.core.account.witness; import com.google.common.annotations.VisibleForTesting; -import static com.google.common.base.Preconditions.checkNotNull; -import com.google.inject.Inject; import haveno.common.UserThread; import haveno.common.crypto.CryptoException; import haveno.common.crypto.Hash; @@ -53,6 +51,12 @@ import haveno.network.p2p.BootstrapListener; import haveno.network.p2p.P2PService; import haveno.network.p2p.storage.P2PDataStorage; import haveno.network.p2p.storage.persistence.AppendOnlyDataStoreService; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import org.bitcoinj.core.ECKey; +import org.bitcoinj.core.Utils; + +import javax.inject.Inject; import java.math.BigInteger; import java.security.PublicKey; import java.time.Clock; @@ -70,10 +74,8 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.Stream; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import org.bitcoinj.core.ECKey; -import org.bitcoinj.core.Utils; + +import static com.google.common.base.Preconditions.checkNotNull; @Slf4j public class AccountAgeWitnessService { diff --git a/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessStorageService.java b/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessStorageService.java index 180f216635..2c4c95287c 100644 --- a/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessStorageService.java +++ b/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessStorageService.java @@ -17,15 +17,16 @@ package haveno.core.account.witness; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.common.persistence.PersistenceManager; import haveno.network.p2p.storage.payload.PersistableNetworkPayload; import haveno.network.p2p.storage.persistence.HistoricalDataStoreService; -import java.io.File; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import javax.inject.Named; +import java.io.File; + @Slf4j public class AccountAgeWitnessStorageService extends HistoricalDataStoreService { private static final String FILE_NAME = "AccountAgeWitnessStore"; diff --git a/core/src/main/java/haveno/core/alert/AlertManager.java b/core/src/main/java/haveno/core/alert/AlertManager.java index ac9f5f4b73..7aab57301c 100644 --- a/core/src/main/java/haveno/core/alert/AlertManager.java +++ b/core/src/main/java/haveno/core/alert/AlertManager.java @@ -18,8 +18,6 @@ package haveno.core.alert; import com.google.common.base.Charsets; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.app.DevEnv; import haveno.common.config.Config; import haveno.common.crypto.KeyRing; @@ -28,18 +26,22 @@ import haveno.network.p2p.P2PService; import haveno.network.p2p.storage.HashMapChangedListener; import haveno.network.p2p.storage.payload.ProtectedStorageEntry; import haveno.network.p2p.storage.payload.ProtectedStoragePayload; -import java.math.BigInteger; -import java.security.SignatureException; -import java.util.Collection; import javafx.beans.property.ObjectProperty; import javafx.beans.property.ReadOnlyObjectProperty; import javafx.beans.property.SimpleObjectProperty; import org.bitcoinj.core.ECKey; import org.bitcoinj.core.Utils; -import static org.bitcoinj.core.Utils.HEX; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.inject.Inject; +import javax.inject.Named; +import java.math.BigInteger; +import java.security.SignatureException; +import java.util.Collection; + +import static org.bitcoinj.core.Utils.HEX; + public class AlertManager { private static final Logger log = LoggerFactory.getLogger(AlertManager.class); diff --git a/core/src/main/java/haveno/core/alert/PrivateNotificationManager.java b/core/src/main/java/haveno/core/alert/PrivateNotificationManager.java index c42aec6ed0..ef0d885b0e 100644 --- a/core/src/main/java/haveno/core/alert/PrivateNotificationManager.java +++ b/core/src/main/java/haveno/core/alert/PrivateNotificationManager.java @@ -22,8 +22,6 @@ import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.SettableFuture; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.app.DevEnv; import haveno.common.config.Config; import haveno.common.crypto.KeyRing; @@ -39,21 +37,25 @@ import haveno.network.p2p.network.MessageListener; import haveno.network.p2p.network.NetworkNode; import haveno.network.p2p.peers.keepalive.messages.Ping; import haveno.network.p2p.peers.keepalive.messages.Pong; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.ReadOnlyObjectProperty; +import javafx.beans.property.SimpleObjectProperty; +import org.bitcoinj.core.ECKey; +import org.bitcoinj.core.Utils; +import org.jetbrains.annotations.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Named; import java.math.BigInteger; import java.security.SignatureException; import java.util.Random; import java.util.UUID; import java.util.function.Consumer; -import javafx.beans.property.ObjectProperty; -import javafx.beans.property.ReadOnlyObjectProperty; -import javafx.beans.property.SimpleObjectProperty; -import javax.annotation.Nullable; -import org.bitcoinj.core.ECKey; -import org.bitcoinj.core.Utils; + import static org.bitcoinj.core.Utils.HEX; -import org.jetbrains.annotations.NotNull; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class PrivateNotificationManager implements MessageListener { private static final Logger log = LoggerFactory.getLogger(PrivateNotificationManager.class); diff --git a/core/src/main/java/haveno/core/api/CoreAccountService.java b/core/src/main/java/haveno/core/api/CoreAccountService.java index 77ed597eee..7f24c06c38 100644 --- a/core/src/main/java/haveno/core/api/CoreAccountService.java +++ b/core/src/main/java/haveno/core/api/CoreAccountService.java @@ -17,9 +17,6 @@ package haveno.core.api; -import static com.google.common.base.Preconditions.checkState; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.config.Config; import haveno.common.crypto.IncorrectPasswordException; import haveno.common.crypto.KeyRing; @@ -27,6 +24,12 @@ import haveno.common.crypto.KeyStorage; import haveno.common.file.FileUtil; import haveno.common.persistence.PersistenceManager; import haveno.common.util.ZipUtils; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.io.File; import java.io.InputStream; import java.io.PipedInputStream; @@ -34,9 +37,8 @@ import java.io.PipedOutputStream; import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; + +import static com.google.common.base.Preconditions.checkState; /** * Manages the account state. A created account must have a password which encrypts diff --git a/core/src/main/java/haveno/core/api/CoreApi.java b/core/src/main/java/haveno/core/api/CoreApi.java index 1bd40ce25d..99515019ca 100644 --- a/core/src/main/java/haveno/core/api/CoreApi.java +++ b/core/src/main/java/haveno/core/api/CoreApi.java @@ -17,8 +17,6 @@ package haveno.core.api; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.app.Version; import haveno.common.config.Config; import haveno.common.crypto.IncorrectPasswordException; @@ -47,6 +45,15 @@ import haveno.core.trade.statistics.TradeStatistics3; import haveno.core.trade.statistics.TradeStatisticsManager; import haveno.core.xmr.MoneroNodeSettings; import haveno.proto.grpc.NotificationMessage; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import monero.common.MoneroRpcConnection; +import monero.wallet.model.MoneroDestination; +import monero.wallet.model.MoneroTxWallet; +import org.bitcoinj.core.Transaction; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.io.IOException; import java.io.InputStream; import java.math.BigInteger; @@ -56,12 +63,6 @@ import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import java.util.function.Consumer; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import monero.common.MoneroRpcConnection; -import monero.wallet.model.MoneroDestination; -import monero.wallet.model.MoneroTxWallet; -import org.bitcoinj.core.Transaction; /** * Provides high level interface to functionality of core Haveno features. diff --git a/core/src/main/java/haveno/core/api/CoreContext.java b/core/src/main/java/haveno/core/api/CoreContext.java index 3d6d036602..c22a10705c 100644 --- a/core/src/main/java/haveno/core/api/CoreContext.java +++ b/core/src/main/java/haveno/core/api/CoreContext.java @@ -17,12 +17,13 @@ package haveno.core.api; -import com.google.inject.Inject; -import com.google.inject.Singleton; import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import javax.inject.Singleton; + @Singleton @Slf4j public class CoreContext { diff --git a/core/src/main/java/haveno/core/api/CoreDisputeAgentsService.java b/core/src/main/java/haveno/core/api/CoreDisputeAgentsService.java index 9bae2d68a4..c069268583 100644 --- a/core/src/main/java/haveno/core/api/CoreDisputeAgentsService.java +++ b/core/src/main/java/haveno/core/api/CoreDisputeAgentsService.java @@ -17,17 +17,11 @@ package haveno.core.api; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.config.Config; import haveno.common.crypto.KeyRing; import haveno.common.handlers.ErrorMessageHandler; import haveno.common.handlers.ResultHandler; import haveno.core.support.SupportType; -import static haveno.core.support.SupportType.ARBITRATION; -import static haveno.core.support.SupportType.MEDIATION; -import static haveno.core.support.SupportType.REFUND; -import static haveno.core.support.SupportType.TRADE; import haveno.core.support.dispute.arbitration.arbitrator.Arbitrator; import haveno.core.support.dispute.arbitration.arbitrator.ArbitratorManager; import haveno.core.support.dispute.mediation.mediator.Mediator; @@ -38,16 +32,24 @@ import haveno.core.user.User; import haveno.core.xmr.wallet.XmrWalletService; import haveno.network.p2p.NodeAddress; import haveno.network.p2p.P2PService; -import static java.lang.String.format; -import static java.net.InetAddress.getLoopbackAddress; +import lombok.extern.slf4j.Slf4j; +import org.bitcoinj.core.ECKey; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.util.ArrayList; -import static java.util.Arrays.asList; import java.util.Date; import java.util.List; import java.util.Objects; import java.util.Optional; -import lombok.extern.slf4j.Slf4j; -import org.bitcoinj.core.ECKey; + +import static haveno.core.support.SupportType.ARBITRATION; +import static haveno.core.support.SupportType.MEDIATION; +import static haveno.core.support.SupportType.REFUND; +import static haveno.core.support.SupportType.TRADE; +import static java.lang.String.format; +import static java.net.InetAddress.getLoopbackAddress; +import static java.util.Arrays.asList; @Singleton @Slf4j diff --git a/core/src/main/java/haveno/core/api/CoreDisputesService.java b/core/src/main/java/haveno/core/api/CoreDisputesService.java index 7e66cc2fb9..ed4813e041 100644 --- a/core/src/main/java/haveno/core/api/CoreDisputesService.java +++ b/core/src/main/java/haveno/core/api/CoreDisputesService.java @@ -1,8 +1,5 @@ package haveno.core.api; -import static com.google.common.base.Preconditions.checkNotNull; -import com.google.inject.Inject; -import com.google.inject.Singleton; import com.google.inject.name.Named; import haveno.common.crypto.KeyRing; import haveno.common.crypto.PubKeyRing; @@ -26,13 +23,18 @@ import haveno.core.trade.TradeManager; import haveno.core.util.FormattingUtils; import haveno.core.util.coin.CoinFormatter; import haveno.core.xmr.wallet.XmrWalletService; -import static java.lang.String.format; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.math.BigInteger; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Optional; -import lombok.extern.slf4j.Slf4j; + +import static com.google.common.base.Preconditions.checkNotNull; +import static java.lang.String.format; @Singleton diff --git a/core/src/main/java/haveno/core/api/CoreHelpService.java b/core/src/main/java/haveno/core/api/CoreHelpService.java index 2002313a8e..e56ccd48d6 100644 --- a/core/src/main/java/haveno/core/api/CoreHelpService.java +++ b/core/src/main/java/haveno/core/api/CoreHelpService.java @@ -17,16 +17,18 @@ package haveno.core.api; -import com.google.inject.Inject; -import com.google.inject.Singleton; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.io.BufferedReader; -import static java.io.File.separator; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; + +import static java.io.File.separator; import static java.lang.String.format; import static java.lang.System.out; -import lombok.extern.slf4j.Slf4j; @Singleton @Slf4j diff --git a/core/src/main/java/haveno/core/api/CoreMoneroConnectionsService.java b/core/src/main/java/haveno/core/api/CoreMoneroConnectionsService.java index 22c67f10ea..1b6401bf32 100644 --- a/core/src/main/java/haveno/core/api/CoreMoneroConnectionsService.java +++ b/core/src/main/java/haveno/core/api/CoreMoneroConnectionsService.java @@ -1,24 +1,18 @@ package haveno.core.api; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.app.DevEnv; import haveno.common.config.Config; import haveno.core.trade.HavenoUtils; import haveno.core.user.Preferences; import haveno.core.xmr.model.EncryptedConnectionList; import haveno.core.xmr.nodes.XmrNodes; -import haveno.core.xmr.nodes.XmrNodes.XmrNode; import haveno.core.xmr.nodes.XmrNodesSetupPreferences; +import haveno.core.xmr.nodes.XmrNodes.XmrNode; import haveno.core.xmr.setup.DownloadListener; import haveno.core.xmr.setup.WalletsSetup; import haveno.network.Socks5ProxyProvider; import haveno.network.p2p.P2PService; import haveno.network.p2p.P2PServiceListener; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; import javafx.beans.property.IntegerProperty; import javafx.beans.property.LongProperty; import javafx.beans.property.ObjectProperty; @@ -38,6 +32,13 @@ import monero.daemon.MoneroDaemonRpc; import monero.daemon.model.MoneroDaemonInfo; import monero.daemon.model.MoneroPeer; +import javax.inject.Inject; +import javax.inject.Singleton; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + @Slf4j @Singleton public final class CoreMoneroConnectionsService { @@ -554,7 +555,7 @@ public final class CoreMoneroConnectionsService { // numPeers.set(peers.get().size()); numPeers.set(lastInfo.getNumOutgoingConnections() + lastInfo.getNumIncomingConnections()); peers.set(new ArrayList()); - + // log recovery message if (lastErrorTimestamp != null) { log.info("Successfully fetched daemon info after previous error"); diff --git a/core/src/main/java/haveno/core/api/CoreMoneroNodeService.java b/core/src/main/java/haveno/core/api/CoreMoneroNodeService.java index 6dd103c9d5..23530ae728 100644 --- a/core/src/main/java/haveno/core/api/CoreMoneroNodeService.java +++ b/core/src/main/java/haveno/core/api/CoreMoneroNodeService.java @@ -16,22 +16,23 @@ */ package haveno.core.api; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.config.BaseCurrencyNetwork; import haveno.common.config.Config; import haveno.common.util.Utilities; import haveno.core.trade.HavenoUtils; import haveno.core.user.Preferences; import haveno.core.xmr.MoneroNodeSettings; +import lombok.extern.slf4j.Slf4j; +import monero.common.MoneroUtils; +import monero.daemon.MoneroDaemonRpc; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import lombok.extern.slf4j.Slf4j; -import monero.common.MoneroUtils; -import monero.daemon.MoneroDaemonRpc; /** * Start and stop or connect to a local Monero node. diff --git a/core/src/main/java/haveno/core/api/CoreNotificationService.java b/core/src/main/java/haveno/core/api/CoreNotificationService.java index fe7d345958..f7646a5758 100644 --- a/core/src/main/java/haveno/core/api/CoreNotificationService.java +++ b/core/src/main/java/haveno/core/api/CoreNotificationService.java @@ -1,16 +1,17 @@ package haveno.core.api; -import com.google.inject.Singleton; import haveno.core.api.model.TradeInfo; import haveno.core.support.messages.ChatMessage; import haveno.core.trade.Trade; import haveno.proto.grpc.NotificationMessage; import haveno.proto.grpc.NotificationMessage.NotificationType; +import lombok.NonNull; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Singleton; import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import lombok.NonNull; -import lombok.extern.slf4j.Slf4j; @Singleton @Slf4j diff --git a/core/src/main/java/haveno/core/api/CoreOffersService.java b/core/src/main/java/haveno/core/api/CoreOffersService.java index e79d8193bc..bfc087f870 100644 --- a/core/src/main/java/haveno/core/api/CoreOffersService.java +++ b/core/src/main/java/haveno/core/api/CoreOffersService.java @@ -17,13 +17,8 @@ package haveno.core.api; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.crypto.KeyRing; import haveno.common.handlers.ErrorMessageHandler; -import static haveno.common.util.MathUtils.exactMultiply; -import static haveno.common.util.MathUtils.roundDoubleToLong; -import static haveno.common.util.MathUtils.scaleUpByPowerOf10; import haveno.core.locale.CurrencyUtil; import haveno.core.monetary.CryptoMoney; import haveno.core.monetary.Price; @@ -32,30 +27,37 @@ import haveno.core.offer.CreateOfferService; import haveno.core.offer.Offer; import haveno.core.offer.OfferBookService; import haveno.core.offer.OfferDirection; -import static haveno.core.offer.OfferDirection.BUY; import haveno.core.offer.OfferFilterService; import haveno.core.offer.OfferFilterService.Result; import haveno.core.offer.OfferUtil; import haveno.core.offer.OpenOffer; import haveno.core.offer.OpenOfferManager; import haveno.core.payment.PaymentAccount; -import static haveno.core.payment.PaymentAccountUtil.isPaymentAccountValidForOffer; import haveno.core.user.User; import haveno.core.util.PriceUtil; -import static java.lang.String.format; +import lombok.extern.slf4j.Slf4j; +import org.bitcoinj.core.Transaction; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.math.BigDecimal; import java.math.BigInteger; import java.util.ArrayList; import java.util.Comparator; -import static java.util.Comparator.comparing; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.function.Consumer; import java.util.function.Supplier; import java.util.stream.Collectors; -import lombok.extern.slf4j.Slf4j; -import org.bitcoinj.core.Transaction; + +import static haveno.common.util.MathUtils.exactMultiply; +import static haveno.common.util.MathUtils.roundDoubleToLong; +import static haveno.common.util.MathUtils.scaleUpByPowerOf10; +import static haveno.core.offer.OfferDirection.BUY; +import static haveno.core.payment.PaymentAccountUtil.isPaymentAccountValidForOffer; +import static java.lang.String.format; +import static java.util.Comparator.comparing; @Singleton @Slf4j diff --git a/core/src/main/java/haveno/core/api/CorePaymentAccountsService.java b/core/src/main/java/haveno/core/api/CorePaymentAccountsService.java index 73ab2a6a0a..6a6f2e87bb 100644 --- a/core/src/main/java/haveno/core/api/CorePaymentAccountsService.java +++ b/core/src/main/java/haveno/core/api/CorePaymentAccountsService.java @@ -17,18 +17,13 @@ package haveno.core.api; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.asset.Asset; import haveno.asset.AssetRegistry; -import static haveno.common.config.Config.baseCurrencyNetwork; import haveno.core.account.witness.AccountAgeWitnessService; import haveno.core.api.model.PaymentAccountForm; import haveno.core.api.model.PaymentAccountFormField; import haveno.core.locale.CryptoCurrency; import haveno.core.locale.CurrencyUtil; -import static haveno.core.locale.CurrencyUtil.findAsset; -import static haveno.core.locale.CurrencyUtil.getCryptoCurrency; import haveno.core.locale.TradeCurrency; import haveno.core.payment.AssetAccount; import haveno.core.payment.CryptoCurrencyAccount; @@ -37,14 +32,21 @@ import haveno.core.payment.PaymentAccount; import haveno.core.payment.PaymentAccountFactory; import haveno.core.payment.payload.PaymentMethod; import haveno.core.user.User; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.io.File; -import static java.lang.String.format; import java.util.Comparator; import java.util.List; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; -import lombok.extern.slf4j.Slf4j; + +import static haveno.common.config.Config.baseCurrencyNetwork; +import static haveno.core.locale.CurrencyUtil.findAsset; +import static haveno.core.locale.CurrencyUtil.getCryptoCurrency; +import static java.lang.String.format; @Singleton @Slf4j diff --git a/core/src/main/java/haveno/core/api/CorePriceService.java b/core/src/main/java/haveno/core/api/CorePriceService.java index 99c8326411..27cf3b46aa 100644 --- a/core/src/main/java/haveno/core/api/CorePriceService.java +++ b/core/src/main/java/haveno/core/api/CorePriceService.java @@ -18,8 +18,6 @@ package haveno.core.api; import com.google.common.math.LongMath; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.core.api.model.MarketDepthInfo; import haveno.core.api.model.MarketPriceInfo; import haveno.core.locale.CurrencyUtil; @@ -29,13 +27,16 @@ import haveno.core.offer.OfferBookService; import haveno.core.offer.OfferDirection; import haveno.core.provider.price.PriceFeedService; import haveno.core.trade.HavenoUtils; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.util.Comparator; import java.util.LinkedHashMap; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import java.util.stream.Collectors; -import lombok.extern.slf4j.Slf4j; @Singleton diff --git a/core/src/main/java/haveno/core/api/CoreTradesService.java b/core/src/main/java/haveno/core/api/CoreTradesService.java index bb130abba8..db9f066641 100644 --- a/core/src/main/java/haveno/core/api/CoreTradesService.java +++ b/core/src/main/java/haveno/core/api/CoreTradesService.java @@ -17,8 +17,6 @@ package haveno.core.api; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.handlers.ErrorMessageHandler; import haveno.common.handlers.ResultHandler; import haveno.core.offer.Offer; @@ -36,16 +34,20 @@ import haveno.core.trade.protocol.SellerProtocol; import haveno.core.user.User; import haveno.core.util.validation.BtcAddressValidator; import haveno.core.xmr.model.AddressEntry; -import static haveno.core.xmr.model.AddressEntry.Context.TRADE_PAYOUT; import haveno.core.xmr.wallet.BtcWalletService; -import static java.lang.String.format; +import lombok.extern.slf4j.Slf4j; +import org.bitcoinj.core.Coin; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.math.BigInteger; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.function.Consumer; -import lombok.extern.slf4j.Slf4j; -import org.bitcoinj.core.Coin; + +import static haveno.core.xmr.model.AddressEntry.Context.TRADE_PAYOUT; +import static java.lang.String.format; @Singleton @Slf4j diff --git a/core/src/main/java/haveno/core/api/CoreWalletsService.java b/core/src/main/java/haveno/core/api/CoreWalletsService.java index 5f0f615ce1..65513de865 100644 --- a/core/src/main/java/haveno/core/api/CoreWalletsService.java +++ b/core/src/main/java/haveno/core/api/CoreWalletsService.java @@ -20,9 +20,6 @@ package haveno.core.api; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import com.google.inject.name.Named; import haveno.common.Timer; import haveno.common.UserThread; import haveno.core.api.model.AddressBalanceInfo; @@ -32,22 +29,13 @@ import haveno.core.api.model.XmrBalanceInfo; import haveno.core.app.AppStartupState; import haveno.core.user.Preferences; import haveno.core.util.FormattingUtils; -import static haveno.core.util.ParsingUtils.parseToCoin; import haveno.core.util.coin.CoinFormatter; import haveno.core.xmr.Balances; import haveno.core.xmr.model.AddressEntry; import haveno.core.xmr.setup.WalletsSetup; import haveno.core.xmr.wallet.BtcWalletService; -import static haveno.core.xmr.wallet.Restrictions.getMinNonDustOutput; import haveno.core.xmr.wallet.WalletsManager; import haveno.core.xmr.wallet.XmrWalletService; -import static java.lang.String.format; -import java.util.List; -import java.util.Optional; -import static java.util.concurrent.TimeUnit.SECONDS; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; import lombok.extern.slf4j.Slf4j; import monero.wallet.model.MoneroDestination; import monero.wallet.model.MoneroTxWallet; @@ -59,6 +47,20 @@ import org.bitcoinj.core.TransactionConfidence; import org.bitcoinj.crypto.KeyCrypterScrypt; import org.bouncycastle.crypto.params.KeyParameter; +import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static haveno.core.util.ParsingUtils.parseToCoin; +import static haveno.core.xmr.wallet.Restrictions.getMinNonDustOutput; +import static java.lang.String.format; +import static java.util.concurrent.TimeUnit.SECONDS; + @Singleton @Slf4j class CoreWalletsService { diff --git a/core/src/main/java/haveno/core/app/AppStartupState.java b/core/src/main/java/haveno/core/app/AppStartupState.java index 503795f051..94767beb0e 100644 --- a/core/src/main/java/haveno/core/app/AppStartupState.java +++ b/core/src/main/java/haveno/core/app/AppStartupState.java @@ -17,8 +17,6 @@ package haveno.core.app; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.core.api.CoreMoneroConnectionsService; import haveno.core.api.CoreNotificationService; import haveno.network.p2p.BootstrapListener; @@ -30,6 +28,9 @@ import lombok.extern.slf4j.Slf4j; import org.fxmisc.easybind.EasyBind; import org.fxmisc.easybind.monadic.MonadicBinding; +import javax.inject.Inject; +import javax.inject.Singleton; + /** * We often need to wait until network and wallet is ready or other combination of startup states. * To avoid those repeated checks for the state or setting of listeners on different domains we provide here a diff --git a/core/src/main/java/haveno/core/app/AvoidStandbyModeService.java b/core/src/main/java/haveno/core/app/AvoidStandbyModeService.java index 410772cffa..d1f1c49369 100644 --- a/core/src/main/java/haveno/core/app/AvoidStandbyModeService.java +++ b/core/src/main/java/haveno/core/app/AvoidStandbyModeService.java @@ -17,13 +17,21 @@ package haveno.core.app; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.config.Config; import haveno.common.file.FileUtil; import haveno.common.file.ResourceNotFoundException; import haveno.common.util.Utilities; import haveno.core.user.Preferences; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Singleton; +import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; +import javax.sound.sampled.DataLine; +import javax.sound.sampled.LineUnavailableException; +import javax.sound.sampled.SourceDataLine; import java.io.File; import java.io.IOException; import java.nio.file.Paths; @@ -35,13 +43,6 @@ import java.util.concurrent.CountDownLatch; import java.util.function.Function; import java.util.function.Predicate; import java.util.function.Supplier; -import javax.sound.sampled.AudioFormat; -import javax.sound.sampled.AudioInputStream; -import javax.sound.sampled.AudioSystem; -import javax.sound.sampled.DataLine; -import javax.sound.sampled.LineUnavailableException; -import javax.sound.sampled.SourceDataLine; -import lombok.extern.slf4j.Slf4j; /** * Prevents that Haveno gets hibernated from the OS. On OSX there is a tool called caffeinate but it seems it does not diff --git a/core/src/main/java/haveno/core/app/DomainInitialisation.java b/core/src/main/java/haveno/core/app/DomainInitialisation.java index 6383999dc7..7918ebc739 100644 --- a/core/src/main/java/haveno/core/app/DomainInitialisation.java +++ b/core/src/main/java/haveno/core/app/DomainInitialisation.java @@ -17,7 +17,6 @@ package haveno.core.app; -import com.google.inject.Inject; import haveno.common.ClockWatcher; import haveno.common.persistence.PersistenceManager; import haveno.core.account.sign.SignedWitnessService; @@ -52,6 +51,8 @@ import haveno.core.user.User; import haveno.core.xmr.Balances; import haveno.network.p2p.P2PService; import haveno.network.p2p.mailbox.MailboxMessageService; + +import javax.inject.Inject; import java.util.List; import java.util.function.Consumer; import java.util.stream.Collectors; diff --git a/core/src/main/java/haveno/core/app/HavenoSetup.java b/core/src/main/java/haveno/core/app/HavenoSetup.java index 9679ed51e2..d25e4ffed9 100644 --- a/core/src/main/java/haveno/core/app/HavenoSetup.java +++ b/core/src/main/java/haveno/core/app/HavenoSetup.java @@ -17,9 +17,6 @@ package haveno.core.app; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import com.google.inject.name.Named; import haveno.common.Timer; import haveno.common.UserThread; import haveno.common.app.DevEnv; @@ -65,6 +62,23 @@ import haveno.network.p2p.NodeAddress; import haveno.network.p2p.P2PService; import haveno.network.p2p.storage.payload.PersistableNetworkPayload; import haveno.network.utils.Utils; +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.SimpleBooleanProperty; +import javafx.beans.property.StringProperty; +import javafx.beans.value.ChangeListener; +import javafx.collections.SetChangeListener; +import lombok.Getter; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; +import org.bitcoinj.core.Coin; +import org.fxmisc.easybind.EasyBind; +import org.fxmisc.easybind.monadic.MonadicBinding; + +import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; @@ -79,19 +93,6 @@ import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.function.BiConsumer; import java.util.function.Consumer; -import javafx.beans.property.BooleanProperty; -import javafx.beans.property.DoubleProperty; -import javafx.beans.property.SimpleBooleanProperty; -import javafx.beans.property.StringProperty; -import javafx.beans.value.ChangeListener; -import javafx.collections.SetChangeListener; -import javax.annotation.Nullable; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import org.bitcoinj.core.Coin; -import org.fxmisc.easybind.EasyBind; -import org.fxmisc.easybind.monadic.MonadicBinding; @Slf4j @Singleton diff --git a/core/src/main/java/haveno/core/app/P2PNetworkSetup.java b/core/src/main/java/haveno/core/app/P2PNetworkSetup.java index 6c9a8e521c..bd52aab41c 100644 --- a/core/src/main/java/haveno/core/app/P2PNetworkSetup.java +++ b/core/src/main/java/haveno/core/app/P2PNetworkSetup.java @@ -17,8 +17,6 @@ package haveno.core.app; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.UserThread; import haveno.core.api.CoreMoneroConnectionsService; import haveno.core.locale.Res; @@ -29,17 +27,20 @@ import haveno.network.p2p.P2PServiceListener; import haveno.network.p2p.network.CloseConnectionReason; import haveno.network.p2p.network.Connection; import haveno.network.p2p.network.ConnectionListener; -import java.util.function.Consumer; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; -import javax.annotation.Nullable; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.fxmisc.easybind.EasyBind; import org.fxmisc.easybind.monadic.MonadicBinding; +import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Singleton; +import java.util.function.Consumer; + @Singleton @Slf4j public class P2PNetworkSetup { diff --git a/core/src/main/java/haveno/core/app/TorSetup.java b/core/src/main/java/haveno/core/app/TorSetup.java index 51f453e961..8976a10e04 100644 --- a/core/src/main/java/haveno/core/app/TorSetup.java +++ b/core/src/main/java/haveno/core/app/TorSetup.java @@ -17,18 +17,20 @@ package haveno.core.app; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.common.file.FileUtil; import haveno.common.handlers.ErrorMessageHandler; -import static haveno.common.util.Preconditions.checkDir; +import lombok.extern.slf4j.Slf4j; + +import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; import java.io.File; import java.io.IOException; import java.nio.file.Paths; -import javax.annotation.Nullable; -import lombok.extern.slf4j.Slf4j; + +import static haveno.common.util.Preconditions.checkDir; @Slf4j @Singleton diff --git a/core/src/main/java/haveno/core/app/WalletAppSetup.java b/core/src/main/java/haveno/core/app/WalletAppSetup.java index 768e541c4f..cc8959ebd8 100644 --- a/core/src/main/java/haveno/core/app/WalletAppSetup.java +++ b/core/src/main/java/haveno/core/app/WalletAppSetup.java @@ -17,8 +17,6 @@ package haveno.core.app; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.UserThread; import haveno.common.config.Config; import haveno.core.api.CoreContext; @@ -32,8 +30,6 @@ import haveno.core.xmr.exceptions.InvalidHostException; import haveno.core.xmr.exceptions.RejectedTxException; import haveno.core.xmr.setup.WalletsSetup; import haveno.core.xmr.wallet.WalletsManager; -import java.util.concurrent.TimeoutException; -import java.util.function.Consumer; import javafx.beans.property.BooleanProperty; import javafx.beans.property.DoubleProperty; import javafx.beans.property.ObjectProperty; @@ -42,10 +38,10 @@ import javafx.beans.property.SimpleDoubleProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; -import javax.annotation.Nullable; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import monero.daemon.model.MoneroDaemonInfo; + import org.bitcoinj.core.RejectMessage; import org.bitcoinj.core.VersionMessage; import org.bitcoinj.store.BlockStoreException; @@ -53,6 +49,12 @@ import org.bitcoinj.store.ChainFileLockedException; import org.fxmisc.easybind.EasyBind; import org.fxmisc.easybind.monadic.MonadicBinding; +import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Singleton; +import java.util.concurrent.TimeoutException; +import java.util.function.Consumer; + @Slf4j @Singleton public class WalletAppSetup { diff --git a/core/src/main/java/haveno/core/app/misc/AppSetup.java b/core/src/main/java/haveno/core/app/misc/AppSetup.java index b3b9f550d2..8ba2e88326 100644 --- a/core/src/main/java/haveno/core/app/misc/AppSetup.java +++ b/core/src/main/java/haveno/core/app/misc/AppSetup.java @@ -17,11 +17,12 @@ package haveno.core.app.misc; -import com.google.inject.Inject; import haveno.common.app.Version; import haveno.common.config.Config; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; + @Slf4j public abstract class AppSetup { protected final Config config; diff --git a/core/src/main/java/haveno/core/app/misc/AppSetupWithP2P.java b/core/src/main/java/haveno/core/app/misc/AppSetupWithP2P.java index bab66d605a..87e1100b90 100644 --- a/core/src/main/java/haveno/core/app/misc/AppSetupWithP2P.java +++ b/core/src/main/java/haveno/core/app/misc/AppSetupWithP2P.java @@ -17,7 +17,6 @@ package haveno.core.app.misc; -import com.google.inject.Inject; import haveno.common.config.Config; import haveno.common.persistence.PersistenceManager; import haveno.common.proto.persistable.PersistedDataHost; @@ -32,11 +31,13 @@ import haveno.network.p2p.network.Connection; import haveno.network.p2p.network.ConnectionListener; import haveno.network.p2p.peers.PeerManager; import haveno.network.p2p.storage.P2PDataStorage; -import java.util.ArrayList; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import java.util.ArrayList; + @Slf4j public class AppSetupWithP2P extends AppSetup { protected final P2PService p2PService; diff --git a/core/src/main/java/haveno/core/app/misc/AppSetupWithP2PAndDAO.java b/core/src/main/java/haveno/core/app/misc/AppSetupWithP2PAndDAO.java index 07b44a13cb..292085ecc8 100644 --- a/core/src/main/java/haveno/core/app/misc/AppSetupWithP2PAndDAO.java +++ b/core/src/main/java/haveno/core/app/misc/AppSetupWithP2PAndDAO.java @@ -17,7 +17,6 @@ package haveno.core.app.misc; -import com.google.inject.Inject; import haveno.common.config.Config; import haveno.core.account.sign.SignedWitnessService; import haveno.core.account.witness.AccountAgeWitnessService; @@ -28,6 +27,8 @@ import haveno.network.p2p.peers.PeerManager; import haveno.network.p2p.storage.P2PDataStorage; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; + @Slf4j public class AppSetupWithP2PAndDAO extends AppSetupWithP2P { diff --git a/core/src/main/java/haveno/core/filter/FilterManager.java b/core/src/main/java/haveno/core/filter/FilterManager.java index 00e17c5a29..169b209443 100644 --- a/core/src/main/java/haveno/core/filter/FilterManager.java +++ b/core/src/main/java/haveno/core/filter/FilterManager.java @@ -17,9 +17,6 @@ package haveno.core.filter; -import static com.google.common.base.Preconditions.checkNotNull; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.app.DevEnv; import haveno.common.app.Version; import haveno.common.config.Config; @@ -38,6 +35,16 @@ import haveno.network.p2p.P2PServiceListener; import haveno.network.p2p.network.BanFilter; import haveno.network.p2p.storage.HashMapChangedListener; import haveno.network.p2p.storage.payload.ProtectedStorageEntry; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleObjectProperty; +import lombok.extern.slf4j.Slf4j; +import org.bitcoinj.core.ECKey; +import org.bitcoinj.core.Sha256Hash; +import org.bouncycastle.util.encoders.Base64; + +import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Named; import java.lang.reflect.Method; import java.math.BigInteger; import java.nio.charset.StandardCharsets; @@ -51,14 +58,9 @@ import java.util.List; import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; import java.util.function.Consumer; -import javafx.beans.property.ObjectProperty; -import javafx.beans.property.SimpleObjectProperty; -import javax.annotation.Nullable; -import lombok.extern.slf4j.Slf4j; -import org.bitcoinj.core.ECKey; -import org.bitcoinj.core.Sha256Hash; + +import static com.google.common.base.Preconditions.checkNotNull; import static org.bitcoinj.core.Utils.HEX; -import org.bouncycastle.util.encoders.Base64; /** * We only support one active filter, if we receive multiple we use the one with the more recent creationDate. diff --git a/core/src/main/java/haveno/core/network/CoreBanFilter.java b/core/src/main/java/haveno/core/network/CoreBanFilter.java index e5ebc9a4d9..ef4406d114 100644 --- a/core/src/main/java/haveno/core/network/CoreBanFilter.java +++ b/core/src/main/java/haveno/core/network/CoreBanFilter.java @@ -17,16 +17,17 @@ package haveno.core.network; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.network.p2p.NodeAddress; import haveno.network.p2p.network.BanFilter; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Named; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.function.Predicate; -import lombok.extern.slf4j.Slf4j; @Slf4j public class CoreBanFilter implements BanFilter { diff --git a/core/src/main/java/haveno/core/network/p2p/inventory/GetInventoryRequestHandler.java b/core/src/main/java/haveno/core/network/p2p/inventory/GetInventoryRequestHandler.java index b923e655af..7d343a179d 100644 --- a/core/src/main/java/haveno/core/network/p2p/inventory/GetInventoryRequestHandler.java +++ b/core/src/main/java/haveno/core/network/p2p/inventory/GetInventoryRequestHandler.java @@ -20,8 +20,6 @@ package haveno.core.network.p2p.inventory; import com.google.common.base.Enums; import com.google.common.base.Joiner; import com.google.common.base.Optional; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.app.Version; import haveno.common.config.Config; import haveno.common.proto.network.NetworkEnvelope; @@ -39,10 +37,13 @@ import haveno.network.p2p.network.Statistic; import haveno.network.p2p.peers.PeerManager; import haveno.network.p2p.storage.P2PDataStorage; import haveno.network.p2p.storage.payload.ProtectedStorageEntry; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Named; import java.lang.management.ManagementFactory; import java.util.HashMap; import java.util.Map; -import lombok.extern.slf4j.Slf4j; @Slf4j public class GetInventoryRequestHandler implements MessageListener { diff --git a/core/src/main/java/haveno/core/network/p2p/inventory/GetInventoryRequestManager.java b/core/src/main/java/haveno/core/network/p2p/inventory/GetInventoryRequestManager.java index d3c3c1cf40..6b109c89bc 100644 --- a/core/src/main/java/haveno/core/network/p2p/inventory/GetInventoryRequestManager.java +++ b/core/src/main/java/haveno/core/network/p2p/inventory/GetInventoryRequestManager.java @@ -17,15 +17,16 @@ package haveno.core.network.p2p.inventory; -import com.google.inject.Inject; import haveno.common.handlers.ErrorMessageHandler; import haveno.core.network.p2p.inventory.model.InventoryItem; import haveno.network.p2p.NodeAddress; import haveno.network.p2p.network.NetworkNode; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; import java.util.HashMap; import java.util.Map; import java.util.function.Consumer; -import lombok.extern.slf4j.Slf4j; @Slf4j public class GetInventoryRequestManager { diff --git a/core/src/main/java/haveno/core/network/p2p/seed/DefaultSeedNodeRepository.java b/core/src/main/java/haveno/core/network/p2p/seed/DefaultSeedNodeRepository.java index 48dfd1dc44..ce2e1be653 100644 --- a/core/src/main/java/haveno/core/network/p2p/seed/DefaultSeedNodeRepository.java +++ b/core/src/main/java/haveno/core/network/p2p/seed/DefaultSeedNodeRepository.java @@ -17,11 +17,13 @@ package haveno.core.network.p2p.seed; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.config.Config; import haveno.network.p2p.NodeAddress; import haveno.network.p2p.seed.SeedNodeRepository; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; @@ -33,7 +35,6 @@ import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; -import lombok.extern.slf4j.Slf4j; // If a new BaseCurrencyNetwork type gets added we need to add the resource file for it as well! @Slf4j diff --git a/core/src/main/java/haveno/core/notifications/MobileMessageEncryption.java b/core/src/main/java/haveno/core/notifications/MobileMessageEncryption.java index 594343fab0..a2afc95e37 100644 --- a/core/src/main/java/haveno/core/notifications/MobileMessageEncryption.java +++ b/core/src/main/java/haveno/core/notifications/MobileMessageEncryption.java @@ -18,15 +18,16 @@ package haveno.core.notifications; import com.google.common.base.Charsets; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.security.NoSuchAlgorithmException; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.binary.Base64; + import javax.crypto.Cipher; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.codec.binary.Base64; +import javax.inject.Inject; +import javax.inject.Singleton; +import java.security.NoSuchAlgorithmException; @Slf4j @Singleton diff --git a/core/src/main/java/haveno/core/notifications/MobileModel.java b/core/src/main/java/haveno/core/notifications/MobileModel.java index b424911fbe..6adf318db1 100644 --- a/core/src/main/java/haveno/core/notifications/MobileModel.java +++ b/core/src/main/java/haveno/core/notifications/MobileModel.java @@ -18,14 +18,15 @@ package haveno.core.notifications; import com.google.common.annotations.VisibleForTesting; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.Arrays; -import javax.annotation.Nullable; import lombok.Data; import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Singleton; +import java.util.Arrays; + @Data @Slf4j @Singleton diff --git a/core/src/main/java/haveno/core/notifications/MobileNotificationService.java b/core/src/main/java/haveno/core/notifications/MobileNotificationService.java index d65fdbe82e..c222f3b704 100644 --- a/core/src/main/java/haveno/core/notifications/MobileNotificationService.java +++ b/core/src/main/java/haveno/core/notifications/MobileNotificationService.java @@ -17,8 +17,6 @@ package haveno.core.notifications; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; @@ -27,15 +25,12 @@ import com.google.common.util.concurrent.MoreExecutors; import com.google.gson.Gson; import com.google.inject.Inject; import com.google.inject.Singleton; -import com.google.inject.name.Named; import haveno.common.UserThread; import haveno.common.app.Version; import haveno.common.config.Config; import haveno.common.util.Utilities; import haveno.core.user.Preferences; import haveno.network.http.HttpClient; -import java.util.UUID; -import java.util.function.Consumer; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import lombok.Getter; @@ -43,6 +38,13 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.binary.Hex; import org.jetbrains.annotations.NotNull; +import javax.inject.Named; +import java.util.UUID; +import java.util.function.Consumer; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + @Slf4j @Singleton public class MobileNotificationService { diff --git a/core/src/main/java/haveno/core/notifications/MobileNotificationValidator.java b/core/src/main/java/haveno/core/notifications/MobileNotificationValidator.java index 456cf17f30..0004defa41 100644 --- a/core/src/main/java/haveno/core/notifications/MobileNotificationValidator.java +++ b/core/src/main/java/haveno/core/notifications/MobileNotificationValidator.java @@ -17,10 +17,11 @@ package haveno.core.notifications; -import com.google.inject.Inject; -import com.google.inject.Singleton; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import javax.inject.Singleton; + @Slf4j @Singleton public class MobileNotificationValidator { diff --git a/core/src/main/java/haveno/core/notifications/alerts/DisputeMsgEvents.java b/core/src/main/java/haveno/core/notifications/alerts/DisputeMsgEvents.java index ea9a73e9b1..41e890edbd 100644 --- a/core/src/main/java/haveno/core/notifications/alerts/DisputeMsgEvents.java +++ b/core/src/main/java/haveno/core/notifications/alerts/DisputeMsgEvents.java @@ -17,8 +17,6 @@ package haveno.core.notifications.alerts; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.core.locale.Res; import haveno.core.notifications.MobileMessage; import haveno.core.notifications.MobileMessageType; @@ -29,11 +27,14 @@ import haveno.core.support.dispute.mediation.MediationManager; import haveno.core.support.dispute.refund.RefundManager; import haveno.core.support.messages.ChatMessage; import haveno.network.p2p.P2PService; -import java.util.UUID; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import javax.inject.Singleton; +import java.util.UUID; + @Slf4j @Singleton public class DisputeMsgEvents { diff --git a/core/src/main/java/haveno/core/notifications/alerts/MyOfferTakenEvents.java b/core/src/main/java/haveno/core/notifications/alerts/MyOfferTakenEvents.java index 431e34804c..1424be3ef1 100644 --- a/core/src/main/java/haveno/core/notifications/alerts/MyOfferTakenEvents.java +++ b/core/src/main/java/haveno/core/notifications/alerts/MyOfferTakenEvents.java @@ -17,18 +17,19 @@ package haveno.core.notifications.alerts; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.core.locale.Res; import haveno.core.notifications.MobileMessage; import haveno.core.notifications.MobileMessageType; import haveno.core.notifications.MobileNotificationService; import haveno.core.offer.OpenOffer; import haveno.core.offer.OpenOfferManager; -import java.util.UUID; import javafx.collections.ListChangeListener; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import javax.inject.Singleton; +import java.util.UUID; + @Slf4j @Singleton public class MyOfferTakenEvents { diff --git a/core/src/main/java/haveno/core/notifications/alerts/TradeEvents.java b/core/src/main/java/haveno/core/notifications/alerts/TradeEvents.java index 92c0c9760c..aa9d8eeb69 100644 --- a/core/src/main/java/haveno/core/notifications/alerts/TradeEvents.java +++ b/core/src/main/java/haveno/core/notifications/alerts/TradeEvents.java @@ -17,8 +17,6 @@ package haveno.core.notifications.alerts; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.crypto.PubKeyRingProvider; import haveno.core.locale.Res; import haveno.core.notifications.MobileMessage; @@ -26,11 +24,14 @@ import haveno.core.notifications.MobileMessageType; import haveno.core.notifications.MobileNotificationService; import haveno.core.trade.Trade; import haveno.core.trade.TradeManager; +import javafx.collections.ListChangeListener; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.util.ArrayList; import java.util.List; import java.util.UUID; -import javafx.collections.ListChangeListener; -import lombok.extern.slf4j.Slf4j; @Slf4j @Singleton diff --git a/core/src/main/java/haveno/core/notifications/alerts/market/MarketAlerts.java b/core/src/main/java/haveno/core/notifications/alerts/market/MarketAlerts.java index 1790fc56db..07fc7fb848 100644 --- a/core/src/main/java/haveno/core/notifications/alerts/market/MarketAlerts.java +++ b/core/src/main/java/haveno/core/notifications/alerts/market/MarketAlerts.java @@ -17,8 +17,6 @@ package haveno.core.notifications.alerts.market; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.crypto.KeyRing; import haveno.common.util.MathUtils; import haveno.core.locale.CurrencyUtil; @@ -36,9 +34,12 @@ import haveno.core.provider.price.MarketPrice; import haveno.core.provider.price.PriceFeedService; import haveno.core.user.User; import haveno.core.util.FormattingUtils; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.util.List; import java.util.UUID; -import lombok.extern.slf4j.Slf4j; @Slf4j @Singleton diff --git a/core/src/main/java/haveno/core/notifications/alerts/price/PriceAlert.java b/core/src/main/java/haveno/core/notifications/alerts/price/PriceAlert.java index 7f369c11da..684533a498 100644 --- a/core/src/main/java/haveno/core/notifications/alerts/price/PriceAlert.java +++ b/core/src/main/java/haveno/core/notifications/alerts/price/PriceAlert.java @@ -17,8 +17,6 @@ package haveno.core.notifications.alerts.price; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.util.MathUtils; import haveno.core.locale.CurrencyUtil; import haveno.core.locale.Res; @@ -33,6 +31,9 @@ import haveno.core.user.User; import haveno.core.util.FormattingUtils; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import javax.inject.Singleton; + @Slf4j @Singleton public class PriceAlert { diff --git a/core/src/main/java/haveno/core/offer/CreateOfferService.java b/core/src/main/java/haveno/core/offer/CreateOfferService.java index 141a7e2b9c..2b60736099 100644 --- a/core/src/main/java/haveno/core/offer/CreateOfferService.java +++ b/core/src/main/java/haveno/core/offer/CreateOfferService.java @@ -17,8 +17,6 @@ package haveno.core.offer; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.app.Version; import haveno.common.crypto.PubKeyRingProvider; import haveno.common.util.Utilities; @@ -40,12 +38,15 @@ import haveno.core.xmr.wallet.Restrictions; import haveno.core.xmr.wallet.XmrWalletService; import haveno.network.p2p.NodeAddress; import haveno.network.p2p.P2PService; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.math.BigInteger; import java.util.Date; import java.util.List; import java.util.Map; import java.util.UUID; -import lombok.extern.slf4j.Slf4j; @Slf4j @Singleton diff --git a/core/src/main/java/haveno/core/offer/OfferBookService.java b/core/src/main/java/haveno/core/offer/OfferBookService.java index 4668717fac..42f07ad71c 100644 --- a/core/src/main/java/haveno/core/offer/OfferBookService.java +++ b/core/src/main/java/haveno/core/offer/OfferBookService.java @@ -17,8 +17,6 @@ package haveno.core.offer; -import com.google.inject.Inject; -import com.google.inject.name.Named; import common.utils.GenUtils; import haveno.common.UserThread; import haveno.common.config.Config; @@ -36,6 +34,15 @@ import haveno.network.p2p.BootstrapListener; import haveno.network.p2p.P2PService; import haveno.network.p2p.storage.HashMapChangedListener; import haveno.network.p2p.storage.payload.ProtectedStorageEntry; +import monero.common.MoneroConnectionManagerListener; +import monero.common.MoneroRpcConnection; +import monero.daemon.model.MoneroKeyImageSpentStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Named; import java.io.File; import java.util.Collection; import java.util.LinkedList; @@ -43,12 +50,6 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; -import javax.annotation.Nullable; -import monero.common.MoneroConnectionManagerListener; -import monero.common.MoneroRpcConnection; -import monero.daemon.model.MoneroKeyImageSpentStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Handles storage and retrieval of offers. diff --git a/core/src/main/java/haveno/core/offer/OfferFilterService.java b/core/src/main/java/haveno/core/offer/OfferFilterService.java index 5949ba9be0..1339f315c8 100644 --- a/core/src/main/java/haveno/core/offer/OfferFilterService.java +++ b/core/src/main/java/haveno/core/offer/OfferFilterService.java @@ -17,8 +17,6 @@ package haveno.core.offer; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.app.Version; import haveno.core.account.witness.AccountAgeWitnessService; import haveno.core.filter.FilterManager; @@ -30,15 +28,18 @@ import haveno.core.user.Preferences; import haveno.core.user.User; import haveno.network.p2p.NodeAddress; import haveno.network.p2p.P2PService; +import javafx.collections.SetChangeListener; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import org.bitcoinj.core.Coin; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; -import javafx.collections.SetChangeListener; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import org.bitcoinj.core.Coin; @Slf4j @Singleton diff --git a/core/src/main/java/haveno/core/offer/OfferUtil.java b/core/src/main/java/haveno/core/offer/OfferUtil.java index 1c74683d86..64e9f9b25c 100644 --- a/core/src/main/java/haveno/core/offer/OfferUtil.java +++ b/core/src/main/java/haveno/core/offer/OfferUtil.java @@ -17,15 +17,9 @@ package haveno.core.offer; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.app.Capabilities; import haveno.common.app.Version; import haveno.common.util.MathUtils; -import static haveno.common.util.MathUtils.roundDoubleToLong; -import static haveno.common.util.MathUtils.scaleUpByPowerOf10; import haveno.common.util.Utilities; import haveno.core.account.witness.AccountAgeWitnessService; import haveno.core.filter.FilterManager; @@ -34,16 +28,8 @@ import haveno.core.locale.Res; import haveno.core.monetary.Price; import haveno.core.monetary.TraditionalMoney; import haveno.core.monetary.Volume; -import static haveno.core.offer.OfferPayload.ACCOUNT_AGE_WITNESS_HASH; -import static haveno.core.offer.OfferPayload.CAPABILITIES; -import static haveno.core.offer.OfferPayload.F2F_CITY; -import static haveno.core.offer.OfferPayload.F2F_EXTRA_INFO; -import static haveno.core.offer.OfferPayload.PAY_BY_MAIL_EXTRA_INFO; -import static haveno.core.offer.OfferPayload.REFERRAL_ID; -import static haveno.core.offer.OfferPayload.XMR_AUTO_CONF; -import static haveno.core.offer.OfferPayload.XMR_AUTO_CONF_ENABLED_VALUE; -import haveno.core.payment.F2FAccount; import haveno.core.payment.PayByMailAccount; +import haveno.core.payment.F2FAccount; import haveno.core.payment.PaymentAccount; import haveno.core.provider.price.MarketPrice; import haveno.core.provider.price.PriceFeedService; @@ -52,18 +38,34 @@ import haveno.core.user.AutoConfirmSettings; import haveno.core.user.Preferences; import haveno.core.util.coin.CoinFormatter; import haveno.core.xmr.wallet.BtcWalletService; -import static haveno.core.xmr.wallet.Restrictions.getMaxBuyerSecurityDepositAsPercent; -import static haveno.core.xmr.wallet.Restrictions.getMinBuyerSecurityDepositAsPercent; import haveno.network.p2p.P2PService; +import lombok.extern.slf4j.Slf4j; +import org.bitcoinj.core.Transaction; +import org.bitcoinj.core.TransactionInput; +import org.bitcoinj.core.TransactionOutput; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.math.BigInteger; import java.util.HashMap; import java.util.Map; import java.util.Optional; import java.util.UUID; -import lombok.extern.slf4j.Slf4j; -import org.bitcoinj.core.Transaction; -import org.bitcoinj.core.TransactionInput; -import org.bitcoinj.core.TransactionOutput; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; +import static haveno.common.util.MathUtils.roundDoubleToLong; +import static haveno.common.util.MathUtils.scaleUpByPowerOf10; +import static haveno.core.offer.OfferPayload.ACCOUNT_AGE_WITNESS_HASH; +import static haveno.core.offer.OfferPayload.CAPABILITIES; +import static haveno.core.offer.OfferPayload.PAY_BY_MAIL_EXTRA_INFO; +import static haveno.core.offer.OfferPayload.F2F_CITY; +import static haveno.core.offer.OfferPayload.F2F_EXTRA_INFO; +import static haveno.core.offer.OfferPayload.REFERRAL_ID; +import static haveno.core.offer.OfferPayload.XMR_AUTO_CONF; +import static haveno.core.offer.OfferPayload.XMR_AUTO_CONF_ENABLED_VALUE; +import static haveno.core.xmr.wallet.Restrictions.getMaxBuyerSecurityDepositAsPercent; +import static haveno.core.xmr.wallet.Restrictions.getMinBuyerSecurityDepositAsPercent; /** * This class holds utility methods for creating, editing and taking an Offer. diff --git a/core/src/main/java/haveno/core/offer/OpenOfferManager.java b/core/src/main/java/haveno/core/offer/OpenOfferManager.java index b7f8eb4a61..29f0cbb7bc 100644 --- a/core/src/main/java/haveno/core/offer/OpenOfferManager.java +++ b/core/src/main/java/haveno/core/offer/OpenOfferManager.java @@ -17,8 +17,6 @@ package haveno.core.offer; -import static com.google.common.base.Preconditions.checkNotNull; -import com.google.inject.Inject; import common.utils.GenUtils; import haveno.common.Timer; import haveno.common.UserThread; @@ -74,22 +72,8 @@ import haveno.network.p2p.P2PService; import haveno.network.p2p.SendDirectMessageListener; import haveno.network.p2p.peers.Broadcaster; import haveno.network.p2p.peers.PeerManager; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; import javafx.collections.FXCollections; import javafx.collections.ObservableList; -import javax.annotation.Nullable; import lombok.Getter; import monero.common.MoneroConnectionManagerListener; import monero.common.MoneroRpcConnection; @@ -106,6 +90,24 @@ import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.annotation.Nullable; +import javax.inject.Inject; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import static com.google.common.base.Preconditions.checkNotNull; + public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMessageListener, PersistedDataHost { private static final Logger log = LoggerFactory.getLogger(OpenOfferManager.class); @@ -800,13 +802,13 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe resultHandler.handleResult(null); return; } - + // get offer reserve amount BigInteger offerReserveAmount = openOffer.getOffer().getReserveAmount(); - + // handle split output offer if (openOffer.isSplitOutput()) { - + // get tx to fund split output MoneroTxWallet splitOutputTx = findSplitOutputFundingTx(openOffers, openOffer); if (openOffer.getScheduledTxHashes() == null && splitOutputTx != null) { @@ -839,7 +841,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe } } } else { - + // handle sufficient balance boolean hasSufficientBalance = xmrWalletService.getWallet().getUnlockedBalance(0).compareTo(offerReserveAmount) >= 0; if (hasSufficientBalance) { @@ -849,7 +851,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe scheduleOfferWithEarliestTxs(openOffers, openOffer); } } - + // handle result resultHandler.handleResult(null); } catch (Exception e) { diff --git a/core/src/main/java/haveno/core/offer/TriggerPriceService.java b/core/src/main/java/haveno/core/offer/TriggerPriceService.java index 578140d9bf..37ebdaaf4f 100644 --- a/core/src/main/java/haveno/core/offer/TriggerPriceService.java +++ b/core/src/main/java/haveno/core/offer/TriggerPriceService.java @@ -17,11 +17,7 @@ package haveno.core.offer; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.util.MathUtils; -import static haveno.common.util.MathUtils.roundDoubleToLong; -import static haveno.common.util.MathUtils.scaleUpByPowerOf10; import haveno.core.locale.CurrencyUtil; import haveno.core.monetary.CryptoMoney; import haveno.core.monetary.Price; @@ -31,14 +27,20 @@ import haveno.core.provider.price.MarketPrice; import haveno.core.provider.price.PriceFeedService; import haveno.network.p2p.BootstrapListener; import haveno.network.p2p.P2PService; +import javafx.collections.ListChangeListener; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; -import javafx.collections.ListChangeListener; -import lombok.extern.slf4j.Slf4j; + +import static haveno.common.util.MathUtils.roundDoubleToLong; +import static haveno.common.util.MathUtils.scaleUpByPowerOf10; @Slf4j @Singleton diff --git a/core/src/main/java/haveno/core/offer/takeoffer/TakeOfferModel.java b/core/src/main/java/haveno/core/offer/takeoffer/TakeOfferModel.java index 4df367d4a1..f97839c944 100644 --- a/core/src/main/java/haveno/core/offer/takeoffer/TakeOfferModel.java +++ b/core/src/main/java/haveno/core/offer/takeoffer/TakeOfferModel.java @@ -17,29 +17,31 @@ package haveno.core.offer.takeoffer; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import com.google.inject.Inject; import haveno.common.taskrunner.Model; import haveno.core.account.witness.AccountAgeWitnessService; import haveno.core.monetary.Price; import haveno.core.monetary.Volume; import haveno.core.offer.Offer; -import static haveno.core.offer.OfferDirection.SELL; import haveno.core.offer.OfferUtil; import haveno.core.payment.PaymentAccount; import haveno.core.provider.price.PriceFeedService; import haveno.core.trade.HavenoUtils; import haveno.core.util.VolumeUtil; import haveno.core.xmr.model.XmrAddressEntry; -import static haveno.core.xmr.model.XmrAddressEntry.Context.OFFER_FUNDING; import haveno.core.xmr.wallet.XmrWalletService; -import java.math.BigInteger; -import java.util.Objects; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; +import javax.inject.Inject; +import java.math.BigInteger; +import java.util.Objects; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; +import static haveno.core.offer.OfferDirection.SELL; +import static haveno.core.xmr.model.XmrAddressEntry.Context.OFFER_FUNDING; + @Slf4j public class TakeOfferModel implements Model { // Immutable diff --git a/core/src/main/java/haveno/core/payment/ChargeBackRisk.java b/core/src/main/java/haveno/core/payment/ChargeBackRisk.java index 99f12d37fc..ec35030b73 100644 --- a/core/src/main/java/haveno/core/payment/ChargeBackRisk.java +++ b/core/src/main/java/haveno/core/payment/ChargeBackRisk.java @@ -17,9 +17,10 @@ package haveno.core.payment; -import com.google.inject.Singleton; import haveno.core.payment.payload.PaymentMethod; +import javax.inject.Singleton; + @Singleton public class ChargeBackRisk { public boolean hasChargebackRisk(String id, String currencyCode) { diff --git a/core/src/main/java/haveno/core/payment/TradeLimits.java b/core/src/main/java/haveno/core/payment/TradeLimits.java index 7acee5d4bc..e41ec8423f 100644 --- a/core/src/main/java/haveno/core/payment/TradeLimits.java +++ b/core/src/main/java/haveno/core/payment/TradeLimits.java @@ -18,15 +18,16 @@ package haveno.core.payment; import com.google.common.annotations.VisibleForTesting; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.util.MathUtils; import haveno.core.trade.HavenoUtils; -import java.math.BigInteger; -import javax.annotation.Nullable; import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Singleton; +import java.math.BigInteger; + @Slf4j @Singleton public class TradeLimits { diff --git a/core/src/main/java/haveno/core/payment/validation/AdvancedCashValidator.java b/core/src/main/java/haveno/core/payment/validation/AdvancedCashValidator.java index cce112b189..b6504d351c 100644 --- a/core/src/main/java/haveno/core/payment/validation/AdvancedCashValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/AdvancedCashValidator.java @@ -1,10 +1,11 @@ package haveno.core.payment.validation; -import com.google.inject.Inject; import haveno.core.locale.Res; import haveno.core.util.validation.InputValidator; import haveno.core.util.validation.RegexValidator; +import javax.inject.Inject; + public class AdvancedCashValidator extends InputValidator { private EmailValidator emailValidator; private RegexValidator regexValidator; diff --git a/core/src/main/java/haveno/core/payment/validation/AustraliaPayidAccountNameValidator.java b/core/src/main/java/haveno/core/payment/validation/AustraliaPayidAccountNameValidator.java index b8c1964e19..2a91270bc5 100644 --- a/core/src/main/java/haveno/core/payment/validation/AustraliaPayidAccountNameValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/AustraliaPayidAccountNameValidator.java @@ -18,10 +18,11 @@ package haveno.core.payment.validation; -import com.google.inject.Inject; import haveno.core.util.validation.InputValidator; import haveno.core.util.validation.RegexValidator; +import javax.inject.Inject; + public final class AustraliaPayidAccountNameValidator extends InputValidator { @Override public ValidationResult validate(String input) { diff --git a/core/src/main/java/haveno/core/payment/validation/CapitualValidator.java b/core/src/main/java/haveno/core/payment/validation/CapitualValidator.java index e18ef0f733..a156193fce 100644 --- a/core/src/main/java/haveno/core/payment/validation/CapitualValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/CapitualValidator.java @@ -1,10 +1,11 @@ package haveno.core.payment.validation; -import com.google.inject.Inject; import haveno.core.locale.Res; import haveno.core.util.validation.InputValidator; import haveno.core.util.validation.RegexValidator; +import javax.inject.Inject; + public class CapitualValidator extends InputValidator { private final RegexValidator regexValidator; diff --git a/core/src/main/java/haveno/core/payment/validation/FiatVolumeValidator.java b/core/src/main/java/haveno/core/payment/validation/FiatVolumeValidator.java index 2950b0faf2..48f81024a2 100644 --- a/core/src/main/java/haveno/core/payment/validation/FiatVolumeValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/FiatVolumeValidator.java @@ -17,9 +17,10 @@ package haveno.core.payment.validation; -import com.google.inject.Inject; import haveno.core.util.validation.MonetaryValidator; +import javax.inject.Inject; + public class FiatVolumeValidator extends MonetaryValidator { @Override public double getMinValue() { diff --git a/core/src/main/java/haveno/core/payment/validation/InteracETransferAnswerValidator.java b/core/src/main/java/haveno/core/payment/validation/InteracETransferAnswerValidator.java index 4bae615941..47841dcc9b 100644 --- a/core/src/main/java/haveno/core/payment/validation/InteracETransferAnswerValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/InteracETransferAnswerValidator.java @@ -1,10 +1,11 @@ package haveno.core.payment.validation; -import com.google.inject.Inject; import haveno.core.locale.Res; import haveno.core.util.validation.InputValidator; import haveno.core.util.validation.RegexValidator; +import javax.inject.Inject; + public class InteracETransferAnswerValidator extends InputValidator { private LengthValidator lengthValidator; private RegexValidator regexValidator; diff --git a/core/src/main/java/haveno/core/payment/validation/InteracETransferQuestionValidator.java b/core/src/main/java/haveno/core/payment/validation/InteracETransferQuestionValidator.java index 2fa0cf8550..6fd7c865f9 100644 --- a/core/src/main/java/haveno/core/payment/validation/InteracETransferQuestionValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/InteracETransferQuestionValidator.java @@ -1,10 +1,11 @@ package haveno.core.payment.validation; -import com.google.inject.Inject; import haveno.core.locale.Res; import haveno.core.util.validation.InputValidator; import haveno.core.util.validation.RegexValidator; +import javax.inject.Inject; + public class InteracETransferQuestionValidator extends InputValidator { private LengthValidator lengthValidator; private RegexValidator regexValidator; diff --git a/core/src/main/java/haveno/core/payment/validation/InteracETransferValidator.java b/core/src/main/java/haveno/core/payment/validation/InteracETransferValidator.java index 7af54e8255..973f62af60 100644 --- a/core/src/main/java/haveno/core/payment/validation/InteracETransferValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/InteracETransferValidator.java @@ -17,11 +17,12 @@ package haveno.core.payment.validation; -import com.google.inject.Inject; import haveno.core.locale.Res; import haveno.core.util.validation.InputValidator; import org.apache.commons.lang3.StringUtils; +import javax.inject.Inject; + /* * Interac e-Transfer requires a mail address or Canadian (mobile) phone number * diff --git a/core/src/main/java/haveno/core/payment/validation/JapanBankAccountNameValidator.java b/core/src/main/java/haveno/core/payment/validation/JapanBankAccountNameValidator.java index f8c71ace9f..1ec805b9f4 100644 --- a/core/src/main/java/haveno/core/payment/validation/JapanBankAccountNameValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/JapanBankAccountNameValidator.java @@ -17,11 +17,12 @@ package haveno.core.payment.validation; -import com.google.inject.Inject; import haveno.core.payment.JapanBankData; import haveno.core.util.validation.InputValidator; import haveno.core.util.validation.RegexValidator; +import javax.inject.Inject; + public final class JapanBankAccountNameValidator extends InputValidator { @Override diff --git a/core/src/main/java/haveno/core/payment/validation/JapanBankBranchNameValidator.java b/core/src/main/java/haveno/core/payment/validation/JapanBankBranchNameValidator.java index 95573d679e..79650acb53 100644 --- a/core/src/main/java/haveno/core/payment/validation/JapanBankBranchNameValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/JapanBankBranchNameValidator.java @@ -17,11 +17,12 @@ package haveno.core.payment.validation; -import com.google.inject.Inject; import haveno.core.payment.JapanBankData; import haveno.core.util.validation.InputValidator; import haveno.core.util.validation.RegexValidator; +import javax.inject.Inject; + public final class JapanBankBranchNameValidator extends InputValidator { @Override diff --git a/core/src/main/java/haveno/core/payment/validation/SecurityDepositValidator.java b/core/src/main/java/haveno/core/payment/validation/SecurityDepositValidator.java index 702030074a..212b8fbd5c 100644 --- a/core/src/main/java/haveno/core/payment/validation/SecurityDepositValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/SecurityDepositValidator.java @@ -17,7 +17,6 @@ package haveno.core.payment.validation; -import com.google.inject.Inject; import haveno.core.locale.Res; import haveno.core.payment.PaymentAccount; import haveno.core.util.FormattingUtils; @@ -25,6 +24,8 @@ import haveno.core.util.ParsingUtils; import haveno.core.util.validation.NumberValidator; import haveno.core.xmr.wallet.Restrictions; +import javax.inject.Inject; + public class SecurityDepositValidator extends NumberValidator { private PaymentAccount paymentAccount; diff --git a/core/src/main/java/haveno/core/payment/validation/TransferwiseValidator.java b/core/src/main/java/haveno/core/payment/validation/TransferwiseValidator.java index e322aa0ae6..ecf0948730 100644 --- a/core/src/main/java/haveno/core/payment/validation/TransferwiseValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/TransferwiseValidator.java @@ -17,9 +17,10 @@ package haveno.core.payment.validation; -import com.google.inject.Inject; import haveno.core.util.validation.InputValidator; +import javax.inject.Inject; + public final class TransferwiseValidator extends InputValidator { private final EmailValidator emailValidator; diff --git a/core/src/main/java/haveno/core/payment/validation/XmrValidator.java b/core/src/main/java/haveno/core/payment/validation/XmrValidator.java index 28d513668e..1fa3c1cbc9 100644 --- a/core/src/main/java/haveno/core/payment/validation/XmrValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/XmrValidator.java @@ -17,16 +17,17 @@ package haveno.core.payment.validation; -import com.google.inject.Inject; import haveno.core.locale.Res; import haveno.core.trade.HavenoUtils; import haveno.core.util.validation.NumberValidator; -import java.math.BigDecimal; -import java.math.BigInteger; -import javax.annotation.Nullable; import lombok.Getter; import lombok.Setter; +import javax.annotation.Nullable; +import javax.inject.Inject; +import java.math.BigDecimal; +import java.math.BigInteger; + public class XmrValidator extends NumberValidator { @Nullable diff --git a/core/src/main/java/haveno/core/presentation/BalancePresentation.java b/core/src/main/java/haveno/core/presentation/BalancePresentation.java index ea9cc3a4a0..2ef1a22c7e 100644 --- a/core/src/main/java/haveno/core/presentation/BalancePresentation.java +++ b/core/src/main/java/haveno/core/presentation/BalancePresentation.java @@ -17,7 +17,6 @@ package haveno.core.presentation; -import com.google.inject.Inject; import haveno.common.UserThread; import haveno.core.trade.HavenoUtils; import haveno.core.xmr.Balances; @@ -26,6 +25,8 @@ import javafx.beans.property.StringProperty; import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; + @Slf4j public class BalancePresentation { diff --git a/core/src/main/java/haveno/core/presentation/SupportTicketsPresentation.java b/core/src/main/java/haveno/core/presentation/SupportTicketsPresentation.java index 8db7e0e307..652dbf246b 100644 --- a/core/src/main/java/haveno/core/presentation/SupportTicketsPresentation.java +++ b/core/src/main/java/haveno/core/presentation/SupportTicketsPresentation.java @@ -17,7 +17,6 @@ package haveno.core.presentation; -import com.google.inject.Inject; import haveno.core.support.dispute.arbitration.ArbitrationManager; import haveno.core.support.dispute.mediation.MediationManager; import haveno.core.support.dispute.refund.RefundManager; @@ -27,6 +26,8 @@ import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import lombok.Getter; +import javax.inject.Inject; + public class SupportTicketsPresentation { @Getter private final StringProperty numOpenSupportTickets = new SimpleStringProperty(); diff --git a/core/src/main/java/haveno/core/presentation/TradePresentation.java b/core/src/main/java/haveno/core/presentation/TradePresentation.java index ccb28ddf51..a1d745f497 100644 --- a/core/src/main/java/haveno/core/presentation/TradePresentation.java +++ b/core/src/main/java/haveno/core/presentation/TradePresentation.java @@ -17,7 +17,6 @@ package haveno.core.presentation; -import com.google.inject.Inject; import haveno.common.UserThread; import haveno.core.trade.TradeManager; import javafx.beans.property.BooleanProperty; @@ -26,6 +25,8 @@ import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import lombok.Getter; +import javax.inject.Inject; + public class TradePresentation { @Getter private final StringProperty numPendingTrades = new SimpleStringProperty(); diff --git a/core/src/main/java/haveno/core/proto/network/CoreNetworkProtoResolver.java b/core/src/main/java/haveno/core/proto/network/CoreNetworkProtoResolver.java index 4b947ff1bb..3443b150c2 100644 --- a/core/src/main/java/haveno/core/proto/network/CoreNetworkProtoResolver.java +++ b/core/src/main/java/haveno/core/proto/network/CoreNetworkProtoResolver.java @@ -17,8 +17,6 @@ package haveno.core.proto.network; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.proto.ProtobufferException; import haveno.common.proto.ProtobufferRuntimeException; import haveno.common.proto.network.NetworkEnvelope; @@ -71,9 +69,12 @@ import haveno.network.p2p.storage.messages.RemoveMailboxDataMessage; import haveno.network.p2p.storage.payload.MailboxStoragePayload; import haveno.network.p2p.storage.payload.ProtectedMailboxStorageEntry; import haveno.network.p2p.storage.payload.ProtectedStorageEntry; -import java.time.Clock; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import javax.inject.Singleton; +import java.time.Clock; + // TODO Use ProtobufferException instead of ProtobufferRuntimeException @Slf4j @Singleton diff --git a/core/src/main/java/haveno/core/proto/persistable/CorePersistenceProtoResolver.java b/core/src/main/java/haveno/core/proto/persistable/CorePersistenceProtoResolver.java index 733872ce9b..53bd30a2be 100644 --- a/core/src/main/java/haveno/core/proto/persistable/CorePersistenceProtoResolver.java +++ b/core/src/main/java/haveno/core/proto/persistable/CorePersistenceProtoResolver.java @@ -17,9 +17,7 @@ package haveno.core.proto.persistable; -import com.google.inject.Inject; import com.google.inject.Provider; -import com.google.inject.Singleton; import haveno.common.proto.ProtobufferRuntimeException; import haveno.common.proto.network.NetworkProtoResolver; import haveno.common.proto.persistable.NavigationPath; @@ -49,6 +47,9 @@ import haveno.network.p2p.storage.persistence.RemovedPayloadsMap; import haveno.network.p2p.storage.persistence.SequenceNumberMap; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import javax.inject.Singleton; + // TODO Use ProtobufferException instead of ProtobufferRuntimeException @Slf4j @Singleton diff --git a/core/src/main/java/haveno/core/provider/FeeHttpClient.java b/core/src/main/java/haveno/core/provider/FeeHttpClient.java index dc6dc2a155..8ca15c3cab 100644 --- a/core/src/main/java/haveno/core/provider/FeeHttpClient.java +++ b/core/src/main/java/haveno/core/provider/FeeHttpClient.java @@ -17,11 +17,12 @@ package haveno.core.provider; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.network.Socks5ProxyProvider; import haveno.network.http.HttpClientImpl; + import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Singleton; @Singleton public class FeeHttpClient extends HttpClientImpl { diff --git a/core/src/main/java/haveno/core/provider/MempoolHttpClient.java b/core/src/main/java/haveno/core/provider/MempoolHttpClient.java index 25e2a196f3..70695fdff4 100644 --- a/core/src/main/java/haveno/core/provider/MempoolHttpClient.java +++ b/core/src/main/java/haveno/core/provider/MempoolHttpClient.java @@ -17,13 +17,14 @@ package haveno.core.provider; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.app.Version; import haveno.network.Socks5ProxyProvider; import haveno.network.http.HttpClientImpl; -import java.io.IOException; + import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Singleton; +import java.io.IOException; @Singleton public class MempoolHttpClient extends HttpClientImpl { diff --git a/core/src/main/java/haveno/core/provider/PriceHttpClient.java b/core/src/main/java/haveno/core/provider/PriceHttpClient.java index f59b118711..2041fe0aa7 100644 --- a/core/src/main/java/haveno/core/provider/PriceHttpClient.java +++ b/core/src/main/java/haveno/core/provider/PriceHttpClient.java @@ -17,11 +17,12 @@ package haveno.core.provider; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.network.Socks5ProxyProvider; import haveno.network.http.HttpClientImpl; + import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Singleton; @Singleton public class PriceHttpClient extends HttpClientImpl { diff --git a/core/src/main/java/haveno/core/provider/ProvidersRepository.java b/core/src/main/java/haveno/core/provider/ProvidersRepository.java index 1e8ffd1477..99d7ed767a 100644 --- a/core/src/main/java/haveno/core/provider/ProvidersRepository.java +++ b/core/src/main/java/haveno/core/provider/ProvidersRepository.java @@ -18,15 +18,17 @@ package haveno.core.provider; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; + +import javax.annotation.Nullable; +import javax.inject.Named; + import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; -import javax.annotation.Nullable; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; @Slf4j public class ProvidersRepository { diff --git a/core/src/main/java/haveno/core/provider/mempool/MempoolService.java b/core/src/main/java/haveno/core/provider/mempool/MempoolService.java index 7f4360a684..d92dea000f 100644 --- a/core/src/main/java/haveno/core/provider/mempool/MempoolService.java +++ b/core/src/main/java/haveno/core/provider/mempool/MempoolService.java @@ -22,7 +22,6 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.SettableFuture; import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.UserThread; import haveno.common.config.Config; import haveno.core.filter.FilterManager; @@ -30,14 +29,16 @@ import haveno.core.offer.OfferPayload; import haveno.core.trade.Trade; import haveno.core.user.Preferences; import haveno.network.Socks5ProxyProvider; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import org.bitcoinj.core.Coin; + +import javax.annotation.Nullable; +import javax.inject.Singleton; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.function.Consumer; -import javax.annotation.Nullable; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import org.bitcoinj.core.Coin; @Slf4j @Singleton diff --git a/core/src/main/java/haveno/core/support/dispute/arbitration/ArbitrationDisputeListService.java b/core/src/main/java/haveno/core/support/dispute/arbitration/ArbitrationDisputeListService.java index f151d630e2..2d9f11756b 100644 --- a/core/src/main/java/haveno/core/support/dispute/arbitration/ArbitrationDisputeListService.java +++ b/core/src/main/java/haveno/core/support/dispute/arbitration/ArbitrationDisputeListService.java @@ -17,11 +17,12 @@ package haveno.core.support.dispute.arbitration; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.persistence.PersistenceManager; import haveno.core.support.dispute.DisputeListService; +import javax.inject.Inject; +import javax.inject.Singleton; + @Singleton public final class ArbitrationDisputeListService extends DisputeListService { diff --git a/core/src/main/java/haveno/core/support/dispute/arbitration/arbitrator/ArbitratorManager.java b/core/src/main/java/haveno/core/support/dispute/arbitration/arbitrator/ArbitratorManager.java index 9426b9dc5c..3f507e0a49 100644 --- a/core/src/main/java/haveno/core/support/dispute/arbitration/arbitrator/ArbitratorManager.java +++ b/core/src/main/java/haveno/core/support/dispute/arbitration/arbitrator/ArbitratorManager.java @@ -17,17 +17,18 @@ package haveno.core.support.dispute.arbitration.arbitrator; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.config.Config; import haveno.common.crypto.KeyRing; import haveno.core.filter.FilterManager; import haveno.core.support.dispute.agent.DisputeAgentManager; import haveno.core.user.User; import haveno.network.p2p.storage.payload.ProtectedStorageEntry; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.util.ArrayList; import java.util.List; -import lombok.extern.slf4j.Slf4j; @Slf4j @Singleton diff --git a/core/src/main/java/haveno/core/support/dispute/arbitration/arbitrator/ArbitratorService.java b/core/src/main/java/haveno/core/support/dispute/arbitration/arbitrator/ArbitratorService.java index 4467fc4d3b..46b35a7ed6 100644 --- a/core/src/main/java/haveno/core/support/dispute/arbitration/arbitrator/ArbitratorService.java +++ b/core/src/main/java/haveno/core/support/dispute/arbitration/arbitrator/ArbitratorService.java @@ -17,12 +17,13 @@ package haveno.core.support.dispute.arbitration.arbitrator; -import com.google.inject.Inject; import com.google.inject.Singleton; import haveno.core.filter.FilterManager; import haveno.core.support.dispute.agent.DisputeAgentService; import haveno.network.p2p.NodeAddress; import haveno.network.p2p.P2PService; + +import javax.inject.Inject; import java.util.ArrayList; import java.util.List; import java.util.Map; diff --git a/core/src/main/java/haveno/core/support/dispute/mediation/MediationDisputeListService.java b/core/src/main/java/haveno/core/support/dispute/mediation/MediationDisputeListService.java index db39b914f4..37021b9974 100644 --- a/core/src/main/java/haveno/core/support/dispute/mediation/MediationDisputeListService.java +++ b/core/src/main/java/haveno/core/support/dispute/mediation/MediationDisputeListService.java @@ -17,11 +17,12 @@ package haveno.core.support.dispute.mediation; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.persistence.PersistenceManager; import haveno.core.support.dispute.DisputeListService; +import javax.inject.Inject; +import javax.inject.Singleton; + @Singleton public final class MediationDisputeListService extends DisputeListService { diff --git a/core/src/main/java/haveno/core/support/dispute/mediation/mediator/MediatorManager.java b/core/src/main/java/haveno/core/support/dispute/mediation/mediator/MediatorManager.java index 06db577f1f..095d80f58f 100644 --- a/core/src/main/java/haveno/core/support/dispute/mediation/mediator/MediatorManager.java +++ b/core/src/main/java/haveno/core/support/dispute/mediation/mediator/MediatorManager.java @@ -17,13 +17,14 @@ package haveno.core.support.dispute.mediation.mediator; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.crypto.KeyRing; import haveno.core.filter.FilterManager; import haveno.core.support.dispute.agent.DisputeAgentManager; import haveno.core.user.User; import haveno.network.p2p.storage.payload.ProtectedStorageEntry; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.util.List; @Singleton diff --git a/core/src/main/java/haveno/core/support/dispute/mediation/mediator/MediatorService.java b/core/src/main/java/haveno/core/support/dispute/mediation/mediator/MediatorService.java index a0c9f0acea..e70ec66bf7 100644 --- a/core/src/main/java/haveno/core/support/dispute/mediation/mediator/MediatorService.java +++ b/core/src/main/java/haveno/core/support/dispute/mediation/mediator/MediatorService.java @@ -17,18 +17,19 @@ package haveno.core.support.dispute.mediation.mediator; -import com.google.inject.Inject; import com.google.inject.Singleton; import haveno.core.filter.FilterManager; import haveno.core.support.dispute.agent.DisputeAgentService; import haveno.network.p2p.NodeAddress; import haveno.network.p2p.P2PService; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; -import lombok.extern.slf4j.Slf4j; @Slf4j diff --git a/core/src/main/java/haveno/core/support/dispute/refund/RefundDisputeListService.java b/core/src/main/java/haveno/core/support/dispute/refund/RefundDisputeListService.java index 70b30f15a2..1eca8d6924 100644 --- a/core/src/main/java/haveno/core/support/dispute/refund/RefundDisputeListService.java +++ b/core/src/main/java/haveno/core/support/dispute/refund/RefundDisputeListService.java @@ -17,11 +17,12 @@ package haveno.core.support.dispute.refund; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.persistence.PersistenceManager; import haveno.core.support.dispute.DisputeListService; +import javax.inject.Inject; +import javax.inject.Singleton; + @Singleton public final class RefundDisputeListService extends DisputeListService { diff --git a/core/src/main/java/haveno/core/support/dispute/refund/refundagent/RefundAgentManager.java b/core/src/main/java/haveno/core/support/dispute/refund/refundagent/RefundAgentManager.java index 22628af4f1..9281234c11 100644 --- a/core/src/main/java/haveno/core/support/dispute/refund/refundagent/RefundAgentManager.java +++ b/core/src/main/java/haveno/core/support/dispute/refund/refundagent/RefundAgentManager.java @@ -17,16 +17,17 @@ package haveno.core.support.dispute.refund.refundagent; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.crypto.KeyRing; import haveno.core.filter.FilterManager; import haveno.core.support.dispute.agent.DisputeAgentManager; import haveno.core.user.User; import haveno.network.p2p.storage.payload.ProtectedStorageEntry; -import java.util.List; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import javax.inject.Singleton; +import java.util.List; + @Slf4j @Singleton public class RefundAgentManager extends DisputeAgentManager { diff --git a/core/src/main/java/haveno/core/support/dispute/refund/refundagent/RefundAgentService.java b/core/src/main/java/haveno/core/support/dispute/refund/refundagent/RefundAgentService.java index 6e26706396..6324445bd7 100644 --- a/core/src/main/java/haveno/core/support/dispute/refund/refundagent/RefundAgentService.java +++ b/core/src/main/java/haveno/core/support/dispute/refund/refundagent/RefundAgentService.java @@ -17,12 +17,13 @@ package haveno.core.support.dispute.refund.refundagent; -import com.google.inject.Inject; import com.google.inject.Singleton; import haveno.core.filter.FilterManager; import haveno.core.support.dispute.agent.DisputeAgentService; import haveno.network.p2p.NodeAddress; import haveno.network.p2p.P2PService; + +import javax.inject.Inject; import java.util.ArrayList; import java.util.List; import java.util.Map; diff --git a/core/src/main/java/haveno/core/support/traderchat/TraderChatManager.java b/core/src/main/java/haveno/core/support/traderchat/TraderChatManager.java index 14a20d1469..048f529a64 100644 --- a/core/src/main/java/haveno/core/support/traderchat/TraderChatManager.java +++ b/core/src/main/java/haveno/core/support/traderchat/TraderChatManager.java @@ -17,8 +17,6 @@ package haveno.core.support.traderchat; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.crypto.PubKeyRing; import haveno.common.crypto.PubKeyRingProvider; import haveno.core.api.CoreMoneroConnectionsService; @@ -33,11 +31,14 @@ import haveno.core.trade.TradeManager; import haveno.network.p2p.AckMessageSourceType; import haveno.network.p2p.NodeAddress; import haveno.network.p2p.P2PService; -import java.util.List; -import java.util.stream.Collectors; import javafx.collections.ObservableList; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import javax.inject.Singleton; +import java.util.List; +import java.util.stream.Collectors; + @Slf4j @Singleton public class TraderChatManager extends SupportManager { diff --git a/core/src/main/java/haveno/core/trade/CleanupMailboxMessages.java b/core/src/main/java/haveno/core/trade/CleanupMailboxMessages.java index 04249b7481..5fdb2dbd73 100644 --- a/core/src/main/java/haveno/core/trade/CleanupMailboxMessages.java +++ b/core/src/main/java/haveno/core/trade/CleanupMailboxMessages.java @@ -17,7 +17,6 @@ package haveno.core.trade; -import com.google.inject.Inject; import haveno.common.crypto.PubKeyRing; import haveno.common.proto.network.NetworkEnvelope; import haveno.core.trade.messages.TradeMessage; @@ -28,9 +27,11 @@ import haveno.network.p2p.DecryptedMessageWithPubKey; import haveno.network.p2p.P2PService; import haveno.network.p2p.mailbox.MailboxMessage; import haveno.network.p2p.mailbox.MailboxMessageService; -import java.util.List; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import java.util.List; + //TODO with the redesign of mailbox messages that is not required anymore. We leave it for now as we want to minimize // changes for the 1.5.0 release but we should clean up afterwards... diff --git a/core/src/main/java/haveno/core/trade/CleanupMailboxMessagesService.java b/core/src/main/java/haveno/core/trade/CleanupMailboxMessagesService.java index 824aefd3a1..eab604b6f6 100644 --- a/core/src/main/java/haveno/core/trade/CleanupMailboxMessagesService.java +++ b/core/src/main/java/haveno/core/trade/CleanupMailboxMessagesService.java @@ -17,7 +17,6 @@ package haveno.core.trade; -import com.google.inject.Inject; import haveno.common.crypto.PubKeyRing; import haveno.common.proto.network.NetworkEnvelope; import haveno.core.trade.messages.TradeMessage; @@ -28,9 +27,11 @@ import haveno.network.p2p.DecryptedMessageWithPubKey; import haveno.network.p2p.P2PService; import haveno.network.p2p.mailbox.MailboxMessage; import haveno.network.p2p.mailbox.MailboxMessageService; -import java.util.List; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import java.util.List; + //TODO with the redesign of mailbox messages that is not required anymore. We leave it for now as we want to minimize // changes for the 1.5.0 release but we should clean up afterwards... diff --git a/core/src/main/java/haveno/core/trade/ClosedTradableFormatter.java b/core/src/main/java/haveno/core/trade/ClosedTradableFormatter.java index 9074032ba0..5f8ca1211e 100644 --- a/core/src/main/java/haveno/core/trade/ClosedTradableFormatter.java +++ b/core/src/main/java/haveno/core/trade/ClosedTradableFormatter.java @@ -17,14 +17,23 @@ package haveno.core.trade; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.core.locale.CurrencyUtil; import haveno.core.locale.Res; import haveno.core.monetary.CryptoMoney; import haveno.core.monetary.TraditionalMoney; import haveno.core.monetary.Volume; import haveno.core.offer.OpenOffer; +import haveno.core.util.FormattingUtils; +import lombok.extern.slf4j.Slf4j; +import org.bitcoinj.core.Monetary; + +import javax.inject.Inject; +import javax.inject.Singleton; +import java.math.BigInteger; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + import static haveno.core.trade.ClosedTradableUtil.castToTrade; import static haveno.core.trade.ClosedTradableUtil.getTotalTxFee; import static haveno.core.trade.ClosedTradableUtil.getTotalVolumeByCurrency; @@ -33,17 +42,10 @@ import static haveno.core.trade.ClosedTradableUtil.isOpenOffer; import static haveno.core.trade.Trade.DisputeState.DISPUTE_CLOSED; import static haveno.core.trade.Trade.DisputeState.MEDIATION_CLOSED; import static haveno.core.trade.Trade.DisputeState.REFUND_REQUEST_CLOSED; -import haveno.core.util.FormattingUtils; import static haveno.core.util.FormattingUtils.formatPercentagePrice; import static haveno.core.util.FormattingUtils.formatToPercentWithSymbol; import static haveno.core.util.VolumeUtil.formatVolume; import static haveno.core.util.VolumeUtil.formatVolumeWithCode; -import java.math.BigInteger; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import lombok.extern.slf4j.Slf4j; -import org.bitcoinj.core.Monetary; @Slf4j @Singleton diff --git a/core/src/main/java/haveno/core/trade/TradeManager.java b/core/src/main/java/haveno/core/trade/TradeManager.java index 798887be66..52bfdad392 100644 --- a/core/src/main/java/haveno/core/trade/TradeManager.java +++ b/core/src/main/java/haveno/core/trade/TradeManager.java @@ -17,10 +17,8 @@ package haveno.core.trade; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.collect.ImmutableList; -import com.google.inject.Inject; + import common.utils.GenUtils; import haveno.common.ClockWatcher; import haveno.common.crypto.KeyRing; @@ -76,6 +74,25 @@ import haveno.network.p2p.DecryptedMessageWithPubKey; import haveno.network.p2p.NodeAddress; import haveno.network.p2p.P2PService; import haveno.network.p2p.network.TorNetworkNode; +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.LongProperty; +import javafx.beans.property.SimpleBooleanProperty; +import javafx.beans.property.SimpleLongProperty; +import javafx.collections.ListChangeListener; +import javafx.collections.ObservableList; +import lombok.Getter; +import lombok.Setter; +import monero.daemon.model.MoneroTx; +import monero.wallet.model.MoneroOutputQuery; +import org.bitcoinj.core.Coin; +import org.bouncycastle.crypto.params.KeyParameter; +import org.fxmisc.easybind.EasyBind; +import org.fxmisc.easybind.Subscription; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.annotation.Nullable; +import javax.inject.Inject; import java.math.BigInteger; import java.util.ArrayList; import java.util.Date; @@ -89,23 +106,9 @@ import java.util.UUID; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; import java.util.stream.Stream; -import javafx.beans.property.BooleanProperty; -import javafx.beans.property.LongProperty; -import javafx.beans.property.SimpleBooleanProperty; -import javafx.beans.property.SimpleLongProperty; -import javafx.collections.ListChangeListener; -import javafx.collections.ObservableList; -import javax.annotation.Nullable; -import lombok.Getter; -import lombok.Setter; -import monero.daemon.model.MoneroTx; -import monero.wallet.model.MoneroOutputQuery; -import org.bitcoinj.core.Coin; -import org.bouncycastle.crypto.params.KeyParameter; -import org.fxmisc.easybind.EasyBind; -import org.fxmisc.easybind.Subscription; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; public class TradeManager implements PersistedDataHost, DecryptedDirectMessageListener { @@ -407,7 +410,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi for (Trade trade : trades) { tasks.add(() -> { try { - + // check for duplicate uid if (!uids.add(trade.getUid())) { log.warn("Found trade with duplicate uid, skipping. That should never happen. {} {}, uid={}", trade.getClass().getSimpleName(), trade.getId(), trade.getUid()); @@ -439,10 +442,10 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi for (Trade trade : trades) { if (trade.isIdling()) HavenoUtils.submitTask(() -> trade.syncWallet()); } - + getObservableList().addListener((ListChangeListener) change -> onTradesChanged()); onTradesChanged(); - + xmrWalletService.setTradeManager(this); // process after all wallets initialized @@ -470,7 +473,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi // notify that persisted trades initialized persistedTradesInitialized.set(true); - + // We do not include failed trades as they should not be counted anyway in the trade statistics // TODO: remove stats? Set nonFailedTrades = new HashSet<>(closedTradableManager.getClosedTrades()); diff --git a/core/src/main/java/haveno/core/trade/TradeUtil.java b/core/src/main/java/haveno/core/trade/TradeUtil.java index 761d203400..ba57166bba 100644 --- a/core/src/main/java/haveno/core/trade/TradeUtil.java +++ b/core/src/main/java/haveno/core/trade/TradeUtil.java @@ -17,22 +17,24 @@ package haveno.core.trade; -import static com.google.common.base.Preconditions.checkNotNull; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.crypto.KeyRing; import haveno.common.util.Tuple2; -import static haveno.core.locale.CurrencyUtil.getCurrencyPair; -import static haveno.core.locale.CurrencyUtil.isTraditionalCurrency; import haveno.core.locale.Res; import haveno.core.offer.Offer; -import static haveno.core.util.FormattingUtils.formatDurationAsWords; import haveno.core.xmr.wallet.BtcWalletService; -import static java.lang.String.format; +import lombok.extern.slf4j.Slf4j; + +import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Singleton; import java.util.Date; import java.util.Objects; -import javax.annotation.Nullable; -import lombok.extern.slf4j.Slf4j; + +import static com.google.common.base.Preconditions.checkNotNull; +import static haveno.core.locale.CurrencyUtil.getCurrencyPair; +import static haveno.core.locale.CurrencyUtil.isTraditionalCurrency; +import static haveno.core.util.FormattingUtils.formatDurationAsWords; +import static java.lang.String.format; /** * This class contains trade utility methods. diff --git a/core/src/main/java/haveno/core/trade/protocol/ProcessModelServiceProvider.java b/core/src/main/java/haveno/core/trade/protocol/ProcessModelServiceProvider.java index 3447d803f2..ce5103a702 100644 --- a/core/src/main/java/haveno/core/trade/protocol/ProcessModelServiceProvider.java +++ b/core/src/main/java/haveno/core/trade/protocol/ProcessModelServiceProvider.java @@ -17,7 +17,6 @@ package haveno.core.trade.protocol; -import com.google.inject.Inject; import haveno.common.crypto.KeyRing; import haveno.core.account.witness.AccountAgeWitnessService; import haveno.core.filter.FilterManager; @@ -34,6 +33,8 @@ import haveno.core.xmr.wallet.XmrWalletService; import haveno.network.p2p.P2PService; import lombok.Getter; +import javax.inject.Inject; + @Getter public class ProcessModelServiceProvider { private final OpenOfferManager openOfferManager; diff --git a/core/src/main/java/haveno/core/trade/statistics/ReferralIdService.java b/core/src/main/java/haveno/core/trade/statistics/ReferralIdService.java index 61369115c7..976432b9cc 100644 --- a/core/src/main/java/haveno/core/trade/statistics/ReferralIdService.java +++ b/core/src/main/java/haveno/core/trade/statistics/ReferralIdService.java @@ -17,11 +17,12 @@ package haveno.core.trade.statistics; -import com.google.inject.Inject; import haveno.core.user.Preferences; + +import javax.annotation.Nullable; +import javax.inject.Inject; import java.util.Arrays; import java.util.Optional; -import javax.annotation.Nullable; public class ReferralIdService { private final Preferences preferences; diff --git a/core/src/main/java/haveno/core/trade/statistics/TradeStatistics3StorageService.java b/core/src/main/java/haveno/core/trade/statistics/TradeStatistics3StorageService.java index 76bc90dc67..deb01a1482 100644 --- a/core/src/main/java/haveno/core/trade/statistics/TradeStatistics3StorageService.java +++ b/core/src/main/java/haveno/core/trade/statistics/TradeStatistics3StorageService.java @@ -17,16 +17,17 @@ package haveno.core.trade.statistics; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.common.persistence.PersistenceManager; import haveno.network.p2p.storage.payload.PersistableNetworkPayload; import haveno.network.p2p.storage.persistence.HistoricalDataStoreService; -import java.io.File; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; +import java.io.File; + @Singleton @Slf4j public class TradeStatistics3StorageService extends HistoricalDataStoreService { diff --git a/core/src/main/java/haveno/core/trade/statistics/TradeStatisticsManager.java b/core/src/main/java/haveno/core/trade/statistics/TradeStatisticsManager.java index fc3e60a4e0..9e762a8e43 100644 --- a/core/src/main/java/haveno/core/trade/statistics/TradeStatisticsManager.java +++ b/core/src/main/java/haveno/core/trade/statistics/TradeStatisticsManager.java @@ -18,8 +18,6 @@ package haveno.core.trade.statistics; import com.google.inject.Inject; -import com.google.inject.Singleton; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.common.file.JsonFileManager; import haveno.core.locale.CurrencyTuple; @@ -32,6 +30,13 @@ import haveno.core.util.JsonUtil; import haveno.network.p2p.P2PService; import haveno.network.p2p.storage.P2PDataStorage; import haveno.network.p2p.storage.persistence.AppendOnlyDataStoreService; +import javafx.collections.FXCollections; +import javafx.collections.ObservableSet; +import lombok.extern.slf4j.Slf4j; + +import javax.annotation.Nullable; +import javax.inject.Named; +import javax.inject.Singleton; import java.io.File; import java.time.Instant; import java.util.ArrayList; @@ -39,10 +44,6 @@ import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import javafx.collections.FXCollections; -import javafx.collections.ObservableSet; -import javax.annotation.Nullable; -import lombok.extern.slf4j.Slf4j; @Singleton @Slf4j diff --git a/core/src/main/java/haveno/core/user/Preferences.java b/core/src/main/java/haveno/core/user/Preferences.java index 481280b44c..8cccce0e0d 100644 --- a/core/src/main/java/haveno/core/user/Preferences.java +++ b/core/src/main/java/haveno/core/user/Preferences.java @@ -17,10 +17,6 @@ package haveno.core.user; -import static com.google.common.base.Preconditions.checkNotNull; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import com.google.inject.name.Named; import haveno.common.config.BaseCurrencyNetwork; import haveno.common.config.Config; import haveno.common.persistence.PersistenceManager; @@ -30,23 +26,16 @@ import haveno.core.locale.Country; import haveno.core.locale.CountryUtil; import haveno.core.locale.CryptoCurrency; import haveno.core.locale.CurrencyUtil; +import haveno.core.locale.TraditionalCurrency; import haveno.core.locale.GlobalSettings; import haveno.core.locale.TradeCurrency; -import haveno.core.locale.TraditionalCurrency; import haveno.core.payment.PaymentAccount; import haveno.core.payment.PaymentAccountUtil; import haveno.core.xmr.MoneroNodeSettings; -import haveno.core.xmr.nodes.LocalBitcoinNode; import haveno.core.xmr.nodes.XmrNodes; +import haveno.core.xmr.nodes.LocalBitcoinNode; import haveno.core.xmr.wallet.Restrictions; import haveno.network.p2p.network.BridgeAddressProvider; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; import javafx.beans.property.BooleanProperty; import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleBooleanProperty; @@ -55,13 +44,26 @@ import javafx.collections.FXCollections; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.collections.ObservableMap; -import javax.annotation.Nullable; import lombok.Getter; import lombok.Setter; import lombok.experimental.Delegate; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; +import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + +import static com.google.common.base.Preconditions.checkNotNull; + @Slf4j @Singleton public final class Preferences implements PersistedDataHost, BridgeAddressProvider { diff --git a/core/src/main/java/haveno/core/user/User.java b/core/src/main/java/haveno/core/user/User.java index 626272cea1..4a5e6cd56f 100644 --- a/core/src/main/java/haveno/core/user/User.java +++ b/core/src/main/java/haveno/core/user/User.java @@ -17,9 +17,6 @@ package haveno.core.user; -import static com.google.common.base.Preconditions.checkNotNull; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.crypto.KeyRing; import haveno.common.persistence.PersistenceManager; import haveno.common.proto.persistable.PersistedDataHost; @@ -34,22 +31,27 @@ import haveno.core.support.dispute.arbitration.arbitrator.Arbitrator; import haveno.core.support.dispute.mediation.mediator.Mediator; import haveno.core.support.dispute.refund.refundagent.RefundAgent; import haveno.network.p2p.NodeAddress; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; import javafx.beans.property.ObjectProperty; import javafx.beans.property.ReadOnlyObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableSet; import javafx.collections.SetChangeListener; -import javax.annotation.Nullable; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Singleton; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import static com.google.common.base.Preconditions.checkNotNull; + /** * The User is persisted locally. * It must never be transmitted over the wire (messageKeyPair contains private key!). diff --git a/core/src/main/java/haveno/core/util/PriceUtil.java b/core/src/main/java/haveno/core/util/PriceUtil.java index f4a5abbad3..c1892fc0a5 100644 --- a/core/src/main/java/haveno/core/util/PriceUtil.java +++ b/core/src/main/java/haveno/core/util/PriceUtil.java @@ -17,9 +17,6 @@ package haveno.core.util; -import static com.google.common.base.Preconditions.checkNotNull; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.util.MathUtils; import haveno.core.locale.CurrencyUtil; import haveno.core.locale.Res; @@ -32,13 +29,18 @@ import haveno.core.provider.price.MarketPrice; import haveno.core.provider.price.PriceFeedService; import haveno.core.trade.statistics.TradeStatisticsManager; import haveno.core.user.Preferences; +import haveno.core.util.validation.NonFiatPriceValidator; import haveno.core.util.validation.FiatPriceValidator; import haveno.core.util.validation.InputValidator; import haveno.core.util.validation.MonetaryValidator; -import haveno.core.util.validation.NonFiatPriceValidator; -import java.util.Optional; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import javax.inject.Singleton; +import java.util.Optional; + +import static com.google.common.base.Preconditions.checkNotNull; + @Slf4j @Singleton public class PriceUtil { diff --git a/core/src/main/java/haveno/core/util/coin/ImmutableCoinFormatter.java b/core/src/main/java/haveno/core/util/coin/ImmutableCoinFormatter.java index ca8999eea8..a685efab10 100644 --- a/core/src/main/java/haveno/core/util/coin/ImmutableCoinFormatter.java +++ b/core/src/main/java/haveno/core/util/coin/ImmutableCoinFormatter.java @@ -17,13 +17,14 @@ package haveno.core.util.coin; -import com.google.inject.Inject; import haveno.core.util.FormattingUtils; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.bitcoinj.core.Coin; import org.bitcoinj.utils.MonetaryFormat; +import javax.inject.Inject; + @Slf4j public class ImmutableCoinFormatter implements CoinFormatter { diff --git a/core/src/main/java/haveno/core/util/validation/BtcAddressValidator.java b/core/src/main/java/haveno/core/util/validation/BtcAddressValidator.java index 7085ab0c1f..c187a7f199 100644 --- a/core/src/main/java/haveno/core/util/validation/BtcAddressValidator.java +++ b/core/src/main/java/haveno/core/util/validation/BtcAddressValidator.java @@ -17,12 +17,13 @@ package haveno.core.util.validation; -import com.google.inject.Inject; import haveno.common.config.Config; import haveno.core.locale.Res; import org.bitcoinj.core.Address; import org.bitcoinj.core.AddressFormatException; +import javax.inject.Inject; + public final class BtcAddressValidator extends InputValidator { @Inject diff --git a/core/src/main/java/haveno/core/util/validation/FiatPriceValidator.java b/core/src/main/java/haveno/core/util/validation/FiatPriceValidator.java index 5192b234d7..d14db6fa92 100644 --- a/core/src/main/java/haveno/core/util/validation/FiatPriceValidator.java +++ b/core/src/main/java/haveno/core/util/validation/FiatPriceValidator.java @@ -17,7 +17,7 @@ package haveno.core.util.validation; -import com.google.inject.Inject; +import javax.inject.Inject; public class FiatPriceValidator extends MonetaryValidator { @Override diff --git a/core/src/main/java/haveno/core/util/validation/MonetaryValidator.java b/core/src/main/java/haveno/core/util/validation/MonetaryValidator.java index 516ddeb58c..a28e6cbbf0 100644 --- a/core/src/main/java/haveno/core/util/validation/MonetaryValidator.java +++ b/core/src/main/java/haveno/core/util/validation/MonetaryValidator.java @@ -17,9 +17,10 @@ package haveno.core.util.validation; -import com.google.inject.Inject; import haveno.core.locale.Res; +import javax.inject.Inject; + public abstract class MonetaryValidator extends NumberValidator { public abstract double getMinValue(); diff --git a/core/src/main/java/haveno/core/util/validation/NonFiatPriceValidator.java b/core/src/main/java/haveno/core/util/validation/NonFiatPriceValidator.java index 2db07e9db1..6e154c8bf7 100644 --- a/core/src/main/java/haveno/core/util/validation/NonFiatPriceValidator.java +++ b/core/src/main/java/haveno/core/util/validation/NonFiatPriceValidator.java @@ -17,7 +17,7 @@ package haveno.core.util.validation; -import com.google.inject.Inject; +import javax.inject.Inject; public class NonFiatPriceValidator extends MonetaryValidator { @Override diff --git a/core/src/main/java/haveno/core/xmr/Balances.java b/core/src/main/java/haveno/core/xmr/Balances.java index c097187119..be607c0268 100644 --- a/core/src/main/java/haveno/core/xmr/Balances.java +++ b/core/src/main/java/haveno/core/xmr/Balances.java @@ -17,7 +17,6 @@ package haveno.core.xmr; -import com.google.inject.Inject; import haveno.core.offer.OfferPayload; import haveno.core.offer.OpenOffer; import haveno.core.offer.OpenOfferManager; @@ -30,9 +29,6 @@ import haveno.core.trade.failed.FailedTradesManager; import haveno.core.xmr.listeners.XmrBalanceListener; import haveno.core.xmr.wallet.XmrWalletService; import haveno.network.p2p.P2PService; -import java.math.BigInteger; -import java.util.List; -import java.util.stream.Collectors; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.collections.ListChangeListener; @@ -44,6 +40,11 @@ import monero.wallet.model.MoneroOutputWallet; import monero.wallet.model.MoneroTxQuery; import monero.wallet.model.MoneroTxWallet; +import javax.inject.Inject; +import java.math.BigInteger; +import java.util.List; +import java.util.stream.Collectors; + @Slf4j public class Balances { private final TradeManager tradeManager; diff --git a/core/src/main/java/haveno/core/xmr/model/EncryptedConnectionList.java b/core/src/main/java/haveno/core/xmr/model/EncryptedConnectionList.java index 472abe4001..9ace577e6b 100644 --- a/core/src/main/java/haveno/core/xmr/model/EncryptedConnectionList.java +++ b/core/src/main/java/haveno/core/xmr/model/EncryptedConnectionList.java @@ -1,6 +1,5 @@ package haveno.core.xmr.model; -import com.google.inject.Inject; import com.google.protobuf.ByteString; import com.google.protobuf.Message; import haveno.common.crypto.CryptoException; @@ -11,6 +10,12 @@ import haveno.common.proto.persistable.PersistableEnvelope; import haveno.common.proto.persistable.PersistedDataHost; import haveno.core.api.CoreAccountService; import haveno.core.api.model.EncryptedConnection; +import lombok.NonNull; +import monero.common.MoneroRpcConnection; +import org.bitcoinj.crypto.KeyCrypterScrypt; + +import javax.crypto.SecretKey; +import javax.inject.Inject; import java.nio.charset.StandardCharsets; import java.security.SecureRandom; import java.util.HashMap; @@ -23,10 +28,6 @@ import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.function.Function; import java.util.stream.Collectors; -import javax.crypto.SecretKey; -import lombok.NonNull; -import monero.common.MoneroRpcConnection; -import org.bitcoinj.crypto.KeyCrypterScrypt; /** diff --git a/core/src/main/java/haveno/core/xmr/nodes/LocalBitcoinNode.java b/core/src/main/java/haveno/core/xmr/nodes/LocalBitcoinNode.java index 7a3997f2da..6d17da513f 100644 --- a/core/src/main/java/haveno/core/xmr/nodes/LocalBitcoinNode.java +++ b/core/src/main/java/haveno/core/xmr/nodes/LocalBitcoinNode.java @@ -1,15 +1,16 @@ package haveno.core.xmr.nodes; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.config.BaseCurrencyNetwork; import haveno.common.config.Config; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Detects whether a Bitcoin node is running on localhost and contains logic for when to diff --git a/core/src/main/java/haveno/core/xmr/wallet/BtcWalletService.java b/core/src/main/java/haveno/core/xmr/wallet/BtcWalletService.java index 243a2519e2..b7a884dae4 100644 --- a/core/src/main/java/haveno/core/xmr/wallet/BtcWalletService.java +++ b/core/src/main/java/haveno/core/xmr/wallet/BtcWalletService.java @@ -18,9 +18,6 @@ package haveno.core.xmr.wallet; import com.google.common.base.Preconditions; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import com.google.inject.Inject; import haveno.common.util.Tuple2; import haveno.core.user.Preferences; import haveno.core.xmr.exceptions.AddressEntryException; @@ -30,13 +27,6 @@ import haveno.core.xmr.exceptions.WalletException; import haveno.core.xmr.model.AddressEntry; import haveno.core.xmr.model.AddressEntryList; import haveno.core.xmr.setup.WalletsSetup; -import java.util.Arrays; -import java.util.List; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import javax.annotation.Nullable; import org.bitcoinj.core.Address; import org.bitcoinj.core.AddressFormatException; import org.bitcoinj.core.Coin; @@ -56,6 +46,18 @@ import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.annotation.Nullable; +import javax.inject.Inject; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + public class BtcWalletService extends WalletService { private static final Logger log = LoggerFactory.getLogger(BtcWalletService.class); diff --git a/core/src/main/java/haveno/core/xmr/wallet/NonBsqCoinSelector.java b/core/src/main/java/haveno/core/xmr/wallet/NonBsqCoinSelector.java index 4edaf9ef37..8f3f5eeb0e 100644 --- a/core/src/main/java/haveno/core/xmr/wallet/NonBsqCoinSelector.java +++ b/core/src/main/java/haveno/core/xmr/wallet/NonBsqCoinSelector.java @@ -17,7 +17,6 @@ package haveno.core.xmr.wallet; -import com.google.inject.Inject; import haveno.core.user.Preferences; import lombok.Setter; import lombok.extern.slf4j.Slf4j; @@ -25,6 +24,8 @@ import org.bitcoinj.core.Transaction; import org.bitcoinj.core.TransactionConfidence; import org.bitcoinj.core.TransactionOutput; +import javax.inject.Inject; + /** * We use a specialized version of the CoinSelector based on the DefaultCoinSelector implementation. * We lookup for spendable outputs which matches our address of our address. diff --git a/core/src/main/java/haveno/core/xmr/wallet/TradeWalletService.java b/core/src/main/java/haveno/core/xmr/wallet/TradeWalletService.java index 089d9f7dd3..12dac1aa9f 100644 --- a/core/src/main/java/haveno/core/xmr/wallet/TradeWalletService.java +++ b/core/src/main/java/haveno/core/xmr/wallet/TradeWalletService.java @@ -17,10 +17,7 @@ package haveno.core.xmr.wallet; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.collect.ImmutableList; -import com.google.inject.Inject; import haveno.common.config.Config; import haveno.common.util.Tuple2; import haveno.core.user.Preferences; @@ -32,10 +29,6 @@ import haveno.core.xmr.model.PreparedDepositTxAndMakerInputs; import haveno.core.xmr.model.RawTransactionInput; import haveno.core.xmr.setup.WalletConfig; import haveno.core.xmr.setup.WalletsSetup; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; -import javax.annotation.Nullable; import org.bitcoinj.core.Address; import org.bitcoinj.core.AddressFormatException; import org.bitcoinj.core.Coin; @@ -62,6 +55,15 @@ import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.annotation.Nullable; +import javax.inject.Inject; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + public class TradeWalletService { diff --git a/core/src/main/java/haveno/core/xmr/wallet/WalletService.java b/core/src/main/java/haveno/core/xmr/wallet/WalletService.java index 31b98a0d6b..ed4bc13f4f 100644 --- a/core/src/main/java/haveno/core/xmr/wallet/WalletService.java +++ b/core/src/main/java/haveno/core/xmr/wallet/WalletService.java @@ -17,13 +17,10 @@ package haveno.core.xmr.wallet; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; import com.google.common.collect.ImmutableMultiset; import com.google.common.collect.ImmutableSetMultimap; import com.google.common.collect.Multiset; import com.google.common.collect.SetMultimap; -import com.google.inject.Inject; import haveno.common.config.Config; import haveno.core.user.Preferences; import haveno.core.xmr.exceptions.TransactionVerificationException; @@ -32,18 +29,8 @@ import haveno.core.xmr.listeners.AddressConfidenceListener; import haveno.core.xmr.listeners.BalanceListener; import haveno.core.xmr.listeners.TxConfidenceListener; import haveno.core.xmr.setup.WalletsSetup; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArraySet; -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; -import javax.annotation.Nullable; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import monero.wallet.MoneroWallet; @@ -86,6 +73,21 @@ import org.bitcoinj.wallet.listeners.WalletReorganizeEventListener; import org.bouncycastle.crypto.params.KeyParameter; import org.jetbrains.annotations.NotNull; +import javax.annotation.Nullable; +import javax.inject.Inject; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.concurrent.CopyOnWriteArraySet; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; + /** * Abstract base class for BTC wallet. Provides all non-trade specific functionality. */ diff --git a/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java b/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java index 19628e67ea..2abe6a8da7 100644 --- a/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java +++ b/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java @@ -1,9 +1,8 @@ package haveno.core.xmr.wallet; -import static com.google.common.base.Preconditions.checkState; import com.google.common.util.concurrent.Service.State; -import com.google.inject.Inject; import com.google.inject.name.Named; + import common.utils.GenUtils; import common.utils.JsonUtils; import haveno.common.UserThread; @@ -26,25 +25,6 @@ import haveno.core.xmr.model.XmrAddressEntry; import haveno.core.xmr.model.XmrAddressEntryList; import haveno.core.xmr.setup.MoneroWalletRpcManager; import haveno.core.xmr.setup.WalletsSetup; -import java.io.File; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.concurrent.Callable; -import java.util.concurrent.CopyOnWriteArraySet; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.stream.Collectors; -import java.util.stream.Stream; import monero.common.MoneroError; import monero.common.MoneroRpcConnection; import monero.common.MoneroRpcError; @@ -70,10 +50,34 @@ import monero.wallet.model.MoneroTxWallet; import monero.wallet.model.MoneroWalletConfig; import monero.wallet.model.MoneroWalletListener; import monero.wallet.model.MoneroWalletListenerI; + import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.inject.Inject; +import java.io.File; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.concurrent.Callable; +import java.util.concurrent.CopyOnWriteArraySet; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static com.google.common.base.Preconditions.checkState; + public class XmrWalletService { private static final Logger log = LoggerFactory.getLogger(XmrWalletService.class); @@ -691,7 +695,7 @@ public class XmrWalletService { int maxAttempts = 2; while (!HavenoUtils.havenoSetup.getWalletInitialized().get()) { try { - + // sync main wallet log.info("Syncing main wallet"); long time = System.currentTimeMillis(); @@ -702,12 +706,12 @@ public class XmrWalletService { // TODO: using this to signify both daemon and wallet synced, use separate sync handlers connectionsService.doneDownload(); - + // notify setup that main wallet is initialized // TODO: app fully initializes after this is set to true, even though wallet might not be initialized if unconnected. wallet will be created when connection detected // refactor startup to call this and sync off main thread? but the calls to e.g. getBalance() fail with 'wallet and network is not yet initialized' HavenoUtils.havenoSetup.getWalletInitialized().set(true); - + // save but skip backup on initialization saveMainWallet(false); } catch (Exception e) { @@ -724,7 +728,7 @@ public class XmrWalletService { } } } - + // register internal listener to notify external listeners wallet.addListener(new XmrWalletListener()); } @@ -743,10 +747,10 @@ public class XmrWalletService { // start monero-wallet-rpc instance walletRpc = startWalletRpcInstance(port); walletRpc.getRpcConnection().setPrintStackTrace(PRINT_STACK_TRACE); - + // prevent wallet rpc from syncing walletRpc.stopSyncing(); - + // create wallet log.info("Creating wallet " + config.getPath() + " connected to daemon " + connection.getUri()); long time = System.currentTimeMillis(); @@ -768,10 +772,10 @@ public class XmrWalletService { // start monero-wallet-rpc instance walletRpc = startWalletRpcInstance(port); walletRpc.getRpcConnection().setPrintStackTrace(PRINT_STACK_TRACE); - + // prevent wallet rpc from syncing walletRpc.stopSyncing(); - + // open wallet log.info("Opening wallet " + config.getPath()); walletRpc.openWallet(config.setServer(connectionsService.getConnection())); @@ -926,7 +930,7 @@ public class XmrWalletService { log.warn("Error getting new address entry based on incoming transactions"); e.printStackTrace(); } - + // create new entry return getNewAddressEntryAux(offerId, context); } diff --git a/daemon/src/main/java/haveno/daemon/grpc/GrpcAccountService.java b/daemon/src/main/java/haveno/daemon/grpc/GrpcAccountService.java index 6bb5a1ebeb..14ce7c2157 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcAccountService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcAccountService.java @@ -17,25 +17,14 @@ package haveno.daemon.grpc; import com.google.common.annotations.VisibleForTesting; -import com.google.inject.Inject; import com.google.protobuf.ByteString; import haveno.common.crypto.IncorrectPasswordException; import haveno.core.api.CoreApi; import haveno.daemon.grpc.interceptor.CallRateMeteringInterceptor; import haveno.daemon.grpc.interceptor.GrpcCallRateMeter; -import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; import haveno.proto.grpc.AccountExistsReply; import haveno.proto.grpc.AccountExistsRequest; import haveno.proto.grpc.AccountGrpc.AccountImplBase; -import static haveno.proto.grpc.AccountGrpc.getAccountExistsMethod; -import static haveno.proto.grpc.AccountGrpc.getBackupAccountMethod; -import static haveno.proto.grpc.AccountGrpc.getChangePasswordMethod; -import static haveno.proto.grpc.AccountGrpc.getCloseAccountMethod; -import static haveno.proto.grpc.AccountGrpc.getCreateAccountMethod; -import static haveno.proto.grpc.AccountGrpc.getDeleteAccountMethod; -import static haveno.proto.grpc.AccountGrpc.getIsAccountOpenMethod; -import static haveno.proto.grpc.AccountGrpc.getOpenAccountMethod; -import static haveno.proto.grpc.AccountGrpc.getRestoreAccountMethod; import haveno.proto.grpc.BackupAccountReply; import haveno.proto.grpc.BackupAccountRequest; import haveno.proto.grpc.ChangePasswordReply; @@ -56,12 +45,25 @@ import haveno.proto.grpc.RestoreAccountReply; import haveno.proto.grpc.RestoreAccountRequest; import io.grpc.ServerInterceptor; import io.grpc.stub.StreamObserver; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.util.HashMap; import java.util.Optional; + +import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; +import static haveno.proto.grpc.AccountGrpc.getAccountExistsMethod; +import static haveno.proto.grpc.AccountGrpc.getBackupAccountMethod; +import static haveno.proto.grpc.AccountGrpc.getChangePasswordMethod; +import static haveno.proto.grpc.AccountGrpc.getCloseAccountMethod; +import static haveno.proto.grpc.AccountGrpc.getCreateAccountMethod; +import static haveno.proto.grpc.AccountGrpc.getDeleteAccountMethod; +import static haveno.proto.grpc.AccountGrpc.getIsAccountOpenMethod; +import static haveno.proto.grpc.AccountGrpc.getOpenAccountMethod; +import static haveno.proto.grpc.AccountGrpc.getRestoreAccountMethod; import static java.util.concurrent.TimeUnit.SECONDS; -import lombok.extern.slf4j.Slf4j; @VisibleForTesting @Slf4j diff --git a/daemon/src/main/java/haveno/daemon/grpc/GrpcDisputeAgentsService.java b/daemon/src/main/java/haveno/daemon/grpc/GrpcDisputeAgentsService.java index 75d1eef40c..99ca4fa868 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcDisputeAgentsService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcDisputeAgentsService.java @@ -1,23 +1,25 @@ package haveno.daemon.grpc; -import com.google.inject.Inject; import haveno.core.api.CoreApi; import haveno.daemon.grpc.interceptor.CallRateMeteringInterceptor; import haveno.daemon.grpc.interceptor.GrpcCallRateMeter; -import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; -import static haveno.proto.grpc.DisputeAgentsGrpc.DisputeAgentsImplBase; -import static haveno.proto.grpc.DisputeAgentsGrpc.getRegisterDisputeAgentMethod; -import static haveno.proto.grpc.DisputeAgentsGrpc.getUnregisterDisputeAgentMethod; import haveno.proto.grpc.RegisterDisputeAgentReply; import haveno.proto.grpc.RegisterDisputeAgentRequest; import haveno.proto.grpc.UnregisterDisputeAgentReply; import haveno.proto.grpc.UnregisterDisputeAgentRequest; import io.grpc.ServerInterceptor; import io.grpc.stub.StreamObserver; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; import java.util.HashMap; import java.util.Optional; + +import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; +import static haveno.proto.grpc.DisputeAgentsGrpc.DisputeAgentsImplBase; +import static haveno.proto.grpc.DisputeAgentsGrpc.getRegisterDisputeAgentMethod; +import static haveno.proto.grpc.DisputeAgentsGrpc.getUnregisterDisputeAgentMethod; import static java.util.concurrent.TimeUnit.SECONDS; -import lombok.extern.slf4j.Slf4j; @Slf4j class GrpcDisputeAgentsService extends DisputeAgentsImplBase { diff --git a/daemon/src/main/java/haveno/daemon/grpc/GrpcDisputesService.java b/daemon/src/main/java/haveno/daemon/grpc/GrpcDisputesService.java index 4ee31e3095..dc0e951242 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcDisputesService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcDisputesService.java @@ -1,19 +1,12 @@ package haveno.daemon.grpc; -import com.google.inject.Inject; import haveno.common.proto.ProtoUtil; import haveno.core.api.CoreApi; import haveno.core.support.dispute.Attachment; import haveno.core.support.dispute.DisputeResult; import haveno.daemon.grpc.interceptor.CallRateMeteringInterceptor; import haveno.daemon.grpc.interceptor.GrpcCallRateMeter; -import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; import haveno.proto.grpc.DisputesGrpc.DisputesImplBase; -import static haveno.proto.grpc.DisputesGrpc.getGetDisputeMethod; -import static haveno.proto.grpc.DisputesGrpc.getGetDisputesMethod; -import static haveno.proto.grpc.DisputesGrpc.getOpenDisputeMethod; -import static haveno.proto.grpc.DisputesGrpc.getResolveDisputeMethod; -import static haveno.proto.grpc.DisputesGrpc.getSendDisputeChatMessageMethod; import haveno.proto.grpc.GetDisputeReply; import haveno.proto.grpc.GetDisputeRequest; import haveno.proto.grpc.GetDisputesReply; @@ -26,12 +19,21 @@ import haveno.proto.grpc.SendDisputeChatMessageReply; import haveno.proto.grpc.SendDisputeChatMessageRequest; import io.grpc.ServerInterceptor; import io.grpc.stub.StreamObserver; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; import java.util.ArrayList; import java.util.HashMap; import java.util.Optional; -import static java.util.concurrent.TimeUnit.SECONDS; import java.util.stream.Collectors; -import lombok.extern.slf4j.Slf4j; + +import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; +import static haveno.proto.grpc.DisputesGrpc.getGetDisputeMethod; +import static haveno.proto.grpc.DisputesGrpc.getGetDisputesMethod; +import static haveno.proto.grpc.DisputesGrpc.getOpenDisputeMethod; +import static haveno.proto.grpc.DisputesGrpc.getResolveDisputeMethod; +import static haveno.proto.grpc.DisputesGrpc.getSendDisputeChatMessageMethod; +import static java.util.concurrent.TimeUnit.SECONDS; @Slf4j public class GrpcDisputesService extends DisputesImplBase { diff --git a/daemon/src/main/java/haveno/daemon/grpc/GrpcExceptionHandler.java b/daemon/src/main/java/haveno/daemon/grpc/GrpcExceptionHandler.java index d0deadd355..f45bf63587 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcExceptionHandler.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcExceptionHandler.java @@ -17,16 +17,18 @@ package haveno.daemon.grpc; -import com.google.inject.Inject; -import com.google.inject.Singleton; import io.grpc.Status; -import static io.grpc.Status.INVALID_ARGUMENT; -import static io.grpc.Status.UNKNOWN; import io.grpc.StatusRuntimeException; import io.grpc.stub.StreamObserver; +import org.slf4j.Logger; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.util.function.Function; import java.util.function.Predicate; -import org.slf4j.Logger; + +import static io.grpc.Status.INVALID_ARGUMENT; +import static io.grpc.Status.UNKNOWN; /** * The singleton instance of this class handles any expected core api Throwable by diff --git a/daemon/src/main/java/haveno/daemon/grpc/GrpcGetTradeStatisticsService.java b/daemon/src/main/java/haveno/daemon/grpc/GrpcGetTradeStatisticsService.java index 04aefc0872..459f59f37e 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcGetTradeStatisticsService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcGetTradeStatisticsService.java @@ -1,22 +1,24 @@ package haveno.daemon.grpc; -import com.google.inject.Inject; import haveno.core.api.CoreApi; import haveno.core.trade.statistics.TradeStatistics3; import haveno.daemon.grpc.interceptor.CallRateMeteringInterceptor; import haveno.daemon.grpc.interceptor.GrpcCallRateMeter; -import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; -import static haveno.proto.grpc.GetTradeStatisticsGrpc.GetTradeStatisticsImplBase; -import static haveno.proto.grpc.GetTradeStatisticsGrpc.getGetTradeStatisticsMethod; import haveno.proto.grpc.GetTradeStatisticsReply; import haveno.proto.grpc.GetTradeStatisticsRequest; import io.grpc.ServerInterceptor; import io.grpc.stub.StreamObserver; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; import java.util.HashMap; import java.util.Optional; -import static java.util.concurrent.TimeUnit.SECONDS; import java.util.stream.Collectors; -import lombok.extern.slf4j.Slf4j; + +import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; +import static haveno.proto.grpc.GetTradeStatisticsGrpc.GetTradeStatisticsImplBase; +import static haveno.proto.grpc.GetTradeStatisticsGrpc.getGetTradeStatisticsMethod; +import static java.util.concurrent.TimeUnit.SECONDS; @Slf4j class GrpcGetTradeStatisticsService extends GetTradeStatisticsImplBase { diff --git a/daemon/src/main/java/haveno/daemon/grpc/GrpcHelpService.java b/daemon/src/main/java/haveno/daemon/grpc/GrpcHelpService.java index c7e994413b..2abfc11a97 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcHelpService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcHelpService.java @@ -17,21 +17,23 @@ package haveno.daemon.grpc; -import com.google.inject.Inject; import haveno.core.api.CoreApi; import haveno.daemon.grpc.interceptor.CallRateMeteringInterceptor; import haveno.daemon.grpc.interceptor.GrpcCallRateMeter; -import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; import haveno.proto.grpc.GetMethodHelpReply; import haveno.proto.grpc.GetMethodHelpRequest; -import static haveno.proto.grpc.HelpGrpc.HelpImplBase; -import static haveno.proto.grpc.HelpGrpc.getGetMethodHelpMethod; import io.grpc.ServerInterceptor; import io.grpc.stub.StreamObserver; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; import java.util.HashMap; import java.util.Optional; + +import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; +import static haveno.proto.grpc.HelpGrpc.HelpImplBase; +import static haveno.proto.grpc.HelpGrpc.getGetMethodHelpMethod; import static java.util.concurrent.TimeUnit.SECONDS; -import lombok.extern.slf4j.Slf4j; @Slf4j class GrpcHelpService extends HelpImplBase { diff --git a/daemon/src/main/java/haveno/daemon/grpc/GrpcMoneroConnectionsService.java b/daemon/src/main/java/haveno/daemon/grpc/GrpcMoneroConnectionsService.java index ed317aac03..4e85d318aa 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcMoneroConnectionsService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcMoneroConnectionsService.java @@ -17,11 +17,9 @@ package haveno.daemon.grpc; -import com.google.inject.Inject; import haveno.core.api.CoreApi; import haveno.daemon.grpc.interceptor.CallRateMeteringInterceptor; import haveno.daemon.grpc.interceptor.GrpcCallRateMeter; -import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; import haveno.proto.grpc.AddConnectionReply; import haveno.proto.grpc.AddConnectionRequest; import haveno.proto.grpc.CheckConnectionReply; @@ -34,18 +32,6 @@ import haveno.proto.grpc.GetConnectionReply; import haveno.proto.grpc.GetConnectionRequest; import haveno.proto.grpc.GetConnectionsReply; import haveno.proto.grpc.GetConnectionsRequest; -import static haveno.proto.grpc.MoneroConnectionsGrpc.MoneroConnectionsImplBase; -import static haveno.proto.grpc.MoneroConnectionsGrpc.getAddConnectionMethod; -import static haveno.proto.grpc.MoneroConnectionsGrpc.getCheckConnectionMethod; -import static haveno.proto.grpc.MoneroConnectionsGrpc.getCheckConnectionsMethod; -import static haveno.proto.grpc.MoneroConnectionsGrpc.getGetBestAvailableConnectionMethod; -import static haveno.proto.grpc.MoneroConnectionsGrpc.getGetConnectionMethod; -import static haveno.proto.grpc.MoneroConnectionsGrpc.getGetConnectionsMethod; -import static haveno.proto.grpc.MoneroConnectionsGrpc.getRemoveConnectionMethod; -import static haveno.proto.grpc.MoneroConnectionsGrpc.getSetAutoSwitchMethod; -import static haveno.proto.grpc.MoneroConnectionsGrpc.getSetConnectionMethod; -import static haveno.proto.grpc.MoneroConnectionsGrpc.getStartCheckingConnectionsMethod; -import static haveno.proto.grpc.MoneroConnectionsGrpc.getStopCheckingConnectionsMethod; import haveno.proto.grpc.RemoveConnectionReply; import haveno.proto.grpc.RemoveConnectionRequest; import haveno.proto.grpc.SetAutoSwitchReply; @@ -59,15 +45,31 @@ import haveno.proto.grpc.StopCheckingConnectionsRequest; import haveno.proto.grpc.UrlConnection; import io.grpc.ServerInterceptor; import io.grpc.stub.StreamObserver; +import lombok.extern.slf4j.Slf4j; +import monero.common.MoneroRpcConnection; + +import javax.inject.Inject; import java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; import java.util.List; import java.util.Optional; -import static java.util.concurrent.TimeUnit.SECONDS; import java.util.stream.Collectors; -import lombok.extern.slf4j.Slf4j; -import monero.common.MoneroRpcConnection; + +import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; +import static haveno.proto.grpc.MoneroConnectionsGrpc.MoneroConnectionsImplBase; +import static haveno.proto.grpc.MoneroConnectionsGrpc.getAddConnectionMethod; +import static haveno.proto.grpc.MoneroConnectionsGrpc.getCheckConnectionMethod; +import static haveno.proto.grpc.MoneroConnectionsGrpc.getCheckConnectionsMethod; +import static haveno.proto.grpc.MoneroConnectionsGrpc.getGetBestAvailableConnectionMethod; +import static haveno.proto.grpc.MoneroConnectionsGrpc.getGetConnectionMethod; +import static haveno.proto.grpc.MoneroConnectionsGrpc.getGetConnectionsMethod; +import static haveno.proto.grpc.MoneroConnectionsGrpc.getRemoveConnectionMethod; +import static haveno.proto.grpc.MoneroConnectionsGrpc.getSetAutoSwitchMethod; +import static haveno.proto.grpc.MoneroConnectionsGrpc.getSetConnectionMethod; +import static haveno.proto.grpc.MoneroConnectionsGrpc.getStartCheckingConnectionsMethod; +import static haveno.proto.grpc.MoneroConnectionsGrpc.getStopCheckingConnectionsMethod; +import static java.util.concurrent.TimeUnit.SECONDS; @Slf4j class GrpcMoneroConnectionsService extends MoneroConnectionsImplBase { diff --git a/daemon/src/main/java/haveno/daemon/grpc/GrpcMoneroNodeService.java b/daemon/src/main/java/haveno/daemon/grpc/GrpcMoneroNodeService.java index 576a31d5b9..b08cbe5188 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcMoneroNodeService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcMoneroNodeService.java @@ -16,33 +16,35 @@ */ package haveno.daemon.grpc; -import com.google.inject.Inject; import haveno.core.api.CoreApi; import haveno.core.xmr.MoneroNodeSettings; import haveno.daemon.grpc.interceptor.CallRateMeteringInterceptor; import haveno.daemon.grpc.interceptor.GrpcCallRateMeter; -import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; import haveno.proto.grpc.GetMoneroNodeSettingsReply; import haveno.proto.grpc.GetMoneroNodeSettingsRequest; import haveno.proto.grpc.IsMoneroNodeOnlineReply; import haveno.proto.grpc.IsMoneroNodeOnlineRequest; import haveno.proto.grpc.MoneroNodeGrpc.MoneroNodeImplBase; -import static haveno.proto.grpc.MoneroNodeGrpc.getGetMoneroNodeSettingsMethod; -import static haveno.proto.grpc.MoneroNodeGrpc.getIsMoneroNodeOnlineMethod; -import static haveno.proto.grpc.MoneroNodeGrpc.getStartMoneroNodeMethod; -import static haveno.proto.grpc.MoneroNodeGrpc.getStopMoneroNodeMethod; import haveno.proto.grpc.StartMoneroNodeReply; import haveno.proto.grpc.StartMoneroNodeRequest; import haveno.proto.grpc.StopMoneroNodeReply; import haveno.proto.grpc.StopMoneroNodeRequest; import io.grpc.ServerInterceptor; import io.grpc.stub.StreamObserver; -import java.util.HashMap; -import java.util.Optional; -import static java.util.concurrent.TimeUnit.SECONDS; import lombok.extern.slf4j.Slf4j; import monero.common.MoneroError; +import javax.inject.Inject; +import java.util.HashMap; +import java.util.Optional; + +import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; +import static haveno.proto.grpc.MoneroNodeGrpc.getGetMoneroNodeSettingsMethod; +import static haveno.proto.grpc.MoneroNodeGrpc.getIsMoneroNodeOnlineMethod; +import static haveno.proto.grpc.MoneroNodeGrpc.getStartMoneroNodeMethod; +import static haveno.proto.grpc.MoneroNodeGrpc.getStopMoneroNodeMethod; +import static java.util.concurrent.TimeUnit.SECONDS; + @Slf4j public class GrpcMoneroNodeService extends MoneroNodeImplBase { diff --git a/daemon/src/main/java/haveno/daemon/grpc/GrpcNotificationsService.java b/daemon/src/main/java/haveno/daemon/grpc/GrpcNotificationsService.java index 410ac270ce..23082d0364 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcNotificationsService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcNotificationsService.java @@ -1,15 +1,11 @@ package haveno.daemon.grpc; -import com.google.inject.Inject; import haveno.core.api.CoreApi; import haveno.core.api.NotificationListener; import haveno.daemon.grpc.interceptor.CallRateMeteringInterceptor; import haveno.daemon.grpc.interceptor.GrpcCallRateMeter; -import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; import haveno.proto.grpc.NotificationMessage; import haveno.proto.grpc.NotificationsGrpc.NotificationsImplBase; -import static haveno.proto.grpc.NotificationsGrpc.getRegisterNotificationListenerMethod; -import static haveno.proto.grpc.NotificationsGrpc.getSendNotificationMethod; import haveno.proto.grpc.RegisterNotificationListenerRequest; import haveno.proto.grpc.SendNotificationReply; import haveno.proto.grpc.SendNotificationRequest; @@ -17,13 +13,19 @@ import io.grpc.Context; import io.grpc.ServerInterceptor; import io.grpc.stub.ServerCallStreamObserver; import io.grpc.stub.StreamObserver; -import java.util.HashMap; -import java.util.Optional; -import static java.util.concurrent.TimeUnit.SECONDS; import lombok.NonNull; import lombok.Value; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import java.util.HashMap; +import java.util.Optional; + +import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; +import static haveno.proto.grpc.NotificationsGrpc.getRegisterNotificationListenerMethod; +import static haveno.proto.grpc.NotificationsGrpc.getSendNotificationMethod; +import static java.util.concurrent.TimeUnit.SECONDS; + @Slf4j class GrpcNotificationsService extends NotificationsImplBase { diff --git a/daemon/src/main/java/haveno/daemon/grpc/GrpcOffersService.java b/daemon/src/main/java/haveno/daemon/grpc/GrpcOffersService.java index f74682507d..61e2905872 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcOffersService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcOffersService.java @@ -17,14 +17,12 @@ package haveno.daemon.grpc; -import com.google.inject.Inject; import haveno.core.api.CoreApi; import haveno.core.api.model.OfferInfo; import haveno.core.offer.Offer; import haveno.core.offer.OpenOffer; import haveno.daemon.grpc.interceptor.CallRateMeteringInterceptor; import haveno.daemon.grpc.interceptor.GrpcCallRateMeter; -import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; import haveno.proto.grpc.CancelOfferReply; import haveno.proto.grpc.CancelOfferRequest; import haveno.proto.grpc.GetMyOfferReply; @@ -35,6 +33,20 @@ import haveno.proto.grpc.GetOfferReply; import haveno.proto.grpc.GetOfferRequest; import haveno.proto.grpc.GetOffersReply; import haveno.proto.grpc.GetOffersRequest; +import haveno.proto.grpc.PostOfferReply; +import haveno.proto.grpc.PostOfferRequest; +import io.grpc.ServerInterceptor; +import io.grpc.stub.StreamObserver; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; import static haveno.proto.grpc.OffersGrpc.OffersImplBase; import static haveno.proto.grpc.OffersGrpc.getCancelOfferMethod; import static haveno.proto.grpc.OffersGrpc.getGetMyOfferMethod; @@ -42,17 +54,7 @@ import static haveno.proto.grpc.OffersGrpc.getGetMyOffersMethod; import static haveno.proto.grpc.OffersGrpc.getGetOfferMethod; import static haveno.proto.grpc.OffersGrpc.getGetOffersMethod; import static haveno.proto.grpc.OffersGrpc.getPostOfferMethod; -import haveno.proto.grpc.PostOfferReply; -import haveno.proto.grpc.PostOfferRequest; -import io.grpc.ServerInterceptor; -import io.grpc.stub.StreamObserver; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Optional; import static java.util.concurrent.TimeUnit.SECONDS; -import java.util.stream.Collectors; -import lombok.extern.slf4j.Slf4j; @Slf4j class GrpcOffersService extends OffersImplBase { diff --git a/daemon/src/main/java/haveno/daemon/grpc/GrpcPaymentAccountsService.java b/daemon/src/main/java/haveno/daemon/grpc/GrpcPaymentAccountsService.java index 75fde41568..1d28eb9355 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcPaymentAccountsService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcPaymentAccountsService.java @@ -17,7 +17,6 @@ package haveno.daemon.grpc; -import com.google.inject.Inject; import haveno.core.api.CoreApi; import haveno.core.api.model.PaymentAccountForm; import haveno.core.api.model.PaymentAccountFormField; @@ -28,7 +27,6 @@ import haveno.core.payment.payload.PaymentMethod; import haveno.core.proto.CoreProtoResolver; import haveno.daemon.grpc.interceptor.CallRateMeteringInterceptor; import haveno.daemon.grpc.interceptor.GrpcCallRateMeter; -import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; import haveno.proto.grpc.CreateCryptoCurrencyPaymentAccountReply; import haveno.proto.grpc.CreateCryptoCurrencyPaymentAccountRequest; import haveno.proto.grpc.CreatePaymentAccountReply; @@ -41,21 +39,25 @@ import haveno.proto.grpc.GetPaymentAccountsReply; import haveno.proto.grpc.GetPaymentAccountsRequest; import haveno.proto.grpc.GetPaymentMethodsReply; import haveno.proto.grpc.GetPaymentMethodsRequest; +import haveno.proto.grpc.ValidateFormFieldReply; +import haveno.proto.grpc.ValidateFormFieldRequest; +import io.grpc.ServerInterceptor; +import io.grpc.stub.StreamObserver; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import java.util.HashMap; +import java.util.Optional; +import java.util.stream.Collectors; + +import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; import static haveno.proto.grpc.PaymentAccountsGrpc.PaymentAccountsImplBase; import static haveno.proto.grpc.PaymentAccountsGrpc.getCreateCryptoCurrencyPaymentAccountMethod; import static haveno.proto.grpc.PaymentAccountsGrpc.getCreatePaymentAccountMethod; import static haveno.proto.grpc.PaymentAccountsGrpc.getGetPaymentAccountFormMethod; import static haveno.proto.grpc.PaymentAccountsGrpc.getGetPaymentAccountsMethod; import static haveno.proto.grpc.PaymentAccountsGrpc.getGetPaymentMethodsMethod; -import haveno.proto.grpc.ValidateFormFieldReply; -import haveno.proto.grpc.ValidateFormFieldRequest; -import io.grpc.ServerInterceptor; -import io.grpc.stub.StreamObserver; -import java.util.HashMap; -import java.util.Optional; import static java.util.concurrent.TimeUnit.SECONDS; -import java.util.stream.Collectors; -import lombok.extern.slf4j.Slf4j; @Slf4j class GrpcPaymentAccountsService extends PaymentAccountsImplBase { diff --git a/daemon/src/main/java/haveno/daemon/grpc/GrpcPriceService.java b/daemon/src/main/java/haveno/daemon/grpc/GrpcPriceService.java index 855cb63c96..d3617c4060 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcPriceService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcPriceService.java @@ -17,28 +17,30 @@ package haveno.daemon.grpc; -import com.google.inject.Inject; import haveno.core.api.CoreApi; import haveno.core.api.model.MarketDepthInfo; import haveno.core.api.model.MarketPriceInfo; import haveno.daemon.grpc.interceptor.CallRateMeteringInterceptor; import haveno.daemon.grpc.interceptor.GrpcCallRateMeter; -import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; import haveno.proto.grpc.MarketDepthReply; import haveno.proto.grpc.MarketDepthRequest; import haveno.proto.grpc.MarketPriceReply; import haveno.proto.grpc.MarketPriceRequest; import haveno.proto.grpc.MarketPricesReply; import haveno.proto.grpc.MarketPricesRequest; -import static haveno.proto.grpc.PriceGrpc.PriceImplBase; -import static haveno.proto.grpc.PriceGrpc.getGetMarketPriceMethod; import io.grpc.ServerInterceptor; import io.grpc.stub.StreamObserver; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; import java.util.HashMap; import java.util.List; import java.util.Optional; + +import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; +import static haveno.proto.grpc.PriceGrpc.PriceImplBase; +import static haveno.proto.grpc.PriceGrpc.getGetMarketPriceMethod; import static java.util.concurrent.TimeUnit.SECONDS; -import lombok.extern.slf4j.Slf4j; @Slf4j class GrpcPriceService extends PriceImplBase { diff --git a/daemon/src/main/java/haveno/daemon/grpc/GrpcServer.java b/daemon/src/main/java/haveno/daemon/grpc/GrpcServer.java index be66aaea96..c1fbd039db 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcServer.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcServer.java @@ -17,17 +17,19 @@ package haveno.daemon.grpc; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.config.Config; import haveno.core.api.CoreContext; import haveno.daemon.grpc.interceptor.PasswordAuthInterceptor; import io.grpc.Server; import io.grpc.ServerBuilder; -import static io.grpc.ServerInterceptors.interceptForward; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.io.IOException; import java.io.UncheckedIOException; -import lombok.extern.slf4j.Slf4j; + +import static io.grpc.ServerInterceptors.interceptForward; @Singleton @Slf4j diff --git a/daemon/src/main/java/haveno/daemon/grpc/GrpcShutdownService.java b/daemon/src/main/java/haveno/daemon/grpc/GrpcShutdownService.java index 1fa70ef80a..000ca3aa3e 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcShutdownService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcShutdownService.java @@ -17,16 +17,18 @@ package haveno.daemon.grpc; -import com.google.inject.Inject; import haveno.common.UserThread; import haveno.core.app.HavenoHeadlessApp; import haveno.proto.grpc.ShutdownServerGrpc; import haveno.proto.grpc.StopReply; import haveno.proto.grpc.StopRequest; import io.grpc.stub.StreamObserver; -import static java.util.concurrent.TimeUnit.MILLISECONDS; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; + +import static java.util.concurrent.TimeUnit.MILLISECONDS; + @Slf4j class GrpcShutdownService extends ShutdownServerGrpc.ShutdownServerImplBase { diff --git a/daemon/src/main/java/haveno/daemon/grpc/GrpcTradesService.java b/daemon/src/main/java/haveno/daemon/grpc/GrpcTradesService.java index c06a51c6a1..7e8c1e4198 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcTradesService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcTradesService.java @@ -17,14 +17,11 @@ package haveno.daemon.grpc; -import com.google.inject.Inject; import haveno.core.api.CoreApi; import haveno.core.api.model.TradeInfo; -import static haveno.core.api.model.TradeInfo.toTradeInfo; import haveno.core.trade.Trade; import haveno.daemon.grpc.interceptor.CallRateMeteringInterceptor; import haveno.daemon.grpc.interceptor.GrpcCallRateMeter; -import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; import haveno.proto.grpc.CompleteTradeReply; import haveno.proto.grpc.CompleteTradeRequest; import haveno.proto.grpc.ConfirmPaymentReceivedReply; @@ -41,6 +38,18 @@ import haveno.proto.grpc.SendChatMessageReply; import haveno.proto.grpc.SendChatMessageRequest; import haveno.proto.grpc.TakeOfferReply; import haveno.proto.grpc.TakeOfferRequest; +import io.grpc.ServerInterceptor; +import io.grpc.stub.StreamObserver; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import java.util.HashMap; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +import static haveno.core.api.model.TradeInfo.toTradeInfo; +import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; import static haveno.proto.grpc.TradesGrpc.TradesImplBase; import static haveno.proto.grpc.TradesGrpc.getCompleteTradeMethod; import static haveno.proto.grpc.TradesGrpc.getConfirmPaymentReceivedMethod; @@ -51,15 +60,8 @@ import static haveno.proto.grpc.TradesGrpc.getGetTradesMethod; import static haveno.proto.grpc.TradesGrpc.getSendChatMessageMethod; import static haveno.proto.grpc.TradesGrpc.getTakeOfferMethod; import static haveno.proto.grpc.TradesGrpc.getWithdrawFundsMethod; -import io.grpc.ServerInterceptor; -import io.grpc.stub.StreamObserver; -import java.util.HashMap; -import java.util.List; -import java.util.Optional; import static java.util.concurrent.TimeUnit.MINUTES; import static java.util.concurrent.TimeUnit.SECONDS; -import java.util.stream.Collectors; -import lombok.extern.slf4j.Slf4j; @Slf4j class GrpcTradesService extends TradesImplBase { diff --git a/daemon/src/main/java/haveno/daemon/grpc/GrpcVersionService.java b/daemon/src/main/java/haveno/daemon/grpc/GrpcVersionService.java index dfd4bff750..a870047053 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcVersionService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcVersionService.java @@ -18,21 +18,23 @@ package haveno.daemon.grpc; import com.google.common.annotations.VisibleForTesting; -import com.google.inject.Inject; import haveno.core.api.CoreApi; import haveno.daemon.grpc.interceptor.CallRateMeteringInterceptor; import haveno.daemon.grpc.interceptor.GrpcCallRateMeter; -import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; -import static haveno.proto.grpc.GetVersionGrpc.GetVersionImplBase; -import static haveno.proto.grpc.GetVersionGrpc.getGetVersionMethod; import haveno.proto.grpc.GetVersionReply; import haveno.proto.grpc.GetVersionRequest; import io.grpc.ServerInterceptor; import io.grpc.stub.StreamObserver; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; import java.util.HashMap; import java.util.Optional; + +import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; +import static haveno.proto.grpc.GetVersionGrpc.GetVersionImplBase; +import static haveno.proto.grpc.GetVersionGrpc.getGetVersionMethod; import static java.util.concurrent.TimeUnit.SECONDS; -import lombok.extern.slf4j.Slf4j; @VisibleForTesting @Slf4j diff --git a/daemon/src/main/java/haveno/daemon/grpc/GrpcWalletsService.java b/daemon/src/main/java/haveno/daemon/grpc/GrpcWalletsService.java index 2081aa1271..e12e9a116d 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcWalletsService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcWalletsService.java @@ -17,14 +17,11 @@ package haveno.daemon.grpc; -import com.google.inject.Inject; import haveno.common.UserThread; import haveno.core.api.CoreApi; import haveno.core.api.model.AddressBalanceInfo; -import static haveno.core.api.model.XmrTx.toXmrTx; import haveno.daemon.grpc.interceptor.CallRateMeteringInterceptor; import haveno.daemon.grpc.interceptor.GrpcCallRateMeter; -import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; import haveno.proto.grpc.CreateXmrTxReply; import haveno.proto.grpc.CreateXmrTxRequest; import haveno.proto.grpc.GetAddressBalanceReply; @@ -51,6 +48,21 @@ import haveno.proto.grpc.SetWalletPasswordReply; import haveno.proto.grpc.SetWalletPasswordRequest; import haveno.proto.grpc.UnlockWalletReply; import haveno.proto.grpc.UnlockWalletRequest; +import io.grpc.ServerInterceptor; +import io.grpc.stub.StreamObserver; +import lombok.extern.slf4j.Slf4j; +import monero.wallet.model.MoneroDestination; +import monero.wallet.model.MoneroTxWallet; + +import javax.inject.Inject; +import java.math.BigInteger; +import java.util.HashMap; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +import static haveno.core.api.model.XmrTx.toXmrTx; +import static haveno.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; import static haveno.proto.grpc.WalletsGrpc.WalletsImplBase; import static haveno.proto.grpc.WalletsGrpc.getGetAddressBalanceMethod; import static haveno.proto.grpc.WalletsGrpc.getGetBalancesMethod; @@ -59,17 +71,7 @@ import static haveno.proto.grpc.WalletsGrpc.getLockWalletMethod; import static haveno.proto.grpc.WalletsGrpc.getRemoveWalletPasswordMethod; import static haveno.proto.grpc.WalletsGrpc.getSetWalletPasswordMethod; import static haveno.proto.grpc.WalletsGrpc.getUnlockWalletMethod; -import io.grpc.ServerInterceptor; -import io.grpc.stub.StreamObserver; -import java.math.BigInteger; -import java.util.HashMap; -import java.util.List; -import java.util.Optional; import static java.util.concurrent.TimeUnit.SECONDS; -import java.util.stream.Collectors; -import lombok.extern.slf4j.Slf4j; -import monero.wallet.model.MoneroDestination; -import monero.wallet.model.MoneroTxWallet; @Slf4j class GrpcWalletsService extends WalletsImplBase { diff --git a/daemon/src/main/java/haveno/daemon/grpc/interceptor/PasswordAuthInterceptor.java b/daemon/src/main/java/haveno/daemon/grpc/interceptor/PasswordAuthInterceptor.java index 704abd50a0..4eccc52f11 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/interceptor/PasswordAuthInterceptor.java +++ b/daemon/src/main/java/haveno/daemon/grpc/interceptor/PasswordAuthInterceptor.java @@ -17,16 +17,18 @@ package haveno.daemon.grpc.interceptor; -import com.google.inject.Inject; import haveno.common.config.Config; import io.grpc.Metadata; -import static io.grpc.Metadata.ASCII_STRING_MARSHALLER; -import static io.grpc.Metadata.Key; import io.grpc.ServerCall; import io.grpc.ServerCallHandler; import io.grpc.ServerInterceptor; -import static io.grpc.Status.UNAUTHENTICATED; import io.grpc.StatusRuntimeException; + +import javax.inject.Inject; + +import static io.grpc.Metadata.ASCII_STRING_MARSHALLER; +import static io.grpc.Metadata.Key; +import static io.grpc.Status.UNAUTHENTICATED; import static java.lang.String.format; /** diff --git a/desktop/src/main/java/haveno/desktop/Navigation.java b/desktop/src/main/java/haveno/desktop/Navigation.java index c882d4a236..9d049f9bd6 100644 --- a/desktop/src/main/java/haveno/desktop/Navigation.java +++ b/desktop/src/main/java/haveno/desktop/Navigation.java @@ -18,7 +18,6 @@ package haveno.desktop; import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.persistence.PersistenceManager; import haveno.common.proto.persistable.NavigationPath; import haveno.common.proto.persistable.PersistedDataHost; @@ -26,15 +25,17 @@ import haveno.desktop.common.view.View; import haveno.desktop.common.view.ViewPath; import haveno.desktop.main.MainView; import haveno.desktop.main.market.MarketView; +import lombok.Getter; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; + +import javax.annotation.Nullable; +import javax.inject.Singleton; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.concurrent.CopyOnWriteArraySet; import java.util.stream.Collectors; -import javax.annotation.Nullable; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; @Slf4j @Singleton diff --git a/desktop/src/main/java/haveno/desktop/common/fxml/FxmlViewLoader.java b/desktop/src/main/java/haveno/desktop/common/fxml/FxmlViewLoader.java index e4efb0b691..e1f4e6110c 100644 --- a/desktop/src/main/java/haveno/desktop/common/fxml/FxmlViewLoader.java +++ b/desktop/src/main/java/haveno/desktop/common/fxml/FxmlViewLoader.java @@ -18,21 +18,23 @@ package haveno.desktop.common.fxml; import com.google.common.base.Joiner; -import static com.google.common.base.Preconditions.checkNotNull; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.util.Utilities; import haveno.desktop.common.ViewfxException; import haveno.desktop.common.view.FxmlView; import haveno.desktop.common.view.View; import haveno.desktop.common.view.ViewFactory; import haveno.desktop.common.view.ViewLoader; +import javafx.fxml.FXMLLoader; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.io.IOException; import java.lang.annotation.Annotation; import java.net.URL; import java.util.ResourceBundle; -import javafx.fxml.FXMLLoader; -import lombok.extern.slf4j.Slf4j; + +import static com.google.common.base.Preconditions.checkNotNull; @Slf4j @Singleton diff --git a/desktop/src/main/java/haveno/desktop/common/view/CachingViewLoader.java b/desktop/src/main/java/haveno/desktop/common/view/CachingViewLoader.java index 0bba7274ae..a09de2d3de 100644 --- a/desktop/src/main/java/haveno/desktop/common/view/CachingViewLoader.java +++ b/desktop/src/main/java/haveno/desktop/common/view/CachingViewLoader.java @@ -17,8 +17,8 @@ package haveno.desktop.common.view; -import com.google.inject.Inject; -import com.google.inject.Singleton; +import javax.inject.Inject; +import javax.inject.Singleton; import java.util.HashMap; import java.util.Map; diff --git a/desktop/src/main/java/haveno/desktop/common/view/guice/InjectorViewFactory.java b/desktop/src/main/java/haveno/desktop/common/view/guice/InjectorViewFactory.java index 96e043b4e0..302957ff5e 100644 --- a/desktop/src/main/java/haveno/desktop/common/view/guice/InjectorViewFactory.java +++ b/desktop/src/main/java/haveno/desktop/common/view/guice/InjectorViewFactory.java @@ -19,9 +19,10 @@ package haveno.desktop.common.view.guice; import com.google.common.base.Preconditions; import com.google.inject.Injector; -import com.google.inject.Singleton; import haveno.desktop.common.view.ViewFactory; +import javax.inject.Singleton; + @Singleton public class InjectorViewFactory implements ViewFactory { diff --git a/desktop/src/main/java/haveno/desktop/main/MainView.java b/desktop/src/main/java/haveno/desktop/main/MainView.java index 81966dbf33..3be68ccded 100644 --- a/desktop/src/main/java/haveno/desktop/main/MainView.java +++ b/desktop/src/main/java/haveno/desktop/main/MainView.java @@ -17,7 +17,6 @@ package haveno.desktop.main; -import com.google.inject.Inject; import com.jfoenix.controls.JFXBadge; import com.jfoenix.controls.JFXComboBox; import com.jfoenix.controls.JFXProgressBar; @@ -56,10 +55,6 @@ import haveno.desktop.main.shared.PriceFeedComboBoxItem; import haveno.desktop.main.support.SupportView; import haveno.desktop.util.DisplayUtils; import haveno.desktop.util.Transitions; -import java.text.DecimalFormat; -import java.text.NumberFormat; -import java.util.Date; -import java.util.Locale; import javafx.animation.Animation; import javafx.animation.KeyFrame; import javafx.animation.Timeline; @@ -86,10 +81,6 @@ import javafx.scene.image.ImageView; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; import javafx.scene.layout.AnchorPane; -import static javafx.scene.layout.AnchorPane.setBottomAnchor; -import static javafx.scene.layout.AnchorPane.setLeftAnchor; -import static javafx.scene.layout.AnchorPane.setRightAnchor; -import static javafx.scene.layout.AnchorPane.setTopAnchor; import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; @@ -102,6 +93,17 @@ import lombok.Setter; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; +import javax.inject.Inject; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.util.Date; +import java.util.Locale; + +import static javafx.scene.layout.AnchorPane.setBottomAnchor; +import static javafx.scene.layout.AnchorPane.setLeftAnchor; +import static javafx.scene.layout.AnchorPane.setRightAnchor; +import static javafx.scene.layout.AnchorPane.setTopAnchor; + @FxmlView @Slf4j public class MainView extends InitializableView { diff --git a/desktop/src/main/java/haveno/desktop/main/account/AccountView.java b/desktop/src/main/java/haveno/desktop/main/account/AccountView.java index 01b462f1fb..13ac1a922c 100644 --- a/desktop/src/main/java/haveno/desktop/main/account/AccountView.java +++ b/desktop/src/main/java/haveno/desktop/main/account/AccountView.java @@ -17,7 +17,6 @@ package haveno.desktop.main.account; -import com.google.inject.Inject; import haveno.common.util.Utilities; import haveno.core.locale.Res; import haveno.core.user.DontShowAgainLookup; @@ -40,7 +39,6 @@ import haveno.desktop.main.account.register.mediator.MediatorRegistrationView; import haveno.desktop.main.account.register.refundagent.RefundAgentRegistrationView; import haveno.desktop.main.account.register.signing.SigningView; import haveno.desktop.main.presentation.AccountPresentation; -import java.util.List; import javafx.beans.value.ChangeListener; import javafx.collections.ListChangeListener; import javafx.event.EventHandler; @@ -52,6 +50,9 @@ import javafx.scene.control.TabPane; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; +import javax.inject.Inject; +import java.util.List; + @FxmlView public class AccountView extends ActivatableView { diff --git a/desktop/src/main/java/haveno/desktop/main/account/content/backup/BackupView.java b/desktop/src/main/java/haveno/desktop/main/account/content/backup/BackupView.java index 631f8706fa..bc14e1d6f6 100644 --- a/desktop/src/main/java/haveno/desktop/main/account/content/backup/BackupView.java +++ b/desktop/src/main/java/haveno/desktop/main/account/content/backup/BackupView.java @@ -17,7 +17,6 @@ package haveno.desktop.main.account.content.backup; -import com.google.inject.Inject; import haveno.common.config.Config; import haveno.common.file.FileUtil; import haveno.common.persistence.PersistenceManager; @@ -28,22 +27,25 @@ import haveno.core.user.Preferences; import haveno.desktop.common.view.ActivatableView; import haveno.desktop.common.view.FxmlView; import haveno.desktop.main.overlays.popups.Popup; -import static haveno.desktop.util.FormBuilder.add2Buttons; -import static haveno.desktop.util.FormBuilder.add2ButtonsAfterGroup; -import static haveno.desktop.util.FormBuilder.addInputTextField; -import static haveno.desktop.util.FormBuilder.addTitledGroupBg; import haveno.desktop.util.Layout; -import java.io.File; -import java.io.IOException; -import java.nio.file.Paths; -import java.text.SimpleDateFormat; -import java.util.Date; import javafx.beans.value.ChangeListener; import javafx.scene.control.Button; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; import javafx.stage.DirectoryChooser; + import javax.annotation.Nullable; +import javax.inject.Inject; +import java.io.File; +import java.io.IOException; +import java.nio.file.Paths; +import java.text.SimpleDateFormat; +import java.util.Date; + +import static haveno.desktop.util.FormBuilder.add2Buttons; +import static haveno.desktop.util.FormBuilder.add2ButtonsAfterGroup; +import static haveno.desktop.util.FormBuilder.addInputTextField; +import static haveno.desktop.util.FormBuilder.addTitledGroupBg; @FxmlView public class BackupView extends ActivatableView { diff --git a/desktop/src/main/java/haveno/desktop/main/account/content/cryptoaccounts/CryptoAccountsView.java b/desktop/src/main/java/haveno/desktop/main/account/content/cryptoaccounts/CryptoAccountsView.java index f5516f60e8..4dde7eed03 100644 --- a/desktop/src/main/java/haveno/desktop/main/account/content/cryptoaccounts/CryptoAccountsView.java +++ b/desktop/src/main/java/haveno/desktop/main/account/content/cryptoaccounts/CryptoAccountsView.java @@ -17,10 +17,8 @@ package haveno.desktop.main.account.content.cryptoaccounts; -import com.google.inject.Inject; -import com.google.inject.name.Named; -import haveno.asset.Asset; import haveno.asset.CryptoAccountDisclaimer; +import haveno.asset.Asset; import haveno.asset.coins.Monero; import haveno.common.util.Tuple2; import haveno.common.util.Tuple3; @@ -41,17 +39,11 @@ import haveno.core.util.validation.InputValidator; import haveno.desktop.common.view.FxmlView; import haveno.desktop.components.TitledGroupBg; import haveno.desktop.components.paymentmethods.AssetsForm; -import static haveno.desktop.components.paymentmethods.AssetsForm.INSTANT_TRADE_NEWS; import haveno.desktop.components.paymentmethods.PaymentMethodForm; import haveno.desktop.main.account.content.PaymentAccountsView; import haveno.desktop.main.overlays.popups.Popup; import haveno.desktop.util.FormBuilder; -import static haveno.desktop.util.FormBuilder.add2ButtonsAfterGroup; -import static haveno.desktop.util.FormBuilder.add3ButtonsAfterGroup; -import static haveno.desktop.util.FormBuilder.addTitledGroupBg; -import static haveno.desktop.util.FormBuilder.addTopLabelListView; import haveno.desktop.util.Layout; -import java.util.Optional; import javafx.collections.ObservableList; import javafx.scene.control.Button; import javafx.scene.control.Label; @@ -60,6 +52,16 @@ import javafx.scene.layout.GridPane; import javafx.scene.layout.VBox; import javafx.stage.Stage; +import javax.inject.Inject; +import javax.inject.Named; +import java.util.Optional; + +import static haveno.desktop.components.paymentmethods.AssetsForm.INSTANT_TRADE_NEWS; +import static haveno.desktop.util.FormBuilder.add2ButtonsAfterGroup; +import static haveno.desktop.util.FormBuilder.add3ButtonsAfterGroup; +import static haveno.desktop.util.FormBuilder.addTitledGroupBg; +import static haveno.desktop.util.FormBuilder.addTopLabelListView; + @FxmlView public class CryptoAccountsView extends PaymentAccountsView { diff --git a/desktop/src/main/java/haveno/desktop/main/account/content/notifications/MobileNotificationsView.java b/desktop/src/main/java/haveno/desktop/main/account/content/notifications/MobileNotificationsView.java index b51484af16..10e6d75081 100644 --- a/desktop/src/main/java/haveno/desktop/main/account/content/notifications/MobileNotificationsView.java +++ b/desktop/src/main/java/haveno/desktop/main/account/content/notifications/MobileNotificationsView.java @@ -17,7 +17,6 @@ package haveno.desktop.main.account.content.notifications; -import com.google.inject.Inject; import haveno.common.UserThread; import haveno.common.util.Tuple2; import haveno.common.util.Tuple3; @@ -41,25 +40,17 @@ import haveno.core.user.User; import haveno.core.util.FormattingUtils; import haveno.core.util.ParsingUtils; import haveno.core.util.PriceUtil; +import haveno.core.util.validation.NonFiatPriceValidator; import haveno.core.util.validation.FiatPriceValidator; import haveno.core.util.validation.InputValidator; -import haveno.core.util.validation.NonFiatPriceValidator; import haveno.desktop.common.view.ActivatableView; import haveno.desktop.common.view.FxmlView; import haveno.desktop.components.InfoInputTextField; import haveno.desktop.components.InputTextField; import haveno.desktop.main.overlays.popups.Popup; import haveno.desktop.util.FormBuilder; -import static haveno.desktop.util.FormBuilder.addButton; -import static haveno.desktop.util.FormBuilder.addInputTextField; -import static haveno.desktop.util.FormBuilder.addSlideToggleButton; -import static haveno.desktop.util.FormBuilder.addTitledGroupBg; -import static haveno.desktop.util.FormBuilder.addTopLabelButton; import haveno.desktop.util.GUIUtil; import haveno.desktop.util.Layout; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; import javafx.beans.value.ChangeListener; import javafx.collections.FXCollections; import javafx.collections.SetChangeListener; @@ -75,6 +66,17 @@ import javafx.scene.control.ToggleGroup; import javafx.scene.layout.GridPane; import javafx.util.StringConverter; +import javax.inject.Inject; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import static haveno.desktop.util.FormBuilder.addButton; +import static haveno.desktop.util.FormBuilder.addInputTextField; +import static haveno.desktop.util.FormBuilder.addSlideToggleButton; +import static haveno.desktop.util.FormBuilder.addTitledGroupBg; +import static haveno.desktop.util.FormBuilder.addTopLabelButton; + @FxmlView public class MobileNotificationsView extends ActivatableView { private final Preferences preferences; diff --git a/desktop/src/main/java/haveno/desktop/main/account/content/password/PasswordView.java b/desktop/src/main/java/haveno/desktop/main/account/content/password/PasswordView.java index e5ada453a2..332170d3d7 100644 --- a/desktop/src/main/java/haveno/desktop/main/account/content/password/PasswordView.java +++ b/desktop/src/main/java/haveno/desktop/main/account/content/password/PasswordView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.account.content.password; -import static com.google.common.base.Preconditions.checkArgument; -import com.google.inject.Inject; import com.jfoenix.validation.RequiredFieldValidator; import haveno.common.util.Tuple4; import haveno.core.api.CoreAccountService; @@ -35,10 +33,6 @@ import haveno.desktop.main.MainView; import haveno.desktop.main.account.AccountView; import haveno.desktop.main.account.content.backup.BackupView; import haveno.desktop.main.overlays.popups.Popup; -import static haveno.desktop.util.FormBuilder.addButtonBusyAnimationLabel; -import static haveno.desktop.util.FormBuilder.addMultilineLabel; -import static haveno.desktop.util.FormBuilder.addPasswordTextField; -import static haveno.desktop.util.FormBuilder.addTitledGroupBg; import haveno.desktop.util.Layout; import haveno.desktop.util.validation.PasswordValidator; import javafx.beans.value.ChangeListener; @@ -47,6 +41,14 @@ import javafx.scene.control.Label; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; +import javax.inject.Inject; + +import static com.google.common.base.Preconditions.checkArgument; +import static haveno.desktop.util.FormBuilder.addButtonBusyAnimationLabel; +import static haveno.desktop.util.FormBuilder.addMultilineLabel; +import static haveno.desktop.util.FormBuilder.addPasswordTextField; +import static haveno.desktop.util.FormBuilder.addTitledGroupBg; + @FxmlView public class PasswordView extends ActivatableView { diff --git a/desktop/src/main/java/haveno/desktop/main/account/content/seedwords/SeedWordsView.java b/desktop/src/main/java/haveno/desktop/main/account/content/seedwords/SeedWordsView.java index dbd8464911..2e8d3679e2 100644 --- a/desktop/src/main/java/haveno/desktop/main/account/content/seedwords/SeedWordsView.java +++ b/desktop/src/main/java/haveno/desktop/main/account/content/seedwords/SeedWordsView.java @@ -18,8 +18,6 @@ package haveno.desktop.main.account.content.seedwords; import com.google.common.base.Splitter; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.core.locale.Res; import haveno.core.offer.OpenOfferManager; @@ -31,20 +29,7 @@ import haveno.desktop.common.view.FxmlView; import haveno.desktop.main.SharedPresentation; import haveno.desktop.main.overlays.popups.Popup; import haveno.desktop.main.overlays.windows.WalletPasswordWindow; -import static haveno.desktop.util.FormBuilder.addMultilineLabel; -import static haveno.desktop.util.FormBuilder.addPrimaryActionButtonAFterGroup; -import static haveno.desktop.util.FormBuilder.addTitledGroupBg; -import static haveno.desktop.util.FormBuilder.addTopLabelDatePicker; -import static haveno.desktop.util.FormBuilder.addTopLabelTextArea; import haveno.desktop.util.Layout; -import java.io.File; -import java.io.IOException; -import java.time.Instant; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.ZoneOffset; -import java.util.TimeZone; -import static javafx.beans.binding.Bindings.createBooleanBinding; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.value.ChangeListener; @@ -56,6 +41,23 @@ import org.bitcoinj.crypto.MnemonicCode; import org.bitcoinj.crypto.MnemonicException; import org.bitcoinj.wallet.DeterministicSeed; +import javax.inject.Inject; +import javax.inject.Named; +import java.io.File; +import java.io.IOException; +import java.time.Instant; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.ZoneOffset; +import java.util.TimeZone; + +import static haveno.desktop.util.FormBuilder.addMultilineLabel; +import static haveno.desktop.util.FormBuilder.addPrimaryActionButtonAFterGroup; +import static haveno.desktop.util.FormBuilder.addTitledGroupBg; +import static haveno.desktop.util.FormBuilder.addTopLabelDatePicker; +import static haveno.desktop.util.FormBuilder.addTopLabelTextArea; +import static javafx.beans.binding.Bindings.createBooleanBinding; + @FxmlView public class SeedWordsView extends ActivatableView { private final WalletsManager walletsManager; diff --git a/desktop/src/main/java/haveno/desktop/main/account/content/traditionalaccounts/TraditionalAccountsView.java b/desktop/src/main/java/haveno/desktop/main/account/content/traditionalaccounts/TraditionalAccountsView.java index 2eac2f6b80..e06cbf9843 100644 --- a/desktop/src/main/java/haveno/desktop/main/account/content/traditionalaccounts/TraditionalAccountsView.java +++ b/desktop/src/main/java/haveno/desktop/main/account/content/traditionalaccounts/TraditionalAccountsView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.account.content.traditionalaccounts; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.common.util.Tuple2; import haveno.common.util.Tuple3; @@ -29,17 +27,17 @@ import haveno.core.offer.OfferRestrictions; import haveno.core.payment.AmazonGiftCardAccount; import haveno.core.payment.AustraliaPayidAccount; import haveno.core.payment.CashAtAtmAccount; +import haveno.core.payment.PayByMailAccount; import haveno.core.payment.CashDepositAccount; +import haveno.core.payment.ZelleAccount; import haveno.core.payment.F2FAccount; import haveno.core.payment.HalCashAccount; import haveno.core.payment.MoneyGramAccount; -import haveno.core.payment.PayByMailAccount; import haveno.core.payment.PaymentAccount; import haveno.core.payment.PaymentAccountFactory; import haveno.core.payment.RevolutAccount; import haveno.core.payment.USPostalMoneyOrderAccount; import haveno.core.payment.WesternUnionAccount; -import haveno.core.payment.ZelleAccount; import haveno.core.payment.payload.PaymentMethod; import haveno.core.payment.validation.AdvancedCashValidator; import haveno.core.payment.validation.AliPayValidator; @@ -76,9 +74,11 @@ import haveno.desktop.components.paymentmethods.AustraliaPayidForm; import haveno.desktop.components.paymentmethods.BizumForm; import haveno.desktop.components.paymentmethods.CapitualForm; import haveno.desktop.components.paymentmethods.CashAtAtmForm; +import haveno.desktop.components.paymentmethods.PayByMailForm; import haveno.desktop.components.paymentmethods.CashDepositForm; import haveno.desktop.components.paymentmethods.CelPayForm; import haveno.desktop.components.paymentmethods.ChaseQuickPayForm; +import haveno.desktop.components.paymentmethods.ZelleForm; import haveno.desktop.components.paymentmethods.DomesticWireTransferForm; import haveno.desktop.components.paymentmethods.F2FForm; import haveno.desktop.components.paymentmethods.FasterPaymentsForm; @@ -93,7 +93,6 @@ import haveno.desktop.components.paymentmethods.NationalBankForm; import haveno.desktop.components.paymentmethods.NeftForm; import haveno.desktop.components.paymentmethods.NequiForm; import haveno.desktop.components.paymentmethods.PaxumForm; -import haveno.desktop.components.paymentmethods.PayByMailForm; import haveno.desktop.components.paymentmethods.PaymentMethodForm; import haveno.desktop.components.paymentmethods.PayseraForm; import haveno.desktop.components.paymentmethods.PaytmForm; @@ -120,19 +119,11 @@ import haveno.desktop.components.paymentmethods.UpiForm; import haveno.desktop.components.paymentmethods.VerseForm; import haveno.desktop.components.paymentmethods.WeChatPayForm; import haveno.desktop.components.paymentmethods.WesternUnionForm; -import haveno.desktop.components.paymentmethods.ZelleForm; import haveno.desktop.main.account.content.PaymentAccountsView; import haveno.desktop.main.overlays.popups.Popup; import haveno.desktop.util.FormBuilder; -import static haveno.desktop.util.FormBuilder.add2ButtonsAfterGroup; -import static haveno.desktop.util.FormBuilder.add3ButtonsAfterGroup; -import static haveno.desktop.util.FormBuilder.addTitledGroupBg; -import static haveno.desktop.util.FormBuilder.addTopLabelListView; import haveno.desktop.util.GUIUtil; import haveno.desktop.util.Layout; -import java.math.BigInteger; -import java.util.List; -import java.util.stream.Collectors; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.control.Button; @@ -144,6 +135,17 @@ import javafx.scene.layout.VBox; import javafx.stage.Stage; import javafx.util.StringConverter; +import javax.inject.Inject; +import javax.inject.Named; +import java.math.BigInteger; +import java.util.List; +import java.util.stream.Collectors; + +import static haveno.desktop.util.FormBuilder.add2ButtonsAfterGroup; +import static haveno.desktop.util.FormBuilder.add3ButtonsAfterGroup; +import static haveno.desktop.util.FormBuilder.addTitledGroupBg; +import static haveno.desktop.util.FormBuilder.addTopLabelListView; + @FxmlView public class TraditionalAccountsView extends PaymentAccountsView { diff --git a/desktop/src/main/java/haveno/desktop/main/account/content/walletinfo/WalletInfoView.java b/desktop/src/main/java/haveno/desktop/main/account/content/walletinfo/WalletInfoView.java index a073c30cf7..2d4f624340 100644 --- a/desktop/src/main/java/haveno/desktop/main/account/content/walletinfo/WalletInfoView.java +++ b/desktop/src/main/java/haveno/desktop/main/account/content/walletinfo/WalletInfoView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.account.content.walletinfo; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.core.locale.Res; import haveno.core.util.FormattingUtils; @@ -31,10 +29,6 @@ import haveno.desktop.common.view.ActivatableView; import haveno.desktop.common.view.FxmlView; import haveno.desktop.main.overlays.popups.Popup; import haveno.desktop.main.overlays.windows.ShowWalletDataWindow; -import static haveno.desktop.util.FormBuilder.addButtonAfterGroup; -import static haveno.desktop.util.FormBuilder.addMultilineLabel; -import static haveno.desktop.util.FormBuilder.addTitledGroupBg; -import static haveno.desktop.util.FormBuilder.addTopLabelTextField; import haveno.desktop.util.Layout; import javafx.scene.control.Button; import javafx.scene.control.TextField; @@ -43,6 +37,14 @@ import org.bitcoinj.core.Coin; import org.bitcoinj.core.Transaction; import org.bitcoinj.script.Script; import org.bitcoinj.wallet.DeterministicKeyChain; + +import javax.inject.Inject; +import javax.inject.Named; + +import static haveno.desktop.util.FormBuilder.addButtonAfterGroup; +import static haveno.desktop.util.FormBuilder.addMultilineLabel; +import static haveno.desktop.util.FormBuilder.addTitledGroupBg; +import static haveno.desktop.util.FormBuilder.addTopLabelTextField; import static org.bitcoinj.wallet.Wallet.BalanceType.ESTIMATED_SPENDABLE; @FxmlView diff --git a/desktop/src/main/java/haveno/desktop/main/account/register/arbitrator/ArbitratorRegistrationView.java b/desktop/src/main/java/haveno/desktop/main/account/register/arbitrator/ArbitratorRegistrationView.java index f709311515..81aa0d88f1 100644 --- a/desktop/src/main/java/haveno/desktop/main/account/register/arbitrator/ArbitratorRegistrationView.java +++ b/desktop/src/main/java/haveno/desktop/main/account/register/arbitrator/ArbitratorRegistrationView.java @@ -18,14 +18,15 @@ package haveno.desktop.main.account.register.arbitrator; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.core.locale.Res; import haveno.core.support.dispute.arbitration.arbitrator.Arbitrator; import haveno.desktop.common.view.FxmlView; import haveno.desktop.main.account.register.AgentRegistrationView; +import javax.inject.Inject; +import javax.inject.Named; + @FxmlView public class ArbitratorRegistrationView extends AgentRegistrationView { diff --git a/desktop/src/main/java/haveno/desktop/main/account/register/mediator/MediatorRegistrationView.java b/desktop/src/main/java/haveno/desktop/main/account/register/mediator/MediatorRegistrationView.java index c99890cbf0..0cfa2524cf 100644 --- a/desktop/src/main/java/haveno/desktop/main/account/register/mediator/MediatorRegistrationView.java +++ b/desktop/src/main/java/haveno/desktop/main/account/register/mediator/MediatorRegistrationView.java @@ -18,14 +18,15 @@ package haveno.desktop.main.account.register.mediator; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.core.locale.Res; import haveno.core.support.dispute.mediation.mediator.Mediator; import haveno.desktop.common.view.FxmlView; import haveno.desktop.main.account.register.AgentRegistrationView; +import javax.inject.Inject; +import javax.inject.Named; + @FxmlView public class MediatorRegistrationView extends AgentRegistrationView { diff --git a/desktop/src/main/java/haveno/desktop/main/account/register/refundagent/RefundAgentRegistrationView.java b/desktop/src/main/java/haveno/desktop/main/account/register/refundagent/RefundAgentRegistrationView.java index ea9b3aa0b6..1f1ff3512a 100644 --- a/desktop/src/main/java/haveno/desktop/main/account/register/refundagent/RefundAgentRegistrationView.java +++ b/desktop/src/main/java/haveno/desktop/main/account/register/refundagent/RefundAgentRegistrationView.java @@ -18,14 +18,15 @@ package haveno.desktop.main.account.register.refundagent; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.core.locale.Res; import haveno.core.support.dispute.refund.refundagent.RefundAgent; import haveno.desktop.common.view.FxmlView; import haveno.desktop.main.account.register.AgentRegistrationView; +import javax.inject.Inject; +import javax.inject.Named; + @FxmlView public class RefundAgentRegistrationView extends AgentRegistrationView { diff --git a/desktop/src/main/java/haveno/desktop/main/account/register/signing/SigningView.java b/desktop/src/main/java/haveno/desktop/main/account/register/signing/SigningView.java index f83e04ac09..ec611af0a3 100644 --- a/desktop/src/main/java/haveno/desktop/main/account/register/signing/SigningView.java +++ b/desktop/src/main/java/haveno/desktop/main/account/register/signing/SigningView.java @@ -18,7 +18,6 @@ package haveno.desktop.main.account.register.signing; -import com.google.inject.Inject; import haveno.common.util.Utilities; import haveno.desktop.common.view.ActivatableView; import haveno.desktop.common.view.FxmlView; @@ -31,6 +30,8 @@ import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; import javafx.scene.layout.AnchorPane; +import javax.inject.Inject; + @FxmlView public class SigningView extends ActivatableView { diff --git a/desktop/src/main/java/haveno/desktop/main/debug/DebugView.java b/desktop/src/main/java/haveno/desktop/main/debug/DebugView.java index 2e79c8faae..40532baf16 100644 --- a/desktop/src/main/java/haveno/desktop/main/debug/DebugView.java +++ b/desktop/src/main/java/haveno/desktop/main/debug/DebugView.java @@ -17,7 +17,6 @@ package haveno.desktop.main.debug; -import com.google.inject.Inject; import haveno.common.taskrunner.Task; import haveno.common.util.Tuple2; import haveno.core.offer.availability.tasks.ProcessOfferAvailabilityResponse; @@ -41,8 +40,6 @@ import haveno.core.trade.protocol.tasks.VerifyPeersAccountAgeWitness; import haveno.desktop.common.view.FxmlView; import haveno.desktop.common.view.InitializableView; import haveno.desktop.components.TitledGroupBg; -import static haveno.desktop.util.FormBuilder.addTopLabelComboBox; -import java.util.Arrays; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; @@ -51,6 +48,11 @@ import javafx.scene.control.Label; import javafx.scene.layout.GridPane; import javafx.util.StringConverter; +import javax.inject.Inject; +import java.util.Arrays; + +import static haveno.desktop.util.FormBuilder.addTopLabelComboBox; + // Not maintained anymore with new trade protocol, but leave it...If used needs to be adopted to current protocol. @FxmlView public class DebugView extends InitializableView { diff --git a/desktop/src/main/java/haveno/desktop/main/funds/FundsView.java b/desktop/src/main/java/haveno/desktop/main/funds/FundsView.java index d7599c4aaa..988660bb97 100644 --- a/desktop/src/main/java/haveno/desktop/main/funds/FundsView.java +++ b/desktop/src/main/java/haveno/desktop/main/funds/FundsView.java @@ -17,7 +17,6 @@ package haveno.desktop.main.funds; -import com.google.inject.Inject; import haveno.core.locale.Res; import haveno.desktop.Navigation; import haveno.desktop.common.view.ActivatableView; @@ -34,6 +33,8 @@ import javafx.fxml.FXML; import javafx.scene.control.Tab; import javafx.scene.control.TabPane; +import javax.inject.Inject; + @FxmlView public class FundsView extends ActivatableView { diff --git a/desktop/src/main/java/haveno/desktop/main/funds/deposit/DepositView.java b/desktop/src/main/java/haveno/desktop/main/funds/deposit/DepositView.java index cfdb2dd065..7bc3f900bd 100644 --- a/desktop/src/main/java/haveno/desktop/main/funds/deposit/DepositView.java +++ b/desktop/src/main/java/haveno/desktop/main/funds/deposit/DepositView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.funds.deposit; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.UserThread; import haveno.common.app.DevEnv; import haveno.common.util.Tuple3; @@ -41,17 +39,8 @@ import haveno.desktop.components.InputTextField; import haveno.desktop.components.TitledGroupBg; import haveno.desktop.main.overlays.popups.Popup; import haveno.desktop.main.overlays.windows.QRCodeWindow; -import static haveno.desktop.util.FormBuilder.addAddressTextField; -import static haveno.desktop.util.FormBuilder.addButtonCheckBoxWithBox; -import static haveno.desktop.util.FormBuilder.addInputTextField; -import static haveno.desktop.util.FormBuilder.addTitledGroupBg; import haveno.desktop.util.GUIUtil; import haveno.desktop.util.Layout; -import java.io.ByteArrayInputStream; -import java.math.BigInteger; -import java.util.Comparator; -import java.util.List; -import java.util.concurrent.TimeUnit; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.beans.value.ChangeListener; import javafx.collections.FXCollections; @@ -81,6 +70,19 @@ import org.fxmisc.easybind.EasyBind; import org.fxmisc.easybind.Subscription; import org.jetbrains.annotations.NotNull; +import javax.inject.Inject; +import javax.inject.Named; +import java.io.ByteArrayInputStream; +import java.math.BigInteger; +import java.util.Comparator; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import static haveno.desktop.util.FormBuilder.addAddressTextField; +import static haveno.desktop.util.FormBuilder.addButtonCheckBoxWithBox; +import static haveno.desktop.util.FormBuilder.addInputTextField; +import static haveno.desktop.util.FormBuilder.addTitledGroupBg; + @FxmlView public class DepositView extends ActivatableView { diff --git a/desktop/src/main/java/haveno/desktop/main/funds/locked/LockedView.java b/desktop/src/main/java/haveno/desktop/main/funds/locked/LockedView.java index 7311e897b8..0b45de8867 100644 --- a/desktop/src/main/java/haveno/desktop/main/funds/locked/LockedView.java +++ b/desktop/src/main/java/haveno/desktop/main/funds/locked/LockedView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.funds.locked; -import com.google.inject.Inject; -import com.google.inject.name.Named; import com.googlecode.jcsv.writer.CSVEntryConverter; import de.jensd.fx.fontawesome.AwesomeIcon; import haveno.core.locale.Res; @@ -42,11 +40,6 @@ import haveno.desktop.components.HyperlinkWithIcon; import haveno.desktop.main.overlays.windows.OfferDetailsWindow; import haveno.desktop.main.overlays.windows.TradeDetailsWindow; import haveno.desktop.util.GUIUtil; -import java.util.Comparator; -import java.util.Date; -import java.util.Objects; -import java.util.Optional; -import java.util.stream.Collectors; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.collections.FXCollections; import javafx.collections.ListChangeListener; @@ -68,6 +61,14 @@ import javafx.util.Callback; import org.bitcoinj.core.Coin; import org.bitcoinj.core.Transaction; +import javax.inject.Inject; +import javax.inject.Named; +import java.util.Comparator; +import java.util.Date; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + @FxmlView public class LockedView extends ActivatableView { @FXML diff --git a/desktop/src/main/java/haveno/desktop/main/funds/reserved/ReservedView.java b/desktop/src/main/java/haveno/desktop/main/funds/reserved/ReservedView.java index bac2d986de..83b7f83162 100644 --- a/desktop/src/main/java/haveno/desktop/main/funds/reserved/ReservedView.java +++ b/desktop/src/main/java/haveno/desktop/main/funds/reserved/ReservedView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.funds.reserved; -import com.google.inject.Inject; -import com.google.inject.name.Named; import com.googlecode.jcsv.writer.CSVEntryConverter; import de.jensd.fx.fontawesome.AwesomeIcon; import haveno.core.locale.Res; @@ -42,11 +40,6 @@ import haveno.desktop.components.HyperlinkWithIcon; import haveno.desktop.main.overlays.windows.OfferDetailsWindow; import haveno.desktop.main.overlays.windows.TradeDetailsWindow; import haveno.desktop.util.GUIUtil; -import java.util.Comparator; -import java.util.Date; -import java.util.Objects; -import java.util.Optional; -import java.util.stream.Collectors; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.collections.FXCollections; import javafx.collections.ListChangeListener; @@ -68,6 +61,14 @@ import javafx.util.Callback; import org.bitcoinj.core.Coin; import org.bitcoinj.core.Transaction; +import javax.inject.Inject; +import javax.inject.Named; +import java.util.Comparator; +import java.util.Date; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + @FxmlView public class ReservedView extends ActivatableView { @FXML diff --git a/desktop/src/main/java/haveno/desktop/main/funds/transactions/DisplayedTransactionsFactory.java b/desktop/src/main/java/haveno/desktop/main/funds/transactions/DisplayedTransactionsFactory.java index 69ec01d098..77b58b7430 100644 --- a/desktop/src/main/java/haveno/desktop/main/funds/transactions/DisplayedTransactionsFactory.java +++ b/desktop/src/main/java/haveno/desktop/main/funds/transactions/DisplayedTransactionsFactory.java @@ -17,10 +17,11 @@ package haveno.desktop.main.funds.transactions; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.core.xmr.wallet.XmrWalletService; +import javax.inject.Inject; +import javax.inject.Singleton; + @Singleton public class DisplayedTransactionsFactory { private final XmrWalletService xmrWalletService; diff --git a/desktop/src/main/java/haveno/desktop/main/funds/transactions/TradableRepository.java b/desktop/src/main/java/haveno/desktop/main/funds/transactions/TradableRepository.java index 24c6bae846..871c0271cb 100644 --- a/desktop/src/main/java/haveno/desktop/main/funds/transactions/TradableRepository.java +++ b/desktop/src/main/java/haveno/desktop/main/funds/transactions/TradableRepository.java @@ -18,13 +18,14 @@ package haveno.desktop.main.funds.transactions; import com.google.common.collect.ImmutableSet; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.core.offer.OpenOfferManager; import haveno.core.trade.ClosedTradableManager; import haveno.core.trade.Tradable; import haveno.core.trade.TradeManager; import haveno.core.trade.failed.FailedTradesManager; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.util.Set; @Singleton diff --git a/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionAwareTradableFactory.java b/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionAwareTradableFactory.java index 661a8aa036..5f6334c1b9 100644 --- a/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionAwareTradableFactory.java +++ b/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionAwareTradableFactory.java @@ -17,8 +17,6 @@ package haveno.desktop.main.funds.transactions; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.crypto.PubKeyRingProvider; import haveno.core.offer.OpenOffer; import haveno.core.support.dispute.arbitration.ArbitrationManager; @@ -27,6 +25,9 @@ import haveno.core.trade.Tradable; import haveno.core.trade.Trade; import haveno.core.xmr.wallet.XmrWalletService; +import javax.inject.Inject; +import javax.inject.Singleton; + @Singleton public class TransactionAwareTradableFactory { diff --git a/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionListItemFactory.java b/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionListItemFactory.java index 9d7a39f1a5..6bd896acd9 100644 --- a/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionListItemFactory.java +++ b/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionListItemFactory.java @@ -17,16 +17,17 @@ package haveno.desktop.main.funds.transactions; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import com.google.inject.name.Named; import haveno.core.user.Preferences; import haveno.core.util.FormattingUtils; import haveno.core.util.coin.CoinFormatter; import haveno.core.xmr.wallet.XmrWalletService; -import javax.annotation.Nullable; import monero.wallet.model.MoneroTxWallet; +import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + @Singleton public class TransactionListItemFactory { diff --git a/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionsView.java b/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionsView.java index 5c8209fafb..7beed5d385 100644 --- a/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionsView.java +++ b/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionsView.java @@ -17,7 +17,6 @@ package haveno.desktop.main.funds.transactions; -import com.google.inject.Inject; import com.googlecode.jcsv.writer.CSVEntryConverter; import de.jensd.fx.fontawesome.AwesomeIcon; import haveno.common.util.Utilities; @@ -38,8 +37,6 @@ import haveno.desktop.main.overlays.windows.OfferDetailsWindow; import haveno.desktop.main.overlays.windows.TradeDetailsWindow; import haveno.desktop.util.GUIUtil; import haveno.network.p2p.P2PService; -import java.math.BigInteger; -import java.util.Comparator; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.collections.ObservableList; import javafx.collections.transformation.SortedList; @@ -63,6 +60,10 @@ import javafx.stage.Stage; import javafx.util.Callback; import monero.wallet.model.MoneroWalletListener; +import javax.inject.Inject; +import java.math.BigInteger; +import java.util.Comparator; + @FxmlView public class TransactionsView extends ActivatableView { diff --git a/desktop/src/main/java/haveno/desktop/main/funds/withdrawal/WithdrawalView.java b/desktop/src/main/java/haveno/desktop/main/funds/withdrawal/WithdrawalView.java index 5fbe8ee4b5..ce58884d71 100644 --- a/desktop/src/main/java/haveno/desktop/main/funds/withdrawal/WithdrawalView.java +++ b/desktop/src/main/java/haveno/desktop/main/funds/withdrawal/WithdrawalView.java @@ -17,7 +17,6 @@ package haveno.desktop.main.funds.withdrawal; -import com.google.inject.Inject; import haveno.common.util.Tuple2; import haveno.core.locale.Res; import haveno.core.trade.HavenoUtils; @@ -36,15 +35,9 @@ import haveno.desktop.components.TitledGroupBg; import haveno.desktop.main.overlays.popups.Popup; import haveno.desktop.main.overlays.windows.TxDetails; import haveno.desktop.main.overlays.windows.WalletPasswordWindow; -import static haveno.desktop.util.FormBuilder.addButton; -import static haveno.desktop.util.FormBuilder.addTitledGroupBg; -import static haveno.desktop.util.FormBuilder.addTopLabelInputTextField; import haveno.desktop.util.GUIUtil; import haveno.desktop.util.Layout; import haveno.network.p2p.P2PService; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; import javafx.beans.value.ChangeListener; import javafx.fxml.FXML; import javafx.scene.control.Button; @@ -55,6 +48,15 @@ import javafx.scene.layout.VBox; import monero.wallet.model.MoneroTxConfig; import monero.wallet.model.MoneroTxWallet; +import javax.inject.Inject; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; + +import static haveno.desktop.util.FormBuilder.addButton; +import static haveno.desktop.util.FormBuilder.addTitledGroupBg; +import static haveno.desktop.util.FormBuilder.addTopLabelInputTextField; + @FxmlView public class WithdrawalView extends ActivatableView { diff --git a/desktop/src/main/java/haveno/desktop/main/market/MarketView.java b/desktop/src/main/java/haveno/desktop/main/market/MarketView.java index efd4f519bf..c50bc16f63 100644 --- a/desktop/src/main/java/haveno/desktop/main/market/MarketView.java +++ b/desktop/src/main/java/haveno/desktop/main/market/MarketView.java @@ -18,8 +18,6 @@ package haveno.desktop.main.market; import com.google.common.base.Joiner; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.util.Utilities; import haveno.core.locale.CurrencyUtil; import haveno.core.locale.Res; @@ -45,8 +43,6 @@ import haveno.desktop.main.offer.offerbook.OfferBook; import haveno.desktop.main.offer.offerbook.OfferBookListItem; import haveno.desktop.main.overlays.popups.Popup; import haveno.desktop.util.DisplayUtils; -import java.util.List; -import java.util.stream.Collectors; import javafx.beans.value.ChangeListener; import javafx.event.EventHandler; import javafx.fxml.FXML; @@ -58,6 +54,11 @@ import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; import org.apache.commons.lang3.StringUtils; +import javax.inject.Inject; +import javax.inject.Named; +import java.util.List; +import java.util.stream.Collectors; + @FxmlView public class MarketView extends ActivatableView { @FXML diff --git a/desktop/src/main/java/haveno/desktop/main/market/offerbook/OfferBookChartView.java b/desktop/src/main/java/haveno/desktop/main/market/offerbook/OfferBookChartView.java index 5773cea3b3..134fddf50c 100644 --- a/desktop/src/main/java/haveno/desktop/main/market/offerbook/OfferBookChartView.java +++ b/desktop/src/main/java/haveno/desktop/main/market/offerbook/OfferBookChartView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.market.offerbook; -import com.google.inject.Inject; -import com.google.inject.name.Named; import com.jfoenix.controls.JFXTabPane; import haveno.common.UserThread; import haveno.common.config.Config; @@ -42,15 +40,8 @@ import haveno.desktop.components.PeerInfoIconSmall; import haveno.desktop.main.offer.offerbook.OfferBookListItem; import haveno.desktop.util.CurrencyListItem; import haveno.desktop.util.DisplayUtils; -import static haveno.desktop.util.FormBuilder.addTopLabelAutocompleteComboBox; import haveno.desktop.util.GUIUtil; -import static haveno.desktop.util.Layout.INITIAL_WINDOW_HEIGHT; import haveno.network.p2p.NodeAddress; -import java.text.DecimalFormat; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.function.Function; -import java.util.stream.Collectors; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; @@ -82,6 +73,17 @@ import javafx.util.StringConverter; import org.fxmisc.easybind.EasyBind; import org.fxmisc.easybind.Subscription; +import javax.inject.Inject; +import javax.inject.Named; +import java.text.DecimalFormat; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static haveno.desktop.util.FormBuilder.addTopLabelAutocompleteComboBox; +import static haveno.desktop.util.Layout.INITIAL_WINDOW_HEIGHT; + @FxmlView public class OfferBookChartView extends ActivatableViewAndModel { private final boolean useDevPrivilegeKeys; diff --git a/desktop/src/main/java/haveno/desktop/main/market/spread/SpreadView.java b/desktop/src/main/java/haveno/desktop/main/market/spread/SpreadView.java index ab2a006c9b..7a680a68c2 100644 --- a/desktop/src/main/java/haveno/desktop/main/market/spread/SpreadView.java +++ b/desktop/src/main/java/haveno/desktop/main/market/spread/SpreadView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.market.spread; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.UserThread; import haveno.core.locale.CurrencyUtil; import haveno.core.locale.Res; @@ -31,8 +29,6 @@ import haveno.desktop.components.AutoTooltipLabel; import haveno.desktop.components.AutoTooltipTableColumn; import haveno.desktop.components.ColoredDecimalPlacesWithZerosText; import haveno.desktop.util.GUIUtil; -import java.math.BigInteger; -import java.util.Comparator; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.collections.ListChangeListener; import javafx.collections.transformation.SortedList; @@ -44,6 +40,11 @@ import javafx.scene.layout.GridPane; import javafx.scene.layout.Priority; import javafx.util.Callback; +import javax.inject.Inject; +import javax.inject.Named; +import java.math.BigInteger; +import java.util.Comparator; + @FxmlView public class SpreadView extends ActivatableViewAndModel { private final CoinFormatter formatter; diff --git a/desktop/src/main/java/haveno/desktop/main/market/spread/SpreadViewModel.java b/desktop/src/main/java/haveno/desktop/main/market/spread/SpreadViewModel.java index 3c8911929f..3529cb94c4 100644 --- a/desktop/src/main/java/haveno/desktop/main/market/spread/SpreadViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/market/spread/SpreadViewModel.java @@ -18,7 +18,6 @@ package haveno.desktop.main.market.spread; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.UserThread; import haveno.core.locale.Res; import haveno.core.monetary.CryptoMoney; @@ -36,6 +35,15 @@ import haveno.desktop.main.offer.offerbook.OfferBook; import haveno.desktop.main.offer.offerbook.OfferBookListItem; import haveno.desktop.main.overlays.popups.Popup; import haveno.desktop.util.GUIUtil; +import javafx.beans.property.IntegerProperty; +import javafx.beans.property.SimpleIntegerProperty; +import javafx.collections.FXCollections; +import javafx.collections.ListChangeListener; +import javafx.collections.ObservableList; +import lombok.Getter; +import lombok.Setter; + +import javax.inject.Named; import java.math.BigDecimal; import java.math.BigInteger; import java.math.RoundingMode; @@ -48,13 +56,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Collectors; -import javafx.beans.property.IntegerProperty; -import javafx.beans.property.SimpleIntegerProperty; -import javafx.collections.FXCollections; -import javafx.collections.ListChangeListener; -import javafx.collections.ObservableList; -import lombok.Getter; -import lombok.Setter; class SpreadViewModel extends ActivatableViewModel { diff --git a/desktop/src/main/java/haveno/desktop/main/market/spread/SpreadViewPaymentMethod.java b/desktop/src/main/java/haveno/desktop/main/market/spread/SpreadViewPaymentMethod.java index aa0463baaf..7832ed7d60 100644 --- a/desktop/src/main/java/haveno/desktop/main/market/spread/SpreadViewPaymentMethod.java +++ b/desktop/src/main/java/haveno/desktop/main/market/spread/SpreadViewPaymentMethod.java @@ -17,15 +17,17 @@ package haveno.desktop.main.market.spread; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.core.locale.Res; import haveno.core.util.FormattingUtils; import haveno.core.util.coin.CoinFormatter; import haveno.desktop.common.view.FxmlView; -import static haveno.desktop.util.FormBuilder.addSlideToggleButton; import javafx.scene.control.ToggleButton; +import javax.inject.Inject; +import javax.inject.Named; + +import static haveno.desktop.util.FormBuilder.addSlideToggleButton; + @FxmlView public class SpreadViewPaymentMethod extends SpreadView { private ToggleButton expandedMode; diff --git a/desktop/src/main/java/haveno/desktop/main/market/trades/TradesChartsView.java b/desktop/src/main/java/haveno/desktop/main/market/trades/TradesChartsView.java index 484a2b0757..4553380ee1 100644 --- a/desktop/src/main/java/haveno/desktop/main/market/trades/TradesChartsView.java +++ b/desktop/src/main/java/haveno/desktop/main/market/trades/TradesChartsView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.market.trades; -import com.google.inject.Inject; -import com.google.inject.name.Named; import com.googlecode.jcsv.writer.CSVEntryConverter; import com.jfoenix.controls.JFXTabPane; import haveno.common.UserThread; @@ -43,20 +41,11 @@ import haveno.desktop.components.AutoTooltipTableColumn; import haveno.desktop.components.AutoTooltipToggleButton; import haveno.desktop.components.AutocompleteComboBox; import haveno.desktop.components.ColoredDecimalPlacesWithZerosText; -import static haveno.desktop.main.market.trades.TradesChartsViewModel.MAX_TICKS; import haveno.desktop.main.market.trades.charts.price.CandleStickChart; import haveno.desktop.main.market.trades.charts.volume.VolumeChart; import haveno.desktop.util.CurrencyListItem; import haveno.desktop.util.DisplayUtils; -import static haveno.desktop.util.FormBuilder.addTopLabelAutocompleteComboBox; -import static haveno.desktop.util.FormBuilder.getTopLabelWithVBox; import haveno.desktop.util.GUIUtil; -import java.text.DecimalFormat; -import java.util.Comparator; -import java.util.Date; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.stream.Collectors; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; @@ -95,6 +84,19 @@ import org.fxmisc.easybind.Subscription; import org.fxmisc.easybind.monadic.MonadicBinding; import org.jetbrains.annotations.NotNull; +import javax.inject.Inject; +import javax.inject.Named; +import java.text.DecimalFormat; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.stream.Collectors; + +import static haveno.desktop.main.market.trades.TradesChartsViewModel.MAX_TICKS; +import static haveno.desktop.util.FormBuilder.addTopLabelAutocompleteComboBox; +import static haveno.desktop.util.FormBuilder.getTopLabelWithVBox; + @FxmlView public class TradesChartsView extends ActivatableViewAndModel { private static final int SHOW_ALL = 0; diff --git a/desktop/src/main/java/haveno/desktop/main/offer/BuyOfferView.java b/desktop/src/main/java/haveno/desktop/main/offer/BuyOfferView.java index 59f0399394..5ae1de3268 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/BuyOfferView.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/BuyOfferView.java @@ -17,7 +17,6 @@ package haveno.desktop.main.offer; -import com.google.inject.Inject; import haveno.core.offer.OfferDirection; import haveno.core.user.Preferences; import haveno.core.user.User; @@ -26,6 +25,8 @@ import haveno.desktop.common.view.FxmlView; import haveno.desktop.common.view.ViewLoader; import haveno.network.p2p.P2PService; +import javax.inject.Inject; + @FxmlView public class BuyOfferView extends OfferView { diff --git a/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferDataModel.java b/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferDataModel.java index 825b3db5cb..bc758b6e01 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferDataModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferDataModel.java @@ -17,9 +17,7 @@ package haveno.desktop.main.offer; -import static com.google.common.base.Preconditions.checkNotNull; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.handlers.ErrorMessageHandler; import haveno.common.util.MathUtils; import haveno.common.util.Utilities; @@ -54,16 +52,6 @@ import haveno.desktop.Navigation; import haveno.desktop.util.DisplayUtils; import haveno.desktop.util.GUIUtil; import haveno.network.p2p.P2PService; -import java.math.BigInteger; -import java.util.Comparator; -import static java.util.Comparator.comparing; -import java.util.Date; -import java.util.HashSet; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Predicate; -import java.util.stream.Collectors; import javafx.beans.property.BooleanProperty; import javafx.beans.property.DoubleProperty; import javafx.beans.property.ObjectProperty; @@ -82,6 +70,20 @@ import javafx.collections.SetChangeListener; import lombok.Getter; import org.jetbrains.annotations.NotNull; +import javax.inject.Named; +import java.math.BigInteger; +import java.util.Comparator; +import java.util.Date; +import java.util.HashSet; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +import static com.google.common.base.Preconditions.checkNotNull; +import static java.util.Comparator.comparing; + public abstract class MutableOfferDataModel extends OfferDataModel { private final CreateOfferService createOfferService; protected final OpenOfferManager openOfferManager; diff --git a/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferViewModel.java b/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferViewModel.java index 8809c4d3aa..8a0b01e1b9 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferViewModel.java @@ -17,8 +17,6 @@ package haveno.desktop.main.offer; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.UserThread; import haveno.common.app.DevEnv; import haveno.common.util.MathUtils; @@ -49,10 +47,10 @@ import haveno.core.util.PriceUtil; import haveno.core.util.VolumeUtil; import haveno.core.util.coin.CoinFormatter; import haveno.core.util.coin.CoinUtil; +import haveno.core.util.validation.NonFiatPriceValidator; import haveno.core.util.validation.FiatPriceValidator; import haveno.core.util.validation.InputValidator; import haveno.core.util.validation.MonetaryValidator; -import haveno.core.util.validation.NonFiatPriceValidator; import haveno.core.xmr.wallet.Restrictions; import haveno.desktop.Navigation; import haveno.desktop.common.model.ActivatableWithDataModel; @@ -64,9 +62,6 @@ import haveno.desktop.main.settings.SettingsView; import haveno.desktop.main.settings.preferences.PreferencesView; import haveno.desktop.util.DisplayUtils; import haveno.desktop.util.GUIUtil; -import java.math.BigInteger; -import java.util.concurrent.TimeUnit; -import static javafx.beans.binding.Bindings.createStringBinding; import javafx.beans.property.BooleanProperty; import javafx.beans.property.IntegerProperty; import javafx.beans.property.ObjectProperty; @@ -83,6 +78,13 @@ import javafx.util.Callback; import lombok.extern.slf4j.Slf4j; import org.bitcoinj.core.Coin; +import javax.inject.Inject; +import javax.inject.Named; +import java.math.BigInteger; +import java.util.concurrent.TimeUnit; + +import static javafx.beans.binding.Bindings.createStringBinding; + @Slf4j public abstract class MutableOfferViewModel extends ActivatableWithDataModel { private final XmrValidator xmrValidator; diff --git a/desktop/src/main/java/haveno/desktop/main/offer/SellOfferView.java b/desktop/src/main/java/haveno/desktop/main/offer/SellOfferView.java index 22c33d2dab..144aee1cf8 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/SellOfferView.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/SellOfferView.java @@ -17,7 +17,6 @@ package haveno.desktop.main.offer; -import com.google.inject.Inject; import haveno.core.offer.OfferDirection; import haveno.core.user.Preferences; import haveno.core.user.User; @@ -26,6 +25,8 @@ import haveno.desktop.common.view.FxmlView; import haveno.desktop.common.view.ViewLoader; import haveno.network.p2p.P2PService; +import javax.inject.Inject; + @FxmlView public class SellOfferView extends OfferView { diff --git a/desktop/src/main/java/haveno/desktop/main/offer/createoffer/CreateOfferDataModel.java b/desktop/src/main/java/haveno/desktop/main/offer/createoffer/CreateOfferDataModel.java index 81669db644..3e54df3355 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/createoffer/CreateOfferDataModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/createoffer/CreateOfferDataModel.java @@ -18,7 +18,6 @@ package haveno.desktop.main.offer.createoffer; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.core.account.witness.AccountAgeWitnessService; import haveno.core.offer.CreateOfferService; import haveno.core.offer.OfferUtil; @@ -34,6 +33,8 @@ import haveno.core.xmr.wallet.XmrWalletService; import haveno.desktop.Navigation; import haveno.desktop.main.offer.MutableOfferDataModel; import haveno.network.p2p.P2PService; + +import javax.inject.Named; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; diff --git a/desktop/src/main/java/haveno/desktop/main/offer/createoffer/CreateOfferView.java b/desktop/src/main/java/haveno/desktop/main/offer/createoffer/CreateOfferView.java index ffc9eab50c..6dace11d42 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/createoffer/CreateOfferView.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/createoffer/CreateOfferView.java @@ -18,7 +18,6 @@ package haveno.desktop.main.offer.createoffer; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.core.locale.CurrencyUtil; import haveno.core.locale.TradeCurrency; import haveno.core.offer.OfferDirection; @@ -32,11 +31,13 @@ import haveno.desktop.main.offer.MutableOfferView; import haveno.desktop.main.offer.OfferView; import haveno.desktop.main.overlays.windows.OfferDetailsWindow; import haveno.desktop.util.GUIUtil; -import java.util.Objects; -import java.util.stream.Collectors; import javafx.collections.FXCollections; import javafx.collections.ObservableList; +import javax.inject.Named; +import java.util.Objects; +import java.util.stream.Collectors; + @FxmlView public class CreateOfferView extends MutableOfferView { diff --git a/desktop/src/main/java/haveno/desktop/main/offer/createoffer/CreateOfferViewModel.java b/desktop/src/main/java/haveno/desktop/main/offer/createoffer/CreateOfferViewModel.java index 1a6936d3a7..00b9d678ff 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/createoffer/CreateOfferViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/createoffer/CreateOfferViewModel.java @@ -18,7 +18,6 @@ package haveno.desktop.main.offer.createoffer; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.core.account.witness.AccountAgeWitnessService; import haveno.core.offer.OfferUtil; import haveno.core.payment.validation.FiatVolumeValidator; @@ -28,12 +27,14 @@ import haveno.core.provider.price.PriceFeedService; import haveno.core.user.Preferences; import haveno.core.util.FormattingUtils; import haveno.core.util.coin.CoinFormatter; -import haveno.core.util.validation.FiatPriceValidator; import haveno.core.util.validation.NonFiatPriceValidator; +import haveno.core.util.validation.FiatPriceValidator; import haveno.desktop.Navigation; import haveno.desktop.common.model.ViewModel; import haveno.desktop.main.offer.MutableOfferViewModel; +import javax.inject.Named; + class CreateOfferViewModel extends MutableOfferViewModel implements ViewModel { @Inject diff --git a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBook.java b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBook.java index 72183c9bae..a058939a51 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBook.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBook.java @@ -17,23 +17,25 @@ package haveno.desktop.main.offer.offerbook; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.core.filter.FilterManager; import haveno.core.offer.Offer; import haveno.core.offer.OfferBookService; -import static haveno.core.offer.OfferDirection.BUY; import haveno.core.offer.OfferRestrictions; import haveno.network.p2p.storage.P2PDataStorage; import haveno.network.utils.Utils; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import lombok.extern.slf4j.Slf4j; + +import static haveno.core.offer.OfferDirection.BUY; /** * Holds and manages the unsorted and unfiltered offerbook list (except for banned offers) of both buy and sell offers. diff --git a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OtherOfferBookView.java b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OtherOfferBookView.java index dbdab352a1..e6537cfd71 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OtherOfferBookView.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OtherOfferBookView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.offer.offerbook; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.core.account.sign.SignedWitnessService; import haveno.core.account.witness.AccountAgeWitnessService; @@ -32,6 +30,9 @@ import haveno.desktop.common.view.FxmlView; import haveno.desktop.main.overlays.windows.OfferDetailsWindow; import javafx.scene.layout.GridPane; +import javax.inject.Inject; +import javax.inject.Named; + @FxmlView public class OtherOfferBookView extends OfferBookView { diff --git a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OtherOfferBookViewModel.java b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OtherOfferBookViewModel.java index 071c340db2..c6fc412aa2 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OtherOfferBookViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OtherOfferBookViewModel.java @@ -18,7 +18,6 @@ package haveno.desktop.main.offer.offerbook; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.core.account.witness.AccountAgeWitnessService; import haveno.core.api.CoreApi; import haveno.core.locale.CryptoCurrency; @@ -43,13 +42,15 @@ import haveno.desktop.Navigation; import haveno.desktop.main.offer.OfferViewUtil; import haveno.desktop.util.GUIUtil; import haveno.network.p2p.P2PService; -import java.util.List; -import java.util.function.Predicate; -import java.util.stream.Collectors; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import org.jetbrains.annotations.NotNull; +import javax.inject.Named; +import java.util.List; +import java.util.function.Predicate; +import java.util.stream.Collectors; + public class OtherOfferBookViewModel extends OfferBookViewModel { @Inject diff --git a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/TopCryptoOfferBookView.java b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/TopCryptoOfferBookView.java index f6f3ff2362..b04f04101d 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/TopCryptoOfferBookView.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/TopCryptoOfferBookView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.offer.offerbook; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.core.account.sign.SignedWitnessService; import haveno.core.account.witness.AccountAgeWitnessService; @@ -32,6 +30,9 @@ import haveno.desktop.common.view.FxmlView; import haveno.desktop.main.overlays.windows.OfferDetailsWindow; import javafx.scene.layout.GridPane; +import javax.inject.Inject; +import javax.inject.Named; + @FxmlView public class TopCryptoOfferBookView extends OfferBookView { diff --git a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/TopCryptoOfferBookViewModel.java b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/TopCryptoOfferBookViewModel.java index 14a7e07c01..8ce52b69ee 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/TopCryptoOfferBookViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/TopCryptoOfferBookViewModel.java @@ -18,7 +18,6 @@ package haveno.desktop.main.offer.offerbook; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.core.account.witness.AccountAgeWitnessService; import haveno.core.api.CoreApi; import haveno.core.locale.TradeCurrency; @@ -38,11 +37,13 @@ import haveno.core.xmr.setup.WalletsSetup; import haveno.desktop.Navigation; import haveno.desktop.util.GUIUtil; import haveno.network.p2p.P2PService; -import java.util.function.Predicate; -import java.util.stream.Collectors; import javafx.collections.FXCollections; import javafx.collections.ObservableList; +import javax.inject.Named; +import java.util.function.Predicate; +import java.util.stream.Collectors; + public class TopCryptoOfferBookViewModel extends OfferBookViewModel { public static TradeCurrency TOP_CRYPTO = GUIUtil.TOP_CRYPTO; diff --git a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/XmrOfferBookView.java b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/XmrOfferBookView.java index 61e2846bd9..697431d5d9 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/XmrOfferBookView.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/XmrOfferBookView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.offer.offerbook; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.core.account.sign.SignedWitnessService; import haveno.core.account.witness.AccountAgeWitnessService; @@ -32,6 +30,9 @@ import haveno.desktop.common.view.FxmlView; import haveno.desktop.main.overlays.windows.OfferDetailsWindow; import javafx.scene.layout.GridPane; +import javax.inject.Inject; +import javax.inject.Named; + @FxmlView public class XmrOfferBookView extends OfferBookView { diff --git a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/XmrOfferBookViewModel.java b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/XmrOfferBookViewModel.java index 5555c9308a..afa2a9d668 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/XmrOfferBookViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/XmrOfferBookViewModel.java @@ -18,7 +18,6 @@ package haveno.desktop.main.offer.offerbook; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.core.account.witness.AccountAgeWitnessService; import haveno.core.api.CoreApi; import haveno.core.locale.CryptoCurrency; @@ -43,11 +42,13 @@ import haveno.core.xmr.setup.WalletsSetup; import haveno.desktop.Navigation; import haveno.desktop.util.GUIUtil; import haveno.network.p2p.P2PService; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; + +import javax.inject.Named; import java.util.List; import java.util.function.Predicate; import java.util.stream.Collectors; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; public class XmrOfferBookViewModel extends OfferBookViewModel { diff --git a/desktop/src/main/java/haveno/desktop/main/offer/signedoffer/SignedOfferView.java b/desktop/src/main/java/haveno/desktop/main/offer/signedoffer/SignedOfferView.java index 1d3e750bd4..dfbde8df65 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/signedoffer/SignedOfferView.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/signedoffer/SignedOfferView.java @@ -17,7 +17,38 @@ package haveno.desktop.main.offer.signedoffer; -import com.google.inject.Inject; +import javax.inject.Inject; + +import javafx.fxml.FXML; + +import javafx.scene.control.ContextMenu; +import javafx.scene.control.Label; +import javafx.scene.control.MenuItem; +import javafx.scene.control.TableCell; +import javafx.scene.control.TableColumn; +import javafx.scene.control.TableRow; +import javafx.scene.control.TableView; +import javafx.scene.control.Tooltip; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Priority; +import javafx.scene.layout.Region; +import javafx.scene.layout.VBox; + +import javafx.geometry.Insets; + +import javafx.beans.property.ReadOnlyObjectWrapper; + +import javafx.collections.transformation.FilteredList; +import javafx.collections.transformation.SortedList; + +import javafx.util.Callback; +import javafx.util.Duration; + +import java.util.Comparator; +import java.util.Date; + + + import haveno.common.util.Utilities; import haveno.core.locale.Res; import haveno.core.offer.SignedOffer; @@ -34,27 +65,6 @@ import haveno.desktop.main.offer.OfferViewUtil; import haveno.desktop.main.overlays.popups.Popup; import haveno.desktop.util.DisplayUtils; import haveno.desktop.util.GUIUtil; -import java.util.Comparator; -import java.util.Date; -import javafx.beans.property.ReadOnlyObjectWrapper; -import javafx.collections.transformation.FilteredList; -import javafx.collections.transformation.SortedList; -import javafx.fxml.FXML; -import javafx.geometry.Insets; -import javafx.scene.control.ContextMenu; -import javafx.scene.control.Label; -import javafx.scene.control.MenuItem; -import javafx.scene.control.TableCell; -import javafx.scene.control.TableColumn; -import javafx.scene.control.TableRow; -import javafx.scene.control.TableView; -import javafx.scene.control.Tooltip; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Priority; -import javafx.scene.layout.Region; -import javafx.scene.layout.VBox; -import javafx.util.Callback; -import javafx.util.Duration; @FxmlView public class SignedOfferView extends ActivatableViewAndModel { diff --git a/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferView.java b/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferView.java index 5bbf4f9206..db6c39d854 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferView.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.offer.takeoffer; -import com.google.inject.Inject; -import com.google.inject.name.Named; import com.jfoenix.controls.JFXTextField; import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon; import haveno.common.UserThread; @@ -56,7 +54,6 @@ import haveno.desktop.main.offer.ClosableView; import haveno.desktop.main.offer.InitializableViewWithTakeOfferData; import haveno.desktop.main.offer.OfferView; import haveno.desktop.main.offer.OfferViewUtil; -import static haveno.desktop.main.offer.OfferViewUtil.addPayInfoEntry; import haveno.desktop.main.offer.SelectableView; import haveno.desktop.main.overlays.notifications.Notification; import haveno.desktop.main.overlays.popups.Popup; @@ -65,27 +62,9 @@ import haveno.desktop.main.overlays.windows.OfferDetailsWindow; import haveno.desktop.main.overlays.windows.QRCodeWindow; import haveno.desktop.main.portfolio.PortfolioView; import haveno.desktop.main.portfolio.pendingtrades.PendingTradesView; -import static haveno.desktop.util.FormBuilder.add2ButtonsWithBox; -import static haveno.desktop.util.FormBuilder.addAddressTextField; -import static haveno.desktop.util.FormBuilder.addBalanceTextField; -import static haveno.desktop.util.FormBuilder.addComboBoxTopLabelTextField; -import static haveno.desktop.util.FormBuilder.addFundsTextfield; -import static haveno.desktop.util.FormBuilder.addTitledGroupBg; -import static haveno.desktop.util.FormBuilder.getEditableValueBox; -import static haveno.desktop.util.FormBuilder.getIconForLabel; -import static haveno.desktop.util.FormBuilder.getNonEditableValueBox; -import static haveno.desktop.util.FormBuilder.getNonEditableValueBoxWithInfo; -import static haveno.desktop.util.FormBuilder.getSmallIconForLabel; -import static haveno.desktop.util.FormBuilder.getTopLabelWithVBox; import haveno.desktop.util.GUIUtil; import haveno.desktop.util.Layout; import haveno.desktop.util.Transitions; -import java.io.ByteArrayInputStream; -import java.math.BigInteger; -import java.net.URI; -import java.util.HashMap; -import java.util.concurrent.TimeUnit; -import static javafx.beans.binding.Bindings.createStringBinding; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.value.ChangeListener; import javafx.geometry.HPos; @@ -114,6 +93,29 @@ import org.fxmisc.easybind.EasyBind; import org.fxmisc.easybind.Subscription; import org.jetbrains.annotations.NotNull; +import javax.inject.Inject; +import javax.inject.Named; +import java.io.ByteArrayInputStream; +import java.math.BigInteger; +import java.net.URI; +import java.util.HashMap; +import java.util.concurrent.TimeUnit; + +import static haveno.desktop.main.offer.OfferViewUtil.addPayInfoEntry; +import static haveno.desktop.util.FormBuilder.add2ButtonsWithBox; +import static haveno.desktop.util.FormBuilder.addAddressTextField; +import static haveno.desktop.util.FormBuilder.addBalanceTextField; +import static haveno.desktop.util.FormBuilder.addComboBoxTopLabelTextField; +import static haveno.desktop.util.FormBuilder.addFundsTextfield; +import static haveno.desktop.util.FormBuilder.addTitledGroupBg; +import static haveno.desktop.util.FormBuilder.getEditableValueBox; +import static haveno.desktop.util.FormBuilder.getIconForLabel; +import static haveno.desktop.util.FormBuilder.getNonEditableValueBox; +import static haveno.desktop.util.FormBuilder.getNonEditableValueBoxWithInfo; +import static haveno.desktop.util.FormBuilder.getSmallIconForLabel; +import static haveno.desktop.util.FormBuilder.getTopLabelWithVBox; +import static javafx.beans.binding.Bindings.createStringBinding; + @FxmlView public class TakeOfferView extends ActivatableViewAndModel implements ClosableView, InitializableViewWithTakeOfferData, SelectableView { private final Navigation navigation; diff --git a/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferViewModel.java b/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferViewModel.java index eb8dfe1889..6063d4599c 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferViewModel.java @@ -17,9 +17,6 @@ package haveno.desktop.main.offer.takeoffer; -import static com.google.common.base.Preconditions.checkNotNull; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.UserThread; import haveno.core.account.witness.AccountAgeWitnessService; import haveno.core.locale.Res; @@ -53,8 +50,6 @@ import haveno.network.p2p.P2PService; import haveno.network.p2p.network.CloseConnectionReason; import haveno.network.p2p.network.Connection; import haveno.network.p2p.network.ConnectionListener; -import java.math.BigInteger; -import static javafx.beans.binding.Bindings.createStringBinding; import javafx.beans.property.BooleanProperty; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleBooleanProperty; @@ -67,7 +62,14 @@ import javafx.scene.control.ComboBox; import javafx.scene.control.ListCell; import javafx.scene.control.ListView; import javafx.util.Callback; + import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Named; +import java.math.BigInteger; + +import static com.google.common.base.Preconditions.checkNotNull; +import static javafx.beans.binding.Bindings.createStringBinding; class TakeOfferViewModel extends ActivatableWithDataModel implements ViewModel { final TakeOfferDataModel dataModel; @@ -590,7 +592,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel im && !isAmountEqualMinAmount(amount) && !isAmountEqualMaxAmount(amount)) { // We only apply the rounding if the amount is variable (minAmount is lower as amount). // Otherwise we could get an amount lower then the minAmount set by rounding - amount = dataModel.getOffer().isFiatOffer() ? + amount = dataModel.getOffer().isFiatOffer() ? CoinUtil.getRoundedFiatAmount(amount, price, maxTradeLimit) : CoinUtil.getRoundedTraditionalAmount(amount, price, maxTradeLimit); } diff --git a/desktop/src/main/java/haveno/desktop/main/overlays/notifications/NotificationCenter.java b/desktop/src/main/java/haveno/desktop/main/overlays/notifications/NotificationCenter.java index 33d2600522..81c81dfc44 100644 --- a/desktop/src/main/java/haveno/desktop/main/overlays/notifications/NotificationCenter.java +++ b/desktop/src/main/java/haveno/desktop/main/overlays/notifications/NotificationCenter.java @@ -18,7 +18,6 @@ package haveno.desktop.main.overlays.notifications; import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.UserThread; import haveno.core.api.NotificationListener; import haveno.core.locale.Res; @@ -46,17 +45,19 @@ import haveno.desktop.main.support.dispute.client.mediation.MediationClientView; import haveno.desktop.main.support.dispute.client.refund.RefundClientView; import haveno.proto.grpc.NotificationMessage; import haveno.proto.grpc.NotificationMessage.NotificationType; +import javafx.collections.ListChangeListener; +import lombok.NonNull; +import lombok.extern.slf4j.Slf4j; +import org.fxmisc.easybind.EasyBind; +import org.fxmisc.easybind.Subscription; + +import javax.annotation.Nullable; +import javax.inject.Singleton; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Consumer; -import javafx.collections.ListChangeListener; -import javax.annotation.Nullable; -import lombok.NonNull; -import lombok.extern.slf4j.Slf4j; -import org.fxmisc.easybind.EasyBind; -import org.fxmisc.easybind.Subscription; @Slf4j @Singleton diff --git a/desktop/src/main/java/haveno/desktop/main/overlays/windows/ClosedTradesSummaryWindow.java b/desktop/src/main/java/haveno/desktop/main/overlays/windows/ClosedTradesSummaryWindow.java index 3bf047563e..de49b4e1e0 100644 --- a/desktop/src/main/java/haveno/desktop/main/overlays/windows/ClosedTradesSummaryWindow.java +++ b/desktop/src/main/java/haveno/desktop/main/overlays/windows/ClosedTradesSummaryWindow.java @@ -17,16 +17,18 @@ package haveno.desktop.main.overlays.windows; -import com.google.inject.Inject; import haveno.core.locale.Res; import haveno.desktop.main.overlays.Overlay; import haveno.desktop.main.portfolio.closedtrades.ClosedTradesViewModel; -import static haveno.desktop.util.FormBuilder.addConfirmationLabelLabel; -import static haveno.desktop.util.FormBuilder.addTitledGroupBg; import haveno.desktop.util.Layout; +import javafx.geometry.Insets; + +import javax.inject.Inject; import java.math.BigInteger; import java.util.Map; -import javafx.geometry.Insets; + +import static haveno.desktop.util.FormBuilder.addConfirmationLabelLabel; +import static haveno.desktop.util.FormBuilder.addTitledGroupBg; public class ClosedTradesSummaryWindow extends Overlay { private final ClosedTradesViewModel model; diff --git a/desktop/src/main/java/haveno/desktop/main/overlays/windows/ContractWindow.java b/desktop/src/main/java/haveno/desktop/main/overlays/windows/ContractWindow.java index 70b82d8e3a..51093841b5 100644 --- a/desktop/src/main/java/haveno/desktop/main/overlays/windows/ContractWindow.java +++ b/desktop/src/main/java/haveno/desktop/main/overlays/windows/ContractWindow.java @@ -18,7 +18,6 @@ package haveno.desktop.main.overlays.windows; import com.google.common.base.Joiner; -import com.google.inject.Inject; import haveno.common.UserThread; import haveno.core.account.witness.AccountAgeWitnessService; import haveno.core.locale.CountryUtil; @@ -39,17 +38,8 @@ import haveno.desktop.components.HavenoTextArea; import haveno.desktop.main.MainView; import haveno.desktop.main.overlays.Overlay; import haveno.desktop.util.DisplayUtils; -import static haveno.desktop.util.DisplayUtils.getAccountWitnessDescription; -import static haveno.desktop.util.FormBuilder.addButtonAfterGroup; -import static haveno.desktop.util.FormBuilder.addConfirmationLabelButton; -import static haveno.desktop.util.FormBuilder.addConfirmationLabelTextField; -import static haveno.desktop.util.FormBuilder.addConfirmationLabelTextFieldWithCopyIcon; -import static haveno.desktop.util.FormBuilder.addLabelExplorerAddressTextField; -import static haveno.desktop.util.FormBuilder.addLabelTxIdTextField; -import static haveno.desktop.util.FormBuilder.addTitledGroupBg; import haveno.desktop.util.Layout; import haveno.network.p2p.NodeAddress; -import java.util.List; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Button; @@ -64,6 +54,18 @@ import javafx.stage.Window; import lombok.extern.slf4j.Slf4j; import org.bitcoinj.core.Utils; +import javax.inject.Inject; +import java.util.List; + +import static haveno.desktop.util.DisplayUtils.getAccountWitnessDescription; +import static haveno.desktop.util.FormBuilder.addButtonAfterGroup; +import static haveno.desktop.util.FormBuilder.addConfirmationLabelButton; +import static haveno.desktop.util.FormBuilder.addConfirmationLabelTextField; +import static haveno.desktop.util.FormBuilder.addConfirmationLabelTextFieldWithCopyIcon; +import static haveno.desktop.util.FormBuilder.addLabelExplorerAddressTextField; +import static haveno.desktop.util.FormBuilder.addLabelTxIdTextField; +import static haveno.desktop.util.FormBuilder.addTitledGroupBg; + @Slf4j public class ContractWindow extends Overlay { private final ArbitrationManager arbitrationManager; diff --git a/desktop/src/main/java/haveno/desktop/main/overlays/windows/FilterWindow.java b/desktop/src/main/java/haveno/desktop/main/overlays/windows/FilterWindow.java index 04bdf223a4..57cad82c6b 100644 --- a/desktop/src/main/java/haveno/desktop/main/overlays/windows/FilterWindow.java +++ b/desktop/src/main/java/haveno/desktop/main/overlays/windows/FilterWindow.java @@ -18,7 +18,6 @@ package haveno.desktop.main.overlays.windows; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.UserThread; import haveno.common.app.DevEnv; import haveno.common.config.Config; @@ -30,14 +29,6 @@ import haveno.desktop.components.AutoTooltipButton; import haveno.desktop.components.InputTextField; import haveno.desktop.main.overlays.Overlay; import haveno.desktop.main.overlays.popups.Popup; -import static haveno.desktop.util.FormBuilder.addInputTextField; -import static haveno.desktop.util.FormBuilder.addLabelCheckBox; -import static haveno.desktop.util.FormBuilder.addTopLabelInputTextField; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.stream.Collectors; import javafx.collections.FXCollections; import javafx.geometry.HPos; import javafx.geometry.Insets; @@ -51,6 +42,17 @@ import javafx.scene.layout.HBox; import javafx.scene.layout.Region; import org.apache.commons.lang3.StringUtils; +import javax.inject.Named; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.stream.Collectors; + +import static haveno.desktop.util.FormBuilder.addInputTextField; +import static haveno.desktop.util.FormBuilder.addLabelCheckBox; +import static haveno.desktop.util.FormBuilder.addTopLabelInputTextField; + public class FilterWindow extends Overlay { private final FilterManager filterManager; private final boolean useDevPrivilegeKeys; diff --git a/desktop/src/main/java/haveno/desktop/main/overlays/windows/OfferDetailsWindow.java b/desktop/src/main/java/haveno/desktop/main/overlays/windows/OfferDetailsWindow.java index 75f87aa351..6d5f217718 100644 --- a/desktop/src/main/java/haveno/desktop/main/overlays/windows/OfferDetailsWindow.java +++ b/desktop/src/main/java/haveno/desktop/main/overlays/windows/OfferDetailsWindow.java @@ -18,8 +18,7 @@ package haveno.desktop.main.overlays.windows; import com.google.common.base.Joiner; -import com.google.inject.Inject; -import com.google.inject.name.Named; + import haveno.common.UserThread; import haveno.common.crypto.KeyRing; import haveno.common.util.Tuple2; @@ -43,17 +42,8 @@ import haveno.desktop.components.AutoTooltipButton; import haveno.desktop.components.BusyAnimation; import haveno.desktop.main.overlays.Overlay; import haveno.desktop.util.DisplayUtils; -import static haveno.desktop.util.FormBuilder.addButtonAfterGroup; -import static haveno.desktop.util.FormBuilder.addButtonBusyAnimationLabelAfterGroup; -import static haveno.desktop.util.FormBuilder.addConfirmationLabelLabel; -import static haveno.desktop.util.FormBuilder.addConfirmationLabelTextArea; -import static haveno.desktop.util.FormBuilder.addConfirmationLabelTextFieldWithCopyIcon; -import static haveno.desktop.util.FormBuilder.addTitledGroupBg; import haveno.desktop.util.GUIUtil; import haveno.desktop.util.Layout; -import java.math.BigInteger; -import java.util.List; -import java.util.Optional; import javafx.geometry.HPos; import javafx.geometry.Insets; import javafx.scene.control.Button; @@ -68,6 +58,19 @@ import org.fxmisc.easybind.Subscription; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.inject.Inject; +import javax.inject.Named; +import java.math.BigInteger; +import java.util.List; +import java.util.Optional; + +import static haveno.desktop.util.FormBuilder.addButtonAfterGroup; +import static haveno.desktop.util.FormBuilder.addButtonBusyAnimationLabelAfterGroup; +import static haveno.desktop.util.FormBuilder.addConfirmationLabelLabel; +import static haveno.desktop.util.FormBuilder.addConfirmationLabelTextArea; +import static haveno.desktop.util.FormBuilder.addConfirmationLabelTextFieldWithCopyIcon; +import static haveno.desktop.util.FormBuilder.addTitledGroupBg; + public class OfferDetailsWindow extends Overlay { protected static final Logger log = LoggerFactory.getLogger(OfferDetailsWindow.class); diff --git a/desktop/src/main/java/haveno/desktop/main/overlays/windows/SelectDepositTxWindow.java b/desktop/src/main/java/haveno/desktop/main/overlays/windows/SelectDepositTxWindow.java index 09870356bd..4a7cac56ce 100644 --- a/desktop/src/main/java/haveno/desktop/main/overlays/windows/SelectDepositTxWindow.java +++ b/desktop/src/main/java/haveno/desktop/main/overlays/windows/SelectDepositTxWindow.java @@ -17,14 +17,9 @@ package haveno.desktop.main.overlays.windows; -import com.google.inject.Inject; import haveno.core.locale.Res; import haveno.desktop.main.overlays.Overlay; import haveno.desktop.util.FormBuilder; -import static haveno.desktop.util.FormBuilder.addMultilineLabel; -import java.util.List; -import java.util.Optional; -import java.util.function.Consumer; import javafx.collections.FXCollections; import javafx.geometry.Insets; import javafx.scene.control.ComboBox; @@ -33,6 +28,13 @@ import javafx.scene.layout.GridPane; import javafx.util.StringConverter; import org.bitcoinj.core.Transaction; +import javax.inject.Inject; +import java.util.List; +import java.util.Optional; +import java.util.function.Consumer; + +import static haveno.desktop.util.FormBuilder.addMultilineLabel; + //TODO might be removed, but leave it for now until sure we will not use it anymore. public class SelectDepositTxWindow extends Overlay { private ComboBox transactionsComboBox; diff --git a/desktop/src/main/java/haveno/desktop/main/overlays/windows/SendAlertMessageWindow.java b/desktop/src/main/java/haveno/desktop/main/overlays/windows/SendAlertMessageWindow.java index 9e6c661f40..ca8ce6fcfc 100644 --- a/desktop/src/main/java/haveno/desktop/main/overlays/windows/SendAlertMessageWindow.java +++ b/desktop/src/main/java/haveno/desktop/main/overlays/windows/SendAlertMessageWindow.java @@ -18,7 +18,6 @@ package haveno.desktop.main.overlays.windows; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.app.DevEnv; import haveno.common.config.Config; import haveno.common.util.Tuple2; @@ -30,10 +29,6 @@ import haveno.desktop.components.InputTextField; import haveno.desktop.main.overlays.Overlay; import haveno.desktop.main.overlays.popups.Popup; import haveno.desktop.util.FormBuilder; -import static haveno.desktop.util.FormBuilder.addInputTextField; -import static haveno.desktop.util.FormBuilder.addLabelCheckBox; -import static haveno.desktop.util.FormBuilder.addRadioButton; -import static haveno.desktop.util.FormBuilder.addTopLabelTextArea; import javafx.geometry.HPos; import javafx.geometry.Insets; import javafx.scene.Scene; @@ -47,6 +42,13 @@ import javafx.scene.input.KeyCode; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; +import javax.inject.Named; + +import static haveno.desktop.util.FormBuilder.addInputTextField; +import static haveno.desktop.util.FormBuilder.addLabelCheckBox; +import static haveno.desktop.util.FormBuilder.addRadioButton; +import static haveno.desktop.util.FormBuilder.addTopLabelTextArea; + public class SendAlertMessageWindow extends Overlay { private final AlertManager alertManager; private final boolean useDevPrivilegeKeys; diff --git a/desktop/src/main/java/haveno/desktop/main/overlays/windows/SignPaymentAccountsWindow.java b/desktop/src/main/java/haveno/desktop/main/overlays/windows/SignPaymentAccountsWindow.java index 0fa83e3320..798414900e 100644 --- a/desktop/src/main/java/haveno/desktop/main/overlays/windows/SignPaymentAccountsWindow.java +++ b/desktop/src/main/java/haveno/desktop/main/overlays/windows/SignPaymentAccountsWindow.java @@ -17,8 +17,6 @@ package haveno.desktop.main.overlays.windows; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.common.util.Tuple2; import haveno.common.util.Tuple3; @@ -36,22 +34,6 @@ import haveno.desktop.components.AutoTooltipButton; import haveno.desktop.components.InputTextField; import haveno.desktop.main.overlays.Overlay; import haveno.desktop.main.overlays.popups.Popup; -import static haveno.desktop.util.FormBuilder.add2ButtonsAfterGroup; -import static haveno.desktop.util.FormBuilder.addComboBox; -import static haveno.desktop.util.FormBuilder.addInputTextField; -import static haveno.desktop.util.FormBuilder.addLabelCheckBox; -import static haveno.desktop.util.FormBuilder.addMultilineLabel; -import static haveno.desktop.util.FormBuilder.addTopLabelDatePicker; -import static haveno.desktop.util.FormBuilder.addTopLabelListView; -import static haveno.desktop.util.FormBuilder.removeRowsFromGridPane; -import java.time.Instant; -import java.time.ZoneId; -import java.time.ZoneOffset; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.stream.Collectors; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.geometry.HPos; @@ -72,6 +54,26 @@ import lombok.extern.slf4j.Slf4j; import org.bitcoinj.core.ECKey; import org.bitcoinj.core.Utils; +import javax.inject.Inject; +import javax.inject.Named; +import java.time.Instant; +import java.time.ZoneId; +import java.time.ZoneOffset; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +import static haveno.desktop.util.FormBuilder.add2ButtonsAfterGroup; +import static haveno.desktop.util.FormBuilder.addComboBox; +import static haveno.desktop.util.FormBuilder.addInputTextField; +import static haveno.desktop.util.FormBuilder.addLabelCheckBox; +import static haveno.desktop.util.FormBuilder.addMultilineLabel; +import static haveno.desktop.util.FormBuilder.addTopLabelDatePicker; +import static haveno.desktop.util.FormBuilder.addTopLabelListView; +import static haveno.desktop.util.FormBuilder.removeRowsFromGridPane; + @Slf4j public class SignPaymentAccountsWindow extends Overlay { diff --git a/desktop/src/main/java/haveno/desktop/main/overlays/windows/SignSpecificWitnessWindow.java b/desktop/src/main/java/haveno/desktop/main/overlays/windows/SignSpecificWitnessWindow.java index 959f619d0f..880494b84f 100644 --- a/desktop/src/main/java/haveno/desktop/main/overlays/windows/SignSpecificWitnessWindow.java +++ b/desktop/src/main/java/haveno/desktop/main/overlays/windows/SignSpecificWitnessWindow.java @@ -17,7 +17,6 @@ package haveno.desktop.main.overlays.windows; -import com.google.inject.Inject; import haveno.common.util.Tuple2; import haveno.common.util.Utilities; import haveno.core.account.witness.AccountAgeWitness; @@ -29,12 +28,6 @@ import haveno.desktop.components.HavenoTextArea; import haveno.desktop.components.InputTextField; import haveno.desktop.main.overlays.Overlay; import haveno.desktop.main.overlays.popups.Popup; -import static haveno.desktop.util.FormBuilder.add2ButtonsAfterGroup; -import static haveno.desktop.util.FormBuilder.addInputTextField; -import static haveno.desktop.util.FormBuilder.addMultilineLabel; -import static haveno.desktop.util.FormBuilder.addTopLabelTextField; -import static haveno.desktop.util.FormBuilder.removeRowsFromGridPane; -import java.util.Date; import javafx.geometry.VPos; import javafx.scene.control.TextArea; import javafx.scene.layout.GridPane; @@ -43,6 +36,15 @@ import lombok.extern.slf4j.Slf4j; import org.bitcoinj.core.ECKey; import org.bitcoinj.core.Utils; +import javax.inject.Inject; +import java.util.Date; + +import static haveno.desktop.util.FormBuilder.add2ButtonsAfterGroup; +import static haveno.desktop.util.FormBuilder.addInputTextField; +import static haveno.desktop.util.FormBuilder.addMultilineLabel; +import static haveno.desktop.util.FormBuilder.addTopLabelTextField; +import static haveno.desktop.util.FormBuilder.removeRowsFromGridPane; + @Slf4j public class SignSpecificWitnessWindow extends Overlay { diff --git a/desktop/src/main/java/haveno/desktop/main/overlays/windows/SignUnsignedPubKeysWindow.java b/desktop/src/main/java/haveno/desktop/main/overlays/windows/SignUnsignedPubKeysWindow.java index d3a9051128..c840a718ec 100644 --- a/desktop/src/main/java/haveno/desktop/main/overlays/windows/SignUnsignedPubKeysWindow.java +++ b/desktop/src/main/java/haveno/desktop/main/overlays/windows/SignUnsignedPubKeysWindow.java @@ -17,7 +17,6 @@ package haveno.desktop.main.overlays.windows; -import com.google.inject.Inject; import haveno.common.crypto.Hash; import haveno.common.util.Tuple3; import haveno.common.util.Utilities; @@ -29,12 +28,6 @@ import haveno.desktop.components.AutoTooltipButton; import haveno.desktop.components.InputTextField; import haveno.desktop.main.overlays.Overlay; import haveno.desktop.main.overlays.popups.Popup; -import static haveno.desktop.util.FormBuilder.add2ButtonsAfterGroup; -import static haveno.desktop.util.FormBuilder.addInputTextField; -import static haveno.desktop.util.FormBuilder.addTopLabelListView; -import static haveno.desktop.util.FormBuilder.removeRowsFromGridPane; -import java.util.ArrayList; -import java.util.List; import javafx.collections.FXCollections; import javafx.geometry.VPos; import javafx.scene.control.Label; @@ -47,6 +40,15 @@ import javafx.util.Callback; import lombok.extern.slf4j.Slf4j; import org.bitcoinj.core.Utils; +import javax.inject.Inject; +import java.util.ArrayList; +import java.util.List; + +import static haveno.desktop.util.FormBuilder.add2ButtonsAfterGroup; +import static haveno.desktop.util.FormBuilder.addInputTextField; +import static haveno.desktop.util.FormBuilder.addTopLabelListView; +import static haveno.desktop.util.FormBuilder.removeRowsFromGridPane; + @Slf4j public class SignUnsignedPubKeysWindow extends Overlay { diff --git a/desktop/src/main/java/haveno/desktop/main/overlays/windows/TorNetworkSettingsWindow.java b/desktop/src/main/java/haveno/desktop/main/overlays/windows/TorNetworkSettingsWindow.java index e3cc347581..1899041b3a 100644 --- a/desktop/src/main/java/haveno/desktop/main/overlays/windows/TorNetworkSettingsWindow.java +++ b/desktop/src/main/java/haveno/desktop/main/overlays/windows/TorNetworkSettingsWindow.java @@ -18,8 +18,6 @@ package haveno.desktop.main.overlays.windows; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.UserThread; import haveno.common.util.Tuple2; import haveno.common.util.Tuple4; @@ -32,19 +30,9 @@ import haveno.desktop.components.BusyAnimation; import haveno.desktop.components.TitledGroupBg; import haveno.desktop.main.overlays.Overlay; import haveno.desktop.main.overlays.popups.Popup; -import static haveno.desktop.util.FormBuilder.addButtonBusyAnimationLabelAfterGroup; -import static haveno.desktop.util.FormBuilder.addComboBox; -import static haveno.desktop.util.FormBuilder.addLabel; -import static haveno.desktop.util.FormBuilder.addRadioButton; -import static haveno.desktop.util.FormBuilder.addTitledGroupBg; -import static haveno.desktop.util.FormBuilder.addTopLabelTextArea; import haveno.desktop.util.Layout; import haveno.network.p2p.network.DefaultPluggableTransports; import haveno.network.p2p.network.NetworkNode; -import java.io.IOException; -import java.net.URI; -import java.util.Arrays; -import java.util.concurrent.TimeUnit; import javafx.collections.FXCollections; import javafx.geometry.HPos; import javafx.geometry.Insets; @@ -64,6 +52,20 @@ import javafx.scene.layout.Priority; import javafx.util.StringConverter; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import javax.inject.Singleton; +import java.io.IOException; +import java.net.URI; +import java.util.Arrays; +import java.util.concurrent.TimeUnit; + +import static haveno.desktop.util.FormBuilder.addButtonBusyAnimationLabelAfterGroup; +import static haveno.desktop.util.FormBuilder.addComboBox; +import static haveno.desktop.util.FormBuilder.addLabel; +import static haveno.desktop.util.FormBuilder.addRadioButton; +import static haveno.desktop.util.FormBuilder.addTitledGroupBg; +import static haveno.desktop.util.FormBuilder.addTopLabelTextArea; + @Slf4j @Singleton public class TorNetworkSettingsWindow extends Overlay { diff --git a/desktop/src/main/java/haveno/desktop/main/overlays/windows/TradeDetailsWindow.java b/desktop/src/main/java/haveno/desktop/main/overlays/windows/TradeDetailsWindow.java index 41be6e6b03..0decace925 100644 --- a/desktop/src/main/java/haveno/desktop/main/overlays/windows/TradeDetailsWindow.java +++ b/desktop/src/main/java/haveno/desktop/main/overlays/windows/TradeDetailsWindow.java @@ -17,8 +17,6 @@ package haveno.desktop.main.overlays.windows; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.UserThread; import haveno.common.util.Tuple3; import haveno.common.util.Utilities; @@ -39,12 +37,6 @@ import haveno.desktop.components.HavenoTextArea; import haveno.desktop.main.MainView; import haveno.desktop.main.overlays.Overlay; import haveno.desktop.util.DisplayUtils; -import static haveno.desktop.util.DisplayUtils.getAccountWitnessDescription; -import static haveno.desktop.util.FormBuilder.add2ButtonsWithBox; -import static haveno.desktop.util.FormBuilder.addConfirmationLabelTextArea; -import static haveno.desktop.util.FormBuilder.addConfirmationLabelTextField; -import static haveno.desktop.util.FormBuilder.addLabelTxIdTextField; -import static haveno.desktop.util.FormBuilder.addTitledGroupBg; import haveno.desktop.util.Layout; import haveno.network.p2p.NodeAddress; import javafx.beans.property.IntegerProperty; @@ -67,6 +59,16 @@ import javafx.stage.Window; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.inject.Inject; +import javax.inject.Named; + +import static haveno.desktop.util.DisplayUtils.getAccountWitnessDescription; +import static haveno.desktop.util.FormBuilder.add2ButtonsWithBox; +import static haveno.desktop.util.FormBuilder.addConfirmationLabelTextArea; +import static haveno.desktop.util.FormBuilder.addConfirmationLabelTextField; +import static haveno.desktop.util.FormBuilder.addLabelTxIdTextField; +import static haveno.desktop.util.FormBuilder.addTitledGroupBg; + public class TradeDetailsWindow extends Overlay { protected static final Logger log = LoggerFactory.getLogger(TradeDetailsWindow.class); diff --git a/desktop/src/main/java/haveno/desktop/main/overlays/windows/WalletPasswordWindow.java b/desktop/src/main/java/haveno/desktop/main/overlays/windows/WalletPasswordWindow.java index 77a327580a..9a0d65ddf3 100644 --- a/desktop/src/main/java/haveno/desktop/main/overlays/windows/WalletPasswordWindow.java +++ b/desktop/src/main/java/haveno/desktop/main/overlays/windows/WalletPasswordWindow.java @@ -17,10 +17,7 @@ package haveno.desktop.main.overlays.windows; -import static com.google.common.base.Preconditions.checkArgument; import com.google.common.base.Splitter; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.common.crypto.IncorrectPasswordException; import haveno.common.util.Tuple2; @@ -35,18 +32,7 @@ import haveno.desktop.components.PasswordTextField; import haveno.desktop.main.SharedPresentation; import haveno.desktop.main.overlays.Overlay; import haveno.desktop.main.overlays.popups.Popup; -import static haveno.desktop.util.FormBuilder.addPasswordTextField; -import static haveno.desktop.util.FormBuilder.addPrimaryActionButton; -import static haveno.desktop.util.FormBuilder.addTextArea; -import static haveno.desktop.util.FormBuilder.addTopLabelDatePicker; import haveno.desktop.util.Layout; -import java.io.File; -import java.io.IOException; -import java.time.Instant; -import java.time.LocalDate; -import java.time.ZoneId; -import java.time.ZoneOffset; -import static javafx.beans.binding.Bindings.createBooleanBinding; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.value.ChangeListener; @@ -68,6 +54,22 @@ import org.bitcoinj.crypto.MnemonicCode; import org.bitcoinj.crypto.MnemonicException; import org.bitcoinj.wallet.DeterministicSeed; +import javax.inject.Inject; +import javax.inject.Named; +import java.io.File; +import java.io.IOException; +import java.time.Instant; +import java.time.LocalDate; +import java.time.ZoneId; +import java.time.ZoneOffset; + +import static com.google.common.base.Preconditions.checkArgument; +import static haveno.desktop.util.FormBuilder.addPasswordTextField; +import static haveno.desktop.util.FormBuilder.addPrimaryActionButton; +import static haveno.desktop.util.FormBuilder.addTextArea; +import static haveno.desktop.util.FormBuilder.addTopLabelDatePicker; +import static javafx.beans.binding.Bindings.createBooleanBinding; + @Slf4j public class WalletPasswordWindow extends Overlay { private final CoreAccountService accountService; diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/PortfolioView.java b/desktop/src/main/java/haveno/desktop/main/portfolio/PortfolioView.java index 84c353e756..982f3e787c 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/PortfolioView.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/PortfolioView.java @@ -17,7 +17,6 @@ package haveno.desktop.main.portfolio; -import com.google.inject.Inject; import haveno.core.locale.Res; import haveno.core.offer.OfferPayload; import haveno.core.offer.OpenOffer; @@ -35,13 +34,15 @@ import haveno.desktop.main.portfolio.editoffer.EditOfferView; import haveno.desktop.main.portfolio.failedtrades.FailedTradesView; import haveno.desktop.main.portfolio.openoffer.OpenOffersView; import haveno.desktop.main.portfolio.pendingtrades.PendingTradesView; -import java.util.List; import javafx.beans.value.ChangeListener; import javafx.collections.ListChangeListener; import javafx.fxml.FXML; import javafx.scene.control.Tab; import javafx.scene.control.TabPane; + import javax.annotation.Nullable; +import javax.inject.Inject; +import java.util.List; @FxmlView public class PortfolioView extends ActivatableView { diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/closedtrades/ClosedTradesView.java b/desktop/src/main/java/haveno/desktop/main/portfolio/closedtrades/ClosedTradesView.java index 5f2ff5b397..a43d677605 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/closedtrades/ClosedTradesView.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/closedtrades/ClosedTradesView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.portfolio.closedtrades; -import com.google.inject.Inject; -import com.google.inject.name.Named; import com.googlecode.jcsv.writer.CSVEntryConverter; import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon; import haveno.common.config.Config; @@ -45,11 +43,8 @@ import haveno.desktop.main.overlays.windows.ClosedTradesSummaryWindow; import haveno.desktop.main.overlays.windows.OfferDetailsWindow; import haveno.desktop.main.overlays.windows.TradeDetailsWindow; import haveno.desktop.main.portfolio.presentation.PortfolioUtil; -import static haveno.desktop.util.FormBuilder.getRegularIconButton; import haveno.desktop.util.GUIUtil; import haveno.network.p2p.NodeAddress; -import java.util.Comparator; -import java.util.function.Function; import javafx.beans.binding.Bindings; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.beans.value.ChangeListener; @@ -75,6 +70,13 @@ import javafx.scene.layout.VBox; import javafx.stage.Stage; import javafx.util.Callback; +import javax.inject.Inject; +import javax.inject.Named; +import java.util.Comparator; +import java.util.function.Function; + +import static haveno.desktop.util.FormBuilder.getRegularIconButton; + @FxmlView public class ClosedTradesView extends ActivatableViewAndModel { private final boolean useDevPrivilegeKeys; diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/duplicateoffer/DuplicateOfferDataModel.java b/desktop/src/main/java/haveno/desktop/main/portfolio/duplicateoffer/DuplicateOfferDataModel.java index 64a6c1bfd8..780667087f 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/duplicateoffer/DuplicateOfferDataModel.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/duplicateoffer/DuplicateOfferDataModel.java @@ -19,7 +19,6 @@ package haveno.desktop.main.portfolio.duplicateoffer; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.core.account.witness.AccountAgeWitnessService; import haveno.core.locale.CurrencyUtil; import haveno.core.locale.TradeCurrency; @@ -40,6 +39,8 @@ import haveno.core.xmr.wallet.XmrWalletService; import haveno.desktop.Navigation; import haveno.desktop.main.offer.MutableOfferDataModel; import haveno.network.p2p.P2PService; + +import javax.inject.Named; import java.math.BigInteger; import java.util.Objects; import java.util.Optional; diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/duplicateoffer/DuplicateOfferView.java b/desktop/src/main/java/haveno/desktop/main/portfolio/duplicateoffer/DuplicateOfferView.java index 2a9b58b920..b2c6a10f07 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/duplicateoffer/DuplicateOfferView.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/duplicateoffer/DuplicateOfferView.java @@ -18,7 +18,6 @@ package haveno.desktop.main.portfolio.duplicateoffer; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.core.locale.CurrencyUtil; import haveno.core.offer.OfferPayload; import haveno.core.payment.PaymentAccount; @@ -32,6 +31,8 @@ import haveno.desktop.main.overlays.windows.OfferDetailsWindow; import javafx.collections.ObservableList; import javafx.geometry.Insets; +import javax.inject.Named; + @FxmlView public class DuplicateOfferView extends MutableOfferView { diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/duplicateoffer/DuplicateOfferViewModel.java b/desktop/src/main/java/haveno/desktop/main/portfolio/duplicateoffer/DuplicateOfferViewModel.java index c9813b7333..a3a0f6fe8e 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/duplicateoffer/DuplicateOfferViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/duplicateoffer/DuplicateOfferViewModel.java @@ -18,7 +18,6 @@ package haveno.desktop.main.portfolio.duplicateoffer; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.core.account.witness.AccountAgeWitnessService; import haveno.core.offer.Offer; import haveno.core.offer.OfferPayload; @@ -30,12 +29,14 @@ import haveno.core.provider.price.PriceFeedService; import haveno.core.user.Preferences; import haveno.core.util.FormattingUtils; import haveno.core.util.coin.CoinFormatter; -import haveno.core.util.validation.FiatPriceValidator; import haveno.core.util.validation.NonFiatPriceValidator; +import haveno.core.util.validation.FiatPriceValidator; import haveno.desktop.Navigation; import haveno.desktop.main.offer.MutableOfferViewModel; import lombok.extern.slf4j.Slf4j; +import javax.inject.Named; + @Slf4j class DuplicateOfferViewModel extends MutableOfferViewModel { diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/editoffer/EditOfferDataModel.java b/desktop/src/main/java/haveno/desktop/main/portfolio/editoffer/EditOfferDataModel.java index a59394eac6..9d312dd964 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/editoffer/EditOfferDataModel.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/editoffer/EditOfferDataModel.java @@ -19,7 +19,6 @@ package haveno.desktop.main.portfolio.editoffer; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.handlers.ErrorMessageHandler; import haveno.common.handlers.ResultHandler; import haveno.core.account.witness.AccountAgeWitnessService; @@ -46,6 +45,8 @@ import haveno.core.xmr.wallet.XmrWalletService; import haveno.desktop.Navigation; import haveno.desktop.main.offer.MutableOfferDataModel; import haveno.network.p2p.P2PService; + +import javax.inject.Named; import java.util.Optional; import java.util.Set; diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/editoffer/EditOfferView.java b/desktop/src/main/java/haveno/desktop/main/portfolio/editoffer/EditOfferView.java index 908266bcfa..549661b0b7 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/editoffer/EditOfferView.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/editoffer/EditOfferView.java @@ -18,7 +18,6 @@ package haveno.desktop.main.portfolio.editoffer; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.util.Tuple4; import haveno.core.locale.CurrencyUtil; import haveno.core.locale.Res; @@ -35,7 +34,6 @@ import haveno.desktop.components.BusyAnimation; import haveno.desktop.main.offer.MutableOfferView; import haveno.desktop.main.overlays.popups.Popup; import haveno.desktop.main.overlays.windows.OfferDetailsWindow; -import static haveno.desktop.util.FormBuilder.addButtonBusyAnimationLabelAfterGroup; import javafx.collections.ObservableList; import javafx.geometry.HPos; import javafx.geometry.Insets; @@ -46,6 +44,10 @@ import javafx.scene.image.ImageView; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; +import javax.inject.Named; + +import static haveno.desktop.util.FormBuilder.addButtonBusyAnimationLabelAfterGroup; + @FxmlView public class EditOfferView extends MutableOfferView { diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/editoffer/EditOfferViewModel.java b/desktop/src/main/java/haveno/desktop/main/portfolio/editoffer/EditOfferViewModel.java index 6b6b2c1c2b..e8450aded5 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/editoffer/EditOfferViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/editoffer/EditOfferViewModel.java @@ -18,7 +18,6 @@ package haveno.desktop.main.portfolio.editoffer; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.handlers.ErrorMessageHandler; import haveno.common.handlers.ResultHandler; import haveno.core.account.witness.AccountAgeWitnessService; @@ -32,11 +31,13 @@ import haveno.core.user.Preferences; import haveno.core.util.FormattingUtils; import haveno.core.util.PriceUtil; import haveno.core.util.coin.CoinFormatter; -import haveno.core.util.validation.FiatPriceValidator; import haveno.core.util.validation.NonFiatPriceValidator; +import haveno.core.util.validation.FiatPriceValidator; import haveno.desktop.Navigation; import haveno.desktop.main.offer.MutableOfferViewModel; +import javax.inject.Named; + class EditOfferViewModel extends MutableOfferViewModel { @Inject diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/failedtrades/FailedTradesView.java b/desktop/src/main/java/haveno/desktop/main/portfolio/failedtrades/FailedTradesView.java index 56e9b6cae5..4048fdff0a 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/failedtrades/FailedTradesView.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/failedtrades/FailedTradesView.java @@ -17,7 +17,6 @@ package haveno.desktop.main.portfolio.failedtrades; -import com.google.inject.Inject; import com.googlecode.jcsv.writer.CSVEntryConverter; import com.jfoenix.controls.JFXButton; import de.jensd.fx.fontawesome.AwesomeIcon; @@ -39,8 +38,6 @@ import haveno.desktop.main.overlays.popups.Popup; import haveno.desktop.main.overlays.windows.TradeDetailsWindow; import haveno.desktop.util.FormBuilder; import haveno.desktop.util.GUIUtil; -import java.math.BigInteger; -import java.util.Comparator; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.beans.value.ChangeListener; import javafx.collections.ObservableList; @@ -68,6 +65,10 @@ import javafx.scene.layout.VBox; import javafx.stage.Stage; import javafx.util.Callback; +import javax.inject.Inject; +import java.math.BigInteger; +import java.util.Comparator; + @FxmlView public class FailedTradesView extends ActivatableViewAndModel { diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/failedtrades/FailedTradesViewModel.java b/desktop/src/main/java/haveno/desktop/main/portfolio/failedtrades/FailedTradesViewModel.java index 35b140b9de..cdf8ac053c 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/failedtrades/FailedTradesViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/failedtrades/FailedTradesViewModel.java @@ -18,7 +18,6 @@ package haveno.desktop.main.portfolio.failedtrades; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.core.locale.CurrencyUtil; import haveno.core.locale.Res; import haveno.core.trade.HavenoUtils; @@ -30,6 +29,8 @@ import haveno.desktop.common.model.ViewModel; import haveno.desktop.util.DisplayUtils; import javafx.collections.ObservableList; +import javax.inject.Named; + class FailedTradesViewModel extends ActivatableWithDataModel implements ViewModel { private final CoinFormatter formatter; diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/openoffer/OpenOffersView.java b/desktop/src/main/java/haveno/desktop/main/portfolio/openoffer/OpenOffersView.java index ce5ea6158e..592255b55b 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/openoffer/OpenOffersView.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/openoffer/OpenOffersView.java @@ -17,7 +17,6 @@ package haveno.desktop.main.portfolio.openoffer; -import com.google.inject.Inject; import com.googlecode.jcsv.writer.CSVEntryConverter; import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon; import haveno.core.locale.Res; @@ -41,13 +40,7 @@ import haveno.desktop.main.overlays.popups.Popup; import haveno.desktop.main.overlays.windows.OfferDetailsWindow; import haveno.desktop.main.portfolio.PortfolioView; import haveno.desktop.main.portfolio.duplicateoffer.DuplicateOfferView; -import static haveno.desktop.util.FormBuilder.getRegularIconButton; import haveno.desktop.util.GUIUtil; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; import javafx.beans.binding.Bindings; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.beans.value.ChangeListener; @@ -75,10 +68,20 @@ import javafx.scene.layout.Region; import javafx.scene.layout.VBox; import javafx.stage.Stage; import javafx.util.Callback; + import org.fxmisc.easybind.EasyBind; import org.fxmisc.easybind.Subscription; import org.jetbrains.annotations.NotNull; +import javax.inject.Inject; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import static haveno.desktop.util.FormBuilder.getRegularIconButton; + @FxmlView public class OpenOffersView extends ActivatableViewAndModel { diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/openoffer/OpenOffersViewModel.java b/desktop/src/main/java/haveno/desktop/main/portfolio/openoffer/OpenOffersViewModel.java index 03c1303870..57992bf310 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/openoffer/OpenOffersViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/openoffer/OpenOffersViewModel.java @@ -17,9 +17,7 @@ package haveno.desktop.main.portfolio.openoffer; -import static com.google.common.base.Preconditions.checkNotNull; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.handlers.ErrorMessageHandler; import haveno.common.handlers.ResultHandler; import haveno.core.locale.CurrencyUtil; @@ -39,6 +37,10 @@ import haveno.desktop.util.GUIUtil; import haveno.network.p2p.P2PService; import javafx.collections.ObservableList; +import javax.inject.Named; + +import static com.google.common.base.Preconditions.checkNotNull; + class OpenOffersViewModel extends ActivatableWithDataModel implements ViewModel { private final P2PService p2PService; private final PriceUtil priceUtil; diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java b/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java index f09ba10e26..798e3ffdea 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java @@ -17,10 +17,7 @@ package haveno.desktop.main.portfolio.pendingtrades; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.UserThread; import haveno.common.crypto.PubKeyRing; import haveno.common.crypto.PubKeyRingProvider; @@ -64,9 +61,6 @@ import haveno.desktop.main.support.dispute.client.arbitration.ArbitrationClientV import haveno.desktop.main.support.dispute.client.mediation.MediationClientView; import haveno.desktop.util.GUIUtil; import haveno.network.p2p.P2PService; -import java.math.BigInteger; -import java.util.Date; -import java.util.stream.Collectors; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; @@ -75,11 +69,19 @@ import javafx.beans.value.ChangeListener; import javafx.collections.FXCollections; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; -import javax.annotation.Nullable; import lombok.Getter; import org.bitcoinj.core.Coin; import org.bouncycastle.crypto.params.KeyParameter; +import javax.annotation.Nullable; +import javax.inject.Named; +import java.math.BigInteger; +import java.util.Date; +import java.util.stream.Collectors; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + public class PendingTradesDataModel extends ActivatableDataModel { @Getter public final TradeManager tradeManager; diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/PendingTradesView.java b/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/PendingTradesView.java index ef9e2a99fa..b309de20a3 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/PendingTradesView.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/PendingTradesView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.portfolio.pendingtrades; -import com.google.inject.Inject; -import com.google.inject.name.Named; import com.jfoenix.controls.JFXBadge; import com.jfoenix.controls.JFXButton; import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon; @@ -56,9 +54,6 @@ import haveno.desktop.util.CssTheme; import haveno.desktop.util.DisplayUtils; import haveno.desktop.util.FormBuilder; import haveno.network.p2p.NodeAddress; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Map; import javafx.application.Platform; import javafx.beans.binding.Bindings; import javafx.beans.property.ReadOnlyObjectWrapper; @@ -97,6 +92,12 @@ import javafx.util.Callback; import org.fxmisc.easybind.EasyBind; import org.fxmisc.easybind.Subscription; +import javax.inject.Inject; +import javax.inject.Named; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Map; + @FxmlView public class PendingTradesView extends ActivatableViewAndModel { public interface ChatCallback { diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java b/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java index f3f531d7e9..e07dd2fdea 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java @@ -17,9 +17,7 @@ package haveno.desktop.main.portfolio.pendingtrades; -import static com.google.common.base.Preconditions.checkNotNull; import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.ClockWatcher; import haveno.common.app.DevEnv; import haveno.core.account.witness.AccountAgeWitnessService; @@ -43,23 +41,27 @@ import haveno.core.xmr.wallet.Restrictions; import haveno.desktop.Navigation; import haveno.desktop.common.model.ActivatableWithDataModel; import haveno.desktop.common.model.ViewModel; -import static haveno.desktop.main.portfolio.pendingtrades.PendingTradesViewModel.SellerState.UNDEFINED; import haveno.desktop.util.DisplayUtils; import haveno.desktop.util.GUIUtil; import haveno.network.p2p.P2PService; -import java.math.BigInteger; -import java.util.Date; -import java.util.stream.Collectors; import javafx.beans.property.IntegerProperty; import javafx.beans.property.ObjectProperty; import javafx.beans.property.ReadOnlyObjectProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleObjectProperty; -import javax.annotation.Nullable; import lombok.Getter; import org.fxmisc.easybind.EasyBind; import org.fxmisc.easybind.Subscription; +import javax.annotation.Nullable; +import javax.inject.Named; +import java.math.BigInteger; +import java.util.Date; +import java.util.stream.Collectors; + +import static com.google.common.base.Preconditions.checkNotNull; +import static haveno.desktop.main.portfolio.pendingtrades.PendingTradesViewModel.SellerState.UNDEFINED; + public class PendingTradesViewModel extends ActivatableWithDataModel implements ViewModel { @Getter @@ -150,12 +152,12 @@ public class PendingTradesViewModel extends ActivatableWithDataModel { diff --git a/desktop/src/main/java/haveno/desktop/main/presentation/AccountPresentation.java b/desktop/src/main/java/haveno/desktop/main/presentation/AccountPresentation.java index 7a7746777a..c54dbff962 100644 --- a/desktop/src/main/java/haveno/desktop/main/presentation/AccountPresentation.java +++ b/desktop/src/main/java/haveno/desktop/main/presentation/AccountPresentation.java @@ -17,8 +17,6 @@ package haveno.desktop.main.presentation; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.app.DevEnv; import haveno.core.locale.Res; import haveno.core.user.DontShowAgainLookup; @@ -28,6 +26,9 @@ import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.collections.MapChangeListener; +import javax.inject.Inject; +import javax.inject.Singleton; + @Singleton public class AccountPresentation { diff --git a/desktop/src/main/java/haveno/desktop/main/presentation/MarketPricePresentation.java b/desktop/src/main/java/haveno/desktop/main/presentation/MarketPricePresentation.java index 455655316f..35be328950 100644 --- a/desktop/src/main/java/haveno/desktop/main/presentation/MarketPricePresentation.java +++ b/desktop/src/main/java/haveno/desktop/main/presentation/MarketPricePresentation.java @@ -17,8 +17,6 @@ package haveno.desktop.main.presentation; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.UserThread; import haveno.core.locale.CurrencyUtil; import haveno.core.locale.Res; @@ -30,10 +28,6 @@ import haveno.core.util.FormattingUtils; import haveno.core.xmr.wallet.XmrWalletService; import haveno.desktop.components.TxIdTextField; import haveno.desktop.main.shared.PriceFeedComboBoxItem; -import java.util.List; -import java.util.Optional; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; import javafx.beans.property.BooleanProperty; import javafx.beans.property.IntegerProperty; import javafx.beans.property.ObjectProperty; @@ -50,6 +44,13 @@ import org.fxmisc.easybind.EasyBind; import org.fxmisc.easybind.Subscription; import org.fxmisc.easybind.monadic.MonadicBinding; +import javax.inject.Inject; +import javax.inject.Singleton; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + @Singleton public class MarketPricePresentation { private final Preferences preferences; diff --git a/desktop/src/main/java/haveno/desktop/main/presentation/SettingsPresentation.java b/desktop/src/main/java/haveno/desktop/main/presentation/SettingsPresentation.java index e1336106b3..8f25f91845 100644 --- a/desktop/src/main/java/haveno/desktop/main/presentation/SettingsPresentation.java +++ b/desktop/src/main/java/haveno/desktop/main/presentation/SettingsPresentation.java @@ -17,13 +17,14 @@ package haveno.desktop.main.presentation; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.core.user.Preferences; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.collections.MapChangeListener; +import javax.inject.Inject; +import javax.inject.Singleton; + @Singleton public class SettingsPresentation { diff --git a/desktop/src/main/java/haveno/desktop/main/settings/SettingsView.java b/desktop/src/main/java/haveno/desktop/main/settings/SettingsView.java index 22fbfb752b..4a2f0a836d 100644 --- a/desktop/src/main/java/haveno/desktop/main/settings/SettingsView.java +++ b/desktop/src/main/java/haveno/desktop/main/settings/SettingsView.java @@ -17,7 +17,6 @@ package haveno.desktop.main.settings; -import com.google.inject.Inject; import haveno.core.locale.Res; import haveno.core.user.Preferences; import haveno.desktop.Navigation; @@ -37,6 +36,8 @@ import javafx.scene.control.ScrollPane; import javafx.scene.control.Tab; import javafx.scene.control.TabPane; +import javax.inject.Inject; + @FxmlView public class SettingsView extends ActivatableView { @FXML diff --git a/desktop/src/main/java/haveno/desktop/main/settings/about/AboutView.java b/desktop/src/main/java/haveno/desktop/main/settings/about/AboutView.java index a682012beb..722638c0b4 100644 --- a/desktop/src/main/java/haveno/desktop/main/settings/about/AboutView.java +++ b/desktop/src/main/java/haveno/desktop/main/settings/about/AboutView.java @@ -17,21 +17,23 @@ package haveno.desktop.main.settings.about; -import com.google.inject.Inject; import haveno.common.app.Version; import haveno.core.locale.Res; import haveno.desktop.common.view.ActivatableView; import haveno.desktop.common.view.FxmlView; import haveno.desktop.components.HyperlinkWithIcon; -import static haveno.desktop.util.FormBuilder.addCompactTopLabelTextField; -import static haveno.desktop.util.FormBuilder.addHyperlinkWithIcon; -import static haveno.desktop.util.FormBuilder.addLabel; -import static haveno.desktop.util.FormBuilder.addTitledGroupBg; import haveno.desktop.util.Layout; import javafx.geometry.HPos; import javafx.scene.control.Label; import javafx.scene.layout.GridPane; +import javax.inject.Inject; + +import static haveno.desktop.util.FormBuilder.addCompactTopLabelTextField; +import static haveno.desktop.util.FormBuilder.addHyperlinkWithIcon; +import static haveno.desktop.util.FormBuilder.addLabel; +import static haveno.desktop.util.FormBuilder.addTitledGroupBg; + @FxmlView public class AboutView extends ActivatableView { diff --git a/desktop/src/main/java/haveno/desktop/main/settings/network/NetworkSettingsView.java b/desktop/src/main/java/haveno/desktop/main/settings/network/NetworkSettingsView.java index bd7b48c6df..cc9ce3bee6 100644 --- a/desktop/src/main/java/haveno/desktop/main/settings/network/NetworkSettingsView.java +++ b/desktop/src/main/java/haveno/desktop/main/settings/network/NetworkSettingsView.java @@ -17,7 +17,6 @@ package haveno.desktop.main.settings.network; -import com.google.inject.Inject; import haveno.common.ClockWatcher; import haveno.common.UserThread; import haveno.core.api.CoreMoneroConnectionsService; @@ -28,8 +27,8 @@ import haveno.core.user.Preferences; import haveno.core.util.FormattingUtils; import haveno.core.util.validation.RegexValidator; import haveno.core.util.validation.RegexValidatorFactory; -import haveno.core.xmr.nodes.LocalBitcoinNode; import haveno.core.xmr.nodes.XmrNodes; +import haveno.core.xmr.nodes.LocalBitcoinNode; import haveno.core.xmr.setup.WalletsSetup; import haveno.desktop.app.HavenoApp; import haveno.desktop.common.view.ActivatableView; @@ -43,10 +42,6 @@ import haveno.desktop.main.overlays.windows.TorNetworkSettingsWindow; import haveno.desktop.util.GUIUtil; import haveno.network.p2p.P2PService; import haveno.network.p2p.network.Statistic; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; -import static javafx.beans.binding.Bindings.createStringBinding; import javafx.beans.value.ChangeListener; import javafx.collections.FXCollections; import javafx.collections.ObservableList; @@ -67,6 +62,13 @@ import monero.daemon.model.MoneroPeer; import org.fxmisc.easybind.EasyBind; import org.fxmisc.easybind.Subscription; +import javax.inject.Inject; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import static javafx.beans.binding.Bindings.createStringBinding; + @FxmlView public class NetworkSettingsView extends ActivatableView { diff --git a/desktop/src/main/java/haveno/desktop/main/settings/preferences/PreferencesView.java b/desktop/src/main/java/haveno/desktop/main/settings/preferences/PreferencesView.java index 4d81c850b2..f9792d6f94 100644 --- a/desktop/src/main/java/haveno/desktop/main/settings/preferences/PreferencesView.java +++ b/desktop/src/main/java/haveno/desktop/main/settings/preferences/PreferencesView.java @@ -17,9 +17,6 @@ package haveno.desktop.main.settings.preferences; -import static com.google.common.base.Preconditions.checkArgument; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.UserThread; import haveno.common.app.DevEnv; import haveno.common.config.Config; @@ -32,10 +29,10 @@ import haveno.core.locale.Country; import haveno.core.locale.CountryUtil; import haveno.core.locale.CryptoCurrency; import haveno.core.locale.CurrencyUtil; +import haveno.core.locale.TraditionalCurrency; import haveno.core.locale.LanguageUtil; import haveno.core.locale.Res; import haveno.core.locale.TradeCurrency; -import haveno.core.locale.TraditionalCurrency; import haveno.core.payment.PaymentAccount; import haveno.core.payment.payload.PaymentMethod; import haveno.core.payment.validation.XmrValidator; @@ -57,24 +54,9 @@ import haveno.desktop.components.PasswordTextField; import haveno.desktop.components.TitledGroupBg; import haveno.desktop.main.overlays.popups.Popup; import haveno.desktop.main.overlays.windows.EditCustomExplorerWindow; -import static haveno.desktop.util.FormBuilder.addButton; -import static haveno.desktop.util.FormBuilder.addComboBox; -import static haveno.desktop.util.FormBuilder.addInputTextField; -import static haveno.desktop.util.FormBuilder.addSlideToggleButton; -import static haveno.desktop.util.FormBuilder.addTextFieldWithEditButton; -import static haveno.desktop.util.FormBuilder.addTitledGroupBg; -import static haveno.desktop.util.FormBuilder.addTopLabelListView; import haveno.desktop.util.GUIUtil; import haveno.desktop.util.ImageUtil; import haveno.desktop.util.Layout; -import java.io.File; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; import javafx.beans.value.ChangeListener; import javafx.collections.FXCollections; import javafx.collections.ObservableList; @@ -99,6 +81,26 @@ import javafx.util.Callback; import javafx.util.StringConverter; import org.apache.commons.lang3.StringUtils; +import javax.inject.Inject; +import javax.inject.Named; +import java.io.File; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import static com.google.common.base.Preconditions.checkArgument; +import static haveno.desktop.util.FormBuilder.addButton; +import static haveno.desktop.util.FormBuilder.addComboBox; +import static haveno.desktop.util.FormBuilder.addInputTextField; +import static haveno.desktop.util.FormBuilder.addSlideToggleButton; +import static haveno.desktop.util.FormBuilder.addTextFieldWithEditButton; +import static haveno.desktop.util.FormBuilder.addTitledGroupBg; +import static haveno.desktop.util.FormBuilder.addTopLabelListView; + @FxmlView public class PreferencesView extends ActivatableViewAndModel { private final User user; diff --git a/desktop/src/main/java/haveno/desktop/main/support/SupportView.java b/desktop/src/main/java/haveno/desktop/main/support/SupportView.java index 92f3e9ae1a..0ff81ea2a3 100644 --- a/desktop/src/main/java/haveno/desktop/main/support/SupportView.java +++ b/desktop/src/main/java/haveno/desktop/main/support/SupportView.java @@ -17,7 +17,6 @@ package haveno.desktop.main.support; -import com.google.inject.Inject; import haveno.common.app.DevEnv; import haveno.common.crypto.KeyRing; import haveno.common.crypto.PubKeyRing; @@ -38,8 +37,8 @@ import haveno.desktop.common.view.FxmlView; import haveno.desktop.common.view.View; import haveno.desktop.common.view.ViewLoader; import haveno.desktop.main.MainView; -import haveno.desktop.main.offer.signedoffer.SignedOfferView; import haveno.desktop.main.overlays.popups.Popup; +import haveno.desktop.main.offer.signedoffer.SignedOfferView; import haveno.desktop.main.support.dispute.agent.arbitration.ArbitratorView; import haveno.desktop.main.support.dispute.agent.mediation.MediatorView; import haveno.desktop.main.support.dispute.agent.refund.RefundAgentView; @@ -51,7 +50,9 @@ import javafx.beans.value.ChangeListener; import javafx.collections.MapChangeListener; import javafx.scene.control.Tab; import javafx.scene.control.TabPane; + import javax.annotation.Nullable; +import javax.inject.Inject; @FxmlView public class SupportView extends ActivatableView { diff --git a/desktop/src/main/java/haveno/desktop/main/support/dispute/agent/arbitration/ArbitratorView.java b/desktop/src/main/java/haveno/desktop/main/support/dispute/agent/arbitration/ArbitratorView.java index 2a82ca9d4f..821892e108 100644 --- a/desktop/src/main/java/haveno/desktop/main/support/dispute/agent/arbitration/ArbitratorView.java +++ b/desktop/src/main/java/haveno/desktop/main/support/dispute/agent/arbitration/ArbitratorView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.support.dispute.agent.arbitration; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.common.crypto.KeyRing; import haveno.core.account.witness.AccountAgeWitnessService; @@ -39,6 +37,9 @@ import haveno.desktop.main.overlays.windows.DisputeSummaryWindow; import haveno.desktop.main.overlays.windows.TradeDetailsWindow; import haveno.desktop.main.support.dispute.agent.DisputeAgentView; +import javax.inject.Inject; +import javax.inject.Named; + @FxmlView public class ArbitratorView extends DisputeAgentView { diff --git a/desktop/src/main/java/haveno/desktop/main/support/dispute/agent/mediation/MediatorView.java b/desktop/src/main/java/haveno/desktop/main/support/dispute/agent/mediation/MediatorView.java index b6ed9031d6..dca55b0871 100644 --- a/desktop/src/main/java/haveno/desktop/main/support/dispute/agent/mediation/MediatorView.java +++ b/desktop/src/main/java/haveno/desktop/main/support/dispute/agent/mediation/MediatorView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.support.dispute.agent.mediation; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.common.crypto.KeyRing; import haveno.core.account.witness.AccountAgeWitnessService; @@ -39,6 +37,9 @@ import haveno.desktop.main.overlays.windows.DisputeSummaryWindow; import haveno.desktop.main.overlays.windows.TradeDetailsWindow; import haveno.desktop.main.support.dispute.agent.DisputeAgentView; +import javax.inject.Inject; +import javax.inject.Named; + @FxmlView public class MediatorView extends DisputeAgentView { diff --git a/desktop/src/main/java/haveno/desktop/main/support/dispute/agent/refund/RefundAgentView.java b/desktop/src/main/java/haveno/desktop/main/support/dispute/agent/refund/RefundAgentView.java index b73cd75905..8b225c7fe6 100644 --- a/desktop/src/main/java/haveno/desktop/main/support/dispute/agent/refund/RefundAgentView.java +++ b/desktop/src/main/java/haveno/desktop/main/support/dispute/agent/refund/RefundAgentView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.support.dispute.agent.refund; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.common.crypto.KeyRing; import haveno.core.account.witness.AccountAgeWitnessService; @@ -41,6 +39,9 @@ import haveno.desktop.main.overlays.windows.DisputeSummaryWindow; import haveno.desktop.main.overlays.windows.TradeDetailsWindow; import haveno.desktop.main.support.dispute.agent.DisputeAgentView; +import javax.inject.Inject; +import javax.inject.Named; + @FxmlView public class RefundAgentView extends DisputeAgentView { diff --git a/desktop/src/main/java/haveno/desktop/main/support/dispute/client/arbitration/ArbitrationClientView.java b/desktop/src/main/java/haveno/desktop/main/support/dispute/client/arbitration/ArbitrationClientView.java index 7c4d83119d..b9eda655cd 100644 --- a/desktop/src/main/java/haveno/desktop/main/support/dispute/client/arbitration/ArbitrationClientView.java +++ b/desktop/src/main/java/haveno/desktop/main/support/dispute/client/arbitration/ArbitrationClientView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.support.dispute.client.arbitration; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.common.crypto.KeyRing; import haveno.core.account.witness.AccountAgeWitnessService; @@ -39,6 +37,9 @@ import haveno.desktop.main.overlays.windows.DisputeSummaryWindow; import haveno.desktop.main.overlays.windows.TradeDetailsWindow; import haveno.desktop.main.support.dispute.client.DisputeClientView; +import javax.inject.Inject; +import javax.inject.Named; + @FxmlView public class ArbitrationClientView extends DisputeClientView { @Inject diff --git a/desktop/src/main/java/haveno/desktop/main/support/dispute/client/mediation/MediationClientView.java b/desktop/src/main/java/haveno/desktop/main/support/dispute/client/mediation/MediationClientView.java index 369bde0696..73865352ef 100644 --- a/desktop/src/main/java/haveno/desktop/main/support/dispute/client/mediation/MediationClientView.java +++ b/desktop/src/main/java/haveno/desktop/main/support/dispute/client/mediation/MediationClientView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.support.dispute.client.mediation; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.common.crypto.KeyRing; import haveno.core.account.witness.AccountAgeWitnessService; @@ -43,6 +41,9 @@ import haveno.desktop.main.overlays.windows.TradeDetailsWindow; import haveno.desktop.main.support.dispute.client.DisputeClientView; import haveno.network.p2p.NodeAddress; +import javax.inject.Inject; +import javax.inject.Named; + @FxmlView public class MediationClientView extends DisputeClientView { @Inject diff --git a/desktop/src/main/java/haveno/desktop/main/support/dispute/client/refund/RefundClientView.java b/desktop/src/main/java/haveno/desktop/main/support/dispute/client/refund/RefundClientView.java index 2b812a8ecf..2dfa06ad82 100644 --- a/desktop/src/main/java/haveno/desktop/main/support/dispute/client/refund/RefundClientView.java +++ b/desktop/src/main/java/haveno/desktop/main/support/dispute/client/refund/RefundClientView.java @@ -17,8 +17,6 @@ package haveno.desktop.main.support.dispute.client.refund; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.config.Config; import haveno.common.crypto.KeyRing; import haveno.core.account.witness.AccountAgeWitnessService; @@ -41,6 +39,9 @@ import haveno.desktop.main.overlays.windows.TradeDetailsWindow; import haveno.desktop.main.support.dispute.client.DisputeClientView; import haveno.network.p2p.NodeAddress; +import javax.inject.Inject; +import javax.inject.Named; + @FxmlView public class RefundClientView extends DisputeClientView { @Inject diff --git a/desktop/src/main/java/haveno/desktop/util/Transitions.java b/desktop/src/main/java/haveno/desktop/util/Transitions.java index 06c84712ed..c0ce04c2ca 100644 --- a/desktop/src/main/java/haveno/desktop/util/Transitions.java +++ b/desktop/src/main/java/haveno/desktop/util/Transitions.java @@ -17,8 +17,6 @@ package haveno.desktop.util; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.UserThread; import haveno.core.user.Preferences; import javafx.animation.FadeTransition; @@ -34,6 +32,9 @@ import javafx.scene.effect.GaussianBlur; import javafx.scene.layout.Pane; import javafx.util.Duration; +import javax.inject.Inject; +import javax.inject.Singleton; + @Singleton public class Transitions { diff --git a/docs/installing.md b/docs/installing.md index 8e12c8bae2..3d525f6a3a 100644 --- a/docs/installing.md +++ b/docs/installing.md @@ -6,12 +6,12 @@ These are the steps needed to build Haveno and test it on our test network or lo On Ubuntu: - 1. `sudo apt install make wget git openjdk-17-jdk`. - 2. If `echo $JAVA_HOME` does not print the path to JDK 17, then `export JAVA_HOME=/path/to/jdk` (e.g. `export JAVA_HOME=/usr/lib/jvm/java-17-openjdk`). + 1. `sudo apt install make wget git openjdk-11-jdk`. + 2. If `echo $JAVA_HOME` does not print the path to JDK 11, then `export JAVA_HOME=/path/to/jdk` (e.g. `export JAVA_HOME=/usr/lib/jvm/java-11-openjdk`). On Windows: - 1. Download [Java JDK 17](https://adoptium.net/temurin/archive/?version=17). During installation, enable the option to set the $JAVA_HOME environment variable. + 1. Download [Java JDK 11](https://adoptium.net/temurin/archive/?version=11). During installation, enable the option to set the $JAVA_HOME environment variable. 2. Install [MSYS2](https://www.msys2.org/). 3. Start MSYS2 MINGW64 or MSYS MINGW32 depending on your system. Use MSYS2 for all commands throughout this document. 4. Update pacman: `pacman -Syy` diff --git a/gradle/README.md b/gradle/README.md index bb93fa1f7c..b1f90bd970 100644 --- a/gradle/README.md +++ b/gradle/README.md @@ -8,9 +8,9 @@ Visit the [Gradle website](https://gradle.org/releases/) and decide the: Adjust the following command with tha arguments above and execute it twice: - ./gradlew wrapper --gradle-version 8.2 \ + ./gradlew wrapper --gradle-version 8.0.2 \ --distribution-type all \ - --gradle-distribution-sha256-sum 5022b0b25fe182b0e50867e77f484501dba44feeea88f5c1f13b6b4660463640 + --gradle-distribution-sha256-sum 47a5bfed9ef814f90f8debcbbb315e8e7c654109acd224595ea39fca95c5d4da The first execution should automatically update: diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index a448d4e884..8472b2c7c5 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -678,11 +678,6 @@ - - - - - @@ -738,6 +733,14 @@ + + + + + + + + @@ -749,25 +752,59 @@ + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + @@ -794,9 +831,17 @@ - - - + + + + + + + + + + + @@ -812,11 +857,6 @@ - - - - - @@ -921,9 +961,9 @@ - - - + + + @@ -1511,11 +1551,6 @@ - - - - - @@ -2163,11 +2198,6 @@ - - - - - @@ -2346,24 +2376,48 @@ - - - + + + + + + - - - + + + + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -3127,11 +3181,6 @@ - - - - - @@ -3173,11 +3222,6 @@ - - - - - @@ -3201,11 +3245,6 @@ - - - - - diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 033e24c4cd..7454180f2a 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a3044fac5a..1a703c8b43 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,8 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=5022b0b25fe182b0e50867e77f484501dba44feeea88f5c1f13b6b4660463640 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip -networkTimeout=10000 -validateDistributionUrl=true +distributionSha256Sum=47a5bfed9ef814f90f8debcbbb315e8e7c654109acd224595ea39fca95c5d4da +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index fcb6fca147..1b6c787337 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,11 +80,14 @@ do esac done -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -130,29 +133,22 @@ location of your Java installation." fi else JAVACMD=java - if ! command -v java >/dev/null 2>&1 - then - die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." - fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,10 +193,6 @@ if "$cygwin" || "$msys" ; then done fi - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in @@ -213,12 +205,6 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 93e3f59f13..107acd32c4 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%"=="" @echo off +@if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,8 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused +if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -41,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -76,15 +75,13 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd +if "%ERRORLEVEL%"=="0" goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/p2p/src/main/java/haveno/network/Socks5ProxyProvider.java b/p2p/src/main/java/haveno/network/Socks5ProxyProvider.java index c8b4ad10df..8029e5014d 100644 --- a/p2p/src/main/java/haveno/network/Socks5ProxyProvider.java +++ b/p2p/src/main/java/haveno/network/Socks5ProxyProvider.java @@ -18,15 +18,16 @@ package haveno.network; import com.google.inject.Inject; -import com.google.inject.name.Named; import com.runjva.sourceforge.jsocks.protocol.Socks5Proxy; import haveno.common.config.Config; import haveno.network.p2p.network.NetworkNode; -import java.net.UnknownHostException; -import javax.annotation.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.annotation.Nullable; +import javax.inject.Named; +import java.net.UnknownHostException; + /** * Provides Socks5Proxies for the bitcoin network and http requests *

diff --git a/p2p/src/main/java/haveno/network/crypto/EncryptionService.java b/p2p/src/main/java/haveno/network/crypto/EncryptionService.java index b2fe4a6039..b0e6fa7b8d 100644 --- a/p2p/src/main/java/haveno/network/crypto/EncryptionService.java +++ b/p2p/src/main/java/haveno/network/crypto/EncryptionService.java @@ -17,11 +17,9 @@ package haveno.network.crypto; -import com.google.inject.Inject; import com.google.protobuf.InvalidProtocolBufferException; import haveno.common.crypto.CryptoException; import haveno.common.crypto.Encryption; -import static haveno.common.crypto.Encryption.decryptSecretKey; import haveno.common.crypto.Hash; import haveno.common.crypto.KeyRing; import haveno.common.crypto.PubKeyRing; @@ -31,11 +29,15 @@ import haveno.common.proto.ProtobufferException; import haveno.common.proto.network.NetworkEnvelope; import haveno.common.proto.network.NetworkProtoResolver; import haveno.network.p2p.DecryptedMessageWithPubKey; +import lombok.extern.slf4j.Slf4j; + +import javax.crypto.SecretKey; +import javax.inject.Inject; import java.security.KeyPair; import java.security.PrivateKey; import java.security.PublicKey; -import javax.crypto.SecretKey; -import lombok.extern.slf4j.Slf4j; + +import static haveno.common.crypto.Encryption.decryptSecretKey; @Slf4j public class EncryptionService { diff --git a/p2p/src/main/java/haveno/network/http/HttpClientImpl.java b/p2p/src/main/java/haveno/network/http/HttpClientImpl.java index d75eb0461e..17185d60e1 100644 --- a/p2p/src/main/java/haveno/network/http/HttpClientImpl.java +++ b/p2p/src/main/java/haveno/network/http/HttpClientImpl.java @@ -17,25 +17,10 @@ package haveno.network.http; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import com.google.inject.Inject; import com.runjva.sourceforge.jsocks.protocol.Socks5Proxy; import haveno.common.app.Version; import haveno.common.util.Utilities; import haveno.network.Socks5ProxyProvider; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.UnsupportedEncodingException; -import java.net.HttpURLConnection; -import java.net.InetSocketAddress; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import javax.annotation.Nullable; import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; @@ -54,6 +39,23 @@ import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.ssl.SSLContexts; +import javax.annotation.Nullable; +import javax.inject.Inject; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.InetSocketAddress; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + // TODO close connection if failing @Slf4j public class HttpClientImpl implements HttpClient { diff --git a/p2p/src/main/java/haveno/network/p2p/NetworkNodeProvider.java b/p2p/src/main/java/haveno/network/p2p/NetworkNodeProvider.java index 6825abe79c..5bdaa2cc38 100644 --- a/p2p/src/main/java/haveno/network/p2p/NetworkNodeProvider.java +++ b/p2p/src/main/java/haveno/network/p2p/NetworkNodeProvider.java @@ -17,20 +17,24 @@ package haveno.network.p2p; -import com.google.inject.Inject; -import com.google.inject.Provider; -import com.google.inject.name.Named; -import haveno.common.config.Config; -import haveno.common.proto.network.NetworkProtoResolver; -import haveno.network.p2p.network.BanFilter; import haveno.network.p2p.network.BridgeAddressProvider; import haveno.network.p2p.network.LocalhostNetworkNode; +import haveno.network.p2p.network.BanFilter; import haveno.network.p2p.network.NetworkNode; import haveno.network.p2p.network.NewTor; import haveno.network.p2p.network.RunningTor; import haveno.network.p2p.network.TorMode; import haveno.network.p2p.network.TorNetworkNode; + +import haveno.common.config.Config; +import haveno.common.proto.network.NetworkProtoResolver; + +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Provider; + import java.io.File; + import javax.annotation.Nullable; public class NetworkNodeProvider implements Provider { diff --git a/p2p/src/main/java/haveno/network/p2p/mailbox/IgnoredMailboxService.java b/p2p/src/main/java/haveno/network/p2p/mailbox/IgnoredMailboxService.java index ede80009d5..7d6fd9292b 100644 --- a/p2p/src/main/java/haveno/network/p2p/mailbox/IgnoredMailboxService.java +++ b/p2p/src/main/java/haveno/network/p2p/mailbox/IgnoredMailboxService.java @@ -17,12 +17,13 @@ package haveno.network.p2p.mailbox; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.persistence.PersistenceManager; import haveno.common.proto.persistable.PersistedDataHost; import haveno.network.p2p.storage.payload.MailboxStoragePayload; +import javax.inject.Inject; +import javax.inject.Singleton; + /** * We persist failed attempts to decrypt mailbox messages (expected if mailbox message was not addressed to us). * This improves performance at processing mailbox messages. diff --git a/p2p/src/main/java/haveno/network/p2p/mailbox/MailboxMessageService.java b/p2p/src/main/java/haveno/network/p2p/mailbox/MailboxMessageService.java index 09f7b49e7f..5249a7caf2 100644 --- a/p2p/src/main/java/haveno/network/p2p/mailbox/MailboxMessageService.java +++ b/p2p/src/main/java/haveno/network/p2p/mailbox/MailboxMessageService.java @@ -18,15 +18,10 @@ package haveno.network.p2p.mailbox; import com.google.common.base.Joiner; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.SettableFuture; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import com.google.inject.name.Named; import haveno.common.UserThread; import haveno.common.config.Config; import haveno.common.crypto.CryptoException; @@ -58,6 +53,13 @@ import haveno.network.p2p.storage.payload.MailboxStoragePayload; import haveno.network.p2p.storage.payload.ProtectedMailboxStorageEntry; import haveno.network.p2p.storage.payload.ProtectedStorageEntry; import haveno.network.utils.CapabilityUtils; +import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.NotNull; + +import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; import java.security.PublicKey; import java.time.Clock; import java.util.ArrayDeque; @@ -76,9 +78,9 @@ import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Collectors; -import javax.annotation.Nullable; -import lombok.extern.slf4j.Slf4j; -import org.jetbrains.annotations.NotNull; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; /** * Responsible for handling of mailbox messages. diff --git a/p2p/src/main/java/haveno/network/p2p/network/Connection.java b/p2p/src/main/java/haveno/network/p2p/network/Connection.java index daf1bc0e7d..bd887e2cc1 100644 --- a/p2p/src/main/java/haveno/network/p2p/network/Connection.java +++ b/p2p/src/main/java/haveno/network/p2p/network/Connection.java @@ -17,22 +17,6 @@ package haveno.network.p2p.network; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.util.concurrent.Uninterruptibles; -import com.google.inject.Inject; -import com.google.protobuf.InvalidProtocolBufferException; -import haveno.common.Proto; -import haveno.common.UserThread; -import haveno.common.app.Capabilities; -import haveno.common.app.HasCapabilities; -import haveno.common.app.Version; -import haveno.common.config.Config; -import haveno.common.proto.ProtobufferException; -import haveno.common.proto.network.NetworkEnvelope; -import haveno.common.proto.network.NetworkProtoResolver; -import haveno.common.util.SingleThreadExecutorUtils; -import haveno.common.util.Utilities; import haveno.network.p2p.BundleOfEnvelopes; import haveno.network.p2p.CloseConnectionMessage; import haveno.network.p2p.ExtendedDataSizePermission; @@ -46,16 +30,39 @@ import haveno.network.p2p.storage.messages.AddPersistableNetworkPayloadMessage; import haveno.network.p2p.storage.messages.RemoveDataMessage; import haveno.network.p2p.storage.payload.CapabilityRequiringPayload; import haveno.network.p2p.storage.payload.PersistableNetworkPayload; + +import haveno.common.Proto; +import haveno.common.UserThread; +import haveno.common.app.Capabilities; +import haveno.common.app.HasCapabilities; +import haveno.common.app.Version; +import haveno.common.config.Config; +import haveno.common.proto.ProtobufferException; +import haveno.common.proto.network.NetworkEnvelope; +import haveno.common.proto.network.NetworkProtoResolver; +import haveno.common.util.SingleThreadExecutorUtils; +import haveno.common.util.Utilities; + +import com.google.protobuf.InvalidProtocolBufferException; + +import javax.inject.Inject; + +import com.google.common.util.concurrent.Uninterruptibles; + +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleObjectProperty; + +import java.net.Socket; +import java.net.SocketException; +import java.net.SocketTimeoutException; + import java.io.EOFException; import java.io.IOException; import java.io.InputStream; import java.io.InvalidClassException; import java.io.OptionalDataException; import java.io.StreamCorruptedException; -import java.lang.ref.WeakReference; -import java.net.Socket; -import java.net.SocketException; -import java.net.SocketTimeoutException; + import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -70,12 +77,17 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.stream.Collectors; -import javafx.beans.property.ObjectProperty; -import javafx.beans.property.SimpleObjectProperty; + +import java.lang.ref.WeakReference; + import lombok.Getter; import lombok.extern.slf4j.Slf4j; + import org.jetbrains.annotations.Nullable; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + /** * Connection is created by the server thread or by sendMessage from NetworkNode. * All handlers are called on User thread. diff --git a/p2p/src/main/java/haveno/network/p2p/peers/Broadcaster.java b/p2p/src/main/java/haveno/network/p2p/peers/Broadcaster.java index 625483edf2..109e192fcb 100644 --- a/p2p/src/main/java/haveno/network/p2p/peers/Broadcaster.java +++ b/p2p/src/main/java/haveno/network/p2p/peers/Broadcaster.java @@ -17,25 +17,31 @@ package haveno.network.p2p.peers; -import com.google.common.util.concurrent.ListeningExecutorService; -import com.google.common.util.concurrent.MoreExecutors; -import com.google.inject.Inject; -import com.google.inject.name.Named; +import haveno.network.p2p.NodeAddress; +import haveno.network.p2p.network.NetworkNode; +import haveno.network.p2p.storage.messages.BroadcastMessage; + import haveno.common.Timer; import haveno.common.UserThread; import haveno.common.config.Config; import haveno.common.util.Utilities; -import haveno.network.p2p.NodeAddress; -import haveno.network.p2p.network.NetworkNode; -import haveno.network.p2p.storage.messages.BroadcastMessage; + +import javax.inject.Inject; +import javax.inject.Named; + +import com.google.common.util.concurrent.ListeningExecutorService; +import com.google.common.util.concurrent.MoreExecutors; + import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; + import lombok.Value; import lombok.extern.slf4j.Slf4j; + import org.jetbrains.annotations.Nullable; @Slf4j diff --git a/p2p/src/main/java/haveno/network/p2p/peers/PeerManager.java b/p2p/src/main/java/haveno/network/p2p/peers/PeerManager.java index 0ca6217d47..457457deed 100644 --- a/p2p/src/main/java/haveno/network/p2p/peers/PeerManager.java +++ b/p2p/src/main/java/haveno/network/p2p/peers/PeerManager.java @@ -18,9 +18,6 @@ package haveno.network.p2p.peers; import com.google.common.annotations.VisibleForTesting; -import static com.google.common.base.Preconditions.checkArgument; -import com.google.inject.Inject; -import com.google.inject.name.Named; import haveno.common.ClockWatcher; import haveno.common.Timer; import haveno.common.UserThread; @@ -40,6 +37,12 @@ import haveno.network.p2p.network.RuleViolation; import haveno.network.p2p.peers.peerexchange.Peer; import haveno.network.p2p.peers.peerexchange.PeerList; import haveno.network.p2p.seed.SeedNodeRepository; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; + +import javax.annotation.Nullable; +import javax.inject.Inject; +import javax.inject.Named; import java.util.ArrayList; import java.util.Collection; import java.util.Comparator; @@ -53,9 +56,8 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; -import javax.annotation.Nullable; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; + +import static com.google.common.base.Preconditions.checkArgument; @Slf4j public final class PeerManager implements ConnectionListener, PersistedDataHost { diff --git a/p2p/src/main/java/haveno/network/p2p/peers/getdata/RequestDataManager.java b/p2p/src/main/java/haveno/network/p2p/peers/getdata/RequestDataManager.java index fbb1fb7e0d..5a62959e12 100644 --- a/p2p/src/main/java/haveno/network/p2p/peers/getdata/RequestDataManager.java +++ b/p2p/src/main/java/haveno/network/p2p/peers/getdata/RequestDataManager.java @@ -17,9 +17,6 @@ package haveno.network.p2p.peers.getdata; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import com.google.inject.Inject; import haveno.common.Timer; import haveno.common.UserThread; import haveno.common.app.Version; @@ -35,6 +32,10 @@ import haveno.network.p2p.peers.getdata.messages.GetDataRequest; import haveno.network.p2p.peers.peerexchange.Peer; import haveno.network.p2p.seed.SeedNodeRepository; import haveno.network.p2p.storage.P2PDataStorage; +import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.Nullable; + +import javax.inject.Inject; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -44,8 +45,9 @@ import java.util.Map; import java.util.Optional; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import lombok.extern.slf4j.Slf4j; -import org.jetbrains.annotations.Nullable; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; @Slf4j public class RequestDataManager implements MessageListener, ConnectionListener, PeerManager.Listener { diff --git a/p2p/src/main/java/haveno/network/p2p/peers/keepalive/KeepAliveManager.java b/p2p/src/main/java/haveno/network/p2p/peers/keepalive/KeepAliveManager.java index 715238881b..d1772dc8bc 100644 --- a/p2p/src/main/java/haveno/network/p2p/peers/keepalive/KeepAliveManager.java +++ b/p2p/src/main/java/haveno/network/p2p/peers/keepalive/KeepAliveManager.java @@ -20,7 +20,6 @@ package haveno.network.p2p.peers.keepalive; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.SettableFuture; -import com.google.inject.Inject; import haveno.common.Timer; import haveno.common.UserThread; import haveno.common.proto.network.NetworkEnvelope; @@ -34,11 +33,13 @@ import haveno.network.p2p.network.OutboundConnection; import haveno.network.p2p.peers.PeerManager; import haveno.network.p2p.peers.keepalive.messages.Ping; import haveno.network.p2p.peers.keepalive.messages.Pong; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.inject.Inject; import java.util.HashMap; import java.util.Map; import java.util.Random; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class KeepAliveManager implements MessageListener, ConnectionListener, PeerManager.Listener { private static final Logger log = LoggerFactory.getLogger(KeepAliveManager.class); diff --git a/p2p/src/main/java/haveno/network/p2p/peers/peerexchange/PeerExchangeManager.java b/p2p/src/main/java/haveno/network/p2p/peers/peerexchange/PeerExchangeManager.java index d2b454a1b8..ec7d3b60f1 100644 --- a/p2p/src/main/java/haveno/network/p2p/peers/peerexchange/PeerExchangeManager.java +++ b/p2p/src/main/java/haveno/network/p2p/peers/peerexchange/PeerExchangeManager.java @@ -18,7 +18,6 @@ package haveno.network.p2p.peers.peerexchange; import com.google.common.base.Preconditions; -import com.google.inject.Inject; import haveno.common.Timer; import haveno.common.UserThread; import haveno.common.proto.network.NetworkEnvelope; @@ -31,6 +30,10 @@ import haveno.network.p2p.network.NetworkNode; import haveno.network.p2p.peers.PeerManager; import haveno.network.p2p.peers.peerexchange.messages.GetPeersRequest; import haveno.network.p2p.seed.SeedNodeRepository; +import lombok.extern.slf4j.Slf4j; + +import javax.annotation.Nullable; +import javax.inject.Inject; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -43,8 +46,6 @@ import java.util.Random; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import javax.annotation.Nullable; -import lombok.extern.slf4j.Slf4j; @Slf4j public class PeerExchangeManager implements MessageListener, ConnectionListener, PeerManager.Listener { diff --git a/p2p/src/main/java/haveno/network/p2p/storage/P2PDataStorage.java b/p2p/src/main/java/haveno/network/p2p/storage/P2PDataStorage.java index ea52805a7c..45017c9967 100644 --- a/p2p/src/main/java/haveno/network/p2p/storage/P2PDataStorage.java +++ b/p2p/src/main/java/haveno/network/p2p/storage/P2PDataStorage.java @@ -17,26 +17,6 @@ package haveno.network.p2p.storage; -import com.google.common.annotations.VisibleForTesting; -import com.google.common.collect.Maps; -import com.google.inject.Inject; -import com.google.inject.name.Named; -import com.google.protobuf.ByteString; -import haveno.common.Timer; -import haveno.common.UserThread; -import haveno.common.app.Capabilities; -import haveno.common.crypto.CryptoException; -import haveno.common.crypto.Hash; -import haveno.common.crypto.Sig; -import haveno.common.persistence.PersistenceManager; -import haveno.common.proto.network.GetDataResponsePriority; -import haveno.common.proto.network.NetworkEnvelope; -import haveno.common.proto.network.NetworkPayload; -import haveno.common.proto.persistable.PersistablePayload; -import haveno.common.proto.persistable.PersistedDataHost; -import haveno.common.util.Hex; -import haveno.common.util.Tuple2; -import haveno.common.util.Utilities; import haveno.network.p2p.NodeAddress; import haveno.network.p2p.network.CloseConnectionReason; import haveno.network.p2p.network.Connection; @@ -74,9 +54,43 @@ import haveno.network.p2p.storage.persistence.ProtectedDataStoreService; import haveno.network.p2p.storage.persistence.RemovedPayloadsService; import haveno.network.p2p.storage.persistence.ResourceDataStoreService; import haveno.network.p2p.storage.persistence.SequenceNumberMap; + +import haveno.common.Timer; +import haveno.common.UserThread; +import haveno.common.app.Capabilities; +import haveno.common.crypto.CryptoException; +import haveno.common.crypto.Hash; +import haveno.common.crypto.Sig; +import haveno.common.persistence.PersistenceManager; +import haveno.common.proto.network.GetDataResponsePriority; +import haveno.common.proto.network.NetworkEnvelope; +import haveno.common.proto.network.NetworkPayload; +import haveno.common.proto.persistable.PersistablePayload; +import haveno.common.proto.persistable.PersistedDataHost; +import haveno.common.util.Hex; +import haveno.common.util.Tuple2; +import haveno.common.util.Utilities; + +import com.google.protobuf.ByteString; + +import com.google.inject.name.Named; + +import javax.inject.Inject; + +import com.google.common.annotations.VisibleForTesting; +import com.google.common.collect.Maps; + +import org.fxmisc.easybind.EasyBind; +import org.fxmisc.easybind.monadic.MonadicBinding; + +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.SimpleBooleanProperty; + import java.security.KeyPair; import java.security.PublicKey; + import java.time.Clock; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -97,16 +111,14 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Collectors; -import javafx.beans.property.BooleanProperty; -import javafx.beans.property.SimpleBooleanProperty; -import javax.annotation.Nullable; + import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import lombok.ToString; import lombok.extern.slf4j.Slf4j; -import org.fxmisc.easybind.EasyBind; -import org.fxmisc.easybind.monadic.MonadicBinding; + +import javax.annotation.Nullable; @Slf4j public class P2PDataStorage implements MessageListener, ConnectionListener, PersistedDataHost { @@ -235,7 +247,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers appendOnlyDataStoreService.readFromResourcesSync(postFix); protectedDataStoreService.readFromResourcesSync(postFix); resourceDataStoreService.readFromResourcesSync(postFix); - + map.putAll(protectedDataStoreService.getMap()); } } @@ -819,9 +831,9 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers synchronized (map) { ProtectedStoragePayload protectedStoragePayload = protectedStorageEntry.getProtectedStoragePayload(); ByteArray hashOfPayload = get32ByteHashAsByteArray(protectedStoragePayload); - + //log.trace("## call addProtectedStorageEntry hash={}, map={}", hashOfPayload, printMap()); - + // We do that check early as it is a very common case for returning, so we return early // If we have seen a more recent operation for this payload and we have a payload locally, ignore it ProtectedStorageEntry storedEntry = map.get(hashOfPayload); @@ -829,13 +841,13 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers log.trace("## hasSequenceNrIncreased is false. hash={}", hashOfPayload); return false; } - + if (hasAlreadyRemovedAddOncePayload(protectedStoragePayload, hashOfPayload)) { log.trace("## We have already removed that AddOncePayload by a previous removeDataMessage. " + "We ignore that message. ProtectedStoragePayload: {}", protectedStoragePayload.toString()); return false; } - + // To avoid that expired data get stored and broadcast we check for expire date. if (protectedStorageEntry.isExpired(clock)) { String peer = sender != null ? sender.getFullAddress() : "sender is null"; @@ -843,7 +855,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers peer, protectedStorageEntry.getProtectedStoragePayload().getClass().getSimpleName()); return false; } - + // We want to allow add operations for equal sequence numbers if we don't have the payload locally. This is // the case for non-persistent Payloads that need to be reconstructed from peer and seed nodes each startup. MapValue sequenceNumberMapValue = sequenceNumberMap.get(hashOfPayload); @@ -852,36 +864,36 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers log.trace("## sequenceNr too low hash={}", hashOfPayload); return false; } - + // Verify the ProtectedStorageEntry is well formed and valid for the add operation if (!protectedStorageEntry.isValidForAddOperation()) { log.trace("## !isValidForAddOperation hash={}", hashOfPayload); return false; } - + // If we have already seen an Entry with the same hash, verify the metadata is equal if (storedEntry != null && !protectedStorageEntry.matchesRelevantPubKey(storedEntry)) { log.trace("## !matchesRelevantPubKey hash={}", hashOfPayload); return false; } - + // Test against filterPredicate set from FilterManager if (filterPredicate != null && !filterPredicate.test(protectedStorageEntry.getProtectedStoragePayload())) { log.debug("filterPredicate test failed. hashOfPayload={}", hashOfPayload); return false; } - + // This is an updated entry. Record it and signal listeners. map.put(hashOfPayload, protectedStorageEntry); hashMapChangedListeners.forEach(e -> e.onAdded(Collections.singletonList(protectedStorageEntry))); - + // Record the updated sequence number and persist it. Higher delay so we can batch more items. sequenceNumberMap.put(hashOfPayload, new MapValue(protectedStorageEntry.getSequenceNumber(), this.clock.millis())); requestPersistence(); - + //log.trace("## ProtectedStorageEntry added to map. hash={}, map={}", hashOfPayload, printMap()); - + // Optionally, broadcast the add/update depending on the calling environment if (allowBroadcast) { broadcaster.broadcast(new AddDataMessage(protectedStorageEntry), sender, listener); @@ -890,7 +902,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers // Persist ProtectedStorageEntries carrying PersistablePayload payloads if (protectedStoragePayload instanceof PersistablePayload) protectedDataStoreService.put(hashOfPayload, protectedStorageEntry); - + return true; } } @@ -939,13 +951,13 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers try { ByteArray hashOfPayload = new ByteArray(refreshTTLMessage.getHashOfPayload()); ProtectedStorageEntry storedData = map.get(hashOfPayload); - + if (storedData == null) { log.debug("We don't have data for that refresh message in our map. That is expected if we missed the data publishing."); - + return false; } - + ProtectedStorageEntry storedEntry = map.get(hashOfPayload); ProtectedStorageEntry updatedEntry = new ProtectedStorageEntry( storedEntry.getProtectedStoragePayload(), @@ -953,26 +965,26 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers refreshTTLMessage.getSequenceNumber(), refreshTTLMessage.getSignature(), this.clock); - - + + // If we have seen a more recent operation for this payload, we ignore the current one if (!hasSequenceNrIncreased(updatedEntry.getSequenceNumber(), hashOfPayload)) return false; - + // Verify the updated ProtectedStorageEntry is well formed and valid for update if (!updatedEntry.isValidForAddOperation()) return false; - + // Update the hash map with the updated entry map.put(hashOfPayload, updatedEntry); - + // Record the latest sequence number and persist it sequenceNumberMap.put(hashOfPayload, new MapValue(updatedEntry.getSequenceNumber(), this.clock.millis())); requestPersistence(); - + // Always broadcast refreshes broadcaster.broadcast(refreshTTLMessage, sender); - + } catch (IllegalArgumentException e) { log.error("refreshTTL failed, missing data: {}", e.toString()); e.printStackTrace(); @@ -995,29 +1007,29 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers synchronized (map) { ProtectedStoragePayload protectedStoragePayload = protectedStorageEntry.getProtectedStoragePayload(); ByteArray hashOfPayload = get32ByteHashAsByteArray(protectedStoragePayload); - + // If we have seen a more recent operation for this payload, ignore this one if (!hasSequenceNrIncreased(protectedStorageEntry.getSequenceNumber(), hashOfPayload)) return false; - + // Verify the ProtectedStorageEntry is well formed and valid for the remove operation if (!protectedStorageEntry.isValidForRemoveOperation()) return false; - + // If we have already seen an Entry with the same hash, verify the metadata is the same ProtectedStorageEntry storedEntry = map.get(hashOfPayload); if (storedEntry != null && !protectedStorageEntry.matchesRelevantPubKey(storedEntry)) return false; - + // Record the latest sequence number and persist it sequenceNumberMap.put(hashOfPayload, new MapValue(protectedStorageEntry.getSequenceNumber(), this.clock.millis())); requestPersistence(); - + // Update that we have seen this AddOncePayload so the next time it is seen it fails verification if (protectedStoragePayload instanceof AddOncePayload) { removedPayloadsService.addHash(hashOfPayload); } - + if (storedEntry != null) { // Valid remove entry, do the remove and signal listeners removeFromMapAndDataStore(protectedStorageEntry, hashOfPayload); @@ -1027,13 +1039,13 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers // broadcast the remove to peers so they can update their state appropriately } */ printData("after remove"); - + if (protectedStorageEntry instanceof ProtectedMailboxStorageEntry) { broadcaster.broadcast(new RemoveMailboxDataMessage((ProtectedMailboxStorageEntry) protectedStorageEntry), sender); } else { broadcaster.broadcast(new RemoveDataMessage(protectedStorageEntry), sender); } - + return true; } } diff --git a/p2p/src/main/java/haveno/network/p2p/storage/persistence/AppendOnlyDataStoreService.java b/p2p/src/main/java/haveno/network/p2p/storage/persistence/AppendOnlyDataStoreService.java index 8f7b2b8027..6aabfe761d 100644 --- a/p2p/src/main/java/haveno/network/p2p/storage/persistence/AppendOnlyDataStoreService.java +++ b/p2p/src/main/java/haveno/network/p2p/storage/persistence/AppendOnlyDataStoreService.java @@ -18,18 +18,21 @@ package haveno.network.p2p.storage.persistence; import com.google.common.annotations.VisibleForTesting; -import com.google.inject.Inject; import haveno.network.p2p.storage.P2PDataStorage; import haveno.network.p2p.storage.payload.PersistableNetworkPayload; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; + +import org.jetbrains.annotations.NotNull; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import org.jetbrains.annotations.NotNull; /** * Used for PersistableNetworkPayload data which gets appended to a map storage. diff --git a/p2p/src/main/java/haveno/network/p2p/storage/persistence/ProtectedDataStoreService.java b/p2p/src/main/java/haveno/network/p2p/storage/persistence/ProtectedDataStoreService.java index 8b36b416d7..8e1291b274 100644 --- a/p2p/src/main/java/haveno/network/p2p/storage/persistence/ProtectedDataStoreService.java +++ b/p2p/src/main/java/haveno/network/p2p/storage/persistence/ProtectedDataStoreService.java @@ -18,17 +18,18 @@ package haveno.network.p2p.storage.persistence; import com.google.common.annotations.VisibleForTesting; -import com.google.inject.Inject; import haveno.common.proto.persistable.PersistableEnvelope; import haveno.network.p2p.storage.P2PDataStorage; import haveno.network.p2p.storage.payload.ProtectedStorageEntry; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; -import lombok.extern.slf4j.Slf4j; /** * Used for data which can be added and removed. ProtectedStorageEntry is used for verifying ownership. diff --git a/p2p/src/main/java/haveno/network/p2p/storage/persistence/RemovedPayloadsService.java b/p2p/src/main/java/haveno/network/p2p/storage/persistence/RemovedPayloadsService.java index e7c17ce8a7..902ae73fb9 100644 --- a/p2p/src/main/java/haveno/network/p2p/storage/persistence/RemovedPayloadsService.java +++ b/p2p/src/main/java/haveno/network/p2p/storage/persistence/RemovedPayloadsService.java @@ -17,14 +17,15 @@ package haveno.network.p2p.storage.persistence; -import com.google.inject.Inject; -import com.google.inject.Singleton; import haveno.common.persistence.PersistenceManager; import haveno.common.proto.persistable.PersistedDataHost; import haveno.network.p2p.storage.P2PDataStorage; import haveno.network.p2p.storage.payload.MailboxStoragePayload; import lombok.extern.slf4j.Slf4j; +import javax.inject.Inject; +import javax.inject.Singleton; + /** * We persist the hashes and timestamp when a AddOncePayload payload got removed. This protects that it could be * added again for instance if the sequence number map would be inconsistent/deleted or when we receive data from diff --git a/p2p/src/main/java/haveno/network/p2p/storage/persistence/ResourceDataStoreService.java b/p2p/src/main/java/haveno/network/p2p/storage/persistence/ResourceDataStoreService.java index a081733e2e..b10573c8cb 100644 --- a/p2p/src/main/java/haveno/network/p2p/storage/persistence/ResourceDataStoreService.java +++ b/p2p/src/main/java/haveno/network/p2p/storage/persistence/ResourceDataStoreService.java @@ -18,12 +18,13 @@ package haveno.network.p2p.storage.persistence; import com.google.common.annotations.VisibleForTesting; -import com.google.inject.Inject; import haveno.common.proto.persistable.PersistableEnvelope; +import lombok.extern.slf4j.Slf4j; + +import javax.inject.Inject; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; -import lombok.extern.slf4j.Slf4j; /** * Used for handling data from resource files. diff --git a/scripts/install_java.bat b/scripts/install_java.bat index 3364679050..b53b087917 100644 --- a/scripts/install_java.bat +++ b/scripts/install_java.bat @@ -25,9 +25,9 @@ cd /D "%~dp0" title Install Java -set jdk_version=20.0.1 +set jdk_version=11.0.2 set jdk_filename=openjdk-%jdk_version%_windows-x64_bin -set jdk_url=https://download.java.net/java/GA/jdk20.0.1/b4887098932d415489976708ad6d1a4b/9/GPL/openjdk-20.0.1_windows-x64_bin.zip +set jdk_url=https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_windows-x64_bin.zip if exist "%PROGRAMFILES%\Java\openjdk\jdk-%jdk_version%" ( echo %PROGRAMFILES%\Java\openjdk\jdk-%jdk_version% already exists, skipping install diff --git a/scripts/install_java.sh b/scripts/install_java.sh index 6ffb7eb4fa..d14214b9f7 100755 --- a/scripts/install_java.sh +++ b/scripts/install_java.sh @@ -15,9 +15,9 @@ set -e unameOut="$(uname -s)" case "${unameOut}" in Linux*) - JAVA_HOME=/usr/lib/jvm/openjdk-20.0.1 - JDK_FILENAME=openjdk-20.0.1_linux-x64_bin.tar.gz - JDK_URL=https://download.java.net/java/GA/jdk20.0.1/b4887098932d415489976708ad6d1a4b/9/GPL/openjdk-20.0.1_linux-x64_bin.tar.gz + JAVA_HOME=/usr/lib/jvm/openjdk-11.0.2 + JDK_FILENAME=openjdk-11.0.2_linux-x64_bin.tar.gz + JDK_URL=https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz # Determine which package manager to use depending on the distribution declare -A osInfo; @@ -52,9 +52,9 @@ case "${unameOut}" in update-alternatives --set javac $JAVA_HOME/bin/javac ;; Darwin*) - JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk-20.0.1.jdk/Contents/Home - JDK_FILENAME=openjdk-20.0.1_macos-x64_bin.tar.gz - JDK_URL=https://download.java.net/java/GA/jdk20.0.1/b4887098932d415489976708ad6d1a4b/9/GPL/openjdk-20.0.1_macos-x64_bin.tar.gz + JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home + JDK_FILENAME=openjdk-11.0.2_osx-x64_bin.tar.gz + JDK_URL=https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_osx-x64_bin.tar.gz if [ ! -d "$JAVA_HOME" ]; then if [[ $(command -v brew) == "" ]]; then echo "Installing Homebrew" @@ -66,10 +66,10 @@ case "${unameOut}" in brew install curl curl -L -O $JDK_URL - sudo mkdir /Library/Java/JavaVirtualMachines/openjdk-20.0.1.jdk | sudo bash + sudo mkdir /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk | sudo bash gunzip -c $JDK_FILENAME | tar xopf - - sudo mv jdk-20.0.1.jdk/* /Library/Java/JavaVirtualMachines/openjdk-20.0.1.jdk - sudo rmdir jdk-20.0.1.jdk + sudo mv jdk-11.0.2.jdk/* /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk + sudo rmdir jdk-11.0.2.jdk rm $JDK_FILENAME fi