diff --git a/assets/src/main/java/bisq/asset/Base58BitcoinAddressValidator.java b/assets/src/main/java/bisq/asset/Base58BitcoinAddressValidator.java index 9a99385f60..64401b8475 100644 --- a/assets/src/main/java/bisq/asset/Base58BitcoinAddressValidator.java +++ b/assets/src/main/java/bisq/asset/Base58BitcoinAddressValidator.java @@ -19,6 +19,7 @@ package bisq.asset; import org.bitcoinj.core.Address; import org.bitcoinj.core.AddressFormatException; +import org.bitcoinj.core.LegacyAddress; import org.bitcoinj.core.NetworkParameters; import org.bitcoinj.params.MainNetParams; @@ -27,7 +28,7 @@ import org.bitcoinj.params.MainNetParams; * * @author Chris Beams * @since 0.7.0 - * @see org.bitcoinj.core.Address#fromBase58(NetworkParameters, String) + * @see org.bitcoinj.core.LegacyAddress#fromBase58(NetworkParameters, String) */ public class Base58BitcoinAddressValidator implements AddressValidator { @@ -44,7 +45,7 @@ public class Base58BitcoinAddressValidator implements AddressValidator { @Override public AddressValidationResult validate(String address) { try { - Address.fromBase58(networkParameters, address); + LegacyAddress.fromBase58(networkParameters, address); } catch (AddressFormatException ex) { return AddressValidationResult.invalidAddress(ex); } diff --git a/core/src/main/java/bisq/core/btc/wallet/BsqWalletService.java b/core/src/main/java/bisq/core/btc/wallet/BsqWalletService.java index fb104675f9..a2b3e43874 100644 --- a/core/src/main/java/bisq/core/btc/wallet/BsqWalletService.java +++ b/core/src/main/java/bisq/core/btc/wallet/BsqWalletService.java @@ -43,6 +43,7 @@ import org.bitcoinj.core.BlockChain; import org.bitcoinj.core.Coin; import org.bitcoinj.core.ECKey; import org.bitcoinj.core.InsufficientMoneyException; +import org.bitcoinj.core.LegacyAddress; import org.bitcoinj.core.NetworkParameters; import org.bitcoinj.core.listeners.TransactionConfidenceEventListener; import org.bitcoinj.script.ScriptException; @@ -538,7 +539,7 @@ public class BsqWalletService extends WalletService implements DaoStateListener Transaction tx = new Transaction(params); checkArgument(Restrictions.isAboveDust(receiverAmount), "The amount is too low (dust limit)."); - tx.addOutput(receiverAmount, Address.fromBase58(params, receiverAddress)); + tx.addOutput(receiverAmount, LegacyAddress.fromBase58(params, receiverAddress)); SendRequest sendRequest = SendRequest.forTx(tx); sendRequest.fee = Coin.ZERO; diff --git a/core/src/main/java/bisq/core/btc/wallet/BtcWalletService.java b/core/src/main/java/bisq/core/btc/wallet/BtcWalletService.java index b7c2e59887..3fe56a7b96 100644 --- a/core/src/main/java/bisq/core/btc/wallet/BtcWalletService.java +++ b/core/src/main/java/bisq/core/btc/wallet/BtcWalletService.java @@ -33,6 +33,7 @@ import org.bitcoinj.core.Address; import org.bitcoinj.core.AddressFormatException; import org.bitcoinj.core.Coin; import org.bitcoinj.core.InsufficientMoneyException; +import org.bitcoinj.core.LegacyAddress; import org.bitcoinj.core.Transaction; import org.bitcoinj.core.TransactionConfidence; import org.bitcoinj.core.TransactionInput; @@ -1057,7 +1058,7 @@ public class BtcWalletService extends WalletService { final Coin receiverAmount = amount.subtract(fee); Preconditions.checkArgument(Restrictions.isAboveDust(receiverAmount), "The amount is too low (dust limit)."); - tx.addOutput(receiverAmount, Address.fromBase58(params, toAddress)); + tx.addOutput(receiverAmount, LegacyAddress.fromBase58(params, toAddress)); SendRequest sendRequest = SendRequest.forTx(tx); sendRequest.fee = fee; @@ -1088,7 +1089,7 @@ public class BtcWalletService extends WalletService { checkArgument(Restrictions.isAboveDust(netValue), "The amount is too low (dust limit)."); - tx.addOutput(netValue, Address.fromBase58(params, toAddress)); + tx.addOutput(netValue, LegacyAddress.fromBase58(params, toAddress)); SendRequest sendRequest = SendRequest.forTx(tx); sendRequest.fee = fee; @@ -1153,14 +1154,14 @@ public class BtcWalletService extends WalletService { Preconditions.checkArgument(Restrictions.isAboveDust(buyerAmount), "The buyerAmount is too low (dust limit)."); - tx.addOutput(buyerAmount, Address.fromBase58(params, buyerAddressString)); + tx.addOutput(buyerAmount, LegacyAddress.fromBase58(params, buyerAddressString)); } // sellerAmount can be 0 if (sellerAmount.isPositive()) { Preconditions.checkArgument(Restrictions.isAboveDust(sellerAmount), "The sellerAmount is too low (dust limit)."); - tx.addOutput(sellerAmount, Address.fromBase58(params, sellerAddressString)); + tx.addOutput(sellerAmount, LegacyAddress.fromBase58(params, sellerAddressString)); } SendRequest sendRequest = SendRequest.forTx(tx); diff --git a/core/src/main/java/bisq/core/btc/wallet/TradeWalletService.java b/core/src/main/java/bisq/core/btc/wallet/TradeWalletService.java index e6e826ed71..70a92275a5 100644 --- a/core/src/main/java/bisq/core/btc/wallet/TradeWalletService.java +++ b/core/src/main/java/bisq/core/btc/wallet/TradeWalletService.java @@ -36,6 +36,7 @@ import org.bitcoinj.core.AddressFormatException; import org.bitcoinj.core.Coin; import org.bitcoinj.core.ECKey; import org.bitcoinj.core.InsufficientMoneyException; +import org.bitcoinj.core.LegacyAddress; import org.bitcoinj.core.NetworkParameters; import org.bitcoinj.core.Sha256Hash; import org.bitcoinj.core.Transaction; @@ -151,7 +152,7 @@ public class TradeWalletService { Transaction tradingFeeTx = new Transaction(params); SendRequest sendRequest = null; try { - tradingFeeTx.addOutput(tradingFee, Address.fromBase58(params, feeReceiverAddress)); + tradingFeeTx.addOutput(tradingFee, LegacyAddress.fromBase58(params, feeReceiverAddress)); // the reserved amount we need for the trade we send to our trade reservedForTradeAddress tradingFeeTx.addOutput(reservedFundsForOffer, reservedForTradeAddress); @@ -515,7 +516,7 @@ public class TradeWalletService { TransactionOutput takerTransactionOutput = null; if (takerChangeOutputValue > 0 && takerChangeAddressString != null) { takerTransactionOutput = new TransactionOutput(params, preparedDepositTx, Coin.valueOf(takerChangeOutputValue), - Address.fromBase58(params, takerChangeAddressString)); + LegacyAddress.fromBase58(params, takerChangeAddressString)); } if (makerIsBuyer) { @@ -685,7 +686,7 @@ public class TradeWalletService { delayedPayoutTx.addInput(p2SHMultiSigOutput); applyLockTime(lockTime, delayedPayoutTx); Coin outputAmount = p2SHMultiSigOutput.getValue().subtract(minerFee); - delayedPayoutTx.addOutput(outputAmount, Address.fromBase58(params, donationAddressString)); + delayedPayoutTx.addOutput(outputAmount, LegacyAddress.fromBase58(params, donationAddressString)); WalletService.printTx("Unsigned delayedPayoutTx ToDonationAddress", delayedPayoutTx); WalletService.verifyTransaction(delayedPayoutTx); return delayedPayoutTx; @@ -937,10 +938,10 @@ public class TradeWalletService { Transaction payoutTx = new Transaction(params); payoutTx.addInput(p2SHMultiSigOutput); if (buyerPayoutAmount.isPositive()) { - payoutTx.addOutput(buyerPayoutAmount, Address.fromBase58(params, buyerAddressString)); + payoutTx.addOutput(buyerPayoutAmount, LegacyAddress.fromBase58(params, buyerAddressString)); } if (sellerPayoutAmount.isPositive()) { - payoutTx.addOutput(sellerPayoutAmount, Address.fromBase58(params, sellerAddressString)); + payoutTx.addOutput(sellerPayoutAmount, LegacyAddress.fromBase58(params, sellerAddressString)); } // take care of sorting! @@ -1000,10 +1001,10 @@ public class TradeWalletService { payoutTx.addInput(new TransactionInput(params, depositTx, p2SHMultiSigOutputScript.getProgram(), new TransactionOutPoint(params, 0, spendTxHash), msOutput)); if (buyerPayoutAmount.isPositive()) { - payoutTx.addOutput(buyerPayoutAmount, Address.fromBase58(params, buyerAddressString)); + payoutTx.addOutput(buyerPayoutAmount, LegacyAddress.fromBase58(params, buyerAddressString)); } if (sellerPayoutAmount.isPositive()) { - payoutTx.addOutput(sellerPayoutAmount, Address.fromBase58(params, sellerAddressString)); + payoutTx.addOutput(sellerPayoutAmount, LegacyAddress.fromBase58(params, sellerAddressString)); } // take care of sorting! @@ -1145,10 +1146,10 @@ public class TradeWalletService { Transaction transaction = new Transaction(params); transaction.addInput(p2SHMultiSigOutput); if (buyerPayoutAmount.isPositive()) { - transaction.addOutput(buyerPayoutAmount, Address.fromBase58(params, buyerAddressString)); + transaction.addOutput(buyerPayoutAmount, LegacyAddress.fromBase58(params, buyerAddressString)); } if (sellerPayoutAmount.isPositive()) { - transaction.addOutput(sellerPayoutAmount, Address.fromBase58(params, sellerAddressString)); + transaction.addOutput(sellerPayoutAmount, LegacyAddress.fromBase58(params, sellerAddressString)); } checkArgument(transaction.getOutputs().size() >= 1, "We need at least one output."); return transaction; diff --git a/core/src/main/java/bisq/core/btc/wallet/WalletService.java b/core/src/main/java/bisq/core/btc/wallet/WalletService.java index 6034c60a1c..699d08b6d5 100644 --- a/core/src/main/java/bisq/core/btc/wallet/WalletService.java +++ b/core/src/main/java/bisq/core/btc/wallet/WalletService.java @@ -37,6 +37,7 @@ import org.bitcoinj.core.Coin; import org.bitcoinj.core.Context; import org.bitcoinj.core.ECKey; import org.bitcoinj.core.InsufficientMoneyException; +import org.bitcoinj.core.LegacyAddress; import org.bitcoinj.core.NetworkParameters; import org.bitcoinj.core.listeners.TransactionConfidenceEventListener; import org.bitcoinj.script.ScriptException; @@ -499,7 +500,7 @@ public abstract class WalletService { ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) throws InsufficientMoneyException, AddressFormatException { - SendRequest sendRequest = SendRequest.emptyWallet(Address.fromBase58(params, toAddress)); + SendRequest sendRequest = SendRequest.emptyWallet(LegacyAddress.fromBase58(params, toAddress)); sendRequest.fee = Coin.ZERO; sendRequest.feePerKb = getTxFeeForWithdrawalPerByte().multiply(1000); sendRequest.aesKey = aesKey; diff --git a/core/src/main/java/bisq/core/dao/state/model/governance/CompensationProposal.java b/core/src/main/java/bisq/core/dao/state/model/governance/CompensationProposal.java index 7f1355f3bc..2d337d1f38 100644 --- a/core/src/main/java/bisq/core/dao/state/model/governance/CompensationProposal.java +++ b/core/src/main/java/bisq/core/dao/state/model/governance/CompensationProposal.java @@ -30,6 +30,7 @@ import bisq.common.util.CollectionUtils; import org.bitcoinj.core.Address; import org.bitcoinj.core.AddressFormatException; import org.bitcoinj.core.Coin; +import org.bitcoinj.core.LegacyAddress; import java.util.Date; import java.util.Map; @@ -120,7 +121,7 @@ public final class CompensationProposal extends Proposal implements IssuanceProp public Address getAddress() throws AddressFormatException { // Remove leading 'B' String underlyingBtcAddress = bsqAddress.substring(1, bsqAddress.length()); - return Address.fromBase58(Config.baseCurrencyNetworkParameters(), underlyingBtcAddress); + return LegacyAddress.fromBase58(Config.baseCurrencyNetworkParameters(), underlyingBtcAddress); } diff --git a/core/src/main/java/bisq/core/dao/state/model/governance/ReimbursementProposal.java b/core/src/main/java/bisq/core/dao/state/model/governance/ReimbursementProposal.java index 4bb15e2eb9..dc08b6b951 100644 --- a/core/src/main/java/bisq/core/dao/state/model/governance/ReimbursementProposal.java +++ b/core/src/main/java/bisq/core/dao/state/model/governance/ReimbursementProposal.java @@ -30,6 +30,7 @@ import bisq.common.util.CollectionUtils; import org.bitcoinj.core.Address; import org.bitcoinj.core.AddressFormatException; import org.bitcoinj.core.Coin; +import org.bitcoinj.core.LegacyAddress; import java.util.Date; import java.util.Map; @@ -120,7 +121,7 @@ public final class ReimbursementProposal extends Proposal implements IssuancePro public Address getAddress() throws AddressFormatException { // Remove leading 'B' String underlyingBtcAddress = bsqAddress.substring(1, bsqAddress.length()); - return Address.fromBase58(Config.baseCurrencyNetworkParameters(), underlyingBtcAddress); + return LegacyAddress.fromBase58(Config.baseCurrencyNetworkParameters(), underlyingBtcAddress); } diff --git a/core/src/main/java/bisq/core/util/coin/BsqFormatter.java b/core/src/main/java/bisq/core/util/coin/BsqFormatter.java index 963ecace26..60206f56ab 100644 --- a/core/src/main/java/bisq/core/util/coin/BsqFormatter.java +++ b/core/src/main/java/bisq/core/util/coin/BsqFormatter.java @@ -34,6 +34,7 @@ import bisq.common.util.MathUtils; import org.bitcoinj.core.Address; import org.bitcoinj.core.AddressFormatException; import org.bitcoinj.core.Coin; +import org.bitcoinj.core.LegacyAddress; import org.bitcoinj.utils.MonetaryFormat; import javax.inject.Inject; @@ -110,7 +111,7 @@ public class BsqFormatter implements CoinFormatter { encoded = encoded.substring(prefix.length(), encoded.length()); try { - return Address.fromBase58(Config.baseCurrencyNetworkParameters(), encoded); + return LegacyAddress.fromBase58(Config.baseCurrencyNetworkParameters(), encoded); } catch (AddressFormatException e) { throw new RuntimeException(e); } diff --git a/core/src/main/java/bisq/core/util/validation/BtcAddressValidator.java b/core/src/main/java/bisq/core/util/validation/BtcAddressValidator.java index 17d46d97f6..3f20fcc560 100644 --- a/core/src/main/java/bisq/core/util/validation/BtcAddressValidator.java +++ b/core/src/main/java/bisq/core/util/validation/BtcAddressValidator.java @@ -23,6 +23,7 @@ import bisq.common.config.Config; import org.bitcoinj.core.Address; import org.bitcoinj.core.AddressFormatException; +import org.bitcoinj.core.LegacyAddress; import javax.inject.Inject; @@ -44,7 +45,7 @@ public final class BtcAddressValidator extends InputValidator { private ValidationResult validateBtcAddress(String input) { try { - Address.fromBase58(Config.baseCurrencyNetworkParameters(), input); + LegacyAddress.fromBase58(Config.baseCurrencyNetworkParameters(), input); return new ValidationResult(true); } catch (AddressFormatException e) { return new ValidationResult(false, Res.get("validation.btc.invalidFormat")); diff --git a/desktop/src/main/java/bisq/desktop/util/GUIUtil.java b/desktop/src/main/java/bisq/desktop/util/GUIUtil.java index 0d26e80a96..d126f697fd 100644 --- a/desktop/src/main/java/bisq/desktop/util/GUIUtil.java +++ b/desktop/src/main/java/bisq/desktop/util/GUIUtil.java @@ -70,6 +70,7 @@ import bisq.common.util.Utilities; import org.bitcoinj.core.Address; import org.bitcoinj.core.Coin; +import org.bitcoinj.core.LegacyAddress; import org.bitcoinj.core.TransactionConfidence; import org.bitcoinj.uri.BitcoinURI; import org.bitcoinj.utils.Fiat; @@ -718,7 +719,7 @@ public class GUIUtil { public static String getBitcoinURI(String address, Coin amount, String label) { return address != null ? - BitcoinURI.convertToBitcoinURI(Address.fromBase58(Config.baseCurrencyNetworkParameters(), + BitcoinURI.convertToBitcoinURI(LegacyAddress.fromBase58(Config.baseCurrencyNetworkParameters(), address), amount, label, null) : ""; }