-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
52 lines (38 loc) · 1.5 KB
/
Program.cs
File metadata and controls
52 lines (38 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System.Net.Http.Json;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using MudBlazor.Services;
using Nethereum.GnosisValidator;
using Serilog;
using Nethereum.Blazor;
using Nethereum.EIP6963WalletInterop;
using Nethereum.Blazor.Storage;
using Nethereum.UI;
using Microsoft.AspNetCore.Components.Authorization;
using Nethereum.Blazor.EIP6963WalletInterop;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
if (!builder.RootComponents.Any())
{
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
}
builder.Services.AddMudServices();
builder.Services.AddAuthorizationCore();
builder.Services.AddSingleton<IEIP6963WalletInterop, EIP6963WalletBlazorInterop>();
builder.Services.AddSingleton<EIP6963WalletHostProvider>();
builder.Services.AddSingleton<LocalStorageHelper>();
//Add eip as the selected ethereum host provider
builder.Services.AddSingleton(services =>
{
var walletHostProvider = services.GetService<EIP6963WalletHostProvider>();
var selectedHostProvider = new SelectedEthereumHostProviderService();
selectedHostProvider.SetSelectedEthereumHostProvider(walletHostProvider);
return selectedHostProvider;
});
builder.Services.AddSingleton<AuthenticationStateProvider, EthereumAuthenticationStateProvider>();
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.WriteTo.BrowserConsole()
.CreateLogger();
var app = builder.Build();
await app.RunAsync();