def test_get_set_stored_gas_price(self): """Checks default stored gas price and set method.""" # checks default assert Settings.get_stored_gas_price() == 4 # checks set Settings.set_stored_gas_price(42) assert Settings.get_stored_gas_price() == 42
def load_settings(self): """Load json store settings to UI properties.""" self.is_stored_mainnet = Settings.is_stored_mainnet() self.is_stored_testnet = Settings.is_stored_testnet() self.stored_gas_price = Settings.get_stored_gas_price() is_persistent_keystore = (Settings.is_persistent_keystore() and check_write_permission()) self.set_persist_keystore_switch_state(is_persistent_keystore)
def send(self, address, amount_eth): """Retrieves fields to complete the `transaction()` call.""" gas_price_gwei = Settings.get_stored_gas_price() account = self.current_account if account is None: self.on_account_none() return wallet_path = account.path password = self.get_account_password( account, lambda: self.send(address, amount_eth)) if password is not None: self.transaction(address, amount_eth, wallet_path, password, gas_price_gwei)
def roll(self): """ Retrieves bet parameters from user input and sends it as a signed transaction to the smart contract. """ roll_screen = self.roll_screen roll_input = roll_screen.get_roll_input() bet_size_eth = roll_input['bet_size'] chances = roll_input['chances'] gas_price_gwei = Settings.get_stored_gas_price() account = self.current_account if account is None: self.on_account_none() return wallet_path = account.path password = self.get_account_password(account, self.roll) if password is not None: self.player_roll_dice(bet_size_eth, chances, wallet_path, password, gas_price_gwei) # restarts roll polling service to reset the roll activity period self.start_services()