From cfc1c20a2e2862b4687a4528a41d0b00822fd1d6 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 21 Feb 2020 21:57:17 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../com/tangem/data/network/AdaliteApi.java | 2 +- .../tangem/data/network/ServerApiAdalite.java | 12 ++++---- .../tangem/wallet/cardano/CardanoEngine.java | 29 ++++++------------- 3 files changed, 16 insertions(+), 27 deletions(-) diff --git a/app/src/main/java/com/tangem/data/network/AdaliteApi.java b/app/src/main/java/com/tangem/data/network/AdaliteApi.java index 8af94a92c5..3a6b380945 100644 --- a/app/src/main/java/com/tangem/data/network/AdaliteApi.java +++ b/app/src/main/java/com/tangem/data/network/AdaliteApi.java @@ -26,5 +26,5 @@ public interface AdaliteApi { @Headers("Content-Type: application/json") @POST(ServerApiAdalite.ADALITE_SEND) - Call adaliteSend(@Body AdaliteBody adaliteBody); + Call adaliteSend(@Body AdaliteBody adaliteBody); } diff --git a/app/src/main/java/com/tangem/data/network/ServerApiAdalite.java b/app/src/main/java/com/tangem/data/network/ServerApiAdalite.java index 0e51596e15..7dab3374a2 100644 --- a/app/src/main/java/com/tangem/data/network/ServerApiAdalite.java +++ b/app/src/main/java/com/tangem/data/network/ServerApiAdalite.java @@ -27,7 +27,7 @@ public class ServerApiAdalite { private int requestsCount = 0; - private final String adaliteURL1 = "https://explorer2.adalite.io"; //TODO: make random selection, add more?, move + private final String adaliteURL1 = "https://explorer3.adalite.io"; //TODO: make random selection, add more?, move private final String adaliteURL2 = "https://nodes.southeastasia.cloudapp.azure.com"; private String currentURL = adaliteURL1; @@ -48,7 +48,7 @@ public class ServerApiAdalite { void onSuccess(String method, AdaliteResponseUtxo adaliteResponseUtxo); - void onSuccess(String method, List listResponse); + void onSuccess(String method, String stringResponse); void onFail(String method, String message); } @@ -145,10 +145,10 @@ public class ServerApiAdalite { break; case ADALITE_SEND: - Call sendCall = adaliteApi.adaliteSend(new AdaliteBody(tx)); - sendCall.enqueue(new Callback() { + Call sendCall = adaliteApi.adaliteSend(new AdaliteBody(tx)); + sendCall.enqueue(new Callback() { @Override - public void onResponse(@NonNull Call call, @NonNull Response response) { + public void onResponse(@NonNull Call call, @NonNull Response response) { requestsCount--; if (response.code() == 200) { @@ -166,7 +166,7 @@ public class ServerApiAdalite { } @Override - public void onFailure(@NonNull Call call, @NonNull Throwable t) { + public void onFailure(@NonNull Call call, @NonNull Throwable t) { Log.e(TAG, "requestData " + method + " onFailure " + t.getMessage()); requestsCount--; diff --git a/app/src/main/java/com/tangem/wallet/cardano/CardanoEngine.java b/app/src/main/java/com/tangem/wallet/cardano/CardanoEngine.java index e51226a99b..1614b760ca 100644 --- a/app/src/main/java/com/tangem/wallet/cardano/CardanoEngine.java +++ b/app/src/main/java/com/tangem/wallet/cardano/CardanoEngine.java @@ -671,7 +671,7 @@ public class CardanoEngine extends CoinEngine { } @Override - public void onSuccess(String method, List listResponse) { + public void onSuccess(String method, String stringResponse) { Log.e(TAG, "Wrong response type for requestBalanceAndUnspentTransactions"); ctx.setError("Wrong response type for requestBalanceAndUnspentTransactions"); blockchainRequestsCallbacks.onComplete(false); @@ -731,30 +731,19 @@ public class CardanoEngine extends CoinEngine { } @Override - public void onSuccess(String method, List listResponse) { + public void onSuccess(String method, String stringResponse) { if (method.equals(ServerApiAdalite.ADALITE_SEND)) { - String resultString = listResponse.toString(); - try { - if (resultString.isEmpty()) { - ctx.setError("No response from node"); - blockchainRequestsCallbacks.onComplete(false); - } else { // TODO: Make check for a valid send response - ctx.setError(null); - blockchainRequestsCallbacks.onComplete(true); - } - } catch (Exception e) { - if (e.getMessage() != null) { - ctx.setError(e.getMessage()); - blockchainRequestsCallbacks.onComplete(false); - } else { - ctx.setError(e.getClass().getName()); - blockchainRequestsCallbacks.onComplete(false); - Log.e(TAG, resultString); - } + if (stringResponse.equals("\"Transaction sent successfully!\"")) { + ctx.setError(null); + blockchainRequestsCallbacks.onComplete(true); + } else { // TODO: Make check for a valid send response + ctx.setError(stringResponse); + blockchainRequestsCallbacks.onComplete(false); } } } + @Override public void onFail(String method, String message) { Log.e(TAG, "onFail: " + method + " " + message);