Add more interfaces and abstract classes

This commit is contained in:
Ivan Yaremenchuk 2022-10-02 19:37:09 -05:00
parent a0c05f3bbf
commit 407e12ab31
56 changed files with 575 additions and 657 deletions

View File

@ -0,0 +1,10 @@
using CSharpFunctionalExtensions;
namespace NftFaucet.Plugins.Models.Abstraction;
public interface IConfigurable
{
public bool IsConfigured { get; }
public ConfigurationItem[] GetConfigurationItems();
public Task<Result> Configure(ConfigurationItem[] configurationItems);
}

View File

@ -0,0 +1,6 @@
namespace NftFaucet.Plugins.Models.Abstraction;
public interface IEntityWithProperties
{
public Property[] GetProperties();
}

View File

@ -0,0 +1,7 @@
namespace NftFaucet.Plugins.Models.Abstraction;
public interface IInitializable
{
public bool IsInitialized { get; }
public Task InitializeAsync(IServiceProvider serviceProvider);
}

View File

@ -0,0 +1,10 @@
namespace NftFaucet.Plugins.Models.Abstraction;
public interface INamedEntity
{
public Guid Id { get; }
public string Name { get; }
public string ShortName { get; }
public string ImageName { get; }
public bool IsSupported { get; }
}

View File

@ -1,17 +1,13 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
namespace NftFaucet.Domain.Models.Abstraction;
namespace NftFaucet.Plugins.Models.Abstraction;
public interface INetwork
public interface INetwork : INamedEntity
{
public Guid Id { get; }
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; }
public bool IsTestnet { get; }
public bool IsDeprecated { get; }
public NetworkType Type { get; }

View File

@ -1,5 +1,3 @@
using NftFaucet.Domain.Models.Abstraction;
namespace NftFaucet.Plugins.Models.Abstraction;
public interface INetworkPlugin

View File

@ -1,28 +1,12 @@
using CSharpFunctionalExtensions;
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
namespace NftFaucet.Plugins.Models.Abstraction;
public interface IProvider
public interface IProvider : INamedEntity, IStateful, IInitializable, IEntityWithProperties, IConfigurable
{
public Guid Id { get; }
public string Name { get; }
public string ShortName { get; }
public string ImageName { get; }
public bool IsInitialized { get; }
public bool IsSupported { get; }
public bool IsConfigured { get; }
public Task InitializeAsync(IServiceProvider serviceProvider);
public Property[] GetProperties();
public ConfigurationItem[] GetConfigurationItems();
public Task<Result> Configure(ConfigurationItem[] configurationItems);
public bool IsNetworkSupported(INetwork network);
public Task<string> GetAddress();
public Task<Balance> GetBalance(INetwork network);
public Task<INetwork> GetNetwork(IReadOnlyCollection<INetwork> allKnownNetworks, INetwork selectedNetwork);
public Task<string> Mint(MintRequest mintRequest);
public Task<string> GetState();
public Task SetState(string state);
}

View File

@ -0,0 +1,7 @@
namespace NftFaucet.Plugins.Models.Abstraction;
public interface IStateful
{
public Task<string> GetState();
public Task SetState(string state);
}

View File

@ -1,20 +1,6 @@
using CSharpFunctionalExtensions;
namespace NftFaucet.Plugins.Models.Abstraction;
public interface IUploader
public interface IUploader : INamedEntity, IStateful, IInitializable, IEntityWithProperties, IConfigurable
{
public Guid Id { get; }
public string Name { get; }
public string ShortName { get; }
public string ImageName { get; }
public bool IsSupported { get; }
public bool IsConfigured { get; }
public Property[] GetProperties();
public ConfigurationItem[] GetConfigurationItems();
public Task<Result> Configure(ConfigurationItem[] configurationItems);
public Task<Uri> Upload(string fileName, string fileType, byte[] fileData);
public Task<string> GetState();
public Task SetState(string state);
}

View File

@ -0,0 +1,25 @@
using CSharpFunctionalExtensions;
using NftFaucet.Plugins.Models.Abstraction;
namespace NftFaucet.Plugins.Models;
public abstract class DefaultEntity : INamedEntity, IStateful, IInitializable, IEntityWithProperties, IConfigurable
{
public abstract Guid Id { get; }
public abstract string Name { get; }
public abstract string ShortName { get; }
public abstract string ImageName { get; }
public virtual bool IsSupported { get; } = true;
public virtual Task<string> GetState() => Task.FromResult(string.Empty);
public virtual Task SetState(string state) => Task.CompletedTask;
public virtual bool IsInitialized { get; protected set; } = true;
public virtual Task InitializeAsync(IServiceProvider serviceProvider) => Task.CompletedTask;
public virtual Property[] GetProperties() => Array.Empty<Property>();
public virtual bool IsConfigured { get; protected set; } = true;
public virtual ConfigurationItem[] GetConfigurationItems() => Array.Empty<ConfigurationItem>();
public virtual Task<Result> Configure(ConfigurationItem[] configurationItems) => Task.FromResult(Result.Success());
}

View File

@ -0,0 +1,19 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models.Abstraction;
namespace NftFaucet.Plugins.Models;
public abstract class Network : DefaultEntity, INetwork
{
public virtual ulong? ChainId { get; } = null;
public virtual int? Order { get; } = null;
public virtual string Currency { get; } = null;
public virtual bool IsTestnet { get; } = true;
public virtual bool IsDeprecated { get; } = false;
public abstract NetworkType Type { get; }
public abstract NetworkSubtype SubType { get; }
public abstract Uri PublicRpcUrl { get; }
public abstract Uri ExplorerUrl { get; }
public virtual IReadOnlyCollection<IContract> DeployedContracts { get; } = new List<IContract>();
}

View File

@ -0,0 +1,13 @@
using NftFaucet.Domain.Models;
using NftFaucet.Plugins.Models.Abstraction;
namespace NftFaucet.Plugins.Models;
public abstract class Provider : DefaultEntity, IProvider
{
public abstract bool IsNetworkSupported(INetwork network);
public abstract Task<string> GetAddress();
public abstract Task<Balance> GetBalance(INetwork network);
public abstract Task<INetwork> GetNetwork(IReadOnlyCollection<INetwork> allKnownNetworks, INetwork selectedNetwork);
public abstract Task<string> Mint(MintRequest mintRequest);
}

View File

@ -0,0 +1,8 @@
using NftFaucet.Plugins.Models.Abstraction;
namespace NftFaucet.Plugins.Models;
public abstract class Uploader : DefaultEntity, IUploader
{
public abstract Task<Uri> Upload(string fileName, string fileType, byte[] fileData);
}

View File

@ -1,9 +1,9 @@
using System.Numerics;
using NftFaucet.Components;
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Utils;
using NftFaucet.Plugins.Models;
using NftFaucet.Plugins.Models.Abstraction;
namespace NftFaucet.Pages;

View File

