mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-17 07:34:24 +01:00
upd ws
This commit is contained in:
@@ -72,12 +72,6 @@ SmartCoin[] FilterCoinsMore(IEnumerable<SmartCoin> coins)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_wallet.WabisabiStoreSettings.PlebMode ||
|
||||
_wallet.WabisabiStoreSettings.CrossMixBetweenCoordinatorsMode ==
|
||||
WabisabiStoreSettings.CrossMixMode.WhenFree)
|
||||
{
|
||||
return coin.Amount <= roundParameters.CoordinationFeeRate.PlebsDontPayThreshold;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NNostr.Client" Version="0.0.48"></PackageReference>
|
||||
<PackageReference Include="NNostr.Client" Version="0.0.51"></PackageReference>
|
||||
<PackageReference Include="WabiSabi" Version="1.0.1.2"/>
|
||||
</ItemGroup>
|
||||
<Target Name="DeleteExampleFile" AfterTargets="Publish">
|
||||
|
||||
@@ -286,8 +286,7 @@ public class BTCPayWallet : IWallet, IDestinationProvider
|
||||
{
|
||||
return coordSettings.RoundWhenEnabled is not null &&
|
||||
roundParameters.CoordinationFeeRate.Rate <= coordSettings.RoundWhenEnabled.CoordinationFeeRate &&
|
||||
roundParameters.CoordinationFeeRate.PlebsDontPayThreshold <=
|
||||
coordSettings.RoundWhenEnabled.PlebsDontPayThresholdM &&
|
||||
|
||||
roundParameters.MinInputCountByRound <= coordSettings.RoundWhenEnabled.MinInputCountByRound;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -24,7 +24,7 @@ public static class CoordinatorExtensions
|
||||
return null;
|
||||
}
|
||||
return new WabiSabiController(s.IdempotencyRequestCache, s.WabiSabiCoordinator.Arena,
|
||||
s.WabiSabiCoordinator.CoinJoinFeeRateStatStore, s.WabiSabiCoordinator.AffiliationManager);
|
||||
s.WabiSabiCoordinator.CoinJoinFeeRateStatStore);
|
||||
});
|
||||
services.AddHostedService((sp) => sp.GetRequiredService<WabisabiCoordinatorService>());
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using WabiSabi.Crypto;
|
||||
using WalletWasabi.Affiliation;
|
||||
using WalletWasabi.WabiSabi;
|
||||
using WalletWasabi.WabiSabi.Backend.Models;
|
||||
using WalletWasabi.WabiSabi.Models;
|
||||
@@ -43,14 +42,6 @@ public class ExceptionTranslateAttribute : ExceptionFilterAttribute
|
||||
{
|
||||
StatusCode = (int) HttpStatusCode.InternalServerError
|
||||
},
|
||||
AffiliationException e => new JsonResult(new Error(
|
||||
Type: AffiliationConstants.RequestSecrecyViolationType,
|
||||
ErrorCode: "undefined",
|
||||
Description: e.Message,
|
||||
ExceptionData: EmptyExceptionData.Instance), serializerSettings)
|
||||
{
|
||||
StatusCode = (int) HttpStatusCode.InternalServerError
|
||||
},
|
||||
_ => new StatusCodeResult((int) HttpStatusCode.InternalServerError)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using WalletWasabi.Affiliation;
|
||||
using WalletWasabi.Backend.Filters;
|
||||
using WalletWasabi.Cache;
|
||||
using WalletWasabi.WabiSabi.Backend.PostRequests;
|
||||
@@ -24,27 +23,24 @@ namespace WalletWasabi.Backend.Controllers;
|
||||
[Produces("application/json")]
|
||||
public class WabiSabiController : ControllerBase, IWabiSabiApiRequestHandler
|
||||
{
|
||||
public WabiSabiController(IdempotencyRequestCache idempotencyRequestCache, Arena arena, CoinJoinFeeRateStatStore coinJoinFeeRateStatStore, AffiliationManager affiliationManager)
|
||||
public WabiSabiController(IdempotencyRequestCache idempotencyRequestCache, Arena arena, CoinJoinFeeRateStatStore coinJoinFeeRateStatStore)
|
||||
{
|
||||
IdempotencyRequestCache = idempotencyRequestCache;
|
||||
Arena = arena;
|
||||
CoinJoinFeeRateStatStore = coinJoinFeeRateStatStore;
|
||||
AffiliationManager = affiliationManager;
|
||||
}
|
||||
|
||||
private static TimeSpan RequestTimeout { get; } = TimeSpan.FromMinutes(5);
|
||||
private IdempotencyRequestCache IdempotencyRequestCache { get; }
|
||||
private Arena Arena { get; }
|
||||
private CoinJoinFeeRateStatStore CoinJoinFeeRateStatStore { get; }
|
||||
private AffiliationManager AffiliationManager { get; }
|
||||
|
||||
[HttpPost("status")]
|
||||
public async Task<RoundStateResponse> GetStatusAsync(RoundStateRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
var response = await Arena.GetStatusAsync(request, cancellationToken);
|
||||
var medians = CoinJoinFeeRateStatStore.GetDefaultMedians();
|
||||
var affiliateInformation = AffiliationManager.GetAffiliateInformation();
|
||||
var ret = new RoundStateResponse(response.RoundStates, medians, affiliateInformation);
|
||||
var ret = new RoundStateResponse(response.RoundStates, medians);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ using WalletWasabi.Services;
|
||||
using WalletWasabi.Tor.Socks5.Pool.Circuits;
|
||||
using WalletWasabi.WabiSabi;
|
||||
using WalletWasabi.WabiSabi.Backend;
|
||||
using WalletWasabi.WabiSabi.Backend.Rounds.CoinJoinStorage;
|
||||
using WalletWasabi.WabiSabi.Backend.Statistics;
|
||||
using WalletWasabi.WabiSabi.Client;
|
||||
using WalletWasabi.WabiSabi.Models;
|
||||
@@ -230,12 +229,10 @@ public class WabisabiCoordinatorService : PeriodicRunner
|
||||
var network = _networkProvider.GetNetwork<BTCPayNetwork>("BTC");
|
||||
var coordinatorParameters =
|
||||
new CoordinatorParameters(Path.Combine(_dataDirectories.Value.DataDir, "Plugins", "Coinjoin"));
|
||||
var coinJoinIdStore =
|
||||
CoinJoinIdStore.Create( coordinatorParameters.CoinJoinIdStoreFilePath);
|
||||
var coinJoinScriptStore = CoinJoinScriptStore.LoadFromFile(coordinatorParameters.CoinJoinScriptStoreFilePath);
|
||||
var rpc = new BtcPayRpcClient(_feeProviderFactory.CreateFeeProvider(network),explorerClient.RPCClient, _memoryCache, explorerClient);
|
||||
|
||||
WabiSabiCoordinator = new WabiSabiCoordinator(coordinatorParameters, rpc, coinJoinIdStore, coinJoinScriptStore,
|
||||
WabiSabiCoordinator = new WabiSabiCoordinator(coordinatorParameters, rpc, coinJoinScriptStore,
|
||||
_httpClientFactory, _coordinatorScriptResolver);
|
||||
HostedServices.Register<WabiSabiCoordinator>(() => WabiSabiCoordinator, "WabiSabi Coordinator");
|
||||
|
||||
@@ -267,8 +264,8 @@ public class WabisabiCoordinatorService : PeriodicRunner
|
||||
{
|
||||
instance.WasabiCoordinatorStatusFetcher.OverrideConnected = null;
|
||||
}
|
||||
|
||||
var coinjoinConfig = new CoinJoinConfiguration(WabiSabiCoordinator.Config.CoordinatorIdentifier, 10m, 100m);
|
||||
|
||||
var coinjoinConfig = new CoinJoinConfiguration(WabiSabiCoordinator.Config.CoordinatorIdentifier,150m, WabiSabiCoordinator.Config.MinInputCountByRound, false);
|
||||
_instanceManager.AddCoordinator("Local Coordinator",
|
||||
"local", _ => null,
|
||||
cachedSettings.TermsConditions,
|
||||
|
||||
@@ -379,7 +379,7 @@
|
||||
<tr>
|
||||
<th scope="row">Fee charged</th>
|
||||
@{
|
||||
var fee = $"{roundParameters.CoordinationFeeRate.Rate * 100}% + Free remixing {(roundParameters.CoordinationFeeRate.PlebsDontPayThreshold <= 0 ? string.Empty : $"+ Free under {roundParameters.CoordinationFeeRate.PlebsDontPayThreshold.ToDecimal(MoneyUnit.BTC)} BTC")}";
|
||||
var fee = $"{roundParameters.CoordinationFeeRate.Rate * 100}%";
|
||||
}
|
||||
<td>
|
||||
@(fee)
|
||||
@@ -450,7 +450,6 @@
|
||||
@if (Model.Settings[index].RoundWhenEnabled is not null)
|
||||
{
|
||||
<input type="hidden" asp-for="Settings[index].RoundWhenEnabled.CoordinationFeeRate"/>
|
||||
<input type="hidden" asp-for="Settings[index].RoundWhenEnabled.PlebsDontPayThreshold"/>
|
||||
<input type="hidden" asp-for="Settings[index].RoundWhenEnabled.MinInputCountByRound"/>
|
||||
}
|
||||
|
||||
|
||||
@@ -50,15 +50,6 @@ namespace BTCPayServer.Plugins.Wabisabi
|
||||
nameof(WabisabiStoreSettings));
|
||||
res ??= new WabisabiStoreSettings();
|
||||
res.Settings = res.Settings.Where(settings => _ids.Contains(settings.Coordinator)).ToList();
|
||||
res.Settings.ForEach(settings =>
|
||||
{
|
||||
if (settings.RoundWhenEnabled != null &&
|
||||
string.IsNullOrEmpty(settings.RoundWhenEnabled.PlebsDontPayThreshold))
|
||||
{
|
||||
settings.RoundWhenEnabled.PlebsDontPayThreshold = "1000000";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
await EnablePayoutProcessorBasedOnSettings(storeId, res);
|
||||
return res;
|
||||
@@ -126,8 +117,6 @@ namespace BTCPayServer.Plugins.Wabisabi
|
||||
? new LastCoordinatorRoundConfig()
|
||||
{
|
||||
CoordinationFeeRate = roundParameters.CoordinationFeeRate.Rate,
|
||||
PlebsDontPayThreshold = roundParameters.CoordinationFeeRate
|
||||
.PlebsDontPayThreshold.Satoshi.ToString(),
|
||||
MinInputCountByRound = roundParameters.MinInputCountByRound,
|
||||
}
|
||||
: null;
|
||||
|
||||
@@ -245,7 +245,7 @@ namespace BTCPayServer.Plugins.Wabisabi
|
||||
{
|
||||
coordSettings.DiscoveredCoordinators.Add(viewModel);
|
||||
await _wabisabiCoordinatorService.UpdateSettings(coordSettings);
|
||||
var config = new CoinJoinConfiguration();
|
||||
var config = new CoinJoinConfiguration("CoordinatorIdentifier",150m, 1, false);
|
||||
_instanceManager.AddCoordinator(viewModel.Name, viewModel.Name, provider => viewModel.Uri, null,viewModel.Description, config);
|
||||
|
||||
TempData["SuccessMessage"] = $"Coordinator {viewModel.Name } added and started";
|
||||
|
||||
@@ -84,9 +84,6 @@ public class LastCoordinatorRoundConfig
|
||||
{
|
||||
|
||||
public decimal CoordinationFeeRate { get; set; }
|
||||
public string PlebsDontPayThreshold { get; set; }
|
||||
[JsonIgnore]
|
||||
public Money PlebsDontPayThresholdM => Money.Parse(PlebsDontPayThreshold);
|
||||
|
||||
public int MinInputCountByRound { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user