Reuse same html and handling of commands for PSBT signing/ Wallet Send (#1587)

* Reuse same html and handling of commands for PSBT signing/ Wallet Send

* fix ledger
This commit is contained in:
Andrew Camilleri
2020-05-23 21:31:21 +02:00
committed by GitHub
parent cdf6886c39
commit 9d215ea27d
5 changed files with 77 additions and 74 deletions

View File

@@ -653,24 +653,16 @@ namespace BTCPayServer.Controllers
return View(vm);
}
derivationScheme.RebaseKeyPaths(psbt.PSBT);
var res = await TryHandleSigningCommands(walletId, psbt.PSBT, command, vm.PayJoinEndpointUrl, psbt.ChangeAddress);
if (res != null)
{
return res;
}
switch (command)
{
case "vault":
return ViewVault(walletId, psbt.PSBT, vm.PayJoinEndpointUrl);
case "nbx-seed":
var extKey = await ExplorerClientProvider.GetExplorerClient(network)
.GetMetadataAsync<string>(derivationScheme.AccountDerivation, WellknownMetadataKeys.MasterHDKey, cancellation);
return SignWithSeed(walletId, new SignWithSeedViewModel()
{
PayJoinEndpointUrl = vm.PayJoinEndpointUrl,
SeedOrKey = extKey,
PSBT = psbt.PSBT.ToBase64()
});
case "ledger":
return ViewWalletSendLedger(walletId, psbt.PSBT, psbt.ChangeAddress);
case "seed":
return SignWithSeed(walletId, psbt.PSBT.ToBase64(), vm.PayJoinEndpointUrl);
case "analyze-psbt":
var name =
$"Send-{string.Join('_', vm.Outputs.Select(output => $"{output.Amount}->{output.DestinationAddress}{(output.SubtractFeesFromOutput ? "-Fees" : string.Empty)}"))}.psbt";