mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-17 07:34:24 +01:00
upd wabi
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
<ProjectReference Include="..\..\submodules\btcpayserver\BTCPayServer\BTCPayServer.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NNostr.Client" Version="0.0.28" />
|
||||
<PackageReference Include="NNostr.Client" Version="0.0.33" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources" />
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<PropertyGroup>
|
||||
<Product>Wabisabi Coinjoin</Product>
|
||||
<Description>Allows you to integrate your btcpayserver store with coinjoins.</Description>
|
||||
<Version>1.0.50</Version>
|
||||
<Version>1.0.51</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Plugin development properties -->
|
||||
|
||||
@@ -16,8 +16,10 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
using NBitcoin;
|
||||
using NBitcoin.RPC;
|
||||
using NBitcoin.Secp256k1;
|
||||
using NBXplorer;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NNostr.Client;
|
||||
using WalletWasabi.Bases;
|
||||
using WalletWasabi.BitcoinCore.Rpc;
|
||||
using WalletWasabi.Cache;
|
||||
@@ -95,9 +97,10 @@ public class WabisabiCoordinatorService : PeriodicRunner
|
||||
instance.TermsConditions = wabisabiCoordinatorSettings.TermsConditions;
|
||||
}
|
||||
|
||||
_ = ActionAsync(CancellationToken.None);
|
||||
|
||||
await _settingsRepository.UpdateSetting(wabisabiCoordinatorSettings, nameof(WabisabiCoordinatorSettings));
|
||||
|
||||
TriggerRound();
|
||||
}
|
||||
|
||||
public class BtcPayRpcClient : CachedRpcClient
|
||||
@@ -217,10 +220,21 @@ public class WabisabiCoordinatorService : PeriodicRunner
|
||||
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;
|
||||
}
|
||||
await Nostr.Publish(s.NostrRelay,
|
||||
new[]
|
||||
{
|
||||
await Nostr.CreateCoordinatorDiscoveryEvent(network, s.NostrIdentity, s.UriToAdvertise,
|
||||
await Nostr.CreateCoordinatorDiscoveryEvent(network, key, s.UriToAdvertise,
|
||||
s.CoordinatorDescription)
|
||||
},s.UriToAdvertise.IsOnion()? _socks5HttpClientHandler: null, cancel);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
|
||||
using BTCPayServer.Services;
|
||||
using LNURL;
|
||||
using NBitcoin;
|
||||
using NBitcoin.Secp256k1;
|
||||
using NNostr.Client;
|
||||
using WalletWasabi.Backend.Controllers;
|
||||
|
||||
@@ -46,11 +47,10 @@ public class Nostr
|
||||
}
|
||||
|
||||
public static async Task<NostrEvent> CreateCoordinatorDiscoveryEvent(Network currentNetwork,
|
||||
string key,
|
||||
ECPrivKey key,
|
||||
Uri coordinatorUri,
|
||||
string description)
|
||||
{
|
||||
var privateKey = NostrExtensions.ParseKey(key);
|
||||
var evt = new NostrEvent()
|
||||
{
|
||||
Kind = Kind,
|
||||
@@ -63,7 +63,7 @@ public class Nostr
|
||||
}
|
||||
};
|
||||
|
||||
await evt.ComputeIdAndSignAsync(privateKey);
|
||||
await evt.ComputeIdAndSignAsync(key);
|
||||
return evt;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,12 +10,10 @@ using BTCPayServer.Abstractions.Contracts;
|
||||
using BTCPayServer.Client;
|
||||
using BTCPayServer.Client.Models;
|
||||
using BTCPayServer.Common;
|
||||
using BTCPayServer.Configuration;
|
||||
using BTCPayServer.Security;
|
||||
using BTCPayServer.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using NBitcoin;
|
||||
using NBitcoin.Payment;
|
||||
@@ -31,7 +29,7 @@ namespace BTCPayServer.Plugins.Wabisabi
|
||||
[Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie)]
|
||||
[Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)]
|
||||
[Route("plugins/{storeId}/Wabisabi")]
|
||||
public partial class WabisabiStoreController : Controller
|
||||
public class WabisabiStoreController : Controller
|
||||
{
|
||||
private readonly WabisabiService _WabisabiService;
|
||||
private readonly WalletProvider _walletProvider;
|
||||
|
||||
Reference in New Issue
Block a user