mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 01:43:50 +01:00
641bdcff31
* Histograms: Add Lightning data and API endpoints Ported over from the mobile-working-branch. Adds histogram data for Lightning and exposes the wallet/lightning histogram data via the API. It also add a dashboard graph for the Lightning balance. Caveat: The Lightning histogram is calculated by using the current channel balance and going backwards through as much invoices and transactions as we have. The "start" of the LN graph data might not be accurate though. That's because we don't track (and not even have) the LN onchain data. It is calculated by using the current channel balance and going backwards through as much invoices and transactions as we have. So the historic graph data for LN is basically a best effort of trying to reconstruct it with what we have: The LN channel transactions. * More timeframes * Refactoring: Remove redundant WalletHistogram types * Remove store property from dashboard tile view models * JS error fixes
31 lines
775 B
C#
31 lines
775 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using BTCPayServer.JsonConverters;
|
|
using NBitcoin.JsonConverters;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Converters;
|
|
|
|
namespace BTCPayServer.Client.Models;
|
|
|
|
public enum HistogramType
|
|
{
|
|
Week,
|
|
Month,
|
|
YTD,
|
|
Year,
|
|
TwoYears,
|
|
Day
|
|
}
|
|
|
|
public class HistogramData
|
|
{
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
public HistogramType Type { get; set; }
|
|
[JsonProperty(ItemConverterType = typeof(NumericStringJsonConverter))]
|
|
public List<decimal> Series { get; set; }
|
|
[JsonProperty(ItemConverterType = typeof(DateTimeToUnixTimeConverter))]
|
|
public List<DateTimeOffset> Labels { get; set; }
|
|
[JsonConverter(typeof(NumericStringJsonConverter))]
|
|
public decimal Balance { get; set; }
|
|
}
|