From bcdb1ab1d81a7ec62421269bc3d2f36919ab9fba Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Thu, 29 Jul 2021 17:13:46 +0200 Subject: [PATCH] Improve review/broadcast flow and fix test --- BTCPayServer.Tests/SeleniumTests.cs | 5 ---- .../Controllers/WalletsController.PSBT.cs | 11 +++++--- .../Views/Wallets/WalletPSBTDecoded.cshtml | 25 +++++++++++++++++-- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/BTCPayServer.Tests/SeleniumTests.cs b/BTCPayServer.Tests/SeleniumTests.cs index f959d64d2..dfc243d89 100644 --- a/BTCPayServer.Tests/SeleniumTests.cs +++ b/BTCPayServer.Tests/SeleniumTests.cs @@ -890,11 +890,6 @@ namespace BTCPayServer.Tests Assert.Contains("0.01000000", s.Driver.PageSource); s.Driver.FindElement(By.CssSelector("button[value=analyze-psbt]")).Click(); Assert.EndsWith("psbt", s.Driver.Url); - - s.Driver.FindElement(By.Id("OtherActionsDropdownToggle")).Click(); - s.Driver.FindElement(By.CssSelector("button[value=broadcast]")).Click(); - - Assert.EndsWith("psbt/ready", s.Driver.Url); s.Driver.FindElement(By.CssSelector("button[value=broadcast]")).Click(); Assert.Equal(walletTransactionLink, s.Driver.Url); diff --git a/BTCPayServer/Controllers/WalletsController.PSBT.cs b/BTCPayServer/Controllers/WalletsController.PSBT.cs index fc1c9dc4c..26a0dadd3 100644 --- a/BTCPayServer/Controllers/WalletsController.PSBT.cs +++ b/BTCPayServer/Controllers/WalletsController.PSBT.cs @@ -86,12 +86,14 @@ namespace BTCPayServer.Controllers if (await vm.GetPSBT(network.NBitcoinNetwork) is PSBT psbt) { + vm.PSBT = vm.SigningContext.PSBT = psbt.ToBase64(); + vm.PSBTHex = psbt.ToHex(); vm.Decoded = psbt.ToString(); - vm.PSBT = psbt.ToBase64(); - vm.PSBTHex = psbt.ToHex(); + await FetchTransactionDetails(derivationSchemeSettings, vm, network); + return View("WalletPSBTDecoded", vm); } - return View(nameof(WalletPSBT), vm ?? new WalletPSBTViewModel() { CryptoCode = walletId.CryptoCode }); + return View(vm); } [HttpPost("{walletId}/psbt")] @@ -176,7 +178,8 @@ namespace BTCPayServer.Controllers return FilePSBT(psbt, vm.FileName); default: - return View(vm); + var viewName = string.IsNullOrEmpty(vm.PSBT) ? "WalletPSBT" : "WalletPSBTDecoded"; + return View(viewName, vm); } } diff --git a/BTCPayServer/Views/Wallets/WalletPSBTDecoded.cshtml b/BTCPayServer/Views/Wallets/WalletPSBTDecoded.cshtml index 9152f88fc..babf6cf67 100644 --- a/BTCPayServer/Views/Wallets/WalletPSBTDecoded.cshtml +++ b/BTCPayServer/Views/Wallets/WalletPSBTDecoded.cshtml @@ -59,7 +59,8 @@ -
+@if (Model.HasErrors) +{
@@ -71,7 +72,27 @@
- +} +else +{ +
+ + + +
+ @if (!string.IsNullOrEmpty(Model.SigningContext?.PayJoinBIP21)) + { + + or + + } + else + { + + } +
+ +}

Show export options