nft-faucet/NftFaucet/Pages/MintPage.razor.cs

36 lines
1.4 KiB
C#
Raw Permalink Normal View History

2022-09-20 22:24:05 -05:00
using CSharpFunctionalExtensions;
2022-09-29 23:11:55 -05:00
using NftFaucet.Components;
2022-10-02 13:30:56 -05:00
using NftFaucet.Domain.Utils;
using Radzen;
2022-09-18 22:15:59 -05:00
2022-09-29 23:11:55 -05:00
namespace NftFaucet.Pages;
2022-09-18 22:15:59 -05:00
public partial class MintPage : BasicComponent
{
2022-09-20 22:24:05 -05:00
private string SourceAddress { get; set; }
2022-09-18 22:15:59 -05:00
private bool IsReadyToMint => AppState != null &&
AppState.SelectedNetwork != null &&
2022-10-02 20:55:07 -05:00
AppState.SelectedWallet != null &&
AppState.SelectedWallet.IsConfigured &&
2022-09-18 22:15:59 -05:00
AppState.SelectedContract != null &&
AppState.SelectedToken != null &&
AppState.SelectedUploadLocation != null &&
2022-09-29 21:54:11 -05:00
AppState.UserStorage.DestinationAddress != null;
protected override async Task OnInitializedAsync()
{
2022-10-02 20:55:07 -05:00
if (AppState?.SelectedWallet?.IsConfigured ?? false)
{
2022-10-02 20:55:07 -05:00
SourceAddress = await ResultWrapper.Wrap(() => AppState.SelectedWallet.GetAddress()).Match(x => x, _ => null);
2022-09-28 20:49:55 -05:00
AppState.UserStorage.DestinationAddress = SourceAddress;
}
}
2022-09-20 21:05:08 -05:00
private async Task Mint()
{
2022-09-29 21:54:11 -05:00
await DialogService.OpenAsync<MintDialog>("Minting...",
new Dictionary<string, object>(),
new DialogOptions() { Width = "700px", Height = "570px", Resizable = true, Draggable = true });
2022-09-20 21:05:08 -05:00
}
2022-09-18 22:15:59 -05:00
}