Beispiel #1
0
        static async Task <GetOrdersOutputDTOBase> GetOrdersEth(BigInteger timespan)
        {
            var web3 = new Web3("http://127.0.0.1:7545");

            //testing with the ethereum /truffle example from the petshop tutorial
            var json     = JObject.Load(new JsonTextReader(new StreamReader(System.IO.File.OpenRead(orderSystemJson))));
            var abi      = json["abi"].ToString();
            var bytecode = json["bytecode"].ToString();
            var ganacheOrderSystemContractAddress = json["networks"]["5777"]["address"].ToString();

            var unlockAccountResult = await web3.Personal.UnlockAccount.SendRequestAsync(senderAddress, senderPassword, 1200).ConfigureAwait(false);

            var unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds - timespan;

            //get the contract we deployed
            GetOrdersFunction getOrders = new GetOrdersFunction();

            getOrders.TimeGreaterThan = unixTimestamp;
            getOrders.FromAddress     = senderAddress;

            OrderSystemService service2 = new OrderSystemService(web3, ganacheOrderSystemContractAddress);
            var theresult = await service2.GetOrdersQueryAsync(getOrders);

            return(theresult);
        }
Beispiel #2
0
        public Task <GetOrdersOutputDTO> GetOrdersQueryAsync(BigInteger timeGreaterThan, BlockParameter blockParameter = null)
        {
            var getOrdersFunction = new GetOrdersFunction();

            getOrdersFunction.TimeGreaterThan = timeGreaterThan;

            return(ContractHandler.QueryDeserializingToObjectAsync <GetOrdersFunction, GetOrdersOutputDTO>(getOrdersFunction, blockParameter));
        }
Beispiel #3
0
 public Task <GetOrdersOutputDTO> GetOrdersQueryAsync(GetOrdersFunction getOrdersFunction, BlockParameter blockParameter = null)
 {
     return(ContractHandler.QueryDeserializingToObjectAsync <GetOrdersFunction, GetOrdersOutputDTO>(getOrdersFunction, blockParameter));
 }