add additional info

This commit is contained in:
Kukks 2024-06-21 08:26:43 +02:00 committed by Dennis Reimann
parent a6293d21c2
commit a05212923b
No known key found for this signature in database
GPG key ID: 5009E1797F03F8D0
2 changed files with 20 additions and 3 deletions

View file

@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text.Json;
using BTCPayServer.Lightning;
using Newtonsoft.Json;
namespace BTCPayApp.CommonServer.Models;
@ -17,6 +20,9 @@ public partial class LightningPayment
//you can have multiple requests generated for the same payment hash, but once you reveal the preimage, you should reject any attempt to pay the same payment hash
public List<string> PaymentRequests { get; set; }
[JsonIgnore]
public Dictionary<string, JsonDocument> AdditionalData { get; set; }
}
public class AppUserInfo

View file

@ -145,18 +145,29 @@ public class BTCPayAppHub : Hub<IBTCPayAppHubClient>, IBTCPayAppHubServer
public async Task<decimal> GetFeeRate(int blockTarget)
{
_logger.LogInformation($"Getting fee rate for {blockTarget}");
var feeProvider = _feeProviderFactory.CreateFeeProvider( _btcPayNetworkProvider.BTC);
return (await feeProvider.GetFeeRateAsync(blockTarget)).SatoshiPerByte;
try
{
return (await feeProvider.GetFeeRateAsync(blockTarget)).SatoshiPerByte;
}
finally
{
_logger.LogInformation($"Getting fee rate for {blockTarget} done");
}
}
public async Task<BestBlockResponse> GetBestBlock()
{
_logger.LogInformation($"Getting best block");
var explorerClient = _explorerClientProvider.GetExplorerClient( _btcPayNetworkProvider.BTC);
var bcInfo = await explorerClient.RPCClient.GetBlockchainInfoAsyncEx();
var bh = await GetBlockHeader(bcInfo.BestBlockHash.ToString());
_logger.LogInformation($"Getting best block done");
return new BestBlockResponse()
{
BlockHash = bcInfo.BestBlockHash.ToString(),