def does_interchain_exist(blockchain: str, name: str) -> bool: """Check if a specific interchain exists Args: blockchain: the blockchain of the desired client (i.e. bitcoin, ethereum, etc) name: the name (id) of the network to get (user defined on the creation of the interchain) """ if blockchain == "bitcoin": return storage.does_object_exist(f"{FOLDER}/bitcoin/{name}") elif blockchain == "ethereum": return storage.does_object_exist(f"{FOLDER}/ethereum/{name}") else: return False
def sanity_check_empty_chain() -> None: """Checks that no blocks exist in storage This is for sanity checking to ensure that we don't start overwriting blocks if an earlier call for previous block failed. Does not return, just throws exceptions if Block 1 already exists (or an if an error occurs while checking) """ if storage.does_object_exist("BLOCK/1"): raise exceptions.SanityCheckFailure("Block 1 already exists!")
def contract_does_exist(contract_id: str) -> bool: """Checks if a contract exists or not""" return storage.does_object_exist(f"{FOLDER}/{contract_id}/metadata.json")
def test_does_object_exist_calls_storage_does_object_exist_with_params( self): storage.does_object_exist("prefix") storage.storage.does_object_exist.assert_called_once_with( "test", "prefix")