Exemple #1
0
        static async Task <bool> ChangeOrderStatus(string orderid, int status)
        {
            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(DataController.senderAddress, DataController.senderPassword, 1200).ConfigureAwait(false);

            ChangeStatusFunction statusChange = new ChangeStatusFunction();

            statusChange.Orderid     = orderid;
            statusChange.Newstatus   = status;
            statusChange.FromAddress = senderAddress;


            OrderSystemService service = new OrderSystemService(web3, ganacheOrderSystemContractAddress);

            var theresult = await service.ChangeStatusRequestAsync(statusChange);

            return(theresult.Length > 0);
        }
Exemple #2
0
        public Task <string> ChangeStatusRequestAsync(string orderid, BigInteger newstatus)
        {
            var changeStatusFunction = new ChangeStatusFunction();

            changeStatusFunction.Orderid   = orderid;
            changeStatusFunction.Newstatus = newstatus;

            return(ContractHandler.SendRequestAsync(changeStatusFunction));
        }
Exemple #3
0
        public Task <TransactionReceipt> ChangeStatusRequestAndWaitForReceiptAsync(string orderid, BigInteger newstatus, CancellationTokenSource cancellationToken = null)
        {
            var changeStatusFunction = new ChangeStatusFunction();

            changeStatusFunction.Orderid   = orderid;
            changeStatusFunction.Newstatus = newstatus;

            return(ContractHandler.SendRequestAndWaitForReceiptAsync(changeStatusFunction, cancellationToken));
        }
Exemple #4
0
 public Task <string> ChangeStatusRequestAsync(ChangeStatusFunction changeStatusFunction)
 {
     return(ContractHandler.SendRequestAsync(changeStatusFunction));
 }
Exemple #5
0
 public Task <TransactionReceipt> ChangeStatusRequestAndWaitForReceiptAsync(ChangeStatusFunction changeStatusFunction, CancellationTokenSource cancellationToken = null)
 {
     return(ContractHandler.SendRequestAndWaitForReceiptAsync(changeStatusFunction, cancellationToken));
 }