Add client side query
MODIFY
WalletWasabi.Backend/Controllers/BatchController.cs
WalletWasabi.Backend/Controllers/BatchController.cs
@@ -34,9 +34,13 @@ namespace WalletWasabi.Backend.Controllers
[HttpGet("synchronize")]
public async Task<IActionResult> GetSynchronizeAsync([FromQuery]string bestKnownBlockHash, [FromQuery]int maxNumberOfFilters, [FromQuery]string estimateSmartFeeMode)
{
- if (string.IsNullOrWhiteSpace(bestKnownBlockHash) || maxNumberOfFilters <= 0)
+ if (string.IsNullOrWhiteSpace(bestKnownBlockHash))
{
- return BadRequest("Invalid block hash or count is provided.");
+ return BadRequest("Invalid block hash is provided.");
+ }
+ if (maxNumberOfFilters <= 0)
+ {
+ return BadRequest("Invalid maxNumberOfFilters is provided.");
}
bool estimateSmartFee = !string.IsNullOrWhiteSpace(estimateSmartFeeMode);

MODIFY
WalletWasabi/WebClients/Wasabi/WasabiClient.cs
WalletWasabi/WebClients/Wasabi/WasabiClient.cs
@@ -10,6 +10,7 @@ using WalletWasabi.Models;
using System.Text;
using System.Threading;
using WalletWasabi.Backend.Models.Responses;
+using NBitcoin.RPC;
namespace WalletWasabi.WebClients.Wasabi
{
@@ -20,6 +21,39 @@ namespace WalletWasabi.WebClients.Wasabi
{
}
+ #region batch
+
+ /// <remarks>
+ /// Throws OperationCancelledException if <paramref name="cancel"/> is set.
+ /// </remarks>
+ public async Task<SynchronizeResponse> GetSynchronizeAsync(uint256 bestKnownBlockHash, int count, EstimateSmartFeeMode? estimateMode = null, CancellationToken cancel = default)
+ {
+ string relativeUri = $"/api/v{Helpers.Constants.BackendMajorVersion}/btc/batch/synchronize?bestKnownBlockHash={bestKnownBlockHash}&maxNumberOfFilters={count}";
+ if (estimateMode != null)
+ {
+ relativeUri = $"{relativeUri}&estimateSmartFeeMode={estimateMode}";
+ }
+
+ using (var response = await TorClient.SendAndRetryAsync(HttpMethod.Get,
+ HttpStatusCode.OK,
+ relativeUri,
+ cancel: cancel))
+ {
+ if (response.StatusCode != HttpStatusCode.OK)
+ {
+ await response.ThrowRequestExceptionFromContentAsync();
+ }
+
+ using (HttpContent content = response.Content)
+ {
+ var ret = await content.ReadAsJsonAsync<SynchronizeResponse>();
+ return ret;
+ }
+ }
+ }
+
+ #endregion batch
+
#region blockchain
/// <remarks>

Add client side query