mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 14:22:40 +01:00
Merge pull request #1523 from Kukks/sender-payjoin-label
Tag payjoin for sender too
This commit is contained in:
commit
29741f39ac
2 changed files with 20 additions and 3 deletions
|
@ -5,6 +5,7 @@ using System.Net.Http;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using BTCPayServer.HostedServices;
|
||||||
using BTCPayServer.ModelBinders;
|
using BTCPayServer.ModelBinders;
|
||||||
using BTCPayServer.Models;
|
using BTCPayServer.Models;
|
||||||
using BTCPayServer.Models.WalletViewModels;
|
using BTCPayServer.Models.WalletViewModels;
|
||||||
|
@ -329,6 +330,21 @@ namespace BTCPayServer.Controllers
|
||||||
vm.PSBT = proposedPayjoin.ToBase64();
|
vm.PSBT = proposedPayjoin.ToBase64();
|
||||||
vm.OriginalPSBT = psbt.ToBase64();
|
vm.OriginalPSBT = psbt.ToBase64();
|
||||||
proposedPayjoin.Finalize();
|
proposedPayjoin.Finalize();
|
||||||
|
var hash = proposedPayjoin.ExtractTransaction().GetHash();
|
||||||
|
_EventAggregator.Publish(new UpdateTransactionLabel()
|
||||||
|
{
|
||||||
|
WalletId = walletId,
|
||||||
|
TransactionLabels = new Dictionary<uint256, List<(string color, string label)>>()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
hash,
|
||||||
|
new List<(string color, string label)>
|
||||||
|
{
|
||||||
|
UpdateTransactionLabel.PayjoinLabelTemplate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
TempData.SetStatusMessageModel(new StatusMessageModel()
|
TempData.SetStatusMessageModel(new StatusMessageModel()
|
||||||
{
|
{
|
||||||
Severity = StatusMessageModel.StatusSeverity.Success,
|
Severity = StatusMessageModel.StatusSeverity.Success,
|
||||||
|
|
|
@ -43,12 +43,13 @@ namespace BTCPayServer.Services.Labels
|
||||||
throw new ArgumentNullException(nameof(value));
|
throw new ArgumentNullException(nameof(value));
|
||||||
if (color == null)
|
if (color == null)
|
||||||
throw new ArgumentNullException(nameof(color));
|
throw new ArgumentNullException(nameof(color));
|
||||||
if (value.StartsWith("{"))
|
if (value.StartsWith("{", StringComparison.InvariantCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
var jObj = JObject.Parse(value);
|
var jObj = JObject.Parse(value);
|
||||||
if (jObj.ContainsKey("value"))
|
if (jObj.ContainsKey("value"))
|
||||||
{
|
{
|
||||||
var id = jObj.ContainsKey("id") ? jObj["id"].Value<string>() : string.Empty;
|
var id = jObj.ContainsKey("id") ? jObj["id"].Value<string>() : string.Empty;
|
||||||
|
var idInLabel = string.IsNullOrEmpty(id) ? string.Empty : $"({id})";
|
||||||
switch (jObj["value"].Value<string>())
|
switch (jObj["value"].Value<string>())
|
||||||
{
|
{
|
||||||
case "invoice":
|
case "invoice":
|
||||||
|
@ -57,7 +58,7 @@ namespace BTCPayServer.Services.Labels
|
||||||
RawValue = value,
|
RawValue = value,
|
||||||
Value = "invoice",
|
Value = "invoice",
|
||||||
Color = color,
|
Color = color,
|
||||||
Tooltip = $"Received through an invoice ({id})",
|
Tooltip = $"Received through an invoice {idInLabel}",
|
||||||
Link = string.IsNullOrEmpty(id)
|
Link = string.IsNullOrEmpty(id)
|
||||||
? null
|
? null
|
||||||
: _linkGenerator.InvoiceLink(id, request.Scheme, request.Host, request.PathBase)
|
: _linkGenerator.InvoiceLink(id, request.Scheme, request.Host, request.PathBase)
|
||||||
|
@ -68,7 +69,7 @@ namespace BTCPayServer.Services.Labels
|
||||||
RawValue = value,
|
RawValue = value,
|
||||||
Value = "payjoin-exposed",
|
Value = "payjoin-exposed",
|
||||||
Color = color,
|
Color = color,
|
||||||
Tooltip = $"This utxo was exposed through a payjoin proposal for an invoice ({id})",
|
Tooltip = $"This utxo was exposed through a payjoin proposal for an invoice {idInLabel}",
|
||||||
Link = string.IsNullOrEmpty(id)
|
Link = string.IsNullOrEmpty(id)
|
||||||
? null
|
? null
|
||||||
: _linkGenerator.InvoiceLink(id, request.Scheme, request.Host, request.PathBase)
|
: _linkGenerator.InvoiceLink(id, request.Scheme, request.Host, request.PathBase)
|
||||||
|
|
Loading…
Add table
Reference in a new issue