Remove references to cryptoCode in SyncStatus (#6275)

This commit is contained in:
Nicolas Dorier 2024-10-04 16:58:31 +09:00 committed by GitHub
parent 5190c25be0
commit 2e114d7c29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 21 additions and 10 deletions

View File

@ -12,7 +12,7 @@ namespace BTCPayServer.Abstractions.Contracts
public interface ISyncStatus
{
public string CryptoCode { get; set; }
public string PaymentMethodId { get; set; }
public bool Available { get; }
}
}

View File

@ -32,7 +32,7 @@ namespace BTCPayServer.Client.Models
public class SyncStatus
{
public string CryptoCode { get; set; }
public string PaymentMethodId { get; set; }
public virtual bool Available { get; set; }
}

View File

@ -1979,7 +1979,7 @@ namespace BTCPayServer.Tests
Assert.Contains("BTC-CHAIN", serverInfoData.SupportedPaymentMethods);
Assert.Contains("BTC-LN", serverInfoData.SupportedPaymentMethods);
Assert.NotNull(serverInfoData.SyncStatus);
Assert.Single(serverInfoData.SyncStatus.Select(s => s.CryptoCode == "BTC"));
Assert.Single(serverInfoData.SyncStatus.Select(s => s.PaymentMethodId == "BTC-CHAIN"));
}
[Fact(Timeout = TestTimeout)]

View File

@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Linq;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Client.Models;
using BTCPayServer.Payments;
namespace BTCPayServer.Services.Altcoins.Monero.Services
{
@ -24,13 +25,18 @@ namespace BTCPayServer.Services.Altcoins.Monero.Services
{
return _moneroRpcProvider.Summaries.Select(pair => new MoneroSyncStatus()
{
Summary = pair.Value, CryptoCode = pair.Key
Summary = pair.Value, PaymentMethodId = PaymentMethodId.Parse(pair.Key)
});
}
}
public class MoneroSyncStatus: SyncStatus, ISyncStatus
{
public new PaymentMethodId PaymentMethodId
{
get => PaymentMethodId.Parse(base.PaymentMethodId);
set => base.PaymentMethodId = value.ToString();
}
public override bool Available
{
get

View File

@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Linq;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Client.Models;
using BTCPayServer.Payments;
namespace BTCPayServer.Services.Altcoins.Zcash.Services
{
@ -24,13 +25,18 @@ namespace BTCPayServer.Services.Altcoins.Zcash.Services
{
return _ZcashRpcProvider.Summaries.Select(pair => new ZcashSyncStatus()
{
Summary = pair.Value, CryptoCode = pair.Key
Summary = pair.Value, PaymentMethodId = PaymentMethodId.Parse(pair.Key)
});
}
}
public class ZcashSyncStatus: SyncStatus, ISyncStatus
{
public new PaymentMethodId PaymentMethodId
{
get => PaymentMethodId.Parse(base.PaymentMethodId);
set => base.PaymentMethodId = value.ToString();
}
public override bool Available
{
get

View File

@ -3,6 +3,7 @@ using System.Linq;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Client.Models;
using BTCPayServer.HostedServices;
using BTCPayServer.Payments;
using NBXplorer.Models;
namespace BTCPayServer.Services
@ -28,7 +29,7 @@ namespace BTCPayServer.Services
.Where(summary => summary.Network.ShowSyncSummary)
.Select(summary => new ServerInfoSyncStatusData2
{
CryptoCode = summary.Network.CryptoCode,
PaymentMethodId = PaymentTypes.CHAIN.GetPaymentMethodId(summary.Network.CryptoCode).ToString(),
NodeInformation = summary.Status.BitcoinStatus is BitcoinStatus s ? new ServerInfoNodeData()
{
Headers = s.Headers,

View File

@ -143,10 +143,8 @@
"type": "object",
"description": "Detailed sync status",
"properties": {
"cryptoCode": {
"type": "string",
"description": "The CryptoCode of the crypto currency (eg. BTC)",
"example": "BTC"
"paymentMethodId": {
"$ref": "#/components/schemas/PaymentMethodId"
},
"nodeInformation": {
"$ref": "#/components/schemas/ApplicationServerInfoNodeStatusData"