def run(self) -> None: """Execute the Ethereum Client installation step. TODO: This is a stub. """ if self.meta['raiden']['use_remote']: print( 'Using a remote client - skipping download and installation of local ethereum client.' ) return eth_client = user_input("Use local eth client? [Yes/no]", default='yes', options=['yes', 'no']) if eth_client == 'no': self.download_binary() self.install_binary() make_symlink = user_input( "Create a symbolic link at /usr/local/bin for the Ethereum client? [Yes/no]", default='yes', options=['yes', 'no'], short_hand=True) if make_symlink == 'yes': create_symlink(self.binary, 'Ethereum Client') desktop_icon = user_input( 'Would you like to create a desktop icon for the Ethereum client?', default='yes', options=['yes', 'no'], short_hand=True) if desktop_icon == 'yes': create_desktop_icon(self.binary, 'Ethereum Client') else: self.binary = user_input( 'Please specify the path to the eth client: [/usr/local/bin/geth]', default=GETH_META.BIN_PATH, short_hand=True) # Determine which connection method we should use. connection_method = user_input( "Your selection: [1]", default=1, options=[ 'Connect to Infura', 'Connect to an existing Ethereum Client', 'Connect to an existing Raiden Client (launches WebUI after installation)', 'Use local Ethereum Client and synchronize network', 'Install a private chain' ]) if connection_method == 5: self.install_private_chain() else: self.configure_client(connection_method)
def run(self): """Execute the account creation step. TODO This is a stub. """ # Determine if we need to setup a new account for the user create_account = user_input("Your selection: [1]", default=1, options={ '1': 'Use existing Ethereum user account', '2': 'Create a new Ethereum account' }) if create_account: self.setup_account() else: self.account = user_input("Please specify the account to use:")
def token_acquisition(self): """Execute the token acquisition step. TODO: This is a stub. """ if is_testnet(self.network): token = user_input('Specify a token to acquire:') self.acquire_token(token) else: # Skipping token acquisition for Main network. pass
def run(self): """Execute the Raiden client installation step. We download the binary from the download url specified in :attr:`RAIDEN_META.DOWNLOAD_URL` and place it in `<INSTALL DIR>/download`, and unpack the archive; the resulting binary is copied to `<INSTALL DIR>/bin`. Once this is done, we ask the user if a symbolic link should be created in :attr:`PATHS.USR_BIN_DIR`, and if so, create it. We repeat the procedure for a desktop icon linking to the installed binary. Next, we determine which network the user would like to connect to. Their input is used to configure the raiden client appropriately. Finally, we show the 'Safe Usage Requirements' to the user, and have them confirm that they read it. Once this is happens, the step is complete and we return. """ # Download the binary self.download_binary() # Copy binary to the directory specified in self.install_dir. self.install_binary() # Configure the client network = user_input( f'Please choose a network to connect to: [{NETWORKS.ROPSTEN}]', default=NETWORKS.ROPSTEN, options=[NETWORKS.ROPSTEN, NETWORKS.KOVAN, NETWORKS.RINKEBY]) self.use_remote = yes_no_input( 'Would you like to use a remote client? [Yes/no]') self.configure_client(network, self.use_remote) # Determine whether or not we should create a symbolic link and desktop icon # for the raiden client. symbolic_link = yes_no_input( "Add a symbolic link to /usr/local/bin for Raiden?") if symbolic_link: create_symlink(self.binary, 'raiden', flags=self.execution_flags) self.symlink_created = symbolic_link desktop_icon = yes_no_input( 'Would you like to create a desktop icon for the Raiden client?') if desktop_icon: create_desktop_icon(self.binary, 'raiden') self.icon_created = desktop_icon
def configure_client(self, network: str, remote: bool = True) -> None: """configure the client to use the given `network`. If `remote=True` is passed, we connect to the network via a remote node. Settings, such as the path to the keystore and the RPC url are required from the user. TODO: Support remote nodes other than Infura TODO: Support local clients """ if remote: infura_token = user_input( 'Please enter your Infura Access Token: ') rpc_endpoint = f'https://{network}.infura.io/v3/{infura_token}' keystore = user_input( 'Please enter the path to your keystore: [~/.ethereum/testnet/keystore]: ', default='~/.ethereum/testnet/keystore', ) self.execution_flags = [ f'--keystore-path {keystore}', f'--eth-rpc-endpoint {rpc_endpoint}' ] else: raise NotImplementedError
import pathlib from raideninstaller.steps import ( RaidenInstallationStep, EthClientInstallationStep, AccountSetupStep, AccountFundingStep, TokenAcquisitionStep, ) from raideninstaller.utils import user_input from raideninstaller.constants import STRINGS, PATHS # Choose a default installation directory tar_dir = user_input( f"Choose a installation directory: [{PATHS.DEFAULT_INSTALL_DIR}]", default=PATHS.DEFAULT_INSTALL_DIR, ) install_root_path = pathlib.Path(tar_dir) # Create directories for installing. install_root_path.mkdir(exist_ok=True, parents=True) download_cache_dir = install_root_path.joinpath('cache') binary_dir = install_root_path.joinpath('bin') ################################################################################ # Install the Raiden Client ################################################################################ print(f'{STRINGS.STEP_1}\n') with RaidenInstallationStep(install_root_path) as step: step.run()