mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
Improve review/broadcast flow and fix test
This commit is contained in:
committed by
Andrew Camilleri
parent
63944792b0
commit
bcdb1ab1d8
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,8 @@
|
||||
|
||||
<partial name="_PSBTInfo" model="Model" />
|
||||
|
||||
<div class="form-group">
|
||||
@if (Model.HasErrors)
|
||||
{
|
||||
<form method="post" asp-action="WalletPSBT" asp-route-walletId="@Context.GetRouteValue("walletId")">
|
||||
<input type="hidden" asp-for="CryptoCode"/>
|
||||
<input type="hidden" asp-for="NBXSeedAvailable"/>
|
||||
@@ -71,7 +72,27 @@
|
||||
<button type="submit" name="command" value="combine" class="btn btn-secondary">Combine</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<form method="post" asp-action="WalletPSBTReady" asp-route-walletId="@Context.GetRouteValue("walletId")">
|
||||
<input type="hidden" asp-for="SigningKey" />
|
||||
<input type="hidden" asp-for="SigningKeyPath" />
|
||||
<partial name="SigningContext" for="SigningContext" />
|
||||
<div class="d-flex justify-content-center">
|
||||
@if (!string.IsNullOrEmpty(Model.SigningContext?.PayJoinBIP21))
|
||||
{
|
||||
<button type="submit" class="btn btn-primary" name="command" value="payjoin">Broadcast (Payjoin)</button>
|
||||
<span class="mx-2">or</span>
|
||||
<button type="submit" class="btn btn-secondary" name="command" value="broadcast">Broadcast (Simple)</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button type="submit" class="btn btn-primary" name="command" value="broadcast">Broadcast it</button>
|
||||
}
|
||||
</div>
|
||||
</form>
|
||||
}
|
||||
|
||||
<p class="my-5 text-center">
|
||||
<a href="#ExportOptions" data-bs-toggle="collapse" class="text-secondary">Show export options</a>
|
||||
|
||||
Reference in New Issue
Block a user