mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 14:22:40 +01:00
add download psbt action
This commit is contained in:
parent
d393cee732
commit
016bf1d671
2 changed files with 16 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.IO;
|
||||
|
@ -38,8 +39,20 @@ namespace BTCPayServer.Models.WalletViewModels
|
|||
if (UploadedPSBTFile.Length > 500 * 1024)
|
||||
return null;
|
||||
|
||||
using var stream = new StreamReader(UploadedPSBTFile.OpenReadStream());
|
||||
PSBT = await stream.ReadToEndAsync();
|
||||
try
|
||||
{
|
||||
byte[] bytes = new byte[UploadedPSBTFile.Length];
|
||||
await using (var stream = UploadedPSBTFile.OpenReadStream())
|
||||
{
|
||||
await stream.ReadAsync(bytes, 0, (int)UploadedPSBTFile.Length);
|
||||
}
|
||||
return NBitcoin.PSBT.Load(bytes, network);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
using var stream = new StreamReader(UploadedPSBTFile.OpenReadStream());
|
||||
PSBT = await stream.ReadToEndAsync();
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(PSBT))
|
||||
{
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
<button name="command" type="submit" class="dropdown-item" value="broadcast">Review</button>
|
||||
<button name="command" type="submit" class="dropdown-item" value="update">Update</button>
|
||||
<button name="command" type="submit" class="dropdown-item" value="combine">Combine</button>
|
||||
<button name="command" type="submit" class="dropdown-item" value="save-psbt">Download</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue