diff --git a/src/main/java/com/sparrowwallet/sparrow/control/PayNymAvatar.java b/src/main/java/com/sparrowwallet/sparrow/control/PayNymAvatar.java index bcb1edec..12910a1a 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/PayNymAvatar.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/PayNymAvatar.java @@ -121,6 +121,10 @@ public class PayNymAvatar extends StackPane { Proxy proxy = AppServices.getProxy(); String url = PayNymService.getHostUrl(proxy != null) + "/" + paymentCodeStr + "/avatar"; + if(log.isDebugEnabled()) { + log.debug("Requesting PayNym avatar from " + url); + } + try(InputStream is = (proxy == null ? new URL(url).openStream() : new URL(url).openConnection(proxy).getInputStream())) { Image image = new Image(is, 150, 150, true, false); paymentCodeCache.put(cacheId, image); diff --git a/src/main/java/com/sparrowwallet/sparrow/net/Auth47.java b/src/main/java/com/sparrowwallet/sparrow/net/Auth47.java index 1b4cdd4b..aae2c647 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/Auth47.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/Auth47.java @@ -123,8 +123,8 @@ public class Auth47 { } private void send(String json) throws IOException, Auth47Exception { - if(log.isDebugEnabled()) { - log.debug("Sending " + json + " to " + callback); + if(log.isInfoEnabled()) { + log.info("Sending auth47 response " + json + " to " + callback); } Proxy proxy = AppServices.getProxy(); diff --git a/src/main/java/com/sparrowwallet/sparrow/net/BroadcastSource.java b/src/main/java/com/sparrowwallet/sparrow/net/BroadcastSource.java index 0c6a9c8f..a1dcfa0e 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/BroadcastSource.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/BroadcastSource.java @@ -146,6 +146,10 @@ public enum BroadcastSource { try { URL url = getURL(proxy); + if(log.isInfoEnabled()) { + log.info("Broadcasting transaction to " + url); + } + HttpURLConnection connection = proxy == null ? (HttpURLConnection)url.openConnection() : (HttpURLConnection)url.openConnection(proxy); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "text/plain"); diff --git a/src/main/java/com/sparrowwallet/sparrow/net/ExchangeSource.java b/src/main/java/com/sparrowwallet/sparrow/net/ExchangeSource.java index b1096e9d..437f59e6 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/ExchangeSource.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/ExchangeSource.java @@ -52,6 +52,10 @@ public enum ExchangeSource { String url = "https://api.coinbase.com/v2/exchange-rates?currency=BTC"; Proxy proxy = AppServices.getProxy(); + if(log.isInfoEnabled()) { + log.info("Requesting exchange rates from " + url); + } + try(InputStream is = (proxy == null ? new URL(url).openStream() : new URL(url).openConnection(proxy).getInputStream()); Reader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) { Gson gson = new Gson(); return gson.fromJson(reader, CoinbaseRates.class); @@ -87,6 +91,10 @@ public enum ExchangeSource { String url = "https://api.coingecko.com/api/v3/exchange_rates"; Proxy proxy = AppServices.getProxy(); + if(log.isInfoEnabled()) { + log.info("Requesting exchange rates from " + url); + } + try(InputStream is = (proxy == null ? new URL(url).openStream() : new URL(url).openConnection(proxy).getInputStream()); Reader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) { Gson gson = new Gson(); return gson.fromJson(reader, CoinGeckoRates.class); diff --git a/src/main/java/com/sparrowwallet/sparrow/net/FeeRatesSource.java b/src/main/java/com/sparrowwallet/sparrow/net/FeeRatesSource.java index 34548951..a4be28d4 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/FeeRatesSource.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/FeeRatesSource.java @@ -68,6 +68,10 @@ public enum FeeRatesSource { private static Map getThreeTierFeeRates(Map defaultblockTargetFeeRates, String url) { Proxy proxy = AppServices.getProxy(); + if(log.isInfoEnabled()) { + log.info("Requesting fee rates from " + url); + } + Map blockTargetFeeRates = new LinkedHashMap<>(); try(InputStream is = (proxy == null ? new URL(url).openStream() : new URL(url).openConnection(proxy).getInputStream()); Reader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) { Gson gson = new Gson(); diff --git a/src/main/java/com/sparrowwallet/sparrow/net/LnurlAuth.java b/src/main/java/com/sparrowwallet/sparrow/net/LnurlAuth.java index 3fcb493e..faa08f6c 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/LnurlAuth.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/LnurlAuth.java @@ -103,6 +103,10 @@ public class LnurlAuth { public void sendResponse(Wallet wallet) throws LnurlAuthException, IOException { URL callback = getReturnURL(wallet); + if(log.isInfoEnabled()) { + log.info("Sending LNURL-auth response to " + callback); + } + Proxy proxy = AppServices.getProxy(); if(proxy == null && callback.getHost().toLowerCase(Locale.ROOT).endsWith(TorService.TOR_ADDRESS_SUFFIX)) { throw new LnurlAuthException("A Tor proxy must be configured to authenticate this resource."); diff --git a/src/main/java/com/sparrowwallet/sparrow/net/VersionCheckService.java b/src/main/java/com/sparrowwallet/sparrow/net/VersionCheckService.java index c7ab16c6..c5f545c7 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/VersionCheckService.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/VersionCheckService.java @@ -47,6 +47,11 @@ public class VersionCheckService extends ScheduledService { private VersionCheck getVersionCheck() throws IOException { URL url = new URL(VERSION_CHECK_URL); Proxy proxy = AppServices.getProxy(); + + if(log.isInfoEnabled()) { + log.info("Requesting application version check from " + url); + } + HttpsURLConnection conn = (HttpsURLConnection)(proxy == null ? url.openConnection() : url.openConnection(proxy)); try(InputStreamReader reader = new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)) { diff --git a/src/main/java/com/sparrowwallet/sparrow/paynym/PayNymService.java b/src/main/java/com/sparrowwallet/sparrow/paynym/PayNymService.java index 9a39ba0c..447ce041 100644 --- a/src/main/java/com/sparrowwallet/sparrow/paynym/PayNymService.java +++ b/src/main/java/com/sparrowwallet/sparrow/paynym/PayNymService.java @@ -51,8 +51,13 @@ public class PayNymService { HashMap body = new HashMap<>(); body.put("code", paymentCode.toString()); + String url = getHostUrl() + "/api/v1/create"; + if(log.isInfoEnabled()) { + log.info("Creating PayNym using " + url); + } + IHttpClient httpClient = httpClientService.getHttpClient(HttpUsage.COORDINATOR_REST); - return httpClient.postJson(getHostUrl() + "/api/v1/create", Map.class, headers, body) + return httpClient.postJson(url, Map.class, headers, body) .subscribeOn(Schedulers.io()) .observeOn(JavaFxScheduler.platform()) .map(Optional::get); @@ -69,8 +74,13 @@ public class PayNymService { HashMap body = new HashMap<>(); body.put("code", paymentCode.toString()); + String url = getHostUrl() + "/api/v1/token"; + if(log.isInfoEnabled()) { + log.info("Updating PayNym token using " + url); + } + IHttpClient httpClient = httpClientService.getHttpClient(HttpUsage.COORDINATOR_REST); - return httpClient.postJson(getHostUrl() + "/api/v1/token", Map.class, headers, body) + return httpClient.postJson(url, Map.class, headers, body) .subscribeOn(Schedulers.io()) .observeOn(JavaFxScheduler.platform()) .map(Optional::get); @@ -114,8 +124,13 @@ public class PayNymService { HashMap body = new HashMap<>(); body.put("signature", signature); + String url = getHostUrl() + "/api/v1/claim"; + if(log.isInfoEnabled()) { + log.info("Claiming PayNym using " + url); + } + IHttpClient httpClient = httpClientService.getHttpClient(HttpUsage.COORDINATOR_REST); - return httpClient.postJson(getHostUrl() + "/api/v1/claim", Map.class, headers, body) + return httpClient.postJson(url, Map.class, headers, body) .subscribeOn(Schedulers.io()) .observeOn(JavaFxScheduler.platform()) .map(Optional::get); @@ -139,8 +154,13 @@ public class PayNymService { body.put("code", strPaymentCode); body.put("signature", signature); + String url = getHostUrl() + "/api/v1/nym/add"; + if(log.isInfoEnabled()) { + log.info("Adding payment code to PayNym using " + url); + } + IHttpClient httpClient = httpClientService.getHttpClient(HttpUsage.COORDINATOR_REST); - return httpClient.postJson(getHostUrl() + "/api/v1/nym/add", Map.class, headers, body) + return httpClient.postJson(url, Map.class, headers, body) .subscribeOn(Schedulers.io()) .observeOn(JavaFxScheduler.platform()) .map(Optional::get); @@ -159,8 +179,13 @@ public class PayNymService { body.put("signature", signature); body.put("target", paymentCode.toString()); + String url = getHostUrl() + "/api/v1/follow"; + if(log.isInfoEnabled()) { + log.info("Following payment code using " + url); + } + IHttpClient httpClient = httpClientService.getHttpClient(HttpUsage.COORDINATOR_REST); - return httpClient.postJson(getHostUrl() + "/api/v1/follow", Map.class, headers, body) + return httpClient.postJson(url, Map.class, headers, body) .subscribeOn(Schedulers.io()) .observeOn(JavaFxScheduler.platform()) .map(Optional::get); @@ -173,8 +198,13 @@ public class PayNymService { HashMap body = new HashMap<>(); body.put("nym", nymIdentifier); + String url = getHostUrl() + "/api/v1/nym"; + if(log.isInfoEnabled()) { + log.info("Fetching PayNym using " + url); + } + IHttpClient httpClient = httpClientService.getHttpClient(HttpUsage.COORDINATOR_REST); - return httpClient.postJson(getHostUrl() + "/api/v1/nym", Map.class, headers, body) + return httpClient.postJson(url, Map.class, headers, body) .subscribeOn(Schedulers.io()) .observeOn(JavaFxScheduler.platform()) .map(Optional::get);