Ejemplo n.º 1
0
        static async Task <GetAllOrdersOutputDTOBase> GetAllOrdersEth()
        {
            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);

            //get the contract we deployed
            GetAllOrdersFunction getAllOrders = new GetAllOrdersFunction();

            getAllOrders.FromAddress = senderAddress;

            OrderSystemService service = new OrderSystemService(web3, ganacheOrderSystemContractAddress);
            var theAllResult           = await service.GetAllOrdersQueryAsync(getAllOrders);

            return(theAllResult);
        }
Ejemplo n.º 2
0
 public Task <GetAllOrdersOutputDTO> GetAllOrdersQueryAsync(GetAllOrdersFunction getAllOrdersFunction, BlockParameter blockParameter = null)
 {
     return(ContractHandler.QueryDeserializingToObjectAsync <GetAllOrdersFunction, GetAllOrdersOutputDTO>(getAllOrdersFunction, blockParameter));
 }