mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
Update lightning lib, on-chain balance shouldn't be lightmoney (#3945)
This commit is contained in:
@@ -28,7 +28,7 @@
|
|||||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
|
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BTCPayServer.Lightning.Common" Version="1.3.7" />
|
<PackageReference Include="BTCPayServer.Lightning.Common" Version="1.3.8" />
|
||||||
<PackageReference Include="NBitcoin" Version="7.0.1" />
|
<PackageReference Include="NBitcoin" Version="7.0.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using BTCPayServer.Client.JsonConverters;
|
using BTCPayServer.Client.JsonConverters;
|
||||||
using BTCPayServer.Lightning;
|
using BTCPayServer.Lightning;
|
||||||
|
using NBitcoin;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace BTCPayServer.Client.Models
|
namespace BTCPayServer.Client.Models
|
||||||
@@ -25,14 +26,14 @@ namespace BTCPayServer.Client.Models
|
|||||||
|
|
||||||
public class OnchainBalanceData
|
public class OnchainBalanceData
|
||||||
{
|
{
|
||||||
[JsonConverter(typeof(LightMoneyJsonConverter))]
|
[JsonConverter(typeof(JsonConverters.MoneyJsonConverter))]
|
||||||
public LightMoney Confirmed { get; set; }
|
public Money Confirmed { get; set; }
|
||||||
|
|
||||||
[JsonConverter(typeof(LightMoneyJsonConverter))]
|
[JsonConverter(typeof(JsonConverters.MoneyJsonConverter))]
|
||||||
public LightMoney Unconfirmed { get; set; }
|
public Money Unconfirmed { get; set; }
|
||||||
|
|
||||||
[JsonConverter(typeof(LightMoneyJsonConverter))]
|
[JsonConverter(typeof(JsonConverters.MoneyJsonConverter))]
|
||||||
public LightMoney Reserved { get; set; }
|
public Money Reserved { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OffchainBalanceData
|
public class OffchainBalanceData
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BIP78.Sender" Version="0.2.2" />
|
<PackageReference Include="BIP78.Sender" Version="0.2.2" />
|
||||||
<PackageReference Include="BTCPayServer.Hwi" Version="2.0.2" />
|
<PackageReference Include="BTCPayServer.Hwi" Version="2.0.2" />
|
||||||
<PackageReference Include="BTCPayServer.Lightning.All" Version="1.3.11" />
|
<PackageReference Include="BTCPayServer.Lightning.All" Version="1.3.12" />
|
||||||
<PackageReference Include="BuildBundlerMinifier" Version="3.2.449" />
|
<PackageReference Include="BuildBundlerMinifier" Version="3.2.449" />
|
||||||
<PackageReference Include="BundlerMinifier.Core" Version="3.2.435" />
|
<PackageReference Include="BundlerMinifier.Core" Version="3.2.435" />
|
||||||
<PackageReference Include="BundlerMinifier.TagHelpers" Version="3.2.435" />
|
<PackageReference Include="BundlerMinifier.TagHelpers" Version="3.2.435" />
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ public class StoreLightningBalance : ViewComponent
|
|||||||
var balance = await lightningClient.GetBalance();
|
var balance = await lightningClient.GetBalance();
|
||||||
vm.Balance = balance;
|
vm.Balance = balance;
|
||||||
vm.TotalOnchain = balance.OnchainBalance != null
|
vm.TotalOnchain = balance.OnchainBalance != null
|
||||||
? (balance.OnchainBalance.Confirmed?? 0) + (balance.OnchainBalance.Reserved ?? 0) +
|
? (balance.OnchainBalance.Confirmed?? 0L) + (balance.OnchainBalance.Reserved ?? 0L) +
|
||||||
(balance.OnchainBalance.Unconfirmed ?? 0)
|
(balance.OnchainBalance.Unconfirmed ?? 0L)
|
||||||
: null;
|
: null;
|
||||||
vm.TotalOffchain = balance.OffchainBalance != null
|
vm.TotalOffchain = balance.OffchainBalance != null
|
||||||
? (balance.OffchainBalance.Opening?? 0) + (balance.OffchainBalance.Local?? 0) +
|
? (balance.OffchainBalance.Opening?? 0) + (balance.OffchainBalance.Local?? 0) +
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using BTCPayServer.Data;
|
using BTCPayServer.Data;
|
||||||
using BTCPayServer.Lightning;
|
using BTCPayServer.Lightning;
|
||||||
using BTCPayServer.Services.Rates;
|
using BTCPayServer.Services.Rates;
|
||||||
|
using NBitcoin;
|
||||||
|
|
||||||
namespace BTCPayServer.Components.StoreLightningBalance;
|
namespace BTCPayServer.Components.StoreLightningBalance;
|
||||||
|
|
||||||
@@ -10,7 +11,7 @@ public class StoreLightningBalanceViewModel
|
|||||||
public string DefaultCurrency { get; set; }
|
public string DefaultCurrency { get; set; }
|
||||||
public CurrencyData CurrencyData { get; set; }
|
public CurrencyData CurrencyData { get; set; }
|
||||||
public StoreData Store { get; set; }
|
public StoreData Store { get; set; }
|
||||||
public LightMoney TotalOnchain { get; set; }
|
public Money TotalOnchain { get; set; }
|
||||||
public LightMoney TotalOffchain { get; set; }
|
public LightMoney TotalOffchain { get; set; }
|
||||||
public LightningNodeBalance Balance { get; set; }
|
public LightningNodeBalance Balance { get; set; }
|
||||||
public string ProblemDescription { get; set; }
|
public string ProblemDescription { get; set; }
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace BTCPayServer
|
|||||||
CreationStore.Remove(userId, out _);
|
CreationStore.Remove(userId, out _);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ namespace BTCPayServer.Controllers
|
|||||||
assetBalance.FormattedFiatValue = _currencyNameTable.DisplayFormatCurrency(pair.Value.Qty * quote.Bid, pair.Value.FiatAsset);
|
assetBalance.FormattedFiatValue = _currencyNameTable.DisplayFormatCurrency(pair.Value.Qty * quote.Bid, pair.Value.FiatAsset);
|
||||||
assetBalance.TradableAssetPairs = tradableAssetPairs.Where(o => o.AssetBought == asset || o.AssetSold == asset);
|
assetBalance.TradableAssetPairs = tradableAssetPairs.Where(o => o.AssetBought == asset || o.AssetSold == asset);
|
||||||
}
|
}
|
||||||
catch (WrongTradingPairException e)
|
catch (WrongTradingPairException)
|
||||||
{
|
{
|
||||||
// Cannot trade this asset, just ignore
|
// Cannot trade this asset, just ignore
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using BTCPayServer.Client.Models;
|
using BTCPayServer.Client.Models;
|
||||||
using BTCPayServer.Data;
|
using BTCPayServer.Data;
|
||||||
using BTCPayServer.Data;
|
|
||||||
using BTCPayServer.Payments;
|
using BTCPayServer.Payments;
|
||||||
using BTCPayServer.Payments.Bitcoin;
|
using BTCPayServer.Payments.Bitcoin;
|
||||||
using BTCPayServer.Services.Invoices;
|
using BTCPayServer.Services.Invoices;
|
||||||
|
|||||||
@@ -68,6 +68,6 @@ namespace BTCPayServer.Models.InvoicingModels
|
|||||||
public bool RedirectAutomatically { get; set; }
|
public bool RedirectAutomatically { get; set; }
|
||||||
public bool Activated { get; set; }
|
public bool Activated { get; set; }
|
||||||
public string InvoiceCurrency { get; set; }
|
public string InvoiceCurrency { get; set; }
|
||||||
public string? ReceiptLink { get; set; }
|
public string ReceiptLink { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,17 +219,17 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"confirmed": {
|
"confirmed": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The confirmed amount in millisatoshi",
|
"description": "The confirmed amount in satoshi",
|
||||||
"nullable": true
|
"nullable": true
|
||||||
},
|
},
|
||||||
"unconfirmed": {
|
"unconfirmed": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The unconfirmed amount in millisatoshi",
|
"description": "The unconfirmed amount in satoshi",
|
||||||
"nullable": true
|
"nullable": true
|
||||||
},
|
},
|
||||||
"reserved": {
|
"reserved": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The reserved amount in millisatoshi",
|
"description": "The reserved amount in satoshi",
|
||||||
"nullable": true
|
"nullable": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,9 +56,9 @@ public class FakeCustodian : ICustodian
|
|||||||
return Task.FromResult(form);
|
return Task.FromResult(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
private FakeCustodianConfig? ParseConfig(JObject config)
|
private FakeCustodianConfig ParseConfig(JObject config)
|
||||||
{
|
{
|
||||||
return config?.ToObject<FakeCustodianConfig>();
|
return config?.ToObject<FakeCustodianConfig>() ?? throw new InvalidOperationException("Invalid config");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user