mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 14:22:40 +01:00
Improve error handling for export psbt
This commit is contained in:
parent
aa23222339
commit
3bf4eea1fe
1 changed files with 15 additions and 3 deletions
|
@ -244,8 +244,21 @@ namespace BTCPayServer.Controllers
|
|||
{
|
||||
var storeData = (await Repository.FindStore(walletId.StoreId, GetUserId()));
|
||||
var derivationScheme = GetPaymentMethod(walletId, storeData);
|
||||
var psbt = await CreatePSBT(network, derivationScheme, sendModel, cancellation);
|
||||
return File(psbt.PSBT.ToBytes(), "application/octet-stream", $"Send-{vm.Amount.Value}-{network.CryptoCode}-to-{destination[0].ToString()}.psbt");
|
||||
try
|
||||
{
|
||||
var psbt = await CreatePSBT(network, derivationScheme, sendModel, cancellation);
|
||||
return File(psbt.PSBT.ToBytes(), "application/octet-stream", $"Send-{vm.Amount.Value}-{network.CryptoCode}-to-{destination[0].ToString()}.psbt");
|
||||
}
|
||||
catch (NBXplorerException ex)
|
||||
{
|
||||
ModelState.AddModelError(nameof(vm.Amount), ex.Error.Message);
|
||||
return View(vm);
|
||||
}
|
||||
catch (NotSupportedException)
|
||||
{
|
||||
ModelState.AddModelError(nameof(vm.Destination), "You need to update your version of NBXplorer");
|
||||
return View(vm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -283,7 +296,6 @@ namespace BTCPayServer.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (derivationSettings.AccountKeyPath != null && derivationSettings.AccountKeyPath.Indexes.Length != 0)
|
||||
{
|
||||
// NBX only know the path relative to the account xpub.
|
||||
|
|
Loading…
Add table
Reference in a new issue