public void ConfigureServices(IServiceCollection services) { var web3ServiceProvider = new Web3ProviderService(); var accountsService = new AccountsService(web3ServiceProvider); var newBlockProcessingService = new NewBlockProcessingService(web3ServiceProvider); var toastsViewModel = new ToastsViewModel(); var blocksViewModel = new BlocksViewModel(newBlockProcessingService); var latestBlockTransactionsViewModel = new LatestBlockTransactionsViewModel(web3ServiceProvider); var newAccountPrivateKeyViewModel = new NewAccountPrivateKeyViewModel(); var accountsViewModel = new AccountsViewModel(accountsService, newAccountPrivateKeyViewModel); var accountsTransactionMonitoringService = new AccountsTransactionMonitoringService(accountsService, web3ServiceProvider); services.AddSingleton <IWeb3ProviderService, Web3ProviderService>((x) => web3ServiceProvider); services.AddSingleton <IAccountsService, AccountsService>((x) => accountsService); services.AddSingleton <NewBlockProcessingService>(newBlockProcessingService); services.AddSingleton <ToastsViewModel>(toastsViewModel); services.AddSingleton <BlocksViewModel>(blocksViewModel); services.AddSingleton <LatestBlockTransactionsViewModel>(latestBlockTransactionsViewModel); services.AddTransient <BlockTransactionsViewModel>(); services.AddSingleton <AccountsViewModel>(accountsViewModel); services.AddSingleton <NewAccountPrivateKeyViewModel>(newAccountPrivateKeyViewModel); services.AddSingleton <SendTransactionViewModel>(); services.AddSingleton <SendErc20TransactionViewModel>(); services.AddSingleton(accountsTransactionMonitoringService); services.AddSingleton <TransactionWithReceiptViewModel>(); services.AddFlexGrid(cfg => { cfg.ApplyConfiguration(new TransactionsViewModelGridConfiguration()); }); services.AddSingleton <Web3UrlViewModel>(); services.AddStorage(); }
public App(string[] args = null, IFileProvider fileProvider = null) { var hostBuilder = MobileBlazorBindingsHost.CreateDefaultBuilder() .ConfigureServices((hostContext, services) => { // Adds web-specific services such as NavigationManager services.AddBlazorHybrid(); // Register app-specific services //services.AddSingleton<CounterState>(); var web3ServiceProvider = new Web3ProviderService(); var accountsService = new AccountsService(web3ServiceProvider); var newBlockProcessingService = new NewBlockProcessingService(web3ServiceProvider); var toastsViewModel = new ToastsViewModel(); var blocksViewModel = new BlocksViewModel(newBlockProcessingService); var latestBlockTransactionsViewModel = new LatestBlockTransactionsViewModel(web3ServiceProvider); var newAccountPrivateKeyViewModel = new NewAccountPrivateKeyViewModel(); var accountsViewModel = new AccountsViewModel(accountsService, newAccountPrivateKeyViewModel); var accountsTransactionMonitoringService = new AccountsTransactionMonitoringService(accountsService, web3ServiceProvider); services.AddSingleton <IWeb3ProviderService, Web3ProviderService>((x) => web3ServiceProvider); services.AddSingleton <IAccountsService, AccountsService>((x) => accountsService); services.AddSingleton <NewBlockProcessingService>(newBlockProcessingService); services.AddSingleton <ToastsViewModel>(toastsViewModel); services.AddSingleton <BlocksViewModel>(blocksViewModel); services.AddSingleton <LatestBlockTransactionsViewModel>(latestBlockTransactionsViewModel); services.AddTransient <BlockTransactionsViewModel>(); services.AddSingleton <AccountsViewModel>(accountsViewModel); services.AddSingleton <NewAccountPrivateKeyViewModel>(newAccountPrivateKeyViewModel); services.AddSingleton <SendTransactionViewModel>(); services.AddSingleton <SendErc20TransactionViewModel>(); services.AddSingleton(accountsTransactionMonitoringService); services.AddSingleton <TransactionWithReceiptViewModel>(); services.AddSingleton <Web3UrlViewModel>(); services.AddFlexGrid(cfg => { cfg.ApplyConfiguration(new TransactionsViewModelGridConfiguration()); }); }) .UseWebRoot("wwwroot"); if (fileProvider != null) { hostBuilder.UseStaticFiles(fileProvider); } else { hostBuilder.UseStaticFiles(); } var host = hostBuilder.Build(); MainPage = new ContentPage(); NavigationPage.SetHasNavigationBar(MainPage, false); host.AddComponent <Main>(parent: MainPage); }
public static MauiApp CreateMauiApp() { var builder = MauiApp.CreateBuilder(); builder .RegisterBlazorMauiWebView() .UseMauiApp <App>() .ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); }); builder.Services.AddBlazorWebView(); var services = builder.Services; var web3ServiceProvider = new Web3ProviderService(); var accountsService = new AccountsService(web3ServiceProvider); var newBlockProcessingService = new NewBlockProcessingService(web3ServiceProvider); var toastsViewModel = new ToastsViewModel(); var blocksViewModel = new BlocksViewModel(newBlockProcessingService); var latestBlockTransactionsViewModel = new LatestBlockTransactionsViewModel(web3ServiceProvider); var newAccountPrivateKeyViewModel = new NewAccountPrivateKeyViewModel(); var accountsViewModel = new AccountsViewModel(accountsService, newAccountPrivateKeyViewModel); var accountsTransactionMonitoringService = new AccountsTransactionMonitoringService(accountsService, web3ServiceProvider); services.AddSingleton <IWeb3ProviderService, Web3ProviderService>((x) => web3ServiceProvider); services.AddSingleton <IAccountsService, AccountsService>((x) => accountsService); services.AddSingleton <NewBlockProcessingService>(newBlockProcessingService); services.AddSingleton <ToastsViewModel>(toastsViewModel); services.AddSingleton <BlocksViewModel>(blocksViewModel); services.AddSingleton <LatestBlockTransactionsViewModel>(latestBlockTransactionsViewModel); services.AddTransient <BlockTransactionsViewModel>(); services.AddSingleton <AccountsViewModel>(accountsViewModel); services.AddSingleton <NewAccountPrivateKeyViewModel>(newAccountPrivateKeyViewModel); services.AddSingleton <SendTransactionViewModel>(); services.AddSingleton <SendErc20TransactionViewModel>(); services.AddSingleton(accountsTransactionMonitoringService); services.AddSingleton <TransactionWithReceiptViewModel>(); services.AddSingleton <Web3UrlViewModel>(); services.AddFlexGrid(cfg => { cfg.ApplyConfiguration(new TransactionsViewModelGridConfiguration()); }); return(builder.Build()); }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { var ipfsClient = new IpfsClient("https://ipfs.infura.io:5001"); var web3ServiceProvider = new Web3ProviderService(); var accountsService = new AccountsService(web3ServiceProvider); var ipfsProviderService = new IpfsProviderService(ipfsClient); services.AddMvc() .AddNewtonsoftJson(); services.AddRazorComponents(); services.AddSingleton <IWeb3ProviderService, Web3ProviderService>((x) => web3ServiceProvider); services.AddSingleton <IAccountsService, AccountsService>((x) => accountsService); services.AddSingleton <IIpfsProviderService, IpfsProviderService>((x) => ipfsProviderService); services.AddSingleton <AssetService>(); }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddRazorPages(); services.AddServerSideBlazor(); //NOTE: Server side singleton, just for local usage and sample, you would not want to use the Account services in server mode /// use the Metamask integration in other templates var web3ServiceProvider = new Web3ProviderService(); var accountsService = new AccountsService(web3ServiceProvider); var newBlockProcessingService = new NewBlockProcessingService(web3ServiceProvider); var toastsViewModel = new ToastsViewModel(); var blocksViewModel = new BlocksViewModel(newBlockProcessingService); var latestBlockTransactionsViewModel = new LatestBlockTransactionsViewModel(web3ServiceProvider); var newAccountPrivateKeyViewModel = new NewAccountPrivateKeyViewModel(); var accountsViewModel = new AccountsViewModel(accountsService, newAccountPrivateKeyViewModel); var accountsTransactionMonitoringService = new AccountsTransactionMonitoringService(accountsService, web3ServiceProvider); services.AddSingleton <IWeb3ProviderService, Web3ProviderService>((x) => web3ServiceProvider); services.AddSingleton <IAccountsService, AccountsService>((x) => accountsService); services.AddSingleton <NewBlockProcessingService>(newBlockProcessingService); services.AddSingleton <ToastsViewModel>(toastsViewModel); services.AddSingleton <BlocksViewModel>(blocksViewModel); services.AddSingleton <LatestBlockTransactionsViewModel>(latestBlockTransactionsViewModel); services.AddTransient <BlockTransactionsViewModel>(); services.AddSingleton <AccountsViewModel>(accountsViewModel); services.AddSingleton <NewAccountPrivateKeyViewModel>(newAccountPrivateKeyViewModel); services.AddSingleton <SendTransactionViewModel>(); services.AddSingleton <SendErc20TransactionViewModel>(); services.AddSingleton(accountsTransactionMonitoringService); services.AddSingleton <TransactionWithReceiptViewModel>(); services.AddFlexGridServerSide(cfg => { cfg.ApplyConfiguration(new TransactionsViewModelGridConfiguration()); }); services.AddSingleton <Web3UrlViewModel>(); }