예제 #1
0
 def player_roll_dice(self, bet_size, chances, wallet_path, password,
                      gas_price):
     """
     Sending the bet to the smart contract requires signing a transaction
     which requires CPU computation to unlock the account, hence this
     is ran in a thread.
     """
     roll_screen = self.roll_screen
     try:
         Dialog.snackbar_message("Sending bet...")
         roll_screen.toggle_widgets(False)
         tx_hash = self.pyetheroll.player_roll_dice(bet_size, chances,
                                                    wallet_path, password,
                                                    gas_price)
     except (ValueError, ConnectionError) as exception:
         roll_screen.toggle_widgets(True)
         self.dialog_roll_error(exception)
         return
     roll_screen.toggle_widgets(True)
     self.dialog_roll_success(tx_hash)
예제 #2
0
 def create_account(self):
     """
     Creates an account from provided form.
     Verify we can unlock it.
     Disables widgets during the process, so the user doesn't try
     to create another account during the process.
     """
     self.toggle_widgets(False)
     if not self.verify_fields():
         Dialog.show_invalid_form_dialog()
         self.toggle_widgets(True)
         return
     password = self.new_password1
     Dialog.snackbar_message("Creating account...")
     controller = App.get_running_app().root
     account = controller.account_utils.new_account(password=password)
     Dialog.snackbar_message("Created!")
     self.toggle_widgets(True)
     self.on_account_created(account)
     # CreateNewAccount.try_unlock(account, password)
     self.show_redirect_dialog()
     self.load_landing_page()
     return account