mirror of
https://github.com/status-im/nft-faucet.git
synced 2025-02-23 12:08:32 +00:00
Add CanBeConfigured property to IProvider
This commit is contained in:
parent
4ded842c9e
commit
31beec9bd9
@ -61,10 +61,10 @@ public partial class ProvidersPage : BasicComponent
|
||||
}.Where(x => x != null).ToArray(),
|
||||
Buttons = new[]
|
||||
{
|
||||
!provider.IsInitialized
|
||||
? new CardListItemButton { Name = "Initialize", Style = ButtonStyle.Secondary, Action = () =>
|
||||
provider.CanBeConfigured
|
||||
? new CardListItemButton { Icon = "build", Style = ButtonStyle.Secondary, Action = () =>
|
||||
{
|
||||
provider.Initialize();
|
||||
provider.Configure();
|
||||
RefreshCards();
|
||||
}}
|
||||
: null,
|
||||
|
@ -9,9 +9,11 @@ public interface IProvider
|
||||
public string ShortName { get; }
|
||||
public string ImageName { get; }
|
||||
public bool IsSupported { get; }
|
||||
public bool IsInitialized { get; }
|
||||
|
||||
public void Initialize();
|
||||
public bool CanBeConfigured { get; }
|
||||
public bool IsConfigured { get; }
|
||||
public void Configure();
|
||||
|
||||
public List<(string Name, string Value)> GetProperties();
|
||||
public bool IsNetworkSupported(INetwork network);
|
||||
}
|
||||
|
@ -10,14 +10,14 @@ public class EthereumKeygenProvider : IProvider
|
||||
public string ShortName { get; } = "EthKeygen";
|
||||
public string ImageName { get; } = "ecdsa.svg";
|
||||
public bool IsSupported { get; } = true;
|
||||
|
||||
public bool IsInitialized { get; private set; }
|
||||
public bool CanBeConfigured { get; } = true;
|
||||
public bool IsConfigured { get; private set; }
|
||||
public EthereumKey Key { get; private set; }
|
||||
|
||||
public void Initialize()
|
||||
public void Configure()
|
||||
{
|
||||
Key = EthereumKey.GenerateNew();
|
||||
IsInitialized = true;
|
||||
IsConfigured = true;
|
||||
}
|
||||
|
||||
public List<(string Name, string Value)> GetProperties()
|
||||
|
@ -10,14 +10,14 @@ public class SolanaKeygenProvider : IProvider
|
||||
public string ShortName { get; } = "SolKeygen";
|
||||
public string ImageName { get; } = "ecdsa.svg";
|
||||
public bool IsSupported { get; } = true;
|
||||
|
||||
public bool IsInitialized { get; private set; }
|
||||
public bool CanBeConfigured { get; } = true;
|
||||
public bool IsConfigured { get; private set; }
|
||||
public SolanaKey Key { get; private set; }
|
||||
|
||||
public void Initialize()
|
||||
public void Configure()
|
||||
{
|
||||
Key = SolanaKey.GenerateNew();
|
||||
IsInitialized = true;
|
||||
IsConfigured = true;
|
||||
}
|
||||
|
||||
public List<(string Name, string Value)> GetProperties()
|
||||
|
@ -9,19 +9,19 @@ public class MetamaskProvider : IProvider
|
||||
public string ShortName { get; } = "Metamask";
|
||||
public string ImageName { get; } = "metamask_fox.svg";
|
||||
public bool IsSupported { get; } = true;
|
||||
public bool CanBeConfigured { get; } = true;
|
||||
public bool IsConfigured { get; private set; }
|
||||
|
||||
public bool IsInitialized { get; private set; }
|
||||
|
||||
public void Initialize()
|
||||
public void Configure()
|
||||
{
|
||||
IsInitialized = true;
|
||||
IsConfigured = true;
|
||||
}
|
||||
|
||||
public List<(string Name, string Value)> GetProperties()
|
||||
=> new List<(string Name, string Value)>
|
||||
{
|
||||
("Installed", "YES"),
|
||||
("Connected", IsInitialized ? "YES" : "NO"),
|
||||
("Connected", IsConfigured ? "YES" : "NO"),
|
||||
};
|
||||
|
||||
public bool IsNetworkSupported(INetwork network)
|
||||
|
@ -9,19 +9,19 @@ public class PhantomProvider : IProvider
|
||||
public string ShortName { get; } = "Phantom";
|
||||
public string ImageName { get; } = "phantom.svg";
|
||||
public bool IsSupported { get; } = true;
|
||||
public bool CanBeConfigured { get; } = true;
|
||||
public bool IsConfigured { get; private set; }
|
||||
|
||||
public bool IsInitialized { get; private set; }
|
||||
|
||||
public void Initialize()
|
||||
public void Configure()
|
||||
{
|
||||
IsInitialized = true;
|
||||
IsConfigured = true;
|
||||
}
|
||||
|
||||
public List<(string Name, string Value)> GetProperties()
|
||||
=> new List<(string Name, string Value)>
|
||||
{
|
||||
("Installed", "YES"),
|
||||
("Connected", IsInitialized ? "YES" : "NO"),
|
||||
("Connected", IsConfigured ? "YES" : "NO"),
|
||||
};
|
||||
|
||||
public bool IsNetworkSupported(INetwork network)
|
||||
|
Loading…
x
Reference in New Issue
Block a user