diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj
index e5edea3..ed685b1 100644
--- a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj
+++ b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj
@@ -13,7 +13,7 @@
Coinjoin
Allows you to integrate your btcpayserver store with coinjoins.
- 1.0.89
+ 1.0.90
true
diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiCoordinatorClientInstance.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiCoordinatorClientInstance.cs
index 58336b3..3ef3a36 100644
--- a/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiCoordinatorClientInstance.cs
+++ b/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiCoordinatorClientInstance.cs
@@ -132,11 +132,46 @@ public class WabisabiCoordinatorClientInstanceManager:IHostedService
? url
: url + "/";
}
-
+
+ var coordinator = url is null ? null : new Uri(url);
+
+
+ IWasabiHttpClientFactory wasabiHttpClientFactory;
+ if (name == "local" || coordinator is null)
+ {
+ var controller = _provider.GetService();
+ if(controller is null)
+ return;
+ wasabiHttpClientFactory = new LocalWabisabiClientFactory( controller);
+
+ }
+ else if (coordinator.Scheme == "nostr" &&
+ coordinator.AbsolutePath.TrimEnd('/').FromNIP19Note() is NIP19.NosteProfileNote nostrProfileNote)
+ {
+ var socks5HttpClientHandler = _provider.GetRequiredService();
+
+ var factory = new NostrWabisabiClientFactory(socks5HttpClientHandler, nostrProfileNote);
+ wasabiHttpClientFactory = factory;
+ }
+ else
+ {
+ var config = _provider.GetService();
+ var socksEndpoint = config.GetValue("socksendpoint");
+ EndPointParser.TryParse(socksEndpoint, 9050, out var torEndpoint);
+ if (torEndpoint is not null && torEndpoint is DnsEndPoint dnsEndPoint)
+ {
+ torEndpoint = new IPEndPoint(Dns.GetHostAddresses(dnsEndPoint.Host).First(), dnsEndPoint.Port);
+ }
+
+
+ wasabiHttpClientFactory = new WasabiHttpClientFactory(torEndpoint, () => coordinator);
+ }
+
+
var instance = new WabisabiCoordinatorClientInstance(
displayName,
- name, url is null? null: new Uri(url), _provider.GetService(), _provider, UTXOLocker,
- _provider.GetService(), termsConditions, description,_provider.GetRequiredService());
+ name, url is null? null: new Uri(url), wasabiHttpClientFactory,_provider.GetService(), _provider, UTXOLocker,
+ _provider.GetService(), termsConditions, description);
if (HostedServices.TryAdd(instance.CoordinatorName, instance))
{
if(started)
@@ -254,28 +289,22 @@ public class WabisabiCoordinatorClientInstance:IHostedService
public WasabiCoordinatorStatusFetcher WasabiCoordinatorStatusFetcher { get; set; }
public CoinJoinManager CoinJoinManager { get; set; }
public string Description { get; set; }
- private readonly WalletWasabi.Services.HostedServices _hostedServices = new();
+ public readonly WalletWasabi.Services.HostedServices _hostedServices = new();
- public WabisabiCoordinatorClientInstance(string coordinatorDisplayName,
+ public WabisabiCoordinatorClientInstance(
+ string coordinatorDisplayName,
string coordinatorName,
Uri coordinator,
+ IWasabiHttpClientFactory wasabiHttpClientFactory,
ILoggerFactory loggerFactory,
IServiceProvider serviceProvider,
IUTXOLocker utxoLocker,
- WalletProvider walletProvider, string termsConditions, string description,
- Socks5HttpClientHandler socks5HttpClientHandler, string coordinatorIdentifier = "CoinJoinCoordinatorIdentifier"
+ WalletProvider walletProvider, string termsConditions, string description, string coordinatorIdentifier = "CoinJoinCoordinatorIdentifier"
)
{
_utxoLocker = utxoLocker;
- var config = serviceProvider.GetService();
- var socksEndpoint = config.GetValue("socksendpoint");
- EndPointParser.TryParse(socksEndpoint, 9050, out var torEndpoint);
- if (torEndpoint is not null && torEndpoint is DnsEndPoint dnsEndPoint)
- {
- torEndpoint = new IPEndPoint(Dns.GetHostAddresses(dnsEndPoint.Host).First(), dnsEndPoint.Port);
- }
-
+
CoordinatorDisplayName = coordinatorDisplayName;
CoordinatorName = coordinatorName;
Coordinator = coordinator;
@@ -286,25 +315,10 @@ public class WabisabiCoordinatorClientInstance:IHostedService
IWabiSabiApiRequestHandler sharedWabisabiClient = null;
var roundStateUpdaterCircuit = new PersonCircuit();
-
- if (coordinatorName == "local")
- {
- WasabiHttpClientFactory = new LocalWabisabiClientFactory( serviceProvider.GetRequiredService());
-
- }
- else if (coordinator.Scheme == "nostr" &&
- coordinator.AbsolutePath.TrimEnd('/').FromNIP19Note() is NIP19.NosteProfileNote nostrProfileNote)
- {
- var factory = new NostrWabisabiClientFactory(socks5HttpClientHandler, nostrProfileNote);
- WasabiHttpClientFactory = factory;
- _hostedServices.Register(() => factory, "NostrWabisabiClientFactory");
- }
- else
- {
- WasabiHttpClientFactory = new WasabiHttpClientFactory(torEndpoint, () => Coordinator);
-
-
- }
+ WasabiHttpClientFactory = wasabiHttpClientFactory;
+ if(wasabiHttpClientFactory is IHostedService hostedService)
+ _hostedServices.Register(() => hostedService, hostedService.GetType().Name);
+
sharedWabisabiClient =
WasabiHttpClientFactory.NewWabiSabiApiRequestHandler(Mode.SingleCircuitPerLifetime,
diff --git a/submodules/walletwasabi b/submodules/walletwasabi
index 8f2cf48..10b0aab 160000
--- a/submodules/walletwasabi
+++ b/submodules/walletwasabi
@@ -1 +1 @@
-Subproject commit 8f2cf4898446fb93b612fe43c784d56135f74768
+Subproject commit 10b0aab0fe118ace60c07b308d876731f83d148c