def _run_launch(self, **kw): configuration_file_name = kw.get("configuration_file_name") configuration_file = RaidenConfigurationFile.get_by_filename( configuration_file_name) account = configuration_file.account try_unlock(account) if account.passphrase is None: self._send_error_message( "Failed to unlock account! Please reload page") return raiden_client = RaidenClient.get_client(self.installer_settings) if not raiden_client.is_installed: self._send_status_update( f"Downloading and installing raiden {raiden_client.release}") raiden_client.install() self._send_status_update("Installation complete") self._send_status_update( "Launching Raiden, this might take a couple of minutes, do not close the browser" ) with temporary_passphrase_file(get_passphrase()) as passphrase_file: if not raiden_client.is_running: raiden_client.launch(configuration_file, passphrase_file) try: raiden_client.wait_for_web_ui_ready( status_callback=lambda stat: log.info(str(stat))) self._send_task_complete("Raiden is ready!") self._send_redirect(RaidenClient.WEB_UI_INDEX_URL) except (RaidenClientError, RuntimeError) as exc: self._send_error_message( f"Raiden process failed to start: {exc}") raiden_client.kill()
def _run_launch(self, **kw): configuration_file_name = kw.get("configuration_file_name") configuration_file = RaidenConfigurationFile.get_by_filename( configuration_file_name) network_name = configuration_file.network.name raiden_client = RaidenClient.get_client(network_name) required = RequiredAmounts.for_network(network_name) if not raiden_client.is_installed: self._send_status_update( f"Downloading and installing raiden {raiden_client.release}") raiden_client.install() self._send_status_update("Installation complete") account = configuration_file.account w3 = make_web3_provider( configuration_file.ethereum_client_rpc_endpoint, account) service_token = Erc20Token.find_by_ticker( required.service_token.ticker, network_name) service_token_balance = get_token_balance(w3=w3, account=account, token=service_token) service_token_in_deposit = get_token_deposit(w3=w3, account=account, token=service_token) if service_token_balance.as_wei and service_token_in_deposit < required.service_token: self._send_status_update( f"Making deposit of {service_token_balance.formatted} for Raiden Services" ) deposit_service_tokens(w3=w3, account=account, token=service_token, amount=service_token_balance.as_wei) service_token_deposited = get_token_deposit(w3=w3, account=account, token=service_token) self._send_status_update( f"Amount deposited at UDC: {service_token_deposited.formatted}" ) self._send_status_update( "Launching Raiden, this might take a couple of minutes, do not close the browser" ) if not raiden_client.is_running: raiden_client.launch(configuration_file) try: raiden_client.wait_for_web_ui_ready( status_callback=lambda stat: log.info(str(stat))) self._send_task_complete("Raiden is ready!") self._send_redirect(raiden_client.WEB_UI_INDEX_URL) except (RaidenClientError, RuntimeError) as exc: self._send_error_message(f"Raiden process failed to start: {exc}") raiden_client.kill()
def _run_launch(self, **kw): configuration_file_name = kw.get("configuration_file_name") configuration_file = RaidenConfigurationFile.get_by_filename( configuration_file_name) network_name = configuration_file.network.name raiden_client = RaidenClient.get_client(network_name) if not raiden_client.is_installed: self._send_status_update( f"Downloading and installing raiden {raiden_client.release}") raiden_client.install() self._send_status_update("Installation complete") account = configuration_file.account try_unlock(account) if account.passphrase is None: return self.render( "account_unlock.html", keystore_file_path=account.keystore_file_path, return_to=f"/launch/{configuration_file_name}", ) self._send_status_update( "Launching Raiden, this might take a couple of minutes, do not close the browser" ) with temporary_passphrase_file(PASSPHRASE) as passphrase_file: if not raiden_client.is_running: raiden_client.launch(configuration_file, passphrase_file) try: raiden_client.wait_for_web_ui_ready( status_callback=lambda stat: log.info(str(stat))) self._send_task_complete("Raiden is ready!") self._send_redirect(raiden_client.WEB_UI_INDEX_URL) except (RaidenClientError, RuntimeError) as exc: self._send_error_message( f"Raiden process failed to start: {exc}") raiden_client.kill()
from raiden_contracts.constants import CONTRACT_USER_DEPOSIT from raiden_installer.account import Account from raiden_installer.base import RaidenConfigurationFile from raiden_installer.ethereum_rpc import EthereumRPCProvider, Infura, make_web3_provider from raiden_installer.raiden import RaidenClient from raiden_installer.network import FundingError, Network from raiden_installer.token_exchange import Exchange from raiden_installer.tokens import Erc20Token, Wei, TokenAmount from raiden_installer.utils import get_contract_address ETHEREUM_RPC_ENDPOINTS = [] DEFAULT_INFURA_PROJECT_ID = os.getenv("RAIDEN_INSTALLER_INFURA_PROJECT_ID") DEFAULT_NETWORK = Network.get_default() RELEASE_MAP = RaidenClient.get_all_releases() if DEFAULT_INFURA_PROJECT_ID: ETHEREUM_RPC_ENDPOINTS.append( Infura.make(DEFAULT_NETWORK, DEFAULT_INFURA_PROJECT_ID)) class Messages: action_launch_raiden = "Launch raiden" action_account_create = "Create new ethereum account" action_account_list = "List existing ethereum accounts" action_account_fund = "Add funds to account" action_configuration_setup = "Create new raiden setup" action_configuration_list = "List existing raiden setups" action_release_manager = "Install/Uninstall raiden releases" action_release_list_installed = "List installed raiden releases"
get_total_token_owned, get_token_deposit, mint_tokens, ) DEBUG = "RAIDEN_INSTALLER_DEBUG" in os.environ PORT = 8080 AVAILABLE_NETWORKS = [ Network.get_by_name(n) for n in ["mainnet", "ropsten", "goerli"] ] NETWORKS_WITH_TOKEN_SWAP = [ Network.get_by_name(n) for n in ["mainnet", "ropsten"] ] DEFAULT_NETWORK = Network.get_default() RAIDEN_CLIENT = RaidenClient.get_client() RESOURCE_FOLDER_PATH = get_resource_folder_path() class QuickSetupForm(Form): network = wtforms.HiddenField("Network", default=DEFAULT_NETWORK.name) use_rsb = wtforms.HiddenField("Use Raiden Service Bundle", default=settings.monitoring_enabled) endpoint = wtforms.StringField("Infura Project ID/RPC Endpoint") def validate_network(self, field): network_name = field.data if network_name not in [n.name for n in AVAILABLE_NETWORKS]: raise wtforms.ValidationError( f"Can not run quick setup raiden with {network_name}")