Can actually upload PSBT file in PSBT Combine and PSBT view.

Validate transaction before allowing any broadcast and show errors nicely.
This commit is contained in:
nicolas.dorier
2019-05-19 23:27:18 +09:00
parent 55a48ff84a
commit 87df34e064
8 changed files with 162 additions and 65 deletions

View File

@@ -2,15 +2,22 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NBitcoin;
namespace BTCPayServer.Models.WalletViewModels
{
public class WalletPSBTReadyViewModel
{
public class FinalizeError
{
public int Index { get; set; }
public string Error { get; set; }
}
public string PSBT { get; set; }
public string SigningKey { get; set; }
public string SigningKeyPath { get; set; }
public List<string> Errors { get; set; }
public string GlobalError { get; set; }
public List<FinalizeError> Errors { get; set; }
public class DestinationViewModel
{
@@ -20,9 +27,18 @@ namespace BTCPayServer.Models.WalletViewModels
}
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 string Fee { get; set; }
public string FeeRate { get; set; }
internal void SetErrors(IList<PSBTError> errors)
{
Errors = new List<FinalizeError>();
foreach (var err in errors)
{
Errors.Add(new FinalizeError() { Index = (int)err.InputIndex, Error = err.Message });
}
}
}
}