From 5be38aeca1609ba049178a3d322e323e5c65f2e2 Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Mon, 2 Sep 2024 20:33:03 +0200 Subject: [PATCH] Wallet: remove deprecated methods that take NetworkParameters --- .../main/java/org/bitcoinj/wallet/Wallet.java | 137 ------------------ 1 file changed, 137 deletions(-) diff --git a/core/src/main/java/org/bitcoinj/wallet/Wallet.java b/core/src/main/java/org/bitcoinj/wallet/Wallet.java index 7fe0d09c7..e72b1b1bf 100644 --- a/core/src/main/java/org/bitcoinj/wallet/Wallet.java +++ b/core/src/main/java/org/bitcoinj/wallet/Wallet.java @@ -325,14 +325,6 @@ public class Wallet extends BaseTaggableObject return createDeterministic(network, outputScriptType, KeyChainGroupStructure.BIP32); } - /** - * @deprecated use {@link #createDeterministic(Network, ScriptType)} - */ - @Deprecated - public static Wallet createDeterministic(NetworkParameters params, ScriptType outputScriptType) { - return createDeterministic(params.network(), outputScriptType); - } - /** * Creates a new, empty wallet with a randomly chosen seed and no transactions. Make sure to provide for sufficient * backup! Any keys will be derived from the seed. If you want to restore a wallet from disk instead, see @@ -346,14 +338,6 @@ public class Wallet extends BaseTaggableObject return new Wallet(network, KeyChainGroup.builder(network, keyChainGroupStructure).fromRandom(outputScriptType).build()); } - /** - * @deprecated use {@link Wallet#createDeterministic(Network, ScriptType, KeyChainGroupStructure)} - */ - @Deprecated - public static Wallet createDeterministic(NetworkParameters params, ScriptType outputScriptType, KeyChainGroupStructure keyChainGroupStructure) { - return new Wallet(params.network(), KeyChainGroup.builder(params.network(), keyChainGroupStructure).fromRandom(outputScriptType).build()); - } - /** * Creates a new, empty wallet with just a basic keychain and no transactions. No deterministic chains will be created * automatically. This is meant for when you just want to import a few keys and operate on them. @@ -363,14 +347,6 @@ public class Wallet extends BaseTaggableObject return new Wallet(network, KeyChainGroup.createBasic(network)); } - /** - * @deprecated use {@link #createBasic(Network)} - */ - @Deprecated - public static Wallet createBasic(NetworkParameters params) { - return createBasic(params.network()); - } - /** * @param network network wallet will operate on * @param seed deterministic seed @@ -382,15 +358,6 @@ public class Wallet extends BaseTaggableObject return fromSeed(network, seed, outputScriptType, KeyChainGroupStructure.BIP32); } - /** - * @deprecated use {@link #fromSeed(Network, DeterministicSeed, ScriptType)} - */ - @Deprecated - public static Wallet fromSeed(NetworkParameters params, DeterministicSeed seed, - ScriptType outputScriptType) { - return fromSeed(params.network(), seed, outputScriptType); - } - /** * @param network network wallet will operate on * @param seed deterministic seed @@ -403,15 +370,6 @@ public class Wallet extends BaseTaggableObject return new Wallet(network, KeyChainGroup.builder(network, structure).fromSeed(seed, outputScriptType).build()); } - /** - * @deprecated use {@link #fromSeed(Network, DeterministicSeed, ScriptType, KeyChainGroupStructure)} - */ - @Deprecated - public static Wallet fromSeed(NetworkParameters params, DeterministicSeed seed, ScriptType outputScriptType, - KeyChainGroupStructure structure) { - return fromSeed(params.network(), seed, outputScriptType, structure); - } - /** * @param network network wallet will operate on * @param seed deterministic seed @@ -426,15 +384,6 @@ public class Wallet extends BaseTaggableObject return new Wallet(network, KeyChainGroup.builder(network).addChain(chain).build()); } - /** - * @deprecated use {@link #fromSeed(Network, DeterministicSeed, ScriptType, List)} - */ - @Deprecated - public static Wallet fromSeed(NetworkParameters params, DeterministicSeed seed, ScriptType outputScriptType, - List accountPath) { - return fromSeed(params.network(), seed, outputScriptType, accountPath); - } - /** * Creates a wallet that tracks payments to and from the HD key hierarchy rooted by the given watching key. This HAS * to be an account key as returned by {@link DeterministicKeyChain#getWatchingKey()}. @@ -446,15 +395,6 @@ public class Wallet extends BaseTaggableObject return new Wallet(network, KeyChainGroup.builder(network).addChain(chain).build()); } - /** - * @deprecated use {@link #fromWatchingKey(Network, DeterministicKey, ScriptType)} - */ - @Deprecated - public static Wallet fromWatchingKey(NetworkParameters params, DeterministicKey watchKey, - ScriptType outputScriptType) { - return fromWatchingKey(params.network(), watchKey, outputScriptType); - } - /** * Creates a wallet that tracks payments to and from the HD key hierarchy rooted by the given watching key. The * account path is specified. @@ -469,14 +409,6 @@ public class Wallet extends BaseTaggableObject return fromWatchingKey(network, watchKey, outputScriptTypeFromB58(NetworkParameters.of(network), watchKeyB58)); } - /** - * @deprecated use {@link #fromWatchingKeyB58(Network, String, Instant)} - */ - @Deprecated - public static Wallet fromWatchingKeyB58(NetworkParameters params, String watchKeyB58, Instant creationTime) { - return fromWatchingKeyB58(params.network(), watchKeyB58, creationTime); - } - /** * Creates a wallet that tracks payments to and from the HD key hierarchy rooted by the given watching key. The * account path is specified. The key's creation time will be set to {@link DeterministicHierarchy#BIP32_STANDARDISATION_TIME} @@ -488,14 +420,6 @@ public class Wallet extends BaseTaggableObject return fromWatchingKeyB58(network, watchKeyB58, DeterministicHierarchy.BIP32_STANDARDISATION_TIME); } - /** - * @deprecated use {@link #fromWatchingKeyB58(Network, String)} - */ - @Deprecated - public static Wallet fromWatchingKeyB58(NetworkParameters params, String watchKeyB58) { - return fromWatchingKeyB58(params.network(), watchKeyB58); - } - /** * Creates a wallet that tracks payments to and from the HD key hierarchy rooted by the given spending key. This HAS * to be an account key as returned by {@link DeterministicKeyChain#getWatchingKey()}. This wallet can also spend. @@ -508,17 +432,6 @@ public class Wallet extends BaseTaggableObject return new Wallet(network, KeyChainGroup.builder(network).addChain(chain).build()); } - /** - * @deprecated use {@link #fromSpendingKey(Network, DeterministicKey, ScriptType)} - */ - @Deprecated - public static Wallet fromSpendingKey(NetworkParameters params, DeterministicKey spendKey, - ScriptType outputScriptType) { - DeterministicKeyChain chain = DeterministicKeyChain.builder().spend(spendKey).outputScriptType(outputScriptType) - .build(); - return new Wallet(params.network(), KeyChainGroup.builder(params.network()).addChain(chain).build()); - } - /** * Creates a wallet that tracks payments to and from the HD key hierarchy rooted by the given spending key. * @param network network wallet will operate on @@ -532,14 +445,6 @@ public class Wallet extends BaseTaggableObject return fromSpendingKey(network, spendKey, outputScriptTypeFromB58(NetworkParameters.of(network), spendingKeyB58)); } - /** - * @deprecated use {@link #fromWatchingKeyB58(Network, String, Instant)} - */ - @Deprecated - public static Wallet fromSpendingKeyB58(NetworkParameters params, String spendingKeyB58, Instant creationTime) { - return fromWatchingKeyB58(params.network(), spendingKeyB58, creationTime); - } - /** * Creates a wallet that tracks payments to and from the HD key hierarchy rooted by the given spending key. * The key's creation time will be set to {@link DeterministicHierarchy#BIP32_STANDARDISATION_TIME}. @@ -551,14 +456,6 @@ public class Wallet extends BaseTaggableObject return fromSpendingKeyB58(network, spendingKeyB58, DeterministicHierarchy.BIP32_STANDARDISATION_TIME); } - /** - * @deprecated use {@link #fromSpendingKeyB58(Network, String)} - */ - @Deprecated - public static Wallet fromSpendingKeyB58(NetworkParameters params, String spendingKeyB58) { - return fromSpendingKeyB58(params.network(), spendingKeyB58); - } - /** * Creates a spending wallet that tracks payments to and from a BIP32-style HD key hierarchy rooted by {@code masterKey} and * {@code accountNumber}. The account path must be directly below the master key as in BIP-32. @@ -586,15 +483,6 @@ public class Wallet extends BaseTaggableObject return new Wallet(network, KeyChainGroup.builder(network).addChain(chain).build()); } - /** - * @deprecated use {@link #fromMasterKey(Network, DeterministicKey, ScriptType, ChildNumber)} - */ - @Deprecated - public static Wallet fromMasterKey(NetworkParameters params, DeterministicKey masterKey, - ScriptType outputScriptType, ChildNumber accountNumber) { - return fromMasterKey(params.network(), masterKey, outputScriptType, accountNumber); - } - private static ScriptType outputScriptTypeFromB58(NetworkParameters params, String base58) { int header = ByteBuffer.wrap(Base58.decodeChecked(base58)).getInt(); if (header == params.getBip32HeaderP2PKHpub() || header == params.getBip32HeaderP2PKHpriv()) @@ -632,14 +520,6 @@ public class Wallet extends BaseTaggableObject createTransientState(); } - /** - * @deprecated use {@link Wallet(NetworkParameters, KeyChainGroup)} - */ - @Deprecated - public Wallet(NetworkParameters params, KeyChainGroup keyChainGroup) { - this(params.network(), keyChainGroup); - } - private void createTransientState() { ignoreNextNewBlock = new HashSet<>(); txConfidenceListener = (confidence, reason) -> { @@ -668,14 +548,6 @@ public class Wallet extends BaseTaggableObject return network; } - /** - * @deprecated Use {@link #network()} - */ - @Deprecated - public NetworkParameters getNetworkParameters() { - return params; - } - /** * Parse an address string using all formats this wallet knows about for the wallet's network type * @param addressString Address string to parse @@ -1878,15 +1750,6 @@ public class Wallet extends BaseTaggableObject } } - /** - * Returns the parameters this wallet was created with. - * @deprecated Use {@link #network()} - */ - @Deprecated - public NetworkParameters getParams() { - return params; - } - /** * Returns a wallet deserialized from the given file. Extensions previously saved with the wallet can be * deserialized by calling @{@link WalletExtension#deserializeWalletExtension(Wallet, byte[])}}