예제 #1
0
def create_app(settings_name: str, additional_handlers: list) -> Application:
    log.info("Starting web server")

    handlers = [
        url(r"/", IndexHandler, name="index"),
        url(r"/setup/(.*)", SetupHandler, name="setup"),
        url(r"/create_wallet", WalletCreationHandler, name="create_wallet"),
        url(r"/account/(.*)", AccountDetailHandler, name="account"),
        url(r"/keystore/(.*)/(.*)", KeystoreHandler, name="keystore"),
        url(r"/launch/(.*)", LaunchHandler, name="launch"),
        url(r"/gas_price/(.*)", GasPriceHandler, name="gas_price"),
        url(
            r"/api/configuration/(.*)",
            ConfigurationItemAPIHandler,
            name="api-configuration-detail",
        ),
    ]

    settings = load_settings(settings_name)

    return Application(handlers + additional_handlers,
                       debug=DEBUG,
                       static_path=os.path.join(RESOURCE_FOLDER_PATH,
                                                "static"),
                       template_path=os.path.join(RESOURCE_FOLDER_PATH,
                                                  "templates"),
                       installer_settings=settings)
예제 #2
0
    def load(cls, file_path: Path):
        file_name, _ = os.path.splitext(os.path.basename(file_path))

        _, _, settings_name = file_name.split("-")

        try:
            settings = load_settings(settings_name)
        except FileNotFoundError as exc:
            raise ValueError(
                f"There are no Wizard settings {settings_name} for Raiden configuration {file_path}"
            )

        with file_path.open() as config_file:
            data = toml.load(config_file)
            keystore_file_path = Account.find_keystore_file_path(
                to_canonical_address(data["address"]),
                Path(data["keystore-path"]))
            if keystore_file_path is None:
                raise ValueError(
                    f"{data['keystore-path']} does not contain the account file for config {file_path}"
                )
            return cls(
                account_filename=keystore_file_path,
                ethereum_client_rpc_endpoint=data["eth-rpc-endpoint"],
                settings=settings,
                routing_mode=data["routing-mode"],
                enable_monitoring=data["enable-monitoring"],
                _initial_funding_txhash=data.get("_initial_funding_txhash"),
            )
예제 #3
0
 def setUp(self):
     self.settings = load_settings("mainnet")
     self.service_token = Erc20Token.find_by_ticker(
         self.settings.service_token.ticker,
         self.settings.network
     )
     self.transfer_token = Erc20Token.find_by_ticker(
         self.settings.transfer_token.ticker,
         self.settings.network
     )
예제 #4
0
    def setUp(self):
        RaidenConfigurationFile.FOLDER_PATH = TESTING_TEMP_FOLDER.joinpath(
            "config")

        self.account = Account.create(TESTING_KEYSTORE_FOLDER,
                                      passphrase="test_raiden_config")
        self.network = Network.get_by_name("goerli")
        self.settings = load_settings("demo_env")

        self.configuration_file = RaidenConfigurationFile(
            self.account.keystore_file_path,
            self.settings,
            "http://localhost:8545",
        )
예제 #5
0
 def settings(self, settings_name):
     return load_settings(settings_name)
예제 #6
0
 def test_cannot_get_config_for_different_settings(self):
     self.configuration_file.save()
     settings = load_settings("mainnet")
     all_configs = RaidenConfigurationFile.get_available_configurations(
         settings)
     self.assertEqual(len(all_configs), 0)