예제 #1
0
        public ChainViewModel GetChain(string chainInput)
        {
            var chainQuery = new ChainQueries(_context);
            var repoChain  = chainQuery.QueryChainIncludeBlocksAndTxs(chainInput);
            var chainList  = chainQuery.QueryChains().ToList();

            if (repoChain == null)
            {
                return(null);
            }

            return(ChainViewModel.FromChain(chainList, repoChain));
        }
예제 #2
0
        public async Task <MarketplaceViewModel> GetAuctions(string chain, int currentPage, int pageSize = AppSettings.PageSize, string tokenSymbol = null)
        {
            var tokenQueries = new TokenQueries(_context);
            var chainQueries = new ChainQueries(_context);
            var tokenList    = tokenQueries.QueryTokens();

            var chains = chainQueries.QueryChains();
            List <AuctionDto> auctions = new List <AuctionDto>();

            var auction = await _phantasmaRpcService.GetAuctions.SendRequestAsync(chain, "", currentPage, pageSize);

            auctions.AddRange(auction.AuctionsList);

            return(MarketplaceViewModel.FromAuctionList(auctions, tokenList));
        }
예제 #3
0
        public async Task <List <string> > GetChainsWithMarketsAndActiveAuctions()
        {
            var chainQueries     = new ChainQueries(_context);
            var chainsWithMarket = chainQueries.QueryChains()
                                   .Where(p => p.Contracts.Any(c => c == "market"))
                                   .Select(p => p.Name).ToList();

            List <string> chainList = new List <string>();

            foreach (var chain in chainsWithMarket) //check if they have auctions
            {
                var auctions = await _phantasmaRpcService.GetAuctionCount.SendRequestAsync(chain);

                if (auctions > 0)
                {
                    chainList.Add(chain);
                }
            }

            return(chainList);
        }