mirror of
https://github.com/status-im/nft-faucet.git
synced 2025-02-22 19:48:25 +00:00
Change GetNetworks method to Networks property (and same for GetProviders)
This commit is contained in:
parent
4e62e048e3
commit
bd5dd42933
@ -28,7 +28,7 @@ public partial class NetworkPage : BasicComponent
|
||||
{
|
||||
PluginLoader?.EnsurePluginsLoaded();
|
||||
var networkPlugins = PluginLoader?.NetworkPlugins;
|
||||
var networks = networkPlugins?.SelectMany(x => x?.GetNetworks()).Where(x => x != null).OrderBy(x => x.ChainId ?? ulong.MaxValue).ToArray() ?? Array.Empty<INetwork>();
|
||||
var networks = networkPlugins?.SelectMany(x => x?.Networks).Where(x => x != null).OrderBy(x => x.ChainId ?? ulong.MaxValue).ToArray() ?? Array.Empty<INetwork>();
|
||||
NetworksLookup = networks.ToLookup(x => x.Type, MapCardListItem);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ public partial class ProviderPage : BasicComponent
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
Providers = PluginLoader?.ProviderPlugins?.SelectMany(x => x.GetProviders()).Where(x => x != null).ToArray() ?? Array.Empty<IProvider>();
|
||||
Providers = PluginLoader?.ProviderPlugins?.SelectMany(x => x.Providers).Where(x => x != null).ToArray() ?? Array.Empty<IProvider>();
|
||||
RefreshData();
|
||||
}
|
||||
|
||||
|
@ -4,12 +4,10 @@ namespace NftFaucetRadzen.Plugins.NetworkPlugins.Arbitrum;
|
||||
|
||||
public class ArbitrumNetworkPlugin : INetworkPlugin
|
||||
{
|
||||
private IReadOnlyCollection<INetwork> Networks { get; } = new INetwork[]
|
||||
public IReadOnlyCollection<INetwork> Networks { get; } = new INetwork[]
|
||||
{
|
||||
new ArbitrumOneNetwork(),
|
||||
new ArbitrumNovaNetwork(),
|
||||
new ArbitrumRinkebyNetwork(),
|
||||
};
|
||||
|
||||
public IReadOnlyCollection<INetwork> GetNetworks() => Networks;
|
||||
}
|
||||
|
@ -4,11 +4,9 @@ namespace NftFaucetRadzen.Plugins.NetworkPlugins.Avalanche;
|
||||
|
||||
public class AvalancheNetworkPlugin : INetworkPlugin
|
||||
{
|
||||
private IReadOnlyCollection<INetwork> Networks { get; } = new INetwork[]
|
||||
public IReadOnlyCollection<INetwork> Networks { get; } = new INetwork[]
|
||||
{
|
||||
new AvalancheMainnetNetwork(),
|
||||
new AvalancheFujiNetwork(),
|
||||
};
|
||||
|
||||
public IReadOnlyCollection<INetwork> GetNetworks() => Networks;
|
||||
}
|
||||
|
@ -4,11 +4,9 @@ namespace NftFaucetRadzen.Plugins.NetworkPlugins.BinanceSmartChain;
|
||||
|
||||
public class BscNetworkPlugin : INetworkPlugin
|
||||
{
|
||||
private IReadOnlyCollection<INetwork> Networks { get; } = new INetwork[]
|
||||
public IReadOnlyCollection<INetwork> Networks { get; } = new INetwork[]
|
||||
{
|
||||
new BscMainnetNetwork(),
|
||||
new BscTestnetNetwork(),
|
||||
};
|
||||
|
||||
public IReadOnlyCollection<INetwork> GetNetworks() => Networks;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ namespace NftFaucetRadzen.Plugins.NetworkPlugins.Ethereum;
|
||||
|
||||
public class EthereumNetworkPlugin : INetworkPlugin
|
||||
{
|
||||
private IReadOnlyCollection<INetwork> Networks { get; } = new INetwork[]
|
||||
public IReadOnlyCollection<INetwork> Networks { get; } = new INetwork[]
|
||||
{
|
||||
new EthereumMainnetNetwork(),
|
||||
new RopstenNetwork(),
|
||||
@ -15,6 +15,4 @@ public class EthereumNetworkPlugin : INetworkPlugin
|
||||
new SepoliaNetwork(),
|
||||
new CustomNetwork(),
|
||||
};
|
||||
|
||||
public IReadOnlyCollection<INetwork> GetNetworks() => Networks;
|
||||
}
|
||||
|
@ -2,5 +2,5 @@ namespace NftFaucetRadzen.Plugins.NetworkPlugins;
|
||||
|
||||
public interface INetworkPlugin
|
||||
{
|
||||
public IReadOnlyCollection<INetwork> GetNetworks();
|
||||
public IReadOnlyCollection<INetwork> Networks { get; }
|
||||
}
|
||||
|
@ -4,12 +4,10 @@ namespace NftFaucetRadzen.Plugins.NetworkPlugins.Moonbeam;
|
||||
|
||||
public class MoonbeamNetworkPlugin : INetworkPlugin
|
||||
{
|
||||
private IReadOnlyCollection<INetwork> Networks { get; } = new INetwork[]
|
||||
public IReadOnlyCollection<INetwork> Networks { get; } = new INetwork[]
|
||||
{
|
||||
new MoonbeamNetwork(),
|
||||
new MoonriverNetwork(),
|
||||
new MoonbaseAlphaNetwork(),
|
||||
};
|
||||
|
||||
public IReadOnlyCollection<INetwork> GetNetworks() => Networks;
|
||||
}
|
||||
|
@ -4,12 +4,10 @@ namespace NftFaucetRadzen.Plugins.NetworkPlugins.Optimism;
|
||||
|
||||
public class OptimismNetworkPlugin : INetworkPlugin
|
||||
{
|
||||
private IReadOnlyCollection<INetwork> Networks { get; } = new INetwork[]
|
||||
public IReadOnlyCollection<INetwork> Networks { get; } = new INetwork[]
|
||||
{
|
||||
new OptimismMainnetNetwork(),
|
||||
new OptimismKovanNetwork(),
|
||||
new OptimismGoerliNetwork(),
|
||||
};
|
||||
|
||||
public IReadOnlyCollection<INetwork> GetNetworks() => Networks;
|
||||
}
|
||||
|
@ -4,11 +4,9 @@ namespace NftFaucetRadzen.Plugins.NetworkPlugins.Polygon;
|
||||
|
||||
public class PolygonNetworkPlugin : INetworkPlugin
|
||||
{
|
||||
private IReadOnlyCollection<INetwork> Networks { get; } = new INetwork[]
|
||||
public IReadOnlyCollection<INetwork> Networks { get; } = new INetwork[]
|
||||
{
|
||||
new PolygonMainnetNetwork(),
|
||||
new PolygonMumbaiNetwork(),
|
||||
};
|
||||
|
||||
public IReadOnlyCollection<INetwork> GetNetworks() => Networks;
|
||||
}
|
||||
|
@ -4,12 +4,10 @@ namespace NftFaucetRadzen.Plugins.NetworkPlugins.Solana;
|
||||
|
||||
public class SolanaNetworkPlugin : INetworkPlugin
|
||||
{
|
||||
private IReadOnlyCollection<INetwork> Networks { get; } = new INetwork[]
|
||||
public IReadOnlyCollection<INetwork> Networks { get; } = new INetwork[]
|
||||
{
|
||||
new SolanaMainnetNetwork(),
|
||||
new SolanaDevnetNetwork(),
|
||||
new SolanaTestnetNetwork(),
|
||||
};
|
||||
|
||||
public IReadOnlyCollection<INetwork> GetNetworks() => Networks;
|
||||
}
|
||||
|
@ -4,10 +4,8 @@ namespace NftFaucetRadzen.Plugins.ProviderPlugins.GeneratedKeys;
|
||||
|
||||
public class GeneratedKeysProviderPlugin : IProviderPlugin
|
||||
{
|
||||
private IReadOnlyCollection<IProvider> Providers { get; } = new IProvider[]
|
||||
public IReadOnlyCollection<IProvider> Providers { get; } = new IProvider[]
|
||||
{
|
||||
new GeneratedKeysProvider(),
|
||||
};
|
||||
|
||||
public IReadOnlyCollection<IProvider> GetProviders() => Providers;
|
||||
}
|
||||
|
@ -2,5 +2,5 @@ namespace NftFaucetRadzen.Plugins.ProviderPlugins;
|
||||
|
||||
public interface IProviderPlugin
|
||||
{
|
||||
public IReadOnlyCollection<IProvider> GetProviders();
|
||||
public IReadOnlyCollection<IProvider> Providers { get; }
|
||||
}
|
||||
|
@ -4,10 +4,8 @@ namespace NftFaucetRadzen.Plugins.ProviderPlugins.Metamask;
|
||||
|
||||
public class MetamaskProviderPlugin : IProviderPlugin
|
||||
{
|
||||
private IReadOnlyCollection<IProvider> Providers { get; } = new IProvider[]
|
||||
public IReadOnlyCollection<IProvider> Providers { get; } = new IProvider[]
|
||||
{
|
||||
new MetamaskProvider(),
|
||||
};
|
||||
|
||||
public IReadOnlyCollection<IProvider> GetProviders() => Providers;
|
||||
}
|
||||
|
@ -7,9 +7,9 @@ namespace NftFaucetRadzen.Shared;
|
||||
public partial class NavMenu : BasicComponent
|
||||
{
|
||||
protected Guid? SelectedNetworkId => AppState?.Storage?.SelectedNetworks?.FirstOrDefault();
|
||||
protected string SelectedNetworkName => PluginLoader?.NetworkPlugins?.SelectMany(x => x.GetNetworks()).FirstOrDefault(x => x.Id == SelectedNetworkId)?.ShortName;
|
||||
protected string SelectedNetworkName => PluginLoader?.NetworkPlugins?.SelectMany(x => x?.Networks).FirstOrDefault(x => x?.Id == SelectedNetworkId)?.ShortName;
|
||||
protected Guid? SelectedProviderId => AppState?.Storage?.SelectedProviders?.FirstOrDefault();
|
||||
protected string SelectedProviderName => PluginLoader?.ProviderPlugins?.SelectMany(x => x.GetProviders()).FirstOrDefault(x => x.Id == SelectedProviderId)?.ShortName;
|
||||
protected string SelectedProviderName => PluginLoader?.ProviderPlugins?.SelectMany(x => x?.Providers).FirstOrDefault(x => x?.Id == SelectedProviderId)?.ShortName;
|
||||
|
||||
private bool CollapseNavMenu { get; set; } = true;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user