2019-05-12 00:05:30 +09:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
2019-05-19 23:27:18 +09:00
|
|
|
using NBitcoin;
|
2019-05-12 00:05:30 +09:00
|
|
|
|
|
|
|
namespace BTCPayServer.Models.WalletViewModels
|
|
|
|
{
|
|
|
|
public class WalletPSBTReadyViewModel
|
|
|
|
{
|
2020-05-25 04:55:28 +09:00
|
|
|
public SigningContextModel SigningContext { get; set; } = new SigningContextModel();
|
2019-05-15 15:00:09 +09:00
|
|
|
public string SigningKey { get; set; }
|
|
|
|
public string SigningKeyPath { get; set; }
|
2019-05-19 23:27:18 +09:00
|
|
|
public string GlobalError { get; set; }
|
2019-05-15 15:00:09 +09:00
|
|
|
|
|
|
|
public class DestinationViewModel
|
|
|
|
{
|
|
|
|
public bool Positive { get; set; }
|
|
|
|
public string Destination { get; set; }
|
|
|
|
public string Balance { get; set; }
|
|
|
|
}
|
|
|
|
|
2019-05-31 00:23:23 +09:00
|
|
|
public class InputViewModel
|
|
|
|
{
|
|
|
|
public int Index { get; set; }
|
|
|
|
public string Error { get; set; }
|
|
|
|
public bool Positive { get; set; }
|
|
|
|
public string BalanceChange { get; set; }
|
|
|
|
}
|
|
|
|
public bool HasErrors => Inputs.Count == 0 || Inputs.Any(i => !string.IsNullOrEmpty(i.Error));
|
2019-05-15 15:00:09 +09:00
|
|
|
public string BalanceChange { get; set; }
|
2019-05-19 23:27:18 +09:00
|
|
|
public bool CanCalculateBalance { get; set; }
|
2019-05-15 15:00:09 +09:00
|
|
|
public bool Positive { get; set; }
|
|
|
|
public List<DestinationViewModel> Destinations { get; set; } = new List<DestinationViewModel>();
|
2019-05-31 00:23:23 +09:00
|
|
|
public List<InputViewModel> Inputs { get; set; } = new List<InputViewModel>();
|
2019-05-16 12:56:06 +09:00
|
|
|
public string FeeRate { get; set; }
|
2019-05-19 23:27:18 +09:00
|
|
|
|
|
|
|
internal void SetErrors(IList<PSBTError> errors)
|
|
|
|
{
|
|
|
|
foreach (var err in errors)
|
|
|
|
{
|
2019-05-31 00:23:23 +09:00
|
|
|
Inputs[(int)err.InputIndex].Error = err.Message;
|
2019-05-19 23:27:18 +09:00
|
|
|
}
|
|
|
|
}
|
2019-05-12 00:05:30 +09:00
|
|
|
}
|
|
|
|
}
|