btcpayserver/BTCPayServer/Models/WalletViewModels/WalletPSBTReadyViewModel.cs
Andrew Camilleri 892b3e273f
Improve Labeling further (#4849)
* If loading addresses into the send wallet page using bip21 or address,  (or clicking on "Send selected payouts"  from the payotus page), existing labels will be pre-populated.
*  Add the payout label to the address when the payoutis created instead of to the transaction when it is paid.
*  Add the label attachments when adding labels from an address to the transaction.
2023-04-07 15:58:41 +09:00

48 lines
1.8 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 IEnumerable<TransactionTagModel> Labels { get; set; } = new List<TransactionTagModel>();
}
public class InputViewModel
{
public int Index { get; set; }
public string Error { get; set; }
public bool Positive { get; set; }
public string BalanceChange { get; set; }
public IEnumerable<TransactionTagModel> Labels { get; set; } = new List<TransactionTagModel>();
}
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;
}
}
}
}