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