diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf12e778f8..5c3322306f 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 11 + - name: Set up JDK 20 uses: actions/setup-java@v3 with: - java-version: '11' + java-version: '20' distribution: 'adopt' cache: gradle - name: Build with Gradle diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 2cebc57e9e..972fd2da3a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -35,6 +35,13 @@ 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 66f702c248..a43fe881e7 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@v2 + uses: peter-evans/create-or-update-comment@v3 if: github.event.label.name == '💰bounty' with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.gradle b/build.gradle index cccf3de77c..77127f7cef 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.12.4' // added for windows build verification-metadata.xml error + classpath 'com.gradle:gradle-enterprise-gradle-plugin:3.13.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 = '30.1.1-jre' - guiceVersion = '4.2.2' + guavaVersion = '32.1.1-jre' + guiceVersion = '7.0.0' 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 b810b367a5..047b0b1d39 100644 --- a/common/src/main/java/haveno/common/ClockWatcher.java +++ b/common/src/main/java/haveno/common/ClockWatcher.java @@ -17,12 +17,11 @@ package haveno.common; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Singleton; +import com.google.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 e03fc1969a..b103d76cd9 100644 --- a/common/src/main/java/haveno/common/crypto/KeyRing.java +++ b/common/src/main/java/haveno/common/crypto/KeyRing.java @@ -17,16 +17,15 @@ 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 4acc01662a..b5b81dcfec 100644 --- a/common/src/main/java/haveno/common/crypto/KeyStorage.java +++ b/common/src/main/java/haveno/common/crypto/KeyStorage.java @@ -18,15 +18,11 @@ 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 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 static haveno.common.util.Preconditions.checkDir; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -48,8 +44,10 @@ import java.security.spec.InvalidKeySpecException; import java.security.spec.KeySpec; import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.RSAPublicKeySpec; - -import static haveno.common.util.Preconditions.checkDir; +import javax.crypto.SecretKey; +import org.jetbrains.annotations.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * 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 76cce42779..25db77e7ad 100644 --- a/common/src/main/java/haveno/common/file/CorruptedStorageFileHandler.java +++ b/common/src/main/java/haveno/common/file/CorruptedStorageFileHandler.java @@ -17,13 +17,12 @@ package haveno.common.file; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.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 7bdb4cb1e7..42d0adbb7a 100644 --- a/common/src/main/java/haveno/common/persistence/PersistenceManager.java +++ b/common/src/main/java/haveno/common/persistence/PersistenceManager.java @@ -17,7 +17,9 @@ 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; @@ -30,13 +32,9 @@ 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.SingleThreadExecutorUtils; import haveno.common.util.GcUtil; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; - -import javax.annotation.Nullable; -import javax.inject.Named; +import static haveno.common.util.Preconditions.checkDir; +import haveno.common.util.SingleThreadExecutorUtils; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; @@ -51,9 +49,9 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; - -import static com.google.common.base.Preconditions.checkNotNull; -import static haveno.common.util.Preconditions.checkDir; +import javax.annotation.Nullable; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; /** * 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 b40a7fb0e8..e88142a2af 100644 --- a/core/src/main/java/haveno/core/account/sign/SignedWitnessService.java +++ b/core/src/main/java/haveno/core/account/sign/SignedWitnessService.java @@ -19,6 +19,7 @@ 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; @@ -34,12 +35,6 @@ 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; @@ -57,6 +52,10 @@ 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 304ff09759..f8a7c57251 100644 --- a/core/src/main/java/haveno/core/account/sign/SignedWitnessStorageService.java +++ b/core/src/main/java/haveno/core/account/sign/SignedWitnessStorageService.java @@ -17,17 +17,16 @@ 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 27560f1576..fa1f61e94a 100644 --- a/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessService.java +++ b/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessService.java @@ -18,6 +18,8 @@ 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; @@ -51,12 +53,6 @@ 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; @@ -74,8 +70,10 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.Stream; - -import static com.google.common.base.Preconditions.checkNotNull; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import org.bitcoinj.core.ECKey; +import org.bitcoinj.core.Utils; @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 2c4c95287c..180f216635 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,14 @@ 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 lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; -import javax.inject.Named; import java.io.File; +import lombok.extern.slf4j.Slf4j; @Slf4j public class AccountAgeWitnessStorageService extends HistoricalDataStoreService { diff --git a/core/src/main/java/haveno/core/alert/AlertManager.java b/core/src/main/java/haveno/core/alert/AlertManager.java index 7aab57301c..ac9f5f4b73 100644 --- a/core/src/main/java/haveno/core/alert/AlertManager.java +++ b/core/src/main/java/haveno/core/alert/AlertManager.java @@ -18,6 +18,8 @@ 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; @@ -26,22 +28,18 @@ 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 ef0d885b0e..c42aec6ed0 100644 --- a/core/src/main/java/haveno/core/alert/PrivateNotificationManager.java +++ b/core/src/main/java/haveno/core/alert/PrivateNotificationManager.java @@ -22,6 +22,8 @@ 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; @@ -37,25 +39,21 @@ 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 7f24c06c38..77ed597eee 100644 --- a/core/src/main/java/haveno/core/api/CoreAccountService.java +++ b/core/src/main/java/haveno/core/api/CoreAccountService.java @@ -17,6 +17,9 @@ 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; @@ -24,12 +27,6 @@ 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; @@ -37,8 +34,9 @@ import java.io.PipedOutputStream; import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; - -import static com.google.common.base.Preconditions.checkState; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; /** * 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 99515019ca..1bd40ce25d 100644 --- a/core/src/main/java/haveno/core/api/CoreApi.java +++ b/core/src/main/java/haveno/core/api/CoreApi.java @@ -17,6 +17,8 @@ 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; @@ -45,15 +47,6 @@ 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; @@ -63,6 +56,12 @@ 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 c22a10705c..3d6d036602 100644 --- a/core/src/main/java/haveno/core/api/CoreContext.java +++ b/core/src/main/java/haveno/core/api/CoreContext.java @@ -17,13 +17,12 @@ 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 c069268583..9bae2d68a4 100644 --- a/core/src/main/java/haveno/core/api/CoreDisputeAgentsService.java +++ b/core/src/main/java/haveno/core/api/CoreDisputeAgentsService.java @@ -17,11 +17,17 @@ 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; @@ -32,24 +38,16 @@ import haveno.core.user.User; import haveno.core.xmr.wallet.XmrWalletService; import haveno.network.p2p.NodeAddress; import haveno.network.p2p.P2PService; -import lombok.extern.slf4j.Slf4j; -import org.bitcoinj.core.ECKey; - -import javax.inject.Inject; -import javax.inject.Singleton; +import static java.lang.String.format; +import static java.net.InetAddress.getLoopbackAddress; 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 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; +import lombok.extern.slf4j.Slf4j; +import org.bitcoinj.core.ECKey; @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 ed4813e041..7e66cc2fb9 100644 --- a/core/src/main/java/haveno/core/api/CoreDisputesService.java +++ b/core/src/main/java/haveno/core/api/CoreDisputesService.java @@ -1,5 +1,8 @@ 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; @@ -23,18 +26,13 @@ import haveno.core.trade.TradeManager; import haveno.core.util.FormattingUtils; import haveno.core.util.coin.CoinFormatter; import haveno.core.xmr.wallet.XmrWalletService; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; -import javax.inject.Singleton; +import static java.lang.String.format; import java.math.BigInteger; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Optional; - -import static com.google.common.base.Preconditions.checkNotNull; -import static java.lang.String.format; +import lombok.extern.slf4j.Slf4j; @Singleton diff --git a/core/src/main/java/haveno/core/api/CoreHelpService.java b/core/src/main/java/haveno/core/api/CoreHelpService.java index e56ccd48d6..2002313a8e 100644 --- a/core/src/main/java/haveno/core/api/CoreHelpService.java +++ b/core/src/main/java/haveno/core/api/CoreHelpService.java @@ -17,18 +17,16 @@ package haveno.core.api; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.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 1b6401bf32..22c67f10ea 100644 --- a/core/src/main/java/haveno/core/api/CoreMoneroConnectionsService.java +++ b/core/src/main/java/haveno/core/api/CoreMoneroConnectionsService.java @@ -1,18 +1,24 @@ 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.XmrNodesSetupPreferences; import haveno.core.xmr.nodes.XmrNodes.XmrNode; +import haveno.core.xmr.nodes.XmrNodesSetupPreferences; 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; @@ -32,13 +38,6 @@ 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 { @@ -555,7 +554,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 23530ae728..6dd103c9d5 100644 --- a/core/src/main/java/haveno/core/api/CoreMoneroNodeService.java +++ b/core/src/main/java/haveno/core/api/CoreMoneroNodeService.java @@ -16,23 +16,22 @@ */ 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 f7646a5758..fe7d345958 100644 --- a/core/src/main/java/haveno/core/api/CoreNotificationService.java +++ b/core/src/main/java/haveno/core/api/CoreNotificationService.java @@ -1,17 +1,16 @@ 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 bfc087f870..e79d8193bc 100644 --- a/core/src/main/java/haveno/core/api/CoreOffersService.java +++ b/core/src/main/java/haveno/core/api/CoreOffersService.java @@ -17,8 +17,13 @@ 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; @@ -27,37 +32,30 @@ 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 lombok.extern.slf4j.Slf4j; -import org.bitcoinj.core.Transaction; - -import javax.inject.Inject; -import javax.inject.Singleton; +import static java.lang.String.format; 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 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; +import lombok.extern.slf4j.Slf4j; +import org.bitcoinj.core.Transaction; @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 6a6f2e87bb..73ab2a6a0a 100644 --- a/core/src/main/java/haveno/core/api/CorePaymentAccountsService.java +++ b/core/src/main/java/haveno/core/api/CorePaymentAccountsService.java @@ -17,13 +17,18 @@ 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; @@ -32,21 +37,14 @@ 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 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; +import lombok.extern.slf4j.Slf4j; @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 27cf3b46aa..99c8326411 100644 --- a/core/src/main/java/haveno/core/api/CorePriceService.java +++ b/core/src/main/java/haveno/core/api/CorePriceService.java @@ -18,6 +18,8 @@ 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; @@ -27,16 +29,13 @@ 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 db9f066641..bb130abba8 100644 --- a/core/src/main/java/haveno/core/api/CoreTradesService.java +++ b/core/src/main/java/haveno/core/api/CoreTradesService.java @@ -17,6 +17,8 @@ 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; @@ -34,20 +36,16 @@ 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 lombok.extern.slf4j.Slf4j; -import org.bitcoinj.core.Coin; - -import javax.inject.Inject; -import javax.inject.Singleton; +import static java.lang.String.format; import java.math.BigInteger; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.function.Consumer; - -import static haveno.core.xmr.model.AddressEntry.Context.TRADE_PAYOUT; -import static java.lang.String.format; +import lombok.extern.slf4j.Slf4j; +import org.bitcoinj.core.Coin; @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 65513de865..5f0f615ce1 100644 --- a/core/src/main/java/haveno/core/api/CoreWalletsService.java +++ b/core/src/main/java/haveno/core/api/CoreWalletsService.java @@ -20,6 +20,9 @@ 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; @@ -29,13 +32,22 @@ 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; @@ -47,20 +59,6 @@ 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 94767beb0e..503795f051 100644 --- a/core/src/main/java/haveno/core/app/AppStartupState.java +++ b/core/src/main/java/haveno/core/app/AppStartupState.java @@ -17,6 +17,8 @@ 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; @@ -28,9 +30,6 @@ 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 d1f1c49369..410772cffa 100644 --- a/core/src/main/java/haveno/core/app/AvoidStandbyModeService.java +++ b/core/src/main/java/haveno/core/app/AvoidStandbyModeService.java @@ -17,21 +17,13 @@ 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; @@ -43,6 +35,13 @@ 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 7918ebc739..6383999dc7 100644 --- a/core/src/main/java/haveno/core/app/DomainInitialisation.java +++ b/core/src/main/java/haveno/core/app/DomainInitialisation.java @@ -17,6 +17,7 @@ package haveno.core.app; +import com.google.inject.Inject; import haveno.common.ClockWatcher; import haveno.common.persistence.PersistenceManager; import haveno.core.account.sign.SignedWitnessService; @@ -51,8 +52,6 @@ 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 d25e4ffed9..9679ed51e2 100644 --- a/core/src/main/java/haveno/core/app/HavenoSetup.java +++ b/core/src/main/java/haveno/core/app/HavenoSetup.java @@ -17,6 +17,9 @@ 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; @@ -62,23 +65,6 @@ 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; @@ -93,6 +79,19 @@ 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 bd52aab41c..6c9a8e521c 100644 --- a/core/src/main/java/haveno/core/app/P2PNetworkSetup.java +++ b/core/src/main/java/haveno/core/app/P2PNetworkSetup.java @@ -17,6 +17,8 @@ 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; @@ -27,20 +29,17 @@ 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 8976a10e04..51f453e961 100644 --- a/core/src/main/java/haveno/core/app/TorSetup.java +++ b/core/src/main/java/haveno/core/app/TorSetup.java @@ -17,20 +17,18 @@ 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 lombok.extern.slf4j.Slf4j; - -import javax.annotation.Nullable; -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; +import static haveno.common.util.Preconditions.checkDir; import java.io.File; import java.io.IOException; import java.nio.file.Paths; - -import static haveno.common.util.Preconditions.checkDir; +import javax.annotation.Nullable; +import lombok.extern.slf4j.Slf4j; @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 cc8959ebd8..768e541c4f 100644 --- a/core/src/main/java/haveno/core/app/WalletAppSetup.java +++ b/core/src/main/java/haveno/core/app/WalletAppSetup.java @@ -17,6 +17,8 @@ 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; @@ -30,6 +32,8 @@ 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; @@ -38,10 +42,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; @@ -49,12 +53,6 @@ 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 8ba2e88326..b3b9f550d2 100644 --- a/core/src/main/java/haveno/core/app/misc/AppSetup.java +++ b/core/src/main/java/haveno/core/app/misc/AppSetup.java @@ -17,12 +17,11 @@ 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 87e1100b90..bab66d605a 100644 --- a/core/src/main/java/haveno/core/app/misc/AppSetupWithP2P.java +++ b/core/src/main/java/haveno/core/app/misc/AppSetupWithP2P.java @@ -17,6 +17,7 @@ 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; @@ -31,13 +32,11 @@ 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 292085ecc8..07b44a13cb 100644 --- a/core/src/main/java/haveno/core/app/misc/AppSetupWithP2PAndDAO.java +++ b/core/src/main/java/haveno/core/app/misc/AppSetupWithP2PAndDAO.java @@ -17,6 +17,7 @@ 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; @@ -27,8 +28,6 @@ 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 169b209443..00e17c5a29 100644 --- a/core/src/main/java/haveno/core/filter/FilterManager.java +++ b/core/src/main/java/haveno/core/filter/FilterManager.java @@ -17,6 +17,9 @@ 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; @@ -35,16 +38,6 @@ 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; @@ -58,9 +51,14 @@ import java.util.List; import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; import java.util.function.Consumer; - -import static com.google.common.base.Preconditions.checkNotNull; +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 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 ef4406d114..e5ebc9a4d9 100644 --- a/core/src/main/java/haveno/core/network/CoreBanFilter.java +++ b/core/src/main/java/haveno/core/network/CoreBanFilter.java @@ -17,17 +17,16 @@ 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 7d343a179d..b923e655af 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,6 +20,8 @@ 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; @@ -37,13 +39,10 @@ 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 6b109c89bc..d3c3c1cf40 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,16 +17,15 @@ 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 ce2e1be653..48dfd1dc44 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,13 +17,11 @@ 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; @@ -35,6 +33,7 @@ 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 a2afc95e37..594343fab0 100644 --- a/core/src/main/java/haveno/core/notifications/MobileMessageEncryption.java +++ b/core/src/main/java/haveno/core/notifications/MobileMessageEncryption.java @@ -18,16 +18,15 @@ package haveno.core.notifications; import com.google.common.base.Charsets; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.codec.binary.Base64; - +import com.google.inject.Inject; +import com.google.inject.Singleton; +import java.security.NoSuchAlgorithmException; import javax.crypto.Cipher; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; -import javax.inject.Inject; -import javax.inject.Singleton; -import java.security.NoSuchAlgorithmException; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.binary.Base64; @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 6adf318db1..b424911fbe 100644 --- a/core/src/main/java/haveno/core/notifications/MobileModel.java +++ b/core/src/main/java/haveno/core/notifications/MobileModel.java @@ -18,15 +18,14 @@ 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 c222f3b704..d65fdbe82e 100644 --- a/core/src/main/java/haveno/core/notifications/MobileNotificationService.java +++ b/core/src/main/java/haveno/core/notifications/MobileNotificationService.java @@ -17,6 +17,8 @@ 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; @@ -25,12 +27,15 @@ 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; @@ -38,13 +43,6 @@ 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 0004defa41..456cf17f30 100644 --- a/core/src/main/java/haveno/core/notifications/MobileNotificationValidator.java +++ b/core/src/main/java/haveno/core/notifications/MobileNotificationValidator.java @@ -17,11 +17,10 @@ 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 41e890edbd..ea9a73e9b1 100644 --- a/core/src/main/java/haveno/core/notifications/alerts/DisputeMsgEvents.java +++ b/core/src/main/java/haveno/core/notifications/alerts/DisputeMsgEvents.java @@ -17,6 +17,8 @@ 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; @@ -27,14 +29,11 @@ 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 1424be3ef1..431e34804c 100644 --- a/core/src/main/java/haveno/core/notifications/alerts/MyOfferTakenEvents.java +++ b/core/src/main/java/haveno/core/notifications/alerts/MyOfferTakenEvents.java @@ -17,19 +17,18 @@ 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 aa9d8eeb69..92c0c9760c 100644 --- a/core/src/main/java/haveno/core/notifications/alerts/TradeEvents.java +++ b/core/src/main/java/haveno/core/notifications/alerts/TradeEvents.java @@ -17,6 +17,8 @@ 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; @@ -24,14 +26,11 @@ 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 07fc7fb848..1790fc56db 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,6 +17,8 @@ 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; @@ -34,12 +36,9 @@ 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 684533a498..7f369c11da 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,6 +17,8 @@ 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; @@ -31,9 +33,6 @@ 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 2b60736099..141a7e2b9c 100644 --- a/core/src/main/java/haveno/core/offer/CreateOfferService.java +++ b/core/src/main/java/haveno/core/offer/CreateOfferService.java @@ -17,6 +17,8 @@ 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; @@ -38,15 +40,12 @@ 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 42f07ad71c..4668717fac 100644 --- a/core/src/main/java/haveno/core/offer/OfferBookService.java +++ b/core/src/main/java/haveno/core/offer/OfferBookService.java @@ -17,6 +17,8 @@ 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; @@ -34,15 +36,6 @@ 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; @@ -50,6 +43,12 @@ 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 1339f315c8..5949ba9be0 100644 --- a/core/src/main/java/haveno/core/offer/OfferFilterService.java +++ b/core/src/main/java/haveno/core/offer/OfferFilterService.java @@ -17,6 +17,8 @@ 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; @@ -28,18 +30,15 @@ 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 64e9f9b25c..1c74683d86 100644 --- a/core/src/main/java/haveno/core/offer/OfferUtil.java +++ b/core/src/main/java/haveno/core/offer/OfferUtil.java @@ -17,9 +17,15 @@ 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; @@ -28,8 +34,16 @@ import haveno.core.locale.Res; import haveno.core.monetary.Price; import haveno.core.monetary.TraditionalMoney; import haveno.core.monetary.Volume; -import haveno.core.payment.PayByMailAccount; +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.PaymentAccount; import haveno.core.provider.price.MarketPrice; import haveno.core.provider.price.PriceFeedService; @@ -38,34 +52,18 @@ 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 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; +import lombok.extern.slf4j.Slf4j; +import org.bitcoinj.core.Transaction; +import org.bitcoinj.core.TransactionInput; +import org.bitcoinj.core.TransactionOutput; /** * 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 29f0cbb7bc..b7f8eb4a61 100644 --- a/core/src/main/java/haveno/core/offer/OpenOfferManager.java +++ b/core/src/main/java/haveno/core/offer/OpenOfferManager.java @@ -17,6 +17,8 @@ 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; @@ -72,8 +74,22 @@ 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; @@ -90,24 +106,6 @@ 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); @@ -802,13 +800,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) { @@ -841,7 +839,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe } } } else { - + // handle sufficient balance boolean hasSufficientBalance = xmrWalletService.getWallet().getUnlockedBalance(0).compareTo(offerReserveAmount) >= 0; if (hasSufficientBalance) { @@ -851,7 +849,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 37ebdaaf4f..578140d9bf 100644 --- a/core/src/main/java/haveno/core/offer/TriggerPriceService.java +++ b/core/src/main/java/haveno/core/offer/TriggerPriceService.java @@ -17,7 +17,11 @@ 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; @@ -27,20 +31,14 @@ 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 static haveno.common.util.MathUtils.roundDoubleToLong; -import static haveno.common.util.MathUtils.scaleUpByPowerOf10; +import javafx.collections.ListChangeListener; +import lombok.extern.slf4j.Slf4j; @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 f97839c944..4df367d4a1 100644 --- a/core/src/main/java/haveno/core/offer/takeoffer/TakeOfferModel.java +++ b/core/src/main/java/haveno/core/offer/takeoffer/TakeOfferModel.java @@ -17,31 +17,29 @@ 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 ec35030b73..99f12d37fc 100644 --- a/core/src/main/java/haveno/core/payment/ChargeBackRisk.java +++ b/core/src/main/java/haveno/core/payment/ChargeBackRisk.java @@ -17,10 +17,9 @@ 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 e41ec8423f..7acee5d4bc 100644 --- a/core/src/main/java/haveno/core/payment/TradeLimits.java +++ b/core/src/main/java/haveno/core/payment/TradeLimits.java @@ -18,16 +18,15 @@ 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 b6504d351c..cce112b189 100644 --- a/core/src/main/java/haveno/core/payment/validation/AdvancedCashValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/AdvancedCashValidator.java @@ -1,11 +1,10 @@ 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 2a91270bc5..b8c1964e19 100644 --- a/core/src/main/java/haveno/core/payment/validation/AustraliaPayidAccountNameValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/AustraliaPayidAccountNameValidator.java @@ -18,11 +18,10 @@ 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 a156193fce..e18ef0f733 100644 --- a/core/src/main/java/haveno/core/payment/validation/CapitualValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/CapitualValidator.java @@ -1,11 +1,10 @@ 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 48f81024a2..2950b0faf2 100644 --- a/core/src/main/java/haveno/core/payment/validation/FiatVolumeValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/FiatVolumeValidator.java @@ -17,10 +17,9 @@ 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 47841dcc9b..4bae615941 100644 --- a/core/src/main/java/haveno/core/payment/validation/InteracETransferAnswerValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/InteracETransferAnswerValidator.java @@ -1,11 +1,10 @@ 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 6fd7c865f9..2fa0cf8550 100644 --- a/core/src/main/java/haveno/core/payment/validation/InteracETransferQuestionValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/InteracETransferQuestionValidator.java @@ -1,11 +1,10 @@ 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 973f62af60..7af54e8255 100644 --- a/core/src/main/java/haveno/core/payment/validation/InteracETransferValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/InteracETransferValidator.java @@ -17,12 +17,11 @@ 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 1ec805b9f4..f8c71ace9f 100644 --- a/core/src/main/java/haveno/core/payment/validation/JapanBankAccountNameValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/JapanBankAccountNameValidator.java @@ -17,12 +17,11 @@ 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 79650acb53..95573d679e 100644 --- a/core/src/main/java/haveno/core/payment/validation/JapanBankBranchNameValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/JapanBankBranchNameValidator.java @@ -17,12 +17,11 @@ 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 212b8fbd5c..702030074a 100644 --- a/core/src/main/java/haveno/core/payment/validation/SecurityDepositValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/SecurityDepositValidator.java @@ -17,6 +17,7 @@ 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; @@ -24,8 +25,6 @@ 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 ecf0948730..e322aa0ae6 100644 --- a/core/src/main/java/haveno/core/payment/validation/TransferwiseValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/TransferwiseValidator.java @@ -17,10 +17,9 @@ 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 1fa3c1cbc9..28d513668e 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,15 @@ 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 lombok.Getter; -import lombok.Setter; - -import javax.annotation.Nullable; -import javax.inject.Inject; import java.math.BigDecimal; import java.math.BigInteger; +import javax.annotation.Nullable; +import lombok.Getter; +import lombok.Setter; public class XmrValidator extends NumberValidator { diff --git a/core/src/main/java/haveno/core/presentation/BalancePresentation.java b/core/src/main/java/haveno/core/presentation/BalancePresentation.java index 2ef1a22c7e..ea9cc3a4a0 100644 --- a/core/src/main/java/haveno/core/presentation/BalancePresentation.java +++ b/core/src/main/java/haveno/core/presentation/BalancePresentation.java @@ -17,6 +17,7 @@ package haveno.core.presentation; +import com.google.inject.Inject; import haveno.common.UserThread; import haveno.core.trade.HavenoUtils; import haveno.core.xmr.Balances; @@ -25,8 +26,6 @@ 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 652dbf246b..8db7e0e307 100644 --- a/core/src/main/java/haveno/core/presentation/SupportTicketsPresentation.java +++ b/core/src/main/java/haveno/core/presentation/SupportTicketsPresentation.java @@ -17,6 +17,7 @@ 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; @@ -26,8 +27,6 @@ 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 a1d745f497..ccb28ddf51 100644 --- a/core/src/main/java/haveno/core/presentation/TradePresentation.java +++ b/core/src/main/java/haveno/core/presentation/TradePresentation.java @@ -17,6 +17,7 @@ package haveno.core.presentation; +import com.google.inject.Inject; import haveno.common.UserThread; import haveno.core.trade.TradeManager; import javafx.beans.property.BooleanProperty; @@ -25,8 +26,6 @@ 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 3443b150c2..4b947ff1bb 100644 --- a/core/src/main/java/haveno/core/proto/network/CoreNetworkProtoResolver.java +++ b/core/src/main/java/haveno/core/proto/network/CoreNetworkProtoResolver.java @@ -17,6 +17,8 @@ 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; @@ -69,11 +71,8 @@ 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 lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; -import javax.inject.Singleton; import java.time.Clock; +import lombok.extern.slf4j.Slf4j; // TODO Use ProtobufferException instead of ProtobufferRuntimeException @Slf4j 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 53bd30a2be..733872ce9b 100644 --- a/core/src/main/java/haveno/core/proto/persistable/CorePersistenceProtoResolver.java +++ b/core/src/main/java/haveno/core/proto/persistable/CorePersistenceProtoResolver.java @@ -17,7 +17,9 @@ 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; @@ -47,9 +49,6 @@ 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 8ca15c3cab..dc6dc2a155 100644 --- a/core/src/main/java/haveno/core/provider/FeeHttpClient.java +++ b/core/src/main/java/haveno/core/provider/FeeHttpClient.java @@ -17,12 +17,11 @@ 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 70695fdff4..25e2a196f3 100644 --- a/core/src/main/java/haveno/core/provider/MempoolHttpClient.java +++ b/core/src/main/java/haveno/core/provider/MempoolHttpClient.java @@ -17,14 +17,13 @@ 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 javax.annotation.Nullable; -import javax.inject.Inject; -import javax.inject.Singleton; import java.io.IOException; +import javax.annotation.Nullable; @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 2041fe0aa7..f59b118711 100644 --- a/core/src/main/java/haveno/core/provider/PriceHttpClient.java +++ b/core/src/main/java/haveno/core/provider/PriceHttpClient.java @@ -17,12 +17,11 @@ 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 99d7ed767a..1e8ffd1477 100644 --- a/core/src/main/java/haveno/core/provider/ProvidersRepository.java +++ b/core/src/main/java/haveno/core/provider/ProvidersRepository.java @@ -18,17 +18,15 @@ 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 d92dea000f..7f4360a684 100644 --- a/core/src/main/java/haveno/core/provider/mempool/MempoolService.java +++ b/core/src/main/java/haveno/core/provider/mempool/MempoolService.java @@ -22,6 +22,7 @@ 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; @@ -29,16 +30,14 @@ 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 2d9f11756b..f151d630e2 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,12 +17,11 @@ 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 3f507e0a49..9426b9dc5c 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,18 +17,17 @@ 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 46b35a7ed6..4467fc4d3b 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,13 +17,12 @@ 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 37021b9974..db39b914f4 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,12 +17,11 @@ 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 095d80f58f..06db577f1f 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,14 +17,13 @@ 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 e70ec66bf7..a0c9f0acea 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,19 +17,18 @@ 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 1eca8d6924..70b30f15a2 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,12 +17,11 @@ 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 9281234c11..22628af4f1 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,15 @@ 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 lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; -import javax.inject.Singleton; import java.util.List; +import lombok.extern.slf4j.Slf4j; @Slf4j @Singleton 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 6324445bd7..6e26706396 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,13 +17,12 @@ 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 048f529a64..14a20d1469 100644 --- a/core/src/main/java/haveno/core/support/traderchat/TraderChatManager.java +++ b/core/src/main/java/haveno/core/support/traderchat/TraderChatManager.java @@ -17,6 +17,8 @@ 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; @@ -31,13 +33,10 @@ import haveno.core.trade.TradeManager; import haveno.network.p2p.AckMessageSourceType; import haveno.network.p2p.NodeAddress; import haveno.network.p2p.P2PService; -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; +import javafx.collections.ObservableList; +import lombok.extern.slf4j.Slf4j; @Slf4j @Singleton diff --git a/core/src/main/java/haveno/core/trade/CleanupMailboxMessages.java b/core/src/main/java/haveno/core/trade/CleanupMailboxMessages.java index 5fdb2dbd73..04249b7481 100644 --- a/core/src/main/java/haveno/core/trade/CleanupMailboxMessages.java +++ b/core/src/main/java/haveno/core/trade/CleanupMailboxMessages.java @@ -17,6 +17,7 @@ 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; @@ -27,10 +28,8 @@ import haveno.network.p2p.DecryptedMessageWithPubKey; import haveno.network.p2p.P2PService; import haveno.network.p2p.mailbox.MailboxMessage; import haveno.network.p2p.mailbox.MailboxMessageService; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.List; +import lombok.extern.slf4j.Slf4j; //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 eab604b6f6..824aefd3a1 100644 --- a/core/src/main/java/haveno/core/trade/CleanupMailboxMessagesService.java +++ b/core/src/main/java/haveno/core/trade/CleanupMailboxMessagesService.java @@ -17,6 +17,7 @@ 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; @@ -27,10 +28,8 @@ import haveno.network.p2p.DecryptedMessageWithPubKey; import haveno.network.p2p.P2PService; import haveno.network.p2p.mailbox.MailboxMessage; import haveno.network.p2p.mailbox.MailboxMessageService; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.List; +import lombok.extern.slf4j.Slf4j; //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 5f8ca1211e..9074032ba0 100644 --- a/core/src/main/java/haveno/core/trade/ClosedTradableFormatter.java +++ b/core/src/main/java/haveno/core/trade/ClosedTradableFormatter.java @@ -17,23 +17,14 @@ 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; @@ -42,10 +33,17 @@ 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 52bfdad392..798887be66 100644 --- a/core/src/main/java/haveno/core/trade/TradeManager.java +++ b/core/src/main/java/haveno/core/trade/TradeManager.java @@ -17,8 +17,10 @@ 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; @@ -74,25 +76,6 @@ 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; @@ -106,9 +89,23 @@ import java.util.UUID; import java.util.concurrent.atomic.AtomicReference; 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; +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; public class TradeManager implements PersistedDataHost, DecryptedDirectMessageListener { @@ -410,7 +407,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()); @@ -442,10 +439,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 @@ -473,7 +470,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 ba57166bba..761d203400 100644 --- a/core/src/main/java/haveno/core/trade/TradeUtil.java +++ b/core/src/main/java/haveno/core/trade/TradeUtil.java @@ -17,24 +17,22 @@ 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 haveno.core.locale.Res; -import haveno.core.offer.Offer; -import haveno.core.xmr.wallet.BtcWalletService; -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 static com.google.common.base.Preconditions.checkNotNull; 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 java.util.Date; +import java.util.Objects; +import javax.annotation.Nullable; +import lombok.extern.slf4j.Slf4j; /** * 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 ce5103a702..3447d803f2 100644 --- a/core/src/main/java/haveno/core/trade/protocol/ProcessModelServiceProvider.java +++ b/core/src/main/java/haveno/core/trade/protocol/ProcessModelServiceProvider.java @@ -17,6 +17,7 @@ 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; @@ -33,8 +34,6 @@ 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 976432b9cc..61369115c7 100644 --- a/core/src/main/java/haveno/core/trade/statistics/ReferralIdService.java +++ b/core/src/main/java/haveno/core/trade/statistics/ReferralIdService.java @@ -17,12 +17,11 @@ 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 deb01a1482..76bc90dc67 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,15 @@ 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 lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; import java.io.File; +import lombok.extern.slf4j.Slf4j; @Singleton @Slf4j 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 9e762a8e43..fc3e60a4e0 100644 --- a/core/src/main/java/haveno/core/trade/statistics/TradeStatisticsManager.java +++ b/core/src/main/java/haveno/core/trade/statistics/TradeStatisticsManager.java @@ -18,6 +18,8 @@ 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; @@ -30,13 +32,6 @@ 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; @@ -44,6 +39,10 @@ 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 8cccce0e0d..481280b44c 100644 --- a/core/src/main/java/haveno/core/user/Preferences.java +++ b/core/src/main/java/haveno/core/user/Preferences.java @@ -17,6 +17,10 @@ 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; @@ -26,16 +30,23 @@ 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.XmrNodes; import haveno.core.xmr.nodes.LocalBitcoinNode; +import haveno.core.xmr.nodes.XmrNodes; 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; @@ -44,26 +55,13 @@ 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 4a5e6cd56f..626272cea1 100644 --- a/core/src/main/java/haveno/core/user/User.java +++ b/core/src/main/java/haveno/core/user/User.java @@ -17,6 +17,9 @@ 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; @@ -31,26 +34,21 @@ 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 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 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; +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; /** * The User is persisted locally. diff --git a/core/src/main/java/haveno/core/util/PriceUtil.java b/core/src/main/java/haveno/core/util/PriceUtil.java index c1892fc0a5..f4a5abbad3 100644 --- a/core/src/main/java/haveno/core/util/PriceUtil.java +++ b/core/src/main/java/haveno/core/util/PriceUtil.java @@ -17,6 +17,9 @@ 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; @@ -29,17 +32,12 @@ 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 lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; -import javax.inject.Singleton; +import haveno.core.util.validation.NonFiatPriceValidator; import java.util.Optional; - -import static com.google.common.base.Preconditions.checkNotNull; +import lombok.extern.slf4j.Slf4j; @Slf4j @Singleton 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 a685efab10..ca8999eea8 100644 --- a/core/src/main/java/haveno/core/util/coin/ImmutableCoinFormatter.java +++ b/core/src/main/java/haveno/core/util/coin/ImmutableCoinFormatter.java @@ -17,14 +17,13 @@ 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 c187a7f199..7085ab0c1f 100644 --- a/core/src/main/java/haveno/core/util/validation/BtcAddressValidator.java +++ b/core/src/main/java/haveno/core/util/validation/BtcAddressValidator.java @@ -17,13 +17,12 @@ 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 d14db6fa92..5192b234d7 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 javax.inject.Inject; +import com.google.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 a28e6cbbf0..516ddeb58c 100644 --- a/core/src/main/java/haveno/core/util/validation/MonetaryValidator.java +++ b/core/src/main/java/haveno/core/util/validation/MonetaryValidator.java @@ -17,10 +17,9 @@ 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 6e154c8bf7..2db07e9db1 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 javax.inject.Inject; +import com.google.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 be607c0268..c097187119 100644 --- a/core/src/main/java/haveno/core/xmr/Balances.java +++ b/core/src/main/java/haveno/core/xmr/Balances.java @@ -17,6 +17,7 @@ package haveno.core.xmr; +import com.google.inject.Inject; import haveno.core.offer.OfferPayload; import haveno.core.offer.OpenOffer; import haveno.core.offer.OpenOfferManager; @@ -29,6 +30,9 @@ 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; @@ -40,11 +44,6 @@ 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 9ace577e6b..472abe4001 100644 --- a/core/src/main/java/haveno/core/xmr/model/EncryptedConnectionList.java +++ b/core/src/main/java/haveno/core/xmr/model/EncryptedConnectionList.java @@ -1,5 +1,6 @@ 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; @@ -10,12 +11,6 @@ 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; @@ -28,6 +23,10 @@ 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 6d17da513f..7a3997f2da 100644 --- a/core/src/main/java/haveno/core/xmr/nodes/LocalBitcoinNode.java +++ b/core/src/main/java/haveno/core/xmr/nodes/LocalBitcoinNode.java @@ -1,16 +1,15 @@ 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 b7a884dae4..243a2519e2 100644 --- a/core/src/main/java/haveno/core/xmr/wallet/BtcWalletService.java +++ b/core/src/main/java/haveno/core/xmr/wallet/BtcWalletService.java @@ -18,6 +18,9 @@ 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; @@ -27,6 +30,13 @@ 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; @@ -46,18 +56,6 @@ 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 8f3f5eeb0e..4edaf9ef37 100644 --- a/core/src/main/java/haveno/core/xmr/wallet/NonBsqCoinSelector.java +++ b/core/src/main/java/haveno/core/xmr/wallet/NonBsqCoinSelector.java @@ -17,6 +17,7 @@ package haveno.core.xmr.wallet; +import com.google.inject.Inject; import haveno.core.user.Preferences; import lombok.Setter; import lombok.extern.slf4j.Slf4j; @@ -24,8 +25,6 @@ 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 12dac1aa9f..089d9f7dd3 100644 --- a/core/src/main/java/haveno/core/xmr/wallet/TradeWalletService.java +++ b/core/src/main/java/haveno/core/xmr/wallet/TradeWalletService.java @@ -17,7 +17,10 @@ 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; @@ -29,6 +32,10 @@ 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; @@ -55,15 +62,6 @@ 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 ed4bc13f4f..31b98a0d6b 100644 --- a/core/src/main/java/haveno/core/xmr/wallet/WalletService.java +++ b/core/src/main/java/haveno/core/xmr/wallet/WalletService.java @@ -17,10 +17,13 @@ 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; @@ -29,8 +32,18 @@ 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; @@ -73,21 +86,6 @@ 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 2abe6a8da7..19628e67ea 100644 --- a/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java +++ b/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java @@ -1,8 +1,9 @@ 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; @@ -25,6 +26,25 @@ 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; @@ -50,34 +70,10 @@ 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); @@ -695,7 +691,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(); @@ -706,12 +702,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) { @@ -728,7 +724,7 @@ public class XmrWalletService { } } } - + // register internal listener to notify external listeners wallet.addListener(new XmrWalletListener()); } @@ -747,10 +743,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(); @@ -772,10 +768,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())); @@ -930,7 +926,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 14ce7c2157..6bb5a1ebeb 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcAccountService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcAccountService.java @@ -17,14 +17,25 @@ 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; @@ -45,25 +56,12 @@ 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 99ca4fa868..75d1eef40c 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcDisputeAgentsService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcDisputeAgentsService.java @@ -1,25 +1,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 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 dc0e951242..4ee31e3095 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcDisputesService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcDisputesService.java @@ -1,12 +1,19 @@ 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; @@ -19,21 +26,12 @@ 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 java.util.stream.Collectors; - -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; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; @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 f45bf63587..d0deadd355 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcExceptionHandler.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcExceptionHandler.java @@ -17,18 +17,16 @@ package haveno.daemon.grpc; +import com.google.inject.Inject; +import com.google.inject.Singleton; import io.grpc.Status; -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 static io.grpc.Status.INVALID_ARGUMENT; import static io.grpc.Status.UNKNOWN; +import io.grpc.StatusRuntimeException; +import io.grpc.stub.StreamObserver; +import java.util.function.Function; +import java.util.function.Predicate; +import org.slf4j.Logger; /** * 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 459f59f37e..04aefc0872 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcGetTradeStatisticsService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcGetTradeStatisticsService.java @@ -1,24 +1,22 @@ 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 java.util.stream.Collectors; - -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; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; @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 2abfc11a97..c7e994413b 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcHelpService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcHelpService.java @@ -17,23 +17,21 @@ 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 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 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; @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 4e85d318aa..ed317aac03 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcMoneroConnectionsService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcMoneroConnectionsService.java @@ -17,9 +17,11 @@ 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; @@ -32,6 +34,18 @@ 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; @@ -45,31 +59,15 @@ 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 java.util.stream.Collectors; - -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; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; +import monero.common.MoneroRpcConnection; @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 b08cbe5188..576a31d5b9 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcMoneroNodeService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcMoneroNodeService.java @@ -16,34 +16,32 @@ */ 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 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; +import lombok.extern.slf4j.Slf4j; +import monero.common.MoneroError; @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 23082d0364..410ac270ce 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcNotificationsService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcNotificationsService.java @@ -1,11 +1,15 @@ 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; @@ -13,19 +17,13 @@ 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 61e2905872..f74682507d 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcOffersService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcOffersService.java @@ -17,12 +17,14 @@ 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; @@ -33,20 +35,6 @@ 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; @@ -54,7 +42,17 @@ 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 1d28eb9355..75fde41568 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcPaymentAccountsService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcPaymentAccountsService.java @@ -17,6 +17,7 @@ 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; @@ -27,6 +28,7 @@ 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; @@ -39,25 +41,21 @@ 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 d3617c4060..855cb63c96 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcPriceService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcPriceService.java @@ -17,30 +17,28 @@ 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 c1fbd039db..be66aaea96 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcServer.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcServer.java @@ -17,19 +17,17 @@ 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 lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; -import javax.inject.Singleton; +import static io.grpc.ServerInterceptors.interceptForward; import java.io.IOException; import java.io.UncheckedIOException; - -import static io.grpc.ServerInterceptors.interceptForward; +import lombok.extern.slf4j.Slf4j; @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 000ca3aa3e..1fa70ef80a 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcShutdownService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcShutdownService.java @@ -17,17 +17,15 @@ 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 lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; - import static java.util.concurrent.TimeUnit.MILLISECONDS; +import lombok.extern.slf4j.Slf4j; @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 7e8c1e4198..c06a51c6a1 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcTradesService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcTradesService.java @@ -17,11 +17,14 @@ 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; @@ -38,18 +41,6 @@ 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; @@ -60,8 +51,15 @@ 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 a870047053..dfd4bff750 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcVersionService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcVersionService.java @@ -18,23 +18,21 @@ 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 e12e9a116d..2081aa1271 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/GrpcWalletsService.java +++ b/daemon/src/main/java/haveno/daemon/grpc/GrpcWalletsService.java @@ -17,11 +17,14 @@ 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; @@ -48,21 +51,6 @@ 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; @@ -71,7 +59,17 @@ 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 4eccc52f11..704abd50a0 100644 --- a/daemon/src/main/java/haveno/daemon/grpc/interceptor/PasswordAuthInterceptor.java +++ b/daemon/src/main/java/haveno/daemon/grpc/interceptor/PasswordAuthInterceptor.java @@ -17,18 +17,16 @@ 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 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 io.grpc.StatusRuntimeException; 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 9d049f9bd6..c882d4a236 100644 --- a/desktop/src/main/java/haveno/desktop/Navigation.java +++ b/desktop/src/main/java/haveno/desktop/Navigation.java @@ -18,6 +18,7 @@ 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; @@ -25,17 +26,15 @@ 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 e1f4e6110c..e4efb0b691 100644 --- a/desktop/src/main/java/haveno/desktop/common/fxml/FxmlViewLoader.java +++ b/desktop/src/main/java/haveno/desktop/common/fxml/FxmlViewLoader.java @@ -18,23 +18,21 @@ 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 static com.google.common.base.Preconditions.checkNotNull; +import javafx.fxml.FXMLLoader; +import lombok.extern.slf4j.Slf4j; @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 a09de2d3de..0bba7274ae 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 javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.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 302957ff5e..96e043b4e0 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,10 +19,9 @@ 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 3be68ccded..81966dbf33 100644 --- a/desktop/src/main/java/haveno/desktop/main/MainView.java +++ b/desktop/src/main/java/haveno/desktop/main/MainView.java @@ -17,6 +17,7 @@ package haveno.desktop.main; +import com.google.inject.Inject; import com.jfoenix.controls.JFXBadge; import com.jfoenix.controls.JFXComboBox; import com.jfoenix.controls.JFXProgressBar; @@ -55,6 +56,10 @@ 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; @@ -81,6 +86,10 @@ 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; @@ -93,17 +102,6 @@ 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 13ac1a922c..01b462f1fb 100644 --- a/desktop/src/main/java/haveno/desktop/main/account/AccountView.java +++ b/desktop/src/main/java/haveno/desktop/main/account/AccountView.java @@ -17,6 +17,7 @@ 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; @@ -39,6 +40,7 @@ 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; @@ -50,9 +52,6 @@ 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 bc14e1d6f6..631f8706fa 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,6 +17,7 @@ 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; @@ -27,25 +28,22 @@ 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 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; +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; @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 4dde7eed03..f5516f60e8 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,8 +17,10 @@ package haveno.desktop.main.account.content.cryptoaccounts; -import haveno.asset.CryptoAccountDisclaimer; +import com.google.inject.Inject; +import com.google.inject.name.Named; import haveno.asset.Asset; +import haveno.asset.CryptoAccountDisclaimer; import haveno.asset.coins.Monero; import haveno.common.util.Tuple2; import haveno.common.util.Tuple3; @@ -39,11 +41,17 @@ 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; @@ -52,16 +60,6 @@ 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 10e6d75081..b51484af16 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,6 +17,7 @@ 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; @@ -40,17 +41,25 @@ 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; @@ -66,17 +75,6 @@ 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 332170d3d7..e5ada453a2 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,6 +17,8 @@ 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; @@ -33,6 +35,10 @@ 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; @@ -41,14 +47,6 @@ 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 2e8d3679e2..dbd8464911 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,6 +18,8 @@ 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; @@ -29,7 +31,20 @@ 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; @@ -41,23 +56,6 @@ 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 e06cbf9843..2eac2f6b80 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,6 +17,8 @@ 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; @@ -27,17 +29,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; @@ -74,11 +76,9 @@ 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,6 +93,7 @@ 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; @@ -119,11 +120,19 @@ 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; @@ -135,17 +144,6 @@ 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 2d4f624340..a073c30cf7 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,6 +17,8 @@ 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; @@ -29,6 +31,10 @@ 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; @@ -37,14 +43,6 @@ 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 81aa0d88f1..f709311515 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,15 +18,14 @@ 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 0cfa2524cf..c99890cbf0 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,15 +18,14 @@ 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 1f1ff3512a..ea9b3aa0b6 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,15 +18,14 @@ 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 ec611af0a3..f83e04ac09 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,6 +18,7 @@ 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; @@ -30,8 +31,6 @@ 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 40532baf16..2e79c8faae 100644 --- a/desktop/src/main/java/haveno/desktop/main/debug/DebugView.java +++ b/desktop/src/main/java/haveno/desktop/main/debug/DebugView.java @@ -17,6 +17,7 @@ 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; @@ -40,6 +41,8 @@ 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; @@ -48,11 +51,6 @@ 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 988660bb97..d7599c4aaa 100644 --- a/desktop/src/main/java/haveno/desktop/main/funds/FundsView.java +++ b/desktop/src/main/java/haveno/desktop/main/funds/FundsView.java @@ -17,6 +17,7 @@ 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; @@ -33,8 +34,6 @@ 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 7bc3f900bd..cfdb2dd065 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,6 +17,8 @@ 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; @@ -39,8 +41,17 @@ 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; @@ -70,19 +81,6 @@ 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 0b45de8867..7311e897b8 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,6 +17,8 @@ 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; @@ -40,6 +42,11 @@ 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; @@ -61,14 +68,6 @@ 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 83b7f83162..bac2d986de 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,6 +17,8 @@ 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; @@ -40,6 +42,11 @@ 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; @@ -61,14 +68,6 @@ 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 77b58b7430..69ec01d098 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,11 +17,10 @@ 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 871c0271cb..24c6bae846 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,14 +18,13 @@ 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 5f6334c1b9..661a8aa036 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,6 +17,8 @@ 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; @@ -25,9 +27,6 @@ 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 6bd896acd9..9d7a39f1a5 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,15 @@ 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 monero.wallet.model.MoneroTxWallet; - import javax.annotation.Nullable; -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; +import monero.wallet.model.MoneroTxWallet; @Singleton 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 7beed5d385..5c8209fafb 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,6 +17,7 @@ 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; @@ -37,6 +38,8 @@ 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; @@ -60,10 +63,6 @@ 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 ce58884d71..5fbe8ee4b5 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,6 +17,7 @@ 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; @@ -35,9 +36,15 @@ 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; @@ -48,15 +55,6 @@ 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 c50bc16f63..efd4f519bf 100644 --- a/desktop/src/main/java/haveno/desktop/main/market/MarketView.java +++ b/desktop/src/main/java/haveno/desktop/main/market/MarketView.java @@ -18,6 +18,8 @@ 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; @@ -43,6 +45,8 @@ 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; @@ -54,11 +58,6 @@ 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 134fddf50c..5773cea3b3 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,6 +17,8 @@ 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; @@ -40,8 +42,15 @@ 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; @@ -73,17 +82,6 @@ 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 7a680a68c2..ab2a006c9b 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,6 +17,8 @@ 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; @@ -29,6 +31,8 @@ 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; @@ -40,11 +44,6 @@ 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 3529cb94c4..3c8911929f 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,6 +18,7 @@ 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; @@ -35,15 +36,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.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; @@ -56,6 +48,13 @@ 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 7832ed7d60..aa0463baaf 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,16 +17,14 @@ 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 javafx.scene.control.ToggleButton; - -import javax.inject.Inject; -import javax.inject.Named; - import static haveno.desktop.util.FormBuilder.addSlideToggleButton; +import javafx.scene.control.ToggleButton; @FxmlView public class SpreadViewPaymentMethod extends SpreadView { 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 4553380ee1..484a2b0757 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,6 +17,8 @@ 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; @@ -41,11 +43,20 @@ 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; @@ -84,19 +95,6 @@ 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 5ae1de3268..59f0399394 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/BuyOfferView.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/BuyOfferView.java @@ -17,6 +17,7 @@ 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; @@ -25,8 +26,6 @@ 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 bc758b6e01..825b3db5cb 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferDataModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferDataModel.java @@ -17,7 +17,9 @@ 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; @@ -52,6 +54,16 @@ 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; @@ -70,20 +82,6 @@ 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 8a0b01e1b9..8809c4d3aa 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferViewModel.java @@ -17,6 +17,8 @@ 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; @@ -47,10 +49,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; @@ -62,6 +64,9 @@ 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; @@ -78,13 +83,6 @@ 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 144aee1cf8..22c33d2dab 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/SellOfferView.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/SellOfferView.java @@ -17,6 +17,7 @@ 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; @@ -25,8 +26,6 @@ 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 3e54df3355..81669db644 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,6 +18,7 @@ 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; @@ -33,8 +34,6 @@ 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 6dace11d42..ffc9eab50c 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,6 +18,7 @@ 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; @@ -31,12 +32,10 @@ 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 javafx.collections.FXCollections; -import javafx.collections.ObservableList; - -import javax.inject.Named; import java.util.Objects; import java.util.stream.Collectors; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; @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 00b9d678ff..1a6936d3a7 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,6 +18,7 @@ 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; @@ -27,14 +28,12 @@ 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.NonFiatPriceValidator; import haveno.core.util.validation.FiatPriceValidator; +import haveno.core.util.validation.NonFiatPriceValidator; 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 a058939a51..72183c9bae 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,25 +17,23 @@ 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 static haveno.core.offer.OfferDirection.BUY; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import lombok.extern.slf4j.Slf4j; /** * 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 e6537cfd71..dbdab352a1 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,6 +17,8 @@ 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; @@ -30,9 +32,6 @@ 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 c6fc412aa2..071c340db2 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,6 +18,7 @@ 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; @@ -42,14 +43,12 @@ import haveno.desktop.Navigation; import haveno.desktop.main.offer.OfferViewUtil; import haveno.desktop.util.GUIUtil; import haveno.network.p2p.P2PService; -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; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import org.jetbrains.annotations.NotNull; public class OtherOfferBookViewModel extends OfferBookViewModel { 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 b04f04101d..f6f3ff2362 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,6 +17,8 @@ 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; @@ -30,9 +32,6 @@ 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 8ce52b69ee..14a7e07c01 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,6 +18,7 @@ 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; @@ -37,12 +38,10 @@ 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.function.Predicate; import java.util.stream.Collectors; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; public class TopCryptoOfferBookViewModel extends OfferBookViewModel { 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 697431d5d9..61e2846bd9 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,6 +17,8 @@ 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; @@ -30,9 +32,6 @@ 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 afa2a9d668..5555c9308a 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,6 +18,7 @@ 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; @@ -42,13 +43,11 @@ 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 dfbde8df65..1d3e750bd4 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,38 +17,7 @@ package haveno.desktop.main.offer.signedoffer; -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 com.google.inject.Inject; import haveno.common.util.Utilities; import haveno.core.locale.Res; import haveno.core.offer.SignedOffer; @@ -65,6 +34,27 @@ 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 db6c39d854..5bbf4f9206 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,6 +17,8 @@ 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; @@ -54,6 +56,7 @@ 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; @@ -62,9 +65,27 @@ 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; @@ -93,29 +114,6 @@ 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 6063d4599c..eb8dfe1889 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,6 +17,9 @@ 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; @@ -50,6 +53,8 @@ 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; @@ -62,14 +67,7 @@ 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; @@ -592,7 +590,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 81c81dfc44..33d2600522 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,6 +18,7 @@ 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; @@ -45,19 +46,17 @@ 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 de49b4e1e0..3bf047563e 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,18 +17,16 @@ 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 haveno.desktop.util.Layout; -import javafx.geometry.Insets; - -import javax.inject.Inject; -import java.math.BigInteger; -import java.util.Map; - import static haveno.desktop.util.FormBuilder.addConfirmationLabelLabel; import static haveno.desktop.util.FormBuilder.addTitledGroupBg; +import haveno.desktop.util.Layout; +import java.math.BigInteger; +import java.util.Map; +import javafx.geometry.Insets; 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 51093841b5..70b82d8e3a 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,6 +18,7 @@ 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; @@ -38,8 +39,17 @@ 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; @@ -54,18 +64,6 @@ 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 57cad82c6b..04bdf223a4 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,6 +18,7 @@ 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; @@ -29,6 +30,14 @@ 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; @@ -42,17 +51,6 @@ 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 6d5f217718..75f87aa351 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,7 +18,8 @@ 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; @@ -42,8 +43,17 @@ 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; @@ -58,19 +68,6 @@ 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 4a7cac56ce..09870356bd 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,9 +17,14 @@ 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; @@ -28,13 +33,6 @@ 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 ca8ce6fcfc..9e6c661f40 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,6 +18,7 @@ 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; @@ -29,6 +30,10 @@ 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; @@ -42,13 +47,6 @@ 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 798414900e..0fa83e3320 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,6 +17,8 @@ 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; @@ -34,6 +36,22 @@ 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; @@ -54,26 +72,6 @@ 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 880494b84f..959f619d0f 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,6 +17,7 @@ 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; @@ -28,6 +29,12 @@ 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; @@ -36,15 +43,6 @@ 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 c840a718ec..d3a9051128 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,6 +17,7 @@ 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; @@ -28,6 +29,12 @@ 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; @@ -40,15 +47,6 @@ 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 1899041b3a..e3cc347581 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,6 +18,8 @@ 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; @@ -30,9 +32,19 @@ 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; @@ -52,20 +64,6 @@ 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 0decace925..41be6e6b03 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,6 +17,8 @@ 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; @@ -37,6 +39,12 @@ 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; @@ -59,16 +67,6 @@ 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 9a0d65ddf3..77a327580a 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,7 +17,10 @@ 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; @@ -32,7 +35,18 @@ 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; @@ -54,22 +68,6 @@ 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 982f3e787c..84c353e756 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/PortfolioView.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/PortfolioView.java @@ -17,6 +17,7 @@ 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; @@ -34,15 +35,13 @@ 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 a43d677605..5f2ff5b397 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,6 +17,8 @@ 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; @@ -43,8 +45,11 @@ 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; @@ -70,13 +75,6 @@ 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 780667087f..64a6c1bfd8 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,6 +19,7 @@ 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; @@ -39,8 +40,6 @@ 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 b2c6a10f07..2a9b58b920 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,6 +18,7 @@ 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; @@ -31,8 +32,6 @@ 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 a3a0f6fe8e..c9813b7333 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,6 +18,7 @@ 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; @@ -29,14 +30,12 @@ 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.NonFiatPriceValidator; import haveno.core.util.validation.FiatPriceValidator; +import haveno.core.util.validation.NonFiatPriceValidator; 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 9d312dd964..a59394eac6 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,6 +19,7 @@ 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; @@ -45,8 +46,6 @@ 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 549661b0b7..908266bcfa 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,6 +18,7 @@ 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; @@ -34,6 +35,7 @@ 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; @@ -44,10 +46,6 @@ 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 e8450aded5..6b6b2c1c2b 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,6 +18,7 @@ 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; @@ -31,13 +32,11 @@ 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.NonFiatPriceValidator; import haveno.core.util.validation.FiatPriceValidator; +import haveno.core.util.validation.NonFiatPriceValidator; 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 4048fdff0a..56e9b6cae5 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,6 +17,7 @@ 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; @@ -38,6 +39,8 @@ 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; @@ -65,10 +68,6 @@ 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 cdf8ac053c..35b140b9de 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,6 +18,7 @@ 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; @@ -29,8 +30,6 @@ 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 592255b55b..ce5ea6158e 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,6 +17,7 @@ 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; @@ -40,7 +41,13 @@ 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; @@ -68,20 +75,10 @@ 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 57992bf310..03c1303870 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,7 +17,9 @@ 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; @@ -37,10 +39,6 @@ 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 798e3ffdea..f09ba10e26 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,7 +17,10 @@ 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; @@ -61,6 +64,9 @@ 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; @@ -69,19 +75,11 @@ 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 b309de20a3..ef9e2a99fa 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,6 +17,8 @@ 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; @@ -54,6 +56,9 @@ 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; @@ -92,12 +97,6 @@ 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 e07dd2fdea..f3f531d7e9 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,7 +17,9 @@ 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; @@ -41,27 +43,23 @@ 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 @@ -152,12 +150,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 c54dbff962..7a7746777a 100644 --- a/desktop/src/main/java/haveno/desktop/main/presentation/AccountPresentation.java +++ b/desktop/src/main/java/haveno/desktop/main/presentation/AccountPresentation.java @@ -17,6 +17,8 @@ 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; @@ -26,9 +28,6 @@ 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 35be328950..455655316f 100644 --- a/desktop/src/main/java/haveno/desktop/main/presentation/MarketPricePresentation.java +++ b/desktop/src/main/java/haveno/desktop/main/presentation/MarketPricePresentation.java @@ -17,6 +17,8 @@ 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; @@ -28,6 +30,10 @@ 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; @@ -44,13 +50,6 @@ 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 8f25f91845..e1336106b3 100644 --- a/desktop/src/main/java/haveno/desktop/main/presentation/SettingsPresentation.java +++ b/desktop/src/main/java/haveno/desktop/main/presentation/SettingsPresentation.java @@ -17,14 +17,13 @@ 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 4a2f0a836d..22fbfb752b 100644 --- a/desktop/src/main/java/haveno/desktop/main/settings/SettingsView.java +++ b/desktop/src/main/java/haveno/desktop/main/settings/SettingsView.java @@ -17,6 +17,7 @@ package haveno.desktop.main.settings; +import com.google.inject.Inject; import haveno.core.locale.Res; import haveno.core.user.Preferences; import haveno.desktop.Navigation; @@ -36,8 +37,6 @@ 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 722638c0b4..a682012beb 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,22 +17,20 @@ 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 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; +import haveno.desktop.util.Layout; +import javafx.geometry.HPos; +import javafx.scene.control.Label; +import javafx.scene.layout.GridPane; @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 cc9ce3bee6..bd7b48c6df 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,6 +17,7 @@ package haveno.desktop.main.settings.network; +import com.google.inject.Inject; import haveno.common.ClockWatcher; import haveno.common.UserThread; import haveno.core.api.CoreMoneroConnectionsService; @@ -27,8 +28,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.XmrNodes; import haveno.core.xmr.nodes.LocalBitcoinNode; +import haveno.core.xmr.nodes.XmrNodes; import haveno.core.xmr.setup.WalletsSetup; import haveno.desktop.app.HavenoApp; import haveno.desktop.common.view.ActivatableView; @@ -42,6 +43,10 @@ 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; @@ -62,13 +67,6 @@ 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 f9792d6f94..4d81c850b2 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,6 +17,9 @@ 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; @@ -29,10 +32,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; @@ -54,9 +57,24 @@ 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; @@ -81,26 +99,6 @@ 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 0ff81ea2a3..92f3e9ae1a 100644 --- a/desktop/src/main/java/haveno/desktop/main/support/SupportView.java +++ b/desktop/src/main/java/haveno/desktop/main/support/SupportView.java @@ -17,6 +17,7 @@ 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; @@ -37,8 +38,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.overlays.popups.Popup; import haveno.desktop.main.offer.signedoffer.SignedOfferView; +import haveno.desktop.main.overlays.popups.Popup; 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; @@ -50,9 +51,7 @@ 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 821892e108..2a82ca9d4f 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,6 +17,8 @@ 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; @@ -37,9 +39,6 @@ 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 dca55b0871..b6ed9031d6 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,6 +17,8 @@ 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; @@ -37,9 +39,6 @@ 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 8b225c7fe6..b73cd75905 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,6 +17,8 @@ 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; @@ -39,9 +41,6 @@ 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 b9eda655cd..7c4d83119d 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,6 +17,8 @@ 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; @@ -37,9 +39,6 @@ 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 73865352ef..369bde0696 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,6 +17,8 @@ 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; @@ -41,9 +43,6 @@ 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 2dfa06ad82..2b812a8ecf 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,6 +17,8 @@ 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; @@ -39,9 +41,6 @@ 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 c0ce04c2ca..06c84712ed 100644 --- a/desktop/src/main/java/haveno/desktop/util/Transitions.java +++ b/desktop/src/main/java/haveno/desktop/util/Transitions.java @@ -17,6 +17,8 @@ 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; @@ -32,9 +34,6 @@ 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 3d525f6a3a..8e12c8bae2 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-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`). + 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`). On Windows: - 1. Download [Java JDK 11](https://adoptium.net/temurin/archive/?version=11). During installation, enable the option to set the $JAVA_HOME environment variable. + 1. Download [Java JDK 17](https://adoptium.net/temurin/archive/?version=17). 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 b1f90bd970..bb93fa1f7c 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.0.2 \ + ./gradlew wrapper --gradle-version 8.2 \ --distribution-type all \ - --gradle-distribution-sha256-sum 47a5bfed9ef814f90f8debcbbb315e8e7c654109acd224595ea39fca95c5d4da + --gradle-distribution-sha256-sum 5022b0b25fe182b0e50867e77f484501dba44feeea88f5c1f13b6b4660463640 The first execution should automatically update: diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 8472b2c7c5..a448d4e884 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -678,6 +678,11 @@ + + + + + @@ -733,14 +738,6 @@ - - - - - - - - @@ -752,59 +749,25 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - @@ -831,17 +794,9 @@ - - - - - - - - - - - + + + @@ -857,6 +812,11 @@ + + + + + @@ -961,9 +921,9 @@ - - - + + + @@ -1551,6 +1511,11 @@ + + + + + @@ -2198,6 +2163,11 @@ + + + + + @@ -2376,48 +2346,24 @@ - - - - - - + + + - - - - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + @@ -3181,6 +3127,11 @@ + + + + + @@ -3222,6 +3173,11 @@ + + + + + @@ -3245,6 +3201,11 @@ + + + + + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f2a..033e24c4cd 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 1a703c8b43..a3044fac5a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,8 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=47a5bfed9ef814f90f8debcbbb315e8e7c654109acd224595ea39fca95c5d4da -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip +distributionSha256Sum=5022b0b25fe182b0e50867e77f484501dba44feeea88f5c1f13b6b4660463640 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787337..fcb6fca147 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/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/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,13 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 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"' +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +130,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + 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. 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 @@ -193,6 +197,10 @@ 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 @@ -205,6 +213,12 @@ 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 107acd32c4..93e3f59f13 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,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 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! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +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% :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 8029e5014d..c8b4ad10df 100644 --- a/p2p/src/main/java/haveno/network/Socks5ProxyProvider.java +++ b/p2p/src/main/java/haveno/network/Socks5ProxyProvider.java @@ -18,16 +18,15 @@ 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 b0e6fa7b8d..b2fe4a6039 100644 --- a/p2p/src/main/java/haveno/network/crypto/EncryptionService.java +++ b/p2p/src/main/java/haveno/network/crypto/EncryptionService.java @@ -17,9 +17,11 @@ 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; @@ -29,15 +31,11 @@ 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 static haveno.common.crypto.Encryption.decryptSecretKey; +import javax.crypto.SecretKey; +import lombok.extern.slf4j.Slf4j; @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 17185d60e1..d75eb0461e 100644 --- a/p2p/src/main/java/haveno/network/http/HttpClientImpl.java +++ b/p2p/src/main/java/haveno/network/http/HttpClientImpl.java @@ -17,10 +17,25 @@ 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; @@ -39,23 +54,6 @@ 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 5bdaa2cc38..6825abe79c 100644 --- a/p2p/src/main/java/haveno/network/p2p/NetworkNodeProvider.java +++ b/p2p/src/main/java/haveno/network/p2p/NetworkNodeProvider.java @@ -17,24 +17,20 @@ 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 7d6fd9292b..ede80009d5 100644 --- a/p2p/src/main/java/haveno/network/p2p/mailbox/IgnoredMailboxService.java +++ b/p2p/src/main/java/haveno/network/p2p/mailbox/IgnoredMailboxService.java @@ -17,13 +17,12 @@ 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 5249a7caf2..09f7b49e7f 100644 --- a/p2p/src/main/java/haveno/network/p2p/mailbox/MailboxMessageService.java +++ b/p2p/src/main/java/haveno/network/p2p/mailbox/MailboxMessageService.java @@ -18,10 +18,15 @@ 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; @@ -53,13 +58,6 @@ 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; @@ -78,9 +76,9 @@ import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Collectors; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; +import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.NotNull; /** * 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 bd887e2cc1..daf1bc0e7d 100644 --- a/p2p/src/main/java/haveno/network/p2p/network/Connection.java +++ b/p2p/src/main/java/haveno/network/p2p/network/Connection.java @@ -17,6 +17,22 @@ 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; @@ -30,39 +46,16 @@ 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; @@ -77,17 +70,12 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.stream.Collectors; - -import java.lang.ref.WeakReference; - +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleObjectProperty; 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 109e192fcb..625483edf2 100644 --- a/p2p/src/main/java/haveno/network/p2p/peers/Broadcaster.java +++ b/p2p/src/main/java/haveno/network/p2p/peers/Broadcaster.java @@ -17,31 +17,25 @@ package haveno.network.p2p.peers; -import haveno.network.p2p.NodeAddress; -import haveno.network.p2p.network.NetworkNode; -import haveno.network.p2p.storage.messages.BroadcastMessage; - +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.common.Timer; import haveno.common.UserThread; import haveno.common.config.Config; import haveno.common.util.Utilities; - -import javax.inject.Inject; -import javax.inject.Named; - -import com.google.common.util.concurrent.ListeningExecutorService; -import com.google.common.util.concurrent.MoreExecutors; - +import haveno.network.p2p.NodeAddress; +import haveno.network.p2p.network.NetworkNode; +import haveno.network.p2p.storage.messages.BroadcastMessage; 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 457457deed..0ca6217d47 100644 --- a/p2p/src/main/java/haveno/network/p2p/peers/PeerManager.java +++ b/p2p/src/main/java/haveno/network/p2p/peers/PeerManager.java @@ -18,6 +18,9 @@ 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; @@ -37,12 +40,6 @@ 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; @@ -56,8 +53,9 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; - -import static com.google.common.base.Preconditions.checkArgument; +import javax.annotation.Nullable; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; @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 5a62959e12..fbb1fb7e0d 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,6 +17,9 @@ 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; @@ -32,10 +35,6 @@ 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; @@ -45,9 +44,8 @@ import java.util.Map; import java.util.Optional; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; +import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.Nullable; @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 d1772dc8bc..715238881b 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,6 +20,7 @@ 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; @@ -33,13 +34,11 @@ 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 ec7d3b60f1..d2b454a1b8 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,6 +18,7 @@ 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; @@ -30,10 +31,6 @@ 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; @@ -46,6 +43,8 @@ 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 45017c9967..ea52805a7c 100644 --- a/p2p/src/main/java/haveno/network/p2p/storage/P2PDataStorage.java +++ b/p2p/src/main/java/haveno/network/p2p/storage/P2PDataStorage.java @@ -17,6 +17,26 @@ 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; @@ -54,43 +74,9 @@ 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; @@ -111,14 +97,16 @@ 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 javax.annotation.Nullable; +import org.fxmisc.easybind.EasyBind; +import org.fxmisc.easybind.monadic.MonadicBinding; @Slf4j public class P2PDataStorage implements MessageListener, ConnectionListener, PersistedDataHost { @@ -247,7 +235,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers appendOnlyDataStoreService.readFromResourcesSync(postFix); protectedDataStoreService.readFromResourcesSync(postFix); resourceDataStoreService.readFromResourcesSync(postFix); - + map.putAll(protectedDataStoreService.getMap()); } } @@ -831,9 +819,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); @@ -841,13 +829,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"; @@ -855,7 +843,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); @@ -864,36 +852,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); @@ -902,7 +890,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers // Persist ProtectedStorageEntries carrying PersistablePayload payloads if (protectedStoragePayload instanceof PersistablePayload) protectedDataStoreService.put(hashOfPayload, protectedStorageEntry); - + return true; } } @@ -951,13 +939,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(), @@ -965,26 +953,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(); @@ -1007,29 +995,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); @@ -1039,13 +1027,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 6aabfe761d..8f7b2b8027 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,21 +18,18 @@ 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 8e1291b274..8b36b416d7 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,18 +18,17 @@ 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 902ae73fb9..e7c17ce8a7 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,15 +17,14 @@ 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 b10573c8cb..a081733e2e 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,13 +18,12 @@ 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 b53b087917..3364679050 100644 --- a/scripts/install_java.bat +++ b/scripts/install_java.bat @@ -25,9 +25,9 @@ cd /D "%~dp0" title Install Java -set jdk_version=11.0.2 +set jdk_version=20.0.1 set jdk_filename=openjdk-%jdk_version%_windows-x64_bin -set jdk_url=https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_windows-x64_bin.zip +set jdk_url=https://download.java.net/java/GA/jdk20.0.1/b4887098932d415489976708ad6d1a4b/9/GPL/openjdk-20.0.1_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 d14214b9f7..6ffb7eb4fa 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-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 + 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 # 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-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 + 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 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-11.0.2.jdk | sudo bash + sudo mkdir /Library/Java/JavaVirtualMachines/openjdk-20.0.1.jdk | sudo bash gunzip -c $JDK_FILENAME | tar xopf - - sudo mv jdk-11.0.2.jdk/* /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk - sudo rmdir jdk-11.0.2.jdk + sudo mv jdk-20.0.1.jdk/* /Library/Java/JavaVirtualMachines/openjdk-20.0.1.jdk + sudo rmdir jdk-20.0.1.jdk rm $JDK_FILENAME fi