mirror of
https://github.com/status-im/nft-faucet.git
synced 2025-02-22 19:48:25 +00:00
Add networks ordering (withing one network type)
This commit is contained in:
parent
bd5dd42933
commit
168ee3bd16
@ -6,12 +6,12 @@
|
||||
<RadzenHeading Size="H1" Text="Select network" />
|
||||
<RadzenTabs RenderMode="TabRenderMode.Client">
|
||||
<Tabs>
|
||||
@if (NetworksLookup != null)
|
||||
@if (Networks != null)
|
||||
{
|
||||
foreach (var grouping in NetworksLookup)
|
||||
foreach (var kvp in Networks)
|
||||
{
|
||||
var networkType = grouping.Key;
|
||||
var networks = grouping.ToArray();
|
||||
var networkType = kvp.Key;
|
||||
var networks = kvp.Value;
|
||||
<RadzenTabsItem Text="@networkType.ToString()">
|
||||
<CardList Data="@networks" @bind-SelectedItems="@AppState.Storage.SelectedNetworks"/>
|
||||
</RadzenTabsItem>
|
||||
|
@ -28,11 +28,11 @@ public partial class NetworkPage : BasicComponent
|
||||
{
|
||||
PluginLoader?.EnsurePluginsLoaded();
|
||||
var networkPlugins = PluginLoader?.NetworkPlugins;
|
||||
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);
|
||||
var networks = networkPlugins?.SelectMany(x => x?.Networks).Where(x => x != null).ToArray() ?? Array.Empty<INetwork>();
|
||||
Networks = networks.GroupBy(x => x.Type).ToDictionary(x => x.Key, x => x.OrderBy(v => v.Order ?? int.MaxValue).Select(MapCardListItem).ToArray());
|
||||
}
|
||||
|
||||
private ILookup<NetworkType, CardListItem> NetworksLookup { get; set; }
|
||||
private Dictionary<NetworkType, CardListItem[]> Networks { get; set; }
|
||||
|
||||
private static CardListItem MapCardListItem(INetwork model)
|
||||
=> new CardListItem
|
||||
|
@ -9,5 +9,6 @@ public class ArbitrumNetworkPlugin : INetworkPlugin
|
||||
new ArbitrumOneNetwork(),
|
||||
new ArbitrumNovaNetwork(),
|
||||
new ArbitrumRinkebyNetwork(),
|
||||
new ArbitrumGoerliNetwork(),
|
||||
};
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ public class ArbitrumGoerliNetwork : INetwork
|
||||
public string Name { get; } = "Arbitrum Goerli";
|
||||
public string ShortName { get; } = "ArbGoerli";
|
||||
public ulong? ChainId { get; } = 421613;
|
||||
public int? Order { get; } = 4;
|
||||
public string Currency { get; } = "AGOR";
|
||||
public string ImageName { get; } = "arbitrum-black.svg";
|
||||
public bool IsSupported { get; } = true;
|
||||
|
@ -6,6 +6,7 @@ public class ArbitrumNovaNetwork : INetwork
|
||||
public string Name { get; } = "Arbitrum Nova";
|
||||
public string ShortName { get; } = "ArbNova";
|
||||
public ulong? ChainId { get; } = 42170;
|
||||
public int? Order { get; } = 2;
|
||||
public string Currency { get; } = "ETH";
|
||||
public string ImageName { get; } = "arbitrum-black.svg";
|
||||
public bool IsSupported { get; } = false;
|
||||
|
@ -6,6 +6,7 @@ public class ArbitrumOneNetwork : INetwork
|
||||
public string Name { get; } = "Arbitrum One";
|
||||
public string ShortName { get; } = "Arbitrum";
|
||||
public ulong? ChainId { get; } = 42161;
|
||||
public int? Order { get; } = 1;
|
||||
public string Currency { get; } = "ETH";
|
||||
public string ImageName { get; } = "arbitrum.svg";
|
||||
public bool IsSupported { get; } = false;
|
||||
|
@ -6,6 +6,7 @@ public class ArbitrumRinkebyNetwork : INetwork
|
||||
public string Name { get; } = "Arbitrum Rinkeby";
|
||||
public string ShortName { get; } = "ArbRinkeby";
|
||||
public ulong? ChainId { get; } = 421611;
|
||||
public int? Order { get; } = 3;
|
||||
public string Currency { get; } = "ETH";
|
||||
public string ImageName { get; } = "arbitrum-black.svg";
|
||||
public bool IsSupported { get; } = true;
|
||||
|
@ -6,6 +6,7 @@ public class AvalancheFujiNetwork : INetwork
|
||||
public string Name { get; } = "Avalanche Fuji Testnet";
|
||||
public string ShortName { get; } = "Fuji";
|
||||
public ulong? ChainId { get; } = 43113;
|
||||
public int? Order { get; } = 2;
|
||||
public string Currency { get; } = "AVAX";
|
||||
public string ImageName { get; } = "avalanche-black.svg";
|
||||
public bool IsSupported { get; } = true;
|
||||
|
@ -6,6 +6,7 @@ public class AvalancheMainnetNetwork : INetwork
|
||||
public string Name { get; } = "Avalanche C-Chain";
|
||||
public string ShortName { get; } = "Avalanche";
|
||||
public ulong? ChainId { get; } = 43114;
|
||||
public int? Order { get; } = 1;
|
||||
public string Currency { get; } = "AVAX";
|
||||
public string ImageName { get; } = "avalanche.svg";
|
||||
public bool IsSupported { get; } = false;
|
||||
|
@ -6,6 +6,7 @@ public class BscMainnetNetwork : INetwork
|
||||
public string Name { get; } = "Binance Smart Chain";
|
||||
public string ShortName { get; } = "BSC";
|
||||
public ulong? ChainId { get; } = 56;
|
||||
public int? Order { get; } = 1;
|
||||
public string Currency { get; } = "BNB";
|
||||
public string ImageName { get; } = "bnb.svg";
|
||||
public bool IsSupported { get; } = false;
|
||||
|
@ -6,6 +6,7 @@ public class BscTestnetNetwork : INetwork
|
||||
public string Name { get; } = "Binance Smart Chain Testnet";
|
||||
public string ShortName { get; } = "BSC test";
|
||||
public ulong? ChainId { get; } = 97;
|
||||
public int? Order { get; } = 2;
|
||||
public string Currency { get; } = "tBNB";
|
||||
public string ImageName { get; } = "bnb-black.svg";
|
||||
public bool IsSupported { get; } = true;
|
||||
|
@ -6,6 +6,7 @@ public class CustomNetwork : INetwork
|
||||
public string Name { get; } = "Custom";
|
||||
public string ShortName { get; } = "custom";
|
||||
public ulong? ChainId { get; } = null;
|
||||
public int? Order { get; } = 8;
|
||||
public string Currency { get; } = null;
|
||||
public string ImageName { get; } = "ethereum-gray.svg";
|
||||
public bool IsSupported { get; } = false;
|
||||
|
@ -6,6 +6,7 @@ public class EthereumMainnetNetwork : INetwork
|
||||
public string Name { get; } = "Mainnet";
|
||||
public string ShortName { get; } = "Mainnet";
|
||||
public ulong? ChainId { get; } = 1;
|
||||
public int? Order { get; } = 1;
|
||||
public string Currency { get; } = "ETH";
|
||||
public string ImageName { get; } = "ethereum.svg";
|
||||
public bool IsSupported { get; } = false;
|
||||
|
@ -6,6 +6,7 @@ public class GoerliNetwork : INetwork
|
||||
public string Name { get; } = "Goerli";
|
||||
public string ShortName { get; } = "Goerli";
|
||||
public ulong? ChainId { get; } = 5;
|
||||
public int? Order { get; } = 4;
|
||||
public string Currency { get; } = "ETH";
|
||||
public string ImageName { get; } = "ethereum-gray.svg";
|
||||
public bool IsSupported { get; } = true;
|
||||
|
@ -6,6 +6,7 @@ public class KilnNetwork : INetwork
|
||||
public string Name { get; } = "Kiln";
|
||||
public string ShortName { get; } = "Kiln";
|
||||
public ulong? ChainId { get; } = 1337802;
|
||||
public int? Order { get; } = 6;
|
||||
public string Currency { get; } = "ETH";
|
||||
public string ImageName { get; } = "ethereum-gray.svg";
|
||||
public bool IsSupported { get; } = false;
|
||||
|
@ -6,6 +6,7 @@ public class KovanNetwork : INetwork
|
||||
public string Name { get; } = "Kovan";
|
||||
public string ShortName { get; } = "Kovan";
|
||||
public ulong? ChainId { get; } = 42;
|
||||
public int? Order { get; } = 5;
|
||||
public string Currency { get; } = "ETH";
|
||||
public string ImageName { get; } = "ethereum-gray.svg";
|
||||
public bool IsSupported { get; } = true;
|
||||
|
@ -6,6 +6,7 @@ public class RinkebyNetwork : INetwork
|
||||
public string Name { get; } = "Rinkeby";
|
||||
public string ShortName { get; } = "Rinkeby";
|
||||
public ulong? ChainId { get; } = 4;
|
||||
public int? Order { get; } = 3;
|
||||
public string Currency { get; } = "ETH";
|
||||
public string ImageName { get; } = "ethereum-gray.svg";
|
||||
public bool IsSupported { get; } = true;
|
||||
|
@ -6,6 +6,7 @@ public class RopstenNetwork : INetwork
|
||||
public string Name { get; } = "Ropsten";
|
||||
public string ShortName { get; } = "Ropsten";
|
||||
public ulong? ChainId { get; } = 3;
|
||||
public int? Order { get; } = 2;
|
||||
public string Currency { get; } = "ETH";
|
||||
public string ImageName { get; } = "ethereum-gray.svg";
|
||||
public bool IsSupported { get; } = true;
|
||||
|
@ -6,6 +6,7 @@ public class SepoliaNetwork : INetwork
|
||||
public string Name { get; } = "Sepolia";
|
||||
public string ShortName { get; } = "Sepolia";
|
||||
public ulong? ChainId { get; } = 11155111;
|
||||
public int? Order { get; } = 7;
|
||||
public string Currency { get; } = "SEP";
|
||||
public string ImageName { get; } = "ethereum-gray.svg";
|
||||
public bool IsSupported { get; } = false;
|
||||
|
@ -6,6 +6,7 @@ public interface INetwork
|
||||
public string Name { get; }
|
||||
public string ShortName { get; }
|
||||
public ulong? ChainId { get; }
|
||||
public int? Order { get; }
|
||||
public string Currency { get; }
|
||||
public string ImageName { get; }
|
||||
public bool IsSupported { get; }
|
||||
|
@ -6,6 +6,7 @@ public class MoonbaseAlphaNetwork : INetwork
|
||||
public string Name { get; } = "Moonbase Alpha";
|
||||
public string ShortName { get; } = "MoonAlpha";
|
||||
public ulong? ChainId { get; } = 1287;
|
||||
public int? Order { get; } = 3;
|
||||
public string Currency { get; } = "DEV";
|
||||
public string ImageName { get; } = "moonbeam-black.svg";
|
||||
public bool IsSupported { get; } = true;
|
||||
|
@ -6,6 +6,7 @@ public class MoonbeamNetwork : INetwork
|
||||
public string Name { get; } = "Moonbeam";
|
||||
public string ShortName { get; } = "Moonbeam";
|
||||
public ulong? ChainId { get; } = 1284;
|
||||
public int? Order { get; } = 1;
|
||||
public string Currency { get; } = "GLMR";
|
||||
public string ImageName { get; } = "moonbeam.svg";
|
||||
public bool IsSupported { get; } = false;
|
||||
|
@ -6,6 +6,7 @@ public class MoonriverNetwork : INetwork
|
||||
public string Name { get; } = "Moonriver";
|
||||
public string ShortName { get; } = "Moonriver";
|
||||
public ulong? ChainId { get; } = 1285;
|
||||
public int? Order { get; } = 2;
|
||||
public string Currency { get; } = "MOVR";
|
||||
public string ImageName { get; } = "moonriver.svg";
|
||||
public bool IsSupported { get; } = false;
|
||||
|
@ -6,6 +6,7 @@ public class OptimismGoerliNetwork : INetwork
|
||||
public string Name { get; } = "Optimism Goerli";
|
||||
public string ShortName { get; } = "OpGoerli";
|
||||
public ulong? ChainId { get; } = 420;
|
||||
public int? Order { get; } = 3;
|
||||
public string Currency { get; } = "ETH";
|
||||
public string ImageName { get; } = "optimism-black.svg";
|
||||
public bool IsSupported { get; } = false;
|
||||
|
@ -6,6 +6,7 @@ public class OptimismKovanNetwork : INetwork
|
||||
public string Name { get; } = "Optimism Kovan";
|
||||
public string ShortName { get; } = "OpKovan";
|
||||
public ulong? ChainId { get; } = 69;
|
||||
public int? Order { get; } = 2;
|
||||
public string Currency { get; } = "ETH";
|
||||
public string ImageName { get; } = "optimism-black.svg";
|
||||
public bool IsSupported { get; } = true;
|
||||
|
@ -6,6 +6,7 @@ public class OptimismMainnetNetwork : INetwork
|
||||
public string Name { get; } = "Optimism";
|
||||
public string ShortName { get; } = "Optimism";
|
||||
public ulong? ChainId { get; } = 10;
|
||||
public int? Order { get; } = 1;
|
||||
public string Currency { get; } = "ETH";
|
||||
public string ImageName { get; } = "optimism.svg";
|
||||
public bool IsSupported { get; } = false;
|
||||
|
@ -6,6 +6,7 @@ public class PolygonMainnetNetwork : INetwork
|
||||
public string Name { get; } = "Polygon";
|
||||
public string ShortName { get; } = "Polygon";
|
||||
public ulong? ChainId { get; } = 137;
|
||||
public int? Order { get; } = 1;
|
||||
public string Currency { get; } = "MATIC";
|
||||
public string ImageName { get; } = "polygon.svg";
|
||||
public bool IsSupported { get; } = false;
|
||||
|
@ -6,6 +6,7 @@ public class PolygonMumbaiNetwork : INetwork
|
||||
public string Name { get; } = "Polygon Mumbai";
|
||||
public string ShortName { get; } = "Mumbai";
|
||||
public ulong? ChainId { get; } = 80001;
|
||||
public int? Order { get; } = 2;
|
||||
public string Currency { get; } = "MATIC";
|
||||
public string ImageName { get; } = "polygon-black.svg";
|
||||
public bool IsSupported { get; } = true;
|
||||
|
@ -6,6 +6,7 @@ public class SolanaDevnetNetwork : INetwork
|
||||
public string Name { get; } = "Solana Devnet";
|
||||
public string ShortName { get; } = "SolDevnet";
|
||||
public ulong? ChainId { get; } = null;
|
||||
public int? Order { get; } = 2;
|
||||
public string Currency { get; } = "SOL";
|
||||
public string ImageName { get; } = "solana-black.svg";
|
||||
public bool IsSupported { get; } = true;
|
||||
|
@ -6,6 +6,7 @@ public class SolanaMainnetNetwork : INetwork
|
||||
public string Name { get; } = "Solana Mainnet";
|
||||
public string ShortName { get; } = "Solana";
|
||||
public ulong? ChainId { get; } = null;
|
||||
public int? Order { get; } = 1;
|
||||
public string Currency { get; } = "SOL";
|
||||
public string ImageName { get; } = "solana.svg";
|
||||
public bool IsSupported { get; } = false;
|
||||
|
@ -6,6 +6,7 @@ public class SolanaTestnetNetwork : INetwork
|
||||
public string Name { get; } = "Solana Testnet";
|
||||
public string ShortName { get; } = "SolTestnet";
|
||||
public ulong? ChainId { get; } = null;
|
||||
public int? Order { get; } = 3;
|
||||
public string Currency { get; } = "SOL";
|
||||
public string ImageName { get; } = "solana-black.svg";
|
||||
public bool IsSupported { get; } = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user