def transaction(self, to, amount_eth, wallet_path, password, gas_price_gwei): """Converts input parameters for the underlying library.""" value = int(amount_eth * 1e18) gas_price_wei = int(gas_price_gwei * 1e9) to = to_checksum_address(to) Dialog.snackbar_message("Sending transaction...") tx_hash = self.pyetheroll.transaction(to, value, wallet_path, password, gas_price_wei) self.dialog_transaction_success(tx_hash)
def player_roll_dice(self, bet_size_eth, chances, wallet_path, password, gas_price_gwei): """ 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) bet_size_wei = int(bet_size_eth * 1e18) gas_price_wei = int(gas_price_gwei * 1e9) tx_hash = self.pyetheroll.player_roll_dice(bet_size_wei, chances, wallet_path, password, gas_price_wei) 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)
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