Exemplo n.º 1
0
def create_ethereum_interchain_v1(user_data: Dict[str, Any], conflict_check: bool = True) -> Dict[str, Any]:
    client = eth.new_from_user_input(user_data)
    if conflict_check and interchain_dao.does_interchain_exist("ethereum", client.name):
        _log.error("Ethereum network is already registered")
        raise exceptions.InterchainConflict(f"An ethereum interchain network with the name {client.name} is already registered")
    interchain_dao.save_interchain_client(client)
    return _get_output_dto_v1(client)
Exemplo n.º 2
0
def create_bitcoin_interchain_v1(user_data: Dict[str, Any]) -> Dict[str, Any]:
    client = btc.new_from_user_input(user_data)
    if interchain_dao.does_interchain_exist("bitcoin", client.name):
        _log.error("Bitcoin network is already registered")
        raise exceptions.InterchainConflict(
            f"A bitcoin interchain network with the name {client.name} is already registered"
        )
    interchain_dao.save_interchain_client(client)
    return _get_output_dto_v1(client)
 def test_does_interchain_exist_returns_false_with_bad_blockchain(self):
     self.assertFalse(
         interchain_dao.does_interchain_exist("badblockchaintype",
                                              "whatever"))
 def test_does_interchain_exist_returns_false(self, mock_exist):
     self.assertFalse(
         interchain_dao.does_interchain_exist("bitcoin", "whatever"))
     self.assertFalse(
         interchain_dao.does_interchain_exist("ethereum", "whatever"))