Exemplo n.º 1
0
        public async Task SeedEverythingAsync(ExplorerDbContext context)
        {
            try
            {
                var sw = new Stopwatch();
                sw.Start();
                context.Database.EnsureCreated();
                _phantasmaRpcService = (IPhantasmaRpcService)Explorer.AppServices.GetService(typeof(IPhantasmaRpcService));

                if (!context.Apps.Any())
                {
                    var appList = await _phantasmaRpcService.GetApplications.SendRequestAsync();

                    await SyncUtils.SyncApps(context, appList);
                }

                if (!context.Tokens.Any())
                {
                    var tokenList = await _phantasmaRpcService.GetTokens.SendRequestAsync();

                    await SyncUtils.SyncToken(context, tokenList);
                }

                if (!context.Chains.Any())
                {
                    await SeedChains(context);
                }

                if (!context.Blocks.Any())
                {
                    await SeedBlocks(context);
                }

                sw.Stop();
                Console.WriteLine("Elapsed time to initializing db = {0}", sw.Elapsed);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                Console.WriteLine("Exception occurred during DB initialization, explorer cannot start");
            }
        }
 public ExplorerSync()
 {
     _phantasmaRpcService = Explorer.AppServices.GetService <IPhantasmaRpcService>();
     _addressChanged      = new List <string>();
 }
Exemplo n.º 3
0
 public AccountController()
 {
     _phantasmaRpcService = (IPhantasmaRpcService)Backend.AppServices.GetService(typeof(IPhantasmaRpcService));
 }
Exemplo n.º 4
0
 public MarketplaceController() : base(Explorer.AppServices.GetService <ExplorerDbContext>())
 {
     _phantasmaRpcService = Explorer.AppServices.GetService <IPhantasmaRpcService>();
 }