mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2026-01-31 13:34:52 +01:00
upd
This commit is contained in:
@@ -217,24 +217,15 @@ public class WabisabiCoordinatorService : PeriodicRunner
|
||||
{
|
||||
var network = _clientProvider.GetExplorerClient("BTC").Network.NBitcoinNetwork;
|
||||
var s = await GetSettings();
|
||||
|
||||
if (s.Enabled && !string.IsNullOrEmpty(s.NostrIdentity) && s.NostrRelay is not null &&
|
||||
s.UriToAdvertise is not null)
|
||||
{
|
||||
ECPrivKey key;
|
||||
try
|
||||
{
|
||||
key = NostrExtensions.ParseKey(s.NostrIdentity);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s.NostrIdentity = null;
|
||||
await UpdateSettings(s);
|
||||
throw;
|
||||
}
|
||||
var k = s.GetKey();
|
||||
await Nostr.Publish(s.NostrRelay,
|
||||
new[]
|
||||
{
|
||||
await Nostr.CreateCoordinatorDiscoveryEvent(network, key, s.UriToAdvertise,
|
||||
await Nostr.CreateCoordinatorDiscoveryEvent(network, k, s.UriToAdvertise,
|
||||
s.CoordinatorDescription)
|
||||
},s.UriToAdvertise.IsOnion()? _socks5HttpClientHandler: null, cancel);
|
||||
}
|
||||
|
||||
@@ -14,9 +14,14 @@ public class WabisabiCoordinatorSettings
|
||||
public Uri NostrRelay { get; set; } = new Uri("wss://kukks.org/nostr");
|
||||
|
||||
public List<DiscoveredCoordinator> DiscoveredCoordinators { get; set; } = new();
|
||||
|
||||
[JsonIgnore] public ECPrivKey? Key => string.IsNullOrEmpty(NostrIdentity)? null: NostrExtensions.ParseKey(NostrIdentity);
|
||||
[JsonIgnore] public ECXOnlyPubKey PubKey => Key?.CreatePubKey().ToXOnlyPubKey();
|
||||
|
||||
|
||||
public ECPrivKey GetKey()
|
||||
{
|
||||
return string.IsNullOrEmpty(NostrIdentity) ? null : NostrExtensions.ParseKey(NostrIdentity);
|
||||
}
|
||||
|
||||
public ECXOnlyPubKey GetPubKey() => GetKey()?.CreatePubKey().ToXOnlyPubKey();
|
||||
public Uri UriToAdvertise { get; set; }
|
||||
public string TermsConditions { get; set; } = @"
|
||||
These terms and conditions govern your use of the Coinjoin Coordinator service. By using the service, you agree to be bound by these terms and conditions. If you do not agree to these terms and conditions, you should not use the service.
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace BTCPayServer.Plugins.Wabisabi
|
||||
var result = await Nostr.Discover(
|
||||
_socks5HttpClientHandler, relayUri,
|
||||
network,
|
||||
coordSettings.Key?.CreateXOnlyPubKey().ToHex(), CancellationToken.None);
|
||||
coordSettings.GetPubKey()?.ToHex(), CancellationToken.None);
|
||||
if(result.Any())
|
||||
TempData["DiscoveredCoordinators"] = JsonConvert.SerializeObject(result);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user