Small esthetic refacotring

This commit is contained in:
nicolas.dorier
2020-06-01 13:10:21 +09:00
parent e865d85c2c
commit 9e16b506e5
2 changed files with 18 additions and 20 deletions

View File

@@ -330,20 +330,7 @@ namespace BTCPayServer.Controllers
vm.SigningContext.OriginalPSBT = psbt.ToBase64(); vm.SigningContext.OriginalPSBT = psbt.ToBase64();
proposedPayjoin.Finalize(); proposedPayjoin.Finalize();
var hash = proposedPayjoin.ExtractTransaction().GetHash(); var hash = proposedPayjoin.ExtractTransaction().GetHash();
_EventAggregator.Publish(new UpdateTransactionLabel() _EventAggregator.Publish(new UpdateTransactionLabel(walletId, hash, UpdateTransactionLabel.PayjoinLabelTemplate()));
{
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,

View File

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