public string ChangeSeatingOffline(string privateKey, bool canSend, string newSeatingNumber)
        {
            var changeSeatingLimitFunction = contract.GetFunction("changeSeatingLimit");
            var data = changeSeatingLimitFunction.GetData(newSeatingNumber);

            var potentialGasCost = ServiceSync.Sync(changeSeatingLimitFunction.EstimateGasAsync(69));

            var    txCount   = ContractHelper.Instance.GetTransactionCount();
            string encodedTx = ContractHelper.Instance.SignTransactionOffline(privateKey, contractAddress, txCount, data);

            if (ContractHelper.Instance.VerifyTransaction(encodedTx))
            {
                Console.WriteLine("OK");
            }

            if (canSend)
            {
                var offlineTransactionHash = ContractHelper.Instance.SendRawTx(encodedTx);
                return(ContractHelper.Instance.GetReceiptHash(offlineTransactionHash));
            }
            else
            {
                return(encodedTx);
            }
        }
        public string BuyTicket()
        {
            var buyTicketFunction = contract.GetFunction("buyTicket");
            var transactionHash   = ServiceSync.Sync(buyTicketFunction.SendTransactionAsync(Constants.AddressFrom, Constants.MaxGas, new HexBigInteger(5)));

            return(ContractHelper.Instance.GetReceiptHash(transactionHash));
        }
        public long GetAmountCustomerPaid(string customerAcc)
        {
            var customerPaidFunc = contract.GetFunction("customerPaid");

            return(ServiceSync.Sync(customerPaidFunc.CallAsync <long>(customerAcc)));
        }
 private void createFilters()
 {
     depositEvent  = contract.GetEvent("Deposit");
     depositFilter = ServiceSync.Sync(depositEvent.CreateFilterAsync());
 }
 public long GetSeatingLimit()
 {
     return(ServiceSync.Sync(contract.GetFunction("seatingLimit").CallAsync <long>()));
 }
 public long GetCustomerAmount()
 {
     return(ServiceSync.Sync(contract.GetFunction("numCustomers").CallAsync <long>()));
 }
        public string ShowAllDepositEvent()
        {
            var log = ServiceSync.Sync(depositEvent.GetAllChanges <DepositEvent>(depositFilter));

            return(UtilityHelper.Dump(log));
        }
示例#8
0
        private void btnGetTxinBlock_Click(object sender, EventArgs e)
        {
            var blockService = ContractHelper.Instance.Web3.Eth.Blocks;

            txtBinary.Text = UtilityHelper.Dump(ServiceSync.Sync(blockService.GetBlockWithTransactionsByNumber.SendRequestAsync(new BlockParameter(ulong.Parse(txtBlockNumber.Text)))));
        }