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;
|
2022-09-20 21:13:34 -05:00
|
|
|
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 &&
|
2022-09-20 21:41:53 -05:00
|
|
|
AppState.SelectedUploadLocation != null &&
|
2022-09-29 21:54:11 -05:00
|
|
|
AppState.UserStorage.DestinationAddress != null;
|
2022-09-20 20:20:18 -05:00
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
{
|
2022-10-02 20:55:07 -05:00
|
|
|
if (AppState?.SelectedWallet?.IsConfigured ?? false)
|
2022-09-20 20:20:18 -05:00
|
|
|
{
|
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 20:20:18 -05:00
|
|
|
}
|
|
|
|
}
|
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
|
|
|
}
|