def _run_setup(self, **kw): form = QuickSetupForm(endpoint=kw.get("endpoint")) if form.validate(): self._send_status_update( "Generating new wallet and configuration file for raiden") network = Network.get_by_name(form.data["network"]) url_or_infura_id = form.data["endpoint"].strip() if Infura.is_valid_project_id(url_or_infura_id): ethereum_rpc_provider = Infura.make(network, url_or_infura_id) else: ethereum_rpc_provider = EthereumRPCProvider(url_or_infura_id) account = Account.create() conf_file = RaidenConfigurationFile( account, network, ethereum_rpc_provider.url, routing_mode="pfs" if form.data["use_rsb"] else "local", enable_monitoring=form.data["use_rsb"], ) conf_file.save() if network.FAUCET_AVAILABLE: self._run_funding(configuration_file=conf_file) self._send_redirect( self.reverse_url("launch", conf_file.file_name)) else: self._send_redirect( self.reverse_url("account", conf_file.file_name)) else: self._send_error_message( f"Failed to create account. Error: {form.errors}")
def get_ethereum_rpc_endpoints(cls): endpoints = [] config_glob = glob.glob(cls.FOLDER_PATH.joinpath("*.toml")) for config_file_path in config_glob: with open(config_file_path) as config_file: data = toml.load(config_file) endpoints.append(EthereumRPCProvider.make_from_url(data["eth-rpc-endpoint"])) return endpoints
def _run_setup(self, **kw): account_file = kw.get("account_file") account = Account(account_file) passphrase_path = RaidenConfigurationFile.FOLDER_PATH.joinpath( f"{account.address}.passphrase.txt") passphrase_file = PassphraseFile(passphrase_path) passphrase = passphrase_file.retrieve() account.passphrase = passphrase form = QuickSetupForm(endpoint=kw.get("endpoint"), network=kw.get("network")) if form.validate(): self._send_status_update( "Generating new wallet and configuration file for raiden") network = Network.get_by_name(form.data["network"]) url_or_infura_id = form.data["endpoint"].strip() if Infura.is_valid_project_id_or_endpoint(url_or_infura_id): ethereum_rpc_provider = Infura.make(network, url_or_infura_id) else: ethereum_rpc_provider = EthereumRPCProvider(url_or_infura_id) try: check_eth_node_responsivity(ethereum_rpc_provider.url) except ValueError as e: self._send_error_message(f"Ethereum node unavailable: {e}.") return conf_file = RaidenConfigurationFile( account, network, ethereum_rpc_provider.url, routing_mode="pfs" if form.data["use_rsb"] else "local", enable_monitoring=form.data["use_rsb"], ) conf_file.save() if network.FAUCET_AVAILABLE: self._run_funding(configuration_file=conf_file) self._send_redirect( self.reverse_url("launch", conf_file.file_name)) else: self._send_redirect( self.reverse_url("account", conf_file.file_name)) else: self._send_error_message( f"Failed to create account. Error: {form.errors}")
def prompt_new_ethereum_rpc_endpoint(network=None): global ETHEREUM_RPC_ENDPOINTS if network is None: network = prompt_network_selection() ethereum_rpc_questions = [ { "name": "will_use_infura", "type": "confirm", "default": True, "message": Messages.input_use_infura, }, { "name": "infura_project_id", "type": "input", "message": Messages.input_ethereum_infura_project_id, "when": lambda answers: answers["will_use_infura"], "filter": lambda answer: answer.strip(), "validator": InfuraProjectIdValidator, }, { "name": "ethereum_rpc_endpoint", "type": "input", "message": Messages.input_ethereum_rpc_endpoint, "when": lambda answers: not answers["will_use_infura"], }, ] ethereum_rpc_answers = validate_prompt(ethereum_rpc_questions) if ethereum_rpc_answers["will_use_infura"]: project_id = ethereum_rpc_answers["infura_project_id"] client_rpc_endpoint = Infura.make(network, project_id) else: client_rpc_endpoint = EthereumRPCProvider( ethereum_rpc_answers["ethereum_rpc_endpoint"]) ETHEREUM_RPC_ENDPOINTS.append(client_rpc_endpoint) return client_rpc_endpoint
def _run_setup(self, **kw): account_file = kw.get("account_file") account = Account(account_file, passphrase=get_passphrase()) form = QuickSetupForm(endpoint=kw.get("endpoint"), network=kw.get("network")) if form.validate(): self._send_status_update( "Generating new wallet and configuration file for raiden") network = Network.get_by_name(form.data["network"]) url_or_infura_id = form.data["endpoint"].strip() if Infura.is_valid_project_id_or_endpoint(url_or_infura_id): ethereum_rpc_provider = Infura.make(network, url_or_infura_id) else: ethereum_rpc_provider = EthereumRPCProvider(url_or_infura_id) try: check_eth_node_responsivity(ethereum_rpc_provider.url) except ValueError as e: self._send_error_message(f"Ethereum node unavailable: {e}.") return conf_file = RaidenConfigurationFile( account.keystore_file_path, self.installer_settings, ethereum_rpc_provider.url, routing_mode=self.installer_settings.routing_mode, enable_monitoring=self.installer_settings.monitoring_enabled, ) conf_file.save() self._send_redirect( self.reverse_url("account", conf_file.file_name)) else: self._send_error_message( f"Failed to create account. Error: {form.errors}")