btcpayserver/BTCPayServer/Models/WalletViewModels/WalletPSBTReadyViewModel.cs
d11n 95f3e429b4
Wallet transactions: Add label manager (#4796)
* Wallet transactions: Add label manager

* Update BTCPayServer/Views/UIWallets/WalletTransactions.cshtml

Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>

* Add rich label info

* Fixes

* support labels in wallet send

* add labels to tx info page

* Remove noscript parts

* Allow click on transaction label info

* update psbt info labelstyling

* revert red pixel fix as it broke all

---------

Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>
2023-03-26 20:42:38 +09:00

48 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using NBitcoin;
namespace BTCPayServer.Models.WalletViewModels
{
public class WalletPSBTReadyViewModel
{
public SigningContextModel SigningContext { get; set; } = new SigningContextModel();
public string SigningKey { get; set; }
public string SigningKeyPath { get; set; }
public class DestinationViewModel
{
public bool Positive { get; set; }
public string Destination { get; set; }
public string Balance { get; set; }
public Dictionary<string, string> Labels { get; set; } = new();
}
public class InputViewModel
{
public int Index { get; set; }
public string Error { get; set; }
public bool Positive { get; set; }
public string BalanceChange { get; set; }
public Dictionary<string, string> Labels { get; set; } = new();
}
public bool HasErrors => Inputs.Count == 0 || Inputs.Any(i => !string.IsNullOrEmpty(i.Error));
public string BalanceChange { get; set; }
public bool CanCalculateBalance { get; set; }
public bool Positive { get; set; }
public List<DestinationViewModel> Destinations { get; set; } = new List<DestinationViewModel>();
public List<InputViewModel> Inputs { get; set; } = new List<InputViewModel>();
public string FeeRate { get; set; }
public string BackUrl { get; set; }
public string ReturnUrl { get; set; }
internal void SetErrors(IList<PSBTError> errors)
{
foreach (var err in errors)
{
Inputs[(int)err.InputIndex].Error = err.Message;
}
}
}
}