mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-17 07:34:24 +01:00
update sms
This commit is contained in:
@@ -1,12 +1,24 @@
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
var plugins = Directory.GetDirectories("../../../../Plugins");
|
var plugins = Directory.GetDirectories("../../../../Plugins");
|
||||||
Console.WriteLine(string.Join(',',plugins));
|
var p = "";
|
||||||
var p = string.Join(';', plugins.Select(s => $"{Path.GetFullPath(s)}/bin/Altcoins-Debug/net6.0/{Path.GetFileName(s)}.dll" ));;
|
foreach (var plugin in plugins)
|
||||||
var fileContents = $"{{ \"DEBUG_PLUGINS\": \"{p}\"}}";
|
{
|
||||||
|
var x = Directory.GetDirectories(Path.Combine(plugin,"bin"));
|
||||||
|
if (x.Any(s => s.EndsWith("Altcoins-Debug")))
|
||||||
|
{
|
||||||
|
p += $"{Path.GetFullPath(plugin)}/bin/Altcoins-Debug/net6.0/{Path.GetFileName(plugin)}.dll;";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p += $"{Path.GetFullPath(plugin)}/bin/Debug/net6.0/{Path.GetFileName(plugin)}.dll;";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var content = JsonSerializer.Serialize(new
|
var content = JsonSerializer.Serialize(new
|
||||||
{
|
{
|
||||||
DEBUG_PLUGINS = p
|
DEBUG_PLUGINS = p
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Console.WriteLine(content);
|
||||||
await File.WriteAllTextAsync("../../../../submodules/BTCPayServer/BTCPayServer/appsettings.dev.json", content);
|
await File.WriteAllTextAsync("../../../../submodules/BTCPayServer/BTCPayServer/appsettings.dev.json", content);
|
||||||
@@ -292,6 +292,7 @@ public class BTCPayWallet : IWallet, IDestinationProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
anonset = anonset < 1 ? 1 : anonset;
|
||||||
return (labels, anonset, cjData);
|
return (labels, anonset, cjData);
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -324,12 +325,12 @@ public class BTCPayWallet : IWallet, IDestinationProvider
|
|||||||
|
|
||||||
private Task _savingProgress = Task.CompletedTask;
|
private Task _savingProgress = Task.CompletedTask;
|
||||||
|
|
||||||
public async Task RegisterCoinjoinTransaction(CoinJoinResult result, string coordinatorName)
|
public async Task RegisterCoinjoinTransaction(SuccessfulCoinJoinResult result, string coordinatorName)
|
||||||
{
|
{
|
||||||
_savingProgress = RegisterCoinjoinTransactionInternal(result, coordinatorName);
|
_savingProgress = RegisterCoinjoinTransactionInternal(result, coordinatorName);
|
||||||
await _savingProgress;
|
await _savingProgress;
|
||||||
}
|
}
|
||||||
private async Task RegisterCoinjoinTransactionInternal(CoinJoinResult result, string coordinatorName)
|
private async Task RegisterCoinjoinTransactionInternal(SuccessfulCoinJoinResult result, string coordinatorName)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -351,7 +352,7 @@ public class BTCPayWallet : IWallet, IDestinationProvider
|
|||||||
|
|
||||||
|
|
||||||
Dictionary<IndexedTxOut, PendingPayment> indexToPayment = new();
|
Dictionary<IndexedTxOut, PendingPayment> indexToPayment = new();
|
||||||
foreach (var script in result.RegisteredOutputs)
|
foreach (var script in result.OutputScripts)
|
||||||
{
|
{
|
||||||
var txout = result.UnsignedCoinJoin.Outputs.AsIndexedOutputs()
|
var txout = result.UnsignedCoinJoin.Outputs.AsIndexedOutputs()
|
||||||
.Single(@out => @out.TxOut.ScriptPubKey == script);
|
.Single(@out => @out.TxOut.ScriptPubKey == script);
|
||||||
@@ -372,13 +373,13 @@ public class BTCPayWallet : IWallet, IDestinationProvider
|
|||||||
await Task.WhenAll(scriptInfos.Select(t => t.Item2));
|
await Task.WhenAll(scriptInfos.Select(t => t.Item2));
|
||||||
var scriptInfos2 = scriptInfos.Where(tuple => tuple.Item2.Result is not null).ToDictionary(tuple => tuple.txout.TxOut.ScriptPubKey);
|
var scriptInfos2 = scriptInfos.Where(tuple => tuple.Item2.Result is not null).ToDictionary(tuple => tuple.txout.TxOut.ScriptPubKey);
|
||||||
var smartTx = new SmartTransaction(result.UnsignedCoinJoin, new Height(HeightType.Unknown));
|
var smartTx = new SmartTransaction(result.UnsignedCoinJoin, new Height(HeightType.Unknown));
|
||||||
result.RegisteredCoins.ForEach(coin =>
|
result.Coins.ForEach(coin =>
|
||||||
{
|
{
|
||||||
coin.HdPubKey.SetKeyState(KeyState.Used);
|
coin.HdPubKey.SetKeyState(KeyState.Used);
|
||||||
coin.SpenderTransaction = smartTx;
|
coin.SpenderTransaction = smartTx;
|
||||||
smartTx.TryAddWalletInput(coin);
|
smartTx.TryAddWalletInput(coin);
|
||||||
});
|
});
|
||||||
result.RegisteredOutputs.ForEach(s =>
|
result.OutputScripts.ForEach(s =>
|
||||||
{
|
{
|
||||||
if (scriptInfos2.TryGetValue(s, out var si))
|
if (scriptInfos2.TryGetValue(s, out var si))
|
||||||
{
|
{
|
||||||
@@ -446,6 +447,10 @@ public class BTCPayWallet : IWallet, IDestinationProvider
|
|||||||
new WalletId(StoreId, "BTC"),
|
new WalletId(StoreId, "BTC"),
|
||||||
result.UnsignedCoinJoin.GetHash(),
|
result.UnsignedCoinJoin.GetHash(),
|
||||||
attachments);
|
attachments);
|
||||||
|
|
||||||
|
|
||||||
|
var mixedCoins = smartTx.WalletOutputs.Where(coin =>
|
||||||
|
coin.AnonymitySet > 1 && BlockchainAnalyzer.StdDenoms.Contains(coin.TxOut.Value.Satoshi));
|
||||||
if (storeIdForutxo != StoreId)
|
if (storeIdForutxo != StoreId)
|
||||||
{
|
{
|
||||||
await _walletRepository.AddWalletTransactionAttachment(
|
await _walletRepository.AddWalletTransactionAttachment(
|
||||||
@@ -453,20 +458,32 @@ public class BTCPayWallet : IWallet, IDestinationProvider
|
|||||||
result.UnsignedCoinJoin.GetHash(),
|
result.UnsignedCoinJoin.GetHash(),
|
||||||
new List<Attachment>()
|
new List<Attachment>()
|
||||||
{
|
{
|
||||||
new Attachment("coinjoin", result.RoundId.ToString(), null),
|
new Attachment("coinjoin", result.RoundId.ToString(), JObject.FromObject(new CoinjoinData()
|
||||||
|
{
|
||||||
|
Transaction = result.UnsignedCoinJoin.GetHash().ToString(),
|
||||||
|
Round = result.RoundId.ToString(),
|
||||||
|
CoinsOut = mixedCoins.Select(coin => new CoinjoinData.CoinjoinDataCoin()
|
||||||
|
{
|
||||||
|
AnonymitySet = coin.AnonymitySet,
|
||||||
|
Amount = coin.Amount.ToDecimal(MoneyUnit.BTC),
|
||||||
|
Outpoint = coin.Outpoint.ToString()
|
||||||
|
}).ToArray(),
|
||||||
|
CoordinatorName = coordinatorName
|
||||||
|
})),
|
||||||
new Attachment(coordinatorName, null, null)
|
new Attachment(coordinatorName, null, null)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var mixedCoins = smartTx.WalletOutputs.Where(coin =>
|
|
||||||
coin.AnonymitySet > 1 && BlockchainAnalyzer.StdDenoms.Contains(coin.TxOut.Value.Satoshi));
|
|
||||||
|
|
||||||
foreach (var mixedCoin in mixedCoins)
|
foreach (var mixedCoin in mixedCoins)
|
||||||
{
|
{
|
||||||
await _walletRepository.AddWalletTransactionAttachment(new WalletId(storeIdForutxo, "BTC"),
|
await _walletRepository.AddWalletTransactionAttachment(new WalletId(storeIdForutxo, "BTC"),
|
||||||
mixedCoin.Outpoint.ToString(),
|
mixedCoin.Outpoint.ToString(),
|
||||||
new[] {new Attachment("anonset", mixedCoin.AnonymitySet.ToString())}, "utxo");
|
new[] {new Attachment("anonset", mixedCoin.AnonymitySet.ToString(), JObject.FromObject(new
|
||||||
|
{
|
||||||
|
Tooltip = $"This coin has an anonset score of {mixedCoin.AnonymitySet.ToString()} (anonset-{mixedCoin.AnonymitySet.ToString()})"
|
||||||
|
}))}, "utxo");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ Reputation risks: as the coordinator, the user may be associated with illegal ac
|
|||||||
{
|
{
|
||||||
Wabisabi = await _wabisabiCoordinatorService.GetSettings();
|
Wabisabi = await _wabisabiCoordinatorService.GetSettings();
|
||||||
|
|
||||||
|
ViewBag.Config = _wabisabiCoordinatorService.WabiSabiCoordinator.Config.ToString();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@@ -80,6 +82,7 @@ Reputation risks: as the coordinator, the user may be associated with illegal ac
|
|||||||
public async Task<IActionResult> UpdateWabisabiSettings(WabisabiCoordinatorSettings vm,
|
public async Task<IActionResult> UpdateWabisabiSettings(WabisabiCoordinatorSettings vm,
|
||||||
string command, string config)
|
string command, string config)
|
||||||
{
|
{
|
||||||
|
ViewBag.Config = config;
|
||||||
switch (command)
|
switch (command)
|
||||||
{
|
{
|
||||||
case "nostr-current-url":
|
case "nostr-current-url":
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<span class="text-danger">@string.Join("\n", error.Errors)</span>
|
<span class="text-danger">@string.Join("\n", error.Errors)</span>
|
||||||
}
|
}
|
||||||
<textarea rows="10" cols="40" class="form-control" id="config" name="config" >
|
<textarea rows="10" cols="40" class="form-control" id="config" name="config" >
|
||||||
@Html.Raw(WabisabiCoordinatorService.WabiSabiCoordinator.Config.ToString())
|
@Html.Raw(ViewBag.Config)
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group pt-3">
|
<div class="form-group pt-3">
|
||||||
|
|||||||
@@ -281,7 +281,10 @@
|
|||||||
<th scope="row">Minimum inputs</th><td>@round.MinInputCountByRound</td>
|
<th scope="row">Minimum inputs</th><td>@round.MinInputCountByRound</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Max inputs</th><td>@round.MaxInputCountByRound</td>
|
<th scope="row">Maximum inputs</th><td>@round.MaxInputCountByRound</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Maximum round registration time</th><td>@round.StandardInputRegistrationTimeout.ToString()</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
@@ -293,7 +296,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a class="w-100 px-2 cursor-pointer"
|
<a class="px-2 cursor-pointer"
|
||||||
data-bs-toggle="modal" data-bs-target="#config-@s.Coordinator">
|
data-bs-toggle="modal" data-bs-target="#config-@s.Coordinator">
|
||||||
Coordinator Config
|
Coordinator Config
|
||||||
</a>
|
</a>
|
||||||
@@ -302,7 +305,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group form-check form">
|
<div class="form-group form-check form">
|
||||||
<input asp-for="Settings[index].Enabled" type="checkbox" class="form-check-input form-control-lg toggle-settings" data-coordinator="@s.Coordinator" disabled="@(!coordinator.WasabiCoordinatorStatusFetcher.Connected)" />
|
<input asp-for="Settings[index].Enabled" type="checkbox" class="form-check-input form-control-lg toggle-settings" data-coordinator="@s.Coordinator" disabled="@(!coordinator.WasabiCoordinatorStatusFetcher.Connected)" />
|
||||||
<a class="w-100 px-2 position-absolute bottom-0 cursor-pointer"
|
<a class="px-2 position-absolute bottom-0 cursor-pointer"
|
||||||
data-bs-toggle="modal" data-bs-target="#terms-@s.Coordinator"
|
data-bs-toggle="modal" data-bs-target="#terms-@s.Coordinator"
|
||||||
style="
|
style="
|
||||||
right: 0;
|
right: 0;
|
||||||
|
|||||||
@@ -202,23 +202,23 @@ public class WabisabiCoordinatorClientInstance
|
|||||||
|
|
||||||
var result = completedEventArgs.CoinJoinResult;
|
var result = completedEventArgs.CoinJoinResult;
|
||||||
|
|
||||||
if (completedEventArgs.CompletionStatus == CompletionStatus.Success)
|
if (completedEventArgs.CompletionStatus == CompletionStatus.Success && result is SuccessfulCoinJoinResult successfulCoinJoinResult)
|
||||||
{
|
{
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
|
|
||||||
var wallet = (BTCPayWallet) e.Wallet;
|
var wallet = (BTCPayWallet) e.Wallet;
|
||||||
await wallet.RegisterCoinjoinTransaction(result, CoordinatorName);
|
await wallet.RegisterCoinjoinTransaction(successfulCoinJoinResult, CoordinatorName);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else if(result is DisruptedCoinJoinResult disruptedCoinJoinResult )
|
||||||
{
|
{
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
// _logger.LogInformation("unlocking coins because round failed");
|
// _logger.LogInformation("unlocking coins because round failed");
|
||||||
await _utxoLocker.TryUnlock(
|
await _utxoLocker.TryUnlock(
|
||||||
result.RegisteredCoins.Select(coin => coin.Outpoint).ToArray());
|
disruptedCoinJoinResult.SignedCoins.Select(coin => coin.Outpoint).ToArray());
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Submodule submodules/btcpayserver updated: bd5e4f3d94...b372dc21d6
Submodule submodules/walletwasabi updated: 9fa9947c67...98785f30b2
Reference in New Issue
Block a user