2022-08-02 15:24:07 -05:00
|
|
|
using Ethereum.MetaMask.Blazor;
|
2022-03-31 19:55:58 +02:00
|
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
|
|
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
2022-09-29 23:11:55 -05:00
|
|
|
using NftFaucet.Models.State;
|
2022-03-31 22:16:43 +02:00
|
|
|
using NftFaucet.Options;
|
|
|
|
using NftFaucet.Services;
|
2022-09-29 23:11:55 -05:00
|
|
|
using NftFaucet;
|
|
|
|
using Radzen;
|
|
|
|
using TG.Blazor.IndexedDB;
|
2022-03-31 19:55:58 +02:00
|
|
|
|
|
|
|
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
2022-03-31 22:16:43 +02:00
|
|
|
|
2022-09-29 23:11:55 -05:00
|
|
|
builder.RootComponents.Add<App>("#app");
|
|
|
|
builder.RootComponents.Add<HeadOutlet>("head::after");
|
|
|
|
|
2022-03-31 22:16:43 +02:00
|
|
|
var settings = new Settings();
|
|
|
|
builder.Configuration.Bind(settings);
|
|
|
|
builder.Services.AddSingleton(settings);
|
|
|
|
|
2022-09-29 23:11:55 -05:00
|
|
|
builder.Services.AddScoped(sp => new HttpClient {BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)});
|
|
|
|
builder.Services.AddSingleton<PluginLoader>();
|
|
|
|
builder.Services.AddSingleton<Mapper>();
|
|
|
|
builder.Services.AddScoped<InitializationService>();
|
|
|
|
builder.Services.AddScoped<StateRepository>();
|
2022-03-31 22:16:43 +02:00
|
|
|
builder.Services.AddScoped<ScopedAppState>();
|
|
|
|
builder.Services.AddScoped<RefreshMediator>();
|
2022-09-29 23:11:55 -05:00
|
|
|
builder.Services.AddScoped<DialogService>();
|
|
|
|
builder.Services.AddScoped<NotificationService>();
|
|
|
|
builder.Services.AddScoped<TooltipService>();
|
|
|
|
builder.Services.AddScoped<ContextMenuService>();
|
2022-03-31 21:05:03 +02:00
|
|
|
builder.Services.AddMetaMaskBlazor();
|
2022-03-31 19:55:58 +02:00
|
|
|
|
2022-09-29 23:11:55 -05:00
|
|
|
builder.Services.AddIndexedDB(dbStore =>
|
|
|
|
{
|
|
|
|
dbStore.DbName = "NftFaucet";
|
2022-09-30 04:51:30 -05:00
|
|
|
dbStore.Version = 2;
|
2022-09-29 23:11:55 -05:00
|
|
|
|
|
|
|
dbStore.Stores.Add(new StoreSchema
|
|
|
|
{
|
|
|
|
Name = "AppState",
|
|
|
|
PrimaryKey = new IndexSpec { Name = "id", KeyPath = "id", Auto = true },
|
|
|
|
Indexes = new List<IndexSpec>
|
|
|
|
{
|
|
|
|
new IndexSpec {Name = "selectedNetwork", KeyPath = "selectedNetwork", Auto = false},
|
|
|
|
new IndexSpec {Name = "selectedProvider", KeyPath = "selectedProvider", Auto = false},
|
|
|
|
new IndexSpec {Name = "selectedContract", KeyPath = "selectedContract", Auto = false},
|
|
|
|
new IndexSpec {Name = "selectedToken", KeyPath = "selectedToken", Auto = false},
|
|
|
|
new IndexSpec {Name = "selectedUploadLocation", KeyPath = "selectedUploadLocation", Auto = false},
|
|
|
|
new IndexSpec {Name = "destinationAddress", KeyPath = "destinationAddress", Auto = false},
|
|
|
|
new IndexSpec {Name = "tokenAmount", KeyPath = "tokenAmount", Auto = false},
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
dbStore.Stores.Add(new StoreSchema
|
|
|
|
{
|
|
|
|
Name = "Tokens",
|
|
|
|
PrimaryKey = new IndexSpec { Name = "id", KeyPath = "id", Auto = true },
|
|
|
|
Indexes = new List<IndexSpec>
|
|
|
|
{
|
|
|
|
new IndexSpec {Name = "name", KeyPath = "name", Auto = false},
|
|
|
|
new IndexSpec {Name = "description", KeyPath = "description", Auto = false},
|
|
|
|
new IndexSpec {Name = "createdAt", KeyPath = "createdAt", Auto = false},
|
2022-09-30 04:51:30 -05:00
|
|
|
new IndexSpec {Name = "mainFileName", KeyPath = "mainFileName", Auto = false},
|
|
|
|
new IndexSpec {Name = "mainFileType", KeyPath = "mainFileType", Auto = false},
|
|
|
|
new IndexSpec {Name = "mainFileData", KeyPath = "mainFileData", Auto = false},
|
|
|
|
new IndexSpec {Name = "mainFileSize", KeyPath = "mainFileSize", Auto = false},
|
|
|
|
new IndexSpec {Name = "coverFileName", KeyPath = "coverFileName", Auto = false},
|
|
|
|
new IndexSpec {Name = "coverFileType", KeyPath = "coverFileType", Auto = false},
|
|
|
|
new IndexSpec {Name = "coverFileData", KeyPath = "coverFileData", Auto = false},
|
|
|
|
new IndexSpec {Name = "coverFileSize", KeyPath = "coverFileSize", Auto = false},
|
2022-09-29 23:11:55 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
dbStore.Stores.Add(new StoreSchema
|
|
|
|
{
|
|
|
|
Name = "UploadLocations",
|
|
|
|
PrimaryKey = new IndexSpec { Name = "id", KeyPath = "id", Auto = true },
|
|
|
|
Indexes = new List<IndexSpec>
|
|
|
|
{
|
|
|
|
new IndexSpec {Name = "tokenId", KeyPath = "tokenId", Auto = false},
|
|
|
|
new IndexSpec {Name = "name", KeyPath = "name", Auto = false},
|
|
|
|
new IndexSpec {Name = "location", KeyPath = "location", Auto = false},
|
|
|
|
new IndexSpec {Name = "createdAt", KeyPath = "createdAt", Auto = false},
|
|
|
|
new IndexSpec {Name = "uploaderId", KeyPath = "uploaderId", Auto = false},
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
dbStore.Stores.Add(new StoreSchema
|
|
|
|
{
|
|
|
|
Name = "ProviderStates",
|
|
|
|
PrimaryKey = new IndexSpec { Name = "id", KeyPath = "id", Auto = true },
|
|
|
|
Indexes = new List<IndexSpec>
|
|
|
|
{
|
|
|
|
new IndexSpec {Name = "state", KeyPath = "state", Auto = false},
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
dbStore.Stores.Add(new StoreSchema
|
|
|
|
{
|
|
|
|
Name = "UploaderStates",
|
|
|
|
PrimaryKey = new IndexSpec { Name = "id", KeyPath = "id", Auto = true },
|
|
|
|
Indexes = new List<IndexSpec>
|
|
|
|
{
|
|
|
|
new IndexSpec {Name = "state", KeyPath = "state", Auto = false},
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
var initializationService = app.Services.GetRequiredService<InitializationService>();
|
|
|
|
await initializationService.Initialize();
|
|
|
|
await app.RunAsync();
|