Add Human readable round information API
MODIFY
WalletWasabi.Backend/Controllers/WabiSabiController.cs
WalletWasabi.Backend/Controllers/WabiSabiController.cs
+using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
@@ -77,4 +78,23 @@ public class WabiSabiController : ControllerBase, IWabiSabiApiRequestHandler
{
await Arena.ReadyToSignAsync(request, cancellableToken);
}
+
+ /// <summary>
+ /// Information about the current Rounds designed for the human eyes.
+ /// </summary>
+ [HttpGet("human-monitor")]
+ public HumanMonitorResponse GetHumanMonitor()
+ {
+ var response = Arena.Rounds
+ .Where(r => r.Phase is not Phase.Ended)
+ .Select(r =>
+ new HumanMonitorRoundResponse(
+ RoundId: r.Id,
+ IsBlameRound: r is BlameRound,
+ InputCount: r.InputCount,
+ MaxSuggestedAmount: r.Parameters.MaxSuggestedAmount.ToDecimal(NBitcoin.MoneyUnit.BTC),
+ InputRegistrationRemaining: r.InputRegistrationTimeFrame.EndTime - DateTimeOffset.UtcNow));
+
+ return new HumanMonitorResponse(response.ToArray());
+ }
}

ADD
WalletWasabi/WabiSabi/Models/HumanMonitorResponse.cs
+namespace WalletWasabi.WabiSabi.Models;
+
+public record HumanMonitorResponse(HumanMonitorRoundResponse[] RoundStates);

ADD
WalletWasabi/WabiSabi/Models/HumanMonitorRoundResponse.cs
+using NBitcoin;
+
+public record HumanMonitorRoundResponse(
+ uint256 RoundId,
+ bool IsBlameRound,
+ int InputCount,
+ decimal MaxSuggestedAmount,
+ TimeSpan InputRegistrationRemaining);

Add Human readable round information API