diff --git a/wallets/bitcoind/build.gradle b/wallets/bitcoind/build.gradle index 6ed348774e..6a0bec13f8 100644 --- a/wallets/bitcoind/build.gradle +++ b/wallets/bitcoind/build.gradle @@ -12,6 +12,7 @@ dependencies { implementation("bisq:persistence") implementation project(':core') + implementation project(':json-rpc') implementation libs.google.guava implementation libs.jackson.databind diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/BitcoinWallet.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/BitcoinWallet.java index 472893fb3b..bac5bf7670 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/BitcoinWallet.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/BitcoinWallet.java @@ -24,13 +24,11 @@ import bisq.wallets.bitcoind.zmq.ZmqWallet; import bisq.wallets.core.RpcConfig; import bisq.wallets.core.Wallet; -import bisq.wallets.core.exceptions.WalletInitializationFailedException; import bisq.wallets.core.model.AddressType; import bisq.wallets.core.model.Transaction; import bisq.wallets.core.model.Utxo; import lombok.Getter; -import java.net.MalformedURLException; import java.util.List; import java.util.Optional; @@ -51,12 +49,7 @@ public BitcoinWallet(String walletName, ZmqConnection zmqConnection) { this.receiveAddresses = receiveAddresses; this.zmqConnection = zmqConnection; - - try { - wallet = new BitcoindWallet(daemon, rpcConfig, walletName); - } catch (MalformedURLException e) { - throw new WalletInitializationFailedException("Couldn't initialize BitcoinWalletService", e); - } + this.wallet = new BitcoindWallet(daemon, rpcConfig, walletName); } @Override diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/WalletFactory.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/WalletFactory.java index 1c15d0d6ee..dafabc2458 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/WalletFactory.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/WalletFactory.java @@ -22,8 +22,8 @@ import bisq.wallets.bitcoind.zmq.ZmqConnection; import bisq.wallets.bitcoind.zmq.ZmqConnectionFactory; import bisq.wallets.core.RpcConfig; -import bisq.wallets.core.rpc.DaemonRpcClient; import bisq.wallets.core.rpc.RpcClientFactory; +import bisq.wallets.json_rpc.JsonRpcClient; import java.util.List; @@ -38,13 +38,13 @@ public static BitcoinWallet createBitcoinWallet(RpcConfig rpcConfig, } private static BitcoindDaemon createBitcoindDaemon(RpcConfig rpcConfig) { - DaemonRpcClient rpcClient = RpcClientFactory.createLegacyDaemonRpcClient(rpcConfig); + JsonRpcClient rpcClient = RpcClientFactory.createDaemonRpcClient(rpcConfig); return new BitcoindDaemon(rpcClient); } private static ZmqConnection initializeBitcoindZeroMq(BitcoindDaemon bitcoindDaemon) { var bitcoindZeroMq = ZmqConnectionFactory.createForBitcoind(bitcoindDaemon); - List zmqNotifications = bitcoindDaemon.getZmqNotifications(); + List zmqNotifications = bitcoindDaemon.getZmqNotifications(); bitcoindZeroMq.initialize(zmqNotifications); return bitcoindZeroMq; } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/BitcoindDaemon.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/BitcoindDaemon.java index bdf86368f1..1ca75e4ddd 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/BitcoindDaemon.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/BitcoindDaemon.java @@ -22,19 +22,18 @@ import bisq.wallets.bitcoind.rpc.responses.BitcoindFinalizePsbtResponse; import bisq.wallets.bitcoind.rpc.responses.BitcoindGetZmqNotificationsResponse; import bisq.wallets.core.RpcConfig; -import bisq.wallets.core.exceptions.InvalidRpcCredentialsException; -import bisq.wallets.core.exceptions.RpcCallFailureException; -import bisq.wallets.core.rpc.DaemonRpcClient; import bisq.wallets.core.rpc.RpcClientFactory; +import bisq.wallets.json_rpc.JsonRpcClient; +import bisq.wallets.json_rpc.RpcCallFailureException; +import bisq.wallets.json_rpc.exceptions.InvalidRpcCredentialsException; -import java.util.Arrays; import java.util.List; import java.util.Optional; public class BitcoindDaemon { - private final DaemonRpcClient rpcClient; + private final JsonRpcClient rpcClient; - public BitcoindDaemon(DaemonRpcClient rpcClient) { + public BitcoindDaemon(JsonRpcClient rpcClient) { this.rpcClient = rpcClient; } @@ -66,19 +65,19 @@ private void createOrLoadWallet(String walletName, Optional passphrase, public String combinePsbt(List txs) { var request = new BitcoindCombinePsbtRpcCall.Request(txs); var rpcCall = new BitcoindCombinePsbtRpcCall(request); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall).getResult(); } public BitcoindDecodeRawTransactionResponse decodeRawTransaction(String txInHex) { var request = new BitcoindDecodeRawTransactionRpcCall.Request(txInHex); var rpcCall = new BitcoindDecodeRawTransactionRpcCall(request); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall); } public BitcoindFinalizePsbtResponse finalizePsbt(String psbt) { var request = new BitcoindFinalizePsbtRpcCall.Request(psbt); var rpcCall = new BitcoindFinalizePsbtRpcCall(request); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall); } public List generateToAddress(int numberOfBlocksToMine, String addressOfMiner) { @@ -87,58 +86,56 @@ public List generateToAddress(int numberOfBlocksToMine, String addressOf .address(addressOfMiner) .build(); var rpcCall = new BitcoindGenerateToAddressRpcCall(request); - String[] blockHashes = rpcClient.invokeAndValidate(rpcCall); - return Arrays.asList(blockHashes); + return rpcClient.call(rpcCall).getResult(); } public String getRawTransaction(String txId) { var request = new BitcoindGetRawTransactionRpcCall.Request(txId); var rpcCall = new BitcoindGetRawTransactionRpcCall(request); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall).getResult(); } public String getTxOutProof(List txIds) { var request = new BitcoindGetTxOutProofRpcCall.Request(txIds); var rpcCall = new BitcoindGetTxOutProofRpcCall(request); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall).getResult(); } - public List getZmqNotifications() { + public List getZmqNotifications() { var rpcCall = new BitcoindGetZmqNotificationsRpcCall(); - BitcoindGetZmqNotificationsResponse[] responses = rpcClient.invokeAndValidate(rpcCall); - return Arrays.asList(responses); + BitcoindGetZmqNotificationsResponse responses = rpcClient.call(rpcCall); + return responses.getResult(); } public List listWallets() { return listWalletsWithRpcClient(rpcClient); } - private static List listWalletsWithRpcClient(DaemonRpcClient rpcClient) { + private static List listWalletsWithRpcClient(JsonRpcClient rpcClient) { var rpcCall = new BitcoindListWalletsRpcCall(); - String[] wallets = rpcClient.invokeAndValidate(rpcCall); - return Arrays.asList(wallets); + return rpcClient.call(rpcCall).getResult(); } public String sendRawTransaction(String hexString) { var request = new BitcoindSendRawTransactionRpcCall.Request(hexString); var rpcCall = new BitcoindSendRawTransactionRpcCall(request); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall).getResult(); } public void stop() { var rpcCall = new BitcoindStopRpcCall(); - rpcClient.invokeAndValidate(rpcCall); + rpcClient.call(rpcCall); } public void unloadWallet(String walletName) { var request = new BitcoindUnloadWalletRpcCall.Request(walletName); var rpcCall = new BitcoindUnloadWalletRpcCall(request); - rpcClient.invokeAndValidate(rpcCall); + rpcClient.call(rpcCall); } public static boolean verifyRpcConfig(RpcConfig rpcConfig) { try { - DaemonRpcClient rpcClient = RpcClientFactory.createLegacyDaemonRpcClient(rpcConfig); + JsonRpcClient rpcClient = RpcClientFactory.createDaemonRpcClient(rpcConfig); listWalletsWithRpcClient(rpcClient); // Makes a listwallets RPC call return true; } catch (InvalidRpcCredentialsException e) { @@ -147,7 +144,7 @@ public static boolean verifyRpcConfig(RpcConfig rpcConfig) { } private boolean doesWalletExist(RpcCallFailureException e) { - return e.getCause().getMessage().contains("Database already exists."); + return e.getMessage().contains("Database already exists."); } private void createWallet(String walletName, String passphrase, boolean descriptors, boolean disablePrivateKeys, boolean blank) { @@ -160,12 +157,12 @@ private void createWallet(String walletName, String passphrase, boolean descript .build(); var rpcCall = new BitcoindCreateWalletRpcCall(request); - rpcClient.invokeAndValidate(rpcCall); + rpcClient.call(rpcCall); } private void loadWallet(String walletName) { var request = new BitcoindLoadWalletRpcCall.Request(walletName); var rpcCall = new BitcoindLoadWalletRpcCall(request); - rpcClient.invokeAndValidate(rpcCall); + rpcClient.call(rpcCall); } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/BitcoindWallet.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/BitcoindWallet.java index 7c5575328a..54bdbfabd3 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/BitcoindWallet.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/BitcoindWallet.java @@ -25,10 +25,8 @@ import bisq.wallets.core.RpcConfig; import bisq.wallets.core.model.AddressType; import bisq.wallets.core.rpc.RpcClientFactory; -import bisq.wallets.core.rpc.WalletRpcClient; +import bisq.wallets.json_rpc.JsonRpcClient; -import java.net.MalformedURLException; -import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Optional; @@ -38,20 +36,20 @@ public class BitcoindWallet { private static final long DEFAULT_WALLET_TIMEOUT = TimeUnit.SECONDS.toSeconds(15); private final BitcoindDaemon daemon; - private final WalletRpcClient rpcClient; + private final String walletName; + private final JsonRpcClient rpcClient; - public BitcoindWallet(BitcoindDaemon daemon, RpcConfig rpcConfig, String walletName) throws MalformedURLException { + public BitcoindWallet(BitcoindDaemon daemon, RpcConfig rpcConfig, String walletName) { this.daemon = daemon; + this.walletName = walletName; this.rpcClient = RpcClientFactory.createWalletRpcClient(rpcConfig, walletName); } public void initialize(Optional passphrase) { - String walletName = rpcClient.getWalletName(); daemon.createOrLoadWallet(walletName, passphrase); } public void shutdown() { - String walletName = rpcClient.getWalletName(); daemon.unloadWallet(walletName); } @@ -61,7 +59,7 @@ public BitcoindAddOrCreateMultiSigAddressResponse createMultiSig(int nRequired, .keys(keys) .build(); var rpcCall = new BitcoindCreateMultiSigRpcCall(request); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall); } public BitcoindAddOrCreateMultiSigAddressResponse addMultiSigAddress(int nRequired, List keys) { @@ -70,26 +68,26 @@ public BitcoindAddOrCreateMultiSigAddressResponse addMultiSigAddress(int nRequir .keys(keys) .build(); var rpcCall = new BitcoindAddMultiSigAddressRpcCall(request); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall); } public BitcoindGetAddressInfoResponse getAddressInfo(String address) { var request = new BitcoindGetAddressInfoRpcCall.Request(address); var rpcCall = new BitcoindGetAddressInfoRpcCall(request); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall); } public double getBalance() { var rpcCall = new BitcoindGetBalancesRpcCall(); - BitcoindGetBalancesResponse response = rpcClient.invokeAndValidate(rpcCall); - BitcoindGetMineBalancesResponse mineBalancesResponse = response.getMine(); + BitcoindGetBalancesResponse response = rpcClient.call(rpcCall); + BitcoindGetMineBalancesResponse mineBalancesResponse = response.getResult().getMine(); return mineBalancesResponse.getTrusted() + mineBalancesResponse.getUntrustedPending(); } public BitcoindGetDescriptorInfoResponse getDescriptorInfo(String descriptor) { var request = new BitcoindGetDescriptorInfoRpcCall.Request(descriptor); var rpcCall = new BitcoindGetDescriptorInfoRpcCall(request); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall); } public String getNewAddress(AddressType addressType, String label) { @@ -98,19 +96,17 @@ public String getNewAddress(AddressType addressType, String label) { .label(label) .build(); var rpcCall = new BitcoindGetNewAddressRpcCall(request); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall).getResult(); } - public List importDescriptors( + public List importDescriptors( List requests ) { var request = new BitcoindImportDescriptorsRpcCall.Request( requests.toArray(new BitcoindImportDescriptorRequestEntry[0]) ); var rpcCall = new BitcoindImportDescriptorsRpcCall(request); - return Arrays.asList( - rpcClient.invokeAndValidate(rpcCall) - ); + return rpcClient.call(rpcCall).getResult(); } public void importAddress(String address, String label) { @@ -119,36 +115,33 @@ public void importAddress(String address, String label) { .label(label) .build(); var rpcCall = new BitcoindImportAddressRpcCall(request); - rpcClient.invokeAndValidate(rpcCall); + rpcClient.call(rpcCall); } - public List importMulti(List requests) { + public List importMulti(List requests) { var request = BitcoindImportMultiRpcCall.Request.builder() .requests(requests) .build(); var rpcCall = new BitcoindImportMultiRpcCall(request); - BitcoinImportMultiEntryResponse[] response = rpcClient.invokeAndValidate(rpcCall); - return Arrays.asList(response); + return rpcClient.call(rpcCall).getResult(); } public BitcoindListDescriptorResponse listDescriptors() { var rpcCall = new BitcoindListDescriptorsRpcCall(); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall); } - public List listTransactions(int count) { + public List listTransactions(int count) { var request = BitcoindListTransactionsRpcCall.Request.builder() .count(count) .build(); var rpcCall = new BitcoindListTransactionsRpcCall(request); - BitcoindListTransactionsResponseEntry[] response = rpcClient.invokeAndValidate(rpcCall); - return Arrays.asList(response); + return rpcClient.call(rpcCall).getResult(); } - public List listUnspent() { + public List listUnspent() { var rpcCall = new BitcoindListUnspentRpcCall(); - BitcoindListUnspentResponseEntry[] response = rpcClient.invokeAndValidate(rpcCall); - return Arrays.asList(response); + return rpcClient.call(rpcCall).getResult(); } public String sendToAddress(Optional passphrase, String address, double amount) { @@ -159,7 +152,7 @@ public String sendToAddress(Optional passphrase, String address, double .amount(amount) .build(); var rpcCall = new BitcoindSendToAddressRpcCall(request); - String txId = rpcClient.invokeAndValidate(rpcCall); + String txId = rpcClient.call(rpcCall).getResult(); if (passphrase.isPresent()) { walletLock(); @@ -175,7 +168,7 @@ public String signMessage(Optional walletPasshrase, String address, Stri .message(message) .build(); var rpcCall = new BitcoindSignMessageRpcCall(request); - String signature = rpcClient.invokeAndValidate(rpcCall); + String signature = rpcClient.call(rpcCall).getResult(); if (walletPasshrase.isPresent()) { walletLock(); @@ -190,7 +183,7 @@ public boolean verifyMessage(String address, String signature, String message) { .message(message) .build(); var rpcCall = new BitcoindVerifyMessageRpcCall(request); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall).getResult(); } public BitcoindWalletCreateFundedPsbtResponse walletCreateFundedPsbt(List inputs, @@ -202,19 +195,19 @@ public BitcoindWalletCreateFundedPsbtResponse walletCreateFundedPsbt(List passphrase) { walletPassphrase(rpcClient, passphrase); } - public static void walletPassphrase(WalletRpcClient rpcClient, Optional passphrase) { + public static void walletPassphrase(JsonRpcClient rpcClient, Optional passphrase) { String passphraseString = passphrase.orElse(""); if (passphraseString.isEmpty()) { return; @@ -225,7 +218,7 @@ public static void walletPassphrase(WalletRpcClient rpcClient, Optional .timeout(DEFAULT_WALLET_TIMEOUT) .build(); var rpcCall = new BitcoindWalletPassphraseRpcCall(request); - rpcClient.invokeAndValidate(rpcCall); + rpcClient.call(rpcCall); } public BitcoindWalletProcessPsbtResponse walletProcessPsbt(Optional passphrase, String psbt) { @@ -233,7 +226,7 @@ public BitcoindWalletProcessPsbtResponse walletProcessPsbt(Optional pass var request = new BitcoindWalletProcessPsbtRpcCall.Request(psbt); var rpcCall = new BitcoindWalletProcessPsbtRpcCall(request); - BitcoindWalletProcessPsbtResponse response = rpcClient.invokeAndValidate(rpcCall); + BitcoindWalletProcessPsbtResponse response = rpcClient.call(rpcCall); if (passphrase.isPresent()) { walletLock(); diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindAddMultiSigAddressRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindAddMultiSigAddressRpcCall.java index 6827b3fdc9..973f8e06e3 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindAddMultiSigAddressRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindAddMultiSigAddressRpcCall.java @@ -18,19 +18,19 @@ package bisq.wallets.bitcoind.rpc.calls; import bisq.wallets.bitcoind.rpc.responses.BitcoindAddOrCreateMultiSigAddressResponse; -import bisq.wallets.core.rpc.call.WalletRpcCall; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.DaemonRpcCall; +import com.squareup.moshi.Json; import lombok.Builder; import lombok.Getter; import java.util.List; public class BitcoindAddMultiSigAddressRpcCall - extends WalletRpcCall { + extends DaemonRpcCall { @Builder @Getter public static class Request { - @JsonProperty("nrequired") + @Json(name = "nrequired") private final int nRequired; private final List keys; } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindCombinePsbtRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindCombinePsbtRpcCall.java index a2d81ffeae..81d8bca659 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindCombinePsbtRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindCombinePsbtRpcCall.java @@ -17,12 +17,13 @@ package bisq.wallets.bitcoind.rpc.calls; -import bisq.wallets.core.rpc.call.DaemonRpcCall; +import bisq.wallets.json_rpc.DaemonRpcCall; +import bisq.wallets.json_rpc.reponses.JsonRpcStringResponse; import lombok.Getter; import java.util.List; -public class BitcoindCombinePsbtRpcCall extends DaemonRpcCall { +public class BitcoindCombinePsbtRpcCall extends DaemonRpcCall { @Getter public static class Request { @@ -43,12 +44,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(String response) { + public boolean isResponseValid(JsonRpcStringResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return String.class; + public Class getRpcResponseClass() { + return JsonRpcStringResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindCreateMultiSigRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindCreateMultiSigRpcCall.java index f59912646c..62430ccd85 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindCreateMultiSigRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindCreateMultiSigRpcCall.java @@ -18,23 +18,23 @@ package bisq.wallets.bitcoind.rpc.calls; import bisq.wallets.bitcoind.rpc.responses.BitcoindAddOrCreateMultiSigAddressResponse; -import bisq.wallets.core.rpc.call.WalletRpcCall; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.DaemonRpcCall; +import com.squareup.moshi.Json; import lombok.Builder; import lombok.Getter; import java.util.List; public class BitcoindCreateMultiSigRpcCall - extends WalletRpcCall { + extends DaemonRpcCall { @Builder @Getter public static class Request { - @JsonProperty("nrequired") + @Json(name = "nrequired") private int nRequired; private List keys; - @JsonProperty("address_type") + @Json(name = "address_type") private String addressType; } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindCreateWalletRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindCreateWalletRpcCall.java index aab2ff81df..3f6050ae23 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindCreateWalletRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindCreateWalletRpcCall.java @@ -18,8 +18,8 @@ package bisq.wallets.bitcoind.rpc.calls; import bisq.wallets.bitcoind.rpc.responses.BitcoindCreateOrLoadWalletResponse; -import bisq.wallets.core.rpc.call.DaemonRpcCall; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.DaemonRpcCall; +import com.squareup.moshi.Json; import lombok.Builder; import lombok.Getter; @@ -29,15 +29,15 @@ public class BitcoindCreateWalletRpcCall @Builder @Getter public static class Request { - @JsonProperty("wallet_name") + @Json(name = "wallet_name") private String walletName; - @JsonProperty("disable_private_keys") + @Json(name = "disable_private_keys") private Boolean disablePrivateKeys; private Boolean blank; private String passphrase; - @JsonProperty("avoid_reuse") + @Json(name = "avoid_reuse") private Boolean avoidReuse; private boolean descriptors; } @@ -53,7 +53,7 @@ public String getRpcMethodName() { @Override public boolean isResponseValid(BitcoindCreateOrLoadWalletResponse response) { - return response.getName().equals(request.walletName); + return response.getResult() != null; } @Override diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindDecodeRawTransactionRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindDecodeRawTransactionRpcCall.java index 912d0e73b7..b4195a4bb8 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindDecodeRawTransactionRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindDecodeRawTransactionRpcCall.java @@ -18,8 +18,8 @@ package bisq.wallets.bitcoind.rpc.calls; import bisq.wallets.bitcoind.rpc.responses.BitcoindDecodeRawTransactionResponse; -import bisq.wallets.core.rpc.call.DaemonRpcCall; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.DaemonRpcCall; +import com.squareup.moshi.Json; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; @@ -31,10 +31,10 @@ public class BitcoindDecodeRawTransactionRpcCall @ToString @EqualsAndHashCode public static final class Request { - @JsonProperty("hexstring") + @Json(name = "hexstring") private final String hexString; - public Request(@JsonProperty("hexstring") String hexString) { + public Request(String hexString) { this.hexString = hexString; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindFinalizePsbtRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindFinalizePsbtRpcCall.java index ff16bdc3e7..92c3b40a2f 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindFinalizePsbtRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindFinalizePsbtRpcCall.java @@ -18,7 +18,7 @@ package bisq.wallets.bitcoind.rpc.calls; import bisq.wallets.bitcoind.rpc.responses.BitcoindFinalizePsbtResponse; -import bisq.wallets.core.rpc.call.DaemonRpcCall; +import bisq.wallets.json_rpc.DaemonRpcCall; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGenerateToAddressRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGenerateToAddressRpcCall.java index b83afbdc60..e54b24ae7a 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGenerateToAddressRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGenerateToAddressRpcCall.java @@ -17,11 +17,12 @@ package bisq.wallets.bitcoind.rpc.calls; -import bisq.wallets.core.rpc.call.DaemonRpcCall; +import bisq.wallets.json_rpc.DaemonRpcCall; +import bisq.wallets.json_rpc.reponses.JsonRpcStringListResponse; import lombok.Builder; import lombok.Getter; -public class BitcoindGenerateToAddressRpcCall extends DaemonRpcCall { +public class BitcoindGenerateToAddressRpcCall extends DaemonRpcCall { @Builder @Getter @@ -40,12 +41,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(String[] response) { + public boolean isResponseValid(JsonRpcStringListResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return String[].class; + public Class getRpcResponseClass() { + return JsonRpcStringListResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetAddressInfoRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetAddressInfoRpcCall.java index 8a119b7e35..85ddc64c95 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetAddressInfoRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetAddressInfoRpcCall.java @@ -18,13 +18,13 @@ package bisq.wallets.bitcoind.rpc.calls; import bisq.wallets.bitcoind.rpc.responses.BitcoindGetAddressInfoResponse; -import bisq.wallets.core.rpc.call.WalletRpcCall; +import bisq.wallets.json_rpc.DaemonRpcCall; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; public class BitcoindGetAddressInfoRpcCall - extends WalletRpcCall { + extends DaemonRpcCall { @Getter @ToString diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetBalancesRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetBalancesRpcCall.java index efb78deebf..6d9de9ba93 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetBalancesRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetBalancesRpcCall.java @@ -18,9 +18,9 @@ package bisq.wallets.bitcoind.rpc.calls; import bisq.wallets.bitcoind.rpc.responses.BitcoindGetBalancesResponse; -import bisq.wallets.core.rpc.call.WalletRpcCall; +import bisq.wallets.json_rpc.DaemonRpcCall; -public class BitcoindGetBalancesRpcCall extends WalletRpcCall { +public class BitcoindGetBalancesRpcCall extends DaemonRpcCall { public BitcoindGetBalancesRpcCall() { super(null); } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetDescriptorInfoRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetDescriptorInfoRpcCall.java index 78a022e4ea..835c0df974 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetDescriptorInfoRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetDescriptorInfoRpcCall.java @@ -18,11 +18,11 @@ package bisq.wallets.bitcoind.rpc.calls; import bisq.wallets.bitcoind.rpc.responses.BitcoindGetDescriptorInfoResponse; -import bisq.wallets.core.rpc.call.WalletRpcCall; +import bisq.wallets.json_rpc.DaemonRpcCall; import lombok.Getter; public class BitcoindGetDescriptorInfoRpcCall - extends WalletRpcCall { + extends DaemonRpcCall { @Getter public static class Request { diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetNewAddressRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetNewAddressRpcCall.java index b64c815ea5..0014648c0c 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetNewAddressRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetNewAddressRpcCall.java @@ -17,17 +17,18 @@ package bisq.wallets.bitcoind.rpc.calls; -import bisq.wallets.core.rpc.call.WalletRpcCall; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.DaemonRpcCall; +import bisq.wallets.json_rpc.reponses.JsonRpcStringResponse; +import com.squareup.moshi.Json; import lombok.Builder; import lombok.Getter; -public class BitcoindGetNewAddressRpcCall extends WalletRpcCall { +public class BitcoindGetNewAddressRpcCall extends DaemonRpcCall { @Builder @Getter public static class Request { private final String label; - @JsonProperty("address_type") + @Json(name = "address_type") private final String addressType; } @@ -41,12 +42,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(String response) { + public boolean isResponseValid(JsonRpcStringResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return String.class; + public Class getRpcResponseClass() { + return JsonRpcStringResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetRawTransactionRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetRawTransactionRpcCall.java index ff38f57262..47a0662a2e 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetRawTransactionRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetRawTransactionRpcCall.java @@ -17,14 +17,15 @@ package bisq.wallets.bitcoind.rpc.calls; -import bisq.wallets.core.rpc.call.DaemonRpcCall; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.DaemonRpcCall; +import bisq.wallets.json_rpc.reponses.JsonRpcStringResponse; +import com.squareup.moshi.Json; import lombok.Getter; -public class BitcoindGetRawTransactionRpcCall extends DaemonRpcCall { +public class BitcoindGetRawTransactionRpcCall extends DaemonRpcCall { @Getter public static class Request { - @JsonProperty("txid") + @Json(name = "txid") private final String txId; public Request(String txId) { @@ -42,12 +43,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(String response) { + public boolean isResponseValid(JsonRpcStringResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return String.class; + public Class getRpcResponseClass() { + return JsonRpcStringResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetTxOutProofRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetTxOutProofRpcCall.java index f3731edcd6..982cee1c81 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetTxOutProofRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetTxOutProofRpcCall.java @@ -17,17 +17,18 @@ package bisq.wallets.bitcoind.rpc.calls; -import bisq.wallets.core.rpc.call.DaemonRpcCall; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.DaemonRpcCall; +import bisq.wallets.json_rpc.reponses.JsonRpcStringResponse; +import com.squareup.moshi.Json; import lombok.Getter; import java.util.List; -public class BitcoindGetTxOutProofRpcCall extends DaemonRpcCall { +public class BitcoindGetTxOutProofRpcCall extends DaemonRpcCall { @Getter public static class Request { - @JsonProperty("txids") + @Json(name = "txids") private final List txIds; public Request(List txIds) { @@ -45,12 +46,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(String response) { + public boolean isResponseValid(JsonRpcStringResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return String.class; + public Class getRpcResponseClass() { + return JsonRpcStringResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetZmqNotificationsRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetZmqNotificationsRpcCall.java index fb48d8e92c..722c3a9e80 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetZmqNotificationsRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindGetZmqNotificationsRpcCall.java @@ -18,9 +18,9 @@ package bisq.wallets.bitcoind.rpc.calls; import bisq.wallets.bitcoind.rpc.responses.BitcoindGetZmqNotificationsResponse; -import bisq.wallets.core.rpc.call.DaemonRpcCall; +import bisq.wallets.json_rpc.DaemonRpcCall; -public class BitcoindGetZmqNotificationsRpcCall extends DaemonRpcCall { +public class BitcoindGetZmqNotificationsRpcCall extends DaemonRpcCall { public BitcoindGetZmqNotificationsRpcCall() { super(null); @@ -32,12 +32,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(BitcoindGetZmqNotificationsResponse[] response) { + public boolean isResponseValid(BitcoindGetZmqNotificationsResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return BitcoindGetZmqNotificationsResponse[].class; + public Class getRpcResponseClass() { + return BitcoindGetZmqNotificationsResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindImportAddressRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindImportAddressRpcCall.java index d79b905bfa..49b227ffb7 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindImportAddressRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindImportAddressRpcCall.java @@ -17,11 +17,12 @@ package bisq.wallets.bitcoind.rpc.calls; -import bisq.wallets.core.rpc.call.WalletRpcCall; +import bisq.wallets.json_rpc.DaemonRpcCall; +import bisq.wallets.json_rpc.VoidJsonRpcResponse; import lombok.Builder; import lombok.Getter; -public class BitcoindImportAddressRpcCall extends WalletRpcCall { +public class BitcoindImportAddressRpcCall extends DaemonRpcCall { @Builder @Getter public static class Request { @@ -39,12 +40,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(Void response) { + public boolean isResponseValid(VoidJsonRpcResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return null; + public Class getRpcResponseClass() { + return VoidJsonRpcResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindImportDescriptorsRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindImportDescriptorsRpcCall.java index cf4c5d6716..edac30941b 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindImportDescriptorsRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindImportDescriptorsRpcCall.java @@ -18,15 +18,13 @@ package bisq.wallets.bitcoind.rpc.calls; import bisq.wallets.bitcoind.rpc.calls.requests.BitcoindImportDescriptorRequestEntry; -import bisq.wallets.bitcoind.rpc.responses.BitcoindImportDescriptorResponseEntry; -import bisq.wallets.core.rpc.call.WalletRpcCall; +import bisq.wallets.bitcoind.rpc.responses.BitcoindImportDescriptorResponse; +import bisq.wallets.json_rpc.DaemonRpcCall; import lombok.Getter; import lombok.Setter; -import java.util.Arrays; - public class BitcoindImportDescriptorsRpcCall - extends WalletRpcCall { + extends DaemonRpcCall { @Getter @Setter @@ -48,12 +46,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(BitcoindImportDescriptorResponseEntry[] response) { - return Arrays.stream(response).allMatch(BitcoindImportDescriptorResponseEntry::isSuccess); + public boolean isResponseValid(BitcoindImportDescriptorResponse response) { + return response.getResult().stream().allMatch(BitcoindImportDescriptorResponse.Entry::isSuccess); } @Override - public Class getRpcResponseClass() { - return BitcoindImportDescriptorResponseEntry[].class; + public Class getRpcResponseClass() { + return BitcoindImportDescriptorResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindImportMultiRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindImportMultiRpcCall.java index d96d2a2e88..3d54a4ef34 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindImportMultiRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindImportMultiRpcCall.java @@ -19,7 +19,7 @@ import bisq.wallets.bitcoind.rpc.calls.requests.BitcoindImportMultiRequest; import bisq.wallets.bitcoind.rpc.responses.BitcoinImportMultiEntryResponse; -import bisq.wallets.core.rpc.call.WalletRpcCall; +import bisq.wallets.json_rpc.DaemonRpcCall; import lombok.Builder; import lombok.Getter; @@ -27,7 +27,7 @@ import java.util.Map; public class BitcoindImportMultiRpcCall - extends WalletRpcCall { + extends DaemonRpcCall { @Builder @Getter public static class Request { @@ -45,12 +45,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(BitcoinImportMultiEntryResponse[] response) { + public boolean isResponseValid(BitcoinImportMultiEntryResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return BitcoinImportMultiEntryResponse[].class; + public Class getRpcResponseClass() { + return BitcoinImportMultiEntryResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindListDescriptorsRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindListDescriptorsRpcCall.java index c6c7d62c3a..7657f8f299 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindListDescriptorsRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindListDescriptorsRpcCall.java @@ -18,10 +18,10 @@ package bisq.wallets.bitcoind.rpc.calls; import bisq.wallets.bitcoind.rpc.responses.BitcoindListDescriptorResponse; -import bisq.wallets.core.rpc.call.WalletRpcCall; +import bisq.wallets.json_rpc.DaemonRpcCall; public class BitcoindListDescriptorsRpcCall - extends WalletRpcCall { + extends DaemonRpcCall { public BitcoindListDescriptorsRpcCall() { super(null); diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindListTransactionsRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindListTransactionsRpcCall.java index b4932d8429..587dcd907b 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindListTransactionsRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindListTransactionsRpcCall.java @@ -17,13 +17,13 @@ package bisq.wallets.bitcoind.rpc.calls; -import bisq.wallets.bitcoind.rpc.responses.BitcoindListTransactionsResponseEntry; -import bisq.wallets.core.rpc.call.WalletRpcCall; +import bisq.wallets.bitcoind.rpc.responses.BitcoindListTransactionsResponse; +import bisq.wallets.json_rpc.DaemonRpcCall; import lombok.Builder; import lombok.Getter; public class BitcoindListTransactionsRpcCall - extends WalletRpcCall { + extends DaemonRpcCall { @Builder @Getter public static class Request { @@ -41,12 +41,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(BitcoindListTransactionsResponseEntry[] response) { + public boolean isResponseValid(BitcoindListTransactionsResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return BitcoindListTransactionsResponseEntry[].class; + public Class getRpcResponseClass() { + return BitcoindListTransactionsResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindListUnspentRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindListUnspentRpcCall.java index 4ab07a88ab..6cd8d08952 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindListUnspentRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindListUnspentRpcCall.java @@ -17,10 +17,10 @@ package bisq.wallets.bitcoind.rpc.calls; -import bisq.wallets.bitcoind.rpc.responses.BitcoindListUnspentResponseEntry; -import bisq.wallets.core.rpc.call.WalletRpcCall; +import bisq.wallets.bitcoind.rpc.responses.BitcoindListUnspentResponse; +import bisq.wallets.json_rpc.DaemonRpcCall; -public class BitcoindListUnspentRpcCall extends WalletRpcCall { +public class BitcoindListUnspentRpcCall extends DaemonRpcCall { public BitcoindListUnspentRpcCall() { super(null); } @@ -31,12 +31,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(BitcoindListUnspentResponseEntry[] response) { + public boolean isResponseValid(BitcoindListUnspentResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return BitcoindListUnspentResponseEntry[].class; + public Class getRpcResponseClass() { + return BitcoindListUnspentResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindListWalletsRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindListWalletsRpcCall.java index baf7135f48..8c79128655 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindListWalletsRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindListWalletsRpcCall.java @@ -17,9 +17,11 @@ package bisq.wallets.bitcoind.rpc.calls; -import bisq.wallets.core.rpc.call.DaemonRpcCall; -public class BitcoindListWalletsRpcCall extends DaemonRpcCall { +import bisq.wallets.json_rpc.DaemonRpcCall; +import bisq.wallets.json_rpc.reponses.JsonRpcStringListResponse; + +public class BitcoindListWalletsRpcCall extends DaemonRpcCall { public BitcoindListWalletsRpcCall() { super(null); @@ -31,12 +33,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(String[] response) { + public boolean isResponseValid(JsonRpcStringListResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return String[].class; + public Class getRpcResponseClass() { + return JsonRpcStringListResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindLoadWalletRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindLoadWalletRpcCall.java index d0977665ea..fd58dcd26e 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindLoadWalletRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindLoadWalletRpcCall.java @@ -18,8 +18,8 @@ package bisq.wallets.bitcoind.rpc.calls; import bisq.wallets.bitcoind.rpc.responses.BitcoindCreateOrLoadWalletResponse; -import bisq.wallets.core.rpc.call.DaemonRpcCall; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.DaemonRpcCall; +import com.squareup.moshi.Json; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; @@ -31,7 +31,7 @@ public class BitcoindLoadWalletRpcCall @ToString @EqualsAndHashCode public static final class Request { - @JsonProperty("filename") + @Json(name = "filename") private final String fileName; public Request(String fileName) { @@ -50,7 +50,8 @@ public String getRpcMethodName() { @Override public boolean isResponseValid(BitcoindCreateOrLoadWalletResponse response) { - return response.getName().equals(request.fileName) && !response.hasWarning(); + BitcoindCreateOrLoadWalletResponse.Result result = response.getResult(); + return result.getName().equals(request.fileName) && !result.hasWarning(); } @Override diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindSendRawTransactionRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindSendRawTransactionRpcCall.java index 7d0e7bf880..2fd3024ab7 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindSendRawTransactionRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindSendRawTransactionRpcCall.java @@ -17,19 +17,20 @@ package bisq.wallets.bitcoind.rpc.calls; -import bisq.wallets.core.rpc.call.DaemonRpcCall; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.DaemonRpcCall; +import bisq.wallets.json_rpc.reponses.JsonRpcStringResponse; +import com.squareup.moshi.Json; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; -public class BitcoindSendRawTransactionRpcCall extends DaemonRpcCall { +public class BitcoindSendRawTransactionRpcCall extends DaemonRpcCall { @Getter @ToString @EqualsAndHashCode public static final class Request { - @JsonProperty("hexstring") + @Json(name = "hexstring") private final String hexString; public Request(String hexString) { @@ -47,12 +48,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(String response) { + public boolean isResponseValid(JsonRpcStringResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return String.class; + public Class getRpcResponseClass() { + return JsonRpcStringResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindSendToAddressRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindSendToAddressRpcCall.java index 1c458663aa..c4b7753c55 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindSendToAddressRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindSendToAddressRpcCall.java @@ -17,11 +17,12 @@ package bisq.wallets.bitcoind.rpc.calls; -import bisq.wallets.core.rpc.call.WalletRpcCall; +import bisq.wallets.json_rpc.DaemonRpcCall; +import bisq.wallets.json_rpc.reponses.JsonRpcStringResponse; import lombok.Builder; import lombok.Getter; -public class BitcoindSendToAddressRpcCall extends WalletRpcCall { +public class BitcoindSendToAddressRpcCall extends DaemonRpcCall { @Builder @Getter public static class Request { @@ -39,12 +40,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(String response) { + public boolean isResponseValid(JsonRpcStringResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return String.class; + public Class getRpcResponseClass() { + return JsonRpcStringResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindSignMessageRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindSignMessageRpcCall.java index a4a9b800f3..4d108fd6a7 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindSignMessageRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindSignMessageRpcCall.java @@ -17,11 +17,12 @@ package bisq.wallets.bitcoind.rpc.calls; -import bisq.wallets.core.rpc.call.WalletRpcCall; +import bisq.wallets.json_rpc.DaemonRpcCall; +import bisq.wallets.json_rpc.reponses.JsonRpcStringResponse; import lombok.Builder; import lombok.Getter; -public class BitcoindSignMessageRpcCall extends WalletRpcCall { +public class BitcoindSignMessageRpcCall extends DaemonRpcCall { @Builder @Getter public static class Request { @@ -39,12 +40,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(String response) { + public boolean isResponseValid(JsonRpcStringResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return String.class; + public Class getRpcResponseClass() { + return JsonRpcStringResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindStopRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindStopRpcCall.java index 8401f0a91e..14568c6c65 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindStopRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindStopRpcCall.java @@ -17,9 +17,11 @@ package bisq.wallets.bitcoind.rpc.calls; -import bisq.wallets.core.rpc.call.DaemonRpcCall; -public class BitcoindStopRpcCall extends DaemonRpcCall { +import bisq.wallets.json_rpc.DaemonRpcCall; +import bisq.wallets.json_rpc.reponses.JsonRpcStringResponse; + +public class BitcoindStopRpcCall extends DaemonRpcCall { public BitcoindStopRpcCall() { super(null); } @@ -30,12 +32,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(String response) { - return response.equals("Bitcoin Core stopping"); + public boolean isResponseValid(JsonRpcStringResponse response) { + return response.getResult().equals("Bitcoin Core stopping"); } @Override - public Class getRpcResponseClass() { - return String.class; + public Class getRpcResponseClass() { + return JsonRpcStringResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindUnloadWalletRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindUnloadWalletRpcCall.java index cc94de67d9..57b74b9324 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindUnloadWalletRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindUnloadWalletRpcCall.java @@ -18,8 +18,8 @@ package bisq.wallets.bitcoind.rpc.calls; import bisq.wallets.bitcoind.rpc.responses.BitcoindWarningResponse; -import bisq.wallets.core.rpc.call.DaemonRpcCall; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.DaemonRpcCall; +import com.squareup.moshi.Json; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; @@ -30,10 +30,10 @@ public class BitcoindUnloadWalletRpcCall extends DaemonRpcCall { +public class BitcoindVerifyMessageRpcCall extends DaemonRpcCall { @Builder @Getter public static class Request { @@ -40,12 +41,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(Boolean response) { + public boolean isResponseValid(JsonRpcBooleanResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return Boolean.class; + public Class getRpcResponseClass() { + return JsonRpcBooleanResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindWalletCreateFundedPsbtRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindWalletCreateFundedPsbtRpcCall.java index bec4bb04fc..e128f0ac26 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindWalletCreateFundedPsbtRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindWalletCreateFundedPsbtRpcCall.java @@ -19,7 +19,7 @@ import bisq.wallets.bitcoind.rpc.psbt.BitcoindPsbtInput; import bisq.wallets.bitcoind.rpc.responses.BitcoindWalletCreateFundedPsbtResponse; -import bisq.wallets.core.rpc.call.WalletRpcCall; +import bisq.wallets.json_rpc.DaemonRpcCall; import lombok.Builder; import lombok.Getter; @@ -27,7 +27,7 @@ import java.util.Map; public class BitcoindWalletCreateFundedPsbtRpcCall - extends WalletRpcCall { + extends DaemonRpcCall { @Builder @Getter public static class Request { diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindWalletLockRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindWalletLockRpcCall.java index c6df0a2ea7..966b95f173 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindWalletLockRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindWalletLockRpcCall.java @@ -17,9 +17,10 @@ package bisq.wallets.bitcoind.rpc.calls; -import bisq.wallets.core.rpc.call.WalletRpcCall; +import bisq.wallets.json_rpc.DaemonRpcCall; +import bisq.wallets.json_rpc.VoidJsonRpcResponse; -public class BitcoindWalletLockRpcCall extends WalletRpcCall { +public class BitcoindWalletLockRpcCall extends DaemonRpcCall { public BitcoindWalletLockRpcCall() { super(null); } @@ -30,12 +31,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(Void response) { + public boolean isResponseValid(VoidJsonRpcResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return null; + public Class getRpcResponseClass() { + return VoidJsonRpcResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindWalletPassphraseRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindWalletPassphraseRpcCall.java index 65a5296e0a..d42f313961 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindWalletPassphraseRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindWalletPassphraseRpcCall.java @@ -17,11 +17,12 @@ package bisq.wallets.bitcoind.rpc.calls; -import bisq.wallets.core.rpc.call.WalletRpcCall; +import bisq.wallets.json_rpc.DaemonRpcCall; +import bisq.wallets.json_rpc.VoidJsonRpcResponse; import lombok.Builder; import lombok.Getter; -public class BitcoindWalletPassphraseRpcCall extends WalletRpcCall { +public class BitcoindWalletPassphraseRpcCall extends DaemonRpcCall { @Builder @Getter public static class Request { @@ -39,12 +40,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(Void response) { + public boolean isResponseValid(VoidJsonRpcResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return null; + public Class getRpcResponseClass() { + return VoidJsonRpcResponse.class; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindWalletProcessPsbtRpcCall.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindWalletProcessPsbtRpcCall.java index b112a9f864..8e73597e7c 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindWalletProcessPsbtRpcCall.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/BitcoindWalletProcessPsbtRpcCall.java @@ -18,13 +18,13 @@ package bisq.wallets.bitcoind.rpc.calls; import bisq.wallets.bitcoind.rpc.responses.BitcoindWalletProcessPsbtResponse; -import bisq.wallets.core.rpc.call.WalletRpcCall; +import bisq.wallets.json_rpc.DaemonRpcCall; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; public class BitcoindWalletProcessPsbtRpcCall - extends WalletRpcCall { + extends DaemonRpcCall { @Getter @ToString diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/requests/BitcoindImportDescriptorRequestEntry.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/requests/BitcoindImportDescriptorRequestEntry.java index 07f25c3deb..b728655eb4 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/requests/BitcoindImportDescriptorRequestEntry.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/requests/BitcoindImportDescriptorRequestEntry.java @@ -17,7 +17,7 @@ package bisq.wallets.bitcoind.rpc.calls.requests; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.squareup.moshi.Json; import lombok.Builder; import lombok.Getter; import lombok.Setter; @@ -27,9 +27,9 @@ @Setter public class BitcoindImportDescriptorRequestEntry { private String desc; - @JsonProperty("active") + @Json(name = "active") private boolean isActive; - @JsonProperty("internal") + @Json(name = "internal") private boolean isInternal; private final String timestamp = "now"; } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/requests/BitcoindImportMultiRequest.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/requests/BitcoindImportMultiRequest.java index 076fd5ac2c..7456eda5a5 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/requests/BitcoindImportMultiRequest.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/calls/requests/BitcoindImportMultiRequest.java @@ -17,7 +17,7 @@ package bisq.wallets.bitcoind.rpc.calls.requests; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.squareup.moshi.Json; import lombok.Builder; import lombok.Getter; import lombok.Setter; @@ -32,11 +32,11 @@ public class BitcoindImportMultiRequest { private String desc; private Map scriptPubKey; private final String timestamp = "now"; - @JsonProperty("redeemscript") + @Json(name = "redeemscript") private String redeemScript; - @JsonProperty("witnessscript") + @Json(name = "witnessscript") private String witnessScript; - @JsonProperty("pubkeys") + @Json(name = "pubkeys") private List pubKeys; private List keys; } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/AbstractDecodeRawTransactionResponse.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/AbstractDecodeRawTransactionResponse.java index f6feb8be84..e48e74bf74 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/AbstractDecodeRawTransactionResponse.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/AbstractDecodeRawTransactionResponse.java @@ -17,16 +17,14 @@ package bisq.wallets.bitcoind.rpc.responses; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.squareup.moshi.Json; import lombok.Getter; -import lombok.Setter; import java.util.List; @Getter -@Setter public class AbstractDecodeRawTransactionResponse> { - @JsonProperty("txid") + @Json(name = "txid") private String txId; private String hash; private int size; diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/AbstractVin.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/AbstractVin.java index c3d4c3a9b8..592a39b9b5 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/AbstractVin.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/AbstractVin.java @@ -17,7 +17,7 @@ package bisq.wallets.bitcoind.rpc.responses; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.squareup.moshi.Json; import lombok.Getter; import lombok.Setter; @@ -27,11 +27,11 @@ @Setter public abstract class AbstractVin { private String coinbase; - @JsonProperty("txid") + @Json(name = "txid") private String txId; private int vout; private BitcoindScriptSig scriptSig; - @JsonProperty("txinwitness") + @Json(name = "txinwitness") private List txInWitness; private long sequence; } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoinImportMultiEntryResponse.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoinImportMultiEntryResponse.java index 0fdc923e7a..6e18456300 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoinImportMultiEntryResponse.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoinImportMultiEntryResponse.java @@ -17,17 +17,18 @@ package bisq.wallets.bitcoind.rpc.responses; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.JsonRpcResponse; +import com.squareup.moshi.Json; import lombok.Getter; -import lombok.Setter; import java.util.List; -@Getter -@Setter -public class BitcoinImportMultiEntryResponse { - @JsonProperty("success") - private boolean isSuccess; - private List warnings; - private Object error; +public class BitcoinImportMultiEntryResponse extends JsonRpcResponse> { + @Getter + public static class Entry { + @Json(name = "success") + private boolean isSuccess; + private List warnings; + private Object error; + } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindAddOrCreateMultiSigAddressResponse.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindAddOrCreateMultiSigAddressResponse.java index 1c8b736b54..d6cda65f9f 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindAddOrCreateMultiSigAddressResponse.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindAddOrCreateMultiSigAddressResponse.java @@ -17,13 +17,15 @@ package bisq.wallets.bitcoind.rpc.responses; +import bisq.wallets.json_rpc.JsonRpcResponse; import lombok.Getter; import lombok.Setter; -@Getter -@Setter -public class BitcoindAddOrCreateMultiSigAddressResponse { - private String address; - private String redeemScript; - private String descriptor; +public class BitcoindAddOrCreateMultiSigAddressResponse extends JsonRpcResponse { + @Getter + public static class Result { + private String address; + private String redeemScript; + private String descriptor; + } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindCreateMultiSigResponse.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindCreateMultiSigResponse.java index 397a40f3f4..6dbed63e98 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindCreateMultiSigResponse.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindCreateMultiSigResponse.java @@ -17,13 +17,14 @@ package bisq.wallets.bitcoind.rpc.responses; +import bisq.wallets.json_rpc.JsonRpcResponse; import lombok.Getter; -import lombok.Setter; -@Getter -@Setter -public class BitcoindCreateMultiSigResponse { - private String address; - private String redeemScript; - private String descriptor; +public class BitcoindCreateMultiSigResponse extends JsonRpcResponse { + @Getter + public static class Result { + private String address; + private String redeemScript; + private String descriptor; + } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindCreateOrLoadWalletResponse.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindCreateOrLoadWalletResponse.java index 18f6600135..2f00e32c67 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindCreateOrLoadWalletResponse.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindCreateOrLoadWalletResponse.java @@ -17,14 +17,12 @@ package bisq.wallets.bitcoind.rpc.responses; +import bisq.wallets.json_rpc.JsonRpcResponse; import lombok.Getter; -import lombok.Setter; -public class BitcoindCreateOrLoadWalletResponse extends BitcoindWarningResponse { +public class BitcoindCreateOrLoadWalletResponse extends JsonRpcResponse { @Getter - @Setter - private String name; - - public BitcoindCreateOrLoadWalletResponse() { + public static class Result extends BitcoindWarningResponse.Result { + private String name; } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindDecodeRawTransactionResponse.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindDecodeRawTransactionResponse.java index 9c8bc87405..3d54dabc38 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindDecodeRawTransactionResponse.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindDecodeRawTransactionResponse.java @@ -17,10 +17,11 @@ package bisq.wallets.bitcoind.rpc.responses; +import bisq.wallets.json_rpc.JsonRpcResponse; import lombok.Getter; -import lombok.Setter; -@Getter -@Setter -public class BitcoindDecodeRawTransactionResponse extends AbstractDecodeRawTransactionResponse { +public class BitcoindDecodeRawTransactionResponse extends JsonRpcResponse { + @Getter + public static class Result extends AbstractDecodeRawTransactionResponse { + } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindDescriptor.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindDescriptor.java index 7b03502aaf..8a61f535ce 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindDescriptor.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindDescriptor.java @@ -18,12 +18,10 @@ package bisq.wallets.bitcoind.rpc.responses; import lombok.Getter; -import lombok.Setter; import java.util.List; @Getter -@Setter public class BitcoindDescriptor { private String desc; private long timestamp; diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindFinalizePsbtResponse.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindFinalizePsbtResponse.java index c54290e63a..648187d9fd 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindFinalizePsbtResponse.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindFinalizePsbtResponse.java @@ -17,13 +17,14 @@ package bisq.wallets.bitcoind.rpc.responses; +import bisq.wallets.json_rpc.JsonRpcResponse; import lombok.Getter; -import lombok.Setter; -@Getter -@Setter -public class BitcoindFinalizePsbtResponse { - private String psbt; - private String hex; - private boolean complete; +public class BitcoindFinalizePsbtResponse extends JsonRpcResponse { + @Getter + public static class Result { + private String psbt; + private String hex; + private boolean complete; + } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetAddressInfoResponse.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetAddressInfoResponse.java index 1bd3e6d40a..0506d5e797 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetAddressInfoResponse.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetAddressInfoResponse.java @@ -17,52 +17,53 @@ package bisq.wallets.bitcoind.rpc.responses; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.JsonRpcResponse; +import com.squareup.moshi.Json; import lombok.Getter; -import lombok.Setter; -@Getter -@Setter -public class BitcoindGetAddressInfoResponse { - private String address; - private String scriptPubKey; - @JsonProperty("ismine") - private boolean isMine; - @JsonProperty("iswatchonly") - private boolean isWatchOnly; - private boolean solvable; +public class BitcoindGetAddressInfoResponse extends JsonRpcResponse { + @Getter + public static class Result { + private String address; + private String scriptPubKey; + @Json(name = "ismine") + private boolean isMine; + @Json(name = "iswatchonly") + private boolean isWatchOnly; + private boolean solvable; - private String desc; - @JsonProperty("parent_desc") - private String parentDesc; + private String desc; + @Json(name = "parent_desc") + private String parentDesc; - @JsonProperty("isscript") - private boolean isScript; - @JsonProperty("ischange") - private boolean isChange; - @JsonProperty("iswitness") - private boolean isWitness; - @JsonProperty("witness_version") - private int witnessVersion; - @JsonProperty("witness_program") - private String witnessProgram; - private String script; - private String hex; - @JsonProperty("pubkeys") - private String[] pubKeys; - @JsonProperty("sigsrequired") - private int sigsRequired; - @JsonProperty("pubkey") - private String pubKey; - private Object embedded; - @JsonProperty("iscompressed") - private boolean isCompressed; - private int timestamp; - @JsonProperty("hdkeypath") - private String hdKeyPath; - @JsonProperty("hdseedid") - private String hdSeedId; - @JsonProperty("hdmasterfingerprint") - private String hdMasterFingerprint; - private String[] labels; + @Json(name = "isscript") + private boolean isScript; + @Json(name = "ischange") + private boolean isChange; + @Json(name = "iswitness") + private boolean isWitness; + @Json(name = "witness_version") + private int witnessVersion; + @Json(name = "witness_program") + private String witnessProgram; + private String script; + private String hex; + @Json(name = "pubkeys") + private String[] pubKeys; + @Json(name = "sigsrequired") + private int sigsRequired; + @Json(name = "pubkey") + private String pubKey; + private Object embedded; + @Json(name = "iscompressed") + private boolean isCompressed; + private int timestamp; + @Json(name = "hdkeypath") + private String hdKeyPath; + @Json(name = "hdseedid") + private String hdSeedId; + @Json(name = "hdmasterfingerprint") + private String hdMasterFingerprint; + private String[] labels; + } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetBalancesResponse.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetBalancesResponse.java index 4ab1ca8dce..2df43a4b38 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetBalancesResponse.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetBalancesResponse.java @@ -17,14 +17,15 @@ package bisq.wallets.bitcoind.rpc.responses; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.JsonRpcResponse; +import com.squareup.moshi.Json; import lombok.Getter; -import lombok.Setter; -@Getter -@Setter -public class BitcoindGetBalancesResponse { - private BitcoindGetMineBalancesResponse mine; - @JsonProperty("watchonly") - private BitcoindGetMineBalancesResponse watchOnly; +public class BitcoindGetBalancesResponse extends JsonRpcResponse { + @Getter + public static class Result { + private BitcoindGetMineBalancesResponse mine; + @Json(name = "watchonly") + private BitcoindGetMineBalancesResponse watchOnly; + } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetDescriptorInfoResponse.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetDescriptorInfoResponse.java index 2dcfde611b..7aff63919e 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetDescriptorInfoResponse.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetDescriptorInfoResponse.java @@ -17,19 +17,20 @@ package bisq.wallets.bitcoind.rpc.responses; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.JsonRpcResponse; +import com.squareup.moshi.Json; import lombok.Getter; -import lombok.Setter; -@Getter -@Setter -public class BitcoindGetDescriptorInfoResponse { - private String descriptor; - private String checksum; - @JsonProperty("isrange") - private boolean isRange; - @JsonProperty("issolvable") - private boolean isSolvable; - @JsonProperty("hasprivatekeys") - private boolean hasPrivateKeys; +public class BitcoindGetDescriptorInfoResponse extends JsonRpcResponse { + @Getter + public static class Result { + private String descriptor; + private String checksum; + @Json(name = "isrange") + private boolean isRange; + @Json(name = "issolvable") + private boolean isSolvable; + @Json(name = "hasprivatekeys") + private boolean hasPrivateKeys; + } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetMineBalancesResponse.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetMineBalancesResponse.java index 60b73555de..b60717b5f9 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetMineBalancesResponse.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetMineBalancesResponse.java @@ -17,15 +17,13 @@ package bisq.wallets.bitcoind.rpc.responses; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.squareup.moshi.Json; import lombok.Getter; -import lombok.Setter; @Getter -@Setter public class BitcoindGetMineBalancesResponse { private double trusted; - @JsonProperty("untrusted_pending") + @Json(name = "untrusted_pending") private double untrustedPending; private double immature; } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetZmqNotificationsResponse.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetZmqNotificationsResponse.java index ff24abb214..81cec9289b 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetZmqNotificationsResponse.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindGetZmqNotificationsResponse.java @@ -17,13 +17,16 @@ package bisq.wallets.bitcoind.rpc.responses; +import bisq.wallets.json_rpc.JsonRpcResponse; import lombok.Getter; -import lombok.Setter; -@Getter -@Setter -public class BitcoindGetZmqNotificationsResponse { - private String type; - private String address; - private int hwm; +import java.util.List; + +public class BitcoindGetZmqNotificationsResponse extends JsonRpcResponse> { + @Getter + public static class Entry { + private String type; + private String address; + private int hwm; + } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindImportDescriptorResponseEntry.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindImportDescriptorResponse.java similarity index 66% rename from wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindImportDescriptorResponseEntry.java rename to wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindImportDescriptorResponse.java index d110400fbc..c1380aebbc 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindImportDescriptorResponseEntry.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindImportDescriptorResponse.java @@ -17,18 +17,19 @@ package bisq.wallets.bitcoind.rpc.responses; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.JsonRpcResponse; +import com.squareup.moshi.Json; import lombok.Getter; -import lombok.Setter; import java.util.List; import java.util.Map; -@Getter -@Setter -public class BitcoindImportDescriptorResponseEntry { - @JsonProperty("success") - private boolean isSuccess; - private List warnings; - private Map error; +public class BitcoindImportDescriptorResponse extends JsonRpcResponse> { + @Getter + public static class Entry { + @Json(name = "success") + private boolean isSuccess; + private List warnings; + private Map error; + } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindListDescriptorResponse.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindListDescriptorResponse.java index c177692528..8082290a15 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindListDescriptorResponse.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindListDescriptorResponse.java @@ -17,16 +17,17 @@ package bisq.wallets.bitcoind.rpc.responses; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.JsonRpcResponse; +import com.squareup.moshi.Json; import lombok.Getter; -import lombok.Setter; import java.util.List; -@Getter -@Setter -public class BitcoindListDescriptorResponse { - @JsonProperty("wallet_name") - private String walletName; - private List descriptors; +public class BitcoindListDescriptorResponse extends JsonRpcResponse { + @Getter + public static class Result { + @Json(name = "wallet_name") + private String walletName; + private List descriptors; + } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindListTransactionsResponse.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindListTransactionsResponse.java new file mode 100644 index 0000000000..8fa4b7d29e --- /dev/null +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindListTransactionsResponse.java @@ -0,0 +1,54 @@ +/* + * This file is part of Bisq. + * + * Bisq is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bisq is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bisq. If not, see . + */ + +package bisq.wallets.bitcoind.rpc.responses; + +import bisq.wallets.core.model.Transaction; +import bisq.wallets.json_rpc.JsonRpcResponse; +import com.squareup.moshi.Json; +import lombok.Getter; + +import java.util.List; + +public class BitcoindListTransactionsResponse extends JsonRpcResponse> { + @Getter + public static class Entry implements Transaction { + private boolean involvesWatchonly; + private String address; + private String category; + private double amount; + private String label; + private int vout; + private double fee; + private int confirmations; + private boolean generated; + private boolean trusted; + private String blockhash; + private int blockheight; + private int blockindex; + private int blocktime; + @Json(name = "txid") + private String txId; + private String[] walletconflicts; + private int time; + private int timereceived; + private String comment; + @Json(name = "bip125-replaceable") + private String bip125Replaceable; + private boolean abandoned; + } +} diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindListTransactionsResponseEntry.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindListTransactionsResponseEntry.java deleted file mode 100644 index 8a7a2ae6ec..0000000000 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindListTransactionsResponseEntry.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This file is part of Bisq. - * - * Bisq is free software: you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * Bisq is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public - * License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Bisq. If not, see . - */ - -package bisq.wallets.bitcoind.rpc.responses; - -import bisq.wallets.core.model.Transaction; -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class BitcoindListTransactionsResponseEntry implements Transaction { - private boolean involvesWatchonly; - private String address; - private String category; - private double amount; - private String label; - private int vout; - private double fee; - private int confirmations; - private boolean generated; - private boolean trusted; - private String blockhash; - private int blockheight; - private int blockindex; - private int blocktime; - @JsonProperty("txid") - private String txId; - private String[] walletconflicts; - private int time; - private int timereceived; - private String comment; - private String bip125Replaceable; - private boolean abandoned; - - @JsonProperty("bip125-replaceable") - public String getBip125Replaceable() { - return bip125Replaceable; - } -} diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindListUnspentResponseEntry.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindListUnspentResponse.java similarity index 50% rename from wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindListUnspentResponseEntry.java rename to wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindListUnspentResponse.java index 88973c5bbe..a0ba4d1a70 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindListUnspentResponseEntry.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindListUnspentResponse.java @@ -18,26 +18,29 @@ package bisq.wallets.bitcoind.rpc.responses; import bisq.wallets.core.model.Utxo; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.JsonRpcResponse; +import com.squareup.moshi.Json; import lombok.Getter; -import lombok.Setter; -@Getter -@Setter -public class BitcoindListUnspentResponseEntry implements Utxo { - @JsonProperty("txid") - private String txId; - private int vout; - private String address; - private String label; - private String scriptPubKey; - private double amount; - private int confirmations; - private String redeemScript; - private String witnessScript; - private boolean spendable; - private boolean solvable; - private boolean reused; - private String desc; - private boolean safe; +import java.util.List; + +public class BitcoindListUnspentResponse extends JsonRpcResponse> { + @Getter + public static class Entry implements Utxo { + @Json(name = "txid") + private String txId; + private int vout; + private String address; + private String label; + private String scriptPubKey; + private double amount; + private int confirmations; + private String redeemScript; + private String witnessScript; + private boolean spendable; + private boolean solvable; + private boolean reused; + private String desc; + private boolean safe; + } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindScriptPubKey.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindScriptPubKey.java index 2594031ba6..0f8c86210f 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindScriptPubKey.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindScriptPubKey.java @@ -18,10 +18,8 @@ package bisq.wallets.bitcoind.rpc.responses; import lombok.Getter; -import lombok.Setter; @Getter -@Setter public class BitcoindScriptPubKey { private String asm; private String desc; diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindWalletCreateFundedPsbtResponse.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindWalletCreateFundedPsbtResponse.java index b9179c5c74..c2578df871 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindWalletCreateFundedPsbtResponse.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindWalletCreateFundedPsbtResponse.java @@ -17,14 +17,15 @@ package bisq.wallets.bitcoind.rpc.responses; +import bisq.wallets.json_rpc.JsonRpcResponse; import lombok.Getter; -import lombok.Setter; -@Getter -@Setter -public class BitcoindWalletCreateFundedPsbtResponse { - private String psbt; - private double fee; - private int changepos; +public class BitcoindWalletCreateFundedPsbtResponse extends JsonRpcResponse { + @Getter + public static class Result { + private String psbt; + private double fee; + private int changepos; + } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindWalletProcessPsbtResponse.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindWalletProcessPsbtResponse.java index 60049b94b9..71895f011e 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindWalletProcessPsbtResponse.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindWalletProcessPsbtResponse.java @@ -17,13 +17,14 @@ package bisq.wallets.bitcoind.rpc.responses; +import bisq.wallets.json_rpc.JsonRpcResponse; import lombok.Getter; -import lombok.Setter; -@Getter -@Setter -public class BitcoindWalletProcessPsbtResponse { - private String psbt; - private boolean complete; +public class BitcoindWalletProcessPsbtResponse extends JsonRpcResponse { + @Getter + public static class Result { + private String psbt; + private boolean complete; + } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindWarningResponse.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindWarningResponse.java index 92e70c61cc..72ecd5b5cd 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindWarningResponse.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/rpc/responses/BitcoindWarningResponse.java @@ -17,18 +17,16 @@ package bisq.wallets.bitcoind.rpc.responses; +import bisq.wallets.json_rpc.JsonRpcResponse; import lombok.Getter; -import lombok.Setter; -public class BitcoindWarningResponse { +public class BitcoindWarningResponse extends JsonRpcResponse { @Getter - @Setter - protected String warning; + public static class Result { + protected String warning; - public BitcoindWarningResponse() { - } - - public boolean hasWarning() { - return !warning.isEmpty(); + public boolean hasWarning() { + return !warning.isEmpty(); + } } } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/BitcoindRawTxProcessor.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/BitcoindRawTxProcessor.java index 7567481ac2..9f2d868818 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/BitcoindRawTxProcessor.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/BitcoindRawTxProcessor.java @@ -34,7 +34,7 @@ public BitcoindRawTxProcessor(BitcoindDaemon daemon, ZmqListeners listeners) { @Override public void processRawTx(byte[] serializedTx, byte[] sequenceNumber) { String txInHex = Hex.encode(serializedTx); - BitcoindDecodeRawTransactionResponse rawTransaction = daemon.decodeRawTransaction(txInHex); + BitcoindDecodeRawTransactionResponse.Result rawTransaction = daemon.decodeRawTransaction(txInHex).getResult(); listeners.fireTxOutputAddressesListeners(rawTransaction); listeners.fireTxIdInputListeners(rawTransaction); } diff --git a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/ZmqConnection.java b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/ZmqConnection.java index 808c0ec894..0a04c581ef 100644 --- a/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/ZmqConnection.java +++ b/wallets/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/ZmqConnection.java @@ -55,7 +55,7 @@ public ZmqConnection(ZmqTopicProcessors topicProcessors, ZmqListeners listeners) this.listeners = listeners; } - public void initialize(List zmqConnectionEndpoints) { + public void initialize(List zmqConnectionEndpoints) { context = new ZContext(); executorService.execute(() -> { String zmqAddress = findZmqAddress(zmqConnectionEndpoints); @@ -108,7 +108,7 @@ public void messageLoop(ZMQ.Socket socket) { } } - private String findZmqAddress(List zmqNotifications) { + private String findZmqAddress(List zmqNotifications) { if (!canSubscribeToAllTopics(zmqNotifications)) { throw new CannotFindZmqTopicException( "ZeroMQ: Bitcoind hasn't publishing all topics (" + @@ -124,21 +124,21 @@ private String findZmqAddress(List zmqNotif return zmqNotifications.get(0).getAddress(); } - private boolean canSubscribeToAllTopics(List zmqNotifications) { + private boolean canSubscribeToAllTopics(List zmqNotifications) { Set allTopicNames = Arrays.stream(BitcoindZmqTopic.values()) .map(BitcoindZmqTopic::getTopicName) .collect(Collectors.toSet()); - long count = zmqNotifications.stream().map(BitcoindGetZmqNotificationsResponse::getType) + long count = zmqNotifications.stream().map(BitcoindGetZmqNotificationsResponse.Entry::getType) .filter(allTopicNames::contains) .count(); return count != allTopicNames.size(); } - private boolean allTopicsArePublishedToSameAddress(List zmqNotifications) { + private boolean allTopicsArePublishedToSameAddress(List zmqNotifications) { long count = zmqNotifications.stream() - .map(BitcoindGetZmqNotificationsResponse::getAddress) + .map(BitcoindGetZmqNotificationsResponse.Entry::getAddress) .distinct() .count(); return count == 1; diff --git a/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindConnectionFailureIntegrationTests.java b/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindConnectionFailureIntegrationTests.java index ab0431e59e..106667ceae 100644 --- a/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindConnectionFailureIntegrationTests.java +++ b/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindConnectionFailureIntegrationTests.java @@ -17,7 +17,6 @@ package bisq.wallets.bitcoind; -import bisq.wallets.bitcoind.rpc.BitcoindWallet; import bisq.wallets.regtest.AbstractRegtestSetup; import bisq.wallets.regtest.ConnectionFailureIntegrationTests; import bisq.wallets.regtest.bitcoind.BitcoindRegtestSetup; @@ -26,7 +25,7 @@ import java.io.IOException; public class BitcoindConnectionFailureIntegrationTests - extends ConnectionFailureIntegrationTests { + extends ConnectionFailureIntegrationTests { @Override protected AbstractRegtestSetup createRegtestSetup() throws IOException { return new BitcoindRegtestSetup(); diff --git a/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindCreateWalletNameDocumentationIntegrationTests.java b/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindCreateWalletNameDocumentationIntegrationTests.java index ca9c298488..2d30207bca 100644 --- a/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindCreateWalletNameDocumentationIntegrationTests.java +++ b/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindCreateWalletNameDocumentationIntegrationTests.java @@ -21,8 +21,8 @@ import bisq.wallets.bitcoind.rpc.BitcoindDaemon; import bisq.wallets.bitcoind.rpc.calls.BitcoindCreateWalletRpcCall; import bisq.wallets.core.RpcConfig; -import bisq.wallets.core.rpc.DaemonRpcClient; import bisq.wallets.core.rpc.RpcClientFactory; +import bisq.wallets.json_rpc.JsonRpcClient; import bisq.wallets.regtest.AbstractRegtestSetup; import bisq.wallets.regtest.bitcoind.BitcoindRegtestSetup; import org.junit.jupiter.api.Test; @@ -41,14 +41,14 @@ @ExtendWith(BitcoindExtension.class) public class BitcoindCreateWalletNameDocumentationIntegrationTests { private final Path dataDir; - private final DaemonRpcClient rpcClient; + private final JsonRpcClient rpcClient; private final BitcoindDaemon daemon; public BitcoindCreateWalletNameDocumentationIntegrationTests(BitcoindRegtestSetup regtestSetup) { this.dataDir = regtestSetup.getDataDir(); this.daemon = regtestSetup.getDaemon(); RpcConfig rpcConfig = regtestSetup.getRpcConfig(); - this.rpcClient = RpcClientFactory.createLegacyDaemonRpcClient(rpcConfig); + this.rpcClient = RpcClientFactory.createDaemonRpcClient(rpcConfig); } @Test @@ -61,7 +61,7 @@ void createWalletWithAbsolutePath(@TempDir Path walletPath) { .build(); var rpcCall = new BitcoindCreateWalletRpcCall(request); - rpcClient.invokeAndValidate(rpcCall); + rpcClient.call(rpcCall); File walletFile = walletPath.resolve("wallet.dat") .toFile(); @@ -85,7 +85,7 @@ void createWalletWithRelativePath() throws IOException { .build(); var rpcCall = new BitcoindCreateWalletRpcCall(request); - rpcClient.invokeAndValidate(rpcCall); + rpcClient.call(rpcCall); File expectedWalletFile = newWalletDir.resolve("b") .resolve("wallet.dat") diff --git a/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindListDescriptorsIntegrationTest.java b/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindListDescriptorsIntegrationTest.java index f14bfb9da7..ea9d3b9569 100644 --- a/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindListDescriptorsIntegrationTest.java +++ b/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindListDescriptorsIntegrationTest.java @@ -39,7 +39,7 @@ public BitcoindListDescriptorsIntegrationTest(BitcoindRegtestSetup regtestSetup) @Test void listDescriptorsTest() { - BitcoindListDescriptorResponse response = minerWallet.listDescriptors(); + BitcoindListDescriptorResponse.Result response = minerWallet.listDescriptors().getResult(); List descriptorList = response.getDescriptors(); assertThat(descriptorList).isNotEmpty() diff --git a/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindPsbtMultiSigIntegrationTests.java b/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindPsbtMultiSigIntegrationTests.java index eea02038ba..51fde06116 100644 --- a/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindPsbtMultiSigIntegrationTests.java +++ b/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindPsbtMultiSigIntegrationTests.java @@ -112,20 +112,20 @@ public void psbtMultiSigTest() throws MalformedURLException, InterruptedExceptio // Create PSBT (send to Alice without Alice) String aliceReceiveAddr = aliceWallet.getNewAddress(AddressType.BECH32, ""); - BitcoindWalletCreateFundedPsbtResponse createFundedPsbtResponse = bobWatchOnlyWallet.walletCreateFundedPsbt( + BitcoindWalletCreateFundedPsbtResponse.Result createFundedPsbtResponse = bobWatchOnlyWallet.walletCreateFundedPsbt( Collections.emptyList(), Map.of(aliceReceiveAddr, 4.), Map.of("feeRate", 0.00010) - ); + ).getResult(); - BitcoindWalletProcessPsbtResponse bobPsbtResponse = bobWallet.walletProcessPsbt( + BitcoindWalletProcessPsbtResponse.Result bobPsbtResponse = bobWallet.walletProcessPsbt( Optional.of(AbstractRegtestSetup.WALLET_PASSPHRASE), createFundedPsbtResponse.getPsbt() - ); - BitcoindWalletProcessPsbtResponse charliePsbtResponse = charlieWallet.walletProcessPsbt( + ).getResult(); + BitcoindWalletProcessPsbtResponse.Result charliePsbtResponse = charlieWallet.walletProcessPsbt( Optional.of(AbstractRegtestSetup.WALLET_PASSPHRASE), createFundedPsbtResponse.getPsbt() - ); + ).getResult(); // Combine PSBTs String combinedPsbt = daemon.combinePsbt( @@ -133,7 +133,7 @@ public void psbtMultiSigTest() throws MalformedURLException, InterruptedExceptio ); // Finalize PSBT - BitcoindFinalizePsbtResponse finalizePsbtResponse = daemon.finalizePsbt(combinedPsbt); + BitcoindFinalizePsbtResponse.Result finalizePsbtResponse = daemon.finalizePsbt(combinedPsbt).getResult(); assertThat(finalizePsbtResponse.isComplete()) .isTrue(); @@ -146,7 +146,7 @@ public void psbtMultiSigTest() throws MalformedURLException, InterruptedExceptio } private String getWalletXPub(BitcoindWallet wallet) { - List descriptors = wallet.listDescriptors().getDescriptors(); + List descriptors = wallet.listDescriptors().getResult().getDescriptors(); String xPub = descriptors.stream() .map(BitcoindDescriptor::getDesc) .filter(descriptor -> descriptor.startsWith("pkh")) @@ -162,7 +162,7 @@ private BitcoindWallet createWatchOnlyDescriptorWallet(String walletPrefix) thro } private String appendChecksumToDescriptor(String descriptor) { - BitcoindGetDescriptorInfoResponse receiveDescriptorInfo = minerWallet.getDescriptorInfo(descriptor); + BitcoindGetDescriptorInfoResponse.Result receiveDescriptorInfo = minerWallet.getDescriptorInfo(descriptor).getResult(); return receiveDescriptorInfo.getDescriptor(); } } diff --git a/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindSendAndListTxsIntegrationTests.java b/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindSendAndListTxsIntegrationTests.java index 2064d89e21..78b0098854 100644 --- a/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindSendAndListTxsIntegrationTests.java +++ b/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindSendAndListTxsIntegrationTests.java @@ -19,7 +19,7 @@ import bisq.wallets.bitcoind.regtest.BitcoindExtension; import bisq.wallets.bitcoind.rpc.BitcoindWallet; -import bisq.wallets.bitcoind.rpc.responses.BitcoindListTransactionsResponseEntry; +import bisq.wallets.bitcoind.rpc.responses.BitcoindListTransactionsResponse; import bisq.wallets.core.model.AddressType; import bisq.wallets.regtest.bitcoind.BitcoindRegtestSetup; import org.junit.jupiter.api.Test; @@ -57,10 +57,10 @@ public void sendBtcAndListTxs() throws MalformedURLException, InterruptedExcepti regtestSetup.mineOneBlock(); - List txs = receiverBackend.listTransactions(10); + List txs = receiverBackend.listTransactions(10); assertEquals(3, txs.size()); - BitcoindListTransactionsResponseEntry firstTx = txs.get(0); + BitcoindListTransactionsResponse.Entry firstTx = txs.get(0); assertEquals(firstTxReceiverAddress, firstTx.getAddress()); assertEquals("receive", firstTx.getCategory()); assertEquals(1, firstTx.getAmount()); @@ -68,7 +68,7 @@ public void sendBtcAndListTxs() throws MalformedURLException, InterruptedExcepti assertEquals(0, firstTx.getWalletconflicts().length); assertEquals("no", firstTx.getBip125Replaceable()); - BitcoindListTransactionsResponseEntry secondTx = txs.get(1); + BitcoindListTransactionsResponse.Entry secondTx = txs.get(1); assertEquals(secondTxReceiverAddress, secondTx.getAddress()); assertEquals("receive", secondTx.getCategory()); assertEquals(1, secondTx.getAmount()); @@ -76,7 +76,7 @@ public void sendBtcAndListTxs() throws MalformedURLException, InterruptedExcepti assertEquals(0, secondTx.getWalletconflicts().length); assertEquals("no", secondTx.getBip125Replaceable()); - BitcoindListTransactionsResponseEntry thirdTx = txs.get(2); + BitcoindListTransactionsResponse.Entry thirdTx = txs.get(2); assertEquals(thirdTxReceiverAddress, thirdTx.getAddress()); assertEquals("receive", thirdTx.getCategory()); assertEquals(1, thirdTx.getAmount()); diff --git a/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindSendAndListUnspentIntegrationTests.java b/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindSendAndListUnspentIntegrationTests.java index dd12723312..1576cf6690 100644 --- a/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindSendAndListUnspentIntegrationTests.java +++ b/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/BitcoindSendAndListUnspentIntegrationTests.java @@ -19,7 +19,7 @@ import bisq.wallets.bitcoind.regtest.BitcoindExtension; import bisq.wallets.bitcoind.rpc.BitcoindWallet; -import bisq.wallets.bitcoind.rpc.responses.BitcoindListUnspentResponseEntry; +import bisq.wallets.bitcoind.rpc.responses.BitcoindListUnspentResponse; import bisq.wallets.regtest.bitcoind.BitcoindRegtestSetup; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -50,14 +50,14 @@ public void listUnspent() throws MalformedURLException, InterruptedException { String secondTxReceiverAddress = regtestSetup.sendBtcAndMineOneBlock(minerWallet, receiverBackend, 1); String thirdTxReceiverAddress = regtestSetup.sendBtcAndMineOneBlock(minerWallet, receiverBackend, 1); - List utxos = receiverBackend.listUnspent(); + List utxos = receiverBackend.listUnspent(); assertEquals(3, utxos.size()); - Optional queryResult = regtestSetup + Optional queryResult = regtestSetup .filterUtxosByAddress(utxos, firstTxReceiverAddress); assertTrue(queryResult.isPresent()); - BitcoindListUnspentResponseEntry firstUtxo = queryResult.get(); + BitcoindListUnspentResponse.Entry firstUtxo = queryResult.get(); assertEquals("", firstUtxo.getLabel()); assertEquals(1, firstUtxo.getAmount()); assertEquals(3, firstUtxo.getConfirmations()); @@ -68,7 +68,7 @@ public void listUnspent() throws MalformedURLException, InterruptedException { queryResult = regtestSetup.filterUtxosByAddress(utxos, secondTxReceiverAddress); assertTrue(queryResult.isPresent()); - BitcoindListUnspentResponseEntry secondUtxo = queryResult.get(); + BitcoindListUnspentResponse.Entry secondUtxo = queryResult.get(); assertEquals("", secondUtxo.getLabel()); assertEquals(1, secondUtxo.getAmount()); assertEquals(2, secondUtxo.getConfirmations()); @@ -79,7 +79,7 @@ public void listUnspent() throws MalformedURLException, InterruptedException { queryResult = regtestSetup.filterUtxosByAddress(utxos, thirdTxReceiverAddress); assertTrue(queryResult.isPresent()); - BitcoindListUnspentResponseEntry thirdUtxo = queryResult.get(); + BitcoindListUnspentResponse.Entry thirdUtxo = queryResult.get(); assertEquals("", thirdUtxo.getLabel()); assertEquals(1, thirdUtxo.getAmount()); assertEquals(1, thirdUtxo.getConfirmations()); diff --git a/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/WalletNotRunningTest.java b/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/WalletNotRunningTest.java index 36bc19aa1b..fb43bbf681 100644 --- a/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/WalletNotRunningTest.java +++ b/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/WalletNotRunningTest.java @@ -20,18 +20,17 @@ import bisq.common.util.NetworkUtils; import bisq.wallets.bitcoind.rpc.BitcoindDaemon; import bisq.wallets.core.RpcConfig; -import bisq.wallets.core.rpc.DaemonRpcClient; import bisq.wallets.core.rpc.RpcClientFactory; +import bisq.wallets.json_rpc.JsonRpcClient; import org.junit.jupiter.api.Test; -import java.io.IOException; import java.net.ConnectException; import static org.assertj.core.api.Assertions.assertThatThrownBy; public class WalletNotRunningTest { @Test - void notRunningTest() throws IOException { + void notRunningTest() { int freePort = NetworkUtils.findFreeSystemPort(); RpcConfig rpcConfig = RpcConfig.builder() @@ -41,7 +40,7 @@ void notRunningTest() throws IOException { .port(freePort) .build(); - DaemonRpcClient rpcClient = RpcClientFactory.createLegacyDaemonRpcClient(rpcConfig); + JsonRpcClient rpcClient = RpcClientFactory.createDaemonRpcClient(rpcConfig); var minerChainBackend = new BitcoindDaemon(rpcClient); assertThatThrownBy(minerChainBackend::listWallets) diff --git a/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/zmq/BitcoindZeroMqConnectionInfoFinderIntegrationTests.java b/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/zmq/BitcoindZeroMqConnectionInfoFinderIntegrationTests.java index e00a4424cf..88228a948f 100644 --- a/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/zmq/BitcoindZeroMqConnectionInfoFinderIntegrationTests.java +++ b/wallets/bitcoind/src/test/java/bisq/wallets/bitcoind/zmq/BitcoindZeroMqConnectionInfoFinderIntegrationTests.java @@ -39,7 +39,7 @@ public BitcoindZeroMqConnectionInfoFinderIntegrationTests(BitcoindRegtestSetup r @Test void findConnectionInfo() { - List zmqNotifications = daemon.getZmqNotifications(); + List zmqNotifications = daemon.getZmqNotifications(); assertThat(zmqNotifications).isNotEmpty(); } } diff --git a/wallets/core/src/main/java/bisq/wallets/core/rpc/RpcClientFactory.java b/wallets/core/src/main/java/bisq/wallets/core/rpc/RpcClientFactory.java index 69bcc0bd86..132c794aba 100644 --- a/wallets/core/src/main/java/bisq/wallets/core/rpc/RpcClientFactory.java +++ b/wallets/core/src/main/java/bisq/wallets/core/rpc/RpcClientFactory.java @@ -46,15 +46,9 @@ public static DaemonRpcClient createLegacyDaemonRpcClient(RpcConfig rpcConfig) { } } - public static WalletRpcClient createWalletRpcClient(RpcConfig rpcConfig, String walletName) { - try { - var urlSuffix = "/wallet/" + walletName; - return new WalletRpcClient( - createLegacyJsonRpcClientWithUrlSuffix(rpcConfig, Optional.of(urlSuffix)) - ); - } catch (MalformedURLException e) { - throw new RpcClientCreationFailureException("Couldn't create RpcClient with config: " + rpcConfig, e); - } + public static JsonRpcClient createWalletRpcClient(RpcConfig rpcConfig, String walletName) { + var urlSuffix = "/wallet/" + walletName; + return createJsonRpcClientWithUrlSuffix(rpcConfig, Optional.of(urlSuffix)); } private static JsonRpcClient createJsonRpcClientWithUrlSuffix(RpcConfig rpcConfig, Optional urlSuffix) { diff --git a/wallets/electrum/src/main/java/bisq/wallets/electrum/rpc/DaemonRpcClient.java b/wallets/electrum/src/main/java/bisq/wallets/electrum/rpc/DaemonRpcClient.java deleted file mode 100644 index 1a3f7929fd..0000000000 --- a/wallets/electrum/src/main/java/bisq/wallets/electrum/rpc/DaemonRpcClient.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This file is part of Bisq. - * - * Bisq is free software: you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * Bisq is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public - * License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Bisq. If not, see . - */ - -package bisq.wallets.electrum.rpc; - -import bisq.wallets.core.exceptions.RpcCallFailureException; -import bisq.wallets.json_rpc.DaemonRpcCall; -import bisq.wallets.json_rpc.JsonRpcClient; -import bisq.wallets.json_rpc.JsonRpcResponse; -import bisq.wallets.json_rpc.RpcCall; - -public class DaemonRpcClient { - - private final JsonRpcClient jsonRpcClient; - - public DaemonRpcClient(JsonRpcClient jsonRpcClient) { - this.jsonRpcClient = jsonRpcClient; - } - - public > R invokeAndValidate(DaemonRpcCall rpcCall) { - R response = invoke(rpcCall); - validateRpcCall(rpcCall, response); - return response; - } - - private > R invoke(DaemonRpcCall rpcCall) { - return invokeAndHandleExceptions(jsonRpcClient, rpcCall); - } - - private > void validateRpcCall(RpcCall rpcCall, R response) { - boolean isValid = rpcCall.isResponseValid(response); - if (!isValid) { - throw new RpcCallFailureException("RPC Call to '" + rpcCall.getRpcMethodName() + "' failed. " + - response.toString()); - } - } - - private > R invokeAndHandleExceptions(JsonRpcClient jsonRpcHttpClient, RpcCall rpcCall) { - return jsonRpcHttpClient.call(rpcCall); - } -} diff --git a/wallets/elementsd/build.gradle b/wallets/elementsd/build.gradle index 9c6982242c..935a068f66 100644 --- a/wallets/elementsd/build.gradle +++ b/wallets/elementsd/build.gradle @@ -13,6 +13,7 @@ dependencies { implementation project(':core') implementation project(':bitcoind') + implementation project(':json-rpc') implementation libs.google.guava implementation libs.jackson.databind diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/WalletFactory.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/WalletFactory.java index cbabdc365a..c2f120b220 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/WalletFactory.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/WalletFactory.java @@ -25,6 +25,7 @@ import bisq.wallets.core.rpc.WalletRpcClient; import bisq.wallets.elementsd.rpc.ElementsdDaemon; import bisq.wallets.elementsd.rpc.ElementsdWallet; +import bisq.wallets.json_rpc.JsonRpcClient; import java.util.List; @@ -40,18 +41,18 @@ public static LiquidWallet createLiquidWallet(RpcConfig rpcConfig, } private static ElementsdDaemon createElementsdDaemon(RpcConfig rpcConfig) { - DaemonRpcClient rpcClient = RpcClientFactory.createLegacyDaemonRpcClient(rpcConfig); + JsonRpcClient rpcClient = RpcClientFactory.createDaemonRpcClient(rpcConfig); return new ElementsdDaemon(rpcClient); } private static ElementsdWallet createElementsdWallet(RpcConfig rpcConfig, String walletName) { - WalletRpcClient rpcClient = RpcClientFactory.createWalletRpcClient(rpcConfig, walletName); + JsonRpcClient rpcClient = RpcClientFactory.createWalletRpcClient(rpcConfig, walletName); return new ElementsdWallet(rpcClient); } private static ZmqConnection initializeElementsdZeroMq(ElementsdDaemon elementsdDaemon, ElementsdWallet elementsdWallet) { var zmqConnection = ZmqConnectionFactory.createForElements(elementsdDaemon, elementsdWallet); - List zmqNotifications = elementsdDaemon.getZmqNotifications(); + List zmqNotifications = elementsdDaemon.getZmqNotifications(); zmqConnection.initialize(zmqNotifications); return zmqConnection; } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/ElementsdDaemon.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/ElementsdDaemon.java index 8b07a7cde3..b4ac2bc03c 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/ElementsdDaemon.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/ElementsdDaemon.java @@ -19,21 +19,20 @@ import bisq.wallets.bitcoind.rpc.BitcoindDaemon; import bisq.wallets.bitcoind.rpc.responses.BitcoindGetZmqNotificationsResponse; -import bisq.wallets.core.rpc.DaemonRpcClient; import bisq.wallets.elementsd.rpc.calls.ElementsdDecodeRawTransactionRpcCall; import bisq.wallets.elementsd.rpc.calls.ElementsdStopRpcCall; import bisq.wallets.elementsd.rpc.responses.ElementsdDecodeRawTransactionResponse; +import bisq.wallets.json_rpc.JsonRpcClient; -import java.nio.file.Path; import java.util.List; import java.util.Optional; public class ElementsdDaemon { - private final DaemonRpcClient rpcClient; + private final JsonRpcClient rpcClient; private final BitcoindDaemon bitcoindDaemon; - public ElementsdDaemon(DaemonRpcClient rpcClient) { + public ElementsdDaemon(JsonRpcClient rpcClient) { this.rpcClient = rpcClient; bitcoindDaemon = new BitcoindDaemon(rpcClient); } @@ -45,7 +44,7 @@ public void createOrLoadWallet(String walletName, Optional passphrase) { public ElementsdDecodeRawTransactionResponse decodeRawTransaction(String txInHex) { var request = new ElementsdDecodeRawTransactionRpcCall.Request(txInHex); var rpcCall = new ElementsdDecodeRawTransactionRpcCall(request); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall); } public List generateToAddress(int numberOfBlocksToMine, String addressOfMiner) { @@ -60,7 +59,7 @@ public String getTxOutProof(List txIds) { return bitcoindDaemon.getTxOutProof(txIds); } - public List getZmqNotifications() { + public List getZmqNotifications() { return bitcoindDaemon.getZmqNotifications(); } @@ -74,7 +73,7 @@ public String sendRawTransaction(String hexString) { public void stop() { var rpcCall = new ElementsdStopRpcCall(); - rpcClient.invokeAndValidate(rpcCall); + rpcClient.call(rpcCall); } public void unloadWallet(String walletName) { diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/ElementsdRawTxProcessor.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/ElementsdRawTxProcessor.java index 9d482383c9..b4c78addfa 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/ElementsdRawTxProcessor.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/ElementsdRawTxProcessor.java @@ -38,7 +38,7 @@ public ElementsdRawTxProcessor(ElementsdDaemon daemon, ElementsdWallet wallet, Z public void processRawTx(byte[] serializedTx, byte[] sequenceNumber) { String txInHex = Hex.encode(serializedTx); String unblindedTxInHex = wallet.unblindRawTransaction(txInHex); - ElementsdDecodeRawTransactionResponse rawTransaction = daemon.decodeRawTransaction(unblindedTxInHex); + ElementsdDecodeRawTransactionResponse.Result rawTransaction = daemon.decodeRawTransaction(unblindedTxInHex).getResult(); listeners.fireTxOutputAddressesListeners(rawTransaction); listeners.fireTxIdInputListeners(rawTransaction); diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/ElementsdWallet.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/ElementsdWallet.java index 02096a26c3..673ab0904b 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/ElementsdWallet.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/ElementsdWallet.java @@ -23,18 +23,17 @@ import bisq.wallets.bitcoind.rpc.calls.BitcoindVerifyMessageRpcCall; import bisq.wallets.bitcoind.rpc.calls.BitcoindWalletLockRpcCall; import bisq.wallets.core.model.AddressType; -import bisq.wallets.core.rpc.WalletRpcClient; import bisq.wallets.elementsd.rpc.calls.*; import bisq.wallets.elementsd.rpc.responses.*; +import bisq.wallets.json_rpc.JsonRpcClient; -import java.util.Arrays; import java.util.List; import java.util.Optional; public class ElementsdWallet { - private final WalletRpcClient rpcClient; + private final JsonRpcClient rpcClient; - public ElementsdWallet(WalletRpcClient rpcClient) { + public ElementsdWallet(JsonRpcClient rpcClient) { this.rpcClient = rpcClient; } @@ -46,7 +45,7 @@ public String claimPegin(Optional passphrase, String bitcoinTxId, String .txOutProof(txOutProof) .build(); var rpcCall = new ElementsdClaimPeginRpcCall(request); - String result = rpcClient.invokeAndValidate(rpcCall); + String result = rpcClient.call(rpcCall).getResult(); walletLock(); return result; @@ -58,8 +57,8 @@ public double getLBtcBalance() { public double getAssetBalance(String assetLabel) { var rpcCall = new ElementsdGetBalancesRpcCall(); - ElementsdGetBalancesResponse response = rpcClient.invokeAndValidate(rpcCall); - ElementsdGetMineBalancesResponse mineBalancesResponse = response.getMine(); + ElementsdGetBalancesResponse response = rpcClient.call(rpcCall); + ElementsdGetMineBalances mineBalancesResponse = response.getResult().getMine(); double trustedBalance = mineBalancesResponse.getTrusted().getOrDefault(assetLabel, 0.); double pendingBalance = mineBalancesResponse.getUntrustedPending().getOrDefault(assetLabel, 0.); @@ -69,7 +68,7 @@ public double getAssetBalance(String assetLabel) { public ElementsdGetAddressInfoResponse getAddressInfo(String address) { var request = new ElementsdGetAddressInfoRpcCall.Request(address); var rpcCall = new ElementsdGetAddressInfoRpcCall(request); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall); } public String getNewAddress(AddressType addressType, String label) { @@ -78,12 +77,12 @@ public String getNewAddress(AddressType addressType, String label) { .label(label) .build(); var rpcCall = new BitcoindGetNewAddressRpcCall(request); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall).getResult(); } public ElementsdGetPeginAddressResponse getPeginAddress() { var rpcCall = new ElementsdGetPeginAddressRpcCall(); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall); } public ElementsdIssueAssetResponse issueAsset(Optional passphrase, double assetAmount, double tokenAmount) { @@ -94,25 +93,23 @@ public ElementsdIssueAssetResponse issueAsset(Optional passphrase, doubl .tokenAmount(tokenAmount) .build(); var rpcCall = new ElementsIssueAssetRpcCall(request); - ElementsdIssueAssetResponse response = rpcClient.invokeAndValidate(rpcCall); + ElementsdIssueAssetResponse response = rpcClient.call(rpcCall); walletLock(); return response; } - public List listTransactions(int count) { + public List listTransactions(int count) { var request = ElementsdListTransactionsRpcCall.Request.builder() .count(count) .build(); var rpcCall = new ElementsdListTransactionsRpcCall(request); - ElementsdListTransactionsResponseEntry[] response = rpcClient.invokeAndValidate(rpcCall); - return Arrays.asList(response); + return rpcClient.call(rpcCall).getResult(); } - public List listUnspent() { + public List listUnspent() { var rpcCall = new ElementsdListUnspentRpcCall(); - ElementsdListUnspentResponseEntry[] response = rpcClient.invokeAndValidate(rpcCall); - return Arrays.asList(response); + return rpcClient.call(rpcCall).getResult(); } public String sendLBtcToAddress(Optional passphrase, String address, double amount) { @@ -128,7 +125,7 @@ public String sendAssetToAddress(Optional passphrase, String assetLabel, .amount(amount) .build(); var rpcCall = new ElementsdSendToAddressRpcCall(request); - String txId = rpcClient.invokeAndValidate(rpcCall); + String txId = rpcClient.call(rpcCall).getResult(); walletLock(); return txId; @@ -142,7 +139,7 @@ public String signMessage(Optional passphrase, String address, String me .message(message) .build(); var rpcCall = new BitcoindSignMessageRpcCall(request); - String signature = rpcClient.invokeAndValidate(rpcCall); + String signature = rpcClient.call(rpcCall).getResult(); walletLock(); return signature; @@ -151,7 +148,7 @@ public String signMessage(Optional passphrase, String address, String me public String unblindRawTransaction(String rawTxInHex) { var request = new ElementsdUnblindRawTransactionRpcCall.Request(rawTxInHex); var rpcCall = new ElementsdUnblindRawTransactionRpcCall(request); - return rpcClient.invokeAndValidate(rpcCall).getHex(); + return rpcClient.call(rpcCall).getResult().getHex(); } public boolean verifyMessage(String address, String signature, String message) { @@ -161,12 +158,12 @@ public boolean verifyMessage(String address, String signature, String message) { .message(message) .build(); var rpcCall = new BitcoindVerifyMessageRpcCall(request); - return rpcClient.invokeAndValidate(rpcCall); + return rpcClient.call(rpcCall).getResult(); } public void walletLock() { var rpcCall = new BitcoindWalletLockRpcCall(); - rpcClient.invokeAndValidate(rpcCall); + rpcClient.call(rpcCall); } private void walletPassphrase(Optional passphrase) { diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsIssueAssetRpcCall.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsIssueAssetRpcCall.java index 49e7f0f57a..c519968f7c 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsIssueAssetRpcCall.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsIssueAssetRpcCall.java @@ -17,20 +17,20 @@ package bisq.wallets.elementsd.rpc.calls; -import bisq.wallets.core.rpc.call.WalletRpcCall; import bisq.wallets.elementsd.rpc.responses.ElementsdIssueAssetResponse; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.DaemonRpcCall; +import com.squareup.moshi.Json; import lombok.Builder; import lombok.Getter; public class ElementsIssueAssetRpcCall - extends WalletRpcCall { + extends DaemonRpcCall { @Builder @Getter public static class Request { - @JsonProperty("assetamount") + @Json(name = "assetamount") private final double assetAmount; - @JsonProperty("tokenamount") + @Json(name = "tokenamount") private final double tokenAmount; } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdClaimPeginRpcCall.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdClaimPeginRpcCall.java index 5b08d90c71..ab40617603 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdClaimPeginRpcCall.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdClaimPeginRpcCall.java @@ -17,18 +17,19 @@ package bisq.wallets.elementsd.rpc.calls; -import bisq.wallets.core.rpc.call.WalletRpcCall; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.DaemonRpcCall; +import bisq.wallets.json_rpc.reponses.JsonRpcStringResponse; +import com.squareup.moshi.Json; import lombok.Builder; import lombok.Getter; -public class ElementsdClaimPeginRpcCall extends WalletRpcCall { +public class ElementsdClaimPeginRpcCall extends DaemonRpcCall { @Builder @Getter public static class Request { - @JsonProperty("bitcoin_tx") + @Json(name = "bitcoin_tx") private final String bitcoinTxId; - @JsonProperty("txoutproof") + @Json(name = "txoutproof") private final String txOutProof; } @@ -42,12 +43,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(String response) { + public boolean isResponseValid(JsonRpcStringResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return String.class; + public Class getRpcResponseClass() { + return JsonRpcStringResponse.class; } } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdDecodeRawTransactionRpcCall.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdDecodeRawTransactionRpcCall.java index e6254d95de..95ecba7a88 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdDecodeRawTransactionRpcCall.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdDecodeRawTransactionRpcCall.java @@ -17,9 +17,9 @@ package bisq.wallets.elementsd.rpc.calls; -import bisq.wallets.core.rpc.call.DaemonRpcCall; import bisq.wallets.elementsd.rpc.responses.ElementsdDecodeRawTransactionResponse; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.DaemonRpcCall; +import com.squareup.moshi.Json; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; @@ -31,10 +31,10 @@ public class ElementsdDecodeRawTransactionRpcCall @ToString @EqualsAndHashCode public static final class Request { - @JsonProperty("hexstring") + @Json(name = "hexstring") private final String hexString; - public Request(@JsonProperty("hexstring") String hexString) { + public Request(String hexString) { this.hexString = hexString; } } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdGetAddressInfoRpcCall.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdGetAddressInfoRpcCall.java index c55996ec82..2393fe3f1f 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdGetAddressInfoRpcCall.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdGetAddressInfoRpcCall.java @@ -17,14 +17,14 @@ package bisq.wallets.elementsd.rpc.calls; -import bisq.wallets.core.rpc.call.WalletRpcCall; import bisq.wallets.elementsd.rpc.responses.ElementsdGetAddressInfoResponse; +import bisq.wallets.json_rpc.DaemonRpcCall; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; public class ElementsdGetAddressInfoRpcCall - extends WalletRpcCall { + extends DaemonRpcCall { @Getter @ToString diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdGetBalancesRpcCall.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdGetBalancesRpcCall.java index 7625e7c9c3..582475de3d 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdGetBalancesRpcCall.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdGetBalancesRpcCall.java @@ -17,10 +17,10 @@ package bisq.wallets.elementsd.rpc.calls; -import bisq.wallets.core.rpc.call.WalletRpcCall; import bisq.wallets.elementsd.rpc.responses.ElementsdGetBalancesResponse; +import bisq.wallets.json_rpc.DaemonRpcCall; -public class ElementsdGetBalancesRpcCall extends WalletRpcCall { +public class ElementsdGetBalancesRpcCall extends DaemonRpcCall { public ElementsdGetBalancesRpcCall() { super(null); diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdGetPeginAddressRpcCall.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdGetPeginAddressRpcCall.java index 17934217e7..c6f144b133 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdGetPeginAddressRpcCall.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdGetPeginAddressRpcCall.java @@ -17,10 +17,10 @@ package bisq.wallets.elementsd.rpc.calls; -import bisq.wallets.core.rpc.call.WalletRpcCall; import bisq.wallets.elementsd.rpc.responses.ElementsdGetPeginAddressResponse; +import bisq.wallets.json_rpc.DaemonRpcCall; -public class ElementsdGetPeginAddressRpcCall extends WalletRpcCall { +public class ElementsdGetPeginAddressRpcCall extends DaemonRpcCall { public ElementsdGetPeginAddressRpcCall() { super(null); } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdListTransactionsRpcCall.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdListTransactionsRpcCall.java index f874cca39b..37b6fd8156 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdListTransactionsRpcCall.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdListTransactionsRpcCall.java @@ -17,13 +17,13 @@ package bisq.wallets.elementsd.rpc.calls; -import bisq.wallets.core.rpc.call.WalletRpcCall; -import bisq.wallets.elementsd.rpc.responses.ElementsdListTransactionsResponseEntry; +import bisq.wallets.elementsd.rpc.responses.ElementsdListTransactionsResponse; +import bisq.wallets.json_rpc.DaemonRpcCall; import lombok.Builder; import lombok.Getter; public class ElementsdListTransactionsRpcCall - extends WalletRpcCall { + extends DaemonRpcCall { @Builder @Getter public static class Request { @@ -41,12 +41,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(ElementsdListTransactionsResponseEntry[] response) { + public boolean isResponseValid(ElementsdListTransactionsResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return ElementsdListTransactionsResponseEntry[].class; + public Class getRpcResponseClass() { + return ElementsdListTransactionsResponse.class; } } \ No newline at end of file diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdListUnspentRpcCall.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdListUnspentRpcCall.java index 27faa2db3e..64ce5662ea 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdListUnspentRpcCall.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdListUnspentRpcCall.java @@ -17,10 +17,10 @@ package bisq.wallets.elementsd.rpc.calls; -import bisq.wallets.core.rpc.call.WalletRpcCall; -import bisq.wallets.elementsd.rpc.responses.ElementsdListUnspentResponseEntry; +import bisq.wallets.elementsd.rpc.responses.ElementsdListUnspentResponse; +import bisq.wallets.json_rpc.DaemonRpcCall; -public class ElementsdListUnspentRpcCall extends WalletRpcCall { +public class ElementsdListUnspentRpcCall extends DaemonRpcCall { public ElementsdListUnspentRpcCall() { super(null); } @@ -31,12 +31,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(ElementsdListUnspentResponseEntry[] response) { + public boolean isResponseValid(ElementsdListUnspentResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return ElementsdListUnspentResponseEntry[].class; + public Class getRpcResponseClass() { + return ElementsdListUnspentResponse.class; } } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdSendToAddressRpcCall.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdSendToAddressRpcCall.java index 32d72cd39b..e6269515f7 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdSendToAddressRpcCall.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdSendToAddressRpcCall.java @@ -17,18 +17,19 @@ package bisq.wallets.elementsd.rpc.calls; -import bisq.wallets.core.rpc.call.WalletRpcCall; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.DaemonRpcCall; +import bisq.wallets.json_rpc.reponses.JsonRpcStringResponse; +import com.squareup.moshi.Json; import lombok.Builder; import lombok.Getter; -public class ElementsdSendToAddressRpcCall extends WalletRpcCall { +public class ElementsdSendToAddressRpcCall extends DaemonRpcCall { @Builder @Getter public static class Request { private final String address; private final double amount; - @JsonProperty("assetlabel") + @Json(name = "assetlabel") private String assetLabel; } @@ -42,13 +43,13 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(String response) { + public boolean isResponseValid(JsonRpcStringResponse response) { return true; } @Override - public Class getRpcResponseClass() { - return String.class; + public Class getRpcResponseClass() { + return JsonRpcStringResponse.class; } } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdStopRpcCall.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdStopRpcCall.java index 27f94f1b93..d37556a06d 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdStopRpcCall.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdStopRpcCall.java @@ -17,9 +17,11 @@ package bisq.wallets.elementsd.rpc.calls; -import bisq.wallets.core.rpc.call.DaemonRpcCall; -public class ElementsdStopRpcCall extends DaemonRpcCall { +import bisq.wallets.json_rpc.DaemonRpcCall; +import bisq.wallets.json_rpc.reponses.JsonRpcStringResponse; + +public class ElementsdStopRpcCall extends DaemonRpcCall { public ElementsdStopRpcCall() { super(null); } @@ -30,12 +32,12 @@ public String getRpcMethodName() { } @Override - public boolean isResponseValid(String response) { - return response.equals("Elements Core stopping"); + public boolean isResponseValid(JsonRpcStringResponse response) { + return response.getResult().equals("Elements Core stopping"); } @Override - public Class getRpcResponseClass() { - return String.class; + public Class getRpcResponseClass() { + return JsonRpcStringResponse.class; } } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdUnblindRawTransactionRpcCall.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdUnblindRawTransactionRpcCall.java index 89f238f8d5..8632f0e08a 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdUnblindRawTransactionRpcCall.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/calls/ElementsdUnblindRawTransactionRpcCall.java @@ -17,14 +17,14 @@ package bisq.wallets.elementsd.rpc.calls; -import bisq.wallets.core.rpc.call.WalletRpcCall; import bisq.wallets.elementsd.rpc.responses.ElementsdUnblindRawTransactionResponse; +import bisq.wallets.json_rpc.DaemonRpcCall; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; public class ElementsdUnblindRawTransactionRpcCall - extends WalletRpcCall { + extends DaemonRpcCall { @Getter @ToString diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdDecodeRawTransactionResponse.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdDecodeRawTransactionResponse.java index 9792332a30..3a5f06d163 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdDecodeRawTransactionResponse.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdDecodeRawTransactionResponse.java @@ -18,15 +18,17 @@ package bisq.wallets.elementsd.rpc.responses; import bisq.wallets.bitcoind.rpc.responses.AbstractDecodeRawTransactionResponse; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.JsonRpcResponse; +import com.squareup.moshi.Json; import lombok.Getter; import lombok.Setter; -@Getter -@Setter -public class ElementsdDecodeRawTransactionResponse extends AbstractDecodeRawTransactionResponse { - @JsonProperty("wtxid") - private String wTxId; - @JsonProperty("withash") - private String withHash; +public class ElementsdDecodeRawTransactionResponse extends JsonRpcResponse { + @Getter + public static class Result extends AbstractDecodeRawTransactionResponse { + @Json(name = "wtxid") + private String wTxId; + @Json(name = "withash") + private String withHash; + } } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetAddressInfoResponse.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetAddressInfoResponse.java index a79a902120..ee1b615315 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetAddressInfoResponse.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetAddressInfoResponse.java @@ -17,55 +17,56 @@ package bisq.wallets.elementsd.rpc.responses; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.JsonRpcResponse; +import com.squareup.moshi.Json; import lombok.Getter; import lombok.Setter; import java.util.List; -@Getter -@Setter -public class ElementsdGetAddressInfoResponse { - private String address; - private String scriptPubKey; +public class ElementsdGetAddressInfoResponse extends JsonRpcResponse { + @Getter + public static class Result { + private String address; + private String scriptPubKey; - @JsonProperty("ismine") - private boolean isMine; - private boolean solvable; - private String desc; + @Json(name = "ismine") + private boolean isMine; + private boolean solvable; + private String desc; - @JsonProperty("iswatchonly") - private boolean isWatchOnly; - @JsonProperty("isscript") - private boolean isScript; + @Json(name = "iswatchonly") + private boolean isWatchOnly; + @Json(name = "isscript") + private boolean isScript; - @JsonProperty("iswitness") - private boolean isWitness; - @JsonProperty("witness_version") - private int witnessVersion; - @JsonProperty("witness_program") - private String witnessProgram; + @Json(name = "iswitness") + private boolean isWitness; + @Json(name = "witness_version") + private int witnessVersion; + @Json(name = "witness_program") + private String witnessProgram; - @JsonProperty("pubkey") - private String pubKey; - @JsonProperty("confidential") - private String confidential; - @JsonProperty("confidential_key") - private String confidentialKey; - @JsonProperty("unconfidential") - private String unconfidential; + @Json(name = "pubkey") + private String pubKey; + @Json(name = "confidential") + private String confidential; + @Json(name = "confidential_key") + private String confidentialKey; + @Json(name = "unconfidential") + private String unconfidential; - @JsonProperty("ischange") - private boolean isChange; - private long timestamp; + @Json(name = "ischange") + private boolean isChange; + private long timestamp; - @JsonProperty("hdkeypath") - private String hdKeyPath; - @JsonProperty("hdseedid") - private String hdSeedId; - @JsonProperty("hdmasterfingerprint") - private String hdMasterFingerprint; - - private List labels; + @Json(name = "hdkeypath") + private String hdKeyPath; + @Json(name = "hdseedid") + private String hdSeedId; + @Json(name = "hdmasterfingerprint") + private String hdMasterFingerprint; + private List labels; + } } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetBalancesResponse.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetBalancesResponse.java index 8e421f4c6e..a7efab2886 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetBalancesResponse.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetBalancesResponse.java @@ -17,11 +17,12 @@ package bisq.wallets.elementsd.rpc.responses; +import bisq.wallets.json_rpc.JsonRpcResponse; import lombok.Getter; -import lombok.Setter; -@Getter -@Setter -public class ElementsdGetBalancesResponse { - private ElementsdGetMineBalancesResponse mine; +public class ElementsdGetBalancesResponse extends JsonRpcResponse { + @Getter + public static class Result { + private ElementsdGetMineBalances mine; + } } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetMineBalancesResponse.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetMineBalances.java similarity index 84% rename from wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetMineBalancesResponse.java rename to wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetMineBalances.java index aebac6b862..10999b9f37 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetMineBalancesResponse.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetMineBalances.java @@ -17,17 +17,15 @@ package bisq.wallets.elementsd.rpc.responses; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.squareup.moshi.Json; import lombok.Getter; -import lombok.Setter; import java.util.Map; @Getter -@Setter -public class ElementsdGetMineBalancesResponse { +public class ElementsdGetMineBalances { private Map trusted; - @JsonProperty("untrusted_pending") + @Json(name = "untrusted_pending") private Map untrustedPending; private Map immature; } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetPeginAddressResponse.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetPeginAddressResponse.java index d168e6b5b4..42f4e228da 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetPeginAddressResponse.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdGetPeginAddressResponse.java @@ -17,15 +17,17 @@ package bisq.wallets.elementsd.rpc.responses; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.JsonRpcResponse; +import com.squareup.moshi.Json; import lombok.Getter; import lombok.Setter; -@Getter -@Setter -public class ElementsdGetPeginAddressResponse { - @JsonProperty("mainchain_address") - private String mainChainAddress; - @JsonProperty("claim_script") - private String claimScript; +public class ElementsdGetPeginAddressResponse extends JsonRpcResponse { + @Getter + public static class Result { + @Json(name = "mainchain_address") + private String mainChainAddress; + @Json(name = "claim_script") + private String claimScript; + } } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdIssuance.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdIssuance.java index 1012aed7a2..086a4ed5aa 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdIssuance.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdIssuance.java @@ -17,21 +17,24 @@ package bisq.wallets.elementsd.rpc.responses; +import bisq.wallets.json_rpc.JsonRpcResponse; import com.fasterxml.jackson.annotation.JsonProperty; +import com.squareup.moshi.Json; import lombok.Getter; import lombok.Setter; -@Getter -@Setter -public class ElementsdIssuance { - private String assetBlindingNonce; - private String assetEntropy; - @JsonProperty("isreissuance") - private boolean isReissuance; - private String token; - private String asset; - @JsonProperty("assetamount") - private double assetAmount; - @JsonProperty("tokenamountcommitment") - private String tokenAmountCommitment; +public class ElementsdIssuance extends JsonRpcResponse { + @Getter + public static class Result { + private String assetBlindingNonce; + private String assetEntropy; + @Json(name = "isreissuance") + private boolean isReissuance; + private String token; + private String asset; + @Json(name = "assetamount") + private double assetAmount; + @Json(name = "tokenamountcommitment") + private String tokenAmountCommitment; + } } \ No newline at end of file diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdIssueAssetResponse.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdIssueAssetResponse.java index 2b5f536ae8..08fa287a8c 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdIssueAssetResponse.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdIssueAssetResponse.java @@ -17,18 +17,20 @@ package bisq.wallets.elementsd.rpc.responses; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.json_rpc.JsonRpcResponse; +import com.squareup.moshi.Json; import lombok.Getter; import lombok.Setter; -@Getter -@Setter -public class ElementsdIssueAssetResponse { - @JsonProperty("txid") - private String txId; - @JsonProperty("vin") - private String vIn; - private String entropy; - private String asset; - private String token; +public class ElementsdIssueAssetResponse extends JsonRpcResponse { + @Getter + public static class Result { + @Json(name = "txid") + private String txId; + @Json(name = "vin") + private String vIn; + private String entropy; + private String asset; + private String token; + } } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdListTransactionsResponseEntry.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdListTransactionsResponse.java similarity index 62% rename from wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdListTransactionsResponseEntry.java rename to wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdListTransactionsResponse.java index cd0e95ceda..d8c425c156 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdListTransactionsResponseEntry.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdListTransactionsResponse.java @@ -17,17 +17,21 @@ package bisq.wallets.elementsd.rpc.responses; -import bisq.wallets.bitcoind.rpc.responses.BitcoindListTransactionsResponseEntry; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.bitcoind.rpc.responses.BitcoindListTransactionsResponse; +import bisq.wallets.json_rpc.JsonRpcResponse; +import com.squareup.moshi.Json; import lombok.Getter; import lombok.Setter; -@Getter -@Setter -public class ElementsdListTransactionsResponseEntry extends BitcoindListTransactionsResponseEntry { - @JsonProperty("amountblinder") - private String amountBlinder; - private String asset; - @JsonProperty("assetblinder") - private String assetBlinder; +import java.util.List; + +public class ElementsdListTransactionsResponse extends JsonRpcResponse> { + @Getter + public static class Entry extends BitcoindListTransactionsResponse.Entry { + @Json(name = "amountblinder") + private String amountBlinder; + private String asset; + @Json(name = "assetblinder") + private String assetBlinder; + } } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdListUnspentResponseEntry.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdListUnspentResponse.java similarity index 56% rename from wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdListUnspentResponseEntry.java rename to wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdListUnspentResponse.java index 8c615beffe..2a31bbd58d 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdListUnspentResponseEntry.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdListUnspentResponse.java @@ -17,21 +17,25 @@ package bisq.wallets.elementsd.rpc.responses; -import bisq.wallets.bitcoind.rpc.responses.BitcoindListUnspentResponseEntry; -import com.fasterxml.jackson.annotation.JsonProperty; +import bisq.wallets.bitcoind.rpc.responses.BitcoindListUnspentResponse; +import bisq.wallets.json_rpc.JsonRpcResponse; +import com.squareup.moshi.Json; import lombok.Getter; import lombok.Setter; -@Getter -@Setter -public class ElementsdListUnspentResponseEntry extends BitcoindListUnspentResponseEntry { - @JsonProperty("assetcommitment") - private String assetCommitment; - private String asset; - @JsonProperty("amountcommitment") - private String amountCommitment; - @JsonProperty("amountblinder") - private String amountBlinder; - @JsonProperty("assetblinder") - private String assetBlinder; +import java.util.List; + +public class ElementsdListUnspentResponse extends JsonRpcResponse> { + @Getter + public static class Entry extends BitcoindListUnspentResponse.Entry { + @Json(name = "assetcommitment") + private String assetCommitment; + private String asset; + @Json(name = "amountcommitment") + private String amountCommitment; + @Json(name = "amountblinder") + private String amountBlinder; + @Json(name = "assetblinder") + private String assetBlinder; + } } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdUnblindRawTransactionResponse.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdUnblindRawTransactionResponse.java index 05082a262d..6ce4c8216b 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdUnblindRawTransactionResponse.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdUnblindRawTransactionResponse.java @@ -17,11 +17,13 @@ package bisq.wallets.elementsd.rpc.responses; +import bisq.wallets.json_rpc.JsonRpcResponse; import lombok.Getter; import lombok.Setter; -@Getter -@Setter -public class ElementsdUnblindRawTransactionResponse { - private String hex; +public class ElementsdUnblindRawTransactionResponse extends JsonRpcResponse { + @Getter + public static class Result { + private String hex; + } } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdVin.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdVin.java index 9a42553595..eff0528ee7 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdVin.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdVin.java @@ -19,6 +19,7 @@ import bisq.wallets.bitcoind.rpc.responses.AbstractVin; import com.fasterxml.jackson.annotation.JsonProperty; +import com.squareup.moshi.Json; import lombok.Getter; import lombok.Setter; @@ -27,9 +28,9 @@ @Getter @Setter public class ElementsdVin extends AbstractVin { - @JsonProperty("is_pegin") + @Json(name = "is_pegin") private boolean isPegin; - @JsonProperty("pegin_witness") + @Json(name = "pegin_witness") private List peginWitnesses; private ElementsdIssuance issuance; } diff --git a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdVout.java b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdVout.java index 6c506cc958..6dc4b3f3fc 100644 --- a/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdVout.java +++ b/wallets/elementsd/src/main/java/bisq/wallets/elementsd/rpc/responses/ElementsdVout.java @@ -19,6 +19,7 @@ import bisq.wallets.bitcoind.rpc.responses.AbstractVout; import com.fasterxml.jackson.annotation.JsonProperty; +import com.squareup.moshi.Json; import lombok.Getter; import lombok.Setter; @@ -30,25 +31,25 @@ public class ElementsdVout extends AbstractVout { private String asset; - @JsonProperty("value-minimum") + @Json(name = "value-minimum") private double valueMin; - @JsonProperty("value-maximum") + @Json(name = "value-maximum") private double valueMax; - @JsonProperty("ct-exponent") + @Json(name = "ct-exponent") private int ctExponent; - @JsonProperty("ct-bits") + @Json(name = "ct-bits") private int ctBits; - @JsonProperty("surjectionproof") + @Json(name = "surjectionproof") private String surjectionProof; - @JsonProperty("valuecommitment") + @Json(name = "valuecommitment") private String valueCommitment; - @JsonProperty("assetcommitment") + @Json(name = "assetcommitment") private String assetCommitment; - @JsonProperty("commitmentnonce") + @Json(name = "commitmentnonce") private String commitmentNonce; - @JsonProperty("commitmentnonce_fully_valid") + @Json(name = "commitmentnonce_fully_valid") private boolean isCommitmentNonceFullyValid; @Override diff --git a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdConnectionFailureIntegrationTests.java b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdConnectionFailureIntegrationTests.java index 5e7801bb0c..78957c7940 100644 --- a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdConnectionFailureIntegrationTests.java +++ b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdConnectionFailureIntegrationTests.java @@ -18,7 +18,6 @@ package bisq.wallets.elementsd; import bisq.wallets.elementsd.regtest.ElementsdRegtestSetup; -import bisq.wallets.elementsd.rpc.ElementsdWallet; import bisq.wallets.regtest.AbstractRegtestSetup; import bisq.wallets.regtest.ConnectionFailureIntegrationTests; import bisq.wallets.regtest.process.MultiProcessCoordinator; @@ -26,7 +25,7 @@ import java.io.IOException; public class ElementsdConnectionFailureIntegrationTests - extends ConnectionFailureIntegrationTests { + extends ConnectionFailureIntegrationTests { @Override protected AbstractRegtestSetup createRegtestSetup() throws IOException { return new ElementsdRegtestSetup(); diff --git a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdLiquidAssetsIntegrationTests.java b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdLiquidAssetsIntegrationTests.java index 1174ef8024..2acc54dffa 100644 --- a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdLiquidAssetsIntegrationTests.java +++ b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdLiquidAssetsIntegrationTests.java @@ -49,7 +49,7 @@ public void sendOneLiquidAssetToAddress() throws MalformedURLException, Interrup ElementsdIssueAssetResponse issueAssetResponse = elementsdMinerWallet.issueAsset( Optional.of(ElementsdRegtestSetup.WALLET_PASSPHRASE), 2, 1 ); - String assetLabel = issueAssetResponse.getAsset(); + String assetLabel = issueAssetResponse.getResult().getAsset(); var receiverBackend = elementsdRegtestSetup.createNewWallet("receiver_wallet"); diff --git a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdPeginBtcIntegrationTests.java b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdPeginBtcIntegrationTests.java index 0c46f1706f..50aa198f84 100644 --- a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdPeginBtcIntegrationTests.java +++ b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdPeginBtcIntegrationTests.java @@ -37,7 +37,7 @@ void getPeginAddress() { void claimPegin() throws InterruptedException { ElementsdGetPeginAddressResponse peginAddressResponse = elementsdMinerWallet.getPeginAddress(); - String bitcoindTxId = bitcoindRegtestSetup.fundAddress(peginAddressResponse.getMainChainAddress(), 20); + String bitcoindTxId = bitcoindRegtestSetup.fundAddress(peginAddressResponse.getResult().getMainChainAddress(), 20); String rawBitcoindTx = bitcoindDaemon.getRawTransaction(bitcoindTxId); // main chain tx needs 102 confirmations for pegin (fundAddress mines one block automatically) diff --git a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdSendAndListTxsIntegrationTests.java b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdSendAndListTxsIntegrationTests.java index 0c81c2c51e..3ff711cb9e 100644 --- a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdSendAndListTxsIntegrationTests.java +++ b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdSendAndListTxsIntegrationTests.java @@ -19,7 +19,7 @@ import bisq.wallets.core.model.AddressType; import bisq.wallets.elementsd.regtest.ElementsdRegtestSetup; -import bisq.wallets.elementsd.rpc.responses.ElementsdListTransactionsResponseEntry; +import bisq.wallets.elementsd.rpc.responses.ElementsdListTransactionsResponse; import org.junit.jupiter.api.Test; import java.net.MalformedURLException; @@ -45,10 +45,10 @@ public void sendLBtcAndListTxs() throws MalformedURLException, InterruptedExcept elementsdRegtestSetup.mineOneBlock(); - List txs = receiverBackend.listTransactions(10); + List txs = receiverBackend.listTransactions(10); assertEquals(3, txs.size()); - ElementsdListTransactionsResponseEntry firstTx = txs.get(0); + ElementsdListTransactionsResponse.Entry firstTx = txs.get(0); assertEquals(firstTxId, firstTx.getTxId()); assertEquals("receive", firstTx.getCategory()); assertEquals(1, firstTx.getAmount()); @@ -57,7 +57,7 @@ public void sendLBtcAndListTxs() throws MalformedURLException, InterruptedExcept assertEquals(0, firstTx.getWalletconflicts().length); assertEquals("no", firstTx.getBip125Replaceable()); - ElementsdListTransactionsResponseEntry secondTx = txs.get(1); + ElementsdListTransactionsResponse.Entry secondTx = txs.get(1); assertEquals(secondTxId, secondTx.getTxId()); assertEquals("receive", secondTx.getCategory()); assertEquals(1, secondTx.getAmount()); @@ -66,7 +66,7 @@ public void sendLBtcAndListTxs() throws MalformedURLException, InterruptedExcept assertEquals(0, secondTx.getWalletconflicts().length); assertEquals("no", secondTx.getBip125Replaceable()); - ElementsdListTransactionsResponseEntry thirdTx = txs.get(2); + ElementsdListTransactionsResponse.Entry thirdTx = txs.get(2); assertEquals(thirdTxId, thirdTx.getTxId()); assertEquals("receive", thirdTx.getCategory()); assertEquals(1, thirdTx.getAmount()); diff --git a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdSendAndListUnspentIntegrationTests.java b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdSendAndListUnspentIntegrationTests.java index 7bf822e905..d0b49e7eea 100644 --- a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdSendAndListUnspentIntegrationTests.java +++ b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdSendAndListUnspentIntegrationTests.java @@ -17,9 +17,9 @@ package bisq.wallets.elementsd; -import bisq.wallets.bitcoind.rpc.responses.BitcoindListUnspentResponseEntry; +import bisq.wallets.bitcoind.rpc.responses.BitcoindListUnspentResponse; import bisq.wallets.elementsd.rpc.ElementsdWallet; -import bisq.wallets.elementsd.rpc.responses.ElementsdListUnspentResponseEntry; +import bisq.wallets.elementsd.rpc.responses.ElementsdListUnspentResponse; import org.junit.jupiter.api.Test; import java.net.MalformedURLException; @@ -39,14 +39,14 @@ public void listUnspent() throws MalformedURLException, InterruptedException { String secondTxId = elementsdRegtestSetup.sendBtcAndMineOneBlock(elementsdMinerWallet, receiverBackend, 1); String thirdTxId = elementsdRegtestSetup.sendBtcAndMineOneBlock(elementsdMinerWallet, receiverBackend, 1); - List utxos = receiverBackend.listUnspent(); + List utxos = receiverBackend.listUnspent(); assertEquals(3, utxos.size()); - Optional queryResult = elementsdRegtestSetup + Optional queryResult = elementsdRegtestSetup .filterUtxosByTxId(utxos, firstTxId); assertTrue(queryResult.isPresent()); - BitcoindListUnspentResponseEntry firstUtxo = queryResult.get(); + BitcoindListUnspentResponse.Entry firstUtxo = queryResult.get(); assertEquals("", firstUtxo.getLabel()); assertEquals(1, firstUtxo.getAmount()); assertEquals(3, firstUtxo.getConfirmations()); @@ -57,7 +57,7 @@ public void listUnspent() throws MalformedURLException, InterruptedException { queryResult = elementsdRegtestSetup.filterUtxosByTxId(utxos, secondTxId); assertTrue(queryResult.isPresent()); - BitcoindListUnspentResponseEntry secondUtxo = queryResult.get(); + BitcoindListUnspentResponse.Entry secondUtxo = queryResult.get(); assertEquals("", secondUtxo.getLabel()); assertEquals(1, secondUtxo.getAmount()); assertEquals(2, secondUtxo.getConfirmations()); @@ -68,7 +68,7 @@ public void listUnspent() throws MalformedURLException, InterruptedException { queryResult = elementsdRegtestSetup.filterUtxosByTxId(utxos, thirdTxId); assertTrue(queryResult.isPresent()); - BitcoindListUnspentResponseEntry thirdUtxo = queryResult.get(); + BitcoindListUnspentResponse.Entry thirdUtxo = queryResult.get(); assertEquals("", thirdUtxo.getLabel()); assertEquals(1, thirdUtxo.getAmount()); assertEquals(1, thirdUtxo.getConfirmations()); diff --git a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdSendUnconfirmedTxIntegrationTests.java b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdSendUnconfirmedTxIntegrationTests.java index 66c00212e6..22f03590f2 100644 --- a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdSendUnconfirmedTxIntegrationTests.java +++ b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/ElementsdSendUnconfirmedTxIntegrationTests.java @@ -69,6 +69,6 @@ public void sendOneLBtcToAddress() throws MalformedURLException, InterruptedExce private String getUnblindedAddress(ElementsdWallet wallet, String blindedAddress) { ElementsdGetAddressInfoResponse addressInfo = wallet.getAddressInfo(blindedAddress); - return addressInfo.getUnconfidential(); + return addressInfo.getResult().getUnconfidential(); } } diff --git a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/SharedElementsdInstanceTests.java b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/SharedElementsdInstanceTests.java index 8a7c41be11..27f4ef945f 100644 --- a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/SharedElementsdInstanceTests.java +++ b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/SharedElementsdInstanceTests.java @@ -64,7 +64,7 @@ public void start() throws IOException, InterruptedException { protected void peginBtc(double amount) throws InterruptedException { ElementsdGetPeginAddressResponse peginAddressResponse = elementsdMinerWallet.getPeginAddress(); - String bitcoindTxId = bitcoindRegtestSetup.fundAddress(peginAddressResponse.getMainChainAddress(), amount); + String bitcoindTxId = bitcoindRegtestSetup.fundAddress(peginAddressResponse.getResult().getMainChainAddress(), amount); String rawBitcoindTx = bitcoindDaemon.getRawTransaction(bitcoindTxId); // main chain tx needs 102 confirmations for pegin (fundAddress mines one block automatically) diff --git a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/regtest/ElementsdRegtestProcess.java b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/regtest/ElementsdRegtestProcess.java index 5eff73c872..f70fcfcd9c 100644 --- a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/regtest/ElementsdRegtestProcess.java +++ b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/regtest/ElementsdRegtestProcess.java @@ -20,12 +20,12 @@ import bisq.common.util.NetworkUtils; import bisq.wallets.core.RpcConfig; import bisq.wallets.core.exceptions.RpcCallFailureException; -import bisq.wallets.core.rpc.DaemonRpcClient; import bisq.wallets.core.rpc.RpcClientFactory; import bisq.wallets.elementsd.ElementsdConfig; import bisq.wallets.elementsd.rpc.ElementsdDaemon; -import bisq.wallets.regtest.bitcoind.BitcoindRegtestProcess; +import bisq.wallets.json_rpc.JsonRpcClient; import bisq.wallets.process.ProcessConfig; +import bisq.wallets.regtest.bitcoind.BitcoindRegtestProcess; import lombok.extern.slf4j.Slf4j; import java.nio.file.Path; @@ -77,7 +77,7 @@ public ProcessConfig createProcessConfig() { @Override public void invokeStopRpcCall() { try { - DaemonRpcClient rpcClient = RpcClientFactory.createLegacyDaemonRpcClient(rpcConfig); + JsonRpcClient rpcClient = RpcClientFactory.createDaemonRpcClient(rpcConfig); var chainBackend = new ElementsdDaemon(rpcClient); chainBackend.stop(); } catch (RpcCallFailureException e) { diff --git a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/regtest/ElementsdRegtestSetup.java b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/regtest/ElementsdRegtestSetup.java index 48f23be1ce..ae828875bd 100644 --- a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/regtest/ElementsdRegtestSetup.java +++ b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/regtest/ElementsdRegtestSetup.java @@ -25,14 +25,13 @@ import bisq.wallets.bitcoind.zmq.ZmqTopicProcessors; import bisq.wallets.core.RpcConfig; import bisq.wallets.core.model.AddressType; -import bisq.wallets.core.rpc.DaemonRpcClient; import bisq.wallets.core.rpc.RpcClientFactory; -import bisq.wallets.core.rpc.WalletRpcClient; import bisq.wallets.elementsd.ElementsdConfig; import bisq.wallets.elementsd.rpc.ElementsdDaemon; import bisq.wallets.elementsd.rpc.ElementsdRawTxProcessor; import bisq.wallets.elementsd.rpc.ElementsdWallet; -import bisq.wallets.elementsd.rpc.responses.ElementsdListUnspentResponseEntry; +import bisq.wallets.elementsd.rpc.responses.ElementsdListUnspentResponse; +import bisq.wallets.json_rpc.JsonRpcClient; import bisq.wallets.regtest.AbstractRegtestSetup; import bisq.wallets.regtest.bitcoind.BitcoindRegtestSetup; import bisq.wallets.regtest.process.MultiProcessCoordinator; @@ -136,8 +135,8 @@ public ElementsdWallet createNewWallet(String walletName) { return newWallet(walletName); } - public Optional filterUtxosByTxId( - List utxos, + public Optional filterUtxosByTxId( + List utxos, String txId) { return utxos.stream() .filter(u -> Objects.equals(u.getTxId(), txId)) @@ -150,7 +149,7 @@ public Pair initializeZmqListenersForWallet(Element var zmqTopicProcessors = new ZmqTopicProcessors(rawTxProcessor, zmqListeners); var zmqConnection = new ZmqConnection(zmqTopicProcessors, zmqListeners); - List zmqNotifications = daemon.getZmqNotifications(); + List zmqNotifications = daemon.getZmqNotifications(); zmqConnection.initialize(zmqNotifications); return new Pair<>(zmqConnection, zmqListeners); @@ -163,13 +162,13 @@ private ElementsdRegtestProcess createElementsdProcess() { } private ElementsdDaemon createDaemon() { - DaemonRpcClient rpcClient = RpcClientFactory.createLegacyDaemonRpcClient(elementsdConfig.elementsdRpcConfig()); + JsonRpcClient rpcClient = RpcClientFactory.createDaemonRpcClient(elementsdConfig.elementsdRpcConfig()); return new ElementsdDaemon(rpcClient); } private ElementsdWallet newWallet(String walletName) { RpcConfig walletRpcConfig = elementsdConfig.elementsdRpcConfig(); - WalletRpcClient rpcClient = RpcClientFactory.createWalletRpcClient(walletRpcConfig, walletName); + JsonRpcClient rpcClient = RpcClientFactory.createWalletRpcClient(walletRpcConfig, walletName); return new ElementsdWallet(rpcClient); } diff --git a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/zmq/AbstractElementsdZeroMqTests.java b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/zmq/AbstractElementsdZeroMqTests.java index 25d4ebb5aa..5dd9d70322 100644 --- a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/zmq/AbstractElementsdZeroMqTests.java +++ b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/zmq/AbstractElementsdZeroMqTests.java @@ -78,7 +78,7 @@ ZmqConnection createAndInitializeZmqConnection(ElementsdWallet elementsdWallet) var zmqTopicProcessors = new ZmqTopicProcessors(rawTxProcessor, zmqListeners); var zmqConnection = new ZmqConnection(zmqTopicProcessors, zmqListeners); - List zmqNotifications = elementsdDaemon.getZmqNotifications(); + List zmqNotifications = elementsdDaemon.getZmqNotifications(); zmqConnection.initialize(zmqNotifications); return zmqConnection; diff --git a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/zmq/ElementsdZeroMqConnectionInfoFinderIntegrationTests.java b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/zmq/ElementsdZeroMqConnectionInfoFinderIntegrationTests.java index 0c841678c6..6077472c3c 100644 --- a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/zmq/ElementsdZeroMqConnectionInfoFinderIntegrationTests.java +++ b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/zmq/ElementsdZeroMqConnectionInfoFinderIntegrationTests.java @@ -28,7 +28,7 @@ public class ElementsdZeroMqConnectionInfoFinderIntegrationTests extends SharedElementsdInstanceTests { @Test void findConnectionInfo() { - List zmqNotifications = elementsdDaemon.getZmqNotifications(); + List zmqNotifications = elementsdDaemon.getZmqNotifications(); assertThat(zmqNotifications).isNotEmpty(); } } diff --git a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/zmq/ElementsdZeroMqRawTxIntegrationTests.java b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/zmq/ElementsdZeroMqRawTxIntegrationTests.java index 05cc0cf75a..85c4ed884d 100644 --- a/wallets/elementsd/src/test/java/bisq/wallets/elementsd/zmq/ElementsdZeroMqRawTxIntegrationTests.java +++ b/wallets/elementsd/src/test/java/bisq/wallets/elementsd/zmq/ElementsdZeroMqRawTxIntegrationTests.java @@ -37,7 +37,7 @@ void detectReceiverAddress() throws InterruptedException { String blindedReceiverAddress = receiverWallet.getNewAddress(AddressType.BECH32, ""); ElementsdGetAddressInfoResponse addressInfo = receiverWallet.getAddressInfo(blindedReceiverAddress); - String unblindedReceiverAddress = addressInfo.getUnconfidential(); + String unblindedReceiverAddress = addressInfo.getResult().getUnconfidential(); receiverWalletZmqConnection.getListeners().registerTxOutputAddressesListener(outputAddresses -> { if (outputAddresses.contains(unblindedReceiverAddress)) { diff --git a/wallets/json-rpc/src/main/java/bisq/wallets/json_rpc/VoidJsonRpcResponse.java b/wallets/json-rpc/src/main/java/bisq/wallets/json_rpc/VoidJsonRpcResponse.java new file mode 100644 index 0000000000..00cb2a4814 --- /dev/null +++ b/wallets/json-rpc/src/main/java/bisq/wallets/json_rpc/VoidJsonRpcResponse.java @@ -0,0 +1,21 @@ +/* + * This file is part of Bisq. + * + * Bisq is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bisq is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bisq. If not, see . + */ + +package bisq.wallets.json_rpc; + +public class VoidJsonRpcResponse extends JsonRpcResponse { +} diff --git a/wallets/regtest/build.gradle b/wallets/regtest/build.gradle index bda86d6aec..588fa71040 100644 --- a/wallets/regtest/build.gradle +++ b/wallets/regtest/build.gradle @@ -5,6 +5,7 @@ plugins { dependencies { implementation project(':core') implementation project(':bitcoind') + implementation project(':json-rpc') implementation project(':process') api project(':process') diff --git a/wallets/regtest/src/main/java/bisq/wallets/regtest/ConnectionFailureIntegrationTests.java b/wallets/regtest/src/main/java/bisq/wallets/regtest/ConnectionFailureIntegrationTests.java index 05d8485e85..b8515d2114 100644 --- a/wallets/regtest/src/main/java/bisq/wallets/regtest/ConnectionFailureIntegrationTests.java +++ b/wallets/regtest/src/main/java/bisq/wallets/regtest/ConnectionFailureIntegrationTests.java @@ -19,9 +19,9 @@ import bisq.wallets.bitcoind.rpc.BitcoindDaemon; import bisq.wallets.core.RpcConfig; -import bisq.wallets.core.exceptions.InvalidRpcCredentialsException; -import bisq.wallets.core.rpc.DaemonRpcClient; import bisq.wallets.core.rpc.RpcClientFactory; +import bisq.wallets.json_rpc.JsonRpcClient; +import bisq.wallets.json_rpc.exceptions.InvalidRpcCredentialsException; import bisq.wallets.process.BisqProcess; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.AfterAll; @@ -32,7 +32,7 @@ import java.io.IOException; @TestInstance(TestInstance.Lifecycle.PER_CLASS) -public abstract class ConnectionFailureIntegrationTests { +public abstract class ConnectionFailureIntegrationTests { private AbstractRegtestSetup regtestSetup; @@ -50,7 +50,7 @@ void cleanUp() { } @Test - void wrongRpcCredentialsTest() throws IOException { + void wrongRpcCredentialsTest() { RpcConfig validRpcConfig = regtestSetup.getRpcConfig(); RpcConfig wrongRpcConfig = RpcConfig.builder() .hostname(validRpcConfig.getHostname()) @@ -59,7 +59,7 @@ void wrongRpcCredentialsTest() throws IOException { .password("WRONG_PASSWORD") .build(); - DaemonRpcClient rpcClient = RpcClientFactory.createLegacyDaemonRpcClient(wrongRpcConfig); + JsonRpcClient rpcClient = RpcClientFactory.createDaemonRpcClient(wrongRpcConfig); var minerChainBackend = new BitcoindDaemon(rpcClient); Assertions.assertThatExceptionOfType(InvalidRpcCredentialsException.class) diff --git a/wallets/regtest/src/main/java/bisq/wallets/regtest/bitcoind/BitcoindRegtestProcess.java b/wallets/regtest/src/main/java/bisq/wallets/regtest/bitcoind/BitcoindRegtestProcess.java index 6fcb5e926f..20ce510ba7 100644 --- a/wallets/regtest/src/main/java/bisq/wallets/regtest/bitcoind/BitcoindRegtestProcess.java +++ b/wallets/regtest/src/main/java/bisq/wallets/regtest/bitcoind/BitcoindRegtestProcess.java @@ -21,8 +21,8 @@ import bisq.wallets.bitcoind.rpc.BitcoindDaemon; import bisq.wallets.core.RpcConfig; import bisq.wallets.core.exceptions.RpcCallFailureException; -import bisq.wallets.core.rpc.DaemonRpcClient; import bisq.wallets.core.rpc.RpcClientFactory; +import bisq.wallets.json_rpc.JsonRpcClient; import bisq.wallets.process.DaemonProcess; import bisq.wallets.process.ProcessConfig; import bisq.wallets.process.scanner.InputStreamScanner; @@ -89,7 +89,7 @@ protected Set getIsSuccessfulStartUpLogLines() { @Override public void invokeStopRpcCall() { try { - DaemonRpcClient rpcClient = RpcClientFactory.createLegacyDaemonRpcClient(rpcConfig); + JsonRpcClient rpcClient = RpcClientFactory.createDaemonRpcClient(rpcConfig); var chainBackend = new BitcoindDaemon(rpcClient); chainBackend.stop(); } catch (RpcCallFailureException e) { diff --git a/wallets/regtest/src/main/java/bisq/wallets/regtest/bitcoind/BitcoindRegtestSetup.java b/wallets/regtest/src/main/java/bisq/wallets/regtest/bitcoind/BitcoindRegtestSetup.java index 1eab34b27d..a3d1e2d348 100644 --- a/wallets/regtest/src/main/java/bisq/wallets/regtest/bitcoind/BitcoindRegtestSetup.java +++ b/wallets/regtest/src/main/java/bisq/wallets/regtest/bitcoind/BitcoindRegtestSetup.java @@ -20,7 +20,7 @@ import bisq.common.util.NetworkUtils; import bisq.wallets.bitcoind.rpc.BitcoindDaemon; import bisq.wallets.bitcoind.rpc.BitcoindWallet; -import bisq.wallets.bitcoind.rpc.responses.BitcoindListUnspentResponseEntry; +import bisq.wallets.bitcoind.rpc.responses.BitcoindListUnspentResponse; import bisq.wallets.bitcoind.zmq.ZmqListeners; import bisq.wallets.core.RpcConfig; import bisq.wallets.regtest.AbstractRegtestSetup; @@ -81,8 +81,8 @@ public String sendBtcAndMineOneBlock(BitcoindWallet senderWallet, return remoteBitcoind.sendBtcAndMineOneBlock(senderWallet, receiverWallet, amount); } - public Optional filterUtxosByAddress( - List utxos, + public Optional filterUtxosByAddress( + List utxos, String address) { return utxos.stream() .filter(u -> Objects.equals(u.getAddress(), address)) diff --git a/wallets/regtest/src/main/java/bisq/wallets/regtest/bitcoind/RemoteBitcoind.java b/wallets/regtest/src/main/java/bisq/wallets/regtest/bitcoind/RemoteBitcoind.java index 05865c9934..0d95846e1c 100644 --- a/wallets/regtest/src/main/java/bisq/wallets/regtest/bitcoind/RemoteBitcoind.java +++ b/wallets/regtest/src/main/java/bisq/wallets/regtest/bitcoind/RemoteBitcoind.java @@ -26,8 +26,8 @@ import bisq.wallets.bitcoind.zmq.ZmqTopicProcessors; import bisq.wallets.core.RpcConfig; import bisq.wallets.core.model.AddressType; -import bisq.wallets.core.rpc.DaemonRpcClient; import bisq.wallets.core.rpc.RpcClientFactory; +import bisq.wallets.json_rpc.JsonRpcClient; import bisq.wallets.process.BisqProcess; import lombok.Getter; @@ -110,7 +110,7 @@ public CountDownLatch waitUntilBlocksMined(List blockHashes) { } private BitcoindDaemon createBitcoindDaemon() { - DaemonRpcClient rpcClient = RpcClientFactory.createLegacyDaemonRpcClient(rpcConfig); + JsonRpcClient rpcClient = RpcClientFactory.createDaemonRpcClient(rpcConfig); return new BitcoindDaemon(rpcClient); } @@ -119,7 +119,7 @@ private void initializeZmqListeners() { var bitcoindZmqTopicProcessors = new ZmqTopicProcessors(bitcoindRawTxProcessor, zmqListeners); bitcoindZeroMq = new ZmqConnection(bitcoindZmqTopicProcessors, zmqListeners); - List zmqNotifications = daemon.getZmqNotifications(); + List zmqNotifications = daemon.getZmqNotifications(); bitcoindZeroMq.initialize(zmqNotifications); }