mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-01-06 23:54:28 +01:00
add download psbt action
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -38,8 +39,20 @@ namespace BTCPayServer.Models.WalletViewModels
|
|||||||
if (UploadedPSBTFile.Length > 500 * 1024)
|
if (UploadedPSBTFile.Length > 500 * 1024)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
using var stream = new StreamReader(UploadedPSBTFile.OpenReadStream());
|
try
|
||||||
PSBT = await stream.ReadToEndAsync();
|
{
|
||||||
|
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))
|
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="broadcast">Review</button>
|
||||||
<button name="command" type="submit" class="dropdown-item" value="update">Update</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="combine">Combine</button>
|
||||||
|
<button name="command" type="submit" class="dropdown-item" value="save-psbt">Download</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user