Add NetworkProvider.DefaultNetwork

This commit is contained in:
nicolas.dorier 2022-02-10 12:43:26 +09:00
parent 9e2f7fb048
commit 0afc2cd2cb
No known key found for this signature in database
GPG Key ID: 6618763EF09186FE
3 changed files with 4 additions and 3 deletions

View File

@ -93,6 +93,7 @@ namespace BTCPayServer
}
public BTCPayNetwork BTC => GetNetwork<BTCPayNetwork>("BTC");
public BTCPayNetworkBase DefaultNetwork => BTC ?? GetAll().First();
public void Add(BTCPayNetwork network)
{

View File

@ -451,8 +451,8 @@ namespace BTCPayServer.Controllers
case "cpfp":
if (selectedItems.Length == 0)
return NotSupported("No invoice has been selected");
var network = _NetworkProvider.BTC;
var explorer = _ExplorerClients.GetExplorerClient(_NetworkProvider.BTC);
var network = _NetworkProvider.DefaultNetwork;
var explorer = _ExplorerClients.GetExplorerClient(network);
IActionResult NotSupported(string err)
{
TempData[WellKnownTempData.ErrorMessage] = err;

View File

@ -4,7 +4,7 @@
@{
ViewData.SetActivePage(StoreNavPages.Dashboard, Model.StoreName, Model.StoreId);
var isReady = Model.WalletEnabled || Model.LightningEnabled;
var defaultCryptoCode = (networkProvider.BTC ?? networkProvider.GetAll().First()).CryptoCode;
var defaultCryptoCode = networkProvider.DefaultNetwork.CryptoCode;
}
<partial name="_StatusMessage" />