mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-02-23 15:14:49 +01:00
add download psbt action
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user