diff --git a/BTCPayServer/Controllers/WalletsController.PSBT.cs b/BTCPayServer/Controllers/WalletsController.PSBT.cs index 9fa3c0924..1edf59454 100644 --- a/BTCPayServer/Controllers/WalletsController.PSBT.cs +++ b/BTCPayServer/Controllers/WalletsController.PSBT.cs @@ -258,7 +258,7 @@ namespace BTCPayServer.Controllers if (psbtObject.TryGetFee(out var fee)) { - vm.Destinations.Add(new WalletPSBTReadyViewModel.DestinationViewModel() + vm.Destinations.Add(new WalletPSBTReadyViewModel.DestinationViewModel { Positive = false, Balance = ValueToString(-fee, network), @@ -288,15 +288,17 @@ namespace BTCPayServer.Controllers { if (command == null) return await WalletPSBT(walletId, vm); + PSBT psbt; var network = NetworkProvider.GetNetwork(walletId.CryptoCode); - DerivationSchemeSettings derivationSchemeSettings = null; + DerivationSchemeSettings derivationSchemeSettings; try { psbt = PSBT.Parse(vm.SigningContext.PSBT, network.NBitcoinNetwork); derivationSchemeSettings = GetDerivationSchemeSettings(walletId); if (derivationSchemeSettings == null) return NotFound(); + await FetchTransactionDetails(derivationSchemeSettings, vm, network); } catch @@ -308,14 +310,14 @@ namespace BTCPayServer.Controllers switch (command) { case "payjoin": - string error = null; + string error; try { var proposedPayjoin = await GetPayjoinProposedTX(new BitcoinUrlBuilder(vm.SigningContext.PayJoinBIP21, network.NBitcoinNetwork), psbt, derivationSchemeSettings, network, cancellationToken); try { - proposedPayjoin.Settings.SigningOptions = new SigningOptions() + proposedPayjoin.Settings.SigningOptions = new SigningOptions { EnforceLowR = !(vm.SigningContext?.EnforceLowR is false) }; @@ -328,7 +330,7 @@ namespace BTCPayServer.Controllers proposedPayjoin.Finalize(); var hash = proposedPayjoin.ExtractTransaction().GetHash(); _EventAggregator.Publish(new UpdateTransactionLabel(walletId, hash, UpdateTransactionLabel.PayjoinLabelTemplate())); - TempData.SetStatusMessageModel(new StatusMessageModel() + TempData.SetStatusMessageModel(new StatusMessageModel { Severity = StatusMessageModel.StatusSeverity.Success, AllowDismiss = false, @@ -343,9 +345,9 @@ namespace BTCPayServer.Controllers Severity = StatusMessageModel.StatusSeverity.Warning, AllowDismiss = false, Html = - $"This transaction has been coordinated between the receiver and you to create a payjoin transaction by adding inputs from the receiver.
" + - $"The amount being sent may appear higher but is in fact almost same.

" + - $"If you cancel or refuse to sign this transaction, the payment will proceed without payjoin" + "This transaction has been coordinated between the receiver and you to create a payjoin transaction by adding inputs from the receiver.
" + + "The amount being sent may appear higher but is in fact almost same.

" + + "If you cancel or refuse to sign this transaction, the payment will proceed without payjoin" }); vm.SigningContext.PSBT = proposedPayjoin.ToBase64(); vm.SigningContext.OriginalPSBT = psbt.ToBase64(); @@ -367,7 +369,7 @@ namespace BTCPayServer.Controllers //we possibly exposed the tx to the receiver, so we need to broadcast straight away psbt.Finalize(); - TempData.SetStatusMessageModel(new StatusMessageModel() + TempData.SetStatusMessageModel(new StatusMessageModel { Severity = StatusMessageModel.StatusSeverity.Warning, AllowDismiss = false, @@ -389,7 +391,7 @@ namespace BTCPayServer.Controllers { if (!string.IsNullOrEmpty(vm.SigningContext.OriginalPSBT)) { - TempData.SetStatusMessageModel(new StatusMessageModel() + TempData.SetStatusMessageModel(new StatusMessageModel { Severity = StatusMessageModel.StatusSeverity.Warning, AllowDismiss = false, diff --git a/BTCPayServer/Controllers/WalletsController.cs b/BTCPayServer/Controllers/WalletsController.cs index 57df1e612..e0a19789c 100644 --- a/BTCPayServer/Controllers/WalletsController.cs +++ b/BTCPayServer/Controllers/WalletsController.cs @@ -817,9 +817,10 @@ namespace BTCPayServer.Controllers SigningContext = model.SigningContext }); } + private IActionResult RedirectToWalletPSBTReady(WalletPSBTReadyViewModel vm) { - var redirectVm = new PostRedirectViewModel() + var redirectVm = new PostRedirectViewModel { AspController = "Wallets", AspAction = nameof(WalletPSBTReady), @@ -943,7 +944,7 @@ namespace BTCPayServer.Controllers } ModelState.Remove(nameof(viewModel.SigningContext.PSBT)); viewModel.SigningContext.PSBT = psbt.ToBase64(); - return RedirectToWalletPSBTReady(new WalletPSBTReadyViewModel() + return RedirectToWalletPSBTReady(new WalletPSBTReadyViewModel { SigningKey = signingKey.GetWif(network.NBitcoinNetwork).ToString(), SigningKeyPath = rootedKeyPath?.ToString(),