mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-17 07:34:24 +01:00
update discovery
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<PropertyGroup>
|
||||
<Product>Wabisabi Coinjoin</Product>
|
||||
<Description>Allows you to integrate your btcpayserver store with coinjoins.</Description>
|
||||
<Version>1.0.39</Version>
|
||||
<Version>1.0.40</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Plugin development properties -->
|
||||
|
||||
@@ -179,7 +179,7 @@ public class WabisabiCoordinatorService : PeriodicRunner
|
||||
{
|
||||
foreach (var discoveredCoordinator in settings.DiscoveredCoordinators)
|
||||
{
|
||||
_instanceManager.AddCoordinator(discoveredCoordinator.Name, discoveredCoordinator.Name, _ => discoveredCoordinator.Uri );
|
||||
_instanceManager.AddCoordinator(discoveredCoordinator.Name, discoveredCoordinator.Name, _ => discoveredCoordinator.Uri, null, discoveredCoordinator.Description );
|
||||
}
|
||||
}
|
||||
if (settings.Enabled)
|
||||
@@ -197,7 +197,7 @@ public class WabisabiCoordinatorService : PeriodicRunner
|
||||
{
|
||||
instance.WasabiCoordinatorStatusFetcher.OverrideConnected = null;
|
||||
}
|
||||
_instanceManager.AddCoordinator("Local Coordinator", "local", _ => null, cachedSettings.TermsConditions);
|
||||
_instanceManager.AddCoordinator("Local Coordinator", "local", _ => null, cachedSettings.TermsConditions, cachedSettings.CoordinatorDescription);
|
||||
}
|
||||
|
||||
public async Task StopAsync(CancellationToken cancellationToken)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
</div>
|
||||
|
||||
<span class="text-muted">@Model.Uri</span>
|
||||
<p>@Model.Description</p>
|
||||
</div>
|
||||
<div class="form-group form-check">
|
||||
<button name="command" type="submit" class="btn btn-primary btn-lg">Add</button>
|
||||
|
||||
@@ -217,18 +217,12 @@
|
||||
|
||||
<span class="text-muted">@coordinator.Coordinator</span>
|
||||
<div>
|
||||
@if (!coordinator.WasabiCoordinatorStatusFetcher.Connected)
|
||||
{
|
||||
<p>Coordinator Status: Not connected</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>
|
||||
Coordinator Status: Connected
|
||||
<div>@(coordinator.WasabiCoordinatorStatusFetcher.Connected? "Coordinator Status: Not connected": "Coordinator Status: Connected")</div>
|
||||
|
||||
</p>
|
||||
@if (!string.IsNullOrEmpty(coordinator.Description))
|
||||
{
|
||||
<p class="text-muted">@coordinator.Description</p>
|
||||
}
|
||||
|
||||
@if (coordinator.RoundStateUpdater.AnyRound && coordinator.RoundStateUpdater.RoundStates.Any(pair => pair.Value.BlameOf == uint256.Zero))
|
||||
{
|
||||
var round = coordinator.RoundStateUpdater.RoundStates.Last(pair => pair.Value.BlameOf == uint256.Zero).Value;
|
||||
@@ -309,6 +303,7 @@
|
||||
By enabling this coordinator, you agree to their terms and conditions.
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@{
|
||||
var canEnable = coordinator.WasabiCoordinatorStatusFetcher.Connected && coordinator.RoundStateUpdater.AnyRound;
|
||||
|
||||
@@ -18,6 +18,7 @@ using WalletWasabi.WabiSabi.Client;
|
||||
using WalletWasabi.WabiSabi.Client.RoundStateAwaiters;
|
||||
using WalletWasabi.WabiSabi.Client.StatusChangedEvents;
|
||||
using WalletWasabi.Wallets;
|
||||
using WalletWasabi.WebClients.Wasabi;
|
||||
using HttpClientFactory = WalletWasabi.WebClients.Wasabi.HttpClientFactory;
|
||||
|
||||
namespace BTCPayServer.Plugins.Wabisabi;
|
||||
@@ -78,7 +79,7 @@ public class WabisabiCoordinatorClientInstanceManager:IHostedService
|
||||
|
||||
|
||||
public void AddCoordinator(string displayName, string name,
|
||||
Func<IServiceProvider, Uri> fetcher, string termsConditions = null)
|
||||
Func<IServiceProvider, Uri> fetcher, string termsConditions = null, string description = null)
|
||||
{
|
||||
if (termsConditions is null && name == "zksnacks")
|
||||
{
|
||||
@@ -98,7 +99,7 @@ public class WabisabiCoordinatorClientInstanceManager:IHostedService
|
||||
var instance = new WabisabiCoordinatorClientInstance(
|
||||
displayName,
|
||||
name, new Uri(url), _provider.GetService<ILoggerFactory>(), _provider, UTXOLocker,
|
||||
_provider.GetService<WalletProvider>(), termsConditions);
|
||||
_provider.GetService<WalletProvider>(), termsConditions, description);
|
||||
if (HostedServices.TryAdd(instance.CoordinatorName, instance))
|
||||
{
|
||||
if(started)
|
||||
@@ -131,6 +132,7 @@ public class WabisabiCoordinatorClientInstance
|
||||
public RoundStateUpdater RoundStateUpdater { get; set; }
|
||||
public WasabiCoordinatorStatusFetcher WasabiCoordinatorStatusFetcher { get; set; }
|
||||
public CoinJoinManager CoinJoinManager { get; set; }
|
||||
public string Description { get; set; }
|
||||
|
||||
public WabisabiCoordinatorClientInstance(string coordinatorDisplayName,
|
||||
string coordinatorName,
|
||||
@@ -138,7 +140,7 @@ public class WabisabiCoordinatorClientInstance
|
||||
ILoggerFactory loggerFactory,
|
||||
IServiceProvider serviceProvider,
|
||||
IUTXOLocker utxoLocker,
|
||||
WalletProvider walletProvider, string termsConditions, string coordinatorIdentifier = "CoinJoinCoordinatorIdentifier")
|
||||
WalletProvider walletProvider, string termsConditions, string description,string coordinatorIdentifier = "CoinJoinCoordinatorIdentifier")
|
||||
{
|
||||
|
||||
_utxoLocker = utxoLocker;
|
||||
@@ -154,6 +156,7 @@ public class WabisabiCoordinatorClientInstance
|
||||
Coordinator = coordinator;
|
||||
WalletProvider = walletProvider;
|
||||
TermsConditions = termsConditions;
|
||||
Description = description;
|
||||
_logger = loggerFactory.CreateLogger(coordinatorName);
|
||||
IWabiSabiApiRequestHandler sharedWabisabiClient;
|
||||
if (coordinatorName == "local")
|
||||
@@ -167,6 +170,18 @@ public class WabisabiCoordinatorClientInstance
|
||||
var roundStateUpdaterCircuit = new PersonCircuit();
|
||||
var roundStateUpdaterHttpClient =
|
||||
WasabiHttpClientFactory.NewHttpClient(Mode.SingleCircuitPerLifetime, roundStateUpdaterCircuit);
|
||||
if (termsConditions is null)
|
||||
{
|
||||
_ = new WasabiClient(roundStateUpdaterHttpClient)
|
||||
.GetLegalDocumentsAsync(CancellationToken.None)
|
||||
.ContinueWith(task =>
|
||||
{
|
||||
if (task.Status == TaskStatus.RanToCompletion)
|
||||
{
|
||||
TermsConditions = task.Result;
|
||||
}
|
||||
});
|
||||
}
|
||||
sharedWabisabiClient = new WabiSabiHttpApiClient(roundStateUpdaterHttpClient);
|
||||
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ namespace BTCPayServer.Plugins.Wabisabi
|
||||
{
|
||||
coordSettings.DiscoveredCoordinators.Add(viewModel);
|
||||
await _wabisabiCoordinatorService.UpdateSettings(coordSettings);
|
||||
_instanceManager.AddCoordinator(viewModel.Name, viewModel.Name, provider => viewModel.Uri);
|
||||
_instanceManager.AddCoordinator(viewModel.Name, viewModel.Name, provider => viewModel.Uri, viewModel.Description);
|
||||
|
||||
TempData["SuccessMessage"] = $"Coordinator {viewModel.Name } added and started";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user