public async Task <bool> DoesModeratorExist(string address)
        {
            var isModerator = await ContractHandler.QueryAsync <ModeratorFunction, bool>(new ModeratorFunction()
            {
                Address = address
            });

            return(isModerator);
        }
Ejemplo n.º 2
0
        public async Task <IList <BigInteger> > GetAllContentIdsStruct()
        {
            var contract   = GetContract();
            var contentIds = await ContractHandler.QueryAsync <ContentIdsStructFunction, List <BigInteger> >(new ContentIdsStructFunction()
            {
            });

            return(contentIds);
        }
Ejemplo n.º 3
0
        public Task <BigInteger> GetPoNumberByEshopIdAndQuoteQueryAsync(string eShopId, BigInteger quoteId, BlockParameter blockParameter = null)
        {
            var getPoNumberBySellerAndQuoteFunction = new GetPoNumberByEshopIdAndQuoteFunction();

            getPoNumberBySellerAndQuoteFunction.EShopId = eShopId.ConvertToBytes32();
            getPoNumberBySellerAndQuoteFunction.QuoteId = quoteId;

            return(ContractHandler.QueryAsync <GetPoNumberByEshopIdAndQuoteFunction, BigInteger>(getPoNumberBySellerAndQuoteFunction, blockParameter));
        }
        public async Task <BigInteger> CountAllContentForSubArticle(long subArticleId)
        {
            var contract     = GetContract();
            var contentCount = await ContractHandler.QueryAsync <CountSubArticleContentFunction, BigInteger>(new CountSubArticleContentFunction()
            {
                SubArticleId = subArticleId
            });

            return(contentCount);
        }
        public async Task <List <BigInteger> > GetAllContentIdsForSubArticle(long subArticleId)
        {
            var contract   = GetContract();
            var contentIds = await ContractHandler.QueryAsync <ContentSubArticleIdsFunction, List <BigInteger> >(
                new ContentSubArticleIdsFunction()
            {
                SubArticleId = subArticleId
            });

            if (contentIds != null)
            {
                return(contentIds);
            }
            return(null);
        }
        public async Task <RawPageContent> GetContentById(long contentId)
        {
            var contract = GetContract();
            var content  = await ContractHandler.QueryAsync <ContentByIdFunction, string>(new ContentByIdFunction()
            {
                ContentId = contentId
            });

            if (!string.IsNullOrEmpty(content))
            {
                return new RawPageContent()
                       {
                           ContentId = contentId,
                           Data      = content
                       }
            }
            ;
            return(null);
        }
        private void GetContract()
        {
            // hook up to the contract and event
            ContractHandler lookupContractHandler = _web3.Eth.GetContractHandler(_lookupContractAddress);
            string          ncContractAddress     = lookupContractHandler
                                                    .QueryAsync <NodeControlContractFunction, string>().Result;


            if (string.IsNullOrWhiteSpace(ncContractAddress))
            {
                Log($"Unable to retrieve contract address from lookup at {_lookupContractAddress}");
                throw new Exception("Unable to retrieve node control contract address from lookup.");
            }

            Log($"Retrieved Contract Address {ncContractAddress} from lookup at {_lookupContractAddress}");

            _contractHandler    = _web3.Eth.GetContractHandler(ncContractAddress);
            _updateEventHandler = _web3.Eth.GetEvent <UpdateEventDto>(ncContractAddress);
            _ncContractAddress  = ncContractAddress;
        }
Ejemplo n.º 8
0
        private async Task <TokenInfo> GetTokenInfoAsyncCall()
        {
            var contract = GetContract();
            var address  = await ContractHandler.QueryAsync <CreatorFunction, string>(new CreatorFunction());

            var symbol = await ContractHandler.QueryAsync <SymbolFunction, string>(new SymbolFunction());

            var tokenName = await ContractHandler.QueryAsync <NameFunction, string>(new NameFunction());

            var totalSupply = await ContractHandler.QueryAsync <TotalSupplyFunction, BigInteger>(new TotalSupplyFunction());

            var totalSupplyDecimal = Web3.Convert.FromWei(totalSupply);

            return(new TokenInfo()
            {
                Name = tokenName,
                Symbol = symbol,
                Creator = address,
                TotalSupply = totalSupply,
                TotalSupplyDecimal = totalSupplyDecimal
            });
        }
Ejemplo n.º 9
0
 public Task <bool> SupportsInterfaceQueryAsync(SupportsInterfaceFunction SupportsInterfaceFunction, BlockParameter BlockParameter = null)
 {
     return(ContractHandler.QueryAsync <SupportsInterfaceFunction, bool>(SupportsInterfaceFunction, BlockParameter));
 }
Ejemplo n.º 10
0
 public Task <string> VersionQueryAsync(BlockParameter blockParameter = null)
 {
     return(ContractHandler.QueryAsync <VERSIONFunction, string>(null, blockParameter));
 }