Skip to content

Commit

Permalink
Wallet: remove deprecated methods that take NetworkParameters
Browse files Browse the repository at this point in the history
  • Loading branch information
schildbach committed Sep 2, 2024
1 parent bc7883e commit f28d369
Showing 1 changed file with 0 additions and 157 deletions.
157 changes: 0 additions & 157 deletions core/src/main/java/org/bitcoinj/wallet/Wallet.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,6 @@ public static Wallet createDeterministic(Network network, ScriptType outputScrip
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
Expand All @@ -347,14 +339,6 @@ public static Wallet createDeterministic(Network network, ScriptType outputScrip
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.
Expand All @@ -364,14 +348,6 @@ public static Wallet createBasic(Network network) {
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
Expand All @@ -383,15 +359,6 @@ public static Wallet fromSeed(Network network, DeterministicSeed seed,
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
Expand All @@ -404,15 +371,6 @@ public static Wallet fromSeed(Network network, DeterministicSeed seed, ScriptTyp
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
Expand All @@ -427,15 +385,6 @@ public static Wallet fromSeed(Network network, DeterministicSeed seed, ScriptTyp
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<ChildNumber> 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()}.
Expand All @@ -447,15 +396,6 @@ public static Wallet fromWatchingKey(Network network, DeterministicKey watchKey,
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.
Expand All @@ -470,14 +410,6 @@ public static Wallet fromWatchingKeyB58(Network network, String watchKeyB58, Ins
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}
Expand All @@ -489,24 +421,6 @@ public static Wallet fromWatchingKeyB58(Network network, String watchKeyB58) {
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);
}

/**
* @deprecated Use {@link #fromWatchingKeyB58(Network, String, Instant)} or {@link #fromWatchingKeyB58(Network, String)}
*/
@Deprecated
public static Wallet fromWatchingKeyB58(NetworkParameters params, String watchKeyB58, long creationTimeSeconds) {
return (creationTimeSeconds == 0)
? fromWatchingKeyB58(params.network(), watchKeyB58)
: fromWatchingKeyB58(params.network(), watchKeyB58, Instant.ofEpochSecond(creationTimeSeconds));
}

/**
* 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.
Expand All @@ -519,17 +433,6 @@ public static Wallet fromSpendingKey(Network network, DeterministicKey spendKey,
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
Expand All @@ -543,14 +446,6 @@ public static Wallet fromSpendingKeyB58(Network network, String spendingKeyB58,
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}.
Expand All @@ -562,24 +457,6 @@ public static Wallet fromSpendingKeyB58(Network network, String spendingKeyB58)
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);
}

/**
* @deprecated Use {@link #fromSpendingKeyB58(Network, String, Instant)} or {@link #fromSpendingKeyB58(Network, String)}
*/
@Deprecated
public static Wallet fromSpendingKeyB58(NetworkParameters params, String spendingKeyB58, long creationTimeSeconds) {
return (creationTimeSeconds == 0)
? fromSpendingKeyB58(params.network(), spendingKeyB58)
: fromSpendingKeyB58(params.network(), spendingKeyB58, Instant.ofEpochSecond(creationTimeSeconds));
}

/**
* 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.
Expand Down Expand Up @@ -607,15 +484,6 @@ public static Wallet fromMasterKey(Network network, DeterministicKey masterKey,
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())
Expand Down Expand Up @@ -653,14 +521,6 @@ public Wallet(Network network, KeyChainGroup keyChainGroup) {
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) -> {
Expand Down Expand Up @@ -689,14 +549,6 @@ public Network network() {
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
Expand Down Expand Up @@ -1921,15 +1773,6 @@ public void saveToFileStream(OutputStream f) throws IOException {
}
}

/**
* 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[])}}
Expand Down

0 comments on commit f28d369

Please sign in to comment.