public Task <GetSellerOutputDTO> GetSellerQueryAsync(string sellerId, BlockParameter blockParameter = null)
        {
            var getSellerFunction = new GetSellerFunction();

            getSellerFunction.SellerId = sellerId.ConvertToBytes32();

            return(ContractHandler.QueryDeserializingToObjectAsync <GetSellerFunction, GetSellerOutputDTO>(getSellerFunction, blockParameter));
        }
        public Task <GetEshopOutputDTO> GetEshopQueryAsync(string eShopId, BlockParameter blockParameter = null)
        {
            var getEshopFunction = new GetEshopFunction();

            getEshopFunction.EShopId = eShopId.ConvertToBytes32();

            return(ContractHandler.QueryDeserializingToObjectAsync <GetEshopFunction, GetEshopOutputDTO>(getEshopFunction, blockParameter));
        }
Exemplo n.º 3
0
        protected QueryResult <TOuputDTO> WhenQuerying <TQueryFunction, TOuputDTO>(TQueryFunction queryFunction) where TQueryFunction : FunctionMessage, new()
            where TOuputDTO : IFunctionOutputDTO, new()
        {
            TestLogger.LogWhenQueryFunction(queryFunction);
            var result = ContractHandler.QueryDeserializingToObjectAsync <TQueryFunction, TOuputDTO>(queryFunction).Result;

            return(new QueryResult <TOuputDTO>(ContractHandler, result, TestLogger, Stateprinter));
        }
        /// <summary>
        /// Gets a transaction out of the transactions mapping on the contract and decodes it.
        /// </summary>
        /// <param name="web3">The web3 interface instance to use.</param>
        /// <param name="contractAddress">The address of the deployed multisig wallet contract.</param>
        /// <param name="transactionId">The multisig wallet transaction identifier.</param>
        /// <returns>A decoded transaction object.</returns>
        public static async Task <TransactionDTO> GetTransactionAsync(Web3 web3, string contractAddress, BigInteger transactionId)
        {
            ContractHandler handler = web3.Eth.GetContractHandler(contractAddress);

            return(await handler.QueryDeserializingToObjectAsync <TransactionsFunction, TransactionDTO>(new TransactionsFunction()
            {
                TransactionId = transactionId
            }).ConfigureAwait(false));
        }
        /// <summary>
        /// Checks whether the given transaction identified by the transactionId has been confirmed by the given address.
        /// </summary>
        /// <param name="web3">The web3 interface instance to use.</param>
        /// <param name="contractAddress">The address of the deployed multisig wallet contract.</param>
        /// <param name="transactionId">The multisig wallet transaction identifier.</param>
        /// <param name="address">The address to check the transaction's confirmation status with.</param>
        /// <returns>An object containing the boolean confirmation state.</returns>
        public static async Task <ConfirmationsDTO> AddressConfirmedTransactionAsync(Web3 web3, string contractAddress, BigInteger transactionId, string address)
        {
            ContractHandler handler = web3.Eth.GetContractHandler(contractAddress);

            return(await handler.QueryDeserializingToObjectAsync <ConfirmationsFunction, ConfirmationsDTO>(new ConfirmationsFunction()
            {
                TransactionId = transactionId, Address = address
            }).ConfigureAwait(false));
        }
Exemplo n.º 6
0
        protected QueryResult <TOuputDTO> WhenQueryingThen <TQueryFunction, TOuputDTO>(TQueryFunction queryFunction, TOuputDTO expectedOutput) where TQueryFunction : FunctionMessage, new()
            where TOuputDTO : IFunctionOutputDTO, new()
        {
            TestLogger.LogWhenQueryFunctionThen(queryFunction, expectedOutput);
            var result = ContractHandler.QueryDeserializingToObjectAsync <TQueryFunction, TOuputDTO>(queryFunction).Result;

            Stateprinter.Assert.AreEqual(
                Stateprinter.PrintObject(expectedOutput),
                Stateprinter.PrintObject(result));
            return(new QueryResult <TOuputDTO>(ContractHandler, result, TestLogger, Stateprinter));
        }
Exemplo n.º 7
0
        public async Task <IList <RawPageContent> > GetContentBySubArticleIdStruct(long subArticleId)
        {
            var contract = GetContract();
            var content  = await ContractHandler.QueryDeserializingToObjectAsync <ContentSubArticleStructFunction, ContentListStructOutputDTO>(new ContentSubArticleStructFunction()
            {
                SubArticleId = subArticleId
            });

            if (content != null)
            {
                return(content.Contents.Select(x => new RawPageContent()
                {
                    ArticleId = (long)x.ArticleId,
                    ContentId = (long)x.ContentId,
                    Data = x.Data,
                    SubArticleId = (long)x.SubArticleId,
                    Timestamp = new DateTime((long)x.Timestamp)
                }).ToList());
            }
            return(new List <RawPageContent>());
        }
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <returns></returns>
        public async Task <NodeState> GetExpectedState()
        {
            // Make sure the correct contract is referenced
            GetContract();

            UpdateStateDto contractResponse = await _contractHandler.QueryDeserializingToObjectAsync <RetrieveUpdateFunction, UpdateStateDto>(new RetrieveUpdateFunction
            {
                ValidatorAddress = _validatorAddress,
                FromAddress      = _validatorAddress
            });

            return(new NodeState
            {
                DockerImage = contractResponse.ValidatorState.DockerName,
                DockerChecksum = ConvertBytesToHexString(contractResponse.ValidatorState.DockerSha),
                IsSigning = contractResponse.ValidatorState.IsSigning,
                ChainspecUrl = contractResponse.ValidatorState.ChainSpecUrl,
                ChainspecChecksum = ConvertBytesToHexString(contractResponse.ValidatorState.ChainSpecSha),
                UpdateIntroducedBlock = contractResponse.ValidatorState.UpdateIntroduced
            });
        }
Exemplo n.º 9
0
        public async Task <RawPageContent> GetContentByIdStruct(long contentId)
        {
            var contract = GetContract();
            var content  = await ContractHandler.QueryDeserializingToObjectAsync <ContentStructFunction, ContentStructOutputDTO>(new ContentStructFunction()
            {
                ContentId = contentId
            });

            if (content != null && content.Contents != null && content.Contents.ContentId > 0)
            {
                return new RawPageContent()
                       {
                           ArticleId    = (long)content.Contents.ArticleId,
                           ContentId    = (long)content.Contents.ContentId,
                           Data         = content.Contents.Data,
                           SubArticleId = (long)content.Contents.SubArticleId,
                           Timestamp    = new DateTime((long)content.Contents.Timestamp)
                       }
            }
            ;
            return(null);
        }