@if (DestinationBalance is not null) {

Destination Pending Balances

These are the current balances of destinations. Once the threshold is reached for a destination, a payout is generated of that amount (minus the reserve fee amount to cover potential costs).

@foreach (var (dest, balance) in DestinationBalance) { }
Destination Sats Actions
@dest @(balance / 1000m) @if (UpdatingDestination == dest) { } else { }
} @if (PendingPayouts is not null) {

Pending Payouts

These payouts were generated by Prism after a threshold for a destination was reached. If these payouts are cancelled, the original destination will be credited back the payout amount. If a payout completes, we attempt to get the actual fee spent to adjust the destination balance accordingly.

@foreach (var (payoutId, pendingPayout) in PendingPayouts) { }
Payout Id Destination Reserve fee Amount Actions
@payoutId @pendingPayout.DestinationId @pendingPayout.FeeCharged @pendingPayout.PayoutAmount
}
@code { private string? UpdatingDestination { get; set; } private long? UpdatingValue { get; set; } [Parameter] public Dictionary DestinationBalance { get; set; } [Parameter] public Dictionary PendingPayouts { get; set; } [Parameter] public EventCallback<(string destination, long newBalance)> OnUpdate { get; set; } private bool IsActionOngoing { get; set; } [Parameter] public EventCallback<(string payoutId, TaskCompletionSource tcs)> OnCancelPayout { get; set; } private EventCallback StartUpdate(string dest, long balance) { UpdatingDestination = dest; UpdatingValue = Convert.ToInt32(balance / 1000m); return EventCallback.Empty; } private async Task Update() { if (UpdatingDestination is null || UpdatingValue is null) { return; } await OnUpdate.InvokeAsync((UpdatingDestination, Convert.ToInt64(UpdatingValue.Value * 1000m))); UpdatingDestination = null; } private async Task CancelPayout(string payoutId) { UpdatingDestination = null; IsActionOngoing = true; try { var tcs = new TaskCompletionSource(); await OnCancelPayout.InvokeAsync((payoutId, tcs)); await tcs.Task; } finally { IsActionOngoing = false; } } }