From ba6055442537d0250e3811906f2e656a8693bd29 Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Tue, 14 May 2024 19:56:51 +0200 Subject: [PATCH] optimize imports --- .../java/org/bitcoinj/base/LegacyAddress.java | 15 ++-- .../java/org/bitcoinj/base/SegwitAddress.java | 11 ++- .../java/org/bitcoinj/core/LockTimeTest.java | 3 +- .../kotlin/org/bitcoinj/ForwardingService.kt | 4 +- .../org/bitcoinj/examples/DoubleSpend.java | 7 +- .../org/bitcoinj/examples/DumpWallet.java | 4 +- .../org/bitcoinj/examples/FetchBlock.java | 8 ++- .../bitcoinj/examples/FetchTransactions.java | 8 ++- .../bitcoinj/examples/ForwardingService.java | 8 +-- .../bitcoinj/examples/GenerateLowSTests.java | 42 +++++------ .../main/java/org/bitcoinj/examples/Kit.java | 2 +- .../org/bitcoinj/examples/PeerMonitor.java | 17 ++++- .../org/bitcoinj/examples/PrintPeers.java | 2 +- .../org/bitcoinj/examples/PrivateKeys.java | 9 ++- .../org/bitcoinj/examples/RefreshWallet.java | 5 +- .../bitcoinj/examples/RestoreFromSeed.java | 5 +- .../org/bitcoinj/examples/SendRequest.java | 2 +- .../test/java/org/bitcoinj/core/PeerTest.java | 1 - .../examples/ForwardingServiceTest.java | 2 +- .../testing/TestWithNetworkConnections.java | 4 +- .../wallet/WalletAccountPathTest.java | 9 ++- settings.gradle | 1 - .../org/bitcoinj/tools/BlockImporter.java | 15 +++- .../org/bitcoinj/tools/BuildCheckpoints.java | 13 ++-- .../bitcoinj/tools/PaymentProtocolTool.java | 3 +- .../java/org/bitcoinj/tools/TestFeeLevel.java | 5 +- .../java/org/bitcoinj/tools/WatchMempool.java | 16 ++--- .../application/WalletApplication.java | 2 +- .../controls/BitcoinAddressValidator.java | 3 +- .../controls/ClickableBitcoinAddress.java | 13 ++-- .../controls/NotificationBarPane.java | 3 +- .../OverlayableStackPaneController.java | 3 +- .../walletfx/utils/BitcoinUIModel.java | 9 ++- .../org/bitcoinj/walletfx/utils/GuiUtils.java | 7 +- .../walletfx/utils/KeyDerivationTasks.java | 6 +- .../java/wallettemplate/MainController.java | 22 +++--- .../wallettemplate/SendMoneyController.java | 24 ++++--- .../WalletPasswordController.java | 13 ++-- .../WalletSetPasswordController.java | 27 ++++--- .../WalletSettingsController.java | 17 +++-- .../walletfx/controls/bitcoin_address.fxml | 15 ++-- .../org/bitcoinj/walletfx/utils/alert.fxml | 21 +++--- .../main/resources/wallettemplate/main.fxml | 23 +++--- .../resources/wallettemplate/send_money.fxml | 16 +++-- .../wallettemplate/wallet_password.fxml | 25 ++++--- .../wallettemplate/wallet_set_password.fxml | 25 ++++--- .../wallettemplate/wallet_settings.fxml | 19 ++--- .../org/bitcoinj/wallettool/WalletTool.java | 70 +++++++++---------- .../bitcoinj/wallettool/WalletToolTest.java | 1 - 49 files changed, 317 insertions(+), 268 deletions(-) diff --git a/core/src/main/java/org/bitcoinj/base/LegacyAddress.java b/core/src/main/java/org/bitcoinj/base/LegacyAddress.java index e9d9acb59..fa2b5d238 100644 --- a/core/src/main/java/org/bitcoinj/base/LegacyAddress.java +++ b/core/src/main/java/org/bitcoinj/base/LegacyAddress.java @@ -18,10 +18,11 @@ package org.bitcoinj.base; +import org.bitcoinj.base.BitcoinNetwork; import org.bitcoinj.base.exceptions.AddressFormatException; import org.bitcoinj.base.internal.ByteUtils; -import org.bitcoinj.crypto.ECKey; import org.bitcoinj.core.NetworkParameters; +import org.bitcoinj.crypto.ECKey; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -31,8 +32,6 @@ import java.util.EnumSet; import java.util.Objects; import java.util.stream.Stream; -import static org.bitcoinj.base.BitcoinNetwork.*; - /** *

A Bitcoin address looks like 1MsScoe2fTJoq4ZPdQgqyhgWeoNamYPevy and is derived from an elliptic curve public key * plus a set of network parameters. Not to be confused with a {@link org.bitcoinj.core.PeerAddress} @@ -295,9 +294,9 @@ public class LegacyAddress implements Address { * Address header of legacy P2PKH addresses for standard Bitcoin networks. */ public enum AddressHeader { - X0(0, MAINNET), - X111(111, TESTNET, REGTEST), - X6F(0x6f, SIGNET); + X0(0, BitcoinNetwork.MAINNET), + X111(111, BitcoinNetwork.TESTNET, BitcoinNetwork.REGTEST), + X6F(0x6f, BitcoinNetwork.SIGNET); private final int headerByte; private final EnumSet networks; @@ -327,8 +326,8 @@ public class LegacyAddress implements Address { * Address header of legacy P2SH addresses for standard Bitcoin networks. */ public enum P2SHHeader { - X5(5, MAINNET), - X196(196, TESTNET, SIGNET, REGTEST); + X5(5, BitcoinNetwork.MAINNET), + X196(196, BitcoinNetwork.TESTNET, BitcoinNetwork.SIGNET, BitcoinNetwork.REGTEST); private final int headerByte; private final EnumSet networks; diff --git a/core/src/main/java/org/bitcoinj/base/SegwitAddress.java b/core/src/main/java/org/bitcoinj/base/SegwitAddress.java index c643e24c3..247b1ce29 100644 --- a/core/src/main/java/org/bitcoinj/base/SegwitAddress.java +++ b/core/src/main/java/org/bitcoinj/base/SegwitAddress.java @@ -16,10 +16,11 @@ package org.bitcoinj.base; +import org.bitcoinj.base.BitcoinNetwork; import org.bitcoinj.base.exceptions.AddressFormatException; import org.bitcoinj.base.internal.ByteUtils; -import org.bitcoinj.crypto.ECKey; import org.bitcoinj.core.NetworkParameters; +import org.bitcoinj.crypto.ECKey; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -30,8 +31,6 @@ import java.util.Objects; import java.util.Optional; import java.util.stream.Stream; -import static org.bitcoinj.base.BitcoinNetwork.*; - /** *

Implementation of native segwit addresses. They are composed of two parts:

* @@ -64,9 +63,9 @@ public class SegwitAddress implements Address { * Bitcoin Core Issue 1234 - discussion of {@code bcrt} HRP for details. */ public enum SegwitHrp { - BC(MAINNET), - TB(TESTNET, SIGNET), - BCRT(REGTEST); + BC(BitcoinNetwork.MAINNET), + TB(BitcoinNetwork.TESTNET, BitcoinNetwork.SIGNET), + BCRT(BitcoinNetwork.REGTEST); private final EnumSet networks; diff --git a/core/src/test/java/org/bitcoinj/core/LockTimeTest.java b/core/src/test/java/org/bitcoinj/core/LockTimeTest.java index 331519f21..8e8e7921b 100644 --- a/core/src/test/java/org/bitcoinj/core/LockTimeTest.java +++ b/core/src/test/java/org/bitcoinj/core/LockTimeTest.java @@ -26,7 +26,8 @@ import org.junit.runner.RunWith; import java.time.Instant; import java.time.temporal.ChronoUnit; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; @RunWith(JUnitParamsRunner.class) public class LockTimeTest { diff --git a/examples-kotlin/src/main/kotlin/org/bitcoinj/ForwardingService.kt b/examples-kotlin/src/main/kotlin/org/bitcoinj/ForwardingService.kt index 293b65cb1..fcf445bd6 100644 --- a/examples-kotlin/src/main/kotlin/org/bitcoinj/ForwardingService.kt +++ b/examples-kotlin/src/main/kotlin/org/bitcoinj/ForwardingService.kt @@ -14,10 +14,10 @@ * limitations under the License. */ -import org.bitcoinj.base.BitcoinNetwork import org.bitcoinj.base.Address -import org.bitcoinj.base.Coin import org.bitcoinj.base.AddressParser +import org.bitcoinj.base.BitcoinNetwork +import org.bitcoinj.base.Coin import org.bitcoinj.core.Context import org.bitcoinj.core.Transaction import org.bitcoinj.core.TransactionBroadcast diff --git a/examples/src/main/java/org/bitcoinj/examples/DoubleSpend.java b/examples/src/main/java/org/bitcoinj/examples/DoubleSpend.java index 33a701d76..5fd6f0592 100644 --- a/examples/src/main/java/org/bitcoinj/examples/DoubleSpend.java +++ b/examples/src/main/java/org/bitcoinj/examples/DoubleSpend.java @@ -18,7 +18,8 @@ package org.bitcoinj.examples; import org.bitcoinj.base.Address; import org.bitcoinj.base.BitcoinNetwork; -import org.bitcoinj.core.*; +import org.bitcoinj.core.Peer; +import org.bitcoinj.core.Transaction; import org.bitcoinj.kits.WalletAppKit; import org.bitcoinj.utils.BriefLogFormatter; import org.bitcoinj.utils.Threading; @@ -26,7 +27,9 @@ import org.bitcoinj.wallet.Wallet; import java.io.File; -import static org.bitcoinj.base.Coin.*; +import static org.bitcoinj.base.Coin.CENT; +import static org.bitcoinj.base.Coin.COIN; +import static org.bitcoinj.base.Coin.SATOSHI; /** * This is a little test app that waits for a coin on a local regtest node, then generates two transactions that double diff --git a/examples/src/main/java/org/bitcoinj/examples/DumpWallet.java b/examples/src/main/java/org/bitcoinj/examples/DumpWallet.java index 7219c64e2..b049657b7 100644 --- a/examples/src/main/java/org/bitcoinj/examples/DumpWallet.java +++ b/examples/src/main/java/org/bitcoinj/examples/DumpWallet.java @@ -16,10 +16,10 @@ package org.bitcoinj.examples; -import java.io.File; - import org.bitcoinj.wallet.Wallet; +import java.io.File; + /** * DumpWallet loads a serialized wallet and prints information about what it contains. */ diff --git a/examples/src/main/java/org/bitcoinj/examples/FetchBlock.java b/examples/src/main/java/org/bitcoinj/examples/FetchBlock.java index a0a7ae63e..5008add81 100644 --- a/examples/src/main/java/org/bitcoinj/examples/FetchBlock.java +++ b/examples/src/main/java/org/bitcoinj/examples/FetchBlock.java @@ -20,14 +20,18 @@ package org.bitcoinj.examples; import org.bitcoinj.base.BitcoinNetwork; import org.bitcoinj.base.Network; import org.bitcoinj.base.Sha256Hash; -import org.bitcoinj.core.*; +import org.bitcoinj.core.Block; +import org.bitcoinj.core.BlockChain; +import org.bitcoinj.core.NetworkParameters; +import org.bitcoinj.core.Peer; +import org.bitcoinj.core.PeerAddress; +import org.bitcoinj.core.PeerGroup; import org.bitcoinj.net.discovery.DnsDiscovery; import org.bitcoinj.store.BlockStore; import org.bitcoinj.store.MemoryBlockStore; import org.bitcoinj.utils.BriefLogFormatter; import picocli.CommandLine; -import java.net.InetAddress; import java.util.concurrent.Callable; import java.util.concurrent.Future; diff --git a/examples/src/main/java/org/bitcoinj/examples/FetchTransactions.java b/examples/src/main/java/org/bitcoinj/examples/FetchTransactions.java index f659edeee..69ec4d6bc 100644 --- a/examples/src/main/java/org/bitcoinj/examples/FetchTransactions.java +++ b/examples/src/main/java/org/bitcoinj/examples/FetchTransactions.java @@ -20,12 +20,16 @@ package org.bitcoinj.examples; import org.bitcoinj.base.BitcoinNetwork; import org.bitcoinj.base.Network; import org.bitcoinj.base.Sha256Hash; -import org.bitcoinj.core.*; +import org.bitcoinj.core.BlockChain; +import org.bitcoinj.core.NetworkParameters; +import org.bitcoinj.core.Peer; +import org.bitcoinj.core.PeerAddress; +import org.bitcoinj.core.PeerGroup; +import org.bitcoinj.core.Transaction; import org.bitcoinj.store.BlockStore; import org.bitcoinj.store.MemoryBlockStore; import org.bitcoinj.utils.BriefLogFormatter; -import java.net.InetAddress; import java.util.List; import java.util.concurrent.Future; diff --git a/examples/src/main/java/org/bitcoinj/examples/ForwardingService.java b/examples/src/main/java/org/bitcoinj/examples/ForwardingService.java index 234cd16fb..eba04019a 100644 --- a/examples/src/main/java/org/bitcoinj/examples/ForwardingService.java +++ b/examples/src/main/java/org/bitcoinj/examples/ForwardingService.java @@ -16,16 +16,15 @@ package org.bitcoinj.examples; -import org.bitcoinj.base.BitcoinNetwork; import org.bitcoinj.base.Address; -import org.bitcoinj.base.Coin; import org.bitcoinj.base.AddressParser; +import org.bitcoinj.base.BitcoinNetwork; +import org.bitcoinj.base.Coin; import org.bitcoinj.core.Context; import org.bitcoinj.core.Transaction; import org.bitcoinj.core.TransactionBroadcast; import org.bitcoinj.kits.WalletAppKit; import org.bitcoinj.utils.BriefLogFormatter; -import org.bitcoinj.wallet.CoinSelection; import org.bitcoinj.wallet.CoinSelector; import org.bitcoinj.wallet.SendRequest; import org.bitcoinj.wallet.Wallet; @@ -36,9 +35,6 @@ import java.io.File; import java.util.Objects; import java.util.concurrent.CompletableFuture; -import static java.util.stream.Collectors.collectingAndThen; -import static java.util.stream.Collectors.toList; - /** * ForwardingService demonstrates basic usage of bitcoinj. It creates an SPV Wallet, listens on the network * and when it receives coins, simply sends them onwards to the address given on the command line. diff --git a/examples/src/main/java/org/bitcoinj/examples/GenerateLowSTests.java b/examples/src/main/java/org/bitcoinj/examples/GenerateLowSTests.java index da7fcff82..be779e47c 100644 --- a/examples/src/main/java/org/bitcoinj/examples/GenerateLowSTests.java +++ b/examples/src/main/java/org/bitcoinj/examples/GenerateLowSTests.java @@ -17,6 +17,27 @@ package org.bitcoinj.examples; +import org.bitcoinj.base.BitcoinNetwork; +import org.bitcoinj.base.Coin; +import org.bitcoinj.base.Network; +import org.bitcoinj.base.ScriptType; +import org.bitcoinj.base.internal.ByteUtils; +import org.bitcoinj.core.Transaction; +import org.bitcoinj.core.TransactionInput; +import org.bitcoinj.core.TransactionOutput; +import org.bitcoinj.core.VerificationException; +import org.bitcoinj.crypto.ECKey; +import org.bitcoinj.crypto.SignatureDecodeException; +import org.bitcoinj.crypto.TransactionSignature; +import org.bitcoinj.script.Script; +import org.bitcoinj.script.ScriptBuilder; +import org.bitcoinj.script.ScriptChunk; +import org.bitcoinj.script.ScriptException; +import org.bitcoinj.signers.LocalTransactionSigner; +import org.bitcoinj.signers.TransactionSigner.ProposedTransaction; +import org.bitcoinj.wallet.KeyBag; +import org.bitcoinj.wallet.RedeemData; + import java.io.IOException; import java.math.BigInteger; import java.security.NoSuchAlgorithmException; @@ -24,28 +45,7 @@ import java.security.SecureRandom; import java.util.EnumSet; import java.util.Objects; -import org.bitcoinj.base.BitcoinNetwork; -import org.bitcoinj.base.Network; -import org.bitcoinj.base.ScriptType; -import org.bitcoinj.base.internal.ByteUtils; -import org.bitcoinj.base.Coin; -import org.bitcoinj.crypto.ECKey; -import org.bitcoinj.crypto.SignatureDecodeException; -import org.bitcoinj.core.Transaction; -import org.bitcoinj.core.TransactionInput; -import org.bitcoinj.core.TransactionOutput; -import org.bitcoinj.core.VerificationException; -import org.bitcoinj.crypto.TransactionSignature; -import org.bitcoinj.script.Script; -import org.bitcoinj.script.ScriptBuilder; -import org.bitcoinj.script.ScriptChunk; -import org.bitcoinj.script.ScriptException; - import static org.bitcoinj.script.ScriptOpCodes.getOpCodeName; -import org.bitcoinj.signers.LocalTransactionSigner; -import org.bitcoinj.signers.TransactionSigner.ProposedTransaction; -import org.bitcoinj.wallet.KeyBag; -import org.bitcoinj.wallet.RedeemData; /** * Test case generator for transactions with low-S and high-S signatures, to diff --git a/examples/src/main/java/org/bitcoinj/examples/Kit.java b/examples/src/main/java/org/bitcoinj/examples/Kit.java index f65034e65..e88e8dea2 100644 --- a/examples/src/main/java/org/bitcoinj/examples/Kit.java +++ b/examples/src/main/java/org/bitcoinj/examples/Kit.java @@ -17,7 +17,7 @@ package org.bitcoinj.examples; import org.bitcoinj.base.BitcoinNetwork; -import org.bitcoinj.core.*; +import org.bitcoinj.core.TransactionConfidence; import org.bitcoinj.kits.WalletAppKit; import java.io.File; diff --git a/examples/src/main/java/org/bitcoinj/examples/PeerMonitor.java b/examples/src/main/java/org/bitcoinj/examples/PeerMonitor.java index 70c271071..1138811a1 100644 --- a/examples/src/main/java/org/bitcoinj/examples/PeerMonitor.java +++ b/examples/src/main/java/org/bitcoinj/examples/PeerMonitor.java @@ -18,20 +18,31 @@ package org.bitcoinj.examples; import org.bitcoinj.base.BitcoinNetwork; +import org.bitcoinj.base.Coin; import org.bitcoinj.base.Network; import org.bitcoinj.core.AddressMessage; -import org.bitcoinj.base.Coin; import org.bitcoinj.core.Peer; import org.bitcoinj.core.PeerAddress; import org.bitcoinj.core.PeerGroup; import org.bitcoinj.net.discovery.DnsDiscovery; import org.bitcoinj.utils.BriefLogFormatter; -import javax.swing.*; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JSpinner; +import javax.swing.JTable; +import javax.swing.SpinnerNumberModel; +import javax.swing.SwingUtilities; +import javax.swing.Timer; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumnModel; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.time.Duration; diff --git a/examples/src/main/java/org/bitcoinj/examples/PrintPeers.java b/examples/src/main/java/org/bitcoinj/examples/PrintPeers.java index 650270549..e0b398669 100644 --- a/examples/src/main/java/org/bitcoinj/examples/PrintPeers.java +++ b/examples/src/main/java/org/bitcoinj/examples/PrintPeers.java @@ -22,9 +22,9 @@ import org.bitcoinj.core.NetworkParameters; import org.bitcoinj.core.Peer; import org.bitcoinj.core.PeerAddress; import org.bitcoinj.core.VersionMessage; +import org.bitcoinj.net.NioClientManager; import org.bitcoinj.net.discovery.DnsDiscovery; import org.bitcoinj.net.discovery.PeerDiscoveryException; -import org.bitcoinj.net.NioClientManager; import org.bitcoinj.utils.BriefLogFormatter; import java.net.InetAddress; diff --git a/examples/src/main/java/org/bitcoinj/examples/PrivateKeys.java b/examples/src/main/java/org/bitcoinj/examples/PrivateKeys.java index 11a4c4b09..a1266dfcf 100644 --- a/examples/src/main/java/org/bitcoinj/examples/PrivateKeys.java +++ b/examples/src/main/java/org/bitcoinj/examples/PrivateKeys.java @@ -17,22 +17,21 @@ package org.bitcoinj.examples; +import org.bitcoinj.base.Address; +import org.bitcoinj.base.Base58; import org.bitcoinj.base.BitcoinNetwork; import org.bitcoinj.base.Network; import org.bitcoinj.base.ScriptType; -import org.bitcoinj.base.Address; -import org.bitcoinj.base.Base58; import org.bitcoinj.core.BlockChain; -import org.bitcoinj.crypto.DumpedPrivateKey; -import org.bitcoinj.crypto.ECKey; import org.bitcoinj.core.NetworkParameters; import org.bitcoinj.core.PeerAddress; import org.bitcoinj.core.PeerGroup; +import org.bitcoinj.crypto.DumpedPrivateKey; +import org.bitcoinj.crypto.ECKey; import org.bitcoinj.store.MemoryBlockStore; import org.bitcoinj.wallet.Wallet; import java.math.BigInteger; -import java.net.InetAddress; /** * This example shows how to solve the challenge Hal posted here:

diff --git a/examples/src/main/java/org/bitcoinj/examples/RefreshWallet.java b/examples/src/main/java/org/bitcoinj/examples/RefreshWallet.java index 040e7939c..e4ba1d556 100644 --- a/examples/src/main/java/org/bitcoinj/examples/RefreshWallet.java +++ b/examples/src/main/java/org/bitcoinj/examples/RefreshWallet.java @@ -20,7 +20,10 @@ package org.bitcoinj.examples; import org.bitcoinj.base.BitcoinNetwork; import org.bitcoinj.base.Coin; import org.bitcoinj.base.Network; -import org.bitcoinj.core.*; +import org.bitcoinj.core.BlockChain; +import org.bitcoinj.core.NetworkParameters; +import org.bitcoinj.core.PeerGroup; +import org.bitcoinj.core.Transaction; import org.bitcoinj.store.BlockStore; import org.bitcoinj.store.MemoryBlockStore; import org.bitcoinj.wallet.Wallet; diff --git a/examples/src/main/java/org/bitcoinj/examples/RestoreFromSeed.java b/examples/src/main/java/org/bitcoinj/examples/RestoreFromSeed.java index 23bdf0b53..c71929dcf 100644 --- a/examples/src/main/java/org/bitcoinj/examples/RestoreFromSeed.java +++ b/examples/src/main/java/org/bitcoinj/examples/RestoreFromSeed.java @@ -19,12 +19,13 @@ package org.bitcoinj.examples; import org.bitcoinj.base.BitcoinNetwork; import org.bitcoinj.base.Network; import org.bitcoinj.base.ScriptType; +import org.bitcoinj.core.BlockChain; +import org.bitcoinj.core.NetworkParameters; +import org.bitcoinj.core.PeerGroup; import org.bitcoinj.core.listeners.DownloadProgressTracker; -import org.bitcoinj.core.*; import org.bitcoinj.net.discovery.DnsDiscovery; import org.bitcoinj.store.SPVBlockStore; import org.bitcoinj.wallet.DeterministicSeed; -import org.bitcoinj.wallet.KeyChainGroupStructure; import org.bitcoinj.wallet.Wallet; import java.io.File; diff --git a/examples/src/main/java/org/bitcoinj/examples/SendRequest.java b/examples/src/main/java/org/bitcoinj/examples/SendRequest.java index 16c0fdc4a..3b642b1b8 100644 --- a/examples/src/main/java/org/bitcoinj/examples/SendRequest.java +++ b/examples/src/main/java/org/bitcoinj/examples/SendRequest.java @@ -19,7 +19,7 @@ package org.bitcoinj.examples; import org.bitcoinj.base.Address; import org.bitcoinj.base.BitcoinNetwork; import org.bitcoinj.base.Coin; -import org.bitcoinj.core.*; +import org.bitcoinj.core.InsufficientMoneyException; import org.bitcoinj.kits.WalletAppKit; import org.bitcoinj.wallet.Wallet; import org.bitcoinj.wallet.Wallet.BalanceType; diff --git a/integration-test/src/test/java/org/bitcoinj/core/PeerTest.java b/integration-test/src/test/java/org/bitcoinj/core/PeerTest.java index 4b10c1706..c77bc744c 100644 --- a/integration-test/src/test/java/org/bitcoinj/core/PeerTest.java +++ b/integration-test/src/test/java/org/bitcoinj/core/PeerTest.java @@ -29,7 +29,6 @@ import org.bitcoinj.testing.InboundMessageQueuer; import org.bitcoinj.testing.TestWithNetworkConnections; import org.bitcoinj.utils.Threading; import org.bitcoinj.wallet.Wallet; -import org.checkerframework.checker.units.qual.A; import org.junit.After; import org.junit.Before; import org.junit.Test; diff --git a/integration-test/src/test/java/org/bitcoinj/examples/ForwardingServiceTest.java b/integration-test/src/test/java/org/bitcoinj/examples/ForwardingServiceTest.java index c6974e5c6..43bbe307b 100644 --- a/integration-test/src/test/java/org/bitcoinj/examples/ForwardingServiceTest.java +++ b/integration-test/src/test/java/org/bitcoinj/examples/ForwardingServiceTest.java @@ -16,9 +16,9 @@ package org.bitcoinj.examples; +import org.bitcoinj.base.Address; import org.bitcoinj.base.BitcoinNetwork; import org.bitcoinj.base.ScriptType; -import org.bitcoinj.base.Address; import org.bitcoinj.core.Context; import org.bitcoinj.crypto.ECKey; import org.junit.jupiter.api.BeforeEach; diff --git a/integration-test/src/test/java/org/bitcoinj/testing/TestWithNetworkConnections.java b/integration-test/src/test/java/org/bitcoinj/testing/TestWithNetworkConnections.java index 390f00895..bc0116506 100644 --- a/integration-test/src/test/java/org/bitcoinj/testing/TestWithNetworkConnections.java +++ b/integration-test/src/test/java/org/bitcoinj/testing/TestWithNetworkConnections.java @@ -17,10 +17,10 @@ package org.bitcoinj.testing; -import org.bitcoinj.base.ScriptType; import org.bitcoinj.base.Address; -import org.bitcoinj.core.BlockChain; import org.bitcoinj.base.Coin; +import org.bitcoinj.base.ScriptType; +import org.bitcoinj.core.BlockChain; import org.bitcoinj.core.Context; import org.bitcoinj.core.Message; import org.bitcoinj.core.NetworkParameters; diff --git a/integration-test/src/test/java/org/bitcoinj/wallet/WalletAccountPathTest.java b/integration-test/src/test/java/org/bitcoinj/wallet/WalletAccountPathTest.java index 034f4e7bf..586aca162 100644 --- a/integration-test/src/test/java/org/bitcoinj/wallet/WalletAccountPathTest.java +++ b/integration-test/src/test/java/org/bitcoinj/wallet/WalletAccountPathTest.java @@ -16,12 +16,11 @@ package org.bitcoinj.wallet; +import org.bitcoinj.base.BitcoinNetwork; import org.bitcoinj.base.Network; import org.bitcoinj.base.ScriptType; import org.bitcoinj.core.Context; -import org.bitcoinj.core.NetworkParameters; import org.bitcoinj.crypto.HDPath; -import org.bitcoinj.base.BitcoinNetwork; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; @@ -33,12 +32,12 @@ import java.io.IOException; import java.time.Instant; import java.util.stream.Stream; -import static org.bitcoinj.base.ScriptType.P2PKH; -import static org.bitcoinj.base.ScriptType.P2WPKH; import static org.bitcoinj.base.BitcoinNetwork.MAINNET; import static org.bitcoinj.base.BitcoinNetwork.TESTNET; -import static org.bitcoinj.wallet.KeyChainGroupStructure.BIP43; +import static org.bitcoinj.base.ScriptType.P2PKH; +import static org.bitcoinj.base.ScriptType.P2WPKH; import static org.bitcoinj.wallet.KeyChainGroupStructure.BIP32; +import static org.bitcoinj.wallet.KeyChainGroupStructure.BIP43; import static org.junit.jupiter.api.Assertions.assertEquals; /** diff --git a/settings.gradle b/settings.gradle index 6bb0dc1a5..2341a4f53 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,4 @@ import org.gradle.util.GradleVersion -import org.gradle.api.GradleScriptException // Minimum Gradle version for build def minGradleVersion = GradleVersion.version("4.4") diff --git a/tools/src/main/java/org/bitcoinj/tools/BlockImporter.java b/tools/src/main/java/org/bitcoinj/tools/BlockImporter.java index 87b24d7fa..e61b8c51d 100644 --- a/tools/src/main/java/org/bitcoinj/tools/BlockImporter.java +++ b/tools/src/main/java/org/bitcoinj/tools/BlockImporter.java @@ -18,8 +18,19 @@ package org.bitcoinj.tools; import org.bitcoinj.base.BitcoinNetwork; import org.bitcoinj.base.Network; -import org.bitcoinj.core.*; -import org.bitcoinj.store.*; +import org.bitcoinj.core.AbstractBlockChain; +import org.bitcoinj.core.Block; +import org.bitcoinj.core.BlockChain; +import org.bitcoinj.core.FullPrunedBlockChain; +import org.bitcoinj.core.NetworkParameters; +import org.bitcoinj.core.PrunedException; +import org.bitcoinj.core.VerificationException; +import org.bitcoinj.store.BlockStore; +import org.bitcoinj.store.BlockStoreException; +import org.bitcoinj.store.FullPrunedBlockStore; +import org.bitcoinj.store.MemoryBlockStore; +import org.bitcoinj.store.MemoryFullPrunedBlockStore; +import org.bitcoinj.store.SPVBlockStore; import org.bitcoinj.utils.BlockFileLoader; import java.io.File; diff --git a/tools/src/main/java/org/bitcoinj/tools/BuildCheckpoints.java b/tools/src/main/java/org/bitcoinj/tools/BuildCheckpoints.java index 6e667eb7a..1bbc8cdd0 100644 --- a/tools/src/main/java/org/bitcoinj/tools/BuildCheckpoints.java +++ b/tools/src/main/java/org/bitcoinj/tools/BuildCheckpoints.java @@ -18,9 +18,15 @@ package org.bitcoinj.tools; import org.bitcoinj.base.BitcoinNetwork; -import org.bitcoinj.base.Sha256Hash; import org.bitcoinj.base.internal.TimeUtils; -import org.bitcoinj.core.*; +import org.bitcoinj.core.BlockChain; +import org.bitcoinj.core.CheckpointManager; +import org.bitcoinj.core.Context; +import org.bitcoinj.core.NetworkParameters; +import org.bitcoinj.core.Peer; +import org.bitcoinj.core.PeerAddress; +import org.bitcoinj.core.PeerGroup; +import org.bitcoinj.core.StoredBlock; import org.bitcoinj.net.discovery.DnsDiscovery; import org.bitcoinj.store.BlockStore; import org.bitcoinj.store.MemoryBlockStore; @@ -28,7 +34,6 @@ import org.bitcoinj.utils.BriefLogFormatter; import org.bitcoinj.utils.Threading; import picocli.CommandLine; -import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -41,8 +46,6 @@ import java.net.UnknownHostException; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -import java.security.DigestOutputStream; -import java.security.MessageDigest; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.List; diff --git a/tools/src/main/java/org/bitcoinj/tools/PaymentProtocolTool.java b/tools/src/main/java/org/bitcoinj/tools/PaymentProtocolTool.java index 9e8a60a4d..3eb2d2fe5 100644 --- a/tools/src/main/java/org/bitcoinj/tools/PaymentProtocolTool.java +++ b/tools/src/main/java/org/bitcoinj/tools/PaymentProtocolTool.java @@ -18,12 +18,12 @@ package org.bitcoinj.tools; import org.bitcoinj.base.internal.TimeUtils; import org.bitcoinj.crypto.TrustStoreLoader; +import org.bitcoinj.protobuf.payments.Protos; import org.bitcoinj.protocols.payments.PaymentProtocol; import org.bitcoinj.protocols.payments.PaymentProtocolException; import org.bitcoinj.protocols.payments.PaymentSession; import org.bitcoinj.uri.BitcoinURI; import org.bitcoinj.uri.BitcoinURIParseException; -import org.bitcoinj.protobuf.payments.Protos; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -33,7 +33,6 @@ import java.net.URISyntaxException; import java.security.KeyStoreException; import java.security.cert.X509Certificate; import java.time.Instant; -import java.util.Date; import java.util.concurrent.ExecutionException; import static java.lang.String.format; diff --git a/tools/src/main/java/org/bitcoinj/tools/TestFeeLevel.java b/tools/src/main/java/org/bitcoinj/tools/TestFeeLevel.java index 4a831fe09..fa00fce9a 100644 --- a/tools/src/main/java/org/bitcoinj/tools/TestFeeLevel.java +++ b/tools/src/main/java/org/bitcoinj/tools/TestFeeLevel.java @@ -19,9 +19,8 @@ package org.bitcoinj.tools; import org.bitcoinj.base.BitcoinNetwork; import org.bitcoinj.base.Coin; import org.bitcoinj.base.ScriptType; -import org.bitcoinj.core.*; -import org.bitcoinj.core.listeners.PeerConnectedEventListener; -import org.bitcoinj.core.listeners.PeerDisconnectedEventListener; +import org.bitcoinj.core.InsufficientMoneyException; +import org.bitcoinj.core.Transaction; import org.bitcoinj.kits.WalletAppKit; import org.bitcoinj.utils.BriefLogFormatter; import org.bitcoinj.wallet.KeyChainGroupStructure; diff --git a/tools/src/main/java/org/bitcoinj/tools/WatchMempool.java b/tools/src/main/java/org/bitcoinj/tools/WatchMempool.java index e0348dc43..d9f8660a0 100644 --- a/tools/src/main/java/org/bitcoinj/tools/WatchMempool.java +++ b/tools/src/main/java/org/bitcoinj/tools/WatchMempool.java @@ -17,18 +17,9 @@ package org.bitcoinj.tools; -import java.time.Duration; -import java.time.Instant; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import org.bitcoinj.base.BitcoinNetwork; import org.bitcoinj.base.Network; import org.bitcoinj.base.internal.TimeUtils; -import org.bitcoinj.core.listeners.*; -import org.bitcoinj.core.Peer; import org.bitcoinj.core.PeerGroup; import org.bitcoinj.core.Transaction; import org.bitcoinj.net.discovery.DnsDiscovery; @@ -38,6 +29,13 @@ import org.bitcoinj.wallet.RiskAnalysis.Result; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.time.Duration; +import java.time.Instant; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + public class WatchMempool { private static final Logger log = LoggerFactory.getLogger(WatchMempool.class); private static final Network NETWORK = BitcoinNetwork.MAINNET; diff --git a/wallettemplate/src/main/java/org/bitcoinj/walletfx/application/WalletApplication.java b/wallettemplate/src/main/java/org/bitcoinj/walletfx/application/WalletApplication.java index 5b64aa592..b02d3ad42 100644 --- a/wallettemplate/src/main/java/org/bitcoinj/walletfx/application/WalletApplication.java +++ b/wallettemplate/src/main/java/org/bitcoinj/walletfx/application/WalletApplication.java @@ -17,6 +17,7 @@ package org.bitcoinj.walletfx.application; import com.google.common.util.concurrent.Service; +import jakarta.annotation.Nullable; import javafx.application.Platform; import javafx.scene.input.KeyCombination; import javafx.stage.Stage; @@ -34,7 +35,6 @@ import org.bitcoinj.wallet.KeyChainGroupStructure; import org.bitcoinj.walletfx.utils.GuiUtils; import wallettemplate.WalletSetPasswordController; -import jakarta.annotation.Nullable; import java.io.File; import java.io.IOException; diff --git a/wallettemplate/src/main/java/org/bitcoinj/walletfx/controls/BitcoinAddressValidator.java b/wallettemplate/src/main/java/org/bitcoinj/walletfx/controls/BitcoinAddressValidator.java index dd5b2bf02..6b6ee5e09 100644 --- a/wallettemplate/src/main/java/org/bitcoinj/walletfx/controls/BitcoinAddressValidator.java +++ b/wallettemplate/src/main/java/org/bitcoinj/walletfx/controls/BitcoinAddressValidator.java @@ -16,11 +16,10 @@ package org.bitcoinj.walletfx.controls; -import org.bitcoinj.base.exceptions.AddressFormatException; - import javafx.scene.Node; import javafx.scene.control.TextField; import org.bitcoinj.base.AddressParser; +import org.bitcoinj.base.exceptions.AddressFormatException; import org.bitcoinj.walletfx.utils.TextFieldValidator; /** diff --git a/wallettemplate/src/main/java/org/bitcoinj/walletfx/controls/ClickableBitcoinAddress.java b/wallettemplate/src/main/java/org/bitcoinj/walletfx/controls/ClickableBitcoinAddress.java index bdff64959..96a75c213 100644 --- a/wallettemplate/src/main/java/org/bitcoinj/walletfx/controls/ClickableBitcoinAddress.java +++ b/wallettemplate/src/main/java/org/bitcoinj/walletfx/controls/ClickableBitcoinAddress.java @@ -16,10 +16,8 @@ package org.bitcoinj.walletfx.controls; -import java.awt.Desktop; -import java.io.IOException; -import java.net.URI; - +import de.jensd.fx.fontawesome.AwesomeDude; +import de.jensd.fx.fontawesome.AwesomeIcon; import javafx.beans.binding.StringExpression; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; @@ -38,17 +36,16 @@ import javafx.scene.input.MouseButton; import javafx.scene.input.MouseEvent; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.Pane; - import org.bitcoinj.base.Address; import org.bitcoinj.uri.BitcoinURI; - import org.bitcoinj.walletfx.overlay.OverlayController; import org.bitcoinj.walletfx.overlay.OverlayableStackPaneController; import org.bitcoinj.walletfx.utils.GuiUtils; import org.bitcoinj.walletfx.utils.QRCodeImages; -import de.jensd.fx.fontawesome.AwesomeDude; -import de.jensd.fx.fontawesome.AwesomeIcon; +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; import static javafx.beans.binding.Bindings.convert; diff --git a/wallettemplate/src/main/java/org/bitcoinj/walletfx/controls/NotificationBarPane.java b/wallettemplate/src/main/java/org/bitcoinj/walletfx/controls/NotificationBarPane.java index bd3255e7b..f4f80418e 100644 --- a/wallettemplate/src/main/java/org/bitcoinj/walletfx/controls/NotificationBarPane.java +++ b/wallettemplate/src/main/java/org/bitcoinj/walletfx/controls/NotificationBarPane.java @@ -16,6 +16,7 @@ package org.bitcoinj.walletfx.controls; +import jakarta.annotation.Nullable; import javafx.animation.Interpolator; import javafx.animation.KeyFrame; import javafx.animation.KeyValue; @@ -36,8 +37,6 @@ import org.bitcoinj.walletfx.utils.GuiUtils; import org.bitcoinj.walletfx.utils.easing.EasingMode; import org.bitcoinj.walletfx.utils.easing.ElasticInterpolator; -import jakarta.annotation.Nullable; - /** * Wraps the given Node in a BorderPane and allows a thin bar to slide in from the bottom or top, squeezing the content * node. The API allows different "items" to be added/removed and they will be displayed one at a time, fading between diff --git a/wallettemplate/src/main/java/org/bitcoinj/walletfx/overlay/OverlayableStackPaneController.java b/wallettemplate/src/main/java/org/bitcoinj/walletfx/overlay/OverlayableStackPaneController.java index 2844495cf..7ea4bf416 100644 --- a/wallettemplate/src/main/java/org/bitcoinj/walletfx/overlay/OverlayableStackPaneController.java +++ b/wallettemplate/src/main/java/org/bitcoinj/walletfx/overlay/OverlayableStackPaneController.java @@ -15,14 +15,13 @@ */ package org.bitcoinj.walletfx.overlay; +import jakarta.annotation.Nullable; import javafx.fxml.FXMLLoader; import javafx.scene.Node; import javafx.scene.layout.Pane; import javafx.scene.layout.StackPane; import org.bitcoinj.walletfx.utils.GuiUtils; -import jakarta.annotation.Nullable; - import java.io.IOException; import java.net.URL; diff --git a/wallettemplate/src/main/java/org/bitcoinj/walletfx/utils/BitcoinUIModel.java b/wallettemplate/src/main/java/org/bitcoinj/walletfx/utils/BitcoinUIModel.java index 86a606e14..4eae97b6e 100644 --- a/wallettemplate/src/main/java/org/bitcoinj/walletfx/utils/BitcoinUIModel.java +++ b/wallettemplate/src/main/java/org/bitcoinj/walletfx/utils/BitcoinUIModel.java @@ -16,18 +16,17 @@ package org.bitcoinj.walletfx.utils; -import org.bitcoinj.base.Address; -import org.bitcoinj.base.Coin; -import org.bitcoinj.core.listeners.DownloadProgressTracker; -import org.bitcoinj.wallet.Wallet; import javafx.application.Platform; import javafx.beans.property.ReadOnlyDoubleProperty; import javafx.beans.property.ReadOnlyObjectProperty; import javafx.beans.property.SimpleDoubleProperty; import javafx.beans.property.SimpleObjectProperty; +import org.bitcoinj.base.Address; +import org.bitcoinj.base.Coin; +import org.bitcoinj.core.listeners.DownloadProgressTracker; +import org.bitcoinj.wallet.Wallet; import java.time.Instant; -import java.util.Date; /** * A class that exposes relevant bitcoin stuff as JavaFX bindable properties. diff --git a/wallettemplate/src/main/java/org/bitcoinj/walletfx/utils/GuiUtils.java b/wallettemplate/src/main/java/org/bitcoinj/walletfx/utils/GuiUtils.java index 4a31d369e..e383a1ad6 100644 --- a/wallettemplate/src/main/java/org/bitcoinj/walletfx/utils/GuiUtils.java +++ b/wallettemplate/src/main/java/org/bitcoinj/walletfx/utils/GuiUtils.java @@ -16,7 +16,12 @@ package org.bitcoinj.walletfx.utils; -import javafx.animation.*; +import javafx.animation.Animation; +import javafx.animation.FadeTransition; +import javafx.animation.KeyFrame; +import javafx.animation.KeyValue; +import javafx.animation.ScaleTransition; +import javafx.animation.Timeline; import javafx.application.Platform; import javafx.fxml.FXMLLoader; import javafx.scene.Node; diff --git a/wallettemplate/src/main/java/org/bitcoinj/walletfx/utils/KeyDerivationTasks.java b/wallettemplate/src/main/java/org/bitcoinj/walletfx/utils/KeyDerivationTasks.java index 1231e7151..c41fa43e9 100644 --- a/wallettemplate/src/main/java/org/bitcoinj/walletfx/utils/KeyDerivationTasks.java +++ b/wallettemplate/src/main/java/org/bitcoinj/walletfx/utils/KeyDerivationTasks.java @@ -16,14 +16,14 @@ package org.bitcoinj.walletfx.utils; -import org.bitcoinj.crypto.AesKey; -import org.bitcoinj.crypto.KeyCrypterScrypt; +import jakarta.annotation.Nullable; import javafx.beans.property.ReadOnlyDoubleProperty; import javafx.concurrent.Task; +import org.bitcoinj.crypto.AesKey; +import org.bitcoinj.crypto.KeyCrypterScrypt; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import jakarta.annotation.Nullable; import java.time.Duration; import static org.bitcoinj.walletfx.utils.GuiUtils.checkGuiThread; diff --git a/wallettemplate/src/main/java/wallettemplate/MainController.java b/wallettemplate/src/main/java/wallettemplate/MainController.java index fe749380a..ed2b26055 100644 --- a/wallettemplate/src/main/java/wallettemplate/MainController.java +++ b/wallettemplate/src/main/java/wallettemplate/MainController.java @@ -16,30 +16,30 @@ package wallettemplate; -import javafx.beans.binding.Binding; -import javafx.beans.binding.Bindings; -import javafx.beans.value.ObservableValue; -import javafx.scene.Scene; -import javafx.scene.input.KeyCombination; -import javafx.scene.layout.Pane; -import org.bitcoinj.core.listeners.DownloadProgressTracker; -import org.bitcoinj.base.Coin; -import org.bitcoinj.base.utils.MonetaryFormat; import javafx.animation.FadeTransition; import javafx.animation.ParallelTransition; import javafx.animation.TranslateTransition; +import javafx.beans.binding.Binding; +import javafx.beans.binding.Bindings; +import javafx.beans.value.ObservableValue; import javafx.event.ActionEvent; +import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; +import javafx.scene.input.KeyCombination; import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; import javafx.util.Duration; +import org.bitcoinj.base.Coin; +import org.bitcoinj.base.utils.MonetaryFormat; +import org.bitcoinj.core.listeners.DownloadProgressTracker; import org.bitcoinj.walletfx.application.MainWindowController; import org.bitcoinj.walletfx.application.WalletApplication; -import org.bitcoinj.walletfx.utils.GuiUtils; -import org.bitcoinj.walletfx.utils.TextFieldValidator; import org.bitcoinj.walletfx.controls.ClickableBitcoinAddress; import org.bitcoinj.walletfx.controls.NotificationBarPane; import org.bitcoinj.walletfx.utils.BitcoinUIModel; +import org.bitcoinj.walletfx.utils.GuiUtils; +import org.bitcoinj.walletfx.utils.TextFieldValidator; import org.bitcoinj.walletfx.utils.easing.EasingMode; import org.bitcoinj.walletfx.utils.easing.ElasticInterpolator; diff --git a/wallettemplate/src/main/java/wallettemplate/SendMoneyController.java b/wallettemplate/src/main/java/wallettemplate/SendMoneyController.java index 41648b60e..1e0a09112 100644 --- a/wallettemplate/src/main/java/wallettemplate/SendMoneyController.java +++ b/wallettemplate/src/main/java/wallettemplate/SendMoneyController.java @@ -17,28 +17,30 @@ package wallettemplate; import javafx.application.Platform; -import javafx.scene.layout.HBox; -import org.bitcoinj.base.Address; -import org.bitcoinj.base.Coin; -import org.bitcoinj.crypto.AesKey; -import org.bitcoinj.core.*; -import org.bitcoinj.crypto.ECKey; -import org.bitcoinj.wallet.SendRequest; -import org.bitcoinj.wallet.Wallet; - import javafx.event.ActionEvent; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; +import javafx.scene.layout.HBox; +import org.bitcoinj.base.Address; +import org.bitcoinj.base.Coin; +import org.bitcoinj.core.InsufficientMoneyException; +import org.bitcoinj.core.TransactionConfidence; +import org.bitcoinj.crypto.AesKey; +import org.bitcoinj.crypto.ECKey; +import org.bitcoinj.wallet.SendRequest; +import org.bitcoinj.wallet.Wallet; import org.bitcoinj.walletfx.application.WalletApplication; +import org.bitcoinj.walletfx.controls.BitcoinAddressValidator; import org.bitcoinj.walletfx.overlay.OverlayController; import org.bitcoinj.walletfx.overlay.OverlayableStackPaneController; -import org.bitcoinj.walletfx.controls.BitcoinAddressValidator; import org.bitcoinj.walletfx.utils.TextFieldValidator; import org.bitcoinj.walletfx.utils.WTUtils; import static org.bitcoinj.base.internal.Preconditions.checkState; -import static org.bitcoinj.walletfx.utils.GuiUtils.*; +import static org.bitcoinj.walletfx.utils.GuiUtils.checkGuiThread; +import static org.bitcoinj.walletfx.utils.GuiUtils.crashAlert; +import static org.bitcoinj.walletfx.utils.GuiUtils.informationalAlert; public class SendMoneyController implements OverlayController { public Button sendBtn; diff --git a/wallettemplate/src/main/java/wallettemplate/WalletPasswordController.java b/wallettemplate/src/main/java/wallettemplate/WalletPasswordController.java index 3df2470c7..ef941ecf0 100644 --- a/wallettemplate/src/main/java/wallettemplate/WalletPasswordController.java +++ b/wallettemplate/src/main/java/wallettemplate/WalletPasswordController.java @@ -16,10 +16,8 @@ package wallettemplate; -import javafx.application.Platform; -import org.bitcoinj.crypto.AesKey; -import org.bitcoinj.crypto.KeyCrypterScrypt; import com.google.protobuf.ByteString; +import javafx.application.Platform; import javafx.beans.property.ReadOnlyObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.event.ActionEvent; @@ -30,18 +28,23 @@ import javafx.scene.control.ProgressIndicator; import javafx.scene.image.ImageView; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; +import org.bitcoinj.crypto.AesKey; +import org.bitcoinj.crypto.KeyCrypterScrypt; import org.bitcoinj.walletfx.application.WalletApplication; import org.bitcoinj.walletfx.overlay.OverlayController; import org.bitcoinj.walletfx.overlay.OverlayableStackPaneController; +import org.bitcoinj.walletfx.utils.KeyDerivationTasks; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.bitcoinj.walletfx.utils.KeyDerivationTasks; import java.nio.ByteBuffer; import java.time.Duration; import java.util.Objects; -import static org.bitcoinj.walletfx.utils.GuiUtils.*; +import static org.bitcoinj.walletfx.utils.GuiUtils.checkGuiThread; +import static org.bitcoinj.walletfx.utils.GuiUtils.fadeIn; +import static org.bitcoinj.walletfx.utils.GuiUtils.fadeOut; +import static org.bitcoinj.walletfx.utils.GuiUtils.informationalAlert; /** * User interface for entering a password on demand, e.g. to send money. Also used when encrypting a wallet. Shows a diff --git a/wallettemplate/src/main/java/wallettemplate/WalletSetPasswordController.java b/wallettemplate/src/main/java/wallettemplate/WalletSetPasswordController.java index 53d1d7845..2230f8736 100644 --- a/wallettemplate/src/main/java/wallettemplate/WalletSetPasswordController.java +++ b/wallettemplate/src/main/java/wallettemplate/WalletSetPasswordController.java @@ -16,25 +16,30 @@ package wallettemplate; -import javafx.event.*; -import javafx.fxml.*; -import javafx.scene.control.*; -import javafx.scene.layout.*; +import com.google.protobuf.ByteString; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.PasswordField; +import javafx.scene.control.ProgressIndicator; +import javafx.scene.layout.GridPane; import org.bitcoinj.crypto.AesKey; -import org.bitcoinj.crypto.*; +import org.bitcoinj.crypto.KeyCrypterScrypt; import org.bitcoinj.protobuf.wallet.Protos; import org.bitcoinj.walletfx.application.WalletApplication; import org.bitcoinj.walletfx.overlay.OverlayController; import org.bitcoinj.walletfx.overlay.OverlayableStackPaneController; -import org.slf4j.*; - -import com.google.protobuf.ByteString; +import org.bitcoinj.walletfx.utils.KeyDerivationTasks; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.time.Duration; -import java.util.concurrent.*; +import java.util.concurrent.CompletableFuture; -import org.bitcoinj.walletfx.utils.KeyDerivationTasks; -import static org.bitcoinj.walletfx.utils.GuiUtils.*; +import static org.bitcoinj.walletfx.utils.GuiUtils.fadeIn; +import static org.bitcoinj.walletfx.utils.GuiUtils.fadeOut; +import static org.bitcoinj.walletfx.utils.GuiUtils.informationalAlert; public class WalletSetPasswordController implements OverlayController { private static final Logger log = LoggerFactory.getLogger(WalletSetPasswordController.class); diff --git a/wallettemplate/src/main/java/wallettemplate/WalletSettingsController.java b/wallettemplate/src/main/java/wallettemplate/WalletSettingsController.java index 79d7db447..92502e39f 100644 --- a/wallettemplate/src/main/java/wallettemplate/WalletSettingsController.java +++ b/wallettemplate/src/main/java/wallettemplate/WalletSettingsController.java @@ -16,11 +16,8 @@ package wallettemplate; -import org.bitcoinj.base.internal.InternalUtils; -import org.bitcoinj.crypto.AesKey; -import org.bitcoinj.crypto.MnemonicCode; -import org.bitcoinj.wallet.DeterministicSeed; import com.google.common.util.concurrent.Service; +import jakarta.annotation.Nullable; import javafx.application.Platform; import javafx.beans.binding.BooleanBinding; import javafx.event.ActionEvent; @@ -28,14 +25,17 @@ import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.DatePicker; import javafx.scene.control.TextArea; +import org.bitcoinj.base.internal.InternalUtils; +import org.bitcoinj.crypto.AesKey; +import org.bitcoinj.crypto.MnemonicCode; +import org.bitcoinj.wallet.DeterministicSeed; import org.bitcoinj.walletfx.application.WalletApplication; import org.bitcoinj.walletfx.overlay.OverlayController; import org.bitcoinj.walletfx.overlay.OverlayableStackPaneController; +import org.bitcoinj.walletfx.utils.TextFieldValidator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.bitcoinj.walletfx.utils.TextFieldValidator; -import jakarta.annotation.Nullable; import java.time.Instant; import java.time.LocalDate; import java.time.ZoneId; @@ -43,7 +43,10 @@ import java.time.ZoneOffset; import java.util.List; import java.util.Objects; -import static javafx.beans.binding.Bindings.*; +import static javafx.beans.binding.Bindings.createBooleanBinding; +import static javafx.beans.binding.Bindings.equal; +import static javafx.beans.binding.Bindings.not; +import static javafx.beans.binding.Bindings.or; import static org.bitcoinj.walletfx.utils.GuiUtils.checkGuiThread; import static org.bitcoinj.walletfx.utils.GuiUtils.informationalAlert; import static org.bitcoinj.walletfx.utils.WTUtils.didThrow; diff --git a/wallettemplate/src/main/resources/org/bitcoinj/walletfx/controls/bitcoin_address.fxml b/wallettemplate/src/main/resources/org/bitcoinj/walletfx/controls/bitcoin_address.fxml index d32665c9e..be844d34a 100644 --- a/wallettemplate/src/main/resources/org/bitcoinj/walletfx/controls/bitcoin_address.fxml +++ b/wallettemplate/src/main/resources/org/bitcoinj/walletfx/controls/bitcoin_address.fxml @@ -1,14 +1,11 @@ - - - - - - - - - + + + + + + diff --git a/wallettemplate/src/main/resources/org/bitcoinj/walletfx/utils/alert.fxml b/wallettemplate/src/main/resources/org/bitcoinj/walletfx/utils/alert.fxml index a820c8b1a..9c0c2c4f4 100644 --- a/wallettemplate/src/main/resources/org/bitcoinj/walletfx/utils/alert.fxml +++ b/wallettemplate/src/main/resources/org/bitcoinj/walletfx/utils/alert.fxml @@ -1,14 +1,17 @@ - - - - - - - - - + + + + + + + + + + + + diff --git a/wallettemplate/src/main/resources/wallettemplate/main.fxml b/wallettemplate/src/main/resources/wallettemplate/main.fxml index 8ebdada6e..ad7f3dcf4 100644 --- a/wallettemplate/src/main/resources/wallettemplate/main.fxml +++ b/wallettemplate/src/main/resources/wallettemplate/main.fxml @@ -2,18 +2,19 @@ - - - - - - - - - - - + + + + + + + + + + + +