예제 #1
0
        /// <summary>
        /// Queries some data from an ethereum contract.
        /// </summary>
        /// <typeparam name="TFunc"> The type of the function to send. </typeparam>
        /// <typeparam name="TOut"> The return type of the contract query. </typeparam>
        /// <param name="function"> The function containing the data to query. </param>
        /// <param name="contractAddress"> The address of the contract to query data from. </param>
        /// <param name="senderAddress"> The address of the sender which is querying data. </param>
        /// <returns> Task returning the return type of the query. </returns>
        public static Task <TOut> QueryContract <TFunc, TOut>(TFunc function, string contractAddress, string senderAddress)
            where TFunc : FunctionMessage, new()
            where TOut : IFunctionOutputDTO, new()
        {
            function.SetDefaultFromAddressIfNotSet(senderAddress);
            var queryHandler = new QueryToDTOHandler <TFunc, TOut>(NetworkProvider.GetWeb3().Client, senderAddress);

            return(queryHandler.QueryAsync(contractAddress, function));
        }
예제 #2
0
 public MultiQueryHandler(IClient client, string multiCallContractAdress = "0xeefBa1e63905eF1D7ACbA5a8513c70307C1cE441", string defaultAddressFrom = null, BlockParameter defaultBlockParameter = null)
 {
     ContractAddress         = multiCallContractAdress;
     _multiQueryToDtoHandler = new QueryToDTOHandler <AggregateFunction, AggregateOutputDTO>(client, defaultAddressFrom, defaultBlockParameter);
 }