public async Task <Tuple <bool, string> > AddUserRequestAsync(LoginDetails details) { RhodeITDB db = new RhodeITDB(); AddUserFunction addUserFunction = new AddUserFunction { FromAddress = details.Ethereum_Address, Gas = Variables.gas, Studentno_staff_no = details.User_ID }; string receipt = "0x"; bool exists = await UserExistsRequestAndWaitForReceiptAsync(details.Ethereum_Address).ConfigureAwait(false); if (exists) { db.StoreTransactionReceipt(new Models.TransactionReceipt { Receipt = receipt, Activity = "LoggedIn" }); } else { receipt = await ContractHandler.SendRequestAsync(addUserFunction).ConfigureAwait(false); exists = await UserExistsRequestAndWaitForReceiptAsync(details.Ethereum_Address).ConfigureAwait(false); db.StoreTransactionReceipt(new Models.TransactionReceipt { Receipt = receipt, Activity = "Registered" }); db.UpdateLoginDetails(details); } return(new Tuple <bool, string>(exists, receipt)); }
public Task <TransactionReceipt> AddUserRequestAndWaitForReceiptAsync(string studentNo, CancellationTokenSource cancellationToken = null) { var addUserFunction = new AddUserFunction(); addUserFunction.StudentNo = studentNo; addUserFunction.FromAddress = Vars.senderAddress; return(ContractHandler.SendRequestAndWaitForReceiptAsync(addUserFunction, cancellationToken)); }
public Task <string> AddUserRequestAsync(string studentNo) { var addUserFunction = new AddUserFunction(); addUserFunction.StudentNo = studentNo; addUserFunction.FromAddress = Vars.senderAddress; return(ContractHandler.SendRequestAsync(addUserFunction)); }
public Task <TransactionReceipt> AddUserRequestAndWaitForReceiptAsync(string studentNo, CancellationTokenSource cancellationToken = null) { var addUserFunction = new AddUserFunction(); addUserFunction.StudentNo = studentNo; addUserFunction.FromAddress = "0xb8C8316D7a3B401a835461C0AaF926C0caF5eF89"; return(ContractHandler.SendRequestAndWaitForReceiptAsync(addUserFunction, default)); }
public Task <string> AddUserRequestAsync(string studentNo) { var addUserFunction = new AddUserFunction(); addUserFunction.StudentNo = studentNo; addUserFunction.FromAddress = "0xb8C8316D7a3B401a835461C0AaF926C0caF5eF89"; return(ContractHandler.SendRequestAsync(addUserFunction)); }
public async Task RegisterUsername() { try { string username; if (!_contractService.ContractDeployed("UserService")) { throw new Exception("The contract is not deployed"); } string contract_ad = _contractService.GetAddressDeployedContract("UserService"); do { Console.Write("No username registered, Please provide a username: "******"Registering username for {0} gas", gasprice.Value.ToString()); TransactionReceipt receipt = await _functionHandler.SendRequestAndWaitForReceiptAsync(contract_ad, addFunction); if (receipt.Failed()) { throw new Exception("Something went wrong"); } //Decode event //List<EventLog<>> events = receipt.DecodeAllEvents<> } catch (Exception e) { _logger.LogError("Something went wrong with the RegisterUsername function: {0}", e.Message); Console.WriteLine("Something went wrong with Registering a username"); Console.Beep(); System.Environment.Exit(1); } }
public Task <TransactionReceipt> AddUserRequestAndWaitForReceiptAsync(AddUserFunction addUserFunction, CancellationTokenSource cancellationToken = null) { return(ContractHandler.SendRequestAndWaitForReceiptAsync(addUserFunction, cancellationToken)); }
public Task <string> AddUserRequestAsync(AddUserFunction addUserFunction) { return(ContractHandler.SendRequestAsync(addUserFunction)); }