@ -1,7 +1,7 @@
using NftFaucet.Components;
using NftFaucet.Components.CardList;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models.Abstraction;
using Radzen;
namespace NftFaucet.Pages;
@ -26,9 +26,9 @@ public partial class NetworksPage : BasicComponent
IsDisabled = !model.IsSupported,
Properties = new[]
{
new CardListItemProperty { Name = "ChainID", Value = model.ChainId?.ToString() },
new CardListItemProperty { Name = "Currency", Value = model.Currency },
},
model.ChainId != null ? new CardListItemProperty { Name = "ChainID", Value = model.ChainId?.ToString() } : null,
!string.IsNullOrEmpty(model.Currency) ? new CardListItemProperty { Name = "Currency", Value = model.Currency } : null,
}.Where(x => x != null).ToArray(),
Badges = new[]
{
(Settings?.RecommendedNetworks?.Contains(model.Id) ?? false)

View File

@ -1,4 +1,3 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.NetworkPlugins.Arbitrum.Networks;
using NftFaucet.Plugins.Models.Abstraction;

View File

@ -1,23 +1,20 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Arbitrum.Networks;
public class ArbitrumNovaNetwork : INetwork
public sealed class ArbitrumNovaNetwork : Network
{
public Guid Id { get; } = Guid.Parse("e2f056f8-1c5c-494f-9e88-96213a2009d4");
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;
public bool IsTestnet { get; } = true;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Arbitrum;
public Uri PublicRpcUrl { get; } = null;
public Uri ExplorerUrl { get; } = new Uri("https://nova-explorer.arbitrum.io");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = Array.Empty<IContract>();
public override Guid Id { get; } = Guid.Parse("e2f056f8-1c5c-494f-9e88-96213a2009d4");
public override string Name { get; } = "Arbitrum Nova";
public override string ShortName { get; } = "ArbNova";
public override ulong? ChainId { get; } = 42170;
public override int? Order { get; } = 2;
public override string Currency { get; } = "ETH";
public override string ImageName { get; } = "arbitrum-black.svg";
public override bool IsSupported { get; } = false;
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Arbitrum;
public override Uri PublicRpcUrl { get; } = null;
public override Uri ExplorerUrl { get; } = new Uri("https://nova-explorer.arbitrum.io");
}

View File

@ -1,23 +1,21 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Arbitrum.Networks;
public class ArbitrumOneNetwork : INetwork
public sealed class ArbitrumOneNetwork : Network
{
public Guid Id { get; } = Guid.Parse("4f0be8b9-dda1-4598-88b9-d4ba77f4c30e");
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;
public bool IsTestnet { get; } = false;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Arbitrum;
public Uri PublicRpcUrl { get; } = null;
public Uri ExplorerUrl { get; } = new Uri("https://arbiscan.io/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = Array.Empty<IContract>();
public override Guid Id { get; } = Guid.Parse("4f0be8b9-dda1-4598-88b9-d4ba77f4c30e");
public override string Name { get; } = "Arbitrum One";
public override string ShortName { get; } = "Arbitrum";
public override ulong? ChainId { get; } = 42161;
public override int? Order { get; } = 1;
public override string Currency { get; } = "ETH";
public override string ImageName { get; } = "arbitrum.svg";
public override bool IsSupported { get; } = false;
public override bool IsTestnet { get; } = false;
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Arbitrum;
public override Uri PublicRpcUrl { get; } = null;
public override Uri ExplorerUrl { get; } = new Uri("https://arbiscan.io/");
}

View File

@ -2,26 +2,25 @@ using System.Globalization;
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Arbitrum.Networks;
public class ArbitrumRinkebyNetwork : INetwork
public sealed class ArbitrumRinkebyNetwork : Network
{
public Guid Id { get; } = Guid.Parse("8189f9cd-14fc-41ab-9418-ca472ab15873");
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;
public bool IsTestnet { get; } = true;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Arbitrum;
public Uri PublicRpcUrl { get; } = new Uri("https://rinkeby.arbitrum.io/rpc");
public Uri ExplorerUrl { get; } = new Uri("https://rinkeby-explorer.arbitrum.io/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
public override Guid Id { get; } = Guid.Parse("8189f9cd-14fc-41ab-9418-ca472ab15873");
public override string Name { get; } = "Arbitrum Rinkeby";
public override string ShortName { get; } = "ArbRinkeby";
public override ulong? ChainId { get; } = 421611;
public override int? Order { get; } = 3;
public override string Currency { get; } = "ETH";
public override string ImageName { get; } = "arbitrum-black.svg";
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Arbitrum;
public override Uri PublicRpcUrl { get; } = new Uri("https://rinkeby.arbitrum.io/rpc");
public override Uri ExplorerUrl { get; } = new Uri("https://rinkeby-explorer.arbitrum.io/");
public override IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
{
new Contract
{

View File

@ -1,4 +1,3 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.NetworkPlugins.Avalanche.Networks;
using NftFaucet.Plugins.Models.Abstraction;

View File

@ -2,27 +2,25 @@ using System.Globalization;
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Avalanche.Networks;
public class AvalancheFujiNetwork : INetwork
public sealed class AvalancheFujiNetwork : Network
{
public Guid Id { get; } = Guid.Parse("2b809e32-739e-4dd0-9b48-bf83a4c3dfc5");
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;
public bool IsTestnet { get; } = true;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Avalanche;
public Uri PublicRpcUrl { get; } = new Uri("https://api.avax-test.network/ext/bc/C/rpc");
public Uri ExplorerUrl { get; } = new Uri("https://testnet.snowtrace.io/");
public override Guid Id { get; } = Guid.Parse("2b809e32-739e-4dd0-9b48-bf83a4c3dfc5");
public override string Name { get; } = "Avalanche Fuji Testnet";
public override string ShortName { get; } = "Fuji";
public override ulong? ChainId { get; } = 43113;
public override int? Order { get; } = 2;
public override string Currency { get; } = "AVAX";
public override string ImageName { get; } = "avalanche-black.svg";
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Avalanche;
public override Uri PublicRpcUrl { get; } = new Uri("https://api.avax-test.network/ext/bc/C/rpc");
public override Uri ExplorerUrl { get; } = new Uri("https://testnet.snowtrace.io/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
public override IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
{
new Contract
{

View File

@ -1,23 +1,21 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Avalanche.Networks;
public class AvalancheMainnetNetwork : INetwork
public sealed class AvalancheMainnetNetwork : Network
{
public Guid Id { get; } = Guid.Parse("35fba12e-aa79-4d7f-84bc-c120ca7d36a5");
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;
public bool IsTestnet { get; } = false;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Avalanche;
public Uri PublicRpcUrl { get; } = null;
public Uri ExplorerUrl { get; } = new Uri("https://snowtrace.io/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = Array.Empty<IContract>();
public override Guid Id { get; } = Guid.Parse("35fba12e-aa79-4d7f-84bc-c120ca7d36a5");
public override string Name { get; } = "Avalanche C-Chain";
public override string ShortName { get; } = "Avalanche";
public override ulong? ChainId { get; } = 43114;
public override int? Order { get; } = 1;
public override string Currency { get; } = "AVAX";
public override string ImageName { get; } = "avalanche.svg";
public override bool IsSupported { get; } = false;
public override bool IsTestnet { get; } = false;
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Avalanche;
public override Uri PublicRpcUrl { get; } = null;
public override Uri ExplorerUrl { get; } = new Uri("https://snowtrace.io/");
}

View File

@ -1,4 +1,3 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.NetworkPlugins.BinanceSmartChain.Networks;
using NftFaucet.Plugins.Models.Abstraction;

View File

@ -1,23 +1,21 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.BinanceSmartChain.Networks;
public class BscMainnetNetwork : INetwork
public sealed class BscMainnetNetwork : Network
{
public Guid Id { get; } = Guid.Parse("4a948c48-93cb-4b99-b11f-ef906f2751e1");
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;
public bool IsTestnet { get; } = false;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Bsc;
public Uri PublicRpcUrl { get; } = null;
public Uri ExplorerUrl { get; } = new Uri("https://bscscan.com/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = Array.Empty<IContract>();
public override Guid Id { get; } = Guid.Parse("4a948c48-93cb-4b99-b11f-ef906f2751e1");
public override string Name { get; } = "Binance Smart Chain";
public override string ShortName { get; } = "BSC";
public override ulong? ChainId { get; } = 56;
public override int? Order { get; } = 1;
public override string Currency { get; } = "BNB";
public override string ImageName { get; } = "bnb.svg";
public override bool IsSupported { get; } = false;
public override bool IsTestnet { get; } = false;
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Bsc;
public override Uri PublicRpcUrl { get; } = null;
public override Uri ExplorerUrl { get; } = new Uri("https://bscscan.com/");
}

View File

@ -2,27 +2,25 @@ using System.Globalization;
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.BinanceSmartChain.Networks;
public class BscTestnetNetwork : INetwork
public sealed class BscTestnetNetwork : Network
{
public Guid Id { get; } = Guid.Parse("b8d4aa13-acc1-47ee-9e8c-c00f0b67772c");
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;
public bool IsTestnet { get; } = true;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Bsc;
public Uri PublicRpcUrl { get; } = new Uri("https://data-seed-prebsc-1-s1.binance.org:8545/");
public Uri ExplorerUrl { get; } = new Uri("https://testnet.bscscan.com/");
public override Guid Id { get; } = Guid.Parse("b8d4aa13-acc1-47ee-9e8c-c00f0b67772c");
public override string Name { get; } = "Binance Smart Chain Testnet";
public override string ShortName { get; } = "BSC test";
public override ulong? ChainId { get; } = 97;
public override int? Order { get; } = 2;
public override string Currency { get; } = "tBNB";
public override string ImageName { get; } = "bnb-black.svg";
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Bsc;
public override Uri PublicRpcUrl { get; } = new Uri("https://data-seed-prebsc-1-s1.binance.org:8545/");
public override Uri ExplorerUrl { get; } = new Uri("https://testnet.bscscan.com/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
public override IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
{
new Contract
{

View File

@ -1,4 +1,3 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.NetworkPlugins.Ethereum.Networks;
using NftFaucet.Plugins.Models.Abstraction;

View File

@ -1,23 +1,18 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Ethereum.Networks;
public class CustomNetwork : INetwork
public sealed class CustomNetwork : Network
{
public Guid Id { get; } = Guid.Parse("28856b4c-d2d5-4b10-942d-f954f60150e0");
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;
public bool IsTestnet { get; } = true;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Ethereum;
public Uri PublicRpcUrl { get; } = null;
public Uri ExplorerUrl { get; } = null;
public IReadOnlyCollection<IContract> DeployedContracts { get; } = Array.Empty<IContract>();
public override Guid Id { get; } = Guid.Parse("28856b4c-d2d5-4b10-942d-f954f60150e0");
public override string Name { get; } = "Custom";
public override string ShortName { get; } = "custom";
public override int? Order { get; } = 8;
public override string ImageName { get; } = "ethereum-gray.svg";
public override bool IsSupported { get; } = false;
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Ethereum;
public override Uri PublicRpcUrl { get; } = null;
public override Uri ExplorerUrl { get; } = null;
}

View File

@ -1,23 +1,21 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Ethereum.Networks;
public class EthereumMainnetNetwork : INetwork
public sealed class EthereumMainnetNetwork : Network
{
public Guid Id { get; } = Guid.Parse("a583d25d-883b-4f3c-9df1-6efe799c8fc4");
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;
public bool IsTestnet { get; } = false;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Ethereum;
public Uri PublicRpcUrl { get; } = null;
public Uri ExplorerUrl { get; } = new Uri("https://etherscan.io/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = Array.Empty<IContract>();
public override Guid Id { get; } = Guid.Parse("a583d25d-883b-4f3c-9df1-6efe799c8fc4");
public override string Name { get; } = "Mainnet";
public override string ShortName { get; } = "Mainnet";
public override ulong? ChainId { get; } = 1;
public override int? Order { get; } = 1;
public override string Currency { get; } = "ETH";
public override string ImageName { get; } = "ethereum.svg";
public override bool IsSupported { get; } = false;
public override bool IsTestnet { get; } = false;
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Ethereum;
public override Uri PublicRpcUrl { get; } = null;
public override Uri ExplorerUrl { get; } = new Uri("https://etherscan.io/");
}

View File

@ -2,27 +2,25 @@ using System.Globalization;
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Ethereum.Networks;
public class GoerliNetwork : INetwork
public sealed class GoerliNetwork : Network
{
public Guid Id { get; } = Guid.Parse("ac7858ff-b5c7-44f9-bf60-d81470531e56");
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;
public bool IsTestnet { get; } = true;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Ethereum;
public Uri PublicRpcUrl { get; } = new Uri("https://ethereum-goerli-rpc.allthatnode.com");
public Uri ExplorerUrl { get; } = new Uri("https://goerli.etherscan.io/");
public override Guid Id { get; } = Guid.Parse("ac7858ff-b5c7-44f9-bf60-d81470531e56");
public override string Name { get; } = "Goerli";
public override string ShortName { get; } = "Goerli";
public override ulong? ChainId { get; } = 5;
public override int? Order { get; } = 4;
public override string Currency { get; } = "ETH";
public override string ImageName { get; } = "ethereum-gray.svg";
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Ethereum;
public override Uri PublicRpcUrl { get; } = new Uri("https://ethereum-goerli-rpc.allthatnode.com");
public override Uri ExplorerUrl { get; } = new Uri("https://goerli.etherscan.io/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
public override IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
{
new Contract
{

View File

@ -1,23 +1,21 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Ethereum.Networks;
public class KilnNetwork : INetwork
public sealed class KilnNetwork : Network
{
public Guid Id { get; } = Guid.Parse("f2a3b097-c376-4608-9c20-1ad79cbf2d4f");
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;
public bool IsTestnet { get; } = true;
public bool IsDeprecated { get; } = true;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Ethereum;
public Uri PublicRpcUrl { get; } = null;
public Uri ExplorerUrl { get; } = null;
public IReadOnlyCollection<IContract> DeployedContracts { get; } = Array.Empty<IContract>();
public override Guid Id { get; } = Guid.Parse("f2a3b097-c376-4608-9c20-1ad79cbf2d4f");
public override string Name { get; } = "Kiln";
public override string ShortName { get; } = "Kiln";
public override ulong? ChainId { get; } = 1337802;
public override int? Order { get; } = 6;
public override string Currency { get; } = "ETH";
public override string ImageName { get; } = "ethereum-gray.svg";
public override bool IsSupported { get; } = false;
public override bool IsDeprecated { get; } = true;
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Ethereum;
public override Uri PublicRpcUrl { get; } = null;
public override Uri ExplorerUrl { get; } = null;
}

View File

@ -2,27 +2,26 @@ using System.Globalization;
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Ethereum.Networks;
public class KovanNetwork : INetwork
public sealed class KovanNetwork : Network
{
public Guid Id { get; } = Guid.Parse("2d76565d-6e66-4d5b-bd62-c44e4db95782");
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;
public bool IsTestnet { get; } = true;
public bool IsDeprecated { get; } = true;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Ethereum;
public Uri PublicRpcUrl { get; } = new Uri("https://kovan.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161");
public Uri ExplorerUrl { get; } = new Uri("https://kovan.etherscan.io/");
public override Guid Id { get; } = Guid.Parse("2d76565d-6e66-4d5b-bd62-c44e4db95782");
public override string Name { get; } = "Kovan";
public override string ShortName { get; } = "Kovan";
public override ulong? ChainId { get; } = 42;
public override int? Order { get; } = 5;
public override string Currency { get; } = "ETH";
public override string ImageName { get; } = "ethereum-gray.svg";
public override bool IsDeprecated { get; } = true;
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Ethereum;
public override Uri PublicRpcUrl { get; } = new Uri("https://kovan.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161");
public override Uri ExplorerUrl { get; } = new Uri("https://kovan.etherscan.io/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
public override IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
{
new Contract
{

View File

@ -2,27 +2,26 @@ using System.Globalization;
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Ethereum.Networks;
public class RinkebyNetwork : INetwork
public sealed class RinkebyNetwork : Network
{
public Guid Id { get; } = Guid.Parse("795e27ea-942f-45e0-a5c8-b6c6a722635b");
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;
public bool IsTestnet { get; } = true;
public bool IsDeprecated { get; } = true;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Ethereum;
public Uri PublicRpcUrl { get; } = new Uri("https://ethereum-rinkeby-rpc.allthatnode.com");
public Uri ExplorerUrl { get; } = new Uri("https://rinkeby.etherscan.io/");
public override Guid Id { get; } = Guid.Parse("795e27ea-942f-45e0-a5c8-b6c6a722635b");
public override string Name { get; } = "Rinkeby";
public override string ShortName { get; } = "Rinkeby";
public override ulong? ChainId { get; } = 4;
public override int? Order { get; } = 3;
public override string Currency { get; } = "ETH";
public override string ImageName { get; } = "ethereum-gray.svg";
public override bool IsDeprecated { get; } = true;
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Ethereum;
public override Uri PublicRpcUrl { get; } = new Uri("https://ethereum-rinkeby-rpc.allthatnode.com");
public override Uri ExplorerUrl { get; } = new Uri("https://rinkeby.etherscan.io/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
public override IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
{
new Contract
{

View File

@ -2,27 +2,26 @@ using System.Globalization;
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Ethereum.Networks;
public class RopstenNetwork : INetwork
public sealed class RopstenNetwork : Network
{
public Guid Id { get; } = Guid.Parse("d26d00d8-5036-433d-a4bd-2383f3c4c47c");
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;
public bool IsTestnet { get; } = true;
public bool IsDeprecated { get; } = true;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Ethereum;
public Uri PublicRpcUrl { get; } = new Uri("https://ethereum-ropsten-rpc.allthatnode.com");
public Uri ExplorerUrl { get; } = new Uri("https://ropsten.etherscan.io/");
public override Guid Id { get; } = Guid.Parse("d26d00d8-5036-433d-a4bd-2383f3c4c47c");
public override string Name { get; } = "Ropsten";
public override string ShortName { get; } = "Ropsten";
public override ulong? ChainId { get; } = 3;
public override int? Order { get; } = 2;
public override string Currency { get; } = "ETH";
public override string ImageName { get; } = "ethereum-gray.svg";
public override bool IsDeprecated { get; } = true;
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Ethereum;
public override Uri PublicRpcUrl { get; } = new Uri("https://ethereum-ropsten-rpc.allthatnode.com");
public override Uri ExplorerUrl { get; } = new Uri("https://ropsten.etherscan.io/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
public override IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
{
new Contract
{

View File

@ -1,23 +1,20 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Ethereum.Networks;
public class SepoliaNetwork : INetwork
public sealed class SepoliaNetwork : Network
{
public Guid Id { get; } = Guid.Parse("3e792942-4f46-40a9-b2c7-e44a975678bc");
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;
public bool IsTestnet { get; } = true;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Ethereum;
public Uri PublicRpcUrl { get; } = null;
public Uri ExplorerUrl { get; } = new Uri("https://sepolia.etherscan.io/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = Array.Empty<IContract>();
public override Guid Id { get; } = Guid.Parse("3e792942-4f46-40a9-b2c7-e44a975678bc");
public override string Name { get; } = "Sepolia";
public override string ShortName { get; } = "Sepolia";
public override ulong? ChainId { get; } = 11155111;
public override int? Order { get; } = 7;
public override string Currency { get; } = "SEP";
public override string ImageName { get; } = "ethereum-gray.svg";
public override bool IsSupported { get; } = false;
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Ethereum;
public override Uri PublicRpcUrl { get; } = null;
public override Uri ExplorerUrl { get; } = new Uri("https://sepolia.etherscan.io/");
}

View File

@ -1,4 +1,3 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.NetworkPlugins.Moonbeam.Networks;
using NftFaucet.Plugins.Models.Abstraction;

View File

@ -2,27 +2,25 @@ using System.Globalization;
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Moonbeam.Networks;
public class MoonbaseAlphaNetwork : INetwork
public sealed class MoonbaseAlphaNetwork : Network
{
public Guid Id { get; } = Guid.Parse("3232de5b-78bd-4b2f-8048-4aa3e16547bd");
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;
public bool IsTestnet { get; } = true;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Moonbase;
public Uri PublicRpcUrl { get; } = new Uri("https://moonbase-alpha.public.blastapi.io");
public Uri ExplorerUrl { get; } = new Uri("https://moonbase.moonscan.io/");
public override Guid Id { get; } = Guid.Parse("3232de5b-78bd-4b2f-8048-4aa3e16547bd");
public override string Name { get; } = "Moonbase Alpha";
public override string ShortName { get; } = "MoonAlpha";
public override ulong? ChainId { get; } = 1287;
public override int? Order { get; } = 3;
public override string Currency { get; } = "DEV";
public override string ImageName { get; } = "moonbeam-black.svg";
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Moonbase;
public override Uri PublicRpcUrl { get; } = new Uri("https://moonbase-alpha.public.blastapi.io");
public override Uri ExplorerUrl { get; } = new Uri("https://moonbase.moonscan.io/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
public override IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
{
new Contract
{

View File

@ -1,23 +1,21 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Moonbeam.Networks;
public class MoonbeamNetwork : INetwork
public sealed class MoonbeamNetwork : Network
{
public Guid Id { get; } = Guid.Parse("04b52a79-14d7-403c-9411-2af240fa7984");
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;
public bool IsTestnet { get; } = false;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Moonbase;
public Uri PublicRpcUrl { get; } = null;
public Uri ExplorerUrl { get; } = new Uri("https://blockscout.moonbeam.network/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = Array.Empty<IContract>();
public override Guid Id { get; } = Guid.Parse("04b52a79-14d7-403c-9411-2af240fa7984");
public override string Name { get; } = "Moonbeam";
public override string ShortName { get; } = "Moonbeam";
public override ulong? ChainId { get; } = 1284;
public override int? Order { get; } = 1;
public override string Currency { get; } = "GLMR";
public override string ImageName { get; } = "moonbeam.svg";
public override bool IsSupported { get; } = false;
public override bool IsTestnet { get; } = false;
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Moonbase;
public override Uri PublicRpcUrl { get; } = null;
public override Uri ExplorerUrl { get; } = new Uri("https://blockscout.moonbeam.network/");
}

View File

@ -1,23 +1,21 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Moonbeam.Networks;
public class MoonriverNetwork : INetwork
public sealed class MoonriverNetwork : Network
{
public Guid Id { get; } = Guid.Parse("51152b05-ebc6-46a2-9cab-10fb65f3e36b");
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;
public bool IsTestnet { get; } = false;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Moonbase;
public Uri PublicRpcUrl { get; } = null;
public Uri ExplorerUrl { get; } = new Uri("https://blockscout.moonriver.moonbeam.network/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = Array.Empty<IContract>();
public override Guid Id { get; } = Guid.Parse("51152b05-ebc6-46a2-9cab-10fb65f3e36b");
public override string Name { get; } = "Moonriver";
public override string ShortName { get; } = "Moonriver";
public override ulong? ChainId { get; } = 1285;
public override int? Order { get; } = 2;
public override string Currency { get; } = "MOVR";
public override string ImageName { get; } = "moonriver.svg";
public override bool IsSupported { get; } = false;
public override bool IsTestnet { get; } = false;
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Moonbase;
public override Uri PublicRpcUrl { get; } = null;
public override Uri ExplorerUrl { get; } = new Uri("https://blockscout.moonriver.moonbeam.network/");
}

View File

@ -1,23 +1,20 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Optimism.Networks;
public class OptimismGoerliNetwork : INetwork
public sealed class OptimismGoerliNetwork : Network
{
public Guid Id { get; } = Guid.Parse("fe4f3f37-bec9-4f35-9063-8682160b1f9d");
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;
public bool IsTestnet { get; } = true;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Optimism;
public Uri PublicRpcUrl { get; } = null;
public Uri ExplorerUrl { get; } = new Uri("https://blockscout.com/optimism/goerli/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = Array.Empty<IContract>();
public override Guid Id { get; } = Guid.Parse("fe4f3f37-bec9-4f35-9063-8682160b1f9d");
public override string Name { get; } = "Optimism Goerli";
public override string ShortName { get; } = "OpGoerli";
public override ulong? ChainId { get; } = 420;
public override int? Order { get; } = 3;
public override string Currency { get; } = "ETH";
public override string ImageName { get; } = "optimism-black.svg";
public override bool IsSupported { get; } = false;
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Optimism;
public override Uri PublicRpcUrl { get; } = null;
public override Uri ExplorerUrl { get; } = new Uri("https://blockscout.com/optimism/goerli/");
}

View File

@ -2,27 +2,26 @@ using System.Globalization;
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Optimism.Networks;
public class OptimismKovanNetwork : INetwork
public sealed class OptimismKovanNetwork : Network
{
public Guid Id { get; } = Guid.Parse("a3d39e07-2fdd-450f-be3f-cdc8fcff676d");
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;
public bool IsTestnet { get; } = true;
public bool IsDeprecated { get; } = true;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Optimism;
public Uri PublicRpcUrl { get; } = new Uri("https://mainnet.optimism.io");
public Uri ExplorerUrl { get; } = new Uri("https://kovan-optimistic.etherscan.io/");
public override Guid Id { get; } = Guid.Parse("a3d39e07-2fdd-450f-be3f-cdc8fcff676d");
public override string Name { get; } = "Optimism Kovan";
public override string ShortName { get; } = "OpKovan";
public override ulong? ChainId { get; } = 69;
public override int? Order { get; } = 2;
public override string Currency { get; } = "ETH";
public override string ImageName { get; } = "optimism-black.svg";
public override bool IsDeprecated { get; } = true;
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Optimism;
public override Uri PublicRpcUrl { get; } = new Uri("https://mainnet.optimism.io");
public override Uri ExplorerUrl { get; } = new Uri("https://kovan-optimistic.etherscan.io/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
public override IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
{
new Contract
{

View File

@ -1,23 +1,21 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Optimism.Networks;
public class OptimismMainnetNetwork : INetwork
public sealed class OptimismMainnetNetwork : Network
{
public Guid Id { get; } = Guid.Parse("2fa5b635-6711-4994-9d2a-3ca730176516");
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;
public bool IsTestnet { get; } = false;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Optimism;
public Uri PublicRpcUrl { get; } = null;
public Uri ExplorerUrl { get; } = new Uri("https://optimistic.etherscan.io/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = Array.Empty<IContract>();
public override Guid Id { get; } = Guid.Parse("2fa5b635-6711-4994-9d2a-3ca730176516");
public override string Name { get; } = "Optimism";
public override string ShortName { get; } = "Optimism";
public override ulong? ChainId { get; } = 10;
public override int? Order { get; } = 1;
public override string Currency { get; } = "ETH";
public override string ImageName { get; } = "optimism.svg";
public override bool IsSupported { get; } = false;
public override bool IsTestnet { get; } = false;
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Optimism;
public override Uri PublicRpcUrl { get; } = null;
public override Uri ExplorerUrl { get; } = new Uri("https://optimistic.etherscan.io/");
}

View File

@ -1,4 +1,3 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.NetworkPlugins.Optimism.Networks;
using NftFaucet.Plugins.Models.Abstraction;

View File

@ -1,23 +1,21 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Polygon.Networks;
public class PolygonMainnetNetwork : INetwork
public sealed class PolygonMainnetNetwork : Network
{
public Guid Id { get; } = Guid.Parse("e09e7646-cf39-42be-8c8d-c566442e8229");
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;
public bool IsTestnet { get; } = false;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Polygon;
public Uri PublicRpcUrl { get; } = null;
public Uri ExplorerUrl { get; } = new Uri("https://polygonscan.com/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = Array.Empty<IContract>();
public override Guid Id { get; } = Guid.Parse("e09e7646-cf39-42be-8c8d-c566442e8229");
public override string Name { get; } = "Polygon";
public override string ShortName { get; } = "Polygon";
public override ulong? ChainId { get; } = 137;
public override int? Order { get; } = 1;
public override string Currency { get; } = "MATIC";
public override string ImageName { get; } = "polygon.svg";
public override bool IsSupported { get; } = false;
public override bool IsTestnet { get; } = false;
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Polygon;
public override Uri PublicRpcUrl { get; } = null;
public override Uri ExplorerUrl { get; } = new Uri("https://polygonscan.com/");
}

View File

@ -2,27 +2,25 @@ using System.Globalization;
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Polygon.Networks;
public class PolygonMumbaiNetwork : INetwork
public sealed class PolygonMumbaiNetwork : Network
{
public Guid Id { get; } = Guid.Parse("c8f8b235-fde8-49f1-94a9-ab12a1188804");
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;
public bool IsTestnet { get; } = true;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Ethereum;
public NetworkSubtype SubType { get; } = NetworkSubtype.Polygon;
public Uri PublicRpcUrl { get; } = new Uri("https://rpc-mumbai.maticvigil.com");
public Uri ExplorerUrl { get; } = new Uri("https://mumbai.polygonscan.com/");
public override Guid Id { get; } = Guid.Parse("c8f8b235-fde8-49f1-94a9-ab12a1188804");
public override string Name { get; } = "Polygon Mumbai";
public override string ShortName { get; } = "Mumbai";
public override ulong? ChainId { get; } = 80001;
public override int? Order { get; } = 2;
public override string Currency { get; } = "MATIC";
public override string ImageName { get; } = "polygon-black.svg";
public override NetworkType Type { get; } = NetworkType.Ethereum;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Polygon;
public override Uri PublicRpcUrl { get; } = new Uri("https://rpc-mumbai.maticvigil.com");
public override Uri ExplorerUrl { get; } = new Uri("https://mumbai.polygonscan.com/");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
public override IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
{
new Contract
{

View File

@ -1,4 +1,3 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.NetworkPlugins.Polygon.Networks;
using NftFaucet.Plugins.Models.Abstraction;

View File

@ -1,27 +1,24 @@
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Solana.Networks;
public class SolanaDevnetNetwork : INetwork
public sealed class SolanaDevnetNetwork : Network
{
public Guid Id { get; } = Guid.Parse("da9f269a-b53e-492a-be07-b4aadc2aae83");
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;
public bool IsTestnet { get; } = true;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Solana;
public NetworkSubtype SubType { get; } = NetworkSubtype.Solana;
public Uri PublicRpcUrl { get; } = new Uri("https://api.devnet.solana.com");
public Uri ExplorerUrl { get; } = new Uri("https://explorer.solana.com/?cluster=devnet");
public override Guid Id { get; } = Guid.Parse("da9f269a-b53e-492a-be07-b4aadc2aae83");
public override string Name { get; } = "Solana Devnet";
public override string ShortName { get; } = "SolDevnet";
public override int? Order { get; } = 2;
public override string Currency { get; } = "SOL";
public override string ImageName { get; } = "solana-black.svg";
public override NetworkType Type { get; } = NetworkType.Solana;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Solana;
public override Uri PublicRpcUrl { get; } = new Uri("https://api.devnet.solana.com");
public override Uri ExplorerUrl { get; } = new Uri("https://explorer.solana.com/?cluster=devnet");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
public override IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
{
new Contract
{

View File

@ -1,23 +1,20 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Solana.Networks;
public class SolanaMainnetNetwork : INetwork
public sealed class SolanaMainnetNetwork : Network
{
public Guid Id { get; } = Guid.Parse("1198f92d-3222-41e8-94af-8a7112324311");
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;
public bool IsTestnet { get; } = false;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Solana;
public NetworkSubtype SubType { get; } = NetworkSubtype.Solana;
public Uri PublicRpcUrl { get; } = new Uri("https://api.mainnet-beta.solana.com");
public Uri ExplorerUrl { get; } = new Uri("https://explorer.solana.com");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = Array.Empty<IContract>();
public override Guid Id { get; } = Guid.Parse("1198f92d-3222-41e8-94af-8a7112324311");
public override string Name { get; } = "Solana Mainnet";
public override string ShortName { get; } = "Solana";
public override int? Order { get; } = 1;
public override string Currency { get; } = "SOL";
public override string ImageName { get; } = "solana.svg";
public override bool IsSupported { get; } = false;
public override bool IsTestnet { get; } = false;
public override NetworkType Type { get; } = NetworkType.Solana;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Solana;
public override Uri PublicRpcUrl { get; } = new Uri("https://api.mainnet-beta.solana.com");
public override Uri ExplorerUrl { get; } = new Uri("https://explorer.solana.com");
}

View File

@ -1,27 +1,24 @@
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
namespace NftFaucet.NetworkPlugins.Solana.Networks;
public class SolanaTestnetNetwork : INetwork
public sealed class SolanaTestnetNetwork : Network
{
public Guid Id { get; } = Guid.Parse("12d13a34-689c-4fb1-84c0-7fcb719ef5b0");
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;
public bool IsTestnet { get; } = true;
public bool IsDeprecated { get; } = false;
public NetworkType Type { get; } = NetworkType.Solana;
public NetworkSubtype SubType { get; } = NetworkSubtype.Solana;
public Uri PublicRpcUrl { get; } = new Uri("https://api.testnet.solana.com");
public Uri ExplorerUrl { get; } = new Uri("https://explorer.solana.com/?cluster=testnet");
public override Guid Id { get; } = Guid.Parse("12d13a34-689c-4fb1-84c0-7fcb719ef5b0");
public override string Name { get; } = "Solana Testnet";
public override string ShortName { get; } = "SolTestnet";
public override int? Order { get; } = 3;
public override string Currency { get; } = "SOL";
public override string ImageName { get; } = "solana-black.svg";
public override NetworkType Type { get; } = NetworkType.Solana;
public override NetworkSubtype SubType { get; } = NetworkSubtype.Solana;
public override Uri PublicRpcUrl { get; } = new Uri("https://api.testnet.solana.com");
public override Uri ExplorerUrl { get; } = new Uri("https://explorer.solana.com/?cluster=testnet");
public IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
public override IReadOnlyCollection<IContract> DeployedContracts { get; } = new[]
{
new Contract
{

View File

@ -1,4 +1,3 @@
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.NetworkPlugins.Solana.Networks;
using NftFaucet.Plugins.Models.Abstraction;

View File

@ -8,7 +8,6 @@ using Nethereum.Web3;
using Nethereum.Web3.Accounts;
using NftFaucet.Domain.Function;
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Domain.Utils;
using NftFaucet.Plugins.Models;
@ -17,27 +16,22 @@ using NftFaucet.Plugins.Models.Enums;
namespace NftFaucet.ProviderPlugins.EthereumKeygen;
public class EthereumKeygenProvider : IProvider
public sealed class EthereumKeygenProvider : Provider
{
public Guid Id { get; } = Guid.Parse("ded55b2b-8139-4251-a0fc-ba620f9727c9");
public string Name { get; } = "Ethereum keygen";
public string ShortName { get; } = "EthKeygen";
public string ImageName { get; } = "ecdsa.svg";
public bool IsInitialized { get; } = true;
public bool IsSupported { get; } = true;
public bool IsConfigured { get; private set; }
public override Guid Id { get; } = Guid.Parse("ded55b2b-8139-4251-a0fc-ba620f9727c9");
public override string Name { get; } = "Ethereum keygen";
public override string ShortName { get; } = "EthKeygen";
public override string ImageName { get; } = "ecdsa.svg";
public override bool IsConfigured { get; protected set; }
public EthereumKey Key { get; private set; }
public Task InitializeAsync(IServiceProvider serviceProvider)
=> Task.CompletedTask;
public Property[] GetProperties()
public override Property[] GetProperties()
=> new[]
{
new Property{ Name = "Address", Value = Key?.Address ?? "<null>" },
};
public ConfigurationItem[] GetConfigurationItems()
public override ConfigurationItem[] GetConfigurationItems()
{
var privateKeyInput = new ConfigurationItem
{
@ -70,7 +64,7 @@ public class EthereumKeygenProvider : IProvider
return new[] { privateKeyInput, addressInput, button };
}
public Task<Result> Configure(ConfigurationItem[] configurationItems)
public override Task<Result> Configure(ConfigurationItem[] configurationItems)
{
var keyResult = ResultWrapper.Wrap(() => new EthereumKey(configurationItems[0].Value));
if (keyResult.IsFailure)
@ -81,13 +75,13 @@ public class EthereumKeygenProvider : IProvider
return Task.FromResult(Result.Success());
}
public bool IsNetworkSupported(INetwork network)
public override bool IsNetworkSupported(INetwork network)
=> network?.Type == NetworkType.Ethereum;
public Task<string> GetAddress()
public override Task<string> GetAddress()
=> Task.FromResult(Key?.Address);
public async Task<Balance> GetBalance(INetwork network)
public override async Task<Balance> GetBalance(INetwork network)
{
if (string.IsNullOrEmpty(Key?.Address))
return null;
@ -98,7 +92,7 @@ public class EthereumKeygenProvider : IProvider
return new Balance(balance, "wei");
}
public Task<INetwork> GetNetwork(IReadOnlyCollection<INetwork> allKnownNetworks, INetwork selectedNetwork)
public override Task<INetwork> GetNetwork(IReadOnlyCollection<INetwork> allKnownNetworks, INetwork selectedNetwork)
{
if (selectedNetwork != null && selectedNetwork.Type == NetworkType.Ethereum)
return Task.FromResult(selectedNetwork);
@ -108,7 +102,7 @@ public class EthereumKeygenProvider : IProvider
return Task.FromResult(matchingNetwork);
}
public async Task<string> Mint(MintRequest mintRequest)
public override async Task<string> Mint(MintRequest mintRequest)
{
if (mintRequest.Network.Type != NetworkType.Ethereum)
{
@ -159,10 +153,10 @@ public class EthereumKeygenProvider : IProvider
return transactionHash;
}
public Task<string> GetState()
public override Task<string> GetState()
=> Task.FromResult(Key.PrivateKey);
public Task SetState(string state)
public override Task SetState(string state)
{
if (!string.IsNullOrEmpty(state))
{

View File

@ -1,9 +1,7 @@
using CSharpFunctionalExtensions;
using Ethereum.MetaMask.Blazor;
using Microsoft.Extensions.DependencyInjection;
using NftFaucet.Domain.Function;
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
using NftFaucet.Plugins.Models.Abstraction;
@ -11,24 +9,22 @@ using NftFaucet.Plugins.Models.Enums;
namespace NftFaucet.ProviderPlugins.Metamask;
public class MetamaskProvider : IProvider
public class MetamaskProvider : Provider
{
public Guid Id { get; } = Guid.Parse("3367b9bb-f50c-4768-aeb3-9ac14d4c3987");
public string Name { get; } = "Metamask";
public string ShortName { get; } = "Metamask";
public string ImageName { get; } = "metamask_fox.svg";
public bool IsInitialized { get; private set; }
public bool IsSupported { get; } = true;
public bool IsConfigured => IsMetamaskAvailable && IsSiteConnected && !string.IsNullOrEmpty(Address);
public override Guid Id { get; } = Guid.Parse("3367b9bb-f50c-4768-aeb3-9ac14d4c3987");
public override string Name { get; } = "Metamask";
public override string ShortName { get; } = "Metamask";
public override string ImageName { get; } = "metamask_fox.svg";
public override bool IsInitialized { get; protected set; }
public override bool IsConfigured => IsMetamaskAvailable && IsSiteConnected && !string.IsNullOrEmpty(Address);
private IMetaMaskService MetaMaskService { get; set; }
private bool IsMetamaskAvailable { get; set; }
private bool IsSiteConnected { get; set; }
private string Address { get; set; }
private string ChainId { get; set; }
public async Task InitializeAsync(IServiceProvider serviceProvider)
public override async Task InitializeAsync(IServiceProvider serviceProvider)
{
MetaMaskService = serviceProvider.GetRequiredService<IMetaMaskService>();
@ -47,7 +43,7 @@ public class MetamaskProvider : IProvider
IsInitialized = true;
}
public Property[] GetProperties()
public override Property[] GetProperties()
{
var list = new List<Property>(3)
{
@ -74,7 +70,7 @@ public class MetamaskProvider : IProvider
return list.ToArray();
}
public ConfigurationItem[] GetConfigurationItems()
public override ConfigurationItem[] GetConfigurationItems()
{
var addressInput = new ConfigurationItem
{
@ -120,19 +116,13 @@ public class MetamaskProvider : IProvider
return new[] { addressInput, chainInput, connectButton };
}
public Task<Result> Configure(ConfigurationItem[] configurationItems)
{
// IsConfigured = true;
return Task.FromResult(Result.Success());
}
public bool IsNetworkSupported(INetwork network)
public override bool IsNetworkSupported(INetwork network)
=> network?.Type == NetworkType.Ethereum;
public async Task<string> GetAddress()
public override async Task<string> GetAddress()
=> Address ?? await MetaMaskService.GetSelectedAccountAsync();
public async Task<Balance> GetBalance(INetwork network)
public override async Task<Balance> GetBalance(INetwork network)
{
if (!IsConfigured)
return null;
@ -141,14 +131,14 @@ public class MetamaskProvider : IProvider
return new Balance(balance, "wei");
}
public Task<INetwork> GetNetwork(IReadOnlyCollection<INetwork> allKnownNetworks, INetwork selectedNetwork)
public override Task<INetwork> GetNetwork(IReadOnlyCollection<INetwork> allKnownNetworks, INetwork selectedNetwork)
{
var chainId = Convert.ToUInt64(ChainId, 16);
var matchingNetwork = allKnownNetworks.FirstOrDefault(x => x.ChainId != null && x.ChainId.Value == chainId);
return Task.FromResult(matchingNetwork);
}
public async Task<string> Mint(MintRequest mintRequest)
public override async Task<string> Mint(MintRequest mintRequest)
{
if (mintRequest.Network.Type != NetworkType.Ethereum)
{
@ -181,10 +171,4 @@ public class MetamaskProvider : IProvider
return transactionHash;
}
public Task<string> GetState()
=> Task.FromResult(string.Empty);
public Task SetState(string state)
=> Task.CompletedTask;
}

View File

@ -1,66 +1,45 @@
using CSharpFunctionalExtensions;
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Plugins.Models;
using NftFaucet.Plugins.Models.Abstraction;
namespace NftFaucet.ProviderPlugins.Phantom;
public class PhantomProvider : IProvider
public class PhantomProvider : Provider
{
public Guid Id { get; } = Guid.Parse("ae860901-5441-463c-a16e-4786f041500d");
public string Name { get; } = "Phantom";
public string ShortName { get; } = "Phantom";
public string ImageName { get; } = "phantom.svg";
public bool IsInitialized { get; } = true;
public bool IsSupported { get; } = false;
public bool IsConfigured { get; private set; }
public override Guid Id { get; } = Guid.Parse("ae860901-5441-463c-a16e-4786f041500d");
public override string Name { get; } = "Phantom";
public override string ShortName { get; } = "Phantom";
public override string ImageName { get; } = "phantom.svg";
public override bool IsSupported { get; } = false;
public Task InitializeAsync(IServiceProvider serviceProvider)
=> Task.CompletedTask;
public Property[] GetProperties()
public override Property[] GetProperties()
=> new Property[]
{
new Property{ Name = "Installed", Value = "YES" },
new Property{ Name = "Connected", Value = IsConfigured ? "YES" : "NO" },
};
public ConfigurationItem[] GetConfigurationItems()
=> Array.Empty<ConfigurationItem>();
public Task<Result> Configure(ConfigurationItem[] configurationItems)
{
throw new NotImplementedException();
}
public bool IsNetworkSupported(INetwork network)
public override bool IsNetworkSupported(INetwork network)
=> network?.Type == NetworkType.Solana;
public Task<string> GetAddress()
public override Task<string> GetAddress()
{
throw new NotImplementedException();
}
public Task<Balance> GetBalance(INetwork network)
public override Task<Balance> GetBalance(INetwork network)
{
throw new NotImplementedException();
}
public Task<INetwork> GetNetwork(IReadOnlyCollection<INetwork> allKnownNetworks, INetwork selectedNetwork)
public override Task<INetwork> GetNetwork(IReadOnlyCollection<INetwork> allKnownNetworks, INetwork selectedNetwork)
{
throw new NotImplementedException();
}
public Task<string> Mint(MintRequest mintRequest)
public override Task<string> Mint(MintRequest mintRequest)
{
throw new NotImplementedException();
}
public Task<string> GetState()
=> Task.FromResult(string.Empty);
public Task SetState(string state)
=> Task.CompletedTask;
}

View File

@ -2,7 +2,6 @@ using System.Numerics;
using System.Text;
using CSharpFunctionalExtensions;
using NftFaucet.Domain.Models;
using NftFaucet.Domain.Models.Abstraction;
using NftFaucet.Domain.Models.Enums;
using NftFaucet.Domain.Utils;
using NftFaucet.Plugins.Models;
@ -18,27 +17,22 @@ using Solnet.Wallet;
namespace NftFaucet.ProviderPlugins.SolanaKeygen;
public class SolanaKeygenProvider : IProvider
public class SolanaKeygenProvider : Provider
{
public Guid Id { get; } = Guid.Parse("4c1a8ac5-60ca-4024-aae6-3c9852a6535c");
public string Name { get; } = "Solana keygen";
public string ShortName { get; } = "SolKeygen";
public string ImageName { get; } = "ecdsa.svg";
public bool IsInitialized { get; } = true;
public bool IsSupported { get; } = true;
public bool IsConfigured { get; private set; }
public override Guid Id { get; } = Guid.Parse("4c1a8ac5-60ca-4024-aae6-3c9852a6535c");
public override string Name { get; } = "Solana keygen";
public override string ShortName { get; } = "SolKeygen";
public override string ImageName { get; } = "ecdsa.svg";
public override bool IsConfigured { get; protected set; }
public SolanaKey Key { get; private set; }
public Task InitializeAsync(IServiceProvider serviceProvider)
=> Task.CompletedTask;
public Property[] GetProperties()
public override Property[] GetProperties()
=> new[]
{
new Property{ Name = "Address", Value = Key?.Address ?? "<null>" },
};
public ConfigurationItem[] GetConfigurationItems()
public override ConfigurationItem[] GetConfigurationItems()
{
var mnemonicInput = new ConfigurationItem
{
@ -80,7 +74,7 @@ public class SolanaKeygenProvider : IProvider
return new[] { mnemonicInput, privateKeyInput, addressInput, button };
}
public Task<Result> Configure(ConfigurationItem[] configurationItems)
public override Task<Result> Configure(ConfigurationItem[] configurationItems)
{
var keyResult = ResultWrapper.Wrap(() => new SolanaKey(configurationItems[0].Value));
if (keyResult.IsFailure)
@ -91,13 +85,13 @@ public class SolanaKeygenProvider : IProvider
return Task.FromResult(Result.Success());
}
public bool IsNetworkSupported(INetwork network)
public override bool IsNetworkSupported(INetwork network)
=> network?.Type == NetworkType.Solana;
public Task<string> GetAddress()
public override Task<string> GetAddress()
=> Task.FromResult(Key?.Address);
public async Task<Balance> GetBalance(INetwork network)
public override async Task<Balance> GetBalance(INetwork network)
{
if (string.IsNullOrEmpty(Key?.Address))
return null;
@ -111,7 +105,7 @@ public class SolanaKeygenProvider : IProvider
return new Balance(balance, "lamport");
}
public Task<INetwork> GetNetwork(IReadOnlyCollection<INetwork> allKnownNetworks, INetwork selectedNetwork)
public override Task<INetwork> GetNetwork(IReadOnlyCollection<INetwork> allKnownNetworks, INetwork selectedNetwork)
{
if (selectedNetwork != null && selectedNetwork.Type == NetworkType.Solana)
return Task.FromResult(selectedNetwork);
@ -121,7 +115,7 @@ public class SolanaKeygenProvider : IProvider
return Task.FromResult(matchingNetwork);
}
public async Task<string> Mint(MintRequest mintRequest)
public override async Task<string> Mint(MintRequest mintRequest)
{
var client = ClientFactory.GetClient(mintRequest.Network.PublicRpcUrl.OriginalString);
var rentExemption = await client.GetMinimumBalanceForRentExemptionAsync(TokenProgram.MintAccountDataSize);
@ -213,10 +207,10 @@ public class SolanaKeygenProvider : IProvider
return txResult.Result;
}
public Task<string> GetState()
public override Task<string> GetState()
=> Task.FromResult(Key.MnemonicPhrase);
public Task SetState(string state)
public override Task SetState(string state)
{
if (!string.IsNullOrEmpty(state))
{

View File

@ -1,35 +1,25 @@
using System.Text;
using CSharpFunctionalExtensions;
using Nethereum.Signer;
using NftFaucet.Plugins.Models;
using NftFaucet.Plugins.Models.Abstraction;
using NftFaucet.UploadPlugins.Crust.ApiClients;
using NftFaucet.UploadPlugins.Crust.Models;
using RestEase;
namespace NftFaucet.UploadPlugins.Crust;
public class CrustUploader : IUploader
public class CrustUploader : Uploader
{
public Guid Id { get; } = Guid.Parse("5cc1a8bf-9b6a-4fa7-a262-1161bcca3cd5");
public string Name { get; } = "Crust";
public string ShortName { get; } = "Crust";
public string ImageName { get; } = "crust.svg";
public bool IsSupported { get; } = true;
public bool IsConfigured { get; } = true;
public override Guid Id { get; } = Guid.Parse("5cc1a8bf-9b6a-4fa7-a262-1161bcca3cd5");
public override string Name { get; } = "Crust";
public override string ShortName { get; } = "Crust";
public override string ImageName { get; } = "crust.svg";
private string AuthHeader { get; set; }
public Property[] GetProperties()
public override Property[] GetProperties()
=> new[] {new Property {Value = "Very slow, but zero-config"}};
public ConfigurationItem[] GetConfigurationItems()
=> Array.Empty<ConfigurationItem>();
public Task<Result> Configure(ConfigurationItem[] configurationItems)
=> Task.FromResult(Result.Success());
public async Task<Uri> Upload(string fileName, string fileType, byte[] fileData)
public override async Task<Uri> Upload(string fileName, string fileType, byte[] fileData)
{
var fileUploadRequest = ToMultipartContent(fileName, fileType, fileData);
var uploadClient = RestClient.For<ICrustUploadApiClient>();
@ -64,12 +54,6 @@ public class CrustUploader : IUploader
return new Uri("https://gw.crustapps.net/ipfs/" + uploadResponse.Hash);
}
public Task<string> GetState()
=> Task.FromResult(string.Empty);
public Task SetState(string state)
=> Task.CompletedTask;
private MultipartContent ToMultipartContent(string fileName, string fileType, byte[] fileData)
{
var content = new MultipartFormDataContent();

View File

@ -2,28 +2,26 @@ using System.Net.Http.Headers;
using System.Text;
using CSharpFunctionalExtensions;
using NftFaucet.Plugins.Models;
using NftFaucet.Plugins.Models.Abstraction;
using NftFaucet.Plugins.Models.Enums;
using NftFaucet.UploadPlugins.Infura.ApiClients;
using RestEase;
namespace NftFaucet.UploadPlugins.Infura;
public class InfuraUploader : IUploader
public class InfuraUploader : Uploader
{
public Guid Id { get; } = Guid.Parse("c0d79c82-8e35-4cd6-ad35-bbe378088308");
public string Name { get; } = "Infura";
public string ShortName { get; } = "Infura";
public string ImageName { get; } = "infura_black.svg";
public bool IsSupported { get; } = true;
public bool IsConfigured { get; private set; } = false;
public override Guid Id { get; } = Guid.Parse("c0d79c82-8e35-4cd6-ad35-bbe378088308");
public override string Name { get; } = "Infura";
public override string ShortName { get; } = "Infura";
public override string ImageName { get; } = "infura_black.svg";
public override bool IsConfigured { get; protected set; }
private const string DefaultGatewayUrl = "https://ipfs.infura.io:5001";
private string ProjectId { get; set; }
private string ProjectSecret { get; set; }
private Uri DedicatedGatewayUrl { get; set; }
public Property[] GetProperties()
public override Property[] GetProperties()
{
var properties = new List<Property>();
if (IsConfigured)
@ -46,7 +44,7 @@ public class InfuraUploader : IUploader
return properties.ToArray();
}
public ConfigurationItem[] GetConfigurationItems()
public override ConfigurationItem[] GetConfigurationItems()
{
var projectIdInput = new ConfigurationItem
{
@ -72,7 +70,7 @@ public class InfuraUploader : IUploader
return new[] { projectIdInput, projectSecretInput, gatewayUrlInput };
}
public async Task<Result> Configure(ConfigurationItem[] configurationItems)
public override async Task<Result> Configure(ConfigurationItem[] configurationItems)
{
var projectId = configurationItems[0].Value;
var projectSecret = configurationItems[1].Value;
@ -136,7 +134,7 @@ public class InfuraUploader : IUploader
return Result.Success();
}
public async Task<Uri> Upload(string fileName, string fileType, byte[] fileData)
public override async Task<Uri> Upload(string fileName, string fileType, byte[] fileData)
{
var apiClient = GetInfuraClient(ProjectId, ProjectSecret);
var fileUploadRequest = ToMultipartContent(fileName, fileType, fileData);
@ -160,9 +158,9 @@ public class InfuraUploader : IUploader
return new Uri("ipfs://" + uploadResponse.Hash);
}
public Task<string> GetState()
public override Task<string> GetState()
{
var parts = new string[]
var parts = new[]
{
ProjectId,
ProjectSecret,
@ -172,7 +170,7 @@ public class InfuraUploader : IUploader
return Task.FromResult(state);
}
public Task SetState(string state)
public override Task SetState(string state)
{
if (string.IsNullOrEmpty(state))
return Task.CompletedTask;

View File

@ -1,37 +1,17 @@
using CSharpFunctionalExtensions;
using NftFaucet.Plugins.Models;
using NftFaucet.Plugins.Models.Abstraction;
namespace NftFaucet.UploadPlugins.NftStorage;
public class NftStorageUploader : IUploader
public class NftStorageUploader : Uploader
{
public Guid Id { get; } = Guid.Parse("ece2123a-cca7-4266-91e7-bc73680cf218");
public string Name { get; } = "nft.storage";
public string ShortName { get; } = "NftStorage";
public string ImageName { get; } = "nft-storage.svg";
public bool IsSupported { get; } = false;
public bool IsConfigured { get; } = false;
public override Guid Id { get; } = Guid.Parse("ece2123a-cca7-4266-91e7-bc73680cf218");
public override string Name { get; } = "nft.storage";
public override string ShortName { get; } = "NftStorage";
public override string ImageName { get; } = "nft-storage.svg";
public override bool IsSupported { get; } = false;
public Property[] GetProperties()
=> Array.Empty<Property>();
public ConfigurationItem[] GetConfigurationItems()
=> Array.Empty<ConfigurationItem>();
public Task<Result> Configure(ConfigurationItem[] configurationItems)
public override Task<Uri> Upload(string fileName, string fileType, byte[] fileData)
{
throw new NotImplementedException();
}
public Task<Uri> Upload(string fileName, string fileType, byte[] fileData)
{
throw new NotImplementedException();
}
public Task<string> GetState()
=> Task.FromResult(string.Empty);
public Task SetState(string state)
=> Task.CompletedTask;
}