Small esthetic refacotring

This commit is contained in:
nicolas.dorier 2020-06-01 13:10:21 +09:00
parent e865d85c2c
commit 9e16b506e5
No known key found for this signature in database
GPG key ID: 6618763EF09186FE
2 changed files with 18 additions and 20 deletions

View file

@ -330,20 +330,7 @@ namespace BTCPayServer.Controllers
vm.SigningContext.OriginalPSBT = psbt.ToBase64();
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()
}
}
}
});
_EventAggregator.Publish(new UpdateTransactionLabel(walletId, hash, UpdateTransactionLabel.PayjoinLabelTemplate()));
TempData.SetStatusMessageModel(new StatusMessageModel()
{
Severity = StatusMessageModel.StatusSeverity.Success,

View file

@ -50,12 +50,7 @@ namespace BTCPayServer.HostedServices
labels.Add(UpdateTransactionLabel.PayjoinLabelTemplate());
}
_eventAggregator.Publish(new UpdateTransactionLabel()
{
WalletId = walletId,
TransactionLabels =
new Dictionary<uint256, List<(string color, string label)>>() {{transactionId, labels}}
});
_eventAggregator.Publish(new UpdateTransactionLabel(walletId, transactionId, labels));
}
else if (evt is UpdateTransactionLabel updateTransactionLabel)
{
@ -96,6 +91,22 @@ namespace BTCPayServer.HostedServices
public class UpdateTransactionLabel
{
public UpdateTransactionLabel()
{
}
public UpdateTransactionLabel(WalletId walletId, uint256 txId, (string color, string label) colorLabel)
{
WalletId = walletId;
TransactionLabels = new Dictionary<uint256, List<(string color, string label)>>();
TransactionLabels.Add(txId, new List<(string color, string label)>() { colorLabel });
}
public UpdateTransactionLabel(WalletId walletId, uint256 txId, List<(string color, string label)> colorLabels)
{
WalletId = walletId;
TransactionLabels = new Dictionary<uint256, List<(string color, string label)>>();
TransactionLabels.Add(txId, colorLabels);
}
public static (string color, string label) PayjoinLabelTemplate()
{
return ("#51b13e", "payjoin");