diff --git a/BTCPayServer/Controllers/WalletsController.PSBT.cs b/BTCPayServer/Controllers/WalletsController.PSBT.cs index 8078cf969..beee6d4bf 100644 --- a/BTCPayServer/Controllers/WalletsController.PSBT.cs +++ b/BTCPayServer/Controllers/WalletsController.PSBT.cs @@ -130,6 +130,14 @@ namespace BTCPayServer.Controllers } switch (command) { + case "export": + var viewModel = new WalletPSBTExportViewModel {SigningContext = vm.SigningContext}; + viewModel.PSBT = psbt.ToBase64(); + viewModel.PSBTHex = psbt.ToHex(); + viewModel.CryptoCode = network.CryptoCode; + await FetchTransactionDetails(derivationSchemeSettings, viewModel, network); + return View("WalletPSBTExport", viewModel); + case "decode": vm.Decoded = psbt.ToString(); ModelState.Remove(nameof(vm.PSBT)); diff --git a/BTCPayServer/Models/WalletViewModels/WalletPSBTExportViewModel.cs b/BTCPayServer/Models/WalletViewModels/WalletPSBTExportViewModel.cs new file mode 100644 index 000000000..d645e3c4a --- /dev/null +++ b/BTCPayServer/Models/WalletViewModels/WalletPSBTExportViewModel.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Http; + +namespace BTCPayServer.Models.WalletViewModels +{ + public class WalletPSBTExportViewModel : WalletPSBTReadyViewModel + { + public string CryptoCode { get; set; } + public string PSBTHex { get; set; } + public string PSBT { get; set; } + + [Display(Name = "Upload PSBT from file")] + public IFormFile UploadedPSBTFile { get; set; } + } +} diff --git a/BTCPayServer/Views/Wallets/WalletPSBTExport.cshtml b/BTCPayServer/Views/Wallets/WalletPSBTExport.cshtml new file mode 100644 index 000000000..994ce4566 --- /dev/null +++ b/BTCPayServer/Views/Wallets/WalletPSBTExport.cshtml @@ -0,0 +1,80 @@ +@model WalletPSBTExportViewModel +@addTagHelper *, BundlerMinifier.TagHelpers +@{ + Layout = "../Shared/_NavLayout.cshtml"; + ViewData.SetActivePageAndTitle(WalletsNavPages.PSBT, "PSBT Signing", Context.GetStoreData().StoreName); +} + +@section PageHeadContent { + +} + +@section PageFootContent { + + +} + +

@ViewData["PageTitle"]

+ +
+
+ @if (Model.CanCalculateBalance) + { +

+ This transaction will change your balance: + @if (Model.Positive) + { + @Model.BalanceChange + } + else + { + @Model.BalanceChange + } +

+

+ Review the details and export the PSBT for your wallet. + Sign the PSBT with your wallet and import the signed version + here for finalization and broadcastimg. +

+ } + + +

Export PSBT for signing

+
+
+ + +
+ + +
+
+
+ +

Import signed PSBT

+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + diff --git a/BTCPayServer/Views/Wallets/WalletSigningOptions.cshtml b/BTCPayServer/Views/Wallets/WalletSigningOptions.cshtml index b1cb7cb8c..42c629f89 100644 --- a/BTCPayServer/Views/Wallets/WalletSigningOptions.cshtml +++ b/BTCPayServer/Views/Wallets/WalletSigningOptions.cshtml @@ -56,7 +56,7 @@ }
